Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

docs(agent): clarify session transcript boundary

Steven Enamakeld3736ea7931e
diff --git a/.sdd-progress.md b/.sdd-progress.md
index 9ad66dbdbe..0f5d6734b8 100644
--- a/.sdd-progress.md
+++ b/.sdd-progress.md
@@ -44,6 +44,15 @@ and direct `tinyinference_llm` streams. `Cargo.lock` drops only the now-unused
Fresh `cargo test -p tinyagents-session` again passed (60 unit tests plus one
doctest); full `openhuman --lib --no-run` remains blocked by unrelated
channels, tools, orchestration, cron, and inference fixture diagnostics.
+Session documentation/boundary remediation: complete pending the paired
+TinyAgents/OpenHuman commits. TinyAgents transcript and run-ledger docs are
+host-neutral and no longer link to host-private symbols. OpenHuman READMEs,
+the layout-migration rustdoc link, and the session plan name the direct
+`tinyagents_session::transcript` dependency. The host adapter has a focused
+cache-breakpoint round-trip assertion. `cargo test -p tinyagents-session
+transcript`, `cargo doc -p tinyagents-session --no-deps`, `pnpm docs:check`,
+and formatting pass; the focused OpenHuman test command is blocked before the
+new test by unrelated pre-existing test-compilation diagnostics.
Wave 2: complete (direct canonical imports, explicit recursive context, execution-scoped graph bindings including durable resume/retry, registry/definition split, integration fixtures, and full workspace gate; independent Terra reviews resolved).
Wave 3: complete in TinyAgents (all ten host capabilities, truthful unary/stream terminal lifecycle, parent-authority-preserving recursion, budget compression/accounting, and upstream Claude provider merge; independent Terra Gate 3 and merge reviews PASS).
Wave 4 Phase A: complete at OpenHuman commit 9baad52086 (canonical direct imports, behavior-free facade deletion, host-only conversion/tracing seams retained; independent Terra review PASS).
diff --git a/crates/openhuman-core/src/agent/agent_tests.rs b/crates/openhuman-core/src/agent/agent_tests.rs
index 596454a7f0..8b30179d52 100644
--- a/crates/openhuman-core/src/agent/agent_tests.rs
+++ b/crates/openhuman-core/src/agent/agent_tests.rs
@@ -337,5 +337,7 @@ mod agent_memory_attribution_tests;
mod agent_turn_loop_packed_tool_tests;
#[path = "agent_turn_loop_tests.rs"]
mod agent_turn_loop_tests;
+#[path = "messages_tests.rs"]
+mod messages_tests;
#[path = "pformat_tests.rs"]
mod pformat_tests;
diff --git a/crates/openhuman-core/src/agent/harness/README.md b/crates/openhuman-core/src/agent/harness/README.md
index 3498e5ed44..9022c764f7 100644
--- a/crates/openhuman-core/src/agent/harness/README.md
+++ b/crates/openhuman-core/src/agent/harness/README.md
@@ -40,7 +40,7 @@ iterations.
| Module | Role |
| --- | --- |
-| `session/` | `Agent`/`AgentBuilder`/`TurnOverrides` (`types.rs`), the fluent builder + `Agent::from_config` factory (`builder/`), the turn lifecycle (`turn/`: `context.rs`, `core*.rs`, `graph.rs`, `recall_lanes.rs`, `session_io*.rs`, `tools.rs`), transcript persistence + legacy migration (`transcript*.rs`, `migration.rs`, `turn_checkpoint.rs`). |
+| `session/` | `Agent`/`AgentBuilder`/`TurnOverrides` (`types.rs`), the fluent builder + `Agent::from_config` factory (`builder/`), the turn lifecycle (`turn/`: `context.rs`, `core*.rs`, `graph.rs`, `recall_lanes.rs`, `session_io*.rs`, `tools.rs`), host-side transcript persistence + legacy migration (`session_io/`, `migration.rs`, `turn_checkpoint.rs`). Durable transcript codecs and discovery live in `tinyagents_session::transcript`. |
| `subagent_runner/` | `run_subagent`/`SubagentRunOptions`/`SubagentRunError` and the build pipeline around the tinyagents graph: model resolution, tool filtering, sandbox/action-root narrowing, checkpoint/handback, transcript mirroring (`autonomous.rs`, `extract_tool.rs`, `handoff.rs`, `tool_prep.rs`, `ops/{provider,prompt,runner,graph,checkpoint,pause_checkpoint}.rs`). |
| `definition*.rs`, `builtin_definitions.rs`, `definition_loader.rs` | `AgentDefinition`/`AgentDefinitionRegistry`/`SandboxMode`/`ToolScope`/`PromptSource`/`ModelSpec`; loads built-ins from `crate::agent::registry::agents` and user TOML from the workspace/home `agents/` directory. |
| `fork_context.rs`, `sandbox_context.rs`, `spawn_depth_context.rs`, `task_recency_context.rs` | Transitional task-locals for legacy callers. Live TinyAgents tool dispatch receives `OpenHumanRunContext` directly for parent, attachments, dispatch, and usage. |
diff --git a/crates/openhuman-core/src/agent/harness/session/migration.rs b/crates/openhuman-core/src/agent/harness/session/migration.rs
index a543e95d11..ac416d4f38 100644
--- a/crates/openhuman-core/src/agent/harness/session/migration.rs
+++ b/crates/openhuman-core/src/agent/harness/session/migration.rs
@@ -10,8 +10,8 @@
//! From 0.53.5 onwards the source of truth is the *flat*
//! `session_raw/{stem}.jsonl` and the human-readable companion is
//! `sessions/{YYYY_MM_DD}/{stem}.md` — see
-//! [`super::transcript`] for the rationale (idle-thread resume
-//! becomes date-independent).
+//! [`tinyagents_session::transcript`] for the shared transcript format and
+//! date-independent resume discovery.
//!
//! `find_latest_transcript` ships a fallback that reads the legacy
//! layout when the flat dir is empty, so users upgrading don't lose
diff --git a/crates/openhuman-core/src/agent/learning/README.md b/crates/openhuman-core/src/agent/learning/README.md
index 6f36a54ad5..bc20a45c2d 100644
--- a/crates/openhuman-core/src/agent/learning/README.md
+++ b/crates/openhuman-core/src/agent/learning/README.md
@@ -100,7 +100,7 @@ These are subscriber registrations rather than a single `bus.rs`; subscriptions
- `tinymemory_api` — `provider::{MemoryProfile, ProfileFacet, FacetState, FacetType, UserState}` behind `FacetCache`, and the candidate taxonomy re-exported by `candidate.rs` (`learning::{CueFamily, FacetClass, LearningCandidate}`, `host::EvidenceRef`).
- `crate::memory` — the `Memory` trait + `MemoryCategory` for KV persistence (hooks, transcript ingest), `guard::MemoryGuard` and `ops::guard::active_memory_guard` for the facet store, and `memory::api::provider::MemoryProvider` / `api::types` for the enrichment document upsert.
- `crate::agent::hooks` — `PostTurnHook` / `TurnContext` / `ToolCallRecord` implemented by the three hooks.
-- `crate::agent::harness::session::transcript` — `SessionTranscript` parsing for transcript ingestion.
+- `tinyagents_session::transcript` — `SessionTranscript` parsing for transcript ingestion.
- `crate::inference::provider::create_chat_model_from_string_with_model_id` (profile summarisation) and `crate::inference::host_runtime::global` (local reflection route); `ReflectionHook` also accepts an optional `tinyinference_llm::model::ChatModel` for the cloud fallback.
- `crate::config` — `Config` / `LearningConfig` / `ReflectionSource` feature flags and `config::rpc` loader.
- `crate::agent::prompts` — `PromptContext` / `PromptSection` / `LearnedContextData` for prompt injection.
diff --git a/crates/openhuman-core/src/agent/messages.rs b/crates/openhuman-core/src/agent/messages.rs
index e8297ab3f4..87daccc16b 100644
--- a/crates/openhuman-core/src/agent/messages.rs
+++ b/crates/openhuman-core/src/agent/messages.rs
@@ -133,11 +133,12 @@ pub struct ChatMessage {
/// Ascending byte offsets into [`Self::content`] at which the provider may
/// place a prompt-cache breakpoint. Only meaningful on the system message.
///
- /// `skip_serializing` like `id` and `extra_metadata` above: these are a
- /// property of *this call*, derived from the freshly assembled prompt, and
- /// writing them into the JSONL transcript would persist offsets that stop
- /// matching the moment the prompt is rebuilt. `serde(default)` keeps every
- /// record already on disk loadable.
+ /// `skip_serializing` applies only to this host runtime shape: these are a
+ /// property of a provider call, not this type's wire representation. The
+ /// explicit adapter persists them in `TranscriptMessage` so a transcript
+ /// round trip remains lossless; a later host may still discard or rebuild
+ /// them when assembling its next prompt. `serde(default)` keeps existing
+ /// host-serialized records loadable.
#[serde(default, skip_serializing)]
pub cache_breakpoints: Vec<usize>,
}
diff --git a/crates/openhuman-core/src/agent/messages_tests.rs b/crates/openhuman-core/src/agent/messages_tests.rs
new file mode 100644
index 0000000000..a111437413
--- /dev/null
+++ b/crates/openhuman-core/src/agent/messages_tests.rs
@@ -0,0 +1,21 @@
+use super::*;
+
+#[test]
+fn transcript_adapter_round_trips_cache_breakpoints() {
+ let original = ChatMessage {
+ id: Some("message-1".to_string()),
+ role: "system".to_string(),
+ content: "system prompt".to_string(),
+ extra_metadata: None,
+ cache_breakpoints: vec![3, 7],
+ };
+
+ let durable = crate::agent::messages::transcript_message_from_chat(&original);
+ assert_eq!(durable.cache_breakpoints, vec![3, 7]);
+
+ let restored = crate::agent::messages::chat_message_from_transcript(durable);
+ assert_eq!(restored.id, original.id);
+ assert_eq!(restored.role, original.role);
+ assert_eq!(restored.content, original.content);
+ assert_eq!(restored.cache_breakpoints, original.cache_breakpoints);
+}
diff --git a/crates/openhuman-core/src/agent/session_import/README.md b/crates/openhuman-core/src/agent/session_import/README.md
index c043e655c5..7e3d881ed4 100644
--- a/crates/openhuman-core/src/agent/session_import/README.md
+++ b/crates/openhuman-core/src/agent/session_import/README.md
@@ -77,9 +77,8 @@ in `crates/openhuman-core/src/core/all.rs`.
## Used by
- `crates/openhuman-core/src/core/all.rs` — registers the controller.
-- `crates/openhuman-core/src/agent/harness/session/transcript.rs` — the
- legacy transcript readers (`read_transcript`, `read_transcript_legacy_md`)
- the importer converts from.
+- `tinyagents_session::transcript` — the legacy transcript readers
+ (`read_transcript`, `read_transcript_legacy_md`) the importer converts from.
- `crates/openhuman-core/src/agent/harness/session/turn/session_io/transcript_persist.rs`
— calls `live::write_live_turn` after each transcript write and
`live::shadow_read_compare` after each transcript load, both on background tasks.
diff --git a/docs/plans/migrate-agent-sessions-to-tinyagents-session.md b/docs/plans/migrate-agent-sessions-to-tinyagents-session.md
index 5b69a59f15..1c2800d336 100644
--- a/docs/plans/migrate-agent-sessions-to-tinyagents-session.md
+++ b/docs/plans/migrate-agent-sessions-to-tinyagents-session.md
@@ -60,7 +60,7 @@ implements only an adapter at the existing host boundary where conversion from
| Current OpenHuman source | Destination / action |
| --- | --- |
| `agent/harness/session/transcript/{types,jsonl,metadata,paths,reader,writer,legacy_md,markdown,thread_lookup}.rs` | Move/split into `tinyagents-session/src/transcript/`; preserve on-disk JSONL and legacy Markdown reader behavior. |
-| `agent/harness/session/transcript.rs` | Delete after consumers import `tinyagents_session::transcript` directly. |
+| Deleted transcript facade | Consumers import `tinyagents_session::transcript` directly; no OpenHuman forwarding module remains. |
| `agent/harness/session/transcript_history.rs` | Move generic history/read/locator traits and file implementation to `tinyagents-session/src/transcript/history.rs`; keep any OpenHuman message conversion adapter locally. |
| `agent/harness/session/runtime/resume.rs` | Split pure transcript-to-model replay/deduplication into session; keep `Agent` mutation and host message-log fallback in OpenHuman. |
| `agent/session_import/{convert,ops,live}.rs` | Move only pure descriptor/transcript conversion and generic source iteration; retain OpenHuman namespaces, controller/live backend wiring, run-ledger links, and memory import. |
@@ -114,8 +114,8 @@ backend import and memory namespace decisions as thin host calls around them.
**RED:** Add OpenHuman adapter tests proving its `ChatMessage` conversion
preserves tool calls/reasoning/usage and that an old transcript resumes without
-loss. Add a boundary check that fails on production imports from
-`agent::harness::session::transcript` after migration.
+loss. Add a boundary check that fails if production code restores an
+OpenHuman transcript forwarding facade.
**GREEN:** Update `agent/harness/session/**`, `agent/session_import/**`,
`agent/tinyagents/{journal,reaper,turn_runner}.rs`, and direct consumers to
diff --git a/vendor/tinyagents b/vendor/tinyagents
index 6cc9ef5a36..ea2a78842e 160000
--- a/vendor/tinyagents
+++ b/vendor/tinyagents
@@ -1 +1 @@
-Subproject commit 6cc9ef5a366f4c15fad012aed3c8a04743801810
+Subproject commit ea2a78842ec0fea6b7a0f5d1b42012c62d118a54