Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/architecture/document-sources.md
Original file line number Diff line number Diff line change
Expand Up @@ -739,8 +739,8 @@ hook sends with a session's prompt, files or transcript (`context.pack`, `code.s
the latest user message through `memory.search` and persist conversation items through
`memory.set`, so both are session content. Its coalesced delivery through
`memory.bulk_set` has the same class. Automatic tool interception also sends
`code.test_gate`, `code.symbol`, `code.enclosing` and `tracker.duplicate_check` with
session-derived inputs. The rule decides; the
`code.test_gate`, `code.symbol`, `code.outline`, `code.enclosing` and
`tracker.duplicate_check` with session-derived inputs. The rule decides; the
registry's classes and a test over what the shipped hooks send pin the full set.

Once a session has seen the flag, no Loom hook sends any op from it, reads included, and
Expand Down
34 changes: 18 additions & 16 deletions docs/features/integrations/claude-code.md
Original file line number Diff line number Diff line change
Expand Up @@ -594,22 +594,24 @@ Beyond the off switches in the table:

## The code shunt

Inside an indexed checkout, `loom-code-shunt.mjs` denies bulk reads and names the op to
call instead: an identifier goes to `code.symbol`, a literal or regex to `code.grep`,
words to `code.search`. The index answers with the enclosing unit and its callers, not a
whole file.

| Tool call | Denied when |
| ----------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- |
| `Read` of a whole file | the file is indexed, unmodified, and longer than `LOOM_SHUNT_MAX_LINES` (800) |
| `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 |
| `Grep` over a directory; `rg`, `grep -r`, `cat` in Bash | the scope is inside the indexed tree |
| a grep for one symbol name in one file | once per symbol per session, with the exact `code.symbol` call |
| `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, single-file greps, pipelines, files you modified
or have not committed, unindexed repositories. The same command passes on the next try
after a symbol or tracker-shunt denial.
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.

| 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. 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
Expand Down
12 changes: 6 additions & 6 deletions docs/reference/environment.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,12 +123,12 @@ See [Python SDK](./python-sdk.md) and [TypeScript SDK](./typescript-sdk.md).

## Coding-agent plugins and hook scripts

| Variable | Read by | Default | Meaning |
| ------------------------------------------ | ------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- |
| `LOOM_ORG`, `LOOM_NAMESPACE`, `LOOM_AGENT` | the plugins' `lib/loom-client.mjs`, `integrations/cursor/`, `integrations/generic/`, `dev/loom_init.py` | `~/.loom/config.json`, then the token's claims, then `default` / `coding` / the client's name | The identity the hooks and scripts write captured rows under. |
| `LOOM_HOOK_TIMEOUT_MS` | the plugins' `lib/loom-client.mjs` | 5 × the measured `/v1/health` round trip, between 3000 and 8000 | The timeout that aborts each hook request; `loom doctor --client` reports it. |
| `LOOM_HOOK_EXIT_MS` | the plugins' `lib/loom-client.mjs` | `LOOM_HOOK_TIMEOUT_MS` | How long a hook process waits after it sends before it exits. |
| `LOOM_SHUNT_READ_CAP` | the plugins' `hooks/loom-code-shunt.mjs` | `0` (off) | Lines above which a ranged read of an indexed, unmodified file is sent to the code tools instead. |
| Variable | Read by | Default | Meaning |
| ------------------------------------------ | ------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- |
| `LOOM_ORG`, `LOOM_NAMESPACE`, `LOOM_AGENT` | the plugins' `lib/loom-client.mjs`, `integrations/cursor/`, `integrations/generic/`, `dev/loom_init.py` | `~/.loom/config.json`, then the token's claims, then `default` / `coding` / the client's name | The identity the hooks and scripts write captured rows under. |
| `LOOM_HOOK_TIMEOUT_MS` | the plugins' `lib/loom-client.mjs` | 5 × the measured `/v1/health` round trip, between 3000 and 8000 | The timeout that aborts each hook request; `loom doctor --client` reports it. |
| `LOOM_HOOK_EXIT_MS` | the plugins' `lib/loom-client.mjs` | `LOOM_HOOK_TIMEOUT_MS` | How long a hook process waits after it sends before it exits. |
| `LOOM_SHUNT_READ_CAP` | the plugins' `hooks/loom-code-shunt.mjs` | `0` (off) | Lines above which a ranged read of an indexed, unmodified file is denied with its declarations. |

See [Claude Code plugin](../features/integrations/claude-code.md).

Expand Down
2 changes: 1 addition & 1 deletion integrations/claude-code-plugin/.claude-plugin/plugin.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "loom",
"displayName": "ClickHouse Loom",
"version": "1.2.67",
"version": "1.2.68",
"description": "Shared long-term memory and code intelligence for Claude Code, self-hosted on ClickHouse. MCP tools to save and recall decisions, preferences and corrections across sessions and teammates; lifecycle hooks that capture each session with no model call; a code index that answers where-is, who-calls and blast-radius questions with line-accurate units instead of whole-file reads.",
"author": {
"name": "ClickHouse"
Expand Down
Loading
Loading