Reference·Context and recallIndex

Context and recall

The window budget, eviction, the stub it leaves, /evict, the recall forms and checkpoints.

.mdllms.txt
OLDESTTHIS TURNTHE MODEL’S WINDOW[history evicted: seq 1-15]RECALL
The window is a span on the log. When it fills, the oldest turns leave the window and a stub says which. Every turn stays in the store, whole. The model reads older turns back with recall-log.

Budget

The budget is the model's context window in tokens. The first source that has a number wins.

OrderSource
1NODECODE_CONTEXT_TOKENS
2providers.<id>.models[].context_window in config.jsonc
3Overrides for the model recorded in the running image
4The models.dev cache at ~/.cache/nodecode/models.dev/api.json

A model no source knows has an unknown window.

/context reports the window and its usage.

Eviction

SettingValue
Starts at0.85 of the budget
Evicts down to0.50 of the budget

Order:

  1. Finished turns go first, oldest first. Each goes whole.
  2. If that is not enough, the running turn sheds its oldest rounds.

The running turn keeps its user message. It keeps its newest round. It is never evicted whole.

Evicted history is never summarised. It stays in the log, word for word.

The eviction boundary only moves forward. An undo does not bring evicted turns back into the window.

Stub

A stub is a system message that stands where the evicted history was.

Whole turns:

[history evicted: seq A–B · N turns · defined: NAMES · watching: VALUES · recall: (recall-log :match "text" :before B+1)]

Rounds of the running turn:

[turn history evicted: N rounds · seq A–B · defined: NAMES · watching: VALUES · recall: (recall-log :match "text" :after A-1 :before B+1)]

A notes block may follow on the next lines:

[the evicted cells noted and judged, oldest first; (recall-entry seq) reads one whole
 seq N · NOTE
 seq N · NOTE]
PartMeaning
seq A–BThe log positions that left the window. recall-log and recall-entry take the same numbers.
defined:Definitions the evicted rounds recorded. Shown only when there are any.
watching:The last values of watched cells. Shown only when there are any.
Notes blockOne line per evicted cell that opened with a ;; note.
LimitValue
Names in defined: or watching:24, then +N more
Note linesThe newest 100, then +N earlier
Note line length320 characters

Write a ;; line at the top of a cell. It is what survives eviction.

/evict

/evict [percent] forces an eviction.

FactValue
Alias/compact
percent1 to 100. 40 and 40% both work.
Default50
DropsThe oldest whole turns, up to that share of the retained history.
KeepsThe newest turn, always.

Recall

The agent reads evicted history back from the log with three forms.

Recalled verbatim
A session in the shell: the window at 81%, nine turns evicted whole, then a note read back from the log, word for word.
(recall-log :match "text" :before 1200 :limit 10)
(recall-entry 1184)
(recall-search "deploy script")

recall-log

Scans one session's log. Returns clipped rows, oldest first.

KeywordDefaultDoes
:matchnoneSQL LIKE over the raw event payload. % and _ are wildcards. ASCII case is ignored.
:kindsinput, assistant answer, tool call, tool resultOne event kind or a list of kinds.
:beforenoneOnly rows with a :seq below this number.
:afternoneOnly rows with a :seq above this number.
:limit20Maximum rows.
:clip200Characters kept per body.
:session-idThe current sessionAnother session to read.

Each row carries :seq, :at (UTC time) and :kind. A tool result also carries :duration-ms.

When more rows match than :limit, the newest rows are returned. The first element is then (:matched N :showing M). Page older with :before set to the oldest :seq returned.

The scan includes the sessions this one was forked from. It includes turns hidden by an undo.

recall-entry

(recall-entry seq) returns the one event at seq with its whole body. It returns NIL when no event holds that number.

(recall-search query) searches every session.

KeywordDefaultDoes
:kindsSame as recall-logEvent kinds to search.
:limit60Maximum rows.
:window220Characters of text around the match.
:lead32Characters of that text before the match.

The query is split on spaces. Every word must appear. Words are literal: % and _ match themselves. An empty query is an error.

Rows come newest first. Each carries :session-id, :title, :seq and a :text snippet.

Checkpoints

Every turn is a checkpoint on the session tree.

CommandDoes
/treeOpens the session tree. Continue from a turn, or rewind to it. Alias /checkpoints.
/undoRewinds the last turn.
/redoReturns to the branch the last rewind left.
/forkForks a new session at the current head.

A rewind adds a head move to the log. Nothing is deleted. Abandoned branches stay reachable.

In the shell, /undo also restores files by default. See Sessions.

Esc

    Loading the index…

    ↑↓ moveEnter openEsc close