Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
92 commits
Select commit Hold shift + click to select a range
d7f3ec1
chore(vendor): bump tinyagents submodule
senamakel Oct 27, 2026
613669a
chore(vendor): bump tinyagents submodule
senamakel Oct 27, 2026
74bb051
chore(vendor): bump tinyagents submodule
senamakel Oct 27, 2026
3cd4e3e
chore(vendor): bump tinyagents submodule
senamakel Oct 27, 2026
846ee7f
chore(vendor): bump tinyagents submodule
senamakel Oct 27, 2026
ea432a9
chore(vendor): bump tinyagents submodule
senamakel Oct 27, 2026
360ebaa
test(inference): add summarizer turn model tests
senamakel Oct 27, 2026
e47b4be
test(inference): wire summarizer tests into turn model suite
senamakel Oct 27, 2026
ab047b0
feat(inference): expose summarizer model id on turn models
senamakel Oct 27, 2026
77b3346
chore(deps): downgrade tinyagents crates to 3.0.0 and pin windows deps
senamakel Oct 27, 2026
37aaa76
test(memory): cover per-turn recall deadline and exclusion behaviour
senamakel Oct 27, 2026
fe14e96
test(memory): await pre_turn calls in prefetch tests
senamakel Oct 27, 2026
250ab1e
feat(memory): add per-turn recall exclusion hook
senamakel Oct 27, 2026
3c1bd07
test(embed): add memory recall each turn test
senamakel Oct 27, 2026
dd83464
test(embed): drop runtime instead of awaiting shutdown in recall test
senamakel Oct 27, 2026
cd3b514
feat(agent): add per-turn memory recall timeout to memory binding
senamakel Oct 27, 2026
4b44099
chore(vendor): bump tinyagents submodule
senamakel Oct 27, 2026
effbbdb
chore: bump tinyagents submodule and drop unused test import
senamakel Oct 27, 2026
09beca2
test(memory): update prefetch call sites for new async signature
senamakel Oct 27, 2026
9dcf359
test(memory): await pre_turn inside async block in prefetch test
senamakel Oct 28, 2026
4d30c50
feat(memory): wait for per-turn recall when each_turn is set
senamakel Oct 28, 2026
d2f1c72
feat(inference): route summarization to configured summarizer model
senamakel Oct 28, 2026
951159e
feat(inference): honour configured summarizer model for compaction
senamakel Oct 28, 2026
81485b7
refactor(inference): rename summarizer_model_id to choose_summarizer_…
senamakel Oct 28, 2026
968e980
fix(inference): pin configured summarizer model on managed route
senamakel Oct 28, 2026
040b862
test(memory): cover session store provider in recall-each-turn test
senamakel Oct 28, 2026
c05fa01
feat(memory): add per-turn recall timeout binding
senamakel Oct 28, 2026
be743f6
fix(inference): pin the primary model as the summarizer
senamakel Oct 28, 2026
b8353a9
test(embed): keep agent handles alive until runtime teardown
senamakel Oct 28, 2026
8e1021d
fix(inference): use resolved summarizer model id for summarization
senamakel Oct 28, 2026
6d196fa
feat(agent): thread summarizer model id into compaction wiring
senamakel Oct 28, 2026
d7906c4
test(tinyagents): cover summarizer model in compaction provenance
senamakel Oct 28, 2026
5faf2a5
feat(memory): add deadline-bounded recall of the current message
senamakel Oct 28, 2026
c667097
feat(memory): add optional per-turn recall timeout to memory binding
senamakel Oct 28, 2026
3147ead
fix(tinyagents): use summarizer model id in compression summarizers
senamakel Oct 28, 2026
26dfaa6
docs(context): document summarizer_model override for compaction
senamakel Oct 28, 2026
f8cd6e2
test(inference): serialize summarizer pinning test with inference guard
senamakel Oct 28, 2026
39fb7d9
refactor(inference): simplify summarizer model routing and drop unuse…
senamakel Oct 28, 2026
030bd9e
feat(inference): gate harness model builds and allow per-request mode…
senamakel Oct 28, 2026
d5b5309
test(prefetch): split recall-each-turn tests into their own module
senamakel Oct 28, 2026
862d824
test(memory): reorder imports in prefetch recall each turn tests
senamakel Oct 28, 2026
1969a6b
test(prefetch): reformat test lock initializer
senamakel Oct 28, 2026
ad8970e
test(config): cover summarizer env overlay and context table parsing
senamakel Oct 28, 2026
c07f411
feat(config): add summarizer settings to the context table
senamakel Oct 28, 2026
4c1d67e
fix(session-host): use harness context config when building sessions
senamakel Oct 28, 2026
b840e6d
fix(config): apply summarizer env overlay during config load
senamakel Oct 28, 2026
55e9bb4
feat(config): add env overrides for summarizer rendering and output cap
senamakel Oct 28, 2026
ed0feda
test(memory): add tests for memory block lifecycle
senamakel Oct 28, 2026
fcaa41f
feat(memory): add memory_block module to lifecycle
senamakel Oct 28, 2026
b3ca309
refactor(memory): extract session memory identity and readability hel…
senamakel Oct 28, 2026
6cdacef
test(tinyagents): cover markers compaction tool rendering and output cap
senamakel Oct 28, 2026
e37e7ed
feat(agent-registry): add optional memory block to agent extensions
senamakel Oct 28, 2026
baa0609
test(session-host): add memory block tests for runtime session
senamakel Oct 28, 2026
4c29468
feat(session-host): expose memory block helper from runtime session
senamakel Oct 28, 2026
8ad1538
refactor(session_host): expose memory_block module to parent scope
senamakel Oct 28, 2026
de0b2a2
test(session-host): cover memory block for generations outside a turn
senamakel Oct 28, 2026
ce56c03
refactor(tinyagents): bundle compaction summarizer config into a struct
senamakel Oct 28, 2026
4556023
refactor(tinyagents): bundle compaction summarizer model, id and sett…
senamakel Oct 28, 2026
7529cbf
chore(tinyagents): widen context_wiring visibility to pub(crate)
senamakel Oct 28, 2026
222936d
feat(memory): render long-term memory block from beliefs and learnings
senamakel Oct 28, 2026
94a6c58
fix(session-host): exclude memory block from prompt refresh comparison
senamakel Oct 28, 2026
c0a9b41
docs(session-host): correct prompt refresh source count in module docs
senamakel Oct 28, 2026
cc2e742
test(embed): add memory block tests
senamakel Oct 28, 2026
d57ce10
test(embed): use unavailable error in memory block test
senamakel Oct 28, 2026
beab807
feat(agent): add memory block spec to agent definitions
senamakel Oct 28, 2026
40870ce
test(embed): add compact thread integration test
senamakel Oct 28, 2026
ed0ed81
test(compact_thread): rename Provider2 to ScriptedProvider
senamakel Oct 28, 2026
80f0c78
feat(memory): refresh memory block on prompt refresh
senamakel Oct 28, 2026
caee4bb
test(agent): cover memory block inheritance in core definitions
senamakel Oct 28, 2026
9372271
docs(memory): document the memory block in the system prompt
senamakel Oct 28, 2026
3a1f39a
style(tests): reformat long expressions to satisfy line width
senamakel Oct 28, 2026
062ef88
feat(agent): add idle history compaction outside a turn
senamakel Oct 28, 2026
43d1a7e
docs(tinyagents): clarify idle fold tail cap and test intent
senamakel Oct 28, 2026
9d66217
feat(agent): add runtime session compaction
senamakel Oct 28, 2026
50fd5cc
feat(session_host): expose compaction options and outcome types
senamakel Oct 28, 2026
32bf0f5
feat(agent_chat): add thread compaction entry point
senamakel Oct 28, 2026
804d684
feat(agent): add conversation compaction options and outcome types
senamakel Oct 28, 2026
4462f6e
test(embed): surface the error when skipped compaction fails
senamakel Oct 28, 2026
d384c91
fix(agent_chat): apply turn overrides when compacting a thread
senamakel Oct 28, 2026
05fdd00
chore(agent_chat): drop stale clippy allow on compact_thread_for
senamakel Oct 28, 2026
85b3e39
refactor(agent): extract per-call inference route into shared helper
senamakel Oct 28, 2026
548a5e8
test(compact_thread): dump messages after compaction for debugging
senamakel Oct 28, 2026
8e3a77f
test(embed): tighten compact thread assertions
senamakel Oct 28, 2026
b38c996
chore: apply rustfmt formatting to compact thread code
senamakel Oct 28, 2026
ebf6daa
test(compact_thread): cover memory block refresh across compaction
senamakel Oct 28, 2026
2e0a949
fix(session_host): render fresh memory block when compacting
senamakel Oct 28, 2026
f98bb2a
test(embed): reformat compact thread assertions
senamakel Oct 28, 2026
ad563be
docs(embed): document compacting a thread while idle
senamakel Oct 28, 2026
6a46ecd
docs(context): document ContextSettings and out-of-turn compaction
senamakel Oct 28, 2026
65436be
docs(embed): document compact_thread and new API types
senamakel Oct 28, 2026
96f41af
chore(vendor): bump tinyagents submodule
senamakel Oct 28, 2026
fb3bbeb
Move tinyagents to the merged summarizer change (tinyagents#587)
senamakel Oct 28, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 13 additions & 1 deletion crates/openhuman-core/src/agent/context/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ No `store.rs`. State is per-session and in-memory:

## Dependencies

- `crate::config`: `ContextConfig` ([`config/schema/context.rs`](../../config/schema/context.rs)): `enabled`, `microcompact_enabled` / `microcompact_keep_recent`, `autocompact_enabled`, `compaction_trigger_tokens` (absolute summarization trigger for benchmarks; env `OPENHUMAN_COMPACTION_TRIGGER_TOKENS`), `compaction_strategy` (env `OPENHUMAN_COMPACTION_STRATEGY`), `compaction_enabled`, `tool_result_budget_bytes`, `prefer_markdown_tool_output`, `summarizer_model`, and the embedded `session_memory: SessionMemoryConfig`.
- `crate::config`: `ContextSettings` ([`config/schema/context.rs`](../../config/schema/context.rs)), the whole `[context]` table: TinyAgents' `ContextConfig` flattened (reached through `Deref`, so `config.context.<field>` reads it) plus OpenHuman's `summarizer_tool_rendering` (`full` | `markers`; env `OPENHUMAN_CONTEXT_SUMMARIZER_TOOL_RENDERING`: `markers` sends the summarizer one `[used <tool>: …]` line per call and no tool results, for small summarization models) and `summarizer_max_output_tokens` (env `OPENHUMAN_CONTEXT_SUMMARIZER_MAX_OUTPUT_TOKENS`, `0` clears: the summary request's `max_tokens`). The free-form (`summary`) strategy applies both; `task_state` ignores them. `ContextConfig`: `enabled`, `microcompact_enabled` / `microcompact_keep_recent`, `autocompact_enabled`, `compaction_trigger_tokens` (absolute summarization trigger for benchmarks; env `OPENHUMAN_COMPACTION_TRIGGER_TOKENS`), `compaction_strategy` (env `OPENHUMAN_COMPACTION_STRATEGY`), `compaction_enabled`, `tool_result_budget_bytes`, `prefer_markdown_tool_output`, `summarizer_model` (env `OPENHUMAN_CONTEXT_SUMMARIZER_MODEL`: the model the compaction summarizer calls on the turn's own provider route; unset or blank uses the turn's model), and the embedded `session_memory: SessionMemoryConfig`.
- `crate::inference::provider::UsageInfo`: fed into `record_usage`.
- `crate::agent::prompts`: owns prompt rendering; `channels_prompt.rs` uses `inject_inline_content`.
- `crate::skills::Workflow`: `channels_prompt.rs` renders the available-skills section from a `&[Workflow]`.
Expand Down Expand Up @@ -88,3 +88,15 @@ The TinyAgents host maps configured context options into harness middleware.
Channel and agent prompts use `agent::prompts`; live transcript compaction and
tool-result clearing run in TinyAgents. This module owns no persistence,
controllers, tools, or event subscribers.

## Compacting outside a turn

`context_wiring::compact_history` drives the same compression middleware a
turn installs over one request with no model turn: its `before_model` folds
the history and its `after_agent` reports the folded transcript as a
`CompactionCarry`, which is applied to the history exactly as the session
driver applies a turn's. `OpenHumanSessionHost::compact_bound_history`
(`agent/session_host/runtime_session/compact.rs`) runs it on a bound thread's
head generation under the session's turn lock, then seals the head and opens
the next generation with the folded history, as a compacting turn's commit
does. The embed facade exposes it as `Agent::compact_thread`.
3 changes: 2 additions & 1 deletion crates/openhuman-core/src/agent/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,5 +75,6 @@ pub(crate) mod turn_policy;
pub(crate) mod turn_progress;
#[allow(unused_imports)]
pub use session_host::{
HostTools, HostTurnTools, OpenHumanSessionHost, SessionHostBuilder, TurnContext, TurnOverrides,
CompactOptions, CompactOutcome, HostTools, HostTurnTools, OpenHumanSessionHost,
SessionHostBuilder, TurnContext, TurnOverrides,
};
16 changes: 16 additions & 0 deletions crates/openhuman-core/src/agent/session_host/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,22 @@ the live state it renders changes, but never from integrations the session has
not read yet. A prompt that fails to render, or a recorded prompt of unknown
extent, keeps the recorded prompt. The recorded tool list is unaffected.

An agent whose definition sets `memory_block` ends its system prompt with
what long-term memory knows about the user, a `<memory>` … `</memory>`
system message after every static prompt byte
(`runtime_session/memory_block.rs`). The block belongs to the frozen prefix,
so it is rendered only when a transcript generation starts: a new thread, a
resumed thread recorded without one, a turn whose prefix changes anyway (a
replaced prompt, a changed permanent-tool catalogue), and the first turn of a
generation that carried its parent's block over unchanged (an in-turn or
out-of-band compaction). Every other turn re-sends the recorded block
verbatim. The block is excluded from the "did the prompt change" comparison
like the catalogue, so a memory change alone never seals a generation or adds
the note. Code that opens a generation outside a turn can put a fresh block
into the successor's prefix with
`OpenHumanSessionHost::memory_block_for_new_generation` and
`memory_block::with_memory_block`; without it the next turn renders one.

Compaction never erases history. It seals the current generation and opens
the next one, recording the sealed generation as the new one's parent; the
sealed file stays on disk. TinyAgents owns the generation chain and its
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ impl OpenHumanSessionHost {
.tool_dispatcher(tool_dispatcher)
.prompt_builder(prompt_builder)
.config(effective_agent_config)
.context_config(config.context.clone())
.context_config(config.context.harness.clone())
.model_name(model_name)
.model_vision(model_vision)
.temperature(effective_temperature)
Expand Down
1 change: 1 addition & 0 deletions crates/openhuman-core/src/agent/session_host/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ pub(crate) mod test_support;
pub use codec::OpenHumanTranscriptCodec;
pub type OpenHumanSessionHooks =
tinyagents_runtime::FnSessionHooks<crate::agent::tinyagents::host::OpenHumanRunContext>;
pub use runtime_session::{CompactOptions, CompactOutcome};
pub use types::{OpenHumanSessionHost, SessionHostBuilder, TurnOverrides};

// Re-export the duplicate-tool-spec guard for sibling harness modules
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@
//! transcripts, prefixes, snapshots, resume, and persistence.

mod bound_history;
mod compact;
pub use compact::{CompactOptions, CompactOutcome};
#[path = "runtime_session_enrichment.rs"]
mod enrichment;
pub(super) mod memory_block;
mod permanent;
mod post_commit;
#[path = "runtime_session/prelude.rs"]
Expand Down
Loading
Loading