Skip to content
SHAMPOO

Manual ยท Chapter 7 of 19

Context and sessions

Context and sessions

The problem: cold starts

Every assistant session begins knowing nothing: no project memory, no open work, no prior decisions. Context tooling turns a cold start into a continuation in four cheap calls.

Session snapshots

session_save stores a snapshot (project, summary, active files), creating on first call, updating on later calls with the same id. session_recall lists recent snapshots newest-first. The discipline is small and worth it: save at natural breakpoints (plan adopted, milestone done, handing over), and the next session (yours, another agent's, next month's) resumes in minutes. Snapshots always stamp their end time; updates keep whatever the call omits.

Sessions are profile-bound and ownership-checked: without broad scope you touch only your own principal's sessions, and foreign ids read as not-found.

Orientation reads

  • task_digest: counts plus the active sections, overdue first. The thirty-second orientation.
  • ready_context: scored ready/blocked/waiting items with reasons and provenance, in ready, suggested, or compact prime modes. The answer to "what next" before broad search.
  • resume_context: handoff pack plus unresolved items and recently changed facts. The answer to "what did I miss".

Context packs

build_context_pack compiles a role-shaped pack (planner, reviewer, executor, bridge-checker, handoff) under a token budget, scoring available material by relevance. Packs with nothing visible are not persisted: an empty pack is an honest empty answer, not an artefact. enrich_context runs the staged pipeline (assess, extract, pack) at a chosen depth; see 07-reflection for the review half.

A practical handoff recipe

  1. Working session: session_save with a real summary (decisions taken, open threads, next step) and the active files.
  2. New session: session_recall (find the snapshot), task_digest plus ready_context mode prime (orient), then targeted search_nodes / open_nodes for the details the pack cited.
  3. Stuck or unclear: queue a human clarification (11-human-interaction) rather than guessing; the answer re-opens the context for assessment.

When not to

  • Do not save empty or content-free snapshots; they pollute recall.
  • Do not treat packs as archives; they are working views compiled from live material at call time.
  • Do not share session ids across trust boundaries; a foreign id reads as not-found, and working around that (rather than enrolling properly) is always the wrong move.
On this page