memory for agentic sessions
sandman is rewritten from scratch, one part at a time. This build
carries mark, take, chart,
forget, the agent's recall, show and remember,
its defer, due, done and drop,
and the daemon, serve, whose tick ends sessions that never ended, settles held takes, releases unheld transcripts,
encodes episodes, consolidates banks and
topics and reviews its own guidance weekly;
status, setup, upgrade and version run it.
A fast store captures each session as an episode, a slow one absorbs episodes through replay, and the
memory cycle decides what holds, what ends and when a transcript goes. It runs
unattended: every change is a ledger line, recoverable from .pruned/ or the prompt history;
today only forget deletes for good.
Data root
$SANDMAN_ROOT, else
$HOME/.sandman.
chart reads back. Dashed verbs are not built yet: today the subether mod runs sandman mark at start and end and on each denied tool call, keeps its tool calls and prompts in its own daily tool log, and runs the earlier sandman's recall and take.| path | holds |
|---|---|
.archive/claude/<yyyy>/<mm>/<dd>/<HHMMSS>-…-<session>.jsonl | archived transcripts, until release deletes one no note holds |
.pruned/<yyyy>/<mm>/<dd>/<HHMMSS>-<bank>-<file> | what consolidate, decay and a graduation moved aside: consumed traces, merged and pruned memories as they stood, each reply; swept to depth 1 by release, erased by forget |
embeddings.jsonl | recall's embedding cache: {"h","path","v"} a line, h the SHA-256 of the model, 1024 and the text, the last line per hash winning; appended by recall and the tick, rewritten by the tick past twice its live size; about 14 MB for 635 memories, derived, so a synced root ignores it |
eval/recall.jsonl | rethink's labelled (cue, note) examples, one per judged send, the recall evaluation's growing set |
intentions/<id>.md | intentions, work the person deferred: due a date or after an event, state open, done or dropped, the body what; written by defer, done and drop, never by the daemon |
knowledge/<topic>/<file>.md | the knowledge store: knowledge pages and playbooks filed by topic, each revised in place; a memory file's format, type knowledge or playbook |
ledger/<yyyy>/<mm>/<dd>.jsonl | every mod event, one per line, by UTC day: start, end, guard (a denied tool call); call and prompt not built yet; the agent's recall, show, remember, defer, push, done, drop and rethink; the daemon's encode, consolidate and reflect; the cycle's rewrite (a release among them) and check |
memories/.recent/<session>.json | an archived session's short-term pointer: title, cwd, highlights, dreamed once dreamed |
memories/<bank>/<file>.md | the banks, the long-term store's memories, filed by repository: memory files; flat key: value frontmatter between --- fences |
prompts/<job>.md | a model job's guidance (encode, consolidate, reflect, judge) and recall's selection question (question), read when present; written only by reflect, every version it replaced under .history/<yyyy>/<mm>/<dd>/<HHMMSS>-<job>.md |
run/ | the daemon's, mode 0700: serve.lock, serve.pid, serve.sock, serve.log and serve.log.1, each model run's <job>.in, .out, .err |
traces/<bank>/<file>.md | traces, newly encoded or remembered memories awaiting consolidation, one dir per bank; a topic's knowledge and playbook traces under @<topic>, a name no bank key can take |
machine | this machine's id: one line, 32 lowercase hex from /dev/urandom, minted on first use; $SANDMAN_MACHINE overrides it |
trail/, shifts/, breath/, score/, log/, .dream/, pending-takes/, .trace/ | the old sandman's, unread and unwritten by this build; forget does not reach them |
mark
Run by the subether mod inside its 1.5 s budget, so it does nothing slow. Today it writes the start and end marks and a guard per tool call the mod's guard denies; next it carries call and prompt while recall (Next) and take take over start and end.
One JSON object on stdin; kind and session are
required, any other field missing is null.
{"kind":"start"|"end","session":"<uuid>","cwd":"<path>"?,"surface":"<str>"?,"interactive":bool?,"reason":"<str>"?,"resume":"<str>"?}
{"kind":"guard","session":"<uuid>","rationale":"<str>","tool":"<str>"?}
It appends one compact line, keys alphabetical, to today's (UTC)
ledger/<yyyy>/<mm>/<dd>.jsonl in one
O_APPEND write under a shared flock, so concurrent writers interleave whole lines
and forget's rewrite loses none; a guard's rationale is one-lined to 1,000 characters:
{"at":"2026-11-09T08:05:00Z","cwd":"/work/alpha","interactive":true,"kind":"start","machine":"studio","reason":"startup","resume":null,"session":"5a000000-0000-4000-8000-00000000000a","surface":"cli"}
{"at":"2026-11-09T09:10:00Z","kind":"guard","machine":"studio","rationale":"sample: never force-push","session":"5a000000-0000-4000-8000-00000000000a","tool":"Bash"}
A guard is never a session's mark: every reader of sessions (chart's active, take, reconcile, settle, encode) reads only start, end and encode lines.
exit 0 written, silent; exit 2 stdin not JSON, or kind
or session missing or invalid, a guard without a string rationale: one stderr line, nothing written; exit 1
the root cannot hold the line: one stderr line.
take
The one verb the mod runs at a session's end, inside its 1.5 s budget: nothing slow, nothing spawned. A session is marked at its start and taken at its end; one without a start mark is outside this system, and the seed marks only an interactive one, so a headless claude -p run (a routine) is never taken, reconciled or encoded.
One JSON object on stdin; session is checked as in mark.
{"session":"<uuid>","cwd":"<path>"?,"reason":"<str>"?}
It decides one outcome, the first that holds, and appends one end line to today's ledger with the same writer as mark:
| when | outcome |
|---|---|
| no start mark for the session in the ledger | nothing written |
reason is resume: the end fires on the session a resume adopts | nothing written |
$SANDMAN_NO_TAKE set, or CLAUDE_MEMORY_PIPELINE=1 | skipped |
a job's state.json under <claude>/jobs/ names it, by resumeSessionId, else sessionId, whatever its state (the agents view lists a finished job until the person removes it), and reason is not clear | held, with job |
no <claude>/projects/*/<session>.jsonl | gone |
| otherwise | taken, with archived |
{"archived":"<path>"?,"at":…,"cwd":…,"job":"<job dir>"?,"kind":"end","machine":…,"outcome":"skipped"|"held"|"gone"|"taken","reason":…,"session":…}
<claude> is $CLAUDE_CONFIG_DIR, else
$HOME/.claude. The take renames, never copies, the transcript to
.archive/claude/<yyyy>/<mm>/<dd>/<HHMMSS>-projects-<project>-<session>.jsonl
at the take's UTC time (<HHMMSS>-<n>-… on a same-second clash) and its
sidecar dir <session>/, when there is one, to the same stem plus
-dir. Then it writes memories/.recent/<session>.json
atomically, keys in this order, for the earlier recall and dream to read; it goes when recall (Next) replaces the earlier one:
{"archived":"<abs path>","cwd":str|null,"ended":"<the transcript's mtime>","title":"<str>","highlights":[…]}
- pointer —
cwd: the first transcript line's without control characters, else stdin's.title: the first user message, whitespace collapsed, cut at 80 characters, else the session id.highlights: the quoted bodies ofsandman rememberandorrery attendin the commands the session ran (a tool call, a!line), one-lined, cut at 4,000 characters, the latest of a repeat kept, the last 20. - order — rename, pointer, ledger line: an interruption never loses a
transcript, and an archive without a pointer charts as
archived. - exit 0 — decided, silent. exit 2 — bad stdin, one stderr line, nothing written. exit 1 — a rename or write failed (cross-device included): one stderr line, no ledger line.
- tick — the daemon ends sessions through the same path, see serve: a
heldone, reasonjob gone; one that never ended,no end recorded(gone) oridle(taken).
chart
One compact JSON object on stdout, keys alphabetical. It reads the root and
never writes it, bar minting machine; every absence is an empty list
or a skipped item, never an error.
{"active":[{"cwd":str|null,"encoded":str|null,"end":str|null,"interactive":bool|null,"machine":str,"outcome":str|null,"seen":str|null,"session":str,"start":str|null}],
"at":"<now, RFC 3339 UTC>",
"ended":[{"at":str,"id":str,"into":str|null,"op":str,"path":str,"sessions":[str],"state":"ended"}],
"guards":[{"at":str,"rationale":str,"session":str,"tool":str|null}],
"intentions":[{"about":str|null,"after":str|null,"closed":str|null,"created":str|null,"due":str|null,"id":str,"session":str|null,"state":str|null,"what":str}],
"knowledge":[{"created":str|null,"file":str,"from":[str],"id":str|null,"name":str,"origin":str|null,"session":str|null,"sessions":[str],"source":…,"state":"active","topic":str,"type":str}],
"lineage":[{"at":str,"from":str,"op":str,"to":str}],
"machine":"<this machine's id>",
"memories":[{"bank":str,"created":str|null,"file":str,"from":[str],"id":str|null,"name":str,"origin":str|null,"session":str|null,"sessions":[str],"source":"consolidate"|"dream"|"reflect"|"remember"|"other","state":"active","type":str}],
"taken":[{"bytes":int,"cwd":str|null,"dreamed":str|null,"highlights":int,"memories":int,"session":str,"state":"waiting"|"dreamed"|"archived","taken":str,"title":str|null}],
"traces":[{"bank":str,"created":str|null,"file":str,"from":[str],"id":str|null,"name":str,"origin":str|null,"session":str|null,"sessions":[str],"state":"active","type":str}]}
- active — one per session in the ledger files:
starttheatof its earliest start mark (a reload re-fires it),endandoutcomeof its latest end mark (an end without one: null), both null when a start mark is later (resumed, running again);cwdandmachinefrom that start mark, else the end mark;encodedthe outcome of its latest encode line;interactivetrue when a start mark says so, else false when one says false, else null;seenthe live transcript's mtime, null without one. Bystart, then session. - ended, lineage — one per note a rewrite line
ended (an input whose id is not the line's
to),intothat id, null for a prune; and one edge per such note with ato. Byat. - guards — one per guard line in the ledger, by
at: the denied tool calls bifrost's portals page lists. - taken — one per archived transcript, a file directly in a day dir named
<HHMMSS>-…-<session>.jsonl; the latest wins when a session has several.takenis that day and time in UTC,bytesthe file's size;title,cwd,highlights(a count) anddreamedcome from the pointer.state:waiting, a pointer withoutdreamed;dreamed, with it;archived, no pointer.memoriescounts the memories and knowledge pages whosesessionsholds the session. Bytaken, then session. - memories — every
.mddirectly in a bank dir butMEMORY.md, banks and files starting with.or_skipped.namefalls back to the file stem,typeto"";sourceis the first word of the frontmatter's when it is consolidate, dream, reflect or remember, elseother; a consolidate's or a dream'ssessionis the uuid in its source line (dream <ISO> · <uuid> · minds=…);sessionsis the note's provenance, every archived session it descends from, sorted, once each: the uuids on itssessions:line (space-separated, directly beforesource:), itssession:and thatsession;id,from(sorted) andoriginare the note's,stateactive. By bank, then file. - intentions — every
intentions/<id>.md, open and closed, its frontmatter as it stands andwhatits body (the store). Bycreated, then id. - knowledge — every page under
knowledge/<topic>/, read as memories are,topicin place ofbank. By topic, then file. - traces — every trace file, read and skipped as memories are, a topic's bank
@<topic>;sessionfrom its frontmatter,sessionsas a memory's. By bank, then file.
sandman chart over the test suite's fixture,
drawn the way its consumer, bifrost's pipeline tab, draws it. The suite fails when
docs/data/chart.json is not the verb's output.forget
The privacy ending, and the one verb that deletes for good: no .pruned/ copy, and nothing recorded that names the session.
The /delete skill and bridge's forget button run it twice.
take or a tick racing it finds no start mark and archives nothing.sandman forget <session> # forgot: <n> removed, <n> rewritten | nothing to forget
| store | forget |
|---|---|
ledger/**, today's too | every line holding the id dropped but a rewrite line, kept with the id off its from entries' sessions; the file rewritten by temp + rename under an exclusive flock |
<claude>/projects/*/<session>.jsonl and <session>/ | removed, in every project |
.archive/claude/** | every copy and -dir named for it removed |
memories/.recent/<session>.json | removed |
| traces, memories, knowledge pages | those whose session is it removed (an encoded or remembered trace, a consolidate's keep), their lines in embeddings.jsonl too; any other holding the id rewritten without it: off a sessions: line, the line gone once empty, else - (a merge's source) |
.pruned/** | a copy whose session is it removed, a reply's ops on that trace dropped, any other holding the id rewritten |
intentions/<id>.md | kept, its session link dropped: deferred work is the person's, not the session's |
run/ | a model run's .in, .out, .err holding the id removed, and encode's when the last or next episode encoded was this one; serve.log and serve.log.1 without its lines |
- today's file — every append (mark, take, recall, the tick, the daemon's log, the embedding cache) is one
O_APPENDwrite under a sharedflock; forget holds the exclusive one while it reads, writes the temp file and renames it over. An append in flight finishes first; one waiting on the old file wakes holding an inode no longer at the path, sees so, and opens the replacement. The suite races 90 marks against 20 rewrites and loses none; without the lock, 4 runs of 5 lost 4 or 5 (measured 2026-11-14). A CLI cannot take the daemon's tick lock, and needs none: the lock is on the file. - what stays — what a consolidate already merged into another memory: a merge cannot be unpicked, so only what
session:attributes is removed, and the stamp naming the session is rewritten. Claude Code's own stores (history.jsonl,file-history/,session-env/) are not sandman's; neither are the old sandman's directories (data root). An encode in flight may still write its traces and line; the second run takes them. - exit — 0, idempotent:
nothing to forgetonce all is gone; 2 on an id that is not a session's; 1 on a failed removal or write, one stderr line, the rest left for the next run.
serve
The daemon, a foreground process launchd keeps alive as
dev.gigantic.sandman. Its tick runs seven jobs, in order: it reconciles sessions
that never ended, fills recall's embedding cache, settles held takes, releases transcripts no note holds, then one of: a rollback due,
encode one episode, consolidate one bank, or, with
neither waiting, once a week, reflect on the guidance.
run/ others can reach stops at ① with one stderr line and exit 1.At ① it creates run/ 0700 and refuses it if it is not this user's or
group or other can reach it; takes an exclusive flock on
run/serve.lock, held for life; binds run/serve.new
and renames it over run/serve.sock, safe because the lock proves no
one else is alive; and writes run/serve.pid. Then it logs its start and
prints its health line on stdout, so whoever spawned it knows it is ready without polling.
One newline-terminated JSON request and one reply per connection, compact, keys alphabetical; a connection silent for 1 s is dropped unanswered. Errors are typed codes.
{"op":"health"} → {"machine":str,"ok":true,"pid":int,"since":"<RFC 3339 start>","state":"booting"|"ready"|"stopping","version":"<release>-<build>"}
{"op":"shutdown"} → {"ok":true}, written after the listener is dropped
anything else → {"code":"bad_request"|"unknown_op","ok":false}
- state —
readywhenever it answers today: there is nothing to derive before the socket is bound, and a stopping daemon no longer accepts. - child —
sandman-infer, the models (recall's needs), started after the start line:$SANDMAN_INFER's command when it is set (empty: none), else the file beside the daemon's own executable named withsandmanreadsandman-infer(sandman-next→sandman-infer-next), else none (absent, the Linux release). Its own process group, stderr the daemon's, stdin a pipe the daemon holds and never writes: any death of the daemon closes it and the child stops, so none outlives it. An exit is logged and respawned after 1 s, doubling to 60 s and back to 1 s once a child has lived 60 s. - reconcile — every 30 s (
$SANDMAN_TICK_MS), from disk, first: a session of this machine whose latest start mark is later than its latest end, or that has none, older than 10 min ($SANDMAN_GRACE_MS; its transcript may not exist yet), no job naming it: without a live transcript it endsgone, reasonno end recorded(a crash, a kill, a session from beforetake), at most 20 a tick; with one untouched for a week ($SANDMAN_IDLE_MS) it is taken as take does, reasonidle, one a tick, so an abandoned session's memory is kept; otherwise it may be alive and is left. A session resumed later gets a new start mark and is open again. - embed — the cache rewritten to its live lines once it passes twice their
size, then every candidate recall would embed
and the cache lacks, in reader order, at most 128 a tick (
$SANDMAN_EMBED_TICK), 16 a request tosandman-infer(about 124 ms each, measured 2026-11-22), so a first build of 635 lands within a few ticks. At a stop the child answers the request in hand. - settle — a session whose latest end is
heldon this machine with no start since, no job naming it any more, its transcript untouched for 120 s ($SANDMAN_QUIET_MS), is taken as take does:takenorgone, reasonjob gone. A take that fails is logged and stays held for the next tick. - release — after settle, while check holds: the
release of unheld transcripts and the sweep of
.pruned/. - signals — SIGTERM, SIGINT and SIGHUP take the shutdown path; SIGPIPE is
ignored. The drain budget is 2 s, launchd's
ExitTimeOut: the one connection in hand, at most its 1 s read, the tick's job in hand (a running model command is killed) and, beside them, the child: TERMed at the stop, its group KILLed 1 s later; the tick starts no other. On exit it removesserve.pidandserve.sockwhile the pid file still holds its pid. - log —
run/serve.log, one compact object per line withat:start(pid, version),infer(the childabsent,startedwith its pid,exitedwith its status),exit(reason:signal TERM,shutdown request, an accept error),embed(embedded, or the failure asreason),reconcile,take,encode,consolidateandreflect(the tick's ledger line, or itssession,bankorkindand the write's error asreason),panicfrom the panic hook. A line that finds it at$SANDMAN_LOG_CAPbytes (1 MiB) first renames it toserve.log.1. - version —
sandman versionprints<release>-<build>: theYYYY.M.Nthe release workflow stamps (a checkout's build: the crate version), then the commit it was built from (-dirtyover uncommitted work), the same string health carries: an installer's smoke check. - status — sends health and prints the reply with the child's own health added as
infer(null when it does not answer), exit 0, with one stderr line naming both versions and the fix,sandman setup, for each of the daemon and the child whose version is not the client's; no daemon prints{"code":"down","ok":false}, exit 1. - setup — installs the release and the agent. First it boots out the old sandman's agents
(
dev.gigantic.sandman.breathe,.reflect,.report) and removes their plists; then hotswap'sensurebrings the release into its layout (~/.local/share/hotswap/sandman/<version>/: a mise install of a newer version moved in, else, with none active, the latest release installed through packslip under the signerps1_nensfiggtc7n6uctbniwf7q4am), links~/.local/bin/sandmanthrough itscurrentand owns the upgrade agent,dev.gigantic.sandman.upgrade(sandman upgradeevery 900 s), which setup never writes, loads or boots out. The daemon's plist runs that link, never the executable that ran setup, so a checkout's setup wires the installed release: the link andserve, the root it ran with and the caller'sPATH(launchd's finds noclaude), KeepAlive, RunAtLoad, ThrottleInterval 10, ExitTimeOut 2, stderr toserve.errbesiderun/for failures before the log;--printprints it and writes nothing.setupcreates<root>/modelsand, while a model is missing there, prints one line naming both files and their sources (it fetches nothing), then writes~/Library/LaunchAgents/dev.gigantic.sandman.plistby temp + rename, then kickstarts it when that plist was already loaded and loads it afresh otherwise. After a bootout it pollslaunchctl printuntil the job is gone (at most$SANDMAN_BOOTOUT_MS, 30 s): a bootstrap before then fails. Withoutlaunchctl(Linux) it stops before writing anything;--removehas hotswap forget the upgrade agent, the layout and its record, then boots the daemon out and removes its plist and the link, leaving the root alone. - upgrade —
sandman upgrade [--check | --back | --retry]is hotswap's swap under sandman's manifest, its exit code hotswap's (0 green or settled, 1 red, 2 unable to try). A release is newer whenreleases/latestnames a newer tag; packslip installs it beside the running version,currentmoves, thensandman setup, onekickstart -kofdev.gigantic.sandman(when launchd shows it loaded at login with a managed launch constraint and not disabled, hotswap instead boots it out, waits for the job to go and bootstraps it from its plist, since a kickstart keeps the constraint a swapped binary trips) and the smoke:sandman version, thensandman statusonce a second until the restarted daemon answers with that same version, 30 s at most. A failed step rolls back to the previous version and holds the red one off until a newer release. No drain step: the kickstart's SIGTERM is the daemon's own 2 s drain, and a separate stop would race KeepAlive's respawn. Releases come from.github/workflows/release.yaml, one per merge to main,YYYY.M.N, foraarch64-apple-darwinandx86_64-unknown-linux-gnu, signed by packslip.
sandman setup # install the release, retire the old agents, load or swap sandman status # the daemon's health, its version the binary's sandman upgrade --check # what the next swap would run mise run install # a dev build as sandman-next, beside the release claude setup-token # in a terminal: prints a year's token, stores nothing install -m 600 /dev/stdin ~/Codes/claude-oauth-token # paste it, then Ctrl-D
Cut over 2026-11-18: ~/.local/bin/sandman is the release hotswap installed, the old
binary and its agents are retired, and callers say sandman.
encode
A job of serve's tick, not a verb: one episode, a taken
session, at a time, written as traces, newly encoded memories still labile, under
traces/<bank>/, apart from the banks until consolidate.
Each tick, after settling, it derives from the ledger the oldest session of this machine whose
latest end is taken, with no start or encode since, decides one outcome, and appends one line with
mark's writer:
| when | outcome |
|---|---|
no start mark of the session says interactive true: a start marked by mark alone, since the seed never marks a headless run | skipped, no model call |
no file at the end line's archived | gone |
the encoder exits non-zero, outlives $SANDMAN_ENCODE_MS (300 000), or prints no valid object | failed, with error; no trace written |
| otherwise | encoded; traces counts them, often 0 |
{"at":…,"error":"<one line>"?,"ids":["<each trace's id>"]?,"kind":"encode","machine":…,"outcome":"encoded"|"skipped"|"gone"|"failed","session":…,"token":…?,"traces":<count>}
- digest — what the model reads, built from the archive:
# episode(the take's time, the cwd as the pointer finds it),# already remembered(what the session saved withremember, one name and description each, which the contract says never to write again),# highlights(take's, those no remembered note already holds word for word),# recalled(the notes recall sent and the session left unjudged, for its verdicts),# transcript: auser:orassistant:line per message text and atool:line per tool call (its name and command or file, 200 characters); tool results dropped. Over$SANDMAN_DIGEST_BYTES(300 000) it keeps the head and the tail, whole lines, and the middle becomes… <n> bytes omitted …. - model run — shared by both jobs:
$SANDMAN_ENCODERhere, a command line run bysh -cin its own process group withCLAUDE_MEMORY_PIPELINE=1andSANDMAN_NO_TAKE=1, so a session it starts is never taken; by default a headless Claude Opus with no tools, no hooks, MCP servers or CLAUDE.md, and no saved session:claude -p --model opus --output-format text --safe-mode --tools "" --no-session-persistence. Its stdin is the guidance, the contract and the data; its stdout one object, text around it ignored; exit 0. - sign-in — the stored interactive login expires; a token file outlives it, a year.
Read at each run, so a replaced file needs no restart:
$SANDMAN_CLAUDE_TOKEN_FILE, else~/Codes/claude-oauth-token, a regular file no group or other can read, its trimmed text set asCLAUDE_CODE_OAUTH_TOKENfor the command alone. The line'stokensays which, never the value: absent without the file (the stored login, as before), the path when used,refused: <path>: mode <octal>, want a regular file of mode 600orignored: <path> is empty, the run going ahead without it. - prompt — two parts. The contract (src/prompts/encode.contract.md)
fixes the input layout and the reply's shape; it is built in and always sent, so no edit can break
parsing. The guidance, what a trace is and how to word one, is
<root>/prompts/encode.mdwhen that file holds any text, else the built-in default (src/prompts/encode.md), so it changes without a rebuild. A local model replaces Opus with any command that keeps the contract:{"traces":[{"type":"user"|"feedback"|"project"|"reference"|"knowledge"|"playbook","name":str,"description":str,"body":str,"about":str|null,"topic":str|null}], "verdicts"?:[{"file":str,"verdict":"used"|"wrong"|"stale"|"irrelevant","why":str|null}]} - homing — sessions start from one root directory and dispatch work into many repositories,
so a session's cwd says little about what a fact concerns. A
knowledgeorplaybooktrace names itstopic, a slug (lowercase letters, digits,-), and lands intraces/@<topic>/(the knowledge store); a type without one fails the episode. Any other trace names its repository inabout; the bank is that directory's key when it is an absolute path to an existing directory, else the episode cwd's, else$HOME's. A key is the earlier sandman's: the directory a linked worktree sits in, the checkout a nested worktree belongs to, else the directory itself, every byte not alphanumeric-. The trace lands attraces/<bank>/<type>_<slug>.mdby temp file and rename, the slug the bank format's (the name lowercased, non-alphanumeric runs_, 60 characters),_2,_3on a clash. - stop — a stop signal or shutdown request kills the model's group and writes no
line, so the job runs again after the next start.
failedis final: the tick never retries it; removing its line from the ledger does.
--- id: 7d3e9a0b4c21 name: Pass a clock in; never mock time description: tests take time from an injected clock, never a time mock type: feedback created: 2026-03-04T17:25:10Z about: /work/ledger-api session: 5a000000-0000-4000-8000-00000000000a archived: <root>/.archive/claude/2026/03/04/172010-projects--work-5a000000-0000-4000-8000-00000000000a.jsonl source: encode 2026-03-04T17:25:10Z · 5a000000-0000-4000-8000-00000000000a · model=opus --- In /work/ledger-api, tests take time from a clock passed in. Said 2026-03-04: "no mocks for time in this repo, we pass a clock in". Why: "mocks hid a real ordering bug last year".
consolidate
A job of serve's tick: it stabilises a bank's traces and integrates them with what the bank holds. A trace or a verdict that revises a memory updates it (reconsolidation); a merge folds memories that hold one fact into a new one; pruning drops a trace that does not hold or a memory gone stale; a memory moves to the bank it belongs to, or graduates into a topic's page. Nothing waits for a person.
It runs only in a tick with no episode to encode, one bank at a time, derived from disk each tick: of the
banks holding a trace or a note judged (a wrong or stale verdict since its
body last changed), a topic's @<topic> among them, whose newest trace
created and verdict are older than $SANDMAN_CONSOLIDATE_QUIET_MS
(600 000, so a burst of episodes lands first), the one whose oldest is oldest. It needs a trace newer than its last
failed consolidate, or a verdict newer than its last consolidate of either outcome, so a
bad reply never storms and a verdict left standing is answered once. The model run is encode's, with
$SANDMAN_CONSOLIDATOR and $SANDMAN_CONSOLIDATE_MS (600 000), its guidance
<root>/prompts/consolidate.md else the default, then its contract
(src/prompts/consolidate.contract.md),
then the bank. A topic's runs the same way with knowledge/<topic>/ in place of
memories/<bank>/, and its keeps take knowledge or
playbook only (how a page is written):
# bank -work-ledger-api # traces <trace file="feedback_clock_in_benchmarks_too.md"> …the whole file… </trace> # memories <memory file="feedback_pass_a_clock_in.md"> …the whole file… </memory> # listed - reference_metrics_dashboard.md · ledger-api latency dashboard · Where ledger-api's latency dashboard lives # judged - reference_redis_queue_host.md · stale · the queue moved to postgres # elsewhere - knowledge/postgres/knowledge_job_queues.md · Postgres job queues · Queueing jobs in Postgres: SKIP LOCKED, one table
Memories go whole while their bytes fit $SANDMAN_CONSOLIDATE_BYTES (300 000); the rest
are listed, and the contract says a listed memory may not be changed; # judged, absent when
empty, lists each verdict a memory answers to, - for no reason; # elsewhere,
absent when empty, at most 5 notes of other banks and topics, recall's candidates, whose cached embedding has cosine
at least $SANDMAN_NEAR (0.8) with a trace's or memory's, nearest first, a tie in reader
order, never written. The reply is
{"ops":[…]}:
| op | means | applied |
|---|---|---|
{"op":"keep","trace","type","name","description","body"} | the trace becomes a memory | memories/<bank>/<type>_<slug>.md, encode's slug and clash; created, about, topic, session, archived from the trace |
{"op":"merge","trace","memory","description","body"} | the trace revises or extends the memory | the memory rewritten in place: its other keys kept in order, description and source replaced, updated set, the body replaced |
{"op":"merge","memories":[…],"type","name","description","body"} | two or more memories hold one fact | a new note, keep's slug: a new id, created now, topic a topic's, from: its parents' ids (one minted for a parent without), no sessions; the parents leave the bank |
{"op":"revise","memory","description","body"} | a judged memory corrected | as a merge's write, without a trace; only a memory # judged lists |
{"op":"retitle","memory","name","description"} | a better name | its keys and body kept, name and description replaced, under keep's slug for the new name |
{"op":"rehome","memory","bank"} | it belongs to another bank | unchanged but its topic, under keep's slug in that bank: one of the same kind (a bank's, or a topic's @<topic>) already on disk |
{"op":"graduate","memories":[…],"topic","type","name","description","body","reason"} | one or more memories are a topic's knowledge (rung 1) | a new trace under traces/@<topic>/, as a merge of memories writes, type knowledge or playbook; the memories leave the bank |
{"op":"prune","trace","reason"} | the trace does not hold | nothing enters the bank |
{"op":"prune","memory","reason"} | a trace shows the memory stale | the memory leaves the bank |
- checked — every trace named by exactly one op, every file named present in the input, a memory (a merge's parents too) named at most once and never a listed one, a revise only on a judged one; otherwise the whole reply is rejected and nothing changes.
- applied — every write staged beside its target first (a failure removes them and
fails); then every named trace, and every merged or pruned memory as it stood, renamed to
.pruned/<yyyy>/<mm>/<dd>/<HHMMSS>-<bank>-<file>beside the reply,…-<bank>-ops.json, reasons included; then the writes renamed in. Nothing is deleted. - stamped — a kept or merged memory's
sourceisconsolidate <now> · <the trace's session, else -> · model=<model>; a merge or a revise replaces the earlier one, which.pruned/keeps, and a retitle keeps it. A keep, a merge of a trace, a revise and a retitle are the note continuing (the note): a keep takes the trace'sid, the rest keep the memory's (either minted when missing); beforesource:,from:andsessions:are the unions of the trace's and the memory's, so the sessions it descends from outlive the stamp it replaces, andorigin:stays only without either.MEMORY.mdis left alone: the earlier recall reads memory files, never the index, and the earlier commit path regenerates it whole. - lines — once applied, one rewrite line per op, each input as it stood and where it went, then the consolidate line.
- stop — as encode's: no line, the bank runs again after the next start.
{"at":…,"bank":…,"error":"<one line>"?,"kind":"consolidate","kept":n,"machine":…,"merged":n,"order":{…}?,"outcome":"consolidated"|"failed","pruned":n,"token":…?}
merged counts both merges; order, on a consolidated line, is the
order measure.
reflect
A job of serve's tick, the weekly review: the pipeline rewrites the guidance encode and consolidate run on from evidence of what they did, and adopts a rewrite only when a replay judges it no worse; it also decays the store, proposes graduations (decay, the ladder) and may rewrite recall's selection question. No step waits for a person; the contracts stay fixed in the binary.
It runs only in a tick with no rollback due, no episode waiting and no quiet bank; at most once per
$SANDMAN_REFLECT_MS (604 800 000, a week) after this machine's latest
reflect line, and only when at least $SANDMAN_REFLECT_MIN (5) encode
or consolidate model runs follow it: no evidence, no run and no line. The model run is encode's, with
$SANDMAN_REFLECTOR and $SANDMAN_REFLECTOR_MS (600 000), its guidance
<root>/prompts/reflect.md else the default
(src/prompts/reflect.md), then its contract
(reflect.contract.md), then:
<guidance job="encode">
…the guidance in force, whole…
</guidance>
<guidance job="consolidate">
…
</guidance>
<question>
Does the agent need this memory to carry out the request correctly?
</question>
# since
2026-11-07T09:00:00Z
# runs
- {"at":…,"ids":["7d3e9a0b4c21"],"kind":"encode","machine":…,"outcome":"encoded","session":…,"traces":1}
# ops
- -work-ledger-api: {"op":"prune","reason":"the session's story: a fix the repo's history records","trace":"project_fixed_the_retry_test.md"}
# merged again
- -work-ledger-api/feedback_pass_a_clock_in.md · merged 3 times
# remembered by hand
- No closing summary of changes — Every reply, in any repository: no closing summary (traces/-work/feedback_no_closing_summary.md)
# sent, never read
- -work-ledger-api/reference_redis_queue_host.md · sent 4 times, never shown
# irrelevant
- -work-ledger-api/reference_redis_queue_host.md · bump the http client in ledger-api
# standing
- 3f9a0c1d2b4e · -work-ledger-api/feedback_pass_a_clock_in.md · Pass a clock in — ledger-api tests take time from an injected clock · used in 6 sessions
# relearned
- 0a1b2c3d4e5f · -work/feedback_no_closing_summary.md · No closing summary — every reply: no closing summary · relearned in 3 sessions
- evidence — since the latest reflect line, a section each, absent when empty: every model run's
ledger line; each op of the
.pruned/…-ops.jsonwritten since, its body cut; memories merged more than once; eachrememberline with its trace's name and description, live or moved aside; and recall's sends per memory againstshowlines of the same session, listing those sent three times or more and never read; the label-0 examples since,# irrelevant; the ladder's# standingand# relearned. Cut like encode's digest past$SANDMAN_REFLECT_BYTES(300 000); the guidance and the question in force go whole. Decay runs first, with no model run, so a decayed note is in no section. - propose —
nullleaves a job alone; another shape, or a guidance over$SANDMAN_GUIDANCE_BYTES(12 000), fails the review whole, so guidance cannot grow without bound, and so does aproposeentry off its shape (the ladder). reflect never rewrites its own guidance or a contract.{"encode":str|null,"consolidate":str|null,"question"?:str|null,"reason":str,"propose"?:[…]} - replay — per proposal, the latest
$SANDMAN_REFLECT_REPLAY(3) inputs run through the job's own model command under the guidance in force and under the new one, writing nothing; then one judge run per input ($SANDMAN_REFLECTOR, judge.md, judge.contract.md) sees the input and the two replies as# aand# bin a random order and answers{"better":"a"|"b"|"same","reason"}. Adopted only when an input was replayed and the old won none. Encode's inputs are the latest encoded episodes whose archive still exists, the digest rebuilt. Consolidate's are the latest.pruned/replies, each bank rebuilt: the traces it consumed and the memories it merged or pruned as they stood, beside the bank's other memories now, less those whosecreatedandsessionmatch a consumed trace (its keeps). A later run's changes to those others show through: close, not exact. - question — a proposed selection question is scored with the one in force over the latest
$SANDMAN_EVAL_CAP(50) examples whose note is a candidate: one question per example to the decision models, recall's order, state the example's repository and cue, right when the noul is .5 or more for label 1 and under for label 0. Adopted when it scores no worse, as guidance is, toprompts/question.md, which recall reads; no scorer answering fails the review.replaycarries"question":{"new","old"}, the two scores. - adopt — the guidance in force, the built-in default included, copied to
prompts/.history/<yyyy>/<mm>/<dd>/<HHMMSS>-<job>.md, then the new one written toprompts/<job>.mdby temp file and rename; the job's next run reads it. - roll back — when the latest reflect line adopted a job and that job's first two model runs
since both failed, the next tick, before any other job, restores the version the line kept, the failing one kept
under
.history/in turn: outcomereverted. Any later reflect line ends the watch. - stop — as encode's: the group killed, no line, the review again after the next start. Every
other outcome,
failedtoo, waits out the week.
{"at":…,"error":"<one line>"?,"history":{"<job>":"prompts/.history/…"},"kind":"reflect","machine":…,"order"?:{…},"outcome":"adopted"|"kept"|"failed"|"reverted",
"proposed"?:n,"pruned"?:n,"reason":"<one line>"?,"replay":{"<job>":{"new":n,"old":n,"same":n}}?,"token":…?}
order is the store's before decay and after the pass, pruned
decay's count, both on a failed review too; proposed the intentions written.
kept means no guidance was proposed, the old won a replay, or there was nothing to replay
(all three counts 0). One review costs one model run plus three per input replayed: at most 19 with the defaults.
The memory cycle
A session's transcript is encoded into traces, consolidated into memories and knowledge pages, sent by recall, judged, counted, then revised, merged, graduated or decayed; once no active note names the session, its transcript goes. Text and Rust, no database: every fact here is a file or a ledger line, and any index is a cache rebuilt from them. Built in full, in the ten stages under next.
The note
Every memory, knowledge page and trace keeps the file format it has today, with three keys added and one
forbidden; writers put id first, from and origin
just before sessions:
--- id: 3f9a0c1d2b4e 12 lowercase hex from /dev/urandom, minted once, never changed (built) name … archived as today from: 0a1b2c3d4e5f 9e8d7c6b5a4f the notes it was merged from, sorted; only on a note a merge created origin: import|routine|hand only on a note with neither sessions nor from (built) sessions: <uuid> <uuid> the archived sessions it descends from, sorted (built) source: <stamp> as today updated: <now> as today ---
- source — no writer produces a note without one:
sessions(chart's, fromsessions:,session:and the stamp),from:, ororigin:; never-or an empty value.rememberwithout--sessionwritesorigin: hand. - continuing — a keep (the trace's id), a trace merged in, a revise, a retitle and a rehome are the
same note: the id stays,
sessions:andfrom:gain what it absorbed. - new — a merge of two or more notes, and a rung-1 graduation, write a new id,
from:the parents, and nosessions:,session:orarchived:: it starts clean. The parents end; their sessions stay on the rewrite line that ended them. - end — merged into a new note, graduated, or pruned (by consolidate, or by decay); nothing else ends a
note.
forgetis no end: it erases. - strength — counted from the ledger, never stored;
checkrefuses astrength:key.
The rewrite line and lineage
One ledger line per note rewritten, through mark's writer, never edited; recall's
sent entries and the show and remember lines
carry the note's id, an encoded line its traces' ids, and a path in an
older line resolves through these lines' paths. Built for consolidate's keep,
merge, prune, retitle,
revise, rehome and rung 1's graduate, written once the ops have landed, all in one write, before its line.
A write that fails puts the pass back (its notes removed, its inputs renamed back) and fails it; a kill between the
moves and the write leaves copies no line ends, which the sweep keeps and check names (4)
for a person to restore or end:
{"at","from":[{"digest":"<SHA-256 of the file as it stood>","id","path","sessions":[…]}],"kind":"rewrite","machine",
"model":"<model>"|null,"op":"keep"|"merge"|"revise"|"retitle"|"rehome"|"graduate"|"prune"|"release"|"revert",
"reason":str|null,"to":{"id","path"}|{"artifact":"<path>"}|null}
| op | from → to | written by |
|---|---|---|
graduate | memories → a new traces/@<topic>/ trace (rung 1); a note → {"artifact"} (rungs 2, 3) | consolidate; done on the owner's approval |
keep | a trace → the same id under memories/ or knowledge/ | consolidate |
merge | a trace and a note → the note; two or more notes → a new id | consolidate |
prune | a note → null | consolidate; the weekly review (decay) |
rehome | a note → the same id in another bank or topic | consolidate |
release | per archived file {"bytes","digest","id":null,"path","sessions":[<session>]} → null | the tick's release job |
retitle | a note → the same id under another name and file | consolidate |
revert | a note an order op wrote → null; [] → each note it ended, put back | a pass that fails its measure |
revise | a note → the same id, body rewritten after a wrong or stale verdict | consolidate |
lineage; the oldest generation's bodies are deleted by release's depth-1 sweep.- depth 1 —
.pruned/keeps the newest copy of each active note's direct parents and of its own previous version, what a rollback needs; when a note ends, its parents' bodies are deleted. A pruned or graduated note's body stays$SANDMAN_RELEASE_DAYSafter its line. A file the next weekly review reads (written after the latest reflect line, or among the latest$SANDMAN_REFLECT_REPLAYreplies and the copies they name) stays until it is not. A copy without an id is outside the lineage and stays, and so does one whose id no line ends and no note holds. Only.pruned/<yyyy>/<mm>/<dd>/is swept, no symlink followed: a tree made by hand stays. Older generations are rewrite lines only. - order — each consolidated and weekly
review line carries
"order":{"after":{"chars","eval"?,"notes"},"before":{…},"merges":n}over the bank's or the topic's active notes, its traces among them, or the store's: their count, their files' characters, and the pass's merges of notes;eval, with an example, is the store's recall evaluation: the share ofeval/recall.jsonl's examples recall's lexical rank gets right now, a label-1 example's note (by id, followed through the rewrite lines to the note it went into, else by path) among the top 5 scoring above 0, a label-0 one's not, to 3 places. A pass with an order op (a merge of notes, a graduation, a memory pruned, a decay) that lowers neither notes nor characters nor raises the score, or that lowers the score, has its order ops reverted: each one's written note removed (arevertline ending it), its copies back from.pruned/(arevertline each whosetois the note, which no earlier end then counts), outcomereverted(a decay's retirements are judged one at a time instead, above; the review's line:reverted: truewhen any was put back). A trace's intake and a verdict's revise are never reverted for order. Each order op ends more notes than it writes, so only the score fails a pass.
rethink
sandman rethink <path> --irrelevant|--used|--wrong|--stale [--why "<text>"] [--session <uuid>]
rethink {"path":string, "verdict":string, "why"?:string, "session"?:string} # the MCP tool, passed as --<verdict>
- at encode — the default, a cleanup on encode's one read of the transcript: the digest gains
# recalled,- <path> · <name> — <description> · shown|not shownper note on disk (by path, else id) the session's recall lines sent and no verdict of the session judged; the reply gains"verdicts":[{"file","verdict","why"}], one per listed note at most, optional; a file not listed, one judged twice or a verdict outside the four fails the episode (output: not a verdict: …), nothing written. Each is a rethink line,byencode. A send nobody judged counts for nothing. - in session — optional, and it outranks encode's verdict for the same session and note. The path as
showtakes it; stdoutrethink: <verdict> <path>; no verdict or two, exit 2; no note there, exit 1.cueis the session's latest send of the note, by path, else by id. The seed's instructions name it in one sentence. - eval — each verdict on a sent note also appends an example to
eval/recall.jsonlthroughmark's writer,irrelevantlabel 0, the rest 1,aboutandcuethe send's,digestthe SHA-256 of the note as judged;forgetdrops its session's examples:
{"at","by":"agent"|"encode","cue":<the send's>|null,"file","id","kind":"rethink","machine","session","verdict","why":str|null}
{"about","at","cue","digest","id","label":0|1,"path","session","verdict"} eval/recall.jsonl
Strength and decay
strength = (1 + 3·used + 1·shown − 4·judged) × 2^(−idle ÷ 30)
- terms — over the ledger's lines naming the note (by path, else id):
useditsusedverdicts,shownits show lines,judgeditswrongandstaleverdicts since its body last changed (a revise or a merge clears them),idlethe days since the latest of itscreated,updated, used verdicts and shows.$SANDMAN_USED_WEIGHT(3),$SANDMAN_SHOWN_WEIGHT(1),$SANDMAN_JUDGED_WEIGHT(4),$SANDMAN_HALF_LIFE_DAYS(14).idlecounts whole days to the local today ($SANDMAN_TODAY, as intentions date), 0 for a note with none of those dates; chart rounds to 3 places, and a judged note can go below 0. - floor —
$SANDMAN_DECAY_FLOOR(0.1): a note never used reaches it after 47 days idle (14 · log₂ 10), shown once 61, used once 75, used five times 103. - decay — the weekly review first prunes, with no model run, each active note under the floor but a
type: usernote, arecall: pinormuteone, one with a judged verdict outstanding (consolidate's to revise or prune), and a trace (consolidate's): moved to.pruned/as consolidate's prune, its rewrite linemodelnull andreasondecay: strength <s> under <floor>. Each retirement is judged on its own, in order, against the store's measure after the one before: one that fails the measure as consolidate's pass does (order) is put back at once, arevertline ending it, and the rest stand.
Graduation
- rung 1 — consolidate's reply op
graduate(below) writes a trace undertraces/@<topic>/, a new id,from:the memories, which end; the topic's consolidate keeps it as a page or merges it into one, the page continuing with itsfrom:extended.# elsewhere(consolidate) shows a subject converging across banks. - rung 2 — the weekly review's evidence gains
# standing: a note with an id,usedverdicts in$SANDMAN_GUIDE_SESSIONS(5) distinct sessions and nowrongorstaleever. Its reply gainspropose(below), the artifact the most specific one (a repository'sAGENTS.md, a rules file, a skill,CLAUDE.md); a rung-2 proposal with noreplacesjustifies its characters inwhyor is dropped. - rung 3 —
# relearned: an active note that traces of$SANDMAN_MECHANISM_SESSIONS(3) distinct sessions merged into since itscreated(the merge rewrite lines' trace entries): the same failure needed the lesson again. Proposed as a hook, lint, test, gate or tool default. A graduated line is outside the store, so nothing counts its relearning. - approval — each proposal becomes an intention, due today,
aboutthe artifact's directory,graduate: <note id>,artifact: <path>(a leading~/written as the home) andline: <line>, its textDone once <artifact> holds the line: <line>[, replacing: …] — graduates <name> (rung <n>)[: <why>], which the seed's due block surfaces. The owner has it applied;doneon it first reads the artifact and refuses, the note untouched, unless it holds the line (whitespace collapsed), then ends the note (moved to.pruned/, agraduateline to{"artifact"}, stdout's second linegraduated: <path> → <artifact>);dropdeclines, and the note is not listed again until its body changes (itsupdatedafter the drop'sclosed). A note with an open proposal is not listed either.
{"op":"graduate","memories":[<file>,…],"topic","type":"knowledge"|"playbook","name","description","body","reason"} consolidate's
"propose":[{"artifact","line","note","replaces":str|null,"rung":2|3,"why"}] the weekly review's
Release
- transcript — a file
.archive/claude/<yyyy>/<mm>/<dd>/<HHMMSS>-…-<uuid>.jsonl, no symlink on its way; anything else under.archive/(a tree made by hand) is neither released nor checked. - held — a transcript while its session runs (a start later than its end), is held by a job, or
waits for encode (taken, and no encode line since says
encoded,skippedorgone: a failed encode holds it); with no ledger story, while the earlier sandman's.recentpointer has nodreamed; or while an active note or a trace names it (chart'ssessions), a note without an id anywhere in its text. Unheld since the latest of its takes, its encode line and the rewrite line that last named it. - lineage — release follows a note's
sessions, never itsfrom:: a note a merge creates starts clean, by design, and its parents' transcripts go once the grace passes, their sessions kept on the rewrite lines that ended them. - released — a tick job after settle, at most
$SANDMAN_RELEASE_TICK(20) a tick, oldest first, the stop flag checked before each: unheld for$SANDMAN_RELEASE_DAYS(7), its archived files,-dirand.recentpointer are deleted, then onereleaseline written; the id stays in the ledger and on ended notes' lines. The same job sweeps.pruned/to depth 1, as many copies a tick. It runs only whilesandman checkpasses, so a broken link never frees a transcript; invariant 6, the sweep's own backlog, is the one it does not wait on (it would wait forever). Held back, it says so inserve.logonce a UTC day. - known — the grace is read against the wall clock, so a clock set forward releases early and
one set back holds late; and
checkcompares each rewrite line with every later end, quadratic in the ledger's rewrite lines, which is cheap at the store's size today.
check
sandman check # every violation, or check: <n> notes, <h> held, <r> released: clean; writes nothing
sandman check --fix # what can be repaired mechanically, then check
sandman check --release # what the release job would delete now, with its bytes; writes nothing
# <path>: release · <session> · <n> bytes | <path>: sweep · <n> bytes, then
# release: <t> transcripts, <c> copies, <n> bytes[; held back: <v> violations]
- every note's frontmatter reads (LF fences, no CR) and has
id:, 12 lowercase hex, unique across memories, knowledge and traces; - every note has a source (
sessions,from:ororigin: import|routine|hand), and none of those keys is-or empty; sessions:holds uuids,from:ids, each sorted and once; no note hasstrength:;- every
from:id was ended by a rewrite line, no active note's id was, and every id'd.pruned/copy's id is active or ended; - every rewrite line has the shape above, an id ends at most once, and every
toid is active or ended by a later line; .pruned/holds no body past depth 1 and its grace;- no released transcript is on disk, and none an active note names is released (since its latest take).
A violation is one stdout line, <path>: <invariant n>: <detail>, the path as
show takes it, in reader order, and exit 1; the first note in reader order keeps a shared id.
--fix, each note by temp + rename, drops an empty or - list and an
origin outside the three, sorts and dedupes the two lists, mints an id for a note without a valid one of its own,
gives a sourceless note origin by its stamp's first word (remember →
hand; consolidate, dream,
reconsolidate, reflect → routine; else
import), prints check: fixed <n>, writes
{"at","fixed":n,"kind":"check","machine"}, then checks. A frontmatter it cannot read
(CRLF, a fence never closed), a bad word on a list, a strength: and the ledger are left for
a person. A rewrite line's violation reads ledger <its at>: 5: …, after every note's,
then an orphaned copy's <its .pruned/ path>: 4: id <id> is neither active nor ended: restore it or end it.
forget keeps a rewrite line, its session taken off the entries, and one into a note it
erases loses its to and that note's entries, so 4–5 hold through it. A 6 or a 7 reads
<its .pruned/ or .archive/ path>: 6: past depth 1 and its grace,
… 7: released <at>, still on disk, after the ledger's; a note's 7 is
names released <session>. --release prints every violation but 6s
first, exit 1 while any holds the job back.
chart
"memories"|"knowledge"|"traces": [{…,"from":[str],"id":str|null,"origin":str|null,"state":"active","strength":number}]
"ended": [{"at","id","into":str|null,"op","path","sessions":[str],"state":"ended"}]
"lineage": [{"at","from":<id>,"op","to":<id>}]
"taken": [{…,"held":bool,"released":str|null}] a released one from its release line, state "released"
Gate spans
Every run of mise run check is one OpenTelemetry trace through
floodgate span: a check span with each step nested under it
(fmt, clippy,
cover, stele.check and stele.emit),
so floodgate's page shows which steps cost the time and CPU.
A step is wrapped in mise run span -- <name> [--attr k=v]… -- <cmd…>
(.mise/tasks/span): it execs floodgate span when
floodgate is on PATH, else the command after the second --, so
a machine without floodgate, CI included, gates as before. The steps live in the
check:steps task and check wraps it; to add a step, put it in
check:steps wrapped the same way; a step left bare is time no span explains.
The check:steps and cover tasks set
LLAMA_LIB_PROFILE=Release (llama-cpp-sys-2's own hook), so llama.cpp builds without debug
info, which embeds the build directory's absolute path in every object and kept mbx from sharing them between
checkouts. A cold gate in a fresh worktree fell from about 1,476 to about 840 CPU-seconds (measured 2026-11-29 · floodgate spans, a fresh worktree after a first run). What remains uncached is
mbx's: 25 ggml-cpu and ggml-metal compilations carry -F<SDK>/System/Library/Frameworks,
a flag its C adapter does not model, and the build script is keyed by its per-checkout OUT_DIR.
GGML_ACCELERATE=OFF would drop the flag from ggml-cpu but hangs the
sandman-infer ops test, so it stays on.
Next
Parts still to bring over, and the memory cycle's ten stages, all built.
mark: the mod's tool log moves into the ledger, which becomes every mod event:markwrites acallline per tool call and apromptline per typed prompt. Readers that need only sessions skip those kinds; encoding, consolidation and the end-of-day judge read a session's calls and prompts from it.recall: the seed, the agent's pull andshoware built; the mod wiring is next, all on its own page.knowledge: the store is built; rehoming the existing memories and promoting a playbook to a skill are next, on its own page.intentions: the verbs and the seed's due block are built; matching an event-based one to a session and a timeline in bifrost are open, on its own page.
The memory cycle, built one stage a sitting, each leaving mise run check green:
- ids and sources built —
id:on every write (encode, remember, consolidate's keep and merge),origin: handfromrememberwithout a session; the reader'sid,from,origin; chart's row keys andstate;checkinvariants 1–3 and--fix. The owner then runscheckandcheck --fixon the root. - rewrite lines built — consolidate's ops as rewrite lines;
idon recall, show and remember lines,idson encode's; chart'sendedandlineage; invariants 4–5. - rethink in session built — the verb, the MCP tool, the seed's sentence,
eval/recall.jsonl,forgetover it. - rethink at encode built —
# recalled, encode's contract andverdicts. - strength built — the count, chart's
strength, the knobs. - order in a bank built — consolidate's merge of notes,
# judged(revise, prune), retitle; the order measure. - across banks built — rehome, rung-1 graduation,
# elsewhere. - the weekly review built — decay,
# standing,# relearned, proposals as intentions,doneanddropon them. - release built — the job, the depth-1 sweep, chart's
heldandreleased, invariants 6–7,check --release. The owner readscheck --releaseon the root before installing it: its first run releases every transcript no note names. - the recall evaluation built — a score over
eval/recall.jsonl, the order measure'sevaland its revert; reflect's selection question, scored by the decision model over the examples.