sandman · recall

memory for agentic sessions · the main page

recall is the agent's tool: it pulls the memories that bear on what it is about to do, by its own cue, whenever it needs them. A session's start gets a seed.

Partly built: sandman recall, the seed and the pull, sandman show and sandman remember run (the tools), both models in sandman-infer, the daemon's child (needs); the mod wiring and the pane are not, and the earlier sandman's recall runs at every session's start. A decision is open until its badge says settled; the pipeline and its cut are the evaluation's choice.

The problem

Today the mod runs the earlier sandman recall --hook on a session's first prompt, awaits it (10 s timeout) and injects up to 10,000 characters. That recall never sees the prompt: it walks from the cwd's bank up through ancestor banks, never down, inside a 9,000-character budget.

Sessions start from one root directory and dispatch work into many repositories. From there the walk reaches 2 banks and, after its budget cuts, injects 31 index lines; every bank below the root is out of reach.

The corpus as the earlier recall sees it from the start directory: 645 memories in 49 banks (335 feedback, 183 project, 109 reference, 18 user). The 2 reachable banks hold 149; 31 of their lines arrive, which of the two each came from is not measured, so the strip carries the split and the bars do not. Counts from sandman-next chart (measured 2026-11-13), banks unnamed (docs/data/recall-reach.json).

The flow

Two ways in, one pass: the seed once at the first prompt, the agent's pull at any time.

① seedfirst prompt; startmark, always-set ① agent's pullits cue, any time,--about its repo ② lexical gatesteering words only:no model, nothing ③ bm25whole text, its repo+4, a claim +0 ③ cosinecached vectors, thequery embedded ④ fusereciprocal rank,a tie bm25's order ⑤ pplx decidesthe top 10, onerequest, a noul each else jevthe same request,its model's name ⑧ recall lineto the ledger: path,sent, any error ⑦ digestto the caller; theseed's is injected lexical cutno vectors, nomodel: bm25's top 5 hybrid cutno model: ④'s order,a floor, a band, 8 ⑥ fuse, cut⑤'s order with ④'s,2/66 or more, 6 ask no ask top 10 down answers all down p50 ~0.8 s the seed runs the same pass in 4 s, a pull in 10 s; a stage that has not answered by then is skipped
Every station runs today as sandman recall, both models in sandman-infer; the mod does not run the seed yet. pplx's p50 is the evaluation's over 98 cues (latency).

What did the evaluation choose?

settled

Lexical and embedding ranks fused, a local decision model on the fused top 10, the two orders fused again: the best precision measured and, at cap 6, must-recall level with hosted Jev's, with nothing leaving the machine.

pipelinelinesprecisionmust-recallno-ask emptytime or cost
lexical top 39 → hosted Jev, blended5.81.603.6631.0~1 s, 7.5k tokens
lexical only built, the last fallback4.34.584.5101.02 ms
lexical ⊕ embeddings, no decision model built, the fallback4.45.622.5821.0~30 ms
lexical ⊕ embeddings → pplx-decider-flash on the top 10, fused, cap 54.32.648.6111.0p50 772 ms, p90 832 ms
the same at cap 6 built4.93.629.6301.0the same
the same, one question a request (cap 5)4.31.633.5961.0p50 1,546 ms
the same, two requests of five (cap 5)4.33.637.6011.0p50 919 ms
hosted Jev over every memory3.99.619.577.923121.5k tokens

98 cues over the real corpus; one gold of 7,523 Opus-judged labels, 208 of them must-haves; rules fit on a dev half, confirmed on the held-out half (measured 2026-11-13 · the recall evaluation's union-final table). Embeddings add about 3 points of must-recall once the decision model is there, 7 without it.

Rerankers and larger embedding models did not beat the two-model pipeline. Hosted Jev over every memory is no better than it at 121.5k tokens a pull.

The ten candidates go in one request. The decision model's card calls one question a request the safer default; here it scored lower on every measure and took 1.8 times as long, since the local server answers one request at a time. The request shape moves a candidate's score by .13 on average, and a rerun of either shape is identical, so the gap is the shape's and not noise (measured 2026-11-13 · the evaluation's shape table).

What still gets missed

open

The scorers read a name and 160 characters of description, so the remaining losses come from the memories as much as the scoring: a rule for every repository whose description hides when it applies, a name that is a date or a sentence, a memory filed under another repository's bank. Encode and consolidate guidance shapes new memories built.

What is the cue?

settled
optionwhat it meanscost
the ask, led by its repository when one is known builtstate is repository: <owner/repo> and the first prompt or the agent's cue; known from a pull's --about or a seed's cwd inside a repositorythe ask leaves the machine only with hosted Jev (privacy)
the ask aloneno place in the statea rule from the wrong repository ranks beside the right one
nothing (today)selection by place onlythe 95 % in the problem

The cwd is the grove root for nearly every session, which says nothing: only a cwd inside a repository, or the agent naming it, leads the state and joins the BM25 query. A repository the cue names (fix the grove daemon) is the about, 4 to its bank, without leading the state or joining the query, as in the evaluation; of two named, the longest key wins.

Which memories are candidates?

settled
optionwhat it meanscost
every memory and trace, ranked twice, the fused top 10 decided builtBM25 over the whole text and the cosine of a cached embedding, fused; ten names to the decision modela must-have past the fused 10 is never decided
every memory, one noul each628 questions in balanced requests121.5k tokens a pull, and the distractors the first stage removes
the cwd's chain (the earlier recall)the cwd's bank and its ancestors2 of 49 banks from the root

What comes along without a vote?

settled

Every user memory, plus any pinned: facts about the person bear on every session whatever the cue. They ride the seed only, counted first against its budget: 18 lines today, about 3,600 characters. A pull never prints them; at the default 4,000 a pull that did had room for nothing else.

What is injected?

settled
optionwhat it meanscost
one line per memory, a verb to read one built.NN name (type · path) — description, ~name for a trace, and sandman show <path> oncea body costs a tool call when the session needs it
bodies for the top few, lines for the restthe best matches arrive wholea body averages over 1 KB (888 KB over 645 files): three bodies cost about fifteen lines
bodies for all that fitno reads neededa handful of memories per session

One line per item plus a verb to read one in full, the house rule. A read through show writes a ledger line, so line-then-read is also the use signal record needs; a body sent whole leaves no trace of whether it helped.

How much is injected?

settled
pathorderkeptat most
a decision model answeredits order fused with ④'s, a tie newer first2/66 or more6
no decision model④'s fusion.0284 or more, within .0063 of the top8
no embeddings eitherBM25 with its bonus, a tie newer firstall5

Six, where the reference ships five: a missed must-have is the worse error, and the sixth line buys 1.9 points of must-recall for 1.9 of precision. Each line shows one number in its order: a fused score over the best possible, 2/61, so the top line reads 1.00 and a kept one no less than .92; the lexical cut shows BM25 over the top one. Then the characters: 9,000 for the seed, 4,000 for a pull, under the 10,000 session-start cap; a cue with no ask gets nothing.

$SANDMAN_RECALL_CAP, --budget and $SANDMAN_SEED_BUDGET move them.

When does it run?

settled

Whenever the agent needs it: recall is the agent's tool, pulled throughout a session with its own cue — what it is about to do, the repository it is entering, the decision it is about to make — through the CLI or the same verbs as MCP tools. Nothing in the mod calls a model per prompt.

The session's start is a seed, the one verb the mod runs there: ① the start mark, first and whatever follows, an interactive session's only (a headless claude -p run, a routine, gets the seed's text and its recall line, never a mark, so nothing ever takes or encodes it), so mark keeps only calls and prompts and the short-term pointer goes; ② short instructions saying memory exists and when and how to pull it (as shipped); what is due; ③ the always-set; ④ memories for the first prompt, only when the gate finds a real ask.

What does the seed wait for?

settled

At most 4 s for the whole pass, every embedding and every scorer tried ($SANDMAN_SEED_MS), inside the mod's 10 s; a pull has $SANDMAN_RECALL_MS, 10 s. Over the real corpus of 635 a pull takes about 0.95 s with pplx answering, 0.27 s with no decision model and 0.14 s with neither, the read of the 14 MB cache included (measured 2026-11-13, both models then served by an idle Ollama). The seed never fails the prompt: past the bound it prints what the stages that answered allow, exits 0 and records why. ① is written before any of it, so nothing loses the start mark.

What happens when a model is down?

settled

Each stage drops out within the same bound and the rest answer, never an error to the agent: the embeddings down, the decision runs on BM25's order; a decision model down, the next in $SANDMAN_SCORERS (pplx,jev), each sent the same request; none, the hybrid cut; nothing, the lexical cut. The header names the path and what failed (· pplx (infer <version>), the build that answered, plain · pplx from an older child, · jev: pplx failed, · hybrid, no decision model, · lexical: embed and pplx and jev failed) and the ledger line keeps each cause.

Hosted or local?

settled

Local: both models run on this machine, and nothing leaves it unless hosted Jev is placed in the scorer order and reached, which today needs pplx to fail first. Then the cue and ten names, descriptions and repository labels go to api.typesafe.ai; bodies never do. The user memories and pinned ones are never candidates: they ride the seed unscored.

What does recall record, so the pipeline can learn?

open
optionwhat it meanscost
a ledger line a pull and a read, pin and mute from the pane proposedbelow; the two lines builtthe sent list's bytes, per pull
nothingas todayno way to tell a useful memory from a noisy one
{"about"?:"<owner/repo>","always"?:["<path>"],"ask":true,"at":…,"considered":n,"cue":"<200>","cut":n,"embedded":true,"engine":"<version>","error"?,"kind":"recall","machine":…,"ms":n,"scorer":"pplx","seed"?:true,"sent":[{"file":"<path>","id":"<its id>","score":0.97}],"session":…,"tokens":n}
{"at":…,"file":"<path>","id":"<its id>","kind":"show","machine":…,"session":…}
{"at":…,"file":"traces/<bank>/<file>","id":"<its id>","kind":"remember","machine":…,"session":…,"type":"feedback"}

Proposed: sent, then read, then pinned or muted is the whole feedback loop, and two of its three parts exist already.

What happens to the earlier recall's other sections?

open
optionwhat it meanscost
drop all three proposedrecent sessions, the voyage log and the tool index goa session that resumes yesterday's work starts without the list
keep recent episodes, three linesfrom the ledger, after the memoriesabout 600 characters of the budget, unscored
keep allas todaythe budget they took is why 118 reachable lines were cut

Proposed: none of them is chosen by the cue; what they carried that matters becomes memories through encode.

The tools

The seed is the mod's, recall and show the agent's, remember its write, each a command and the agent's three also MCP tools; the contracts are in AGENTS.md.

docs/data/recall-seed.txt
Sample: the seed over the test corpus for the prompt add a clock to the alpha tests; the suite fails unless this is the verb's output.
docs/data/recall-digest.txt
Sample: a pull of the same cue with --budget 560, pplx answering, three lines before the budget; the suite fails unless this is the verb's output.

The pane

not built Today the mod's pane shows one row per injected block, ▸ hh:mm · sandman recall · <n> chars, expanding to the whole text dimmed; a pull's row carries its header's path verbatim, so pplx (infer <version>) names the engine that answered. The engine allows a working list: the session's pulls, the newest open.

recall · 3 pulls · 9 sent · jev 1.8 s
▸ 09:12 seed sample: fix the alpha clock te… 4 sent
▸ 09:40 agent sample: draft the beta notes, … 2 sent
▾ 10:05 agent sample: pick a retry policy fo… 3 sent
sample-alpha
▾ .91 sample: pass a clock in, never mock feedback
tests take time from an injected clock
sandman show sample-alpha/feedback_clock.md
.84 sample: alpha deploys need the vpn project
sample-beta
.71 ~sample: beta retries back off twice feedback
▸ considered, not sent: 624 · next .41 .39 .38
enter expand · o open · p pin · m mute · r recall again
Sample: a dock 62 columns wide; a row per pull (when, who asked, its cue, what it sent), the newest open with its selected memory expanded; ~ a remembered trace not yet consolidated. Scores rank; they are not probabilities (risks).
keydoesrecords
enterexpands the row: description and the verb to read itnothing
oopens the memory filenothing: the pane is the person, not the session
ppins: always sent from now onrecall: pin on the memory, a ledger line
mmutes: never a candidaterecall: mute on the memory, a ledger line
rpulls again with the open pull's cuea new recall line

Risks

What must be running

sandman-infer, the daemon's child (serve starts it beside itself and restarts it when it exits), runs both models in process over llama.cpp on Metal and answers on <root>/run/infer.sock: qwen3-embedding-0.6b-q8_0.gguf (639 MB) and decider-flash-v1.2-q8_0.gguf, the pplx System One decision model (5.2 GB), both in <root>/models, which sandman setup creates and names the sources for; about 8 GB resident, both loaded at start. It reports booting for the first seconds, about 13 s on the first start after an install while Metal compiles its shaders, and recall falls back meanwhile and says so (embed: booting); hosted Jev is the next scorer. Without the child, recall loses its cosine rank and the pplx scorer and says so: Jev still decides over the BM25 order, and only with no scorer answering does it answer from BM25 alone; without the cache, a pull embeds 8 and the tick fills the rest.

The infer socket

One JSON request line, one JSON reply line, a connection each, on <root>/run/infer.sock (<root> is $SANDMAN_ROOT, else ~/.sandman). A client has 1 s from its accept to send the whole line (at most 1 MiB), and 1 s to take the reply.

{"op":"decide","questions":{"<id>":{"instructions"?:"<text>","type":"noul"}},"state":"<text>"}
  → {"answers":{"<id>":{"noul":<0..1>,"type":"noul"}},"ok":true,"usage":{"input_tokens":n},"version":"<build>"}

refused  → {"code":"<code>","ok":false,"reason"?:"<text>"}

Parity with what it replaced

Measured 2026-11-22 ( M4 Max · infer/tests/infer.rs parity): the decision prompt tokenises to the official encoder's ids, nouls within 1.5e-7 of the prototype's native run; embeddings at cosine .99999955 or more against Ollama's over 50 texts. Ten questions decide in about 415 ms, 16 embeddings in about 124 ms. Side by side with the installed Ollama path over copies of the live store, 98 cues (measured 2026-11-22), this build's figure first: the decider answered on the same 85 cues on both (13 closed by the gate on both), the top result agreed on 90 of 98, the sent set was identical on 67 of the 85, 429 lines sent against 430, a pull's p50 860 ms against 967 ms; the differences sit at the keep threshold, the two paths running different quantisations of the decider (this Q8 GGUF against Ollama's MLX mxfp8).

Open questions