Docs / Example apps

Context policies example

A small fleet on the instance runtime. Each agent answers a question by searching a document corpus through bash, on its own machine, under a context policy:

The budget is the model binding's context (the window is it less max_new). Dropping and clipping are layout (agent.tss); summaries react to the layout event when a prompt passes trig of the window.

PolicyRungWhat happens
noneR0Nothing: the run ends when the context is full.
truncR1Past 85% of the window, the oldest whole turns drop, in steps, down to about half (history rule).
compactR2One model call writes a handoff summary (model(<Handoff/>)); it replaces the turns.
treeR4Each fold writes a leaf summary; three leaves merge into one; the recall tool reads a past turn in full.
foldR5Context folding (FoldAgent): branch opens a side task, return folds its turns away to one summary; over budget in a branch, the agent is told to return.
lazyR3Any policy: bcp_search and bcp_get_document are native tools, loaded with load_tool.

Its deployment is affordance.yaml: set the provider and export its key as API_KEY, then affordance run views/demo/research.

Paths in env are absolute: a local machine runs commands in the agent's home. The results table is the root's state (.affordance/root/snapshot.json). The policies come from views/strategies/context.tsx. The Recursive LM (R7) is its own demo, views/demo/rlm/; it does not use the rlm library the window-prototype rung ran (see git history before window.rs was retired).

Source: views/demo/research/README.md, about 2 minutes to read.