Claude Code
Claude Code is the most deeply supported host: the full loop (serialize -> carry -> brief -> recall) runs on it in real daily use, and field incidents feed back into the code — the evidence trail lives in the research logbook.
Install (plugin — recommended)
/plugin marketplace add Daily-Nerd/daimon
/plugin install daimon@daimon
The plugin registers the SessionStart / UserPromptSubmit / SessionEnd /
PreToolUse hooks itself via .claude-plugin/plugin.json + hooks/hooks.json. Order
doesn't matter relative to installing the daimon CLI: if the hooks land
before the CLI, sessions start normally and the hook prints a one-line install
hint instead of a briefing.
Don't mix install paths. Plugin users must not also run the manual hook installer below — both paths coexisting registers the hooks twice (double briefings, double serialize LLM calls). Switching from manual to plugin: run
python3 hook/daimon-hooks.py uninstallfirst.
Install (manual, from a clone)
Working from a source checkout without the plugin system, hook/daimon-hooks.py
is the lifecycle manager:
python3 hook/daimon-hooks.py install [--dry-run]
python3 hook/daimon-hooks.py uninstall [--dry-run]
python3 hook/daimon-hooks.py status
Install copies the hook scripts to ~/.claude/hooks/ and registers them
under SessionStart / SessionEnd / PreToolUse in
~/.claude/settings.json (idempotent;
settings backed up before every mutation). Proactive recall (the
UserPromptSubmit hook below) ships with the plugin only; the manual install
registers just these three events. Requires the daimon CLI on PATH:
uv tool install 'daimon-briefing[pretty]', see the
quickstart — and the hooks also accept the
deprecated daimon-briefing alias as a fallback. After upgrading the CLI,
re-run install so the hook scripts stay in sync.
What each script does
Four scripts run on this host, whichever install path registers them. Three close the capture -> inject loop; the fourth guards shell actions:
-
daimon-session-brief.py—SessionStarthook. Reads the payload from stdin and shells out to the installeddaimon briefCLI (single source of truth for rendering); prints the briefing to stdout, which Claude Code injects as session context. Per-project routing: the hook does not choose a checkpoint. The payloadcwdis forwarded to the CLI viaDAIMON_PROJECT_DIR, anddaimon brief --labelreads this project's checkpoint (bucket slug rule:/Users/x/proj->-Users-x-proj; rundaimon slug <path>to print it for any path; it is not the scheme Claude Code uses for~/.claude/projects, which folds_where daimon keeps it) and prints the oneDAIMON BRIEFING (checkpoint: ..., written ... ago)line above the briefing; the hook prints it as given. A project with no checkpoint of its own gets no other project's briefing. The global checkpoint is read only whenDAIMON_BRIEF_GLOBAL_FALLBACKopts in, for a project that has an identity, and never on aDAIMON_TENANT_SCOPEDhome; the label then ends(global fallback - checkpoint may be from another project). A payload with nocwdfalls to the hook process's own working directory, never to the global pointer, and a project with no identity gets no briefing. Adaimonolder than--labelprints the briefing without the label line. The same holds for the Codex, Gemini and Kimi hooks. Fail-open: always exits 0, prints a one-line diagnostic on failure instead of dying silently. RespectsDAIMON_DISABLEandDAIMON_CHECKPOINT_DIR. -
daimon-session-end.py—SessionEndhook. Reads the payload from stdin and spawnsdaimon serialize <transcript_path>as a detached background process — serialization is an LLM call (30s+ on long sessions) and must never block/exit. The payloadcwdis passed to the child asDAIMON_PROJECT_DIR, so the serializer writes this project's<slug>/latest.jsonin addition to the globallatest.json(kept for backward compatibility and the fallback path). Nocwd-> child env untouched, global-only as before. Diagnostics and serializer output land in~/.daimon/logs/serialize.log— both thewrote checkpoint: <path> (took Ns)success line and named-error lines (... after Ns) carry elapsed seconds. Fail-open, respectsDAIMON_DISABLE. Not fired on hard kills (terminal closed, SIGKILL) — briefings can still be stale, which is why theSessionStartheader shows checkpoint age.LLM credentials come from
~/.daimon/env(see Connect an LLM) — hooks inherit the host process environment, not your shell profile, soDAIMON_LLM_API_KEY/DAIMON_LLM_MODEL/DAIMON_LLM_BASE_URLbelong in that file (chmod 600). Without it, serialize fails fast with a named error in~/.daimon/logs/serialize.log. -
daimon-prompt-recall.py—UserPromptSubmithook (proactive "you worked on this before" recall). Fires on every prompt, pipes the prompt todaimon recall-injecton stdin, and injects a one-line pointer when the prompt overlaps a prior open loop. Because it fires per-prompt, failures are silent (exit 0, no output) — the only thing it ever prints is a real suggestion. Prompts that are not a person asking for work never match: slash commands (host directives) and host-emitted machine blocks — background-task notifications, teammate/agent messages, command output. The plugin install also declares the read-only MCP server inmcpServers, so this pointer names thedaimon_recalltool instead of thedaimon recall "..."shell command — the plugin's own hook entry setsDAIMON_MCP_TOOL_AVAILABLE=1because it is the one install path guaranteed to also register that tool. The manual install below does not set this flag and keeps the shell-command form unless you register the MCP server yourself. -
daimon-pre-action.py—PreToolUsehook, matcherBash. This is the first daimon hook that can fail a host action. Before a shell command runs, it reads the armed-check manifest, keeps the checks armed for the action's working directory, and runs the ones whose pattern matches the command. A check ratified with intentenforcethat reports a violation, or a subject daimon could not read, comes back as Claude Code's structured deny and the command does not run;warncomes back as an allow carrying the reason;record-onlysays nothing to the host at all. Everything it decides lives inchecks_host.py, loaded from beside the script, and the script itself only names its host. Exits 0 on every path, writes nothing to stderr, and writes either one JSON object or nothing at all. See Checks at runtime.Every run appends one row to
~/.daimon/logs/checks.jsonl. A row proves the check RAN. Onlydecision_emitted: denyunderenforcecloses the gap between a check that ran and a check that was honored. The file is capped at 256 KiB, the last 64 KiB kept, so the counts daimon reports from it cover a window and every surface that prints them says where that window starts.DAIMON_DISABLE=1in the host's environment turns every daimon hook off, this one included, and is the way out of anenforcecheck whose pattern matches more than you meant: the command that retires the ruling is itself a shell action the check would otherwise deny.The budget is shared across the whole action, not given to each check, so on a crowded manifest a later check can find the time already spent and report
unresolved, which denies underenforceand warns underwarn. Keep a project's armed checks few and their bodies fast.
These two capture/inject scripts are wired in one of two mutually exclusive ways — pick ONE (both at once double-fires every session: two briefing injections, two serialize LLM calls). See the install sections above.
Rows a capture never reads
A capture reads the conversation and nothing a host or a hook wrote around it. These rules decide which transcript rows are excluded, each with a stable code:
| Code | Row dropped |
|---|---|
sidechain | isSidechain is true (a sub-agent exchange) |
meta | isMeta is true |
attachment | the top-level type is attachment, whatever its inner type |
compact-summary | isCompactSummary is true |
session-owner, file-history-snapshot, file-history-delta, last-prompt, ai-title, mode, permission-mode, queue-operation, system, summary, pr-link, bridge-session, cost-state, tools-used, atis-latch, api-request, api-request-blob, api-request-shape | host bookkeeping: the top-level type is this name and the row names no role. The code is the type |
Hook output reaches a transcript as attachment rows, daimon's own briefing
included, so none of it is read back. An attachment row is dropped even when
it also carries a message. The contract a host can pin: a row read by the
generic loader with top-level type: attachment, or with isSidechain,
isMeta or isCompactSummary set to true, contributes no text, no id and no
coverage row to any capture.
A compaction summary is text the model wrote, so a capture keeps the
conversation the summary was made from, which is almost always earlier in the
same file. When a summary is the first conversation row of the file, the
capture starts without that context. serialize.log then gets a line,
note for <session>: compact-summary-only-context, and admitted_messages
carries the same note.
Every non-empty line of a transcript ends up in exactly one bucket: admitted, excluded (a code above), or dropped with one of these codes:
| Code | Row dropped |
|---|---|
no-role | the row carries no turn the adapter reads: no user or assistant role, or an event type it does not know |
no-content | a turn with no text in it |
tool-result-without-id | a tool result with no host id to be cited by |
tool-use-only | a row of tool calls and no text |
unparsable-line | a non-empty line that is not a JSON object |
When a capture dropped rows, serialize.log gets one line per reason,
note for <session>: rows-dropped: <reason>=<n>, and admitted_messages
carries the same notes. A transcript with rows and no admitted conversation
is a read failure, not a short session: daimon serialize and the session-end
hook write an error: unreadable-transcript: ... line, which daimon status
counts and daimon heal retries. A file with no rows at all is a skip,
empty-transcript, and so is a file where every row was excluded and none
dropped (a session that was opened and left holds only bookkeeping rows):
no-conversation. One row of an unknown shape among them is enough to make
it a failure again. A session that is merely short is still the
transcript too short skip.
A host can pin its own tests to this:
from daimon_briefing import api
admitted = api.admitted_messages("session.jsonl")
admitted.messages # a tuple of read-only mappings: what a capture reads
admitted.notes # codes, or "code: detail"; never raises
api.EXCLUDED_ROWS # code -> one-line meaning
Removing a code is a breaking change. Pin codes by inclusion, not equality, because a code may be added.
Importing past sessions
daimon import --project <dir> discovers this host's sessions on its own: it
lists ~/.claude/projects/<slug>/*.jsonl and matches each file on the working
directory its rows recorded, never on the directory name, which is a lossy
slug. The plan, the bound and the resume are in
Import past sessions;
every refusal is in the command notes.
Teach the agent the protocol
daimon skill install claude # ~/.claude/skills/daimon/SKILL.md
Install delivers two skills: daimon (the protocol) and daimon-end, the in-session /daimon-end checkpoint flow, written next to it as ~/.claude/skills/daimon-end/SKILL.md.
daimon skill show prints the skill content; daimon skill list shows which
scopes each host supports. Re-run install after upgrading daimon to refresh
the content.
Verify
daimon status
daimon status reports capture health honestly, including failures, skips,
and crashes. A failed capture gets one automatic retry: the next session
start launches daimon heal in the background, which re-serializes the
newest failed session whose transcript is still on disk, once per session.
A second failure stays listed in daimon status as "retry attempted, still
failing" until you run daimon heal --force. End a session -> a checkpoint
is written; start the next -> the briefing appears.