Hooks
Hooks are the points in a session where a harness calls the Signet daemon. They let Signet add context the agent did not ask for, record what happened in the session, and mark where a session ends. Explicit memory tools such as memory_search and recall are a separate path; hooks are the automatic one.
Each hook is an HTTP endpoint. Most harnesses reach it through signet hook <name>, a plugin, or an extension. Request and response fields are in the Sessions and hooks API.
The session lifecycle
Section titled “The session lifecycle”| Hook | When it runs | What it does |
|---|---|---|
| Session start | A session begins or is cleared | Returns the stable Signet prefix, identity, MEMORY.md, and Session Continuity previews |
| Prompt submit | Before each user turn | Records the turn and runs bounded recall when the prompt names a known entity |
| Stop | The agent finishes a turn | Appends the final assistant reply to the live transcript |
| Pre-compaction | Before the harness compacts its context | Returns instructions for writing a compaction summary |
| Compaction complete | After compaction | Saves the summary and resets per-session recall |
| Session end | A session ends, forks, switches, or is deleted | Queues canonical transcript capture for Dreaming |
Session start
Section titled “Session start”Session start builds the context an agent sees before its first turn. It is the only hook that delivers identity files and the MEMORY.md working-memory layer. Session Continuity adds individually ranked memories as bounded previews. Each preview keeps the memory’s full ID, so the agent can fetch the exact record with memory_get when a preview is truncated. See POST /api/hooks/session-start.
Startup candidates are ranked by project match first, then by an effective score: pinned memories score 1, and other memories score importance × 0.95^ageDays. hooks.sessionStart.recencyBias is parsed but does not affect this ranking (#2347). Context profiles let a harness use smaller or larger startup budgets; the keys are in Hooks config.
A harness that reconnects to a restarted daemon mid-session sends claimOnly: true. Signet then renews the session claim and returns no context, because the conversation already has its original startup prompt.
Prompt submit
Section titled “Prompt submit”Prompt submit runs on every user turn but adds memory only when it has a reason to. It appends the user turn to the live transcript, then looks for known people, projects, and active aliases in the prompt. See POST /api/hooks/user-prompt-submit.
Stop records the reply that ends each turn. Without it, the live transcript would hold user turns but miss the agent’s answers until the harness exported the full transcript at session end. See POST /api/hooks/stop.
Compaction
Section titled “Compaction”When a harness compacts its context, the agent loses earlier turns. Pre-compaction gives the harness instructions for a durable summary. Compaction complete saves that summary as a session_summary memory and a temporal artifact linked to the session, unless the session is classified as noise. It also starts a new context epoch, so memories delivered before compaction can be delivered again. See POST /api/hooks/pre-compaction and POST /api/hooks/compaction-complete.
Compaction complete takes its project from the stored transcript, then from project. When the transcript is not stored yet and the request sends only cwd, the summary is saved with no project (#2346). Send project when compaction can come before the first transcript write.
Session end
Section titled “Session end”Session end marks a real boundary. Only these reason values count: clear, session.deleted, session_branch, session_fork, session_shutdown, session_switch, and stale-session-sweep. clear resets the session’s startup dedupe, recall epoch, and continuity state, then returns without capturing the transcript. Each of the other reasons queues canonical transcript capture and completes the session’s transcript row. Any other request, including OpenCode’s session.idle, is treated as the end of a turn: it does no transcript capture and returns { "memoriesSaved": 0, "queued": false }. See POST /api/hooks/session-end.
Session end does not write a session summary. The daemon also finalizes abandoned sessions itself, at most 10 per 15-minute sweep, using the stale-session-sweep reason.
Stable and dynamic context
Section titled “Stable and dynamic context”Session start returns its context in parts, so a harness can keep its prompt cache valid:
stableSystemPromptis the fixed Signet prefix. It has no clock, peer list, or recalled memory, so it is byte-identical across sessions.dynamicContextholds everything that changes: identity,MEMORY.md, continuity previews, and peer state. Harnesses deliver it through a hidden or provider-bound channel, not as part of the user’s message.injectcombines both for older connectors. It is wrapped in a versioned<signet-memory-context>envelope, andcontextHashcovers its exact bytes.
Prompt submit adds clockContext, the current time in the daemon’s time zone. It is kept out of inject and the envelope, so a new timestamp never changes the context hash.
hooks.sessionStart.maxInjectTokens bounds the startup payload before it is framed. Cross-agent notifications and board notices are appended after that, so the final inject can exceed the setting (#2348). Continuity budgets are estimated from UTF-8 byte counts, not a model tokenizer.
Signet strips its fenced memory context, including the envelope, from canonical transcripts. Text outside the fence is not stripped: notifications appended after the envelope (#2348) and a wake message that a harness delivers as a user turn can appear in the stored transcript.
Why automatic recall is narrow
Section titled “Why automatic recall is narrow”Automatic recall competes with the user’s prompt for the model’s attention, so prompt submit is strict about what it adds:
- Entity-gated. Recall runs only when the prompt names a known entity or alias. Low-signal prompts skip the check entirely.
- Bounded. Results must clear
hooks.userPromptSubmit.minScore, and the rendered block must fitmaxInjectChars. Raw transcript text and model-written recall summaries are never injected. - Deduplicated. Each memory is delivered at most once per context epoch.
An empty inject means Signet chose not to add context. It does not mean no evidence exists. Agents can still search with memory_search, recall, or session_search.
Startup dedupe and the recall ledger
Section titled “Startup dedupe and the recall ledger”Two separate mechanisms stop Signet from repeating itself.
Startup dedupe is in memory. If session start runs again for the same agent, harness, project (or cwd), and session key, Signet returns a minimal response with the stable prefix and no memories instead of rebuilding startup context. A clear or a daemon restart resets it. A compaction resets the entry for the project (or cwd) the compaction request resolves to, so it clears the earlier start’s entry only when both resolve to the same project.
The recall ledger is durable. It records which memories each session has received in the current context epoch. Its key is the agent plus the session key and harness. Project and cwd do not change it. Session start, prompt submit, /api/hooks/recall, and explicit recall with a session key all share it. A clear or a compaction starts a new epoch. Prompt submit injects a memory only after its delivery is recorded in the ledger, so a request with no session key gets no automatic recall.
Live turns, transcripts, and Dreaming
Section titled “Live turns, transcripts, and Dreaming”Session evidence moves through three stages:
- Live turns. Prompt submit and stop append turns to the live transcript while the session runs. This keeps evidence current if a session never ends cleanly.
- Canonical transcript. A recognized session end queues capture of the harness transcript. Signet stores a cleaned, conversation-only JSONL record and marks the session’s transcript complete.
- Dreaming. Only completed transcripts go to Dreaming, which decides what becomes memory and owns
MEMORY.mdpublication.
Lifecycle hooks do not extract memories from transcripts. Dreaming does that work after the transcript is complete.
Cross-agent notifications
Section titled “Cross-agent notifications”Agent sessions can send each other messages. Messages are stored durably and stay unread for a recipient until that agent acknowledges them or the seven-day retention window passes. Acknowledgement is per agent, so one agent acknowledging a broadcast does not hide it from others.
Session start and prompt submit append unread messages to their response, up to five per hook, with each message cut to its first 1,800 characters plus an ellipsis. A harness can also check for messages at other points, such as before a tool call, through POST /api/hooks/notifications. That endpoint does no recall and no transcript work. It accepts SessionStart and UserPromptSubmit for every harness, plus each harness’s own hook names listed in the harness table.
Delivery is not acknowledgement. An agent must call agent_message_ack (or the ack endpoint) after it handles a message, or later hooks deliver it again. Peer messages are labeled as untrusted coordination data, not instructions.
Harnesses that carry Signet’s messaging tools (Claude Code, Codex, OpenCode, Gemini CLI, Kimi, Muse Code, ForgeCode, Hermes Agent, and pi) get an Agent Messaging section at session start. It names the session’s agent and session key, explains direct messages versus the board, and lists up to five active board topics.
Direct-message wake
Section titled “Direct-message wake”Hooks run only while a session is working. An idle session would not see a message until its user came back. Direct messages, sent to an agent or to a session, can therefore wake the recipient.
A connector holds a long poll open on POST /api/cross-agent/wake. When a direct message arrives, Signet claims up to 10 waiting messages and returns them for the harness to inject. Each message wakes a session at most once, and the claim survives a daemon restart. A message sent to an agent wakes that agent’s most recently active waiting session. Each session can be woken 30 times per rolling hour; after that, messages wait for normal hook delivery.
Waking is not acknowledgement. The agent still acknowledges each message after it handles it. A connector that cannot deliver a wake returns the claim with POST /api/cross-agent/wake/release, so the message can be delivered again.
Broadcasts never wake a session.
Board notices
Section titled “Board notices”The message board is for topic threads that anyone can pick up. Posting never wakes anyone. Instead, session start and prompt submit list threads the current session took part in that have new posts from other sessions. A thread’s notice appears once, and again only after more posts arrive. Two hooks for the same session that run at the same time do not both receive it.
Bypass
Section titled “Bypass”Bypass turns off automatic hook work for one session while leaving explicit tools available. Use it to work without automatic context or capture without stopping the daemon.
SIGNET_BYPASS=1(orSIGNET_NO_HOOKS=1) makessignet hookexit before it contacts the daemon.POST /api/sessions/:key/bypassor the MCP bypass control marks a tracked session as bypassed. Hooks then return no-op responses, notifications return nothing, and wake returnsreason: "bypassed". Session end still releases the session’s claim.
MCP tools such as memory_search and memory_store keep working while a session is bypassed.
Installed hook and MCP launchers
Section titled “Installed hook and MCP launchers”Connectors that write hook commands or MCP entries (Claude Code, Codex, Gemini, Kimi, Muse Code, ForgeCode, and OpenCode) choose the Signet launcher in this order:
SIGNET_HOOK_COMMAND, thenSIGNET_CLI_PATH, when set.- The Signet launcher already registered in that harness’s hooks or MCP entry.
- Package and runtime discovery.
Keeping an existing launcher means a container-based install does not overwrite a working host path. Sync replaces an existing launcher only when its path is missing and the path’s first two directories exist, which shows it is checking the same filesystem. Otherwise it keeps the launcher: silently when the launcher is present, with a warning when its path cannot be verified. Sync keeps other tools’ hooks and MCP servers.
To set a host path explicitly:
SIGNET_CLI_PATH='/host/bin/signet' signet syncSIGNET_HOOK_COMMAND='["/host/bin/node","/host/signetai/bin/signet.js"]' signet syncSIGNET_CLI_PATH is a single executable path. SIGNET_HOOK_COMMAND is an executable path without spaces or a JSON argv array. Neither is a shell expression, and neither is checked against the installer’s filesystem. SIGNET_HOOK_COMMAND wins when both are set. For remote daemons and connector keys, see Remote harness connectors.
Harness capabilities
Section titled “Harness capabilities”Every harness accepts SessionStart and UserPromptSubmit for notifications. The table lists the extra notification hooks and the wake path for each harness. Setup and installed hooks are on each harness page.
| Harness | Extra notification hooks | Wake |
|---|---|---|
| Claude Code | PreToolUse |
asyncRewake hooks on SessionStart and Stop run signet hook wake, so an idle session can wake |
| Codex | PreToolUse |
A synchronous Stop hook runs signet hook wake --no-wait, so messages arrive when a turn ends; no idle wake |
| Hermes Agent | on_turn_start, prefetch, sync_turn, on_delegation |
A background waiter injects with inject_message |
| pi | context |
A background waiter sends a follow-up user message |
| OpenCode | chat.message, tool.execute.before, experimental.chat.system.transform |
Hook delivery only |
| OpenClaw | message_received, before_tool_call, before_prompt_build, before_agent_start |
Hook delivery only |
| Oh My Pi | before_agent_start |
Hook delivery only |
| Kimi Code | None | Hook delivery only |
| Muse Code | None | Hook delivery only |
| Gemini CLI | poll |
Hook delivery only |
Kimi’s connector installs its session-start and prompt-submit hooks with a --kimi-json flag that signet hook does not accept, so those two hooks fail before they reach the daemon (#2350).
To build a new integration, start with the Sessions and hooks API and Develop a harness integration.

