Skip to content
Loom Docs
Esc
↑↓navigate↵open⌘Jpreview
Product
On this page

Claude Code plugin

Installed for one of the two, memory or the code index, it does only that one's part (Modes).

The loom plugin for Claude Code does three things in one install:

  • Mounts the Loom tools over MCP: memory, working memory, context.pack, the code index, the duplicate check.
  • Captures the session through lifecycle hooks: tool calls, chat turns, a run record, a working-memory note, a session brief and the session’s facts. The hooks make no model call, and the agent has nothing to remember to do.
  • Steers the agent to the code index inside a Loom-indexed repository. Whole-file reads and tree-wide greps are redirected to code.* operations, and an edit gets the file’s rules before it, and its blast radius and the tests linked to the file after it.

Installed for one of the two, memory or the code index, it does only that one’s part (Modes).

Source: integrations/claude-code-plugin/, Node ESM scripts with no dependencies. The Codex build runs the same scripts; see codex.md.

Project instructions for MCP-only sessions

An MCP connection makes tools available; it does not require the agent to choose them. When using Loom without the plugin’s routing hooks, add retrieval guidance to the project’s existing CLAUDE.md. Preserve its other instructions and name the paths the index actually covers:

When Loom MCP is configured, use its tools for supported context lookups:

- loom_code_search for behavior; loom_code_symbol for a definition or path:line;
  loom_code_outline for structure; loom_code_grep for text; loom_code_callers for callers.
- Read returned bodies and linked lessons before retrieving more. Follow named
  callees with loom_code_symbol. Discover deferred tools with ToolSearch.
- Use loom_search for relevant history, decisions and documents. Check source
  references, freshness and code-link state before relying on a recalled fact.
- Avoid repeating a successful Loom lookup locally. Explain missing context
  before falling back. Use local tools for unindexed or edited files, editing,
  tests, builds and Git, or when Loom is unavailable.
  When Loom is absent, use the available local tools. Skip retrieval when the
  conversation already contains the evidence needed.

This guidance leaves the agent in charge of its solution and verification. It does not guarantee tool selection or fewer calls. Inspect the session trajectory to distinguish successful retrieval, tool errors and local fallback.

The software factory template is shared across its five arms, including the baseline without Loom. Its protocol retains the exact instructions and their hash. Keep these instructed measurements separate from measurements with no project guidance.

Data handling

This section covers the Claude Code plugin and the Codex plugin, which run the same scripts; Codex wires all but the token-usage hook. The hooks and the plugin’s scripts send data only to the Loom server the plugin is configured with; the two skills named at the end of this section are the exceptions. The plugin sends:

  • whatever the agent passes to a Loom MCP tool: memories it saves, search and code queries;
  • the repository’s identity. The owner and name of each git remote go to code.repos to find its code index, with the host of a remote on github.com; the MCP entry says which of them the server names to GitHub. The owner and name of the matched remote go with every observation, run record and session brief; the branch and HEAD commit go with each brief, and the absolute working directory with the run record. Observations and session memory are tagged with the checkout’s directory name and a hash of the repository, and observations also carry the working subdirectory;
  • prompts: the first 2,000 characters (20,000 to the code index), to fetch recalled memories for them (context.pack) and, where this Loom holds the checkout’s own repository in its code index, to search that index (code.search; prompt_pack=off stops it); LOOM_PROMPT_CONTEXT=off stops both, and the server keeps the text of a code-index search for 180 days (what a prompt gets);
  • each tool call’s input, output or error (observe.record), and the paths of files read or edited, for the code shunt, file rules and blast radius; a symbol name taken from a redirected grep pattern (code.symbol); and the search query of a gh issue search the tracker shunt answers (tracker.duplicate_check), with the owner and name of a repository the command names (code.repos);
  • for each bulk file read or grep in an indexed repository that the code shunt redirects or lets through, the tool name, file path and line range, and an estimate of the tokens it kept out of the context or let in (code.outcome; LOOM_SHUNT_REPORT=off stops it);
  • chat turns (conversation.append), which the server stores only when the namespace has conversation logging on;
  • the session’s last turns (up to 200), to memory.set_from_messages, which keeps them as source evidence for the facts it extracts whatever the logging setting is, with up to 80,000 characters of the session’s Loom tool arguments and results, and with the paths and last-write times, never the content, of the checkout’s files that changed since the session began: tracked files and untracked files git does not ignore, whatever wrote them, at most 50. A tracked file of code also carries the names of the definitions its changed lines are in, at most four of 120 characters each, read from the hunk headers and the added definition lines of git diff -U0 (LOOM_SESSION_MEMORY=off stops all of it);
  • a run record (the first prompt as its goal, the last reply) and a working-memory note (goal, git status, files edited, last reply);
  • a session brief at each compaction and at session end: the client’s compaction summary of the whole context window (up to 15,000 characters) and a log of the session’s events, with each ask and reply, command, file read or edited, search pattern, web address or query, subagent prompt, error, todo list, other tool’s name, and pull request and commit identifier. The server stores none of it, summary or log, when the namespace has conversation logging off (LOOM_SESSION_BRIEF=off stops sending it);
  • token usage and the model name (Claude Code only);
  • after each edit in an indexed checkout, the outline of that file’s uncommitted diff against HEAD, to code.impact (LOOM_BLAST_RADIUS=off stops it);
  • the first time a session changes a file in an indexed checkout, with an edit tool or a shell command that names it, the outline of that file’s uncommitted diff, to code.test_gate (LOOM_TEST_GATE=off stops it). Where the install turns the gate’s stop on (stop_test_gate), it goes once more at the Stop of a session that ran no test since its last code change, for the files it changed. With LOOM_TEST_GATE=block the outline goes at Stop only, for the files the session changed, or for the whole uncommitted tree when the client gives no transcript. A diff’s outline, up to 200,000 characters, is its file paths, its hunk line ranges and, in a code file, the last identifier before the first ( of each hunk header’s context, usually the enclosing function’s name. Git takes that context from a line above the hunk in the old file, which an earlier hunk of the same diff may have changed; no other part of a changed line is sent;
  • with no credential, at the first session, your OS user name and host name, to request a self-signup token (refused unless the server allows self-signup; LOOM_AUTO_SIGNUP=off stops it);
  • in agent mode, the workload’s identity token and LOOM_CLIENT_ID, to the server’s /oauth/token, in exchange for a Loom token.

The plugin’s mode narrows the list. In code mode the hooks send no tool call’s input, output or error, no chat turn, no session turns for extraction and no list of changed files, no working-memory note and no brief, and fetch no recalled memory. They still send each prompt’s text as a code-index search where the checkout is indexed (code.search; prompt_pack=off stops it), the run record (the first prompt and the last reply; LOOM_RUN_LEDGER=off stops it), token usage and the model name (LOOM_USAGE=off stops it), and the code-index items above: a redirected grep’s symbol, the read and grep records, diff outlines and the repository’s identity. In memory mode they send nothing to the code index: no remote’s owner and name to code.repos, no redirect, no read or grep record and no diff outline.

What the hooks do lists the hooks behind these requests. A client-side redaction removes common credential shapes from the prompts, tool calls, turns, run records, notes and briefs the hooks send. It is best effort, not a guarantee. MCP tool arguments and a brief the loom-session skill saves are sent without it.

The server keeps this in its own databases (ClickHouse, and Postgres when the operator stores memories there). It passes text to an LLM or embedding provider only if its operator configured one (models and keys). Deleting data is covered in retention and erasure. Users whose grants allow them to read a stored row, and the server’s operator, can read it. Namespaces and sharing describes access control.

The plugin keeps the token it saves (a copy of the one the hooks were given, or a self-signup token, in ~/.loom/config.json; in agent mode the exchanged one in ~/.loom/agent-token-<hash of LOOM_CLIENT_ID>.json) and its other state in ~/.loom/, mode 0600, until you remove it.

Its files in the system temp directory, which can hold prompt and reply text, are also mode 0600. After a tool call and at the end of a reply one of them holds the event as the client sent it, tool input and output included and not yet redacted, until the process that records it has finished. A queued write or event whose process stopped before sending it stays until you replay or delete it; loom-status counts these and names the directory. A write the server refuses, or that cannot reach the server, is discarded. A batch of the per-file read and grep records above that fails to send is discarded too. Chat turns that fail are sent again at the end of the next reply, and a brief’s events at the next brief save. At session start the plugin tries to remove other state files untouched for a day. They can remain longer, especially when no new session starts. The log of which tool calls the plugin redirected or let through (no prompt or file content) stays until you remove it (LOOM_SHUNT_LOG=off stops it).

Two skills reach other services, each only when you ask for it. The loom-status skill can install Node.js from NodeSource through apt, dnf or yum, or from apk or Homebrew, and runs that installer only after you agree. The improve-loom-for-my-repo skill searches the ClickHouse/loom GitHub issues for each finding it reports and, after you approve, files its report there, or adds it as a comment on the issue that already reports it. The issue is public, and holds the report as shown to you: the server version, namespace, indexed commit and how much of the repository is indexed, and for each finding a reproduction with its queries, symbols and file names.

Requirements

  • A reachable Loom server (quickstart).
  • Claude Code 2.1.139 or newer, the first that runs a hook’s args with no shell. An older one drops them and runs node with the hook’s payload as its program: every hook fails with a SyntaxError.
  • Node.js 18 or newer as node on the PATH Claude Code starts with. Every hook is node with the script’s path as its argument, which Claude Code spawns with no shell, and the MCP header helper is node "${CLAUDE_PLUGIN_ROOT}/bin/loom-mcp-headers.mjs". That PATH is Claude Code’s own: started from a terminal it is the shell’s, but started from the Dock or a desktop launcher on macOS it is only /usr/bin:/bin:/usr/sbin:/sbin, which holds no Node from Homebrew, the nodejs.org installer or a version manager. Then set PATH in the env block of ~/.claude/settings.json to the whole search path with that Node’s directory first, such as "PATH": "/opt/homebrew/bin:/usr/bin:/bin:/usr/sbin:/sbin". The env block applies to every Claude Code session, terminal ones too, so it needs the whole path, not only Node’s directory. If a hook says node was not found, run the loom-status skill; it diagnoses read-only and offers to install Node, running the installer only when you say yes.
  • Supported platforms: macOS (Apple silicon, Intel), Linux (x86_64, arm64; glibc or musl; WSL 2 included) and Windows (x86_64, arm64), with or without Git Bash: the hooks need no shell, and the header helper runs under sh on macOS and Linux and cmd.exe on Windows. A hook that finds no node lets the session continue; Claude Code shows it as a hook error. Without Git Bash, commands run through Claude Code’s PowerShell tool are captured and the test gate reads the paths they name.
  • A writer token for the namespace the session writes to. A viewer token lets the tools read, but the server refuses every capture.

Install

The install steps are in connect a coding agent. In short:

claude plugin marketplace add ClickHouse/loom        # or a path to a local clone
claude plugin install loom@loom \
  --config server_url=https://loom.example.com \
  --config token=<writer JWT>

Install either this plugin or loom-code-skill, not both; the plugin already ships the loom-code skill. Update with claude plugin update loom@loom: hooks ship with the plugin, not the server.

Option Default Meaning
server_url $LOOM_BASE_URL, else http://localhost:7777 Loom base URL, no trailing slash
token empty a writer JWT, stored as a sensitive value
mode both both, memory or code: the planes the session uses (Modes)
local_first false true stands the code shunt down (same as LOOM_CODE_LOCAL_FIRST=on)
prompt_pack auto auto, on or off: the code index’s pointers for a prompt, at auto where this Loom holds the checkout’s own repository (same as LOOM_PROMPT_PACK; below)
prompt_pack_pick false true has the server’s pick model choose a bug report’s code pointers (same as LOOM_PROMPT_PACK_PICK=on; below)
prompt_recall first first, on or off: the memory recall for a prompt (same as LOOM_PROMPT_RECALL)
prompt_context true false stops everything the plugin adds to a prompt, code pointers and memory recall (same as LOOM_PROMPT_CONTEXT=off)
stop_test_gate false true holds the end of a session that changed code and ran no test since, once (same as LOOM_TEST_GATE=stop; the test gate)

Every option is optional; Claude Code asks once, and an empty answer falls back to the lookups below.

  • Install token and LOOM_API_KEY. Claude Code gives the plugin’s MCP header helper neither the install options nor LOOM_API_KEY or LOOM_API_KEY_FILE, so the first hook of a session copies the token the hooks were given (LOOM_API_KEY, else the option, else the file LOOM_API_KEY_FILE names) and the URL into ~/.loom/config.json (0600). It does so only when no token is saved (config.json, ~/.loom/token), and never replaces one: when the hooks use another token, from LOOM_API_KEY or the named file, the Loom tools send the saved one and the primer says to save the hooks’ token in config.json.
  • No credential at all. On a server with LOOM_SELF_SIGNUP=open, the first session signs the machine up: token to ~/.loom/config.json, a claim code to ~/.loom/claim-<namespace>.txt, and the primer says how to claim the namespace (once, at /oauth/agent-claim, with a password of your own). LOOM_AUTO_SIGNUP=off disables this. Otherwise the primer says how to get a token.
  • One MCP entry only. Do not add a user-scope loom entry as well: every tool would be listed twice, and that copy carries no code scope.

The instruction block

An agent follows its project’s instruction file. It rarely calls a tool because a tool listing, a skill’s description or a server’s startup instructions suggest it. In a repository whose CLAUDE.md says nothing about Loom, the code index is connected and the agent rarely searches it. Setup writes the missing lines. In a session in the repository, run:

/loom:loom-setup

The skill runs only when you invoke it. It runs the plugin’s bin/loom-setup.mjs, which writes one block between two markers into the repository’s CLAUDE.md (at the root, or under .claude/ where the repository keeps it there) and creates the file when there is none. Where CLAUDE.md imports AGENTS.md with a line @AGENTS.md, the block goes into AGENTS.md, so a repository that Codex also works in keeps one copy. A block that one of those files already holds stays in that file. Nothing outside the markers changes, apart from the two CLAUDE.md cases below, the block takes the file’s line endings, and no server is called. The block applies from the next session. Commit the file: teammates get the block from the repository.

Claude Code reads a repository’s AGENTS.md (at the root, or under .claude/) only where it finds no CLAUDE.md that holds text; text inside HTML comments does not count. The rule was checked on Claude Code 2.1.333; in a session, /context lists the instruction files it loaded. In a repository that has AGENTS.md and no CLAUDE.md, or one without text, setup therefore writes the block into AGENTS.md and creates no CLAUDE.md: a CLAUDE.md holding only the block would replace the repository’s own instructions in every session. Where a CLAUDE.md holds only the block beside an AGENTS.md with text of its own, the session-start line and /loom:loom-status say that AGENTS.md is not read, and the next /loom:loom-setup deletes that CLAUDE.md and puts the block in AGENTS.md. A CLAUDE.md with a line of your own stays, and so does the rule that it replaces AGENTS.md: import AGENTS.md from it to have both read.

A file of your own ends the reading of AGENTS.md in the same way: a CLAUDE.local.md in the repository, or a CLAUDE.md, .claude/CLAUDE.md or CLAUDE.local.md in a folder above it. The CLAUDE.md of Claude Code’s own configuration folder (~/.claude/CLAUDE.md, or the folder CLAUDE_CONFIG_DIR names) is not such a file, also for a checkout under your home folder: the client reads it in every checkout, and AGENTS.md beside it. Where one holds text, Claude Code reads the repository’s AGENTS.md only through a file that imports it. Setup picks the block’s file from the repository alone, so it names AGENTS.md on that machine too. Where a file of your own imports that AGENTS.md (a line @AGENTS.md, the path from that file’s folder, outside a fenced code block), Claude Code reads it and setup adds nothing more. Where none does, setup adds the line @AGENTS.md to the CLAUDE.md at the root: it creates the file where there is none, and a CLAUDE.md that held only the block becomes that one line. Your sessions then read the repository’s AGENTS.md, which they did not before. Every machine reads the two files, with or without a file of its own above the checkout, so commit them together. Where a teammate’s setup wrote the block into AGENTS.md and your machine has such a file, the session-start line and /loom:loom-status say that the block is not read, and /loom:loom-setup adds the line. --remove takes the block out and leaves the import line. A block in an AGENTS.md that a later CLAUDE.md with text does not import is the one Codex reads: setup under Claude Code writes its own into that CLAUDE.md, and --remove there leaves the AGENTS.md one to the Codex plugin’s $loom-setup --remove.

The block has two texts. Where prompts get no code pointers (prompt_pack off, or a checkout no lookup has found in an index yet) it is:

<!-- loom:start (managed by Loom setup: edits here are overwritten) -->

## Loom

- Call `loom_code_search` only when your own search misses the code or the task names no file or symbol.
- `loom_code_callers` and `loom_code_impact` give a symbol's callers and tests.
- The index holds committed code: check what it returns against the files.

<!-- loom:end -->

The block is 40 words and 360 bytes. Claude Code does not pass the two marker comments to the model; what it does pass is 268 bytes, read by every request of a session.

The block asks for no first call. The first line says when a search of the index is worth a request: after the agent’s own search has missed the code, or for a task that names no file or symbol to search for. The entry loads no tool schema up front, so a Loom call costs one tool-search request first (below), and a session told to search the index ahead of its own lookup pays both requests on every task, also where its own first command finds the code. The second line names the tools that answer with a symbol’s callers and the tests linked to it.

Where prompts get the code index’s pointers (prompt_pack: at its default in an indexed checkout, or on) setup writes another text, 46 words and 361 bytes (269 passed to the model):

<!-- loom:start (managed by Loom setup: edits here are overwritten) -->

## Loom

- Loom's code index sends its pointers for a prompt with the prompt, when it has any: paths and line ranges to read.
- Call `loom_code_search` only when none came or none fits the task.
- The index holds committed code: check what it returns against the files.

<!-- loom:end -->

That block asks for no first call. The prompt hook has searched the index with the prompt before the agent reads it and put what it found beside the prompt (what the hooks do, loom-prompt-pack.mjs), so a line making loom_code_search the first lookup would ask for the search a second time: one more request, for pointers the session already holds. The first line says where those pointers come from. The second names the tool for the two cases the hook leaves open: it sent nothing, or what it sent does not cover the task.

Setup picks the text from the prompt_pack option of the last session that started with the plugin, since Claude Code gives a skill’s shell no install option. Codex and a hand-wired client have no option: there setup reads LOOM_PROMPT_PACK. Under on it writes the pointers text. Under auto, the default, it writes the pointers text where the hooks’ last repository lookup found the checkout’s own repository in an index of the Loom they talk to, which is where its prompts get pointers, and the search text anywhere else; it calls no server itself. Under off it writes the search text. Under on and off a block with the other text counts as outdated: the SessionStart line and /loom:loom-status say so, and /loom:loom-setup replaces it in place. Under auto a current block of either text is left alone by both: the text follows each checkout’s index, and the block is a file of the repository that a clone of it and a clone of a fork of it share. Commit the one for the checkouts most of the team works in.

prompt_context does not change the block. A session that turns its prompt context off reads the block the repository holds, hears at SessionStart what a session with the context on would (the outdated line only where the block is the text for the other state of the pointers), and leaves the setting setup reads as the install’s prompt_pack has it.

Either block is the same for the code and both modes and names code tools only. Memory needs no line: the hooks put the session primer and the first prompt’s recall into the session, and a line asking for loom_context_pack would fetch the same context again. Setup therefore writes nothing, and says why, in two cases:

  • memory mode, which leaves the code index out: its MCP entry lists no code tool.
  • A checkout that a session looked up and found in no index, where the search has nothing to answer. Run setup again after the repository is indexed.

What a run of setup does and leaves alone:

  • Idempotent. A second run changes nothing. After a plugin update changes the wording, the prompt_pack option changes, or the repository becomes indexed, the same command replaces the block in place.
  • Removable. /loom:loom-setup --remove takes the block out and deletes a file it leaves empty.
  • A file it cannot change safely stops it. Setup names the file, exits with an error and leaves the file as it is in four cases: a start marker with no end marker after it, or the reverse (a <!-- loom:start that is not a whole marker line counts, also in your own text); more than one block; bytes that are not UTF-8; a file that cannot be read. Delete the stray marker line or the extra block, or save the file as UTF-8, and run setup again.
  • Reported when missing or outdated. SessionStart says so in one line, once a day for each checkout, and /loom:loom-status shows an instructions warning; both name the command. Neither appears where setup writes nothing, and the SessionStart line appears only when that session’s own lookup found the checkout in an index: not in a checkout with no git remote, with LOOM_CODE_MAP=false, or when the lookup did not answer. LOOM_SETUP_LINE=off drops the SessionStart line, for a repository that declines the block and for a harness that runs each session in a fresh directory. No hook writes to the repository.
  • Scripted setup. Run node <plugin root>/bin/loom-setup.mjs from the repository. The mode is the install’s mode option as the last session saved it, else LOOM_MODE.

The block leaves the agent its own tools: it reads working-copy changes locally, and where a prompt brought pointers the lines a pointer names, and checks what Loom returns against the files. An instruction guides the agent’s choice; it does not prove a lookup occurred.

Claude does not call Loom tools

Count agent tool calls and hook requests separately. In an indexed checkout, unless the install turns the prompt’s code pointers off (prompt_pack), the prompt hook searches the code index before Claude chooses a tool and supplies matching symbols and line ranges, and Claude can use those pointers through a targeted Read with no explicit Loom tool call. The test gate also calls code.test_gate itself, after an edit or a shell command that may have written a file; it names a changed file’s own test, where the file has one, and does not execute it. Zero explicit calls alone does not establish that Loom was unused.

Check the setup in this order:

  1. Check that the repository’s CLAUDE.md, or its AGENTS.md where it has no CLAUDE.md or one that imports AGENTS.md, holds the instruction block; /loom:loom-setup writes it. Without it the agent rarely calls a Loom code tool. With it the agent calls loom_code_search when its own search misses the code or the task names no file or symbol. Where prompts get the index’s pointers the block is the pointers one, and the agent calls the search only for a task the prompt’s pointers do not cover.
  2. Run claude plugin list and check that loom@loom is enabled. The plugin and server have separate versions; updating the server does not update the plugin.
  3. Open /mcp in Claude Code. Check that Loom is connected and lists loom_code_symbol, loom_code_callers and loom_code_search. A connected server without these tools cannot serve Claude’s code lookups. The plugin’s entry lists them in every mode but memory.
  4. Run /loom:loom-status for runtime, server, token and namespace checks. Never share tokens or authorization headers in a support report.
  5. Check the SessionStart output for the matched repository and code namespace. A new session whose MCP connection carries the checkout is told neither, so an empty output there is the working state; otherwise a line says why no index is read (a repository this Loom does not index, one you are not a reader of, a token that does not name its namespace, an index still being built). Compare the indexed commit from code.index_status with the checkout’s git rev-parse HEAD. A missing remote, an unindexed repository or a failed lookup needs attention before measuring retrieval. See adding repositories.
  6. Check /hooks for the plugin’s SessionStart and UserPromptSubmit handlers. A harness using --bare, --safe-mode or disabled hooks does not run the normal plugin path.
  7. Inspect failed tool results as well as attempted calls. In headless dontAsk mode, an unapproved tool is denied. When managed settings set allowManagedPermissionRulesOnly, a command-line --allowedTools list cannot grant access. Have the policy owner approve the intended Loom tools; do not rename the registration or disable the policy to evade the denial.

When a headless harness restricts --tools, include ToolSearch to preserve deferred MCP tool loading. Omitting it loads the MCP schemas into context up front; it does not show whether the task needed those tools. --allowedTools controls permission and cannot restore a tool omitted from --tools. See Claude Code tool search.

In the coding toolset the server requests upfront loading for loom_code_edit_context and loom_code_grep, and for loom_code_symbol outside the compact shapes (schema_profile=compact or plugin). Clients can discover the other code tools and, where listed, general search (loom_search) and the dispatcher (loom_op) when needed. Other toolsets, a union such as coding+tracker included, request upfront loading for loom_code_search, loom_code_grep, loom_code_symbol, loom_search and loom_op where listed. The published plugin’s entry names schema_profile=plugin on the coding toolset: every tool of the toolset in the compact shapes. Without the header below, the server loads three code tools up front on that profile: those two and loom_code_search. In code mode the entry lists the code tools alone; in memory mode it lists no code tool and loads none up front.

Nothing tells every session to call a Loom tool: the instruction block names the search for code the agent’s own search misses and for a task that names no file or symbol, or, where the prompt hook brings the index’s pointers with the prompt, for a task they miss. Every request of a session would re-read three schemas it may never use, so the entry’s header helper asks the server to load none up front (X-Loom-Tool-Loading: on-demand). Every tool stays listed for tool search, the first Loom call of a session costs one tool-search request, and the startup instructions say nothing about the code tools (in code mode there are none). Measured on a scripted session in an indexed checkout whose prompt carried three pointers, in a project that holds the pointers block, the plugin adds about 1,900 bytes to the first request in code mode: the three skill descriptions, the tool names, the pointers, the block and the checkout’s line. With prompt_pack off, or in a checkout no index holds, no pointers are added to that request. The three schemas would be about 4,100 bytes more. A server that does not read the header keeps its own loading and its own startup instructions.

LOOM_MCP_ALWAYS_LOAD_TOOLS=auto selects the defaults above. Supply a comma-separated list of operations such as code.symbol or synthetic tool names such as loom_op to select a different set. An empty value leaves loading to the host. The model chooses calls and the server enforces permission in every mode.

MCP connections receive routing for the available Loom capabilities, including memory, documents, code, issues, tasks and records. Prefer a fitting listed tool; use loom_op help to discover an unlisted operation. The assistant toolset has only its listed read tools. This guidance does not depend on plugin hooks. The plugin’s own connection gets one paragraph instead, because its hooks say the rest when it applies: the checkout’s code namespace at session start, the Loom call in place of a local read they refuse, a file’s memories at its first local read or before an edit and recalled memories beside the prompt. In a one-plane mode the paragraph is that plane’s sentence. A first-step memory pack requires a default memory namespace; code tools use the supplied code scope. Instructions guide tool choice and do not prove a lookup occurred.

Loom returns the complete MCP initialization instructions without a character cap. The client can apply its own limits. In Claude Code, CLAUDE_CODE_MAX_MCP_DESCRIPTION_LENGTH controls the client limit for server instructions and tool descriptions.

The plugin’s loom-mentor skill can load automatically when the relevant Loom operation is unclear. It covers capabilities beyond code and memory and defers to a fitting tool the agent already knows. Existing context can satisfy a task; tool routing does not require extra lookups or authorize writes.

Managed settings can also set hook environment variables. Clearing the launcher’s environment does not clear those settings; inspect the effective configuration and respect its policy. See settings precedence.

LOOM_CODE_SHUNT=off disables code-read substitution. Automatic code pointers on prompts are sent in an indexed checkout unless prompt_pack or LOOM_PROMPT_PACK=off turns them off. Prompt-time memory recall has its own LOOM_PROMPT_RECALL control, and LOOM_PROMPT_CONTEXT=off turns both off (what a prompt gets). Record these choices in comparisons; enabling the code hooks alone does not establish a benchmark improvement.

Where it is on, the prompt pack selects one bounded lookup for a clear named definition, callers or impact question, and uses search for concepts. Named implementation or behavior questions can receive the definition body within the existing 600-token server budget; pure location and signature questions receive pointers. Large definitions remain elided and need a focused read. Returned bodies are delimited as untrusted data. It skips explicit memory questions, local-only changes and self-contained requests. Ambiguous or empty typed answers do not trigger another automatic lookup. Search pointers are sent only when the index labels its own answer low-risk (or, with LOOM_PROMPT_PACK_MIN_CONF set, from that confidence) and never when it abstains. Under either gate each unit of the answer is held to the place test on its own, and only the units that pass, the answer’s places to edit, are sent, one pointer per place, because the model re-reads the pointers on every later request: a unit that is not a place is not carried by one that is, and an answer with no place sends nothing. In Python, C and C++, TypeScript and JavaScript, Go, Rust and Java source a unit is a place when it is a definition (a function or method, a class, a named symbol); the file’s leading comments and imports and its module-level code are not, and neither is any unit of a source file the index could not parse. A unit of any other file is a place: a notebook, a component file, SQL, shell, configuration, and source the index reads as text (Kotlin, Ruby, PHP, C#, Swift). A document is a place when the request asks for documentation or the prompt names the file: .md, .mdx, .markdown, .rst, .adoc, a change log, release notes or a README by its name (CHANGES, HISTORY and NEWS as written, changelog, release notes and readme in any letter case), and a .txt file of a doc, docs or documentation directory that is not a requirements, constraints or CMake file. A unit of another file a fix is not made in is a place only when the prompt names the file: a Python migration file named by its number under migrations, and at the top of the repository the extern and release directories, their documents too, and setup.py, fabfile.py and noxfile.py. A migration written by hand in SQL or another language is source. Generated and vendored files are kept out of the index by its denylist. A file is named, spelled as its path spells it, by the path or a tail of two or more of its segments under any directory, by its base name after ./, or by a bare base name that has an extension and no directory before it: CHANGES as a word names no file. A mention anywhere in the prompt counts, also in a sentence that tells the agent what not to edit and in a pasted traceback: the hook does not read which way a mention points. Naming a file lifts the rule on its path, not the rule on definitions. A test counts when the request asks for tests or the prompt names the test’s file. For a request that asks for tests module-level code, and a unit of a source file the index could not parse, count too: a pytest fixture in conftest.py and a CI definition written as assignments are module-level code outside any test directory. The hook reads whether a request asks for tests as the search ranking does: from every search term (a word or a part of an identifier) of a request of at most 48 terms, and from the first 16 of a longer one, so an issue that names a test where the fault showed does not ask for tests. Whether a request asks for documentation is read from the same terms: one of doc, docs, documentation, documented, readme, changelog, release, releases, guide, tutorial and manual, the words for which the search ranking lifts its penalty on documents. A request to change a page that holds none of them gets no pointer to a document it does not name. A test is a file under a test, tests, __tests__, spec or specs directory or with a test-style name, so source a framework keeps in a directory named test and design documents in a directory named specs count only for such a request or by name. No pointer’s range lies inside another’s. A range and the ranges the answer holds inside it (a class and its own methods) are one place: each innermost definition the prompt names stays (the last segment of its name, four characters or more, as a whole word), else the range when the prompt names it, else the one the index ranked first. What is chosen so, when it is a range of more than 200 lines, gives way to the first-ranked definition the answer holds inside it, which is the part of it the search matched, so a long class the prompt names is sent as that method; with none inside it, it is sent as its first line, the definition’s signature, with its length (path:643 Permutation (372 lines)). The low-risk label says the index holds code about the prompt, not that the pointers are where a fix is made, and no field of the answer tells the two apart. The place test reads a unit’s path and kind and does not tell them apart either: an answer that holds only other places is sent. The pointers are candidates, and the text does not tell the model to stop searching. The prompt waits for the lookup no longer than LOOM_PROMPT_PACK_TIMEOUT_MS (2.5 s), which the repository lookup and the answer share: pointers that have not arrived by then are skipped. A search with no semantic leg reads medium (confidence 0.5), so it sends no search pointers: a server with no embedding model, or a vector leg that failed or missed its deadline. LOOM_PROMPT_PACK_MIN_CONF=0.5 sends them there too, and then also for every indexed-code prompt whose confidence is 0.5 or more. A code namespace an administrator has not calibrated can read answerable prompts medium or high and send none (code.calibrate). Supply a task inside <issue>...</issue> when a harness adds instructions; the existing query helper extracts that block. It also reads a prompt that opens as labelled lines (repo: ..., base_commit: ..., problem_statement: ...): one to twelve labelled lines whose value is one word, then a line labelled issue, task, problem, question, request or query (or one of these with statement, description, text or body). The search text is that line’s value, to the end of the prompt, without the sentences that tell the agent how to work or answer; a value shorter than 12 characters leaves the whole prompt as the search text. A YAML block marker after the label (|, >-) and quotes around the whole value are not part of the value. The lines above it are left out whatever they hold (file: src/a.py, or task: T-123 above a problem_statement: line). One line may stand above the labelled lines and is left out too: a lead-in that has no label of its own and ends in a file path and a colon (Fix the issue described in ../task.yaml:). The file path is the line’s last word. A word that opens with // or has a colon before its first slash is not one: a URL with a scheme (https://example.org/api.json:) or a remote (git@example.org:team/app.git:), but not a drive letter (C:/work/task.yaml:). A URL with no scheme (example.org/api.json:) reads as a file path. A prompt with any other first line (a question that ends in a colon, in such a word or in a dotted name with no path, such as Node.js: or ci.yml:, a labelled line of prose), with a labelled line of prose above the request, or with the labelled lines further down, is searched as written.

Memory recall’s default first mode makes one attempt on the first qualifying prompt, even if the answer is empty or abstains. A clear named definition, caller or impact question skips default recall and leaves that attempt available. Mixed requests for saved memory, decisions, conventions or lessons still qualify, as do conceptual tasks. Use on when recall on each qualifying prompt, including named code questions, is wanted. Whether a prompt qualifies, names a definition or asks for saved memory is read from the same text as the code pointers’ search: the inside of an <issue> block, or the request line’s value of a prompt that opens as labelled lines. A request there that opens Use only the provided source gets neither recall nor pointers, and one that opens Remember ... qualifies for recall and gets no pointers. The memory search itself is sent the whole prompt.

The plugin’s startup instructions name no tool to call first, and its loom-code skill can load automatically. The agent follows the repository’s own instruction file more reliably than either: the instruction block is the project’s policy on when to search the index, and /loom:loom-setup writes it.

A saved fact and an established code reference are separate outcomes. Check the returned metadata before claiming a link or change tracking; a file path in prose alone does not confirm either. Required recall and validation belong to the application’s orchestration; instructions guide the model’s choices.

For headless Claude Code, keep the project setting source enabled: passing --setting-sources '' excludes the project’s CLAUDE.md as well as its settings.

When reporting a comparison, include the plugin and server versions, model, repository and indexed commits, listed code tools, hook output, explicit tool calls, failed requests, cost and elapsed time. Keep the task and test budgets equal between arms. To isolate the test gate’s contribution, compare a baseline, the plugin with LOOM_TEST_GATE=off, and the full plugin. Index the issue’s starting commit so the real fix is not searchable.

Who owns the calls and validation

Path Who chooses the operation Evidence to check
SDK or HTTP stages Application code invokes the stage directly. A valid scoped result and the controller’s validation.
Plugin hooks Configured handlers run on matching CLI events. Hook event, server request, returned context and delivery.
Model tools backed by SDK or MCP The model decides whether to investigate. The actual call and a valid result, not a listed tool.

Exposing an SDK binding does not force the model to use it. Zero model-selected MCP calls can still include automatic hook requests. A request attempt alone does not prove success or useful context. Required retrieval or validation belongs to a controller that runs the stage and rejects missing or invalid results; a tool listing or a prompt instruction does not enforce the gate. See agent integration.

Normal claude -p runs can discover project settings, plugins and hooks. --bare skips discovery: explicit MCP configuration or plugin flags can still load tools, but hooks do not run, even when explicitly configured. Calling a model API directly runs only the client program, without CLI hooks. See headless usage.

Hook context does not appear

The file-context hook runs on PostToolUse, after Read, Grep and Bash, and on PreToolUse, before Edit, Write, MultiEdit and NotebookEdit. After a read it looks up each file of the checkout the call read: the file Read names, a Grep of one file, and in a shell command a file read whole or by a line range (cat, sed -n, head, tail) or searched by name (grep pattern file). A command the hook cannot follow, such as a script that opens the file, starts no lookup. The hook emits context only when memory.for_file renders matching memories, decisions or constraints. When the checkout has a remote, your own rows are asked for by repository and not by the project: tag: by the repo:<id> tag of each of its remotes and of the repository its index matched. A row written in another repository is then not shown, even when both checkouts have the same folder name or the same LOOM_PROJECT_NAME, nor is a row that carries the project: tag alone; a worktree under another folder name gets the repository’s rows. A checkout with no remote asks by the project: tag. On a deployment whose default scope is all_mine (LOOM_MEMORY_SEARCH_DEFAULT_NAMESPACE_SCOPE), the lookup of a checkout with a remote also returns the rows you wrote in your other namespaces, the ones prompt recall reads; a row from one names its namespace. A file is looked up once per session and agent context, including an empty answer; a compaction clears that, and before an edit a file shown more than LOOM_FILE_CONTEXT_TTL_MIN minutes ago is looked up again. An empty answer does not count while the checkout’s last repository lookup is one the server did not answer: a fork whose parent only the server names is then asked for by its own id alone, so the file is looked up again at its next read or edit. Reads look up at most three files per call and 40 per session, and stop after three lookups the server did not answer.

The blast-radius hook runs on PostToolUse after Edit, Write and MultiEdit. It stays quiet for untracked files, empty diffs, repeated impact results, an unavailable index or a failed request. Edits performed through Bash, including scripts using python or sed, do not match either edit hook.

The test gate’s line does follow a shell edit. It runs on PostToolUse after Bash and PowerShell, and rides the blast-radius hook after Edit, Write and MultiEdit. It emits Loom test for <file>: <command> the first time the session changes a file, and only when the command names the file’s path, the file differs from HEAD, it was written after the session began, and the file has a test of its own with a runner the checkout configures (the test gate). It stays quiet for a file with no such test, one whose test an earlier line named or the command itself ran, a comment-only change, an untracked file, a file already asked about in the session, an unavailable index or a request that failed twice, and always with LOOM_TEST_GATE=block or off. A command that only reads (grep, cat, sed -n, git diff and the like, with nothing redirected to a file) wrote no file: it gets no line, starts no git process and sends no request.

Headless sessions support hookSpecificOutput.additionalContext; ordinary visible assistant output does not prove whether that context reached the model. Capture --debug hooks,mcp output privately and redact tokens and authorization headers before sharing it. Include the hook event, tool name, hook output and relevant stream events. Correlate them with server requests to memory.for_file, code.impact and code.test_gate to distinguish hook matching, request execution, nonempty context and delivery to the agent.

Configuration

Where the hooks find the server and the identity. Environment first, then the install option, then ~/.loom/config.json, then the token’s claims, then the defaults (lib/loom-client.mjs: resolveServerUrl, resolveToken, resolveScope):

What Lookup order
server LOOM_BASE_URL → server_url option → config.json url → http://localhost:7777
token LOOM_API_KEY → token option → the file LOOM_API_KEY_FILE names → config.json token → ~/.loom/token (with LOOM_API_KEY_FILE unset)
org LOOM_ORG → config.json org → the token’s org claim → default
namespace LOOM_NAMESPACE → config.json namespace → the token’s first non-wildcard namespace → coding
agent LOOM_AGENT → config.json agent → claude-code

For a remote server the hooks and the header helper need only one file (LOOM_CONFIG_FILE moves it):

{ "url": "https://loom.example.com", "token": "<writer JWT>", "namespace": "my-team" }

The MCP entry does not read it: its URL is the server_url install option, whose default is LOOM_BASE_URL, else localhost. Set one of those too, or the entry sends the file’s token to localhost and the primer says so.

Project scoping. The project is the basename of the git toplevel (LOOM_PROJECT_NAME overrides it). With the default LOOM_PROJECT_SCOPE=tag, every project writes to one namespace and each row carries a project:<name> tag. LOOM_PROJECT_SCOPE=namespace makes the project name the namespace instead. Rows also carry repo:<id>, a hash of a remote’s normalised URL: the remote the checkout’s index matched, else upstream, else origin, else the first remote (LOOM_REPO_REMOTE overrides the remote), and the file-context hook asks by the checkout’s repo: tags (the override’s alone when it is set) and not by the project tag, so two clones of different repositories with the same directory name, or with one LOOM_PROJECT_NAME, do not share file memory.

Modes

The mode install option picks which of Loom’s planes a session uses, so an install that wants one of them pays only for that one:

claude plugin install loom@loom --config mode=code
Mode The hooks The MCP entry lists
both (default) capture the session, recall memory and answer from the code index 23 tools: every tool of the coding toolset
memory capture the session and recall memory; no request reaches the code index 10 tools: the listing without its code tools
code answer from the code index; nothing of the session is captured, recalled or extracted 13 tools: the code tools alone
  • Code mode captures nothing: no tool observation, chat turn, brief, working-memory note or session hand-off. The server has no session to extract facts from, so it makes no model call for one. The hooks read no memory either: no primer pack, no recall and no file memories. The code shunt, the prompt’s code pointers, the blast radius and the test gate work as in both; the shunt’s gh issue-search redirect and the mentor hints, which each name the other plane’s tools, are off.
  • Memory mode sends no code.* request and lists no loom_code_* tool: no redirect of a read or grep, no code pointers, no blast radius, no test gate, and no X-Loom-Code-Scope header. The file lookup covers your own namespace. A repository’s team rules are found through its code index, so they need both.
  • Every mode keeps the run ledger: run.begin with the first prompt, run.complete with the last reply, and cost.record_turns with the token usage. LOOM_RUN_LEDGER=off and LOOM_USAGE=off turn them off. SessionStart also probes GET /v1/health in every mode, for the hooks’ request bound.
  • An event starts one hook process in every mode. At a prompt, after a tool call, at Stop, at SessionEnd and before a compaction that process is the launcher (hooks/loom-record.mjs), which loads a script the session waits for only where the mode runs its plane. In code mode a shell command starts no hook before it, unless it runs gh, and the launcher after it, which runs the test line alone and only for a command that may have written a file; an edit runs the blast radius; a Stop runs the test gate where the install asks for it (stop_test_gate). After a call that has only memory’s scripts to wait for the launcher loads none of them. The recording scripts are loaded in every mode, and each checks its plane itself: one whose plane is off sends no request and prints nothing.
  • Code mode declares the tools capability alone: the entry lists no prompt and no resource there, so the server declares neither. Claude Code 2.1.332, connected to a server that declares tools alone and to no server that declares resources, asks for neither list and leaves the names of its three resource tools out of the session’s requests.
  • The three skills are listed in every mode: a skill’s description is fixed text the client loads at start. Each says when to load its skill in one line of at most 160 bytes, 480 for the three.
  • The listing needs a server that reads ?mode= (MCP reference). An older server ignores it and lists both planes; the hooks follow the mode either way.

Codex and a hand-wired client have no install option: set LOOM_MODE for their hooks. The Codex plugin’s MCP entry is fixed and lists what it always did. Under Claude Code the option outranks the variable, since the option is also what the MCP entry’s URL carries. hooks/HOOKS.md names each hook script’s plane.

The MCP entry and its header helper

The plugin’s .mcp.json points at <server_url>/mcp?toolset=coding&schema_profile=plugin&mode=<mode> and gets its headers from bin/loom-mcp-headers.mjs. Claude Code runs the helper in the plugin root, so the URL ends in #${CLAUDE_PROJECT_DIR}: Claude Code hands the helper the URL with the project directory filled in, and never sends the fragment to the server. The helper sends:

  • Authorization: Bearer <token>, from config.json token, then ~/.loom/token: of the hooks’ lookup, Claude Code keeps LOOM_API_KEY, LOOM_API_KEY_FILE and the install option from the helper (see above). Claude Code connects the MCP entry while the SessionStart hook is still running, so with no token the helper waits up to 5 s (LOOM_MCP_HOOK_WAIT_MS) for that hook to save one, then performs the same first-session sign-up.
  • X-Loom-Code-Scope: <org>/<namespace>, the code namespace the project’s checkout resolves to. The server applies it to every code.* call that names no namespace, so the model does not have to pass one. LOOM_MCP_CODE_SCOPE=off disables it, and an entry in memory mode sends none and looks no repository up.
  • X-Loom-Tool-Loading: on-demand. The server then marks no tool schema to load up front. An entry in memory mode, which loads none up front, sends no such header.

The checkout’s repository is found from its remotes (origin, then upstream, then the rest) through code.repos. The plugin names a remote on github.com as github.com/<owner>/<name> and any other by owner and name alone. The server looks the names up among the repositories it indexes. When none has an index you can read, it asks GitHub whether a remote named on github.com is a fork, so a GitHub fork with no index of its own resolves to its parent’s index when you can read that one; LOOM_CODE_FORK_UPSTREAM_LOOKUP_ENABLED=false on the server stops that request. The server names a remote on any other host to no outside service, so a fork there gets its parent’s index through an upstream remote that names the parent, or through LOOM_CODE_REPO. So does a GitHub fork whose remote does not spell the host, such as an SSH host alias (git@github-work:<owner>/<name>). An older server asks GitHub about the first three remotes whatever their host. A plugin older than 1.2.126 names every remote by owner and name alone, so with this server a GitHub fork with no upstream remote reads as not indexed until the plugin is updated.

LOOM_CODE_REPO=<owner>/<name> or a bare name (or the code_repo option, or code_repo in ~/.loom/config.json) is the fallback candidate after the remotes: it serves a session outside any git checkout, or a checkout with no index, and gives it that repository’s index and scope header. Name the indexed repository there: the server does not ask GitHub about a fork named as <owner>/<name>, which reads as not indexed, and resolves one named by its URL (https://github.com/<owner>/<name>) to its parent’s index, as it does a remote. The helper’s own lookup is bounded at 2.5 s; a miss costs only the header. See code index overview and the MCP reference for how the server uses the scope.

What the hooks do

The wiring is hooks/hooks.json; hooks/HOOKS.md has per-hook notes.

Event Script Effect Off switch
SessionStart loom-session-start.mjs one budgeted context.pack primer (working-memory note, pins, profile, memories, decisions, procedures, recent runs), one line naming an indexed checkout’s code namespace and the repository’s memory tag (left out in a new session whose MCP connection carries the checkout: the server then applies both), a line naming the project’s saved session briefs, a task-inbox line (task.counts), a few lines naming the collections the token can read (collection.list), and a line for a checkout without the instruction block LOOM_INJECT_CONTEXT=false, LOOM_CODE_MAP=false, LOOM_TASK_INBOX_LINE=off, LOOM_COLLECTIONS_LINE=off, LOOM_SETUP_LINE=off
UserPromptSubmit loom-prompt-pack.mjs no request with prompt_pack off; at its default no prompt text unless this Loom holds the checkout’s own repository (what a prompt gets); otherwise up to three code.search pointers for the prompt, only when the index rates its answer low-risk (or it reaches LOOM_PROMPT_PACK_MIN_CONF) and then only the answer’s places to edit, one pointer per place: a definition, a unit of a file the hook does not hold to definitions, a document or a test when the prompt names it or asks for documentation or tests, a Python migration or a release script only if named, and module-level code when it asks for tests; below them the test line for a pointer whose definition the prompt names (the test gate) off unless prompt_pack or LOOM_PROMPT_PACK=on; LOOM_PROMPT_CONTEXT=off
UserPromptSubmit loom-prompt-recall.mjs one bounded context.pack recall for the prompt (memories, decisions, procedures), injected only when memory does not abstain: whole records, and none of code as it was before a commit the checkout already has LOOM_PROMPT_RECALL=first (default) / on / off; LOOM_PROMPT_CONTEXT=off
UserPromptSubmit loom-run.mjs opens the session’s run (run.begin, run_id = cc-<session_id>, goal = the first prompt); the prompt does not wait for it LOOM_RUN_LEDGER=off
PreToolUse (Read, Grep; Bash for a command that runs gh) loom-code-shunt.mjs the code shunt and the tracker shunt (next section) LOOM_CODE_SHUNT=off, LOOM_TRACKER_SHUNT=off
PostToolUse (Read, Grep, Bash) loom-file-context.mjs what Loom knows about each file the call read (memory.for_file): your rules and the repository’s shared rules and design decisions, on the read’s result; once per file per session and agent context LOOM_FILE_CONTEXT=off
PreToolUse (Edit, Write, MultiEdit, NotebookEdit) loom-file-context.mjs the same block before an edit of a file not shown yet in this agent context, or shown more than 30 min ago LOOM_FILE_CONTEXT=off
PostToolUse (Loom tools) loom-mentor-hint.mjs lifts a result’s hint into context, once per hint code per session LOOM_MENTOR_HINTS=off
PostToolUse (Edit, Write, MultiEdit) loom-blast-radius.mjs one line from code.impact: callers, tests reaching the change, co-change files not yet touched; on a file’s first edit, the test gate’s line beside it in place of the tests LOOM_BLAST_RADIUS=off
PostToolUse (Bash, PowerShell) loom-test-gate.mjs for a file the command changed that has a test of its own, that test’s command and what the index knows of it (code.test_gate); once per file and per test per session, on the tool result; nothing for a file with no such test or after a command that only reads (the test gate) LOOM_TEST_GATE=off
UserPromptSubmit loom-record.mjs the prompt’s one process: runs loom-prompt-pack and loom-prompt-recall in the hook and prints their context as one answer, writes the run’s begin to the session’s run state, and hands the prompt’s recording scripts (loom-run, the namespace audit) to a detached process each script’s own
PostToolUse, PostToolUseFailure, PreCompact, Stop, SessionEnd loom-record.mjs the event’s one process: runs the scripts the session waits for in the hook (the PostToolUse rows above, each for its tools, and the Stop gates below) and prints their answers as one, and runs the event’s recording scripts (the other rows for those events) in one process: detached after a tool call the capture script records something of, at Stop and at SessionEnd, so the session does not wait for their requests and the client cannot cancel them, and in the hook itself before a compaction each script’s own
PostToolUse, PostToolUseFailure (any tool) loom-capture.mjs one episodic observation per tool call (observe.record); a failed call is typed error none
Stop, SessionEnd loom-conversation.mjs appends new chat turns to the conversation plane (conversation.append) LOOM_CAPTURE_CONVERSATIONS=false
Stop loom-usage.mjs posts the session’s token usage to cost.record_turns LOOM_USAGE=off
Stop loom-test-gate.mjs off unless the install turns it on (stop_test_gate, or LOOM_TEST_GATE=stop): for changes this session made, blocks “done” once with the tests code.test_gate says the change obliges, unless a test runner ran since the last code change or your latest prompt ends with “Do not run the tests”; with LOOM_TEST_GATE=block, unless pytest ran the named tests to its summary line and nothing was edited or run since (the test gate) LOOM_TEST_GATE=off
Stop loom-validate-gate.mjs blocks once when namespace.validate finds errors or warnings on the memory keys this session wrote LOOM_VALIDATE_GATE=off
Stop loom-namespace-health.mjs one line when namespace.audit finds a critical misuse of the namespace, pointing at the loom-optimize skill; the audit is asked once per session, by the first prompt’s detached process, and told at a Stop LOOM_NAMESPACE_HEALTH=off
Stop, PreCompact loom-working-memory.mjs refreshes the working-memory note (session:<project>): goal, git status, files edited, last reply; the primer of a new conversation on another branch than the note names leaves it out LOOM_WORKING_MEMORY=off
Stop, PreCompact, SessionEnd loom-capture.mjs crystallises the session (observe.crystallize) none
PreCompact, SessionEnd loom-session-brief.mjs revises the branch’s session brief (session.brief_save, key auto/<project>/<branch>) LOOM_SESSION_BRIEF=off
SessionEnd loom-run.mjs closes the run (run.complete, outcome: none, the last reply as the final response) LOOM_RUN_LEDGER=off
SessionEnd loom-session-memory.mjs hands the session’s turns to memory.set_from_messages(defer=true), which extracts facts and writes the session summary; a session with under 40 bytes (UTF-8) of user and assistant text is not sent and gets neither LOOM_SESSION_MEMORY=off

The plugin’s hooks and its MCP header helper (the script that adds the token to Loom’s MCP requests) run node, git and grep on your machine: git reads the checkout’s remotes, branch, HEAD commit, status and diffs, and grep searches uncommitted files for the pattern of a grep the plugin redirects to the code index. The loom-session skill’s brief script also runs git log for the commits since the last brief. The test gate (the hook that names the test of a file you change) runs no Python: for a pytest test it picks the interpreter of the checkout’s virtualenv, the active one (VIRTUAL_ENV) or a python3 or python on PATH, checking that the interpreter’s file exists without running it.

The plugin names the oldest Loom server its hooks support (MIN_SERVER_VERSION in lib/server-version.mjs). SessionStart reads the server’s version from the GET /v1/health answer it already requests and, when that version is older, prints one loom: line naming both versions and asking for a server upgrade. The session goes on either way; an unreachable server, an answer other than 2xx, a server that reports no version, or a version that is not SemVer prints nothing. The loom-status skill (bin/loom-client-status.mjs) reports the same as a warning. The minimum rises with the release that first serves what a hook needs, so between that hook’s merge and that release a server of the previous release gets no warning.

Why the run closes with outcome: none. The hook knows the session ended, not whether it succeeded, and it never guesses which memories the agent relied on. An agent that knows its outcome calls run.complete itself.

What is stored where.

  • Conversation turns are stored only when the namespace has conversation logging on (off for a new namespace; conversation.set_logging). conversation.append succeeds even when it drops a turn. See conversations and sessions.
  • Raw observations become durable memories only when the server runs the observe_extract worker (LOOM_OBSERVE_EXTRACT_ENABLED=true, which needs LLM and embedder credentials; see configuration).
  • Session memory is independent of logging: memory.set_from_messages writes facts and a summary, and keeps the turns it was given as their source evidence.

Safety. A hook never blocks the agent on the network.

  • The scripts that only record (the run’s open and close, tool observations, conversation turns, usage, the working-memory note, session memory, the session brief) do not hold the session at a prompt, after a tool call, at Stop or at SessionEnd: one launcher (hooks/loom-record.mjs) writes the event to a private file, starts one detached process that runs them, and exits. A tool call the capture script records nothing of is handed to no process: a meta tool in every mode, and in code mode every call of a session that asked the index nothing. That process outlives the hook and the client’s process, so a session’s close lands after the client has exited and the client cannot cancel it. It does not outlive a machine or container that is torn down when the client exits, which loses what the process had not sent by then: such a host sets LOOM_SESSION_END_WAIT=true, and the SessionEnd hook sends the session’s close itself (SessionEnd budget, below).
  • The launcher also runs, in its own process, the scripts whose answer the session waits for and prints what they answered as one answer, so an event starts one process: at a prompt the two lookups (the code pointers and the recall), after a tool call the file’s memory, the mentor hint, the blast radius and the test line (the last only after a command that may have written a file), at Stop the gates the install runs. Each script’s text is unchanged and on a line of its own; gates that hold the same stop give one block. A script that throws, or is still running when the wait for its answer is over, has no answer, and the others keep theirs. Before a tool call the host starts the one script wired for the tool, and before a shell command none unless the command runs gh.
  • Before a compaction the launcher runs the event’s scripts itself and returns when they have, so the working-memory note is written before the compaction’s primer reads it.
  • The namespace audit is asked once per session by the first prompt’s detached process, and the first Stop that finds its verdict tells it. A Stop asks in place only when that process died before its answer.
  • Their writes are fire-and-forget; slow ones (conversation, session memory, session brief) go to a detached flusher (hooks/loom-flush.mjs).
  • Every request aborts after 5 × the /v1/health round trip, clamped to 3–8 s and cached six hours per server. LOOM_HOOK_TIMEOUT_MS and LOOM_HOOK_EXIT_MS override it.
  • Errors are swallowed. Only the primer waits for a body; if it fails, the session starts without it. With no token or no server, every hook exits 0.

SessionEnd budget. Claude Code shares about 1.5 s across all SessionEnd hooks and ends the ones still running. The plugin’s one entry, the launcher, hands the event to a detached process and returns, so it needs no more: the run’s close, the extraction’s start, the last turns, session memory and the brief are sent by a process the client does not end. A machine or container torn down the moment the client exits ends that process too. With LOOM_SESSION_END_WAIT=true in the session’s environment the hook sends them itself and returns when the run’s close is answered, about half a second against a server that answers at once; CLAUDE_CODE_SESSIONEND_HOOKS_TIMEOUT_MS raises the client’s budget for a slower one (headless sessions).

What a prompt gets

Two lookups can answer a prompt before the model reads it. Each sends the first 2,000 characters of the prompt, secrets redacted, to the server, and what comes back is added to the request as additional context. The code search also sends a prompt of more lines or characters with its lines, redacted and cut at 20,000 characters: the index reads the frames of a pasted traceback and the names a prompt spells as code from that text.

Install option Variable Default Effect
prompt_pack LOOM_PROMPT_PACK auto auto: where this Loom holds the checkout’s own repository, each prompt is searched in its index and up to three pointers are added (loom-prompt-pack.mjs); elsewhere no prompt text is sent. on: each prompt is searched in whatever index Loom matched to the checkout. off: never.
prompt_recall LOOM_PROMPT_RECALL first first: memory is asked once, on the first qualifying prompt of a session (loom-prompt-recall.mjs). on: every one. off: never.
prompt_context LOOM_PROMPT_CONTEXT on Off: neither lookup runs, whatever the two rows above say. Nothing is added to a prompt and its text goes to no lookup.

A variable outranks its option. Codex and a hand-wired client have no install option and set the variable.

  • At auto, the default, a prompt goes only to the index of the checkout’s own repository. The hook reads what the last repository lookup found for the checkout: the entry the SessionStart hook writes, which the hooks around a read, a search or an edit renew once it is ten minutes old.
    • The checkout’s own repository is in an index the session reads: the prompt is searched. That is the repository at the checkout’s origin remote, host included. The server says which host each entry’s repository is on (repo_key in code.repos, from the entry’s remote), and the plugin compares it with the host and path of the origin. A server that does not send it is taken at its word only for an entry added by its remote, which is named owner/name on GitHub and host/owner/name on any other host. An entry the operator configured is named freely, so on such a server it is not searched under auto (this needs the next server release); prompt_pack on searches it. The host is the one the remote’s URL spells, so a remote written with an alias of the SSH configuration (git@work:owner/name) is not recognised; /loom:loom-status shows the host it read.
    • Loom matched another repository’s index to the checkout: the prompt is not sent to it. That covers the upstream remote’s index or another remote’s, the index of the repository the origin is a fork of, the one code_repo names, and one whose owner and name match on another host.
    • This Loom holds no index of it, or none the session reads: for ten minutes after that answer the hook sends no request at all. An install that uses Loom for memory alone, or a Loom that does not hold the repository, sends the code index no prompt text.
    • No lookup has answered in the last ten minutes, or the one the session made as it started ran out of time: the hook asks itself, so the one prompt of a headless run still gets its pointers. The lookup is one code.repos naming the checkout’s remotes (owner and name, with the host of one on github.com) and, for a repository it lists, one code.index_status naming its namespace; neither carries prompt text. A lookup that fails sends nothing, and the prompt hook asks again no sooner than ten minutes later.
    • A repository that becomes indexed gets pointers from the first prompt after a lookup finds it: ten minutes after the last answer at the latest.
  • The lookup’s answer is kept per server and per token. Which repositories a Loom lists depends on the server and on the caller, so the entry’s file is named by the checkout, the server asked and the token. Two sessions in one checkout that talk to different Looms, or as different principals, never read each other’s answer.
  • on and off. on searches whatever index the lookup matched to the checkout: the checkout’s own, else the upstream remote’s, another remote’s, a fork’s parent’s or the one code_repo names; it also looks up a checkout whose entry has lapsed. --config prompt_pack=off, or LOOM_PROMPT_PACK=off, sends nothing for any prompt: the agent still has the code tools, and the instruction block says when to search. The hook has only the prompt’s text to search with, and no rule it can apply tells a list that names the code a task changes from one that does not, so the pointers are candidates to check. A pipeline with no plugin builds the same block with the SDK or loom pointers (the recipe).
  • The search starts no model call but the query’s embedding. The request names rerank: "none" and llm_legs: "none", as the SDK recipe does, so a deployment whose defaults name a reranker (LOOM_CODE_SEARCH_RERANK_DEFAULT) or a model-backed leg runs neither for a prompt. The pick is the one model call an option turns on.
  • /loom:loom-status says why pointers do or do not arrive. Its pointers check gives the mode (off when prompt_context or the install’s mode rules the pointers out), the option as set, whether this Loom holds the checkout’s own repository, whether the token reads that index, the index’s stage, and the risk one test search read. The check asks the hooks’ server with the checkout’s remotes and one fixed question, never a prompt. It warns where something keeps pointers away that you can change or wait for: an index you are not a reader of, a token that does not name the index’s namespace, an index still being built, an index that is another repository’s. A fixed question about no repository in particular can read medium in a healthy index; a prompt gets pointers when its own answer reads low.
  • A searched prompt is kept for 180 days. Where a prompt is searched, the server stores its search text (at most 2,000 characters, after the plugin’s redaction) as the query of a row in loom.code_search_trace, under the repository’s code namespace, with the ids and paths of the results. The plugin’s search names no user, so the row’s user_id is -, unless the token is narrowed to one user: the server then writes that user’s id. For a restricted repository the row holds a digest of the text and no path. The row is deleted after 180 days or when the namespace is erased; a user_id erasure deletes the rows written under that user id, so it reaches the plugin’s only for such a token. A server with LOOM_CODE_TRACE_LOG_ENABLED=false stores no code search trace (retention and erasure).
  • An install that sets nothing is at auto. To keep the pointers off, export LOOM_PROMPT_PACK=off (the env block of ~/.claude/settings.json works too), or install with --config prompt_pack=off. An install that set prompt_pack to true or false keeps that: they read as on and off.
  • prompt_pack and prompt_recall are free text at install. true, yes and 1 read as on, like every other switch. Any other value that is not auto (for the pointers), first (for the recall) or an off word (off, false, no, 0) turns that lookup off, and /loom:loom-status names such a recall value in a prompt recall warning.
  • A session whose prompt already carries Loom’s answer turns both lookups off with LOOM_PROMPT_CONTEXT=off: a pipeline that calls Loom through the SDK, puts the pointers or the records into the task prompt and then starts the agent would otherwise have the plugin search for them and add them a second time (the recipe). --config prompt_context=false does the same for an install only such sessions use. Neither changes the instruction block, which follows prompt_pack and the checkout’s index.
  • What it does not cover. The SessionStart primer is not a prompt’s context: LOOM_INJECT_CONTEXT=false turns it off. What a tool call gets (a file’s memories, the blast radius, the test line) keeps its own switches.
  • memory mode has no code pointers whatever the option says; prompt_recall and prompt_context apply. code mode has no recall; prompt_pack and prompt_context apply.

Recalled content and local data

The primer, the per-prompt recall, the saved-brief list, the file rules injected after a read or before an edit (loom-file-context) and the tracker items the code shunt quotes when it answers a GitHub issue search can carry other people’s writes: team file rules live in the repository’s code namespace, where every member writes, and anyone who can file an issue writes its title. Each item is labelled with its writer (by= in recall, the author on a team file rule), and the plugin wraps every one of these in a <loom-recalled-data> block that says it is data and not instructions. A file’s block that holds no team rule leaves the note’s clause about shared namespaces out, also when a row in it is another member’s write to your own namespace; the rest of the note is in every block. Each block’s tags carry an id, <loom-recalled-data id="…"> and </loom-recalled-data id="…">, derived from the block’s text under a secret kept in ~/.loom/recall-key (created once, 0600), and the note says only that closing tag ends the block: the text’s writer cannot compute the id, so stored text cannot write the block’s end, and the same text keeps the same id, so the primer stays cacheable across sessions. The plugin also rewrites the tag name inside the text, including common lookalike spellings, to [loom tag removed]. Only procedures the caller wrote are injected (a teammate’s still answers an explicit procedure.match). Loom cannot control what an agent then does: keeping tool authority independent of retrieved text is the client’s job.

The hooks’ temp files (turn journal, cursors, stashes, flush jobs, and the code shunt’s decision log, pending batches and denial counts) are created 0600, never written through a symlink or into another user’s file, and never read from a planted symlink, a hard link or another user’s file. At SessionEnd the session-memory hook removes its recalled-content stash; the turn journal is kept for cleanup at a later session start. Retention and what the hooks redact before sending are in data handling.

Model-picked pointers for a bug report

Off by default, and only where a prompt gets code pointers (prompt_pack). With --config prompt_pack_pick=true at install, or LOOM_PROMPT_PACK_PICK=on, a prompt that reads as a bug report (twelve words or more, or the vocabulary of a failure) is searched with rerank: "builtin:pick": one call of the server’s pick model reads the prompt against one line for each of the first 100 ranked units, puts the definitions it would change first and says how sure it is (how the pick ranks). The hook sends at most three of those pointers, and only when the reply’s pick_confidence is high and its first result is a place to edit (what a prompt gets): the confidence is in the first pick, so the picks below it are not sent in its place, and no result below the third is sent. Any other prompt is searched and sent as without the option.

  • The server names the model. Set LOOM_CODE_SEARCH_PICK_MODEL to the provider’s smallest model. A server without it makes no pick, and a bug report then gets no pointers.
  • It waits for a model call. Such a prompt waits two to three seconds for the pointers, up to LOOM_PROMPT_PACK_PICK_TIMEOUT_MS (6 s), and the server pays for about 7,000 input tokens.
  • Fewer lists are sent. A medium or low answer and a failed call send none. On the bug reports it was measured on, about three lists in ten were sent, and about four in five of those held a definition the fix changed.
  • It was measured on public repositories a model may know. About three quarters of the pick’s gain was on reports where the model could name the changed function with no index, so the gain on private code is unconfirmed. The predicted effect on a session’s total cost is small, about 1% on the measured tasks.

Tuning knobs

Beyond the off switches in the table:

Variable Default Effect
LOOM_CONTEXT_TOKEN_BUDGET 1200 token budget of the SessionStart primer
LOOM_CODE_MAP_TOKEN_BUDGET 0 token budget of the code map in the primer; 0 leaves the map out
LOOM_CONTEXT_RUNS false include recent runs in the primer; LOOM_CONTEXT_RUNS_LIMIT (8) bounds them
LOOM_PROMPT_RECALL_MIN_CONF 0.5 minimum retrieval_confidence before the prompt recall injects anything
LOOM_PROMPT_RECALL_MAX_CHARS 1600 cap on the injected recall; a record that does not fit is left out, the first is cut when none fits
LOOM_PROMPT_CONTEXT on off: nothing is added to a prompt, neither code pointers nor recall (the prompt_context option)
LOOM_PROMPT_RECALL first the prompt recall: first, on or off (the prompt_recall option)
LOOM_PROMPT_PACK auto auto adds code pointers to a prompt where this Loom holds the checkout’s own repository, on searches whatever index Loom matched to the checkout, off never (the prompt_pack option)
LOOM_PROMPT_PACK_TOP_K 3 pointers per prompt
LOOM_PROMPT_PACK_TIMEOUT_MS 2500 what a prompt waits for the code pointers at most: their repository lookup and answer
LOOM_PROMPT_PACK_MIN_CONF unset a retrieval_confidence gate for search pointers (low risk is 0.7 up); unset, that label
LOOM_PROMPT_PACK_PICK off on asks the server’s pick model to choose a bug report’s pointers, sent only when it is confident
LOOM_PROMPT_PACK_PICK_TIMEOUT_MS 6000 what a prompt the pick is asked for waits at most: the answer includes a model call
LOOM_FILE_CONTEXT_TTL_MIN 30 minutes before an edit fetches the same file’s context again
LOOM_BLAST_DEPTH 1 code.impact depth for the blast-radius line
LOOM_TEST_GATE unset stop: also hold a stop with no test run since the last code change (the stop_test_gate option); block: no line at edit time, and a stop passes only on the named tests; off: no gate
LOOM_TEST_GATE_DEPTH 2 hops the test gate follows (1–3)
LOOM_OBSERVE_DEDUPE_S 60 a repeated read in this window is not observed again; 0 disables
LOOM_OBSERVE_SKIP_TOOLS a built-in list comma-separated tool names (with * globs) that produce no observation
LOOM_PLUGIN_SCRATCHPAD unset 1 appends each turn’s one-line conclusion to the run’s scratchpad working-memory block
LOOM_SESSION_BRIEF_KEY auto/<project>/<branch> the key the session brief is saved under

integrations/claude-code-plugin/README.md documents the remaining knobs.

The test gate

The test gate names a file’s own test when the agent changes the file, and says nothing about tests when the file has none. In an indexed checkout, the tool call that first changes a file comes back with two extra lines when Loom has such a test to name:

Loom test for src/app/router.py: .venv/bin/python -m pytest -q -rf tests/test_router.py
It is the one test file named for that file. With -q -rf the last lines are one `FAILED <file>::<test>` line per failing test, then the totals.
  • What it names. One test, and only a test that is the file’s own:

    • the one tracked file named after the edited file: test_<stem>.py or <stem>_test.py for Python, <stem>_test.go, <stem>_test.rs, and <stem>.test.<ext> or <stem>.spec.<ext> for TypeScript and JavaScript. The stem has three characters or more and is not __init__, and two files with such a name name none;
    • a test an imported coverage run measured executing the change (A coverage run measured it executing code this change touches.);
    • the edited file itself, when it is a test (It is the test file the change edits.).

    A test code.test_gate reaches only through the call graph, the mined test map or another definition of the file is not named. In recorded sessions those were other modules’ tests more often than the file’s.

  • Only a runner the checkout uses. The index derives pytest <path> from a test file’s name, and a repository that runs its tests another way fails that command at set-up. So the line is sent for a pytest command only where the checkout configures pytest for the test: pytest.ini, .pytest.ini, pytest.toml, .pytest.toml, a conftest.py, a [tool.pytest…] table in pyproject.toml, [pytest] in tox.ini or [tool:pytest] in setup.cfg, in the test’s folder or one above it. It also needs an interpreter: the checkout’s .venv or venv, an active virtualenv, or python3 or python on PATH, named without starting it. LOOM_CODE_TEST_GATE_RUN_TEMPLATES on the server gives your own harness a command.

  • A path without a command where the root holds a tox, nox or make file. Where the checkout configures no pytest for the test and its root holds tox.ini with a [tox] or [testenv…] section, noxfile.py, or a Makefile with a target whose name starts with test, the line names the test and says which of them was found:

    Loom test for src/app/router.py: tests/test_router.py
    It is the one test file named for that file. No command is given: the checkout configures no pytest for it, and its tox.ini has a `[tox]` or `[testenv…]` section.

    The line says what was found and no more. Loom does not read what that file runs, so a Makefile target named testdata counts; a make assignment (tests := a) does not.

  • A command to copy, written the way the checkout runs pytest. pytest <path> is printed as <python> -m pytest <options> <path>. Each part is read from the checkout’s files, nothing is started, and a part that is not found is left out:

    • -q -rf where pytest’s settings file for the test sets no addopts. With those flags the output ends with one FAILED <file>::<test> line per failing test and then the totals, which the line says. Where the repository set its own options, the line adds none to them.

    • the repository’s own -n form, where pytest-xdist is installed for the interpreter and the repository’s instructions run pytest with -n auto or -n logical: CLAUDE.md, AGENTS.md, CONTRIBUTING, README, Makefile, tox.ini, noxfile.py and pyproject.toml at the root, then the CI workflows. A number of workers is not copied: it is the count of the machine the command was written for. Neither is a command its line comments out, or one a word rules out (Never use `pytest -n auto` , `pytest -n auto` is not safe here). The word is read anywhere before the command on its line, whatever ends a sentence there: Do not use xdist here. `pytest -n auto` deadlocks. gives no -n form, and so does This is not hard. Run `pytest -n auto`.. In a Markdown or reStructuredText file it is also read on the lines above the command, in the command’s sentence, up to 1,024 characters back. A prohibition in a sentence that ended on a line above or in another list item, or in words other than not, never, no, cannot, avoid, without and a word in n't, is not read. The line names the file it read, here in a checkout that sets its own addopts:

      Loom test for src/app/router.py: .venv/bin/python -m pytest -n auto tests/test_router.py
      It is the one test file named for that file. CLAUDE.md runs pytest with -n auto.

      An addopts that sets -n already applies to every run, so the command adds none.

    A command over 200 characters is not sent.

  • Otherwise nothing. A file with no test of its own, a checkout that shows no runner for it, no interpreter for a pytest command, or a prompt that ends by saying not to run tests: the tool result carries no line about tests. Loom does not list the other tests the index reaches, and does not name the changed functions the index links no test to.

  • With the prompt, where it gets pointers. A prompt whose pointers include a definition the prompt names (the last part of its name, four characters or more, as a whole word) gets the same two lines below the pointers, for that pointer’s file, when the file is Python source with exactly one test file named after it and the checks above hold. It adds no request, the same prompt at the same commit gets the same text, and the edit of that file then adds no line. LOOM_TEST_GATE=off or block sends none.

  • When. Once per file and once per test per session, on the result of the edit tool or shell command that changed the file. It costs no model request. A file is asked about at its first change only, so a function changed later in the same file is not named. A test that shell command itself runs is not named on its own result: any pytest run in the checkout that names the file counts, whatever its other options; a run of a part of it (<path>::<test>, -k <name>, -m <mark>, --lf, --sw, --deselect, --collect-only) does not. A shell command that only reads wrote no file, so the session waits for no git call and no request after it; a file changed out of the hooks’ sight, by a formatter run that names no file, is named at the next command that names it and may have written.

  • At the end of the session, only if you turn it on. By default no stop is held: a session that changed code and ran no test ends without being asked to run one. A held stop costs the session at least one more model request and the time of a test run. Install with --config stop_test_gate=true (or set LOOM_TEST_GATE=stop) to have a session that ran no test since its last code change held once per distinct change, with the tests the change obliges and the functions the index links no test to. Any test run since that change lets the stop pass: a shell command that starts a test runner and finished no earlier than the newest write among the code files the session changed. A documentation or prose file (.md, .rst, a changelog, a .txt file under docs/) written after the run holds nothing. The gate reads that command for a runner’s name only. Which tests ran and how they went cannot be read reliably from shell commands, so that judgement stays with the agent and with CI. A repository’s own runner counts when the command starts it, as in python tests/runtests.py app.tests or bin/test pkg/core. The plugin README lists the runners under Stops that pass.

To hold the stop until the named tests ran on the final tree, set LOOM_TEST_GATE=block in the environment Claude Code starts in. The gate then prints nothing at edit time, and blocks “done” once per distinct change unless the transcript already answers the ask; the plugin README lists the exact conditions under Answered stops. That mode also holds a session that ran the tests in a way the gate does not read. LOOM_TEST_GATE=off turns the gate off.

The code shunt

Inside an indexed checkout, loom-code-shunt.mjs denies a bulk read and puts the index’s answer in the denial: a file’s functions, methods, classes and structs with their lines and headers, a symbol’s definition, the tracker’s verdict. A denial costs the agent a request, so the hook gives one only when it holds that answer in full.

Under Claude Code the shunt judges the Read and Grep tools. A shell command starts no hook before it and is never denied, whatever it reads or searches: the one exception is a command that runs gh, which the shunt reads for an issue search. The shell rows of the table apply under Codex, whose shell is its only way to read a file.

Tool call Denied when
Read of a whole file the file is indexed, unmodified, longer than LOOM_SHUNT_MAX_LINES (800), and outlined in full by the index
Read with offset / limit, or a sed -n / head / tail / awk slice the span exceeds LOOM_SHUNT_READ_CAP (0 = off); at most twice per file per session
cat, bat, nl or tac of a whole file in Bash the whole-file rule, when the read is the whole command
a grep for one symbol name in one file once per symbol per session, when the index holds exactly one definition
gh issue list --search, gh search issues once per query, answered by tracker.duplicate_check with the closest reported items

Everything else passes: targeted reads, greps over a directory, single-file greps, files you modified or have not committed, unindexed repositories, and any call the index does not answer in full within 2.5 s. A Bash command of several parts (;, &&, ||, a newline or a pipe) is never denied, because a denial withholds every part; its reads and greps are still counted. A shell command the shunt is started for with no read, no search of files and no issue search in it is not judged, and costs no git call while the checkout’s repository lookup is current; once it is ten minutes old, the command renews it. The same command passes on the next try after a symbol or tracker-shunt denial.

Staleness does not turn the shunt off: an unmodified file is answered as of its indexed commit, and the deny text names the commit. To search your working tree instead, set local_first / LOOM_CODE_LOCAL_FIRST=on; the shunt stands down and the primer skips the code map.

Repository detection is cached ten minutes. A lookup that does not answer within LOOM_SHUNT_RESOLVE_TIMEOUT_MS (8 s) is retried after a minute rather than cached as “not indexed”. Decisions are logged to $TMPDIR/loom-shunt-log-<hash of the uid>.log (LOOM_SHUNT_LOG=off disables) and reported to the server as code.outcome rows (LOOM_SHUNT_REPORT=off disables). LOOM_SHUNT_GREP=off and LOOM_SHUNT_BASH=off exempt the Grep tool and the Bash tool respectively.

claude --bare skips hooks, so none of this runs there; the grep shim covers that case. The operations are described in code index operations.

Skills

Skill Loads when Does
loom-code about to grep or open files in an indexed repository which code.* op replaces the reflex and how to read its answer
loom-memory a fact is stated, decided or corrected; the end of a substantial task what is durable memory and what is scratchpad, how to write a fact a later session can trust, the end-of-task review
loom-mentor which operation serves documents or records; a hint; “what can Loom do” the situation → plane → op map and what each hint code means
loom-optimize “optimize my namespace”, “memory search is bad”, a namespace-health line namespace.audit, a plan the owner approves, memory.move with redirects (guide)
loom-session “save this session”, “resume”, “where was I on this branch” lists the saved briefs, restores the one the user picks (the brief with the client’s compaction summary, or with --transcript every recorded turn as well), or saves one; it never loads a brief unasked
loom-setup only when you run /loom:loom-setup; the model cannot load it writes, updates or removes the instruction block in CLAUDE.md, or in the AGENTS.md that Claude Code reads (bin/loom-setup.mjs)
loom-status a tool says unauthenticated, the primer is missing, “is Loom working?” checks the Node runtime (installs it only on your yes), runs the client check, names the one fix
improve-loom-for-my-repo the end of a session in which the code tools missed turns the session’s misses into reproducible findings for maintainers

loom-session runs bin/loom-brief.mjs (list, get [N | KEY] [--transcript], save); nothing in it runs on its own.

Checking it works

  • After a few tool calls, the dashboard shows the session’s observations and, with logging on, its conversation. run.get on cc-<session_id> replays the run.
  • /loom:loom-status runs bin/loom-client-status.mjs from the plugin: the server it would call, which lookup supplied the token and whether the MCP tools send that token to that server, whether the token is accepted and can write the namespace, capture batches that never reached the server, whether the checkout’s instruction file holds the instruction block, and why a prompt in this checkout does or does not get code pointers (the pointers check). It needs nothing but the plugin.
  • loom doctor --client (the operator CLI, from a source checkout or the server image) adds the Claude Code and Codex wiring checks.

Troubleshooting

Start with /loom:loom-status; it names the cause in one line. It runs its checks with sh: on Windows without Git Bash, run node <plugin root>/bin/loom-client-status.mjs instead. A session start that prints nothing is the working state where the session’s MCP connection carries the indexed checkout and there is no memory to prime. A checkout no index holds, one with no git remote and a lookup the server did not answer each still print their line, unless LOOM_INJECT_CONTEXT=false or LOOM_CODE_MAP=false is set.

Symptom Cause Fix
a hook error says node was not found no node on the PATH Claude Code starts with set PATH in the env block of settings.json to the whole search path with that Node’s directory first, such as "PATH": "/opt/homebrew/bin:/usr/bin:/bin:/usr/sbin:/sbin", or the loom-status skill; restart
every hook error quotes [stdin]:1, a SyntaxError Claude Code older than 2.1.139 drops args update Claude Code
hooks fail and nothing is captured, though Node is installed the first node on that PATH is older than 18 put Node.js 18+ first on that PATH, or run the loom-status skill; restart
MCP server “needs authentication” no Node for the header helper, or no token found the loom-status skill names which
no primer, nothing captured server unreachable, or no token found loom-status; check ~/.loom/config.json
prompts get no code pointers the pointers check of loom-status names it index the repository on this Loom, join its namespace, or wait for the index; for an index that is another repository’s (a fork’s parent’s), --config prompt_pack=on
tools answer, captures do not the token is viewer-only on the write namespace mint a writer token
Conversations page empty conversation logging is off for the namespace the Record conversations switch on the dashboard’s Conversations page, or conversation.set_logging
a hook added in a new release never fires the installed plugin is older than the server claude plugin update loom@loom
every tool listed twice a user-scope loom MCP entry beside the plugin claude mcp remove loom
reads denied in a repo you work on locally the checkout is indexed and the file is unmodified --config local_first=true or LOOM_CODE_LOCAL_FIRST=on
Hook cancelled at exit SessionEnd hooks ran past the client’s budget update the plugin (its entry hands the event off); with LOOM_SESSION_END_WAIT set, raise CLAUDE_CODE_SESSIONEND_HOOKS_TIMEOUT_MS

Other clients

hooks/hooks.generic.json maps the same lifecycle events to the same scripts for any client that runs a command with the hook payload as JSON on stdin; replace ${LOOM_PLUGIN_DIR} with the plugin directory’s absolute path. The scripts probe several common payload field names, and read the client name from their third argument (… PostToolUse codex) or LOOM_CLIENT; unnamed, they assume Claude Code. For a client that can only export a transcript, see transcript capture hooks.

Last updated on

Was this page helpful?