mirror of
https://github.com/tinyhumansai/openhuman.git
synced 2026-07-28 13:32:23 +00:00
3.6 KiB
3.6 KiB
description, icon
| description | icon |
|---|---|
| How much long-term memory the agent injects per session — Minimal / Balanced / Extended / Maximum presets. | memory |
Long-term memory window
User-facing setting that controls how much long-term memory OpenHuman injects into every new agent / orchestrator session.
What it changes
Two distinct injection paths share one preset so the user only has to make one choice:
- Recalled memory + working memory — the
[Memory context]and[User working memory]blocks built byDefaultMemoryLoader::load_contexton every turn. - Tree-summarizer root summaries — the per-namespace root summaries
pulled into the system prompt on the first turn of a session by
fetch_learned_context.
Both call sites read the active limits from
AgentConfig::resolved_memory_limits.
Presets
| Preset | Recall cap (chars) | Per-namespace tree cap | Total tree cap |
|---|---|---|---|
minimal |
800 | 2 000 | 8 000 |
balanced (default) |
2 000 | 8 000 | 32 000 |
extended |
4 000 | 16 000 | 64 000 |
maximum |
8 000 | 32 000 | 128 000 |
balanced matches the historical hard-coded behaviour. maximum is bounded so
prompts cannot grow beyond ~32k tokens of injected long-term memory regardless
of how many namespaces a workspace accumulates.
Where the setting lives
- Storage:
agent.memory_windowin the persisted config TOML. - Read:
openhuman.get_config→config.agent.memory_window. - Write:
openhuman.update_memory_settingswith{ "memory_window": "minimal" | "balanced" | "extended" | "maximum" }. - UI:
Settings → Memory Data → Long-term memory window(app/src/components/settings/components/MemoryWindowControl.tsx).
Design rules
- Core owns the budgets. The frontend stores a label only; mapping
label → char caps lives in
MemoryContextWindow::limits. A buggy or future client cannot pick "infinite memory" by accident. - Stepped, not freeform. The presets are deliberately discrete so the UX
copy (
Minimal/Balanced/Extended/Maximum) and the actual budgets line up. There is no raw "memory budget" slider in the UI. - Backward-compat raw override (unmigrated configs only). A config from
before this setting existed deserializes with
memory_window = None. While unmigrated, the resolver falls back to the legacyagent.max_memory_context_charsfor the recall cap (clamped to theMaximumpreset's ceiling). The first time a preset is written — by the UI or by any client —memory_windowbecomesSome(...)and the preset is authoritative; the legacy raw field is then ignored entirely. This means pickingMinimalin the UI on a config that previously had a wider raw value really does shrink injection size. - Safety bound. The
maximumpreset is the absolute ceiling. No code path in the harness reads memory caps from anywhere other thanresolved_memory_limits, so this ceiling is the single fact to audit.
Adding a new preset
- Extend
MemoryContextWindowinsrc/openhuman/config/schema/agent.rsand add its limits inMemoryContextWindow::limits. - Update
as_str/from_str_optso the RPC + config TOML round-trip works. - Add the label to
MEMORY_CONTEXT_WINDOWSand the meta map inapp/src/components/settings/components/MemoryWindowControl.tsx. - Add unit tests in both
memory_window_tests(Rust) andMemoryWindowControl.test.tsx(Vitest).