Context management
OkBot separates “what the model sees this turn” from “the full UI transcript”: full session.jsonl is always kept for scrolling; the model gets instructions + the uncompressed session tail. Assistants and squads share the same Summary + Buffer design.
What the model sees each turn
- instructions: role line, roster,
SOUL.md, recalled durable memories (pinned + relevant / high-hit, not the full store), session summary, skill catalog — assembled from disk before the run. - session items: user / assistant / tool items in
session.jsonlafter the compression marker.
When a Session exists, the model side uses instructions plus the uncompressed session tail. Token estimates use the current model contextWindow.
Stable blocks (role / roster / SOUL / tool notes) come first; volatile blocks (memory / summary / skill catalog) come later — better for provider prefix caches.
Prompt context viewer
User bubble hover → View context (Developer mode): rebuilds from the live Session + current system materials as ## instructions + ## session items.
- Truncated to that user message; if
coveredThroughIdexists, session items project only the uncompressed tail (same window as the model). - Live projection rebuilt from current system materials; later silent SOUL / skill / memory edits can change what you see if you reopen the same message.
Context compression (Summary + Buffer)
Before a run, if estimated tokens ≥ contextWindow × ratio (default ratio 0.6 on fresh installs) and the uncompressed tail is longer than the keep floor, OkBot incrementally writes session-summary.json and advances coverage.
- Does not delete
session.jsonl; UI bubbles stay; the model sees summary + tail. - Fresh installs keep more recent originals (about 8–12); keep can drop to 0 if still over window. Summary length respects
summaryMaxChars(~2000 on fresh installs). - Tool calls/results enter the summarizer as short digests.
- Auto topic compression (on by default): a light check before send; new topics force “summary + new message only”.
- Settings → Models → Context compression adjusts ratio, keep bounds, summary chars, auto topic, and Compress now.
- Use
search_history(this session only; auto-allowed out of the box, HITL only if set to ask) for original detail. Advancing coverage also triggers incremental memory extraction.
Squads match 1:1: each has its own session-summary.json.
Relation to auto-evolution
Silent upkeep of memory (candidate → durable) / skills / SOUL.md is covered in Evolution. Dialogue that falls out of the window can feed incremental memory. Rhythm: read disk (maybe compress; inject pinned / relevant durables only) → chat → Wrapping up → later turns only.
Content is derived from the OkBot product repo and evolves with the product.