From 8dbcf15ec2bcadb5421a66bd87edece5aa0fb1b7 Mon Sep 17 00:00:00 2001 From: Lareb Zafar Date: Sat, 5 Dec 2026 01:31:56 +0530 Subject: [PATCH 01/13] Tests: a pick worded high or medium is sent whatever the risk label says The tests state the rule and fail: the prompt hook holds a picked answer to the retrieval_risk label, which bands the search's scores before the pick model reads the candidates. A pick worded low, an answer with no word, an abstention, a first pick that fails the place test and a named LOOM_PROMPT_PACK_MIN_CONF keep their rules. Co-Authored-By: Claude Fable 5.2 Signed-off-by: Lareb Zafar --- .../tests/prompt-pack-hook.test.mjs | 21 ++++++++ .../tests/prompt-pack.test.mjs | 53 +++++++++++++++++-- 2 files changed, 70 insertions(+), 4 deletions(-) diff --git a/integrations/claude-code-plugin/tests/prompt-pack-hook.test.mjs b/integrations/claude-code-plugin/tests/prompt-pack-hook.test.mjs index 93c5b62ee4..86be542f85 100644 --- a/integrations/claude-code-plugin/tests/prompt-pack-hook.test.mjs +++ b/integrations/claude-code-plugin/tests/prompt-pack-hook.test.mjs @@ -738,6 +738,27 @@ test("search pointers follow the index's own risk label unless a confidence is n assert.match((await named.ask(prompt)).out, /src\/parser\.py:10-14/); }); +test("a bug report's picks are sent at a medium or high risk label when the model words them high or medium", async (t) => { + const report = "The parser crashes on a nested record prefix that ends with a dot"; + const reply = (risk, word) => ({ + "code.search": { + ...REPLIES["code.search"], + retrieval_confidence: 0.5, + retrieval_risk: risk, + ...(word ? { pick_confidence: word } : {}), + }, + }); + const asked = async (risk, word, env) => (await contractFixture(t, reply(risk, word), env)).ask(report); + for (const risk of ["medium", "high"]) { + for (const word of ["high", "medium"]) + assert.match(context(await asked(risk, word)), /src\/parser\.py:10-14/, `${word} ${risk}`); + // not sure, and no word (no pick model, a pick skipped, cut or failed): the label gates the answer + for (const word of ["low", ""]) assert.deepEqual(await asked(risk, word), SILENT, `${word} ${risk}`); + } + // A confidence the caller names is a floor under every answer, a picked one included. + assert.deepEqual(await asked("medium", "high", { LOOM_PROMPT_PACK_MIN_CONF: "0.6" }), SILENT); +}); + test("a bug report asks for the server's pick, with no switch, and is sent by the model's word", async (t) => { const report = "The parser crashes on a nested record prefix that ends with a dot"; const question = "How are nested record prefixes combined before validation?"; diff --git a/integrations/claude-code-plugin/tests/prompt-pack.test.mjs b/integrations/claude-code-plugin/tests/prompt-pack.test.mjs index c8cec68047..858eb2ba31 100644 --- a/integrations/claude-code-plugin/tests/prompt-pack.test.mjs +++ b/integrations/claude-code-plugin/tests/prompt-pack.test.mjs @@ -75,6 +75,12 @@ test("accept follows the index's own abstain and risk label, or a named confiden assert.equal(accept({ ...RES, retrieval_confidence: 0.3 }, 0.4), false); assert.equal(accept({ ...RES, results: [] }), false); assert.equal(accept(null), false); + // A picked answer (the pick model worded it high or medium) is not held to the label. + for (const risk of ["medium", "high"]) assert.equal(accept({ ...RES, retrieval_risk: risk }, null, true), true, risk); + // It is held to everything else: an abstention, an empty answer, a threshold the caller names. + assert.equal(accept({ ...RES, abstain: true, retrieval_risk: "abstain" }, null, true), false); + assert.equal(accept({ ...RES, results: [], retrieval_risk: "medium" }, null, true), false); + assert.equal(accept({ ...RES, retrieval_confidence: 0.3, retrieval_risk: "medium" }, 0.4, true), false); }); const unit = (kind, path) => ({ path, start_line: 1, end_line: 9, kind }); @@ -991,11 +997,48 @@ test("a picked answer is sent by the model's word: high and medium its first thr const misplaced = [{ ...results[0], path: "app/migrations/0001_initial.py" }, ...results.slice(1)]; for (const word of ["high", "medium"]) assert.deepEqual(sent(answer(word, misplaced)).pointers, [], word); assert.deepEqual(sent(answer("", misplaced)).pointers, results.slice(1)); - // the index's own label still gates every answer, whatever the model said - assert.deepEqual(sent({ ...answer("high"), retrieval_risk: "medium" }).pointers, []); assert.deepEqual(sent(null).pointers, []); }); +test("a pick worded high or medium is sent whatever the risk label says; low, no word and an abstention are not", () => { + const report = "why does the upload crash on an empty bucket name"; + const body = searchBody({ org: "o", namespace: "code-x" }, report, { topK: 4, token: "" }); + const results = [1, 2, 3, 4].map((n) => ({ + path: `src/upload${n}.py`, + start_line: 10, + end_line: 14, + symbol: `send${n}`, + kind: "function", + })); + const misplaced = [{ ...results[0], path: "app/migrations/0001_initial.py" }, ...results.slice(1)]; + const answer = (word, risk, units = results) => ({ + abstain: false, + retrieval_confidence: 0.5, + retrieval_risk: risk, + results: units, + ...(word === undefined ? {} : { pick_confidence: word }), + }); + const sent = (res, minConfidence = null) => pointerBlock(body, res, report, { topK: 4, minConfidence }).pointers; + for (const risk of ["medium", "high"]) { + // The label bands the scores of the search, which ran before the pick model read the + // candidates: its word about them is the later reading, and its picks are sent as at low risk. + for (const word of ["high", "medium"]) + assert.deepEqual(sent(answer(word, risk)), results.slice(0, 3), `${word} ${risk}`); + // the model says probably none of its picks is the place + assert.deepEqual(sent(answer("low", risk)), [], risk); + // No word, or a value that is none of the three: no model read the answer, and the label gates it. + for (const word of ["", undefined, "sure"]) assert.deepEqual(sent(answer(word, risk)), [], `${word} ${risk}`); + // the place test is the same at any label: a first pick that is no place sends nothing + for (const word of ["high", "medium"]) assert.deepEqual(sent(answer(word, risk, misplaced)), [], `${word} ${risk}`); + } + // an abstention sends nothing, whatever word it carries + assert.deepEqual(sent({ ...answer("high", "abstain"), abstain: true }), []); + // a confidence the caller names is a floor under every answer, a picked one included + assert.deepEqual(sent(answer("high", "medium"), 0.6), []); + assert.deepEqual(sent(answer("high", "medium"), 0.5), results.slice(0, 3)); + assert.deepEqual(sent(answer("", "medium"), 0.5), results); +}); + test("the cause sentence is the last line of a block built from a high pick, and of no other", () => { const report = "why does the upload crash on an empty bucket name"; const body = searchBody({ org: "o", namespace: "code-x" }, report, { topK: 4, token: "" }); @@ -1040,10 +1083,12 @@ test("the cause sentence is the last line of a block built from a high pick, and for (const word of ["medium", "", undefined]) assert.equal(text(answer(word, cause)), text(answer(word)), String(word)); assert.equal(text(answer("low", cause)), ""); - // no block, no sentence: a first pick that is no place to edit, an answer the index does not stand behind + // the sentence goes with the block at any risk label: a high pick is sent at a medium one + assert.equal(text({ ...answer("high", cause), retrieval_risk: "medium" }), `${sure}\n${LABEL} ${cause}`); + // no block, no sentence: a first pick that is no place to edit, an answer that abstains const misplaced = [{ ...results[0], path: "app/migrations/0001_initial.py" }, ...results.slice(1)]; assert.equal(text(answer("high", cause, misplaced)), ""); - assert.equal(text({ ...answer("high", cause), retrieval_risk: "medium" }), ""); + assert.equal(text({ ...answer("high", cause), abstain: true, retrieval_risk: "abstain" }), ""); // The server writes the sentence from the reply's picks and the block lists those that are places: // a later pick that is none (a test the prompt does not ask for) gets no pointer, and the sentence stays. const tested = [results[0], { ...results[1], path: "tests/test_upload2.py" }, ...results.slice(2)]; From b757177ddd4cb74f30bac04683ff83bcac594e40 Mon Sep 17 00:00:00 2001 From: Lareb Zafar Date: Sat, 5 Dec 2026 01:46:12 +0530 Subject: [PATCH 02/13] The prompt hook sends a bug report's picks at any risk label when the pick model words them high or medium retrieval_risk bands the scores of the search, which ran before any model read the candidates. The pick model reads them against the report, so its word is the later reading: the hook no longer drops a high or medium answer for a medium or high label. A pick worded low still sends nothing, an answer with no word keeps the label as its gate, an abstention sends nothing, LOOM_PROMPT_PACK_MIN_CONF is a floor under every answer when set, and the place test is unchanged. The SDK pointer helpers ask for no pick and are unchanged. Co-Authored-By: Claude Fable 5.2 Signed-off-by: Lareb Zafar --- docs/features/integrations/claude-code.md | 75 +++++++++++-------- docs/guides/issue-code-pointers.md | 4 +- .../.claude-plugin/plugin.json | 2 +- integrations/claude-code-plugin/README.md | 56 +++++++------- .../claude-code-plugin/hooks/HOOKS.md | 27 ++++--- .../hooks/loom-prompt-pack.mjs | 10 ++- .../lib/agent-instructions.mjs | 3 +- .../claude-code-plugin/lib/prompt-pack.mjs | 24 ++++-- .../codex-plugin/.codex-plugin/plugin.json | 2 +- .../codex-plugin/hooks/loom-prompt-pack.mjs | 10 ++- .../codex-plugin/lib/agent-instructions.mjs | 3 +- integrations/codex-plugin/lib/prompt-pack.mjs | 24 ++++-- tests/unit/session_content_senders.json | 8 +- 13 files changed, 149 insertions(+), 99 deletions(-) diff --git a/docs/features/integrations/claude-code.md b/docs/features/integrations/claude-code.md index 5bb4a477a0..d2d637c95b 100644 --- a/docs/features/integrations/claude-code.md +++ b/docs/features/integrations/claude-code.md @@ -490,11 +490,12 @@ Not every prompt there gets that line. The answer to a named definition, callers impact question opens with a line of its own, which names neither the check nor the search. The hook sends nothing, for example, for a self-contained request, a local-only change or a memory question, or where the index does not rate its search answer low-risk +and no pick worded it `high` or `medium` ([Claude does not call Loom tools](#claude-does-not-call-loom-tools) has the rest). On a server with no embedding model, or in a code namespace an administrator has not -calibrated, that can be every search answer: the checkout then has neither search -pointers nor the block, and the `pointers` line of `/loom:loom-status` prints the risk -its test search read. With +calibrated, that can be every search answer no pick stands behind: the checkout then has +neither search pointers nor the block for those prompts, and the `pointers` line of +`/loom:loom-status` prints the risk its test search read. With `prompt_context` off the hook sends nothing for any prompt: the session has pointers only where a pipeline put them in the prompt before it started the agent. For a prompt without that line no line of the instruction file names the search, and nothing the hook @@ -659,7 +660,9 @@ local-only changes, self-contained requests and a turn the host writes itself wh background command ends (one that opens with ``). 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 +set, from that confidence) and never when it abstains. An answer the server's pick +worded `high` or `medium` is not held to the label +([model-picked pointers](#model-picked-pointers-for-a-bug-report)). 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 @@ -1074,32 +1077,32 @@ See [code index overview](../code-index/overview.md) and the 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, profile, the session's memory stack, recent runs with `LOOM_CONTEXT_RUNS`; and the memories, decisions and procedures a search for the project finds or, where a new or cleared conversation's prompts get the recall, the pinned and newest ones, listed), 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 when [the instruction block](#the-instruction-block) needs setup | `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](#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](#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; of a record linked to a file of the checkout that the prompt does not name, one line: its key and the file | `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-`, 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](#the-code-shunt)) | `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, without the records the session already holds | `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](#the-test-gate)) | `LOOM_TEST_GATE=off` | -| PostToolUse, PostToolUseFailure (Bash) | `loom-test-report.mjs` | after a test command whose output names no failure's reason, a digest of the result file its pytest run wrote: totals and failures grouped by message; no request ([the test report](#the-test-report)) | `LOOM_TEST_REPORT=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, the test report after a failed call too, 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](#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:`): 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//`) | `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` | +| Event | Script | Effect | Off switch | +| ------------------------------------------------------------- | --------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- | +| SessionStart | `loom-session-start.mjs` | one budgeted `context.pack` primer (working-memory note, profile, the session's memory stack, recent runs with `LOOM_CONTEXT_RUNS`; and the memories, decisions and procedures a search for the project finds or, where a new or cleared conversation's prompts get the recall, the pinned and newest ones, listed), 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 when [the instruction block](#the-instruction-block) needs setup | `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](#what-a-prompt-gets)); otherwise up to three `code.search` pointers for the prompt, only when the index rates its answer low-risk or the pick worded it `high` or `medium` (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](#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; of a record linked to a file of the checkout that the prompt does not name, one line: its key and the file | `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-`, 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](#the-code-shunt)) | `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, without the records the session already holds | `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](#the-test-gate)) | `LOOM_TEST_GATE=off` | +| PostToolUse, PostToolUseFailure (Bash) | `loom-test-report.mjs` | after a test command whose output names no failure's reason, a digest of the result file its pytest run wrote: totals and failures grouped by message; no request ([the test report](#the-test-report)) | `LOOM_TEST_REPORT=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, the test report after a failed call too, 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](#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:`): 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//`) | `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 @@ -1347,7 +1350,15 @@ The hook reads that word, `pick_confidence`: picks probably is, `low` that probably none is. On `high` or `medium` the first pick decides: when it is no place to edit, the picks below it are not sent in its place, and no result below the third is sent. `medium` does not say that much of its first pick; -the hook holds both words to one rule by choice. A reply carries no word when the server +the hook holds both words to one rule by choice. + +A `high` or `medium` answer is sent at any `retrieval_risk`. The risk bands the scores +of the search, which ran before any model read the candidates; the pick model read them +against the prompt, so its word is the later reading. An answer that abstains is not +sent, and a `LOOM_PROMPT_PACK_MIN_CONF` that is set is a floor under a picked answer as +under any other. A reply with no word is sent where the index labels it low-risk. + +A reply carries no word when the server made no pick, when its inference gateway refused the pick's call for the caller, and when the page's first unit is not the pick's first, which keeps the picked order. Any other prompt is searched with no pick. @@ -1446,7 +1457,7 @@ Beyond the off switches in the table: | `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` | the bound of a prompt that asks for no pick: the repository lookup and the answer of its code pointers | -| `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_MIN_CONF` | unset | a `retrieval_confidence` gate for search pointers (low risk is 0.7 up); unset, that label, which a pick worded `high` or `medium` passes | | `LOOM_PROMPT_PACK_PICK_TIMEOUT_MS` | `6000` | the bound of a searched prompt that reads as a bug report, in place of that one: its search asks for the server's pick, a model call; under Claude Code, no longer than the launcher waits | | `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 | diff --git a/docs/guides/issue-code-pointers.md b/docs/guides/issue-code-pointers.md index f16851da7a..df49303bfe 100644 --- a/docs/guides/issue-code-pointers.md +++ b/docs/guides/issue-code-pointers.md @@ -208,7 +208,9 @@ What the plugins do and the SDKs do not: - **Ask for the pick.** For a prompt that reads as a bug report a plugin's search asks for the listwise pick and sends the answer by the model's word ([the pick](../features/integrations/claude-code.md#model-picked-pointers-for-a-bug-report)). - The SDK method never asks for it. + It sends an answer the model words `high` or `medium` at any `retrieval_risk`. The + SDK method never asks for it, so every answer of its search is held to + [the low-risk label](#send-nothing-when-the-index-does-not-stand-behind-its-answer). - **Print the cause sentence.** After a pick the model is confident of, the server's answer can carry one sentence that states the cause (`pick_cause`), and a plugin prints it as the last line of the block, under a label that calls it unchecked: diff --git a/integrations/claude-code-plugin/.claude-plugin/plugin.json b/integrations/claude-code-plugin/.claude-plugin/plugin.json index 2fd806675c..6521f856c7 100644 --- a/integrations/claude-code-plugin/.claude-plugin/plugin.json +++ b/integrations/claude-code-plugin/.claude-plugin/plugin.json @@ -1,7 +1,7 @@ { "name": "loom", "displayName": "ClickHouse Loom", - "version": "1.2.178", + "version": "1.2.181", "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" diff --git a/integrations/claude-code-plugin/README.md b/integrations/claude-code-plugin/README.md index d637b47eb4..3f83b5efa7 100644 --- a/integrations/claude-code-plugin/README.md +++ b/integrations/claude-code-plugin/README.md @@ -271,33 +271,33 @@ the duplicate, run `claude mcp remove -s user`. ## What it wires -| Lifecycle event | Script | What it does | -| ----------------------------------------------------------------------- | --------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `UserPromptSubmit` | `loom-record.mjs` | The prompt's one process. Runs the two lookups the prompt waits for (`loom-prompt-pack`, `loom-prompt-recall`) in the hook itself and prints what they found as one `additionalContext`; writes the run's begin to the session's run state and hands the prompt's recording scripts (`loom-run`, `loom-namespace-health`'s audit) to a detached process and exits, as after a tool call. | -| `PostToolUse`, `PostToolUseFailure`, `PreCompact`, `Stop`, `SessionEnd` | `loom-record.mjs` | The event's one process. Runs the scripts whose answer the session waits for in the hook itself, each for the tools its row below names and only where the [mode](#modes) runs its plane: after a tool call `loom-file-context`, `loom-mentor-hint`, `loom-blast-radius`, `loom-test-gate` (only after a shell command that may have written a file) and `loom-test-report` (only after one that starts a test runner), at `Stop` the gates the install runs. It prints their answers as one, each script's text on a line of its own: a file's memory and then its test line as one `additionalContext`, the gates' reasons as one block. Runs the event's recording scripts (`loom-capture`, `loom-conversation`, `loom-usage`, `loom-working-memory`, `loom-run`'s close, `loom-session-memory`, `loom-session-brief`) in one process. After a tool call `loom-capture` records something of, at `Stop` and at `SessionEnd` that process is detached, so the session does not wait for their requests and the client, which ends a SessionEnd hook after 1.5 s, cannot cancel them. Before a compaction it is the hook itself, which exits when they have returned: the compaction's primer reads the note they write. | -| `PostToolUse` | `loom-capture.mjs` | Records one episodic observation of the tool action (heuristic type, file list). | -| `PostToolUseFailure` | `loom-capture.mjs` | Same, typed `error` — the bug-triage signal (errors + the subsequent fix). | -| `SessionStart` | `loom-session-start.mjs` | **First session, no credential:** signs this machine up (see `LOOM_AUTO_SIGNUP`) and points the user to the claim page for the namespace; nothing to paste. Then: injects a token-budgeted context primer via `context.pack`: the project's working-memory note, the profile, the session's memory stack and a few memories. In a new or cleared conversation whose prompts get the recall (`loom-prompt-recall.mjs`, which this plugin and Codex's wire, where it is on) the primer runs no memory search: the memories are the namespace's pinned rows and then its newest, five at most, and the recall searches with the prompt. Any other row arrives only when a prompt's recall finds it: a session whose recall abstains gets none. A resumed or compacted session, a session with `LOOM_PROMPT_RECALL=off` or `LOOM_PROMPT_CONTEXT=off` and a hand-wired client get the memories, decisions and procedures a search for the project finds instead. Beside it, one line names the checkout's code namespace and the repository's memory tag, or says why no index is read: no checkout, no remote, no answer, a repository this Loom does not index, one the session's principal is not a reader of, or one whose namespace the token does not name; an index still being built says so too. A new session whose MCP connection carries the checkout is told neither: the header helper sent the namespace, the server applies it to every `loom_code_*` call and adds the tag to a save, and a session with nothing else to hear starts with no text from the hook. How to route a lookup is in the MCP entry's startup instructions on a toolset with a `coding` part; any other toolset, and a wiring whose entry the plugin does not mount (Codex, a hand-wired client), gets it in the primer. **On by default**, once per session; `LOOM_INJECT_CONTEXT=false` to disable. | -| `PostToolUse` (Read / Grep / Bash), `PreCompact` | `loom-file-context.mjs` | Asks `memory.for_file` what loom knows about a file the call read (its files facet) and attaches the rendered block to the read's result, at no model request: the first local read of a file in the checkout — `Read`, a `Grep` of one file, or a shell `cat` / `sed -n` / `head` / `tail` / `grep pattern file` — brings its memory, so a session that only reads, or that edits through the shell, gets it too. One lookup per session, agent context and file (a subagent's read does not use up the main agent's block); a compaction clears what was shown. A record the session already holds, given whole with the prompt or printed with the same line in another file's block, is left out, and a block with nothing new is not attached; a team rule, a decision and a constraint are printed under every file they name. A file with no memory adds nothing. Reads ask about at most three files per call and 40 per session, give the request 1 s and the call 2 s in all, and stop asking after three unanswered lookups. Where the mode runs the code index, a read or an edit that asks first renews a repository lookup that is ten minutes old, which brings the repository's shared rules; a read that this takes past its 2 s leaves the file for its next read or its edit. | -| `PreToolUse` (Edit / Write / MultiEdit / NotebookEdit) | `loom-file-context.mjs` | Before an edit of a file this agent context has not been shown, the same lookup and block — a constraint arrives **before** the edit, not as a review comment. A file shown more than 30 min ago is asked about again, and a record handed more than 30 min ago is printed again; a team rule, a decision and a constraint are printed with every block. Never a permission decision. `LOOM_FILE_CONTEXT=off` disables. | -| `PostToolUse` (loom tools) | `loom-mentor-hint.mjs` | **The store's advice reaches the model**: a loom tool result may carry one `hint` — the plane this agent is not using, named from the call it just made (a `memory.get` that missed, a search that abstained where the code index answers, a stack trace written as a memory, a duplicate write). The hook lifts it out of the result JSON into additional context, once per code per session. No request of its own. `LOOM_MENTOR_HINTS=off` disables. | -| `PostToolUse` (Edit / Write / MultiEdit) | `loom-blast-radius.mjs` | In a loom-indexed repo, diffs the edited file against HEAD and asks `code.impact` (depth 1) what the touched symbols reach. Injects **one line**: callers, tests reaching the change, and the co-change partner files this session has not touched — the sibling-file miss, surfaced while the edit is still open. Same touched set reported once per session. The first edit of a file in a session also carries the test gate's line (next row), which stands in for the radius's count of tests where it names the file's test, so an edit gets one line. `LOOM_BLAST_RADIUS=off` disables the radius. | -| `PostToolUse` (Bash / PowerShell) | `loom-test-gate.mjs` | **A changed file's own test is named when the file changes.** After a shell command in a loom-indexed repo, asks `code.test_gate` about each file the command changed (a dirty path it names, written since the session began) and, for a file that has a test of its own, attaches its command and what the index knows of it: `Loom test for src/router.py: .venv/bin/python -m pytest -q -rf tests/test_router.py`, then `It is the one test file named for that file.` and what the checkout proves of the command. Once per file and once per test per session, on the tool result, so it costs no model request; an edit tool's call gets the same line from `loom-blast-radius.mjs`. A file with no such test, a runner the checkout does not configure, a comment-only change and a prompt that ruled a test run out get nothing, and a command that only reads (`grep`, `cat`, `sed -n`, `git diff`) starts no git process and asks nothing (**Tests at edit time**, below). `LOOM_TEST_GATE=off` disables; `LOOM_TEST_GATE_DEPTH` sets the hops (1–3). | -| `PostToolUse`, `PostToolUseFailure` (Bash) | `loom-test-report.mjs` | **Why a test failed, on the run whose output was cut.** In a checkout that configures pytest, SessionStart adds its result-file option to `PYTEST_ADDOPTS` for the session's shell commands, so every pytest run writes a private result file. After a test command whose visible output names no failure's reason (`pytest ... \| tail -3`), the hook adds a digest of that file to the tool result: the totals, up to three groups of failures by message, each with its first test and where it was raised; at most 700 characters. No request and nothing stored (**The test report**, below). `LOOM_TEST_REPORT=off` disables. | -| `UserPromptSubmit` | `loom-prompt-recall.mjs` | **Default `first`**: one bounded recall on the first qualifying prompt of a session, including empty or abstaining answers. Clear named code-only questions skip default recall without consuming the attempt; mixed memory requests still qualify. `LOOM_PROMPT_RECALL=on` (or the install option `prompt_recall`) for every prompt, `off` to disable; `LOOM_PROMPT_CONTEXT=off` disables it too ([what a prompt gets](#what-a-prompt-gets)). One `context.pack` per prompt restricted to `memories`, `decisions`, `procedures` with the prompt as the query; injects the records the session has not seen (each plane's under its tag; memories that answer alone under none), only when memory is not abstaining and `retrieval_confidence ≥ 0.5`, whole records within 1,600 chars (`LOOM_PROMPT_RECALL_MAX_CHARS`; one that does not fit is left out; a block's only record that the pack cut, or the first when none fits, is cut at its last whole sentence and names the call that reads it whole, the one the server's mark on the line names, or else the key to read it whole by). A record of code as it was before a commit the checkout's `HEAD` already has is left out, and a fix record whose commit it has is added as one line that names the commit. A record linked to a file of the checkout is added as one line, its key and that file, unless the prompt names the file or the definition, or asks memory: `loom-file-context` adds the record's own line after a local read of the file or before an edit of it. With `LOOM_FILE_CONTEXT=off`, or outside a checkout of a repository this Loom indexes, the prompt gets the record whole. The memory-side sibling of the prompt pack: active retrieval — the model gets what memory knows about the prompt without asking — done per prompt, never per tool turn. | -| `UserPromptSubmit` | `loom-prompt-pack.mjs` | Runs where the Loom the session talks to holds the checkout's own repository in its code index (`LOOM_PROMPT_PACK=off` stops it; [what a prompt gets](#what-a-prompt-gets)). One bounded lookup: `code.symbol`, `code.callers` or `code.impact` for an explicit named question, otherwise `code.search` (top 3, no bodies). The repository lookup and the answer share one bound (`LOOM_PROMPT_PACK_TIMEOUT_MS`, 2.5 s; a searched bug report asks for the server's pick and has 6 s): what comes later is skipped. Self-contained requests, local-only changes and explicit memory questions skip code retrieval. Search emits only where the index labels its own answer low-risk (or, with `LOOM_PROMPT_PACK_MIN_CONF` set, from that confidence), without abstention, and sends 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; its pointers are candidates, and nothing tells the model to stop searching; typed answers preserve ambiguity and static-analysis limits. Named implementation or behavior questions request a whole definition body within 600 server-budget tokens; location/signature requests stay pointer-only and oversized bodies stay elided. No fallback request follows an empty typed answer. Pointers are deduplicated within the current answer, so later prompts can receive changed evidence. Below the pointers of a search answer goes the test gate's line (**Tests at edit time**, below) when a pointer's definition is named in the prompt and its Python file has exactly one test file named after it, in a checkout that configures pytest; it adds no request and a session gets a test once. | -| `Stop` | `loom-test-gate.mjs` | **Off by default; with the `stop_test_gate` option (or `LOOM_TEST_GATE=stop`), holds a session that ran no test since its last code change.** A held stop costs the session at least one more model request, so it is yours to turn on. Then, with uncommitted changes **this session made** in a loom-indexed repo (the dirty paths the transcript shows an edit tool targeted or a shell command named, written since the session began, by the file's modification time; a tree left dirty before the session gates nothing, even when a command reads or runs its files), asks `code.test_gate` what the change obliges — the tests to run, in evidence order with a `run` command when the harness is derivable, and the touched definitions a coverage run measured unexecuted — and blocks the stop **once** per distinct change with a reason that names them. The second stop on the same change passes. Any test run since the last code change lets the stop pass, and nothing is asked (**Stops that pass**, below); with `LOOM_TEST_GATE=block` only a run of the named tests does (**Answered stops**, below). `LOOM_TEST_GATE=off` disables the gate at both events. | -| `Stop` | `loom-validate-gate.mjs` | **Compile green before done**: collects the memory keys this session wrote from the transcript, asks `namespace.validate` for a report scoped to exactly those keys, and blocks the stop **once** per distinct key set with the error and warning findings that name them (a conflict you opened, a fact whose `valid_to` has passed, an attestation your edit made stale) and each check's remedy. `info` findings never block; the second stop on the same keys passes. `LOOM_VALIDATE_GATE=off` disables. | -| `Stop` | `loom-namespace-health.mjs` | **The store tells you when the namespace is misused**: once per session, one `namespace.audit` over the last day (no samples) for the session's namespace, asked by the first prompt's detached process so that a stop does not wait for it (a stop asks in place only when that process died before its answer); when it carries a critical finding — exact-key reads dwarfing searches, double-encoded values, rows the embedder gave up on, leases in the memory plane — you get **one line** naming the codes and `/loom-optimize`, once per session, at the first stop that finds the verdict, as a block-once reason (the one channel a Stop hook has to the model). Healthy namespace, no token, slow or down server: nothing. The same summary rides `context.pack` as the `namespace_health` section at session start. `LOOM_NAMESPACE_HEALTH=off` disables. | -| `Stop` | `loom-usage.mjs` | Posts the session's own model usage (input, cache read, cache creation by TTL, output; deduped by message id, sidechains skipped) to `cost.record_turns`; the **server** prices it into `loom.agent_turn_usage` from the same table it prices its own upstream spend with. Turns "did loom make this session cheaper" into a standing series instead of a hand-run paired experiment. Needs a writer token. `LOOM_USAGE=off` disables. | -| `UserPromptSubmit` | `loom-run.mjs` | Opens the session's **run** on the first prompt (`run.begin`: goal = the prompt, `run_id = cc-`, or the id `run.begin` answers instead; the prompt does not wait for that answer, so the SessionStart primer, the prompt's recall and a first tool observation keep the derived id, or on a resumed session the previous run's id). Later prompts are no-ops once a begin was answered or refused; after a timeout, a 408, 429 or 5xx the next prompt asks again with the same id, and SessionEnd closes it if no answer ever came. Until then the session's run-state file in the temp directory (readable by you only) holds that begin's body, which every retry re-sends: the prompt, redacted and cut to 8000 characters. One row per session in `loom.agent_runs`; every observation the capture hook records carries the same `run_id`, so `run.get` replays the session — goal, observations, memories written, cost. `LOOM_RUN_LEDGER=off` disables. | -| `SessionEnd` | `loom-run.mjs` | Closes the run (`run.complete`) with the transcript's last assistant text as `final_response` and `outcome: none` — the hook knows the run ended, not whether it succeeded, and never guesses which memories were used; that stays the agent's own `run.complete` call (`memories_used`, `reflection`). | -| `PreCompact` | `loom-capture.mjs` | Crystallizes the session before the context window is dropped. | -| `Stop`, `PreCompact` | `loom-working-memory.mjs` | Writes the session's **working-memory note** — one `working_memory.set` per project (`session:`, agent scope): the goal (first prompt), `git status --short --branch`, the files edited this session, the last reply — framed as a bookmark, not a source of facts (the next session's model answered a fact question from this line without searching). Deduped on content, so an unchanged turn writes nothing. `context.pack` loads working memory first in the SessionStart primer and Claude Code fires SessionStart again after a compaction, so the note written a moment before the drop is the first thing the agent reads after it. A new or cleared conversation whose checkout is on another branch than the note names gets its primer without the note. Not retrieval memory: never embedded or ranked. `LOOM_WORKING_MEMORY=off` disables. With `LOOM_PLUGIN_SCRATCHPAD=1` the Stop hook also appends the turn's one-line conclusion to the run's `scratchpad` block at run scope. | -| `Stop` / `SessionEnd` | `loom-capture.mjs` | Crystallizes the finished session. | -| `PreCompact`, `SessionEnd` | `loom-session-brief.mjs` | Revises the branch's **session brief**: the transcript since the last save becomes typed events (asks, replies, edits, commands with their descriptions, errors, reads, todo lists, PR/commit identifiers a command printed; zero model tokens) posted to `session.brief_save`, which condenses them under a budget and revises `auto//` — goal, status, next steps, decisions and why, what was tried and dropped, what was done, open questions, files, the rules you set, pointers. The `loom-session` skill restores one on request: you pick which (a number from `list`, a key, or a session) and restores it with the client's compaction summary (or `--transcript` for every recorded turn as well). Not retrieval memory: never embedded or ranked. Detached flusher; per-session cursor; a first save needs an ask and some work behind it. `LOOM_SESSION_BRIEF=off` disables. | -| `SessionEnd` | `loom-session-memory.mjs` | Hands the session's real turns (last 200, bounded) to `memory.set_from_messages(defer=true)` once, so loom extracts the facts, writes the **session summary**, judges the outcome and distils reflections. The turns are kept as the facts' source evidence. The body also names the files the session changed in its checkout (each path and the time it was last written, never its content), which decide the session's fix record whatever tool wrote them, and `HEAD` as the commit that holds them, when its history has a commit of the session's that touches every file its edit tool wrote (the tag `change:`). A session with under 40 bytes (UTF-8) of user and assistant text is not sent, because the extraction call's fixed prompt outweighs what it can yield: a rule stated in it is not extracted, and it gets no session summary, outcome judgement or reflections. `LOOM_SESSION_MEMORY=off` disables. | -| `Stop` / `SessionEnd` | `loom-conversation.mjs` | Appends new chat turns from the transcript to the conversation plane (→ the dashboard's Conversations page). Deterministic, every turn; per-session cursor + `msg_id`=transcript uuid dedup. Text blocks only — an image the user pasted becomes a `[image: ]` placeholder beside its text, and a tool result that returned images leaves one `tool` turn `[image: N image results returned by a tool]`; the bytes never leave the machine. Off-switch: `LOOM_CAPTURE_CONVERSATIONS=false`. | +| Lifecycle event | Script | What it does | +| ----------------------------------------------------------------------- | --------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `UserPromptSubmit` | `loom-record.mjs` | The prompt's one process. Runs the two lookups the prompt waits for (`loom-prompt-pack`, `loom-prompt-recall`) in the hook itself and prints what they found as one `additionalContext`; writes the run's begin to the session's run state and hands the prompt's recording scripts (`loom-run`, `loom-namespace-health`'s audit) to a detached process and exits, as after a tool call. | +| `PostToolUse`, `PostToolUseFailure`, `PreCompact`, `Stop`, `SessionEnd` | `loom-record.mjs` | The event's one process. Runs the scripts whose answer the session waits for in the hook itself, each for the tools its row below names and only where the [mode](#modes) runs its plane: after a tool call `loom-file-context`, `loom-mentor-hint`, `loom-blast-radius`, `loom-test-gate` (only after a shell command that may have written a file) and `loom-test-report` (only after one that starts a test runner), at `Stop` the gates the install runs. It prints their answers as one, each script's text on a line of its own: a file's memory and then its test line as one `additionalContext`, the gates' reasons as one block. Runs the event's recording scripts (`loom-capture`, `loom-conversation`, `loom-usage`, `loom-working-memory`, `loom-run`'s close, `loom-session-memory`, `loom-session-brief`) in one process. After a tool call `loom-capture` records something of, at `Stop` and at `SessionEnd` that process is detached, so the session does not wait for their requests and the client, which ends a SessionEnd hook after 1.5 s, cannot cancel them. Before a compaction it is the hook itself, which exits when they have returned: the compaction's primer reads the note they write. | +| `PostToolUse` | `loom-capture.mjs` | Records one episodic observation of the tool action (heuristic type, file list). | +| `PostToolUseFailure` | `loom-capture.mjs` | Same, typed `error` — the bug-triage signal (errors + the subsequent fix). | +| `SessionStart` | `loom-session-start.mjs` | **First session, no credential:** signs this machine up (see `LOOM_AUTO_SIGNUP`) and points the user to the claim page for the namespace; nothing to paste. Then: injects a token-budgeted context primer via `context.pack`: the project's working-memory note, the profile, the session's memory stack and a few memories. In a new or cleared conversation whose prompts get the recall (`loom-prompt-recall.mjs`, which this plugin and Codex's wire, where it is on) the primer runs no memory search: the memories are the namespace's pinned rows and then its newest, five at most, and the recall searches with the prompt. Any other row arrives only when a prompt's recall finds it: a session whose recall abstains gets none. A resumed or compacted session, a session with `LOOM_PROMPT_RECALL=off` or `LOOM_PROMPT_CONTEXT=off` and a hand-wired client get the memories, decisions and procedures a search for the project finds instead. Beside it, one line names the checkout's code namespace and the repository's memory tag, or says why no index is read: no checkout, no remote, no answer, a repository this Loom does not index, one the session's principal is not a reader of, or one whose namespace the token does not name; an index still being built says so too. A new session whose MCP connection carries the checkout is told neither: the header helper sent the namespace, the server applies it to every `loom_code_*` call and adds the tag to a save, and a session with nothing else to hear starts with no text from the hook. How to route a lookup is in the MCP entry's startup instructions on a toolset with a `coding` part; any other toolset, and a wiring whose entry the plugin does not mount (Codex, a hand-wired client), gets it in the primer. **On by default**, once per session; `LOOM_INJECT_CONTEXT=false` to disable. | +| `PostToolUse` (Read / Grep / Bash), `PreCompact` | `loom-file-context.mjs` | Asks `memory.for_file` what loom knows about a file the call read (its files facet) and attaches the rendered block to the read's result, at no model request: the first local read of a file in the checkout — `Read`, a `Grep` of one file, or a shell `cat` / `sed -n` / `head` / `tail` / `grep pattern file` — brings its memory, so a session that only reads, or that edits through the shell, gets it too. One lookup per session, agent context and file (a subagent's read does not use up the main agent's block); a compaction clears what was shown. A record the session already holds, given whole with the prompt or printed with the same line in another file's block, is left out, and a block with nothing new is not attached; a team rule, a decision and a constraint are printed under every file they name. A file with no memory adds nothing. Reads ask about at most three files per call and 40 per session, give the request 1 s and the call 2 s in all, and stop asking after three unanswered lookups. Where the mode runs the code index, a read or an edit that asks first renews a repository lookup that is ten minutes old, which brings the repository's shared rules; a read that this takes past its 2 s leaves the file for its next read or its edit. | +| `PreToolUse` (Edit / Write / MultiEdit / NotebookEdit) | `loom-file-context.mjs` | Before an edit of a file this agent context has not been shown, the same lookup and block — a constraint arrives **before** the edit, not as a review comment. A file shown more than 30 min ago is asked about again, and a record handed more than 30 min ago is printed again; a team rule, a decision and a constraint are printed with every block. Never a permission decision. `LOOM_FILE_CONTEXT=off` disables. | +| `PostToolUse` (loom tools) | `loom-mentor-hint.mjs` | **The store's advice reaches the model**: a loom tool result may carry one `hint` — the plane this agent is not using, named from the call it just made (a `memory.get` that missed, a search that abstained where the code index answers, a stack trace written as a memory, a duplicate write). The hook lifts it out of the result JSON into additional context, once per code per session. No request of its own. `LOOM_MENTOR_HINTS=off` disables. | +| `PostToolUse` (Edit / Write / MultiEdit) | `loom-blast-radius.mjs` | In a loom-indexed repo, diffs the edited file against HEAD and asks `code.impact` (depth 1) what the touched symbols reach. Injects **one line**: callers, tests reaching the change, and the co-change partner files this session has not touched — the sibling-file miss, surfaced while the edit is still open. Same touched set reported once per session. The first edit of a file in a session also carries the test gate's line (next row), which stands in for the radius's count of tests where it names the file's test, so an edit gets one line. `LOOM_BLAST_RADIUS=off` disables the radius. | +| `PostToolUse` (Bash / PowerShell) | `loom-test-gate.mjs` | **A changed file's own test is named when the file changes.** After a shell command in a loom-indexed repo, asks `code.test_gate` about each file the command changed (a dirty path it names, written since the session began) and, for a file that has a test of its own, attaches its command and what the index knows of it: `Loom test for src/router.py: .venv/bin/python -m pytest -q -rf tests/test_router.py`, then `It is the one test file named for that file.` and what the checkout proves of the command. Once per file and once per test per session, on the tool result, so it costs no model request; an edit tool's call gets the same line from `loom-blast-radius.mjs`. A file with no such test, a runner the checkout does not configure, a comment-only change and a prompt that ruled a test run out get nothing, and a command that only reads (`grep`, `cat`, `sed -n`, `git diff`) starts no git process and asks nothing (**Tests at edit time**, below). `LOOM_TEST_GATE=off` disables; `LOOM_TEST_GATE_DEPTH` sets the hops (1–3). | +| `PostToolUse`, `PostToolUseFailure` (Bash) | `loom-test-report.mjs` | **Why a test failed, on the run whose output was cut.** In a checkout that configures pytest, SessionStart adds its result-file option to `PYTEST_ADDOPTS` for the session's shell commands, so every pytest run writes a private result file. After a test command whose visible output names no failure's reason (`pytest ... \| tail -3`), the hook adds a digest of that file to the tool result: the totals, up to three groups of failures by message, each with its first test and where it was raised; at most 700 characters. No request and nothing stored (**The test report**, below). `LOOM_TEST_REPORT=off` disables. | +| `UserPromptSubmit` | `loom-prompt-recall.mjs` | **Default `first`**: one bounded recall on the first qualifying prompt of a session, including empty or abstaining answers. Clear named code-only questions skip default recall without consuming the attempt; mixed memory requests still qualify. `LOOM_PROMPT_RECALL=on` (or the install option `prompt_recall`) for every prompt, `off` to disable; `LOOM_PROMPT_CONTEXT=off` disables it too ([what a prompt gets](#what-a-prompt-gets)). One `context.pack` per prompt restricted to `memories`, `decisions`, `procedures` with the prompt as the query; injects the records the session has not seen (each plane's under its tag; memories that answer alone under none), only when memory is not abstaining and `retrieval_confidence ≥ 0.5`, whole records within 1,600 chars (`LOOM_PROMPT_RECALL_MAX_CHARS`; one that does not fit is left out; a block's only record that the pack cut, or the first when none fits, is cut at its last whole sentence and names the call that reads it whole, the one the server's mark on the line names, or else the key to read it whole by). A record of code as it was before a commit the checkout's `HEAD` already has is left out, and a fix record whose commit it has is added as one line that names the commit. A record linked to a file of the checkout is added as one line, its key and that file, unless the prompt names the file or the definition, or asks memory: `loom-file-context` adds the record's own line after a local read of the file or before an edit of it. With `LOOM_FILE_CONTEXT=off`, or outside a checkout of a repository this Loom indexes, the prompt gets the record whole. The memory-side sibling of the prompt pack: active retrieval — the model gets what memory knows about the prompt without asking — done per prompt, never per tool turn. | +| `UserPromptSubmit` | `loom-prompt-pack.mjs` | Runs where the Loom the session talks to holds the checkout's own repository in its code index (`LOOM_PROMPT_PACK=off` stops it; [what a prompt gets](#what-a-prompt-gets)). One bounded lookup: `code.symbol`, `code.callers` or `code.impact` for an explicit named question, otherwise `code.search` (top 3, no bodies). The repository lookup and the answer share one bound (`LOOM_PROMPT_PACK_TIMEOUT_MS`, 2.5 s; a searched bug report asks for the server's pick and has 6 s): what comes later is skipped. Self-contained requests, local-only changes and explicit memory questions skip code retrieval. Search emits only where the index labels its own answer low-risk or the server's pick worded it `high` or `medium` (with `LOOM_PROMPT_PACK_MIN_CONF` set, from that confidence instead), without abstention, and sends 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; its pointers are candidates, and nothing tells the model to stop searching; typed answers preserve ambiguity and static-analysis limits. Named implementation or behavior questions request a whole definition body within 600 server-budget tokens; location/signature requests stay pointer-only and oversized bodies stay elided. No fallback request follows an empty typed answer. Pointers are deduplicated within the current answer, so later prompts can receive changed evidence. Below the pointers of a search answer goes the test gate's line (**Tests at edit time**, below) when a pointer's definition is named in the prompt and its Python file has exactly one test file named after it, in a checkout that configures pytest; it adds no request and a session gets a test once. | +| `Stop` | `loom-test-gate.mjs` | **Off by default; with the `stop_test_gate` option (or `LOOM_TEST_GATE=stop`), holds a session that ran no test since its last code change.** A held stop costs the session at least one more model request, so it is yours to turn on. Then, with uncommitted changes **this session made** in a loom-indexed repo (the dirty paths the transcript shows an edit tool targeted or a shell command named, written since the session began, by the file's modification time; a tree left dirty before the session gates nothing, even when a command reads or runs its files), asks `code.test_gate` what the change obliges — the tests to run, in evidence order with a `run` command when the harness is derivable, and the touched definitions a coverage run measured unexecuted — and blocks the stop **once** per distinct change with a reason that names them. The second stop on the same change passes. Any test run since the last code change lets the stop pass, and nothing is asked (**Stops that pass**, below); with `LOOM_TEST_GATE=block` only a run of the named tests does (**Answered stops**, below). `LOOM_TEST_GATE=off` disables the gate at both events. | +| `Stop` | `loom-validate-gate.mjs` | **Compile green before done**: collects the memory keys this session wrote from the transcript, asks `namespace.validate` for a report scoped to exactly those keys, and blocks the stop **once** per distinct key set with the error and warning findings that name them (a conflict you opened, a fact whose `valid_to` has passed, an attestation your edit made stale) and each check's remedy. `info` findings never block; the second stop on the same keys passes. `LOOM_VALIDATE_GATE=off` disables. | +| `Stop` | `loom-namespace-health.mjs` | **The store tells you when the namespace is misused**: once per session, one `namespace.audit` over the last day (no samples) for the session's namespace, asked by the first prompt's detached process so that a stop does not wait for it (a stop asks in place only when that process died before its answer); when it carries a critical finding — exact-key reads dwarfing searches, double-encoded values, rows the embedder gave up on, leases in the memory plane — you get **one line** naming the codes and `/loom-optimize`, once per session, at the first stop that finds the verdict, as a block-once reason (the one channel a Stop hook has to the model). Healthy namespace, no token, slow or down server: nothing. The same summary rides `context.pack` as the `namespace_health` section at session start. `LOOM_NAMESPACE_HEALTH=off` disables. | +| `Stop` | `loom-usage.mjs` | Posts the session's own model usage (input, cache read, cache creation by TTL, output; deduped by message id, sidechains skipped) to `cost.record_turns`; the **server** prices it into `loom.agent_turn_usage` from the same table it prices its own upstream spend with. Turns "did loom make this session cheaper" into a standing series instead of a hand-run paired experiment. Needs a writer token. `LOOM_USAGE=off` disables. | +| `UserPromptSubmit` | `loom-run.mjs` | Opens the session's **run** on the first prompt (`run.begin`: goal = the prompt, `run_id = cc-`, or the id `run.begin` answers instead; the prompt does not wait for that answer, so the SessionStart primer, the prompt's recall and a first tool observation keep the derived id, or on a resumed session the previous run's id). Later prompts are no-ops once a begin was answered or refused; after a timeout, a 408, 429 or 5xx the next prompt asks again with the same id, and SessionEnd closes it if no answer ever came. Until then the session's run-state file in the temp directory (readable by you only) holds that begin's body, which every retry re-sends: the prompt, redacted and cut to 8000 characters. One row per session in `loom.agent_runs`; every observation the capture hook records carries the same `run_id`, so `run.get` replays the session — goal, observations, memories written, cost. `LOOM_RUN_LEDGER=off` disables. | +| `SessionEnd` | `loom-run.mjs` | Closes the run (`run.complete`) with the transcript's last assistant text as `final_response` and `outcome: none` — the hook knows the run ended, not whether it succeeded, and never guesses which memories were used; that stays the agent's own `run.complete` call (`memories_used`, `reflection`). | +| `PreCompact` | `loom-capture.mjs` | Crystallizes the session before the context window is dropped. | +| `Stop`, `PreCompact` | `loom-working-memory.mjs` | Writes the session's **working-memory note** — one `working_memory.set` per project (`session:`, agent scope): the goal (first prompt), `git status --short --branch`, the files edited this session, the last reply — framed as a bookmark, not a source of facts (the next session's model answered a fact question from this line without searching). Deduped on content, so an unchanged turn writes nothing. `context.pack` loads working memory first in the SessionStart primer and Claude Code fires SessionStart again after a compaction, so the note written a moment before the drop is the first thing the agent reads after it. A new or cleared conversation whose checkout is on another branch than the note names gets its primer without the note. Not retrieval memory: never embedded or ranked. `LOOM_WORKING_MEMORY=off` disables. With `LOOM_PLUGIN_SCRATCHPAD=1` the Stop hook also appends the turn's one-line conclusion to the run's `scratchpad` block at run scope. | +| `Stop` / `SessionEnd` | `loom-capture.mjs` | Crystallizes the finished session. | +| `PreCompact`, `SessionEnd` | `loom-session-brief.mjs` | Revises the branch's **session brief**: the transcript since the last save becomes typed events (asks, replies, edits, commands with their descriptions, errors, reads, todo lists, PR/commit identifiers a command printed; zero model tokens) posted to `session.brief_save`, which condenses them under a budget and revises `auto//` — goal, status, next steps, decisions and why, what was tried and dropped, what was done, open questions, files, the rules you set, pointers. The `loom-session` skill restores one on request: you pick which (a number from `list`, a key, or a session) and restores it with the client's compaction summary (or `--transcript` for every recorded turn as well). Not retrieval memory: never embedded or ranked. Detached flusher; per-session cursor; a first save needs an ask and some work behind it. `LOOM_SESSION_BRIEF=off` disables. | +| `SessionEnd` | `loom-session-memory.mjs` | Hands the session's real turns (last 200, bounded) to `memory.set_from_messages(defer=true)` once, so loom extracts the facts, writes the **session summary**, judges the outcome and distils reflections. The turns are kept as the facts' source evidence. The body also names the files the session changed in its checkout (each path and the time it was last written, never its content), which decide the session's fix record whatever tool wrote them, and `HEAD` as the commit that holds them, when its history has a commit of the session's that touches every file its edit tool wrote (the tag `change:`). A session with under 40 bytes (UTF-8) of user and assistant text is not sent, because the extraction call's fixed prompt outweighs what it can yield: a rule stated in it is not extracted, and it gets no session summary, outcome judgement or reflections. `LOOM_SESSION_MEMORY=off` disables. | +| `Stop` / `SessionEnd` | `loom-conversation.mjs` | Appends new chat turns from the transcript to the conversation plane (→ the dashboard's Conversations page). Deterministic, every turn; per-session cursor + `msg_id`=transcript uuid dedup. Text blocks only — an image the user pasted becomes a `[image: ]` placeholder beside its text, and a tool result that returned images leaves one `tool` turn `[image: N image results returned by a tool]`; the bytes never leave the machine. Off-switch: `LOOM_CAPTURE_CONVERSATIONS=false`. | **Team file rules.** The file-context hook names two places in one `memory.for_file` request: your own namespace, and the repository's **primary code namespace** (its trunk branch's — `code-clickhouse` for every ClickHouse branch), named by the checkout's cached `code.repos` entry. A namespace you cannot read is skipped silently, so access follows repository access. On a server whose default scope is `all_mine`, the request of a checkout with a remote is also answered with the rows you wrote in your other namespaces; such a row reads ` (namespace ""): …`. Rules from the code namespace render as `Team rule (by alice, 3 days ago) [constraint]: … [id: ]` and design decisions (typed or tagged `decision`) as `Decision (by alice, 3 days ago) (pinned): … — source: [id: ]` (`(pinned)` only when someone pinned it, else no mark; `(source changed)` once its source document no longer says it), a newer rule the conflict check linked to an older one sits above it (`supersedes rule by …`, or `supersedes decision by …`), and one footer line says how to remove a wrong one. Every member of the repository may add a rule there (`memory.set` with `files` and the tag `constraint`) and revise or delete the rules they wrote; a maintainer may delete any — from an agent (`memory.delete` on the `[id:]` key) or from the dashboard (pick the code namespace under _show system_, open the memory, Delete). A refused delete answers a `hint` naming the author and what to do instead. `memory.set` fills `files` from the value when you do not pass it. Auto-extracted session facts never go to the code namespace. @@ -565,6 +565,8 @@ them; a named question asks for no pick and keeps the 2.5 s bound, whatever it r model says one word for how sure it is. On `high` (it is confident of its first pick) or `medium` (one of its picks probably is the place) at most three of its picks are sent, and none when the first is no place to edit: one rule for both words, by choice. +Such an answer is sent whatever risk the index labels it: the label bands the scores +of the search, which ran before the pick model read the candidates. On `low` none is sent, and a reply with no word is sent as any other prompt's (a server that sets no `LOOM_CODE_SEARCH_PICK_MODEL`, a pick the server skipped, cut at the request's deadline or lost, a pick call its inference gateway refused for the caller). diff --git a/integrations/claude-code-plugin/hooks/HOOKS.md b/integrations/claude-code-plugin/hooks/HOOKS.md index 3e8cfbe8ce..379c2ab0bf 100644 --- a/integrations/claude-code-plugin/hooks/HOOKS.md +++ b/integrations/claude-code-plugin/hooks/HOOKS.md @@ -842,7 +842,8 @@ in. only when the index is not abstaining and labels its own answer low-risk (`retrieval_risk`, banded by the deployment's settings); with `LOOM_PROMPT_PACK_MIN_CONF` set, when retrieval_confidence is at least that - value instead. The search reads the request as one line, cut at 2,000 + value instead. An answer the pick model worded `high` or `medium` + (**The listwise pick**, below) is not held to the label. The search reads the request as one line, cut at 2,000 characters. A request that holds three or more Markdown heading lines (`#` to `######`, then text) outside fenced blocks is a filled-in form, and the search reads it without those lines and without the `_No response_` lines @@ -931,8 +932,9 @@ in. answer that holds only other places is sent. A search with no semantic leg (a server with no embedding model, a vector leg that failed or missed its deadline) reads `medium` at - confidence 0.5 and sends no pointers; `LOOM_PROMPT_PACK_MIN_CONF=0.5` sends - them there too. The pointers are candidates: the text never tells the + confidence 0.5 and sends no pointers but those of an answer the pick worded + `high` or `medium`; `LOOM_PROMPT_PACK_MIN_CONF=0.5` sends + them there for every answer. The pointers are candidates: the text never tells the model to stop searching. The repository lookup and the answer share one bound (`LOOM_PROMPT_PACK_TIMEOUT_MS`, 2,500 ms; for a bug report `LOOM_PROMPT_PACK_PICK_TIMEOUT_MS`, **The listwise pick** below): when the @@ -964,13 +966,19 @@ in. model (`LOOM_CODE_SEARCH_PICK_MODEL`) one call of it reads the request against one line for each of the first 100 ranked units and puts the definitions it would change first, with one word for how sure it is - (`pick_confidence`). The hook reads that word, under the conditions above. + (`pick_confidence`). The hook reads that word. `high` (the first pick is a definition the fix changes) or `medium` (one of the picks probably is): at most 3 of those pointers are sent, and none when the first is no place to edit. `medium` does not say that much of its - first pick; both words are held to the one rule by choice. `low` + first pick; both words are held to the one rule by choice. Such an answer + is sent at any `retrieval_risk`: the risk bands the scores of the search, + which ran before any model read the candidates, and the pick model read + them against the request, so its word is the later reading. An answer that + abstains is not sent, and with `LOOM_PROMPT_PACK_MIN_CONF` set that + confidence is a floor under a picked answer as under any other. `low` (probably none is): none is sent, the ranking the pick replaced included. - No word: the answer is sent as any other request's. A server with no pick + No word, which is any other value of the field: the answer is sent as any + other request's, where the index labels it low-risk. A server with no pick model says none and answers with its ranking in the search's own time; so does one whose call failed, one whose inference gateway refused the call for the caller, and one that skipped the call or cut it at the request's @@ -997,9 +1005,10 @@ in. failed or the server's inference gateway refused it, the server skipped it or cut it at the request's deadline, or the server sends none. The server makes the call for a `high` reply at a medium or high - `retrieval_risk` too, as it makes the pick: a reply the gate above drops - for that risk (with no `LOOM_PROMPT_PACK_MIN_CONF` set) has waited for - both calls and prints nothing. A reply that abstains gets no call, and + `retrieval_risk` too, as it makes the pick, and the hook prints the + sentence under that reply's pointers. With `LOOM_PROMPT_PACK_MIN_CONF` + set, a reply under that confidence has waited for both calls and prints + nothing. A reply that abstains gets no call, and the hook prints nothing for it under either gate. When the call runs the prompt waits for it too, the time of one more model call that reads at most 6,000 characters of the request and 9,000 diff --git a/integrations/claude-code-plugin/hooks/loom-prompt-pack.mjs b/integrations/claude-code-plugin/hooks/loom-prompt-pack.mjs index 8f39f9fc8f..206a85b2cf 100644 --- a/integrations/claude-code-plugin/hooks/loom-prompt-pack.mjs +++ b/integrations/claude-code-plugin/hooks/loom-prompt-pack.mjs @@ -49,7 +49,8 @@ // deadline, so a pick that would run late is skipped or cut and the ranking // comes back without it. The model says one word, which decides what is sent // (`pointerBlock` in lib/prompt-pack.mjs). `high` or `medium`: at most 3 of its -// picks, and none when the first is no place to edit. `low`: none. No word (no +// picks, whatever risk the index labels the answer, and none when the first is +// no place to edit. `low`: none. No word (no // pick model, a pick skipped, cut or failed, a pick call the server's inference // gateway refused for the caller): the answer as any other prompt's. Under the // picks of a `high` answer goes the server's one sentence on the cause, when it @@ -59,8 +60,9 @@ // LOOM_PROMPT_PACK=auto|on|off as above; unset, auto // LOOM_PROMPT_PACK_MIN_CONF=0.7 skip below this retrieval_confidence; unset, skip // unless the index labels its answer low-risk (from -// 0.7 by default). A search with no semantic leg -// reads 0.5: 0.5 or lower sends its pointers too +// 0.7 by default) or the pick model worded it high +// or medium. A search with no semantic leg reads +// 0.5: 0.5 or lower sends its pointers too // LOOM_PROMPT_PACK_TOP_K=3 pointers per prompt // LOOM_PROMPT_PACK_TIMEOUT_MS=2500 the bound of a prompt that asks for no pick (one // that does not read as a bug report, and a named @@ -116,7 +118,7 @@ const POINTERS = planeEnabled("code") ? promptPointersMode() : "off"; // The user's prompt waits on this lookup; pointers that arrive later help no one. The // bound of a prompt that asks for no pick: its repository lookup, answer and test line. const TIMEOUT_MS = Math.round(envNumber("LOOM_PROMPT_PACK_TIMEOUT_MS", 2500, { min: 200 })); -// Unset, the gate is the index's own low-risk label. +// Unset, the gate is the index's own low-risk label, which a picked answer is not held to. const MIN_CONF = envNumber("LOOM_PROMPT_PACK_MIN_CONF", null, { min: 0, max: 1 }); const TOP_K = Math.round(envNumber("LOOM_PROMPT_PACK_TOP_K", 3, { min: 1, max: 5 })); // A prompt the listwise pick is asked for waits for the server's model call: its bound diff --git a/integrations/claude-code-plugin/lib/agent-instructions.mjs b/integrations/claude-code-plugin/lib/agent-instructions.mjs index eb0a4ed283..76932c5f55 100644 --- a/integrations/claude-code-plugin/lib/agent-instructions.mjs +++ b/integrations/claude-code-plugin/lib/agent-instructions.mjs @@ -20,7 +20,8 @@ // names the search. A named definition, callers or impact question is one: // its answer opens with a line of its own. So is a prompt the hook sends // nothing for: among others a self-contained request, a local-only change, a -// memory question and a search answer the index does not rate low-risk, and +// memory question and a search answer the index does not rate low-risk and +// no pick worded high or medium, and // every prompt of a session with `prompt_context` off unless what started it // put the pointers in the prompt. Nothing the hook sends names the read of // several definitions. Only the tool listing names it, which an agent rarely diff --git a/integrations/claude-code-plugin/lib/prompt-pack.mjs b/integrations/claude-code-plugin/lib/prompt-pack.mjs index 7a162da033..9f3abb2d10 100644 --- a/integrations/claude-code-plugin/lib/prompt-pack.mjs +++ b/integrations/claude-code-plugin/lib/prompt-pack.mjs @@ -394,11 +394,18 @@ export const pickDeadline = (left) => * among the first three for about two prompts in three. A search with no * semantic leg (no embedding model, a failed leg) reads medium. The model * re-reads the pointers on every later request, so a medium or high risk - * sends none. */ -export function accept(res, minConfidence = null) { + * sends none. + * + * A `picked` answer (the pick model said `high` or `medium` of it) is not + * held to the label. The label bands the scores of the search, which ran + * before any model read the candidates; the pick model read them against + * the prompt, so its word is the later reading and the one that has seen + * more. An abstention and a `minConfidence` the caller names hold for a + * picked answer as for any other. */ +export function accept(res, minConfidence = null, picked = false) { if (!res || res.abstain) return false; if (!Array.isArray(res.results) || !res.results.length) return false; - if (minConfidence === null) return res.retrieval_risk === "low"; + if (minConfidence === null) return picked || res.retrieval_risk === "low"; return Number(res.retrieval_confidence || 0) >= minConfidence; } @@ -707,9 +714,10 @@ export function renderPack(res, { cap = 3, header, cause = "" } = {}) { * The pick model's word (`pick_confidence`) says how the answer is read. * `high` (it is confident of its first pick) or `medium` (one of its picks * probably is the place): the model chose the results, and at most `PICK_CAP` - * are sent under the picked rules of `places`. `low` (probably none of its - * picks is the place): none is sent. No word: the answer as served, under - * the plain rules. That is an answer no pick was asked for, a deployment + * are sent under the picked rules of `places`, whatever the index's risk + * label says (`accept`). `low` (probably none of its picks is the place): + * none is sent. No word, which is any other value: the answer as served, + * under the plain rules. That is an answer no pick was asked for, a deployment * with no pick model, a call the server skipped, cut at the request's * deadline or lost, a call its inference gateway refused for the caller, and * a page whose first unit is not the pick's first (the server clears the word @@ -728,7 +736,9 @@ export function pointerBlock(body, res, prompt, { topK = 3, minConfidence = null const picked = word === "high" || word === "medium"; const cap = picked ? Math.min(topK, PICK_CAP) : topK; const pointers = - accept(res, minConfidence) && word !== "low" ? places(res, { query: body.query, text: prompt, cap, picked }) : []; + accept(res, minConfidence, picked) && word !== "low" + ? places(res, { query: body.query, text: prompt, cap, picked }) + : []; const said = word === "high" && typeof res.pick_cause === "string" ? oneLine(res.pick_cause) : ""; const cause = [...said].length <= CAUSE_MAX_CHARS ? said : ""; return { pointers, text: renderPack({ results: pointers }, { cap: pointers.length, cause }).text }; diff --git a/integrations/codex-plugin/.codex-plugin/plugin.json b/integrations/codex-plugin/.codex-plugin/plugin.json index c23952753b..430a254889 100644 --- a/integrations/codex-plugin/.codex-plugin/plugin.json +++ b/integrations/codex-plugin/.codex-plugin/plugin.json @@ -1,6 +1,6 @@ { "name": "loom", - "version": "1.2.178", + "version": "1.2.181", "description": "Shared long-term memory and code intelligence for Codex, 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" diff --git a/integrations/codex-plugin/hooks/loom-prompt-pack.mjs b/integrations/codex-plugin/hooks/loom-prompt-pack.mjs index 8f39f9fc8f..206a85b2cf 100644 --- a/integrations/codex-plugin/hooks/loom-prompt-pack.mjs +++ b/integrations/codex-plugin/hooks/loom-prompt-pack.mjs @@ -49,7 +49,8 @@ // deadline, so a pick that would run late is skipped or cut and the ranking // comes back without it. The model says one word, which decides what is sent // (`pointerBlock` in lib/prompt-pack.mjs). `high` or `medium`: at most 3 of its -// picks, and none when the first is no place to edit. `low`: none. No word (no +// picks, whatever risk the index labels the answer, and none when the first is +// no place to edit. `low`: none. No word (no // pick model, a pick skipped, cut or failed, a pick call the server's inference // gateway refused for the caller): the answer as any other prompt's. Under the // picks of a `high` answer goes the server's one sentence on the cause, when it @@ -59,8 +60,9 @@ // LOOM_PROMPT_PACK=auto|on|off as above; unset, auto // LOOM_PROMPT_PACK_MIN_CONF=0.7 skip below this retrieval_confidence; unset, skip // unless the index labels its answer low-risk (from -// 0.7 by default). A search with no semantic leg -// reads 0.5: 0.5 or lower sends its pointers too +// 0.7 by default) or the pick model worded it high +// or medium. A search with no semantic leg reads +// 0.5: 0.5 or lower sends its pointers too // LOOM_PROMPT_PACK_TOP_K=3 pointers per prompt // LOOM_PROMPT_PACK_TIMEOUT_MS=2500 the bound of a prompt that asks for no pick (one // that does not read as a bug report, and a named @@ -116,7 +118,7 @@ const POINTERS = planeEnabled("code") ? promptPointersMode() : "off"; // The user's prompt waits on this lookup; pointers that arrive later help no one. The // bound of a prompt that asks for no pick: its repository lookup, answer and test line. const TIMEOUT_MS = Math.round(envNumber("LOOM_PROMPT_PACK_TIMEOUT_MS", 2500, { min: 200 })); -// Unset, the gate is the index's own low-risk label. +// Unset, the gate is the index's own low-risk label, which a picked answer is not held to. const MIN_CONF = envNumber("LOOM_PROMPT_PACK_MIN_CONF", null, { min: 0, max: 1 }); const TOP_K = Math.round(envNumber("LOOM_PROMPT_PACK_TOP_K", 3, { min: 1, max: 5 })); // A prompt the listwise pick is asked for waits for the server's model call: its bound diff --git a/integrations/codex-plugin/lib/agent-instructions.mjs b/integrations/codex-plugin/lib/agent-instructions.mjs index eb0a4ed283..76932c5f55 100644 --- a/integrations/codex-plugin/lib/agent-instructions.mjs +++ b/integrations/codex-plugin/lib/agent-instructions.mjs @@ -20,7 +20,8 @@ // names the search. A named definition, callers or impact question is one: // its answer opens with a line of its own. So is a prompt the hook sends // nothing for: among others a self-contained request, a local-only change, a -// memory question and a search answer the index does not rate low-risk, and +// memory question and a search answer the index does not rate low-risk and +// no pick worded high or medium, and // every prompt of a session with `prompt_context` off unless what started it // put the pointers in the prompt. Nothing the hook sends names the read of // several definitions. Only the tool listing names it, which an agent rarely diff --git a/integrations/codex-plugin/lib/prompt-pack.mjs b/integrations/codex-plugin/lib/prompt-pack.mjs index 7a162da033..9f3abb2d10 100644 --- a/integrations/codex-plugin/lib/prompt-pack.mjs +++ b/integrations/codex-plugin/lib/prompt-pack.mjs @@ -394,11 +394,18 @@ export const pickDeadline = (left) => * among the first three for about two prompts in three. A search with no * semantic leg (no embedding model, a failed leg) reads medium. The model * re-reads the pointers on every later request, so a medium or high risk - * sends none. */ -export function accept(res, minConfidence = null) { + * sends none. + * + * A `picked` answer (the pick model said `high` or `medium` of it) is not + * held to the label. The label bands the scores of the search, which ran + * before any model read the candidates; the pick model read them against + * the prompt, so its word is the later reading and the one that has seen + * more. An abstention and a `minConfidence` the caller names hold for a + * picked answer as for any other. */ +export function accept(res, minConfidence = null, picked = false) { if (!res || res.abstain) return false; if (!Array.isArray(res.results) || !res.results.length) return false; - if (minConfidence === null) return res.retrieval_risk === "low"; + if (minConfidence === null) return picked || res.retrieval_risk === "low"; return Number(res.retrieval_confidence || 0) >= minConfidence; } @@ -707,9 +714,10 @@ export function renderPack(res, { cap = 3, header, cause = "" } = {}) { * The pick model's word (`pick_confidence`) says how the answer is read. * `high` (it is confident of its first pick) or `medium` (one of its picks * probably is the place): the model chose the results, and at most `PICK_CAP` - * are sent under the picked rules of `places`. `low` (probably none of its - * picks is the place): none is sent. No word: the answer as served, under - * the plain rules. That is an answer no pick was asked for, a deployment + * are sent under the picked rules of `places`, whatever the index's risk + * label says (`accept`). `low` (probably none of its picks is the place): + * none is sent. No word, which is any other value: the answer as served, + * under the plain rules. That is an answer no pick was asked for, a deployment * with no pick model, a call the server skipped, cut at the request's * deadline or lost, a call its inference gateway refused for the caller, and * a page whose first unit is not the pick's first (the server clears the word @@ -728,7 +736,9 @@ export function pointerBlock(body, res, prompt, { topK = 3, minConfidence = null const picked = word === "high" || word === "medium"; const cap = picked ? Math.min(topK, PICK_CAP) : topK; const pointers = - accept(res, minConfidence) && word !== "low" ? places(res, { query: body.query, text: prompt, cap, picked }) : []; + accept(res, minConfidence, picked) && word !== "low" + ? places(res, { query: body.query, text: prompt, cap, picked }) + : []; const said = word === "high" && typeof res.pick_cause === "string" ? oneLine(res.pick_cause) : ""; const cause = [...said].length <= CAUSE_MAX_CHARS ? said : ""; return { pointers, text: renderPack({ results: pointers }, { cap: pointers.length, cause }).text }; diff --git a/tests/unit/session_content_senders.json b/tests/unit/session_content_senders.json index 5ff93acde6..ce97bc94fa 100644 --- a/tests/unit/session_content_senders.json +++ b/tests/unit/session_content_senders.json @@ -390,14 +390,14 @@ "integrations/claude-code-plugin/hooks/loom-code-shunt.mjs": "f4f761e9f5ed207c8cf4abd6759c1401f9354cddcae2b9065bda9835d778f04b", "integrations/claude-code-plugin/hooks/loom-flush.mjs": "a7634c8a3115aa98f0d7f5d098469cc3a87af4018fb2737c1a90fd27fc19c6e0", "integrations/claude-code-plugin/hooks/loom-namespace-health.mjs": "5f2bd718a88587c5f66b9823317bc77c18ce6a124f0602368b254d2c8c733ddb", - "integrations/claude-code-plugin/hooks/loom-prompt-pack.mjs": "f9bf11cd98b0ca8ad110fe2db631f7af9ab9ce94ca07ab88a603128f0bdebdc6", + "integrations/claude-code-plugin/hooks/loom-prompt-pack.mjs": "fdad9998f6b3d4749bcc03b5d28218aeb2232ecae0b2d333a31574e318a498b3", "integrations/claude-code-plugin/hooks/loom-session-start.mjs": "31ba0130495c6cbd40a3e4e673d9709deafb0cefb0b655b117d22a2437502b78", "integrations/claude-code-plugin/lib/collections-line.mjs": "4415df00d8af1cbb64f5bc25fa1ba1176433b122c1ae35f809b3981f4439c8c9", "integrations/claude-code-plugin/lib/first-session.mjs": "ea5c41ac14f173aa81c8fefc894d72a6661be66e242d0b614f502a0de98b8646", "integrations/claude-code-plugin/lib/flush-job.mjs": "e6c4ae5e42a54cba0e171b727688be621a81245023bf85a8ac093d334bc9bfd5", "integrations/claude-code-plugin/lib/loom-client.mjs": "33b83b0977c4a39d11bf0e9de44bc6bccd6c2bfef56f1639a26b54e14a6b7f4c", "integrations/claude-code-plugin/lib/namespace-health.mjs": "c8a9aab01f1e996c97643aee7b8f367bf6447f7a6c74dec01a70dc50a0caa182", - "integrations/claude-code-plugin/lib/prompt-pack.mjs": "5a4583c0792984a5d751b9aa02b896913445f80ba4a3860df1d62bf55676b673", + "integrations/claude-code-plugin/lib/prompt-pack.mjs": "82aa64beae214c40afa365855519e4c78b63da04cf13eb9c4d560f808bc6e47b", "integrations/claude-code-plugin/lib/repo-scope.mjs": "1fe69b8ecaf5637dc778fb1c8593336afc74d5029f5487b9419f87bc832dd07c", "integrations/claude-code-plugin/lib/session-brief.mjs": "3aee492198a400ed0fa5fee733b4a4e04463efcc4d0b22ff760e1b765a76e28b", "integrations/claude-code-plugin/lib/session-start.mjs": "60675fae31105740885c3b76a34f50e7d18e31447d792bbea5e7c03fc1b30627", @@ -405,14 +405,14 @@ "integrations/codex-plugin/hooks/loom-code-shunt.mjs": "f4f761e9f5ed207c8cf4abd6759c1401f9354cddcae2b9065bda9835d778f04b", "integrations/codex-plugin/hooks/loom-flush.mjs": "a7634c8a3115aa98f0d7f5d098469cc3a87af4018fb2737c1a90fd27fc19c6e0", "integrations/codex-plugin/hooks/loom-namespace-health.mjs": "5f2bd718a88587c5f66b9823317bc77c18ce6a124f0602368b254d2c8c733ddb", - "integrations/codex-plugin/hooks/loom-prompt-pack.mjs": "f9bf11cd98b0ca8ad110fe2db631f7af9ab9ce94ca07ab88a603128f0bdebdc6", + "integrations/codex-plugin/hooks/loom-prompt-pack.mjs": "fdad9998f6b3d4749bcc03b5d28218aeb2232ecae0b2d333a31574e318a498b3", "integrations/codex-plugin/hooks/loom-session-start.mjs": "31ba0130495c6cbd40a3e4e673d9709deafb0cefb0b655b117d22a2437502b78", "integrations/codex-plugin/lib/collections-line.mjs": "4415df00d8af1cbb64f5bc25fa1ba1176433b122c1ae35f809b3981f4439c8c9", "integrations/codex-plugin/lib/first-session.mjs": "ea5c41ac14f173aa81c8fefc894d72a6661be66e242d0b614f502a0de98b8646", "integrations/codex-plugin/lib/flush-job.mjs": "e6c4ae5e42a54cba0e171b727688be621a81245023bf85a8ac093d334bc9bfd5", "integrations/codex-plugin/lib/loom-client.mjs": "33b83b0977c4a39d11bf0e9de44bc6bccd6c2bfef56f1639a26b54e14a6b7f4c", "integrations/codex-plugin/lib/namespace-health.mjs": "c8a9aab01f1e996c97643aee7b8f367bf6447f7a6c74dec01a70dc50a0caa182", - "integrations/codex-plugin/lib/prompt-pack.mjs": "5a4583c0792984a5d751b9aa02b896913445f80ba4a3860df1d62bf55676b673", + "integrations/codex-plugin/lib/prompt-pack.mjs": "82aa64beae214c40afa365855519e4c78b63da04cf13eb9c4d560f808bc6e47b", "integrations/codex-plugin/lib/repo-scope.mjs": "1fe69b8ecaf5637dc778fb1c8593336afc74d5029f5487b9419f87bc832dd07c", "integrations/codex-plugin/lib/session-brief.mjs": "3aee492198a400ed0fa5fee733b4a4e04463efcc4d0b22ff760e1b765a76e28b", "integrations/codex-plugin/lib/session-start.mjs": "60675fae31105740885c3b76a34f50e7d18e31447d792bbea5e7c03fc1b30627", From 38b70e3a7635f76e10905b02a76b654daa79bdfe Mon Sep 17 00:00:00 2001 From: Lareb Zafar Date: Sat, 5 Dec 2026 02:18:41 +0530 Subject: [PATCH 03/13] The pages, the status line and the setting comment that state the low-risk rule name the pick beside it A bug report's answer the pick worded `high` or `medium` is sent at any risk label, and one it worded `low` is sent under no gate. Seven lines still gave the label, or a named confidence, as the whole rule: - docs/features/integrations/claude-code.md: the paragraph on a search with no semantic leg and an uncalibrated namespace, and the hook table's cell, which listed `LOOM_PROMPT_PACK_MIN_CONF` as a third way in where it replaces the other two. - docs/operations/code-index-operations.md: the calibration step. - hooks/HOOKS.md: `LOOM_PROMPT_PACK_MIN_CONF=0.5` does not send an answer the pick worded `low`; the environment table's unset gate. - lib/pointers-status.mjs: the `pointers` line of the status check, with its pinned test string and the generated Codex copy. - server/settings/catalog.py: the comment on `code_search_low_risk_from`, with the three files generated from it. Signed-off-by: Lareb Zafar Co-Authored-By: Claude Fable 5.2 --- docs/features/integrations/claude-code.md | 65 ++++++++++--------- docs/operations/code-index-operations.md | 6 +- docs/reference/configuration.md | 2 +- .../claude-code-plugin/hooks/HOOKS.md | 4 +- .../lib/pointers-status.mjs | 5 +- .../tests/loom-client-status.test.mjs | 2 +- .../codex-plugin/lib/pointers-status.mjs | 5 +- loom.example.yaml | 3 +- schemas/loom-settings.schema.json | 2 +- server/settings/catalog.py | 4 +- 10 files changed, 55 insertions(+), 43 deletions(-) diff --git a/docs/features/integrations/claude-code.md b/docs/features/integrations/claude-code.md index d2d637c95b..ed29311244 100644 --- a/docs/features/integrations/claude-code.md +++ b/docs/features/integrations/claude-code.md @@ -729,12 +729,13 @@ that reads as a bug report has `LOOM_PROMPT_PACK_PICK_TIMEOUT_MS` (6 s) instead, the first variable says, and a repository lookup that is not cached can end up to 1.5 s past either bound on a slow server ([the pick](#model-picked-pointers-for-a-bug-report)). 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 +reads `medium` (confidence 0.5), so it sends no search pointers but those of an answer +the pick worded `high` or `medium`: 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 for +every indexed-code answer whose confidence is 0.5 or more, such a search's included, but not +for one the pick worded `low`. A code namespace an +administrator has not calibrated can read answerable prompts `medium` or `high` risk, +and then sends only the pointers of an answer the pick worded `high` or `medium` ([`code.calibrate`](../../operations/code-index-operations.md#first-index)). Supply a task inside `...` 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 @@ -1077,32 +1078,32 @@ See [code index overview](../code-index/overview.md) and the 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, profile, the session's memory stack, recent runs with `LOOM_CONTEXT_RUNS`; and the memories, decisions and procedures a search for the project finds or, where a new or cleared conversation's prompts get the recall, the pinned and newest ones, listed), 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 when [the instruction block](#the-instruction-block) needs setup | `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](#what-a-prompt-gets)); otherwise up to three `code.search` pointers for the prompt, only when the index rates its answer low-risk or the pick worded it `high` or `medium` (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](#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; of a record linked to a file of the checkout that the prompt does not name, one line: its key and the file | `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-`, 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](#the-code-shunt)) | `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, without the records the session already holds | `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](#the-test-gate)) | `LOOM_TEST_GATE=off` | -| PostToolUse, PostToolUseFailure (Bash) | `loom-test-report.mjs` | after a test command whose output names no failure's reason, a digest of the result file its pytest run wrote: totals and failures grouped by message; no request ([the test report](#the-test-report)) | `LOOM_TEST_REPORT=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, the test report after a failed call too, 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](#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:`): 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//`) | `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` | +| Event | Script | Effect | Off switch | +| ------------------------------------------------------------- | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------- | +| SessionStart | `loom-session-start.mjs` | one budgeted `context.pack` primer (working-memory note, profile, the session's memory stack, recent runs with `LOOM_CONTEXT_RUNS`; and the memories, decisions and procedures a search for the project finds or, where a new or cleared conversation's prompts get the recall, the pinned and newest ones, listed), 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 when [the instruction block](#the-instruction-block) needs setup | `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](#what-a-prompt-gets)); otherwise up to three `code.search` pointers for the prompt, only when the index rates its answer low-risk or the pick worded it `high` or `medium` (with `LOOM_PROMPT_PACK_MIN_CONF` set, from that confidence instead) 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](#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; of a record linked to a file of the checkout that the prompt does not name, one line: its key and the file | `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-`, 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](#the-code-shunt)) | `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, without the records the session already holds | `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](#the-test-gate)) | `LOOM_TEST_GATE=off` | +| PostToolUse, PostToolUseFailure (Bash) | `loom-test-report.mjs` | after a test command whose output names no failure's reason, a digest of the result file its pytest run wrote: totals and failures grouped by message; no request ([the test report](#the-test-report)) | `LOOM_TEST_REPORT=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, the test report after a failed call too, 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](#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:`): 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//`) | `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 diff --git a/docs/operations/code-index-operations.md b/docs/operations/code-index-operations.md index bb6926585c..0975512e5a 100644 --- a/docs/operations/code-index-operations.md +++ b/docs/operations/code-index-operations.md @@ -403,8 +403,10 @@ Then: without its own calibration (`calibration.get` reads `source: cluster`) reads code on the embedder's boot calibration, which is derived from prose. On an embedding model that scores a right code hit lower than a right prose answer, answerable - searches then read `medium` or `high`, and the coding-agent plugins send no search - pointers for them. + searches then read `medium` or `high`, and the coding-agent plugins send search + pointers there only for a bug report whose answer the pick model words `high` or + `medium` + ([the pick](../features/integrations/claude-code.md#model-picked-pointers-for-a-bug-report)). - `loom code describe --top-pct 20` (optional, LLM cost) writes one-line descriptions for the most central chunks. `--limit N` starts at most N description calls. `--max-usd D` stops before a call that would take the run's spend past D dollars: it counts each diff --git a/docs/reference/configuration.md b/docs/reference/configuration.md index 266815d77d..8606611714 100644 --- a/docs/reference/configuration.md +++ b/docs/reference/configuration.md @@ -710,7 +710,7 @@ The code index's network git (clone, fetch, ls-remote, submodule update) through | `LOOM_CODE_SEARCH_ABSTAIN_CARD_BELOW` | `float` | `0.0` | | A prose question whose nearest file card's cosine is below this abstains `off_domain`; independent of the card leg. 0 = off. | | `LOOM_CODE_SEARCH_ABSTAIN_CONFIDENCE_BELOW` | `float` | `0.35` | | The abstain score below which a code.search result is flagged `low_calibrated_confidence` (still returned). The score is not `retrieval_confidence`: it blends the top cosine, its margin over the second hit, route agreement and the pool size. The deployment sets 0.30. | | `LOOM_CODE_SEARCH_MEDIUM_RISK_FROM` | `float` | `0.35` | | The `retrieval_confidence` from which a code.search result reads `retrieval_risk` "medium"; below it the result reads "high". In the measurement behind the default about half of the prompts sent to another repository's index scored under it. | -| `LOOM_CODE_SEARCH_LOW_RISK_FROM` | `float` | `0.7` | | The `retrieval_confidence` from which a code.search result reads `retrieval_risk` "low": the best cosine is close to that of a confident hit. A prompt about other code usually scores lower, but about one in five sent to another repository's index still read low. The coding-agent plugins send their prompt pointers from it. | +| `LOOM_CODE_SEARCH_LOW_RISK_FROM` | `float` | `0.7` | | The `retrieval_confidence` from which a code.search result reads `retrieval_risk` "low": the best cosine is close to that of a confident hit. A prompt about other code usually scores lower, but about one in five sent to another repository's index still read low. The coding-agent plugins send their prompt pointers from it and, for a bug report, the picks the pick model words `high` or `medium` below it too. | | `LOOM_CODE_SEARCH_HYDE_KINDS` | `str` | `'responsibility'` | | The question kinds the hypothetical answer votes on. | | `LOOM_CODE_SEARCH_HYDE_CAP` | `float` | `1.0` | | Cap on the hypothetical-answer (HyDE) leg's candidate list, as a multiple of the two-leg top (the history rule). | | `LOOM_CODE_SEARCH_HYDE_MAX_TOKENS` | `int` | `220` | | Tokens the hypothetical-answer (HyDE) passage may run to. | diff --git a/integrations/claude-code-plugin/hooks/HOOKS.md b/integrations/claude-code-plugin/hooks/HOOKS.md index 379c2ab0bf..f7a3b3eef5 100644 --- a/integrations/claude-code-plugin/hooks/HOOKS.md +++ b/integrations/claude-code-plugin/hooks/HOOKS.md @@ -934,7 +934,7 @@ in. model, a vector leg that failed or missed its deadline) reads `medium` at confidence 0.5 and sends no pointers but those of an answer the pick worded `high` or `medium`; `LOOM_PROMPT_PACK_MIN_CONF=0.5` sends - them there for every answer. The pointers are candidates: the text never tells the + them there for every answer but one the pick worded `low`. The pointers are candidates: the text never tells the model to stop searching. The repository lookup and the answer share one bound (`LOOM_PROMPT_PACK_TIMEOUT_MS`, 2,500 ms; for a bug report `LOOM_PROMPT_PACK_PICK_TIMEOUT_MS`, **The listwise pick** below): when the @@ -1580,7 +1580,7 @@ Switches read on/true/1/yes and off/false/0/no. Defaults in parentheses. | `LOOM_PROMPT_CONTEXT` (on) | prompt-pack, prompt-recall | off: the plugin adds nothing to a prompt, neither code pointers nor recall | | `LOOM_PROMPT_RECALL` (first) | prompt-recall | first, on or off; a value that names none is off; off leaves the memory search to the primer | | `LOOM_PROMPT_RECALL_MIN_CONF` (0.5), `LOOM_PROMPT_RECALL_TOP_K` (3), `LOOM_PROMPT_RECALL_BUDGET` (600), `LOOM_PROMPT_RECALL_MAX_CHARS` (1600) | prompt-recall | the confidence bar, hits per plane, pack budget, injected cap | -| `LOOM_PROMPT_PACK` (auto), `LOOM_PROMPT_PACK_MIN_CONF` (unset: low-risk), `LOOM_PROMPT_PACK_TOP_K` (3) | prompt-pack | per-prompt code pointers (`auto`, `on`, `off`); their confidence gate and count | +| `LOOM_PROMPT_PACK` (auto), `LOOM_PROMPT_PACK_MIN_CONF` (unset: low-risk, or a pick worded `high` or `medium`), `LOOM_PROMPT_PACK_TOP_K` (3) | prompt-pack | per-prompt code pointers (`auto`, `on`, `off`); their confidence gate and count | | `LOOM_PROMPT_PACK_TIMEOUT_MS` (2500) | prompt-pack | the bound for a prompt that asks for no pick: its repository lookup and its answer, together | | `LOOM_PROMPT_PACK_PICK_TIMEOUT_MS` (6000) | prompt-pack | a searched bug report's bound, in place of the one above: its search asks for the listwise pick | | `LOOM_RUN_LEDGER` (on), `LOOM_PLUGIN_RUN_RETAIN` (server default) | run | the run ledger; keep, demote or expire the run's rows | diff --git a/integrations/claude-code-plugin/lib/pointers-status.mjs b/integrations/claude-code-plugin/lib/pointers-status.mjs index e5a64e3cdc..cb80ff358b 100644 --- a/integrations/claude-code-plugin/lib/pointers-status.mjs +++ b/integrations/claude-code-plugin/lib/pointers-status.mjs @@ -58,7 +58,10 @@ function searchedIn(entry, standing, search) { const stage = stageWords(entry); return ["WARN", `${where}, which is still being indexed${stage ? ` (${stage})` : ""}; ${read}`]; } - return ["PASS", `${where}; ${read}; a prompt gets pointers when its own answer reads low`]; + return [ + "PASS", + `${where}; ${read}; a prompt gets pointers when its own answer reads low, a bug report also when the server's pick words its answer high or medium`, + ]; } /** diff --git a/integrations/claude-code-plugin/tests/loom-client-status.test.mjs b/integrations/claude-code-plugin/tests/loom-client-status.test.mjs index fccd15ef41..f1482941ad 100644 --- a/integrations/claude-code-plugin/tests/loom-client-status.test.mjs +++ b/integrations/claude-code-plugin/tests/loom-client-status.test.mjs @@ -401,7 +401,7 @@ test("pointers: the checkout's own repository in a ready index passes, with one assert.equal(grade, "PASS"); assert.match( detail, - /^prompts here are searched in code-x \(x\/y\); a test search answered in \d+ ms and read low risk; a prompt gets pointers when its own answer reads low$/, + /^prompts here are searched in code-x \(x\/y\); a test search answered in \d+ ms and read low risk; a prompt gets pointers when its own answer reads low, a bug report also when the server's pick words its answer high or medium$/, ); const { search, ...facts } = section; assert.deepEqual(facts, { diff --git a/integrations/codex-plugin/lib/pointers-status.mjs b/integrations/codex-plugin/lib/pointers-status.mjs index e5a64e3cdc..cb80ff358b 100644 --- a/integrations/codex-plugin/lib/pointers-status.mjs +++ b/integrations/codex-plugin/lib/pointers-status.mjs @@ -58,7 +58,10 @@ function searchedIn(entry, standing, search) { const stage = stageWords(entry); return ["WARN", `${where}, which is still being indexed${stage ? ` (${stage})` : ""}; ${read}`]; } - return ["PASS", `${where}; ${read}; a prompt gets pointers when its own answer reads low`]; + return [ + "PASS", + `${where}; ${read}; a prompt gets pointers when its own answer reads low, a bug report also when the server's pick words its answer high or medium`, + ]; } /** diff --git a/loom.example.yaml b/loom.example.yaml index ffb7b922b6..e7cffae960 100644 --- a/loom.example.yaml +++ b/loom.example.yaml @@ -2234,7 +2234,8 @@ settings: # The `retrieval_confidence` from which a code.search result reads `retrieval_risk` # "low": the best cosine is close to that of a confident hit. A prompt about other # code usually scores lower, but about one in five sent to another repository's index - # still read low. The coding-agent plugins send their prompt pointers from it. + # still read low. The coding-agent plugins send their prompt pointers from it and, for + # a bug report, the picks the pick model words `high` or `medium` below it too. # [restart] # code_search_low_risk_from: 0.7 diff --git a/schemas/loom-settings.schema.json b/schemas/loom-settings.schema.json index 483984c3f5..9a6300cef6 100644 --- a/schemas/loom-settings.schema.json +++ b/schemas/loom-settings.schema.json @@ -2246,7 +2246,7 @@ "code_search_low_risk_from": { "default": 0.7, "type": "number", - "description": "The `retrieval_confidence` from which a code.search result reads `retrieval_risk` \"low\": the best cosine is close to that of a confident hit. A prompt about other code usually scores lower, but about one in five sent to another repository's index still read low. The coding-agent plugins send their prompt pointers from it." + "description": "The `retrieval_confidence` from which a code.search result reads `retrieval_risk` \"low\": the best cosine is close to that of a confident hit. A prompt about other code usually scores lower, but about one in five sent to another repository's index still read low. The coding-agent plugins send their prompt pointers from it and, for a bug report, the picks the pick model words `high` or `medium` below it too." }, "code_search_medium_risk_from": { "default": 0.35, diff --git a/server/settings/catalog.py b/server/settings/catalog.py index f5314b8345..0b3c0d040a 100644 --- a/server/settings/catalog.py +++ b/server/settings/catalog.py @@ -1842,7 +1842,9 @@ def _check_git_proxy(self) -> CodeSettings: # The `retrieval_confidence` from which a code.search result reads `retrieval_risk` # "low": the best cosine is close to that of a confident hit. A prompt about other # code usually scores lower, but about one in five sent to another repository's - # index still read low. The coding-agent plugins send their prompt pointers from it. + # index still read low. The coding-agent plugins send their prompt pointers from it + # and, for a bug report, the picks the pick model words `high` or `medium` below it + # too. code_search_low_risk_from: float = 0.70 # The question kinds the hypothetical answer votes on. code_search_hyde_kinds: str = "responsibility" From c57537a8c75605e566ac65fe89e1255d055d3a2b Mon Sep 17 00:00:00 2001 From: Lareb Zafar Date: Sat, 5 Dec 2026 02:39:13 +0530 Subject: [PATCH 04/13] The status bullet names the pick beside the low-risk rule, and a test holds a low pick back at a named confidence The `/loom:loom-status` bullet of the Claude Code page gave the low-risk label as the whole rule for pointers. It now ends as the status line it paraphrases does: a bug report also gets pointers when the server's pick words its answer `high` or `medium`. The hook reference and the page say that a named `LOOM_PROMPT_PACK_MIN_CONF` does not send an answer the pick worded `low`. Every `low` case ran with no confidence named, so nothing held that. One assertion does now. Co-Authored-By: Claude Fable 5.2 Signed-off-by: Lareb Zafar --- docs/features/integrations/claude-code.md | 3 ++- integrations/claude-code-plugin/tests/prompt-pack.test.mjs | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/features/integrations/claude-code.md b/docs/features/integrations/claude-code.md index ed29311244..5db705709a 100644 --- a/docs/features/integrations/claude-code.md +++ b/docs/features/integrations/claude-code.md @@ -1261,7 +1261,8 @@ and set the variable. 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`. + index; a prompt gets pointers when its own answer reads `low`, and a bug report also + when the server's pick words its answer `high` or `medium`. - **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 diff --git a/integrations/claude-code-plugin/tests/prompt-pack.test.mjs b/integrations/claude-code-plugin/tests/prompt-pack.test.mjs index 858eb2ba31..c5eb6a21f2 100644 --- a/integrations/claude-code-plugin/tests/prompt-pack.test.mjs +++ b/integrations/claude-code-plugin/tests/prompt-pack.test.mjs @@ -1037,6 +1037,8 @@ test("a pick worded high or medium is sent whatever the risk label says; low, no assert.deepEqual(sent(answer("high", "medium"), 0.6), []); assert.deepEqual(sent(answer("high", "medium"), 0.5), results.slice(0, 3)); assert.deepEqual(sent(answer("", "medium"), 0.5), results); + // and it does not send an answer the pick worded low + assert.deepEqual(sent(answer("low", "medium"), 0.5), []); }); test("the cause sentence is the last line of a block built from a high pick, and of no other", () => { From b7a67a0f31c7b85ffcc9aff557c7de6508702de3 Mon Sep 17 00:00:00 2001 From: Lareb Zafar Date: Sat, 5 Dec 2026 02:59:46 +0530 Subject: [PATCH 05/13] Tests: past the risk label a picked answer sends its first unit alone The server serves the picks first and the rest of its ranking after them, and the reply does not say how many picks there are. These tests hold a picked answer at a medium or high label to the one unit the reply proves is the model's, and fail on the code as it is. Co-Authored-By: Claude Fable 5.2 Signed-off-by: Lareb Zafar --- .../tests/prompt-pack-hook.test.mjs | 20 +++++++-- .../tests/prompt-pack.test.mjs | 44 ++++++++++++++++--- 2 files changed, 56 insertions(+), 8 deletions(-) diff --git a/integrations/claude-code-plugin/tests/prompt-pack-hook.test.mjs b/integrations/claude-code-plugin/tests/prompt-pack-hook.test.mjs index 86be542f85..28060659ba 100644 --- a/integrations/claude-code-plugin/tests/prompt-pack-hook.test.mjs +++ b/integrations/claude-code-plugin/tests/prompt-pack-hook.test.mjs @@ -738,11 +738,19 @@ test("search pointers follow the index's own risk label unless a confidence is n assert.match((await named.ask(prompt)).out, /src\/parser\.py:10-14/); }); -test("a bug report's picks are sent at a medium or high risk label when the model words them high or medium", async (t) => { +test("a bug report's first pick is sent at a medium or high risk label when the model words the answer high or medium", async (t) => { const report = "The parser crashes on a nested record prefix that ends with a dot"; + const results = [1, 2].map((n) => ({ + path: `src/parser${n}.py`, + start_line: 10, + end_line: 14, + symbol: `combine${n}`, + kind: "function", + })); const reply = (risk, word) => ({ "code.search": { ...REPLIES["code.search"], + results, retrieval_confidence: 0.5, retrieval_risk: risk, ...(word ? { pick_confidence: word } : {}), @@ -750,11 +758,17 @@ test("a bug report's picks are sent at a medium or high risk label when the mode }); const asked = async (risk, word, env) => (await contractFixture(t, reply(risk, word), env)).ask(report); for (const risk of ["medium", "high"]) { - for (const word of ["high", "medium"]) - assert.match(context(await asked(risk, word)), /src\/parser\.py:10-14/, `${word} ${risk}`); + for (const word of ["high", "medium"]) { + const block = context(await asked(risk, word)); + assert.match(block, /src\/parser1\.py:10-14 combine1/, `${word} ${risk}`); + // the reply does not say the second unit is a pick, and the label does not admit it + assert.doesNotMatch(block, /parser2/, `${word} ${risk}`); + } // not sure, and no word (no pick model, a pick skipped, cut or failed): the label gates the answer for (const word of ["low", ""]) assert.deepEqual(await asked(risk, word), SILENT, `${word} ${risk}`); } + // at a low label the answer is sent as before, the units after the first included + assert.match(context(await asked("low", "high")), /src\/parser2\.py:10-14 combine2/); // A confidence the caller names is a floor under every answer, a picked one included. assert.deepEqual(await asked("medium", "high", { LOOM_PROMPT_PACK_MIN_CONF: "0.6" }), SILENT); }); diff --git a/integrations/claude-code-plugin/tests/prompt-pack.test.mjs b/integrations/claude-code-plugin/tests/prompt-pack.test.mjs index c5eb6a21f2..8d22f1ec68 100644 --- a/integrations/claude-code-plugin/tests/prompt-pack.test.mjs +++ b/integrations/claude-code-plugin/tests/prompt-pack.test.mjs @@ -1000,7 +1000,7 @@ test("a picked answer is sent by the model's word: high and medium its first thr assert.deepEqual(sent(null).pointers, []); }); -test("a pick worded high or medium is sent whatever the risk label says; low, no word and an abstention are not", () => { +test("a pick worded high or medium is sent at a medium or high risk label, as its first unit alone; low, no word and an abstention are not", () => { const report = "why does the upload crash on an empty bucket name"; const body = searchBody({ org: "o", namespace: "code-x" }, report, { topK: 4, token: "" }); const results = [1, 2, 3, 4].map((n) => ({ @@ -1021,9 +1021,10 @@ test("a pick worded high or medium is sent whatever the risk label says; low, no const sent = (res, minConfidence = null) => pointerBlock(body, res, report, { topK: 4, minConfidence }).pointers; for (const risk of ["medium", "high"]) { // The label bands the scores of the search, which ran before the pick model read the - // candidates: its word about them is the later reading, and its picks are sent as at low risk. + // candidates: its word about them is the later reading. Past the label only that word + // stands behind the answer, and the reply proves one unit to be the model's: the first. for (const word of ["high", "medium"]) - assert.deepEqual(sent(answer(word, risk)), results.slice(0, 3), `${word} ${risk}`); + assert.deepEqual(sent(answer(word, risk)), results.slice(0, 1), `${word} ${risk}`); // the model says probably none of its picks is the place assert.deepEqual(sent(answer("low", risk)), [], risk); // No word, or a value that is none of the three: no model read the answer, and the label gates it. @@ -1035,12 +1036,43 @@ test("a pick worded high or medium is sent whatever the risk label says; low, no assert.deepEqual(sent({ ...answer("high", "abstain"), abstain: true }), []); // a confidence the caller names is a floor under every answer, a picked one included assert.deepEqual(sent(answer("high", "medium"), 0.6), []); + // an answer the caller's confidence admits is sent as one the label admits: its first three assert.deepEqual(sent(answer("high", "medium"), 0.5), results.slice(0, 3)); assert.deepEqual(sent(answer("", "medium"), 0.5), results); // and it does not send an answer the pick worded low assert.deepEqual(sent(answer("low", "medium"), 0.5), []); }); +test("a picked page can hold units the model did not pick: past the label none of them is sent", () => { + const report = "why does the upload crash on an empty bucket name"; + const body = searchBody({ org: "o", namespace: "code-x" }, report, { topK: 4, token: "" }); + const unit = (name) => ({ path: `src/${name}.py`, start_line: 10, end_line: 14, symbol: name, kind: "function" }); + // The server serves the picks first and the rest of its ranking after them, and the reply + // does not say how many picks there are. Here the model chose one unit. + const pick = unit("chosen"); + const ranking = ["ranked2", "ranked3", "ranked4"].map(unit); + const answer = (word, risk) => ({ + abstain: false, + retrieval_confidence: 0.5, + retrieval_risk: risk, + results: [pick, ...ranking], + pick_confidence: word, + }); + for (const word of ["high", "medium"]) { + for (const risk of ["medium", "high"]) { + const block = pointerBlock(body, answer(word, risk), report, { topK: 4 }); + assert.deepEqual(block.pointers, [pick], `${word} ${risk}`); + assert.doesNotMatch(block.text, /ranked/, `${word} ${risk}`); + } + // Where the label admits the answer, or a confidence the caller names does, the units + // after the first are sent on that gate, as they are with no pick. + const low = pointerBlock(body, answer(word, "low"), report, { topK: 4 }); + assert.deepEqual(low.pointers, [pick, ...ranking.slice(0, 2)], word); + const named = pointerBlock(body, answer(word, "medium"), report, { topK: 4, minConfidence: 0.5 }); + assert.deepEqual(named.pointers, [pick, ...ranking.slice(0, 2)], word); + } +}); + test("the cause sentence is the last line of a block built from a high pick, and of no other", () => { const report = "why does the upload crash on an empty bucket name"; const body = searchBody({ org: "o", namespace: "code-x" }, report, { topK: 4, token: "" }); @@ -1085,8 +1117,10 @@ test("the cause sentence is the last line of a block built from a high pick, and for (const word of ["medium", "", undefined]) assert.equal(text(answer(word, cause)), text(answer(word)), String(word)); assert.equal(text(answer("low", cause)), ""); - // the sentence goes with the block at any risk label: a high pick is sent at a medium one - assert.equal(text({ ...answer("high", cause), retrieval_risk: "medium" }), `${sure}\n${LABEL} ${cause}`); + // the sentence goes with the block of a high pick at a medium label too, under its one pointer + const first = text({ ...answer("high"), retrieval_risk: "medium" }); + assert.equal(first.split("\n").length, 2); + assert.equal(text({ ...answer("high", cause), retrieval_risk: "medium" }), `${first}\n${LABEL} ${cause}`); // no block, no sentence: a first pick that is no place to edit, an answer that abstains const misplaced = [{ ...results[0], path: "app/migrations/0001_initial.py" }, ...results.slice(1)]; assert.equal(text(answer("high", cause, misplaced)), ""); From bf1c9c5c8875ccf77d0a31af5b566678f6097bf2 Mon Sep 17 00:00:00 2001 From: Lareb Zafar Date: Sat, 5 Dec 2026 03:08:23 +0530 Subject: [PATCH 06/13] Past the risk label the prompt hook sends a picked answer's first pick alone The server serves the picks first and the rest of its ranking after them, and the reply carries no pick count. A picked answer at a medium or high label passed as its first three results, so where the model picked fewer than three the others were units it read and did not choose, with neither the label nor the model's word behind them. pointerBlock now caps a picked answer that only the model's word admits at one unit, the one the reply proves a pick: the server clears the word on a page that opens with another unit. Where the low-risk label or a named confidence admits the answer, it sends its first three as before. The comments and pages that said such an answer is sent at any risk now say what is sent there, and name the two labels, so none reads as covering an abstention. The setting comment's three generated outputs, the Codex copy and the source pins are renewed. Co-Authored-By: Claude Fable 5.2 Signed-off-by: Lareb Zafar --- docs/features/integrations/claude-code.md | 31 +++++++++------ docs/guides/issue-code-pointers.md | 3 +- docs/operations/code-index-operations.md | 6 +-- docs/reference/configuration.md | 2 +- integrations/claude-code-plugin/README.md | 5 ++- .../claude-code-plugin/hooks/HOOKS.md | 25 +++++++----- .../hooks/loom-prompt-pack.mjs | 17 ++++---- .../claude-code-plugin/lib/prompt-pack.mjs | 39 ++++++++++++------- .../codex-plugin/hooks/loom-prompt-pack.mjs | 17 ++++---- integrations/codex-plugin/lib/prompt-pack.mjs | 39 ++++++++++++------- loom.example.yaml | 4 +- schemas/loom-settings.schema.json | 2 +- server/settings/catalog.py | 4 +- tests/unit/session_content_senders.json | 8 ++-- 14 files changed, 121 insertions(+), 81 deletions(-) diff --git a/docs/features/integrations/claude-code.md b/docs/features/integrations/claude-code.md index 5db705709a..bf26aa448c 100644 --- a/docs/features/integrations/claude-code.md +++ b/docs/features/integrations/claude-code.md @@ -661,7 +661,8 @@ background command ends (one that opens with ``). Ambiguous o 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. An answer the server's pick -worded `high` or `medium` is not held to the label +worded `high` or `medium` is not held to the label, and sends its first pick alone where +the label is not low ([model-picked pointers](#model-picked-pointers-for-a-bug-report)). 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 @@ -729,13 +730,13 @@ that reads as a bug report has `LOOM_PROMPT_PACK_PICK_TIMEOUT_MS` (6 s) instead, the first variable says, and a repository lookup that is not cached can end up to 1.5 s past either bound on a slow server ([the pick](#model-picked-pointers-for-a-bug-report)). A search with no semantic leg -reads `medium` (confidence 0.5), so it sends no search pointers but those of an answer -the pick worded `high` or `medium`: a server with no embedding model, or a vector leg +reads `medium` (confidence 0.5), so it sends no search pointer but the first pick of an +answer the pick worded `high` or `medium`: 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 for every indexed-code answer whose confidence is 0.5 or more, such a search's included, but not for one the pick worded `low`. A code namespace an administrator has not calibrated can read answerable prompts `medium` or `high` risk, -and then sends only the pointers of an answer the pick worded `high` or `medium` +and then sends only the first pick of an answer the pick worded `high` or `medium` ([`code.calibrate`](../../operations/code-index-operations.md#first-index)). Supply a task inside `...` 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 @@ -1342,11 +1343,11 @@ would change first and says one word for how sure it is ([how the pick ranks](../../architecture/code-index-architecture.md#query-patterns)). The hook reads that word, `pick_confidence`: -| The reply says | The hook sends | -| ---------------- | --------------------------------------------------------------------------------------------------------- | -| `high`, `medium` | at most three of the picks, when the first is a place to edit ([what a prompt gets](#what-a-prompt-gets)) | -| `low` | nothing | -| no word | the answer as any other prompt's | +| The reply says | The hook sends | +| ---------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `high`, `medium` | at most three of the picks, or the first alone at a `medium` or `high` risk, when the first is a place to edit ([what a prompt gets](#what-a-prompt-gets)) | +| `low` | nothing | +| no word | the answer as any other prompt's | `high` says the first pick is a definition the fix changes, `medium` that one of the picks probably is, `low` that probably none is. On `high` or `medium` the first pick @@ -1354,9 +1355,14 @@ decides: when it is no place to edit, the picks below it are not sent in its pla no result below the third is sent. `medium` does not say that much of its first pick; the hook holds both words to one rule by choice. -A `high` or `medium` answer is sent at any `retrieval_risk`. The risk bands the scores +A `high` or `medium` answer is sent at a `medium` or `high` `retrieval_risk` too, as its +first pick alone. The risk bands the scores of the search, which ran before any model read the candidates; the pick model read them -against the prompt, so its word is the later reading. An answer that abstains is not +against the prompt, so its word is the later reading. The reply holds the picks first +and the rest of the search's ranking after them, and does not say how many picks there +are: its first unit is the one it proves a pick, and the units after it are sent only +where the low-risk label, or a set `LOOM_PROMPT_PACK_MIN_CONF` the answer meets, admits +them. An answer that abstains is not sent, and a `LOOM_PROMPT_PACK_MIN_CONF` that is set is a floor under a picked answer as under any other. A reply with no word is sent where the index labels it low-risk. @@ -1375,7 +1381,8 @@ and states in one sentence which definition is at fault and why reads no fix, so the sentence is a candidate to check, as the pointers are, and the line's label tells the session so: a model wrote the sentence and nothing checked it. It can name a definition with no pointer above it: the call reads the reply's picks, and the block -lists only those that pass the place test, one for a range and the ranges inside it. A reply +lists only those that pass the place test, one for a range and the ranges inside it, and +only the first at a `medium` or `high` risk. A reply with no sentence leaves the block as it is: a `medium` answer, a model that could not tell from the code, a call the server skipped, cut or lost, and a server that sends none. The hook prints a sentence of at most 600 characters, the most the server serves, and drops a longer one. diff --git a/docs/guides/issue-code-pointers.md b/docs/guides/issue-code-pointers.md index df49303bfe..a09a6c7167 100644 --- a/docs/guides/issue-code-pointers.md +++ b/docs/guides/issue-code-pointers.md @@ -208,7 +208,8 @@ What the plugins do and the SDKs do not: - **Ask for the pick.** For a prompt that reads as a bug report a plugin's search asks for the listwise pick and sends the answer by the model's word ([the pick](../features/integrations/claude-code.md#model-picked-pointers-for-a-bug-report)). - It sends an answer the model words `high` or `medium` at any `retrieval_risk`. The + At a `medium` or `high` `retrieval_risk` it still sends the first pick of an answer + the model words `high` or `medium`. The SDK method never asks for it, so every answer of its search is held to [the low-risk label](#send-nothing-when-the-index-does-not-stand-behind-its-answer). - **Print the cause sentence.** After a pick the model is confident of, the server's diff --git a/docs/operations/code-index-operations.md b/docs/operations/code-index-operations.md index 0975512e5a..bf85988f42 100644 --- a/docs/operations/code-index-operations.md +++ b/docs/operations/code-index-operations.md @@ -403,9 +403,9 @@ Then: without its own calibration (`calibration.get` reads `source: cluster`) reads code on the embedder's boot calibration, which is derived from prose. On an embedding model that scores a right code hit lower than a right prose answer, answerable - searches then read `medium` or `high`, and the coding-agent plugins send search - pointers there only for a bug report whose answer the pick model words `high` or - `medium` + searches then read `medium` or `high`, and the coding-agent plugins send one search + pointer there, the first pick, only for a bug report whose answer the pick model words + `high` or `medium` ([the pick](../features/integrations/claude-code.md#model-picked-pointers-for-a-bug-report)). - `loom code describe --top-pct 20` (optional, LLM cost) writes one-line descriptions for the most central chunks. `--limit N` starts at most N description calls. `--max-usd D` diff --git a/docs/reference/configuration.md b/docs/reference/configuration.md index 8606611714..64a52f63b4 100644 --- a/docs/reference/configuration.md +++ b/docs/reference/configuration.md @@ -710,7 +710,7 @@ The code index's network git (clone, fetch, ls-remote, submodule update) through | `LOOM_CODE_SEARCH_ABSTAIN_CARD_BELOW` | `float` | `0.0` | | A prose question whose nearest file card's cosine is below this abstains `off_domain`; independent of the card leg. 0 = off. | | `LOOM_CODE_SEARCH_ABSTAIN_CONFIDENCE_BELOW` | `float` | `0.35` | | The abstain score below which a code.search result is flagged `low_calibrated_confidence` (still returned). The score is not `retrieval_confidence`: it blends the top cosine, its margin over the second hit, route agreement and the pool size. The deployment sets 0.30. | | `LOOM_CODE_SEARCH_MEDIUM_RISK_FROM` | `float` | `0.35` | | The `retrieval_confidence` from which a code.search result reads `retrieval_risk` "medium"; below it the result reads "high". In the measurement behind the default about half of the prompts sent to another repository's index scored under it. | -| `LOOM_CODE_SEARCH_LOW_RISK_FROM` | `float` | `0.7` | | The `retrieval_confidence` from which a code.search result reads `retrieval_risk` "low": the best cosine is close to that of a confident hit. A prompt about other code usually scores lower, but about one in five sent to another repository's index still read low. The coding-agent plugins send their prompt pointers from it and, for a bug report, the picks the pick model words `high` or `medium` below it too. | +| `LOOM_CODE_SEARCH_LOW_RISK_FROM` | `float` | `0.7` | | The `retrieval_confidence` from which a code.search result reads `retrieval_risk` "low": the best cosine is close to that of a confident hit. A prompt about other code usually scores lower, but about one in five sent to another repository's index still read low. The coding-agent plugins send their prompt pointers from it and, for a bug report, below it the first pick of an answer the pick model words `high` or `medium`. | | `LOOM_CODE_SEARCH_HYDE_KINDS` | `str` | `'responsibility'` | | The question kinds the hypothetical answer votes on. | | `LOOM_CODE_SEARCH_HYDE_CAP` | `float` | `1.0` | | Cap on the hypothetical-answer (HyDE) leg's candidate list, as a multiple of the two-leg top (the history rule). | | `LOOM_CODE_SEARCH_HYDE_MAX_TOKENS` | `int` | `220` | | Tokens the hypothetical-answer (HyDE) passage may run to. | diff --git a/integrations/claude-code-plugin/README.md b/integrations/claude-code-plugin/README.md index 3f83b5efa7..b2f9c1e772 100644 --- a/integrations/claude-code-plugin/README.md +++ b/integrations/claude-code-plugin/README.md @@ -565,8 +565,9 @@ them; a named question asks for no pick and keeps the 2.5 s bound, whatever it r model says one word for how sure it is. On `high` (it is confident of its first pick) or `medium` (one of its picks probably is the place) at most three of its picks are sent, and none when the first is no place to edit: one rule for both words, by choice. -Such an answer is sent whatever risk the index labels it: the label bands the scores -of the search, which ran before the pick model read the candidates. +Where the index labels such an answer `medium` or `high` risk, its first pick alone is +sent: the label bands the scores of the search, which ran before the pick model read the +candidates, and the reply marks no unit after the first as a pick. On `low` none is sent, and a reply with no word is sent as any other prompt's (a server that sets no `LOOM_CODE_SEARCH_PICK_MODEL`, a pick the server skipped, cut at the request's deadline or lost, a pick call its inference gateway refused for the caller). diff --git a/integrations/claude-code-plugin/hooks/HOOKS.md b/integrations/claude-code-plugin/hooks/HOOKS.md index f7a3b3eef5..d32e71c28f 100644 --- a/integrations/claude-code-plugin/hooks/HOOKS.md +++ b/integrations/claude-code-plugin/hooks/HOOKS.md @@ -843,7 +843,8 @@ in. (`retrieval_risk`, banded by the deployment's settings); with `LOOM_PROMPT_PACK_MIN_CONF` set, when retrieval_confidence is at least that value instead. An answer the pick model worded `high` or `medium` - (**The listwise pick**, below) is not held to the label. The search reads the request as one line, cut at 2,000 + (**The listwise pick**, below) is not held to the label: where the label + is not low it sends its first pick alone. The search reads the request as one line, cut at 2,000 characters. A request that holds three or more Markdown heading lines (`#` to `######`, then text) outside fenced blocks is a filled-in form, and the search reads it without those lines and without the `_No response_` lines @@ -932,8 +933,8 @@ in. answer that holds only other places is sent. A search with no semantic leg (a server with no embedding model, a vector leg that failed or missed its deadline) reads `medium` at - confidence 0.5 and sends no pointers but those of an answer the pick worded - `high` or `medium`; `LOOM_PROMPT_PACK_MIN_CONF=0.5` sends + confidence 0.5 and sends no pointer but the first pick of an answer the pick + worded `high` or `medium`; `LOOM_PROMPT_PACK_MIN_CONF=0.5` sends them there for every answer but one the pick worded `low`. The pointers are candidates: the text never tells the model to stop searching. The repository lookup and the answer share one bound (`LOOM_PROMPT_PACK_TIMEOUT_MS`, 2,500 ms; for a bug report @@ -971,9 +972,14 @@ in. the picks probably is): at most 3 of those pointers are sent, and none when the first is no place to edit. `medium` does not say that much of its first pick; both words are held to the one rule by choice. Such an answer - is sent at any `retrieval_risk`: the risk bands the scores of the search, - which ran before any model read the candidates, and the pick model read - them against the request, so its word is the later reading. An answer that + is sent at a `medium` or `high` `retrieval_risk` too, as its first pick + alone: the risk bands the scores of the search, which ran before any model + read the candidates, and the pick model read them against the request, so + its word is the later reading. The reply holds the picks first and the rest + of the search's ranking after them and does not say how many picks there + are: its first unit is the one it proves a pick, and the units after it are + sent only where the low-risk label, or a set `LOOM_PROMPT_PACK_MIN_CONF` + the answer meets, admits them. An answer that abstains is not sent, and with `LOOM_PROMPT_PACK_MIN_CONF` set that confidence is a floor under a picked answer as under any other. `low` (probably none is): none is sent, the ranking the pick replaced included. @@ -997,8 +1003,9 @@ in. points), the most the server serves, is dropped and not cut. The model reads no fix: the sentence is a candidate to check, as the pointers are. It is written from the reply's picks and the block can list fewer of them: a pick that fails - the place test has no pointer, and a range and the ranges inside it send - one. So the sentence can name a definition that has no pointer above it. + the place test has no pointer, a range and the ranges inside it send + one, and at a medium or high `retrieval_risk` only the first pick is + listed. So the sentence can name a definition that has no pointer above it. A reply with no sentence leaves the block as it is: the model could not tell from the code, the call @@ -1006,7 +1013,7 @@ in. it or cut it at the request's deadline, or the server sends none. The server makes the call for a `high` reply at a medium or high `retrieval_risk` too, as it makes the pick, and the hook prints the - sentence under that reply's pointers. With `LOOM_PROMPT_PACK_MIN_CONF` + sentence under that reply's pointer. With `LOOM_PROMPT_PACK_MIN_CONF` set, a reply under that confidence has waited for both calls and prints nothing. A reply that abstains gets no call, and the hook prints nothing for it under either gate. diff --git a/integrations/claude-code-plugin/hooks/loom-prompt-pack.mjs b/integrations/claude-code-plugin/hooks/loom-prompt-pack.mjs index 206a85b2cf..18ab4675dc 100644 --- a/integrations/claude-code-plugin/hooks/loom-prompt-pack.mjs +++ b/integrations/claude-code-plugin/hooks/loom-prompt-pack.mjs @@ -48,14 +48,15 @@ // of the prompt's bound, less 300 ms and 60,000 ms at most, as the server's // deadline, so a pick that would run late is skipped or cut and the ranking // comes back without it. The model says one word, which decides what is sent -// (`pointerBlock` in lib/prompt-pack.mjs). `high` or `medium`: at most 3 of its -// picks, whatever risk the index labels the answer, and none when the first is -// no place to edit. `low`: none. No word (no -// pick model, a pick skipped, cut or failed, a pick call the server's inference -// gateway refused for the caller): the answer as any other prompt's. Under the -// picks of a `high` answer goes the server's one sentence on the cause, when it -// wrote one, labelled as a candidate a model wrote and nothing checked: a second -// call of the pick model, inside the same bound. +// (`pointerBlock` in lib/prompt-pack.mjs). `high` or `medium`: the answer opens +// with its picks, and at most 3 pointers are sent from its top where the index +// labels it low-risk, the first pick alone where it does not (the reply marks +// no other unit as a pick), and none when the first is no place to edit. `low`: +// none. No word (no pick model, a pick skipped, cut or failed, a pick call the +// server's inference gateway refused for the caller): the answer as any other +// prompt's. Under the pointers of a `high` answer goes the server's one sentence +// on the cause, when it wrote one, labelled as a candidate a model wrote and +// nothing checked: a second call of the pick model, inside the same bound. // // LOOM_PROMPT_PACK=auto|on|off as above; unset, auto // LOOM_PROMPT_PACK_MIN_CONF=0.7 skip below this retrieval_confidence; unset, skip diff --git a/integrations/claude-code-plugin/lib/prompt-pack.mjs b/integrations/claude-code-plugin/lib/prompt-pack.mjs index 9f3abb2d10..9a0124d66e 100644 --- a/integrations/claude-code-plugin/lib/prompt-pack.mjs +++ b/integrations/claude-code-plugin/lib/prompt-pack.mjs @@ -401,7 +401,8 @@ export const pickDeadline = (left) => * before any model read the candidates; the pick model read them against * the prompt, so its word is the later reading and the one that has seen * more. An abstention and a `minConfidence` the caller names hold for a - * picked answer as for any other. */ + * picked answer as for any other. What an answer that passes on the word + * alone sends is cut to what the word is about (`pointerBlock`). */ export function accept(res, minConfidence = null, picked = false) { if (!res || res.abstain) return false; if (!Array.isArray(res.results) || !res.results.length) return false; @@ -627,9 +628,12 @@ export const LONG_RANGE_LINES = 200; * what not to edit and in a pasted traceback). A `picked` answer (the pick * model said `high` or `medium` of it) is its first `cap` results, and its * first result decides: when that is no place nothing is sent, and no result - * below the first `cap` is. `high` is the model's word about that first - * result. `medium` says only that one of the picks probably is the place: it - * is held to the same rule by choice, one rule for both words. + * below the first `cap` is. Those results open with the model's picks, and + * where it picked fewer than `cap` the search's own ranking follows them: + * the caller sets `cap` by what admits the answer. `high` is the model's + * word about that first result. `medium` says only that one of the picks + * probably is the place: it is held to the same rule by choice, one rule for + * both words. */ export function places(res, { query, text = query, cap = 3, picked = false } = {}) { const asks = { tests: asksForTests(query), docs: asksForDocs(query) }; @@ -713,15 +717,20 @@ export function renderPack(res, { cap = 3, header, cause = "" } = {}) { * * The pick model's word (`pick_confidence`) says how the answer is read. * `high` (it is confident of its first pick) or `medium` (one of its picks - * probably is the place): the model chose the results, and at most `PICK_CAP` - * are sent under the picked rules of `places`, whatever the index's risk - * label says (`accept`). `low` (probably none of its picks is the place): - * none is sent. No word, which is any other value: the answer as served, - * under the plain rules. That is an answer no pick was asked for, a deployment - * with no pick model, a call the server skipped, cut at the request's - * deadline or lost, a call its inference gateway refused for the caller, and - * a page whose first unit is not the pick's first (the server clears the word - * there and keeps the picked order). + * probably is the place): the model put its picks first, and the answer is + * sent under the picked rules of `places`. Where the index's risk label, or + * the confidence the caller names, admits the answer (`accept`), that is at + * most its first `PICK_CAP` results. Where the label holds it back, the + * model's word alone admits it, and it sends its first result only: the + * server serves the picks first and the rest of its ranking after them, the + * reply does not say how many picks there are, and the first result is the + * one it proves a pick (the server clears the word on a page that opens with + * another unit). `low` (probably none of its picks is the place): none is + * sent. No word, which is any other value: the answer as served, under the + * plain rules. That is an answer no pick was asked for, a deployment with no + * pick model, a call the server skipped, cut at the request's deadline or + * lost, a call its inference gateway refused for the caller, and a page + * whose first unit is not the pick's first. * * Beside `high` the server may answer one sentence that states the cause * (`pick_cause`): its pick model wrote it from the request and the code of @@ -734,7 +743,9 @@ export function renderPack(res, { cap = 3, header, cause = "" } = {}) { export function pointerBlock(body, res, prompt, { topK = 3, minConfidence = null } = {}) { const word = res?.pick_confidence; const picked = word === "high" || word === "medium"; - const cap = picked ? Math.min(topK, PICK_CAP) : topK; + // the label holds the answer back: where it is sent, the model's word alone admits it + const onWord = picked && !accept(res, minConfidence); + const cap = picked ? Math.min(topK, onWord ? 1 : PICK_CAP) : topK; const pointers = accept(res, minConfidence, picked) && word !== "low" ? places(res, { query: body.query, text: prompt, cap, picked }) diff --git a/integrations/codex-plugin/hooks/loom-prompt-pack.mjs b/integrations/codex-plugin/hooks/loom-prompt-pack.mjs index 206a85b2cf..18ab4675dc 100644 --- a/integrations/codex-plugin/hooks/loom-prompt-pack.mjs +++ b/integrations/codex-plugin/hooks/loom-prompt-pack.mjs @@ -48,14 +48,15 @@ // of the prompt's bound, less 300 ms and 60,000 ms at most, as the server's // deadline, so a pick that would run late is skipped or cut and the ranking // comes back without it. The model says one word, which decides what is sent -// (`pointerBlock` in lib/prompt-pack.mjs). `high` or `medium`: at most 3 of its -// picks, whatever risk the index labels the answer, and none when the first is -// no place to edit. `low`: none. No word (no -// pick model, a pick skipped, cut or failed, a pick call the server's inference -// gateway refused for the caller): the answer as any other prompt's. Under the -// picks of a `high` answer goes the server's one sentence on the cause, when it -// wrote one, labelled as a candidate a model wrote and nothing checked: a second -// call of the pick model, inside the same bound. +// (`pointerBlock` in lib/prompt-pack.mjs). `high` or `medium`: the answer opens +// with its picks, and at most 3 pointers are sent from its top where the index +// labels it low-risk, the first pick alone where it does not (the reply marks +// no other unit as a pick), and none when the first is no place to edit. `low`: +// none. No word (no pick model, a pick skipped, cut or failed, a pick call the +// server's inference gateway refused for the caller): the answer as any other +// prompt's. Under the pointers of a `high` answer goes the server's one sentence +// on the cause, when it wrote one, labelled as a candidate a model wrote and +// nothing checked: a second call of the pick model, inside the same bound. // // LOOM_PROMPT_PACK=auto|on|off as above; unset, auto // LOOM_PROMPT_PACK_MIN_CONF=0.7 skip below this retrieval_confidence; unset, skip diff --git a/integrations/codex-plugin/lib/prompt-pack.mjs b/integrations/codex-plugin/lib/prompt-pack.mjs index 9f3abb2d10..9a0124d66e 100644 --- a/integrations/codex-plugin/lib/prompt-pack.mjs +++ b/integrations/codex-plugin/lib/prompt-pack.mjs @@ -401,7 +401,8 @@ export const pickDeadline = (left) => * before any model read the candidates; the pick model read them against * the prompt, so its word is the later reading and the one that has seen * more. An abstention and a `minConfidence` the caller names hold for a - * picked answer as for any other. */ + * picked answer as for any other. What an answer that passes on the word + * alone sends is cut to what the word is about (`pointerBlock`). */ export function accept(res, minConfidence = null, picked = false) { if (!res || res.abstain) return false; if (!Array.isArray(res.results) || !res.results.length) return false; @@ -627,9 +628,12 @@ export const LONG_RANGE_LINES = 200; * what not to edit and in a pasted traceback). A `picked` answer (the pick * model said `high` or `medium` of it) is its first `cap` results, and its * first result decides: when that is no place nothing is sent, and no result - * below the first `cap` is. `high` is the model's word about that first - * result. `medium` says only that one of the picks probably is the place: it - * is held to the same rule by choice, one rule for both words. + * below the first `cap` is. Those results open with the model's picks, and + * where it picked fewer than `cap` the search's own ranking follows them: + * the caller sets `cap` by what admits the answer. `high` is the model's + * word about that first result. `medium` says only that one of the picks + * probably is the place: it is held to the same rule by choice, one rule for + * both words. */ export function places(res, { query, text = query, cap = 3, picked = false } = {}) { const asks = { tests: asksForTests(query), docs: asksForDocs(query) }; @@ -713,15 +717,20 @@ export function renderPack(res, { cap = 3, header, cause = "" } = {}) { * * The pick model's word (`pick_confidence`) says how the answer is read. * `high` (it is confident of its first pick) or `medium` (one of its picks - * probably is the place): the model chose the results, and at most `PICK_CAP` - * are sent under the picked rules of `places`, whatever the index's risk - * label says (`accept`). `low` (probably none of its picks is the place): - * none is sent. No word, which is any other value: the answer as served, - * under the plain rules. That is an answer no pick was asked for, a deployment - * with no pick model, a call the server skipped, cut at the request's - * deadline or lost, a call its inference gateway refused for the caller, and - * a page whose first unit is not the pick's first (the server clears the word - * there and keeps the picked order). + * probably is the place): the model put its picks first, and the answer is + * sent under the picked rules of `places`. Where the index's risk label, or + * the confidence the caller names, admits the answer (`accept`), that is at + * most its first `PICK_CAP` results. Where the label holds it back, the + * model's word alone admits it, and it sends its first result only: the + * server serves the picks first and the rest of its ranking after them, the + * reply does not say how many picks there are, and the first result is the + * one it proves a pick (the server clears the word on a page that opens with + * another unit). `low` (probably none of its picks is the place): none is + * sent. No word, which is any other value: the answer as served, under the + * plain rules. That is an answer no pick was asked for, a deployment with no + * pick model, a call the server skipped, cut at the request's deadline or + * lost, a call its inference gateway refused for the caller, and a page + * whose first unit is not the pick's first. * * Beside `high` the server may answer one sentence that states the cause * (`pick_cause`): its pick model wrote it from the request and the code of @@ -734,7 +743,9 @@ export function renderPack(res, { cap = 3, header, cause = "" } = {}) { export function pointerBlock(body, res, prompt, { topK = 3, minConfidence = null } = {}) { const word = res?.pick_confidence; const picked = word === "high" || word === "medium"; - const cap = picked ? Math.min(topK, PICK_CAP) : topK; + // the label holds the answer back: where it is sent, the model's word alone admits it + const onWord = picked && !accept(res, minConfidence); + const cap = picked ? Math.min(topK, onWord ? 1 : PICK_CAP) : topK; const pointers = accept(res, minConfidence, picked) && word !== "low" ? places(res, { query: body.query, text: prompt, cap, picked }) diff --git a/loom.example.yaml b/loom.example.yaml index e7cffae960..86ba04089a 100644 --- a/loom.example.yaml +++ b/loom.example.yaml @@ -2235,8 +2235,8 @@ settings: # "low": the best cosine is close to that of a confident hit. A prompt about other # code usually scores lower, but about one in five sent to another repository's index # still read low. The coding-agent plugins send their prompt pointers from it and, for - # a bug report, the picks the pick model words `high` or `medium` below it too. - # [restart] + # a bug report, below it the first pick of an answer the pick model words `high` or + # `medium`. [restart] # code_search_low_risk_from: 0.7 # The question kinds the hypothetical answer votes on. [restart] diff --git a/schemas/loom-settings.schema.json b/schemas/loom-settings.schema.json index 9a6300cef6..45e15ba6dd 100644 --- a/schemas/loom-settings.schema.json +++ b/schemas/loom-settings.schema.json @@ -2246,7 +2246,7 @@ "code_search_low_risk_from": { "default": 0.7, "type": "number", - "description": "The `retrieval_confidence` from which a code.search result reads `retrieval_risk` \"low\": the best cosine is close to that of a confident hit. A prompt about other code usually scores lower, but about one in five sent to another repository's index still read low. The coding-agent plugins send their prompt pointers from it and, for a bug report, the picks the pick model words `high` or `medium` below it too." + "description": "The `retrieval_confidence` from which a code.search result reads `retrieval_risk` \"low\": the best cosine is close to that of a confident hit. A prompt about other code usually scores lower, but about one in five sent to another repository's index still read low. The coding-agent plugins send their prompt pointers from it and, for a bug report, below it the first pick of an answer the pick model words `high` or `medium`." }, "code_search_medium_risk_from": { "default": 0.35, diff --git a/server/settings/catalog.py b/server/settings/catalog.py index 0b3c0d040a..bf76a9f605 100644 --- a/server/settings/catalog.py +++ b/server/settings/catalog.py @@ -1843,8 +1843,8 @@ def _check_git_proxy(self) -> CodeSettings: # "low": the best cosine is close to that of a confident hit. A prompt about other # code usually scores lower, but about one in five sent to another repository's # index still read low. The coding-agent plugins send their prompt pointers from it - # and, for a bug report, the picks the pick model words `high` or `medium` below it - # too. + # and, for a bug report, below it the first pick of an answer the pick model words + # `high` or `medium`. code_search_low_risk_from: float = 0.70 # The question kinds the hypothetical answer votes on. code_search_hyde_kinds: str = "responsibility" diff --git a/tests/unit/session_content_senders.json b/tests/unit/session_content_senders.json index ce97bc94fa..cad750e97c 100644 --- a/tests/unit/session_content_senders.json +++ b/tests/unit/session_content_senders.json @@ -390,14 +390,14 @@ "integrations/claude-code-plugin/hooks/loom-code-shunt.mjs": "f4f761e9f5ed207c8cf4abd6759c1401f9354cddcae2b9065bda9835d778f04b", "integrations/claude-code-plugin/hooks/loom-flush.mjs": "a7634c8a3115aa98f0d7f5d098469cc3a87af4018fb2737c1a90fd27fc19c6e0", "integrations/claude-code-plugin/hooks/loom-namespace-health.mjs": "5f2bd718a88587c5f66b9823317bc77c18ce6a124f0602368b254d2c8c733ddb", - "integrations/claude-code-plugin/hooks/loom-prompt-pack.mjs": "fdad9998f6b3d4749bcc03b5d28218aeb2232ecae0b2d333a31574e318a498b3", + "integrations/claude-code-plugin/hooks/loom-prompt-pack.mjs": "1bef908170c4814b922b8972db63a3046cb4fd9d956e0769901af4d52ef03284", "integrations/claude-code-plugin/hooks/loom-session-start.mjs": "31ba0130495c6cbd40a3e4e673d9709deafb0cefb0b655b117d22a2437502b78", "integrations/claude-code-plugin/lib/collections-line.mjs": "4415df00d8af1cbb64f5bc25fa1ba1176433b122c1ae35f809b3981f4439c8c9", "integrations/claude-code-plugin/lib/first-session.mjs": "ea5c41ac14f173aa81c8fefc894d72a6661be66e242d0b614f502a0de98b8646", "integrations/claude-code-plugin/lib/flush-job.mjs": "e6c4ae5e42a54cba0e171b727688be621a81245023bf85a8ac093d334bc9bfd5", "integrations/claude-code-plugin/lib/loom-client.mjs": "33b83b0977c4a39d11bf0e9de44bc6bccd6c2bfef56f1639a26b54e14a6b7f4c", "integrations/claude-code-plugin/lib/namespace-health.mjs": "c8a9aab01f1e996c97643aee7b8f367bf6447f7a6c74dec01a70dc50a0caa182", - "integrations/claude-code-plugin/lib/prompt-pack.mjs": "82aa64beae214c40afa365855519e4c78b63da04cf13eb9c4d560f808bc6e47b", + "integrations/claude-code-plugin/lib/prompt-pack.mjs": "ca92d492ab7fe6b1f9157b9be3943d9a490cb241ca699bf19061e0efb922c4ef", "integrations/claude-code-plugin/lib/repo-scope.mjs": "1fe69b8ecaf5637dc778fb1c8593336afc74d5029f5487b9419f87bc832dd07c", "integrations/claude-code-plugin/lib/session-brief.mjs": "3aee492198a400ed0fa5fee733b4a4e04463efcc4d0b22ff760e1b765a76e28b", "integrations/claude-code-plugin/lib/session-start.mjs": "60675fae31105740885c3b76a34f50e7d18e31447d792bbea5e7c03fc1b30627", @@ -405,14 +405,14 @@ "integrations/codex-plugin/hooks/loom-code-shunt.mjs": "f4f761e9f5ed207c8cf4abd6759c1401f9354cddcae2b9065bda9835d778f04b", "integrations/codex-plugin/hooks/loom-flush.mjs": "a7634c8a3115aa98f0d7f5d098469cc3a87af4018fb2737c1a90fd27fc19c6e0", "integrations/codex-plugin/hooks/loom-namespace-health.mjs": "5f2bd718a88587c5f66b9823317bc77c18ce6a124f0602368b254d2c8c733ddb", - "integrations/codex-plugin/hooks/loom-prompt-pack.mjs": "fdad9998f6b3d4749bcc03b5d28218aeb2232ecae0b2d333a31574e318a498b3", + "integrations/codex-plugin/hooks/loom-prompt-pack.mjs": "1bef908170c4814b922b8972db63a3046cb4fd9d956e0769901af4d52ef03284", "integrations/codex-plugin/hooks/loom-session-start.mjs": "31ba0130495c6cbd40a3e4e673d9709deafb0cefb0b655b117d22a2437502b78", "integrations/codex-plugin/lib/collections-line.mjs": "4415df00d8af1cbb64f5bc25fa1ba1176433b122c1ae35f809b3981f4439c8c9", "integrations/codex-plugin/lib/first-session.mjs": "ea5c41ac14f173aa81c8fefc894d72a6661be66e242d0b614f502a0de98b8646", "integrations/codex-plugin/lib/flush-job.mjs": "e6c4ae5e42a54cba0e171b727688be621a81245023bf85a8ac093d334bc9bfd5", "integrations/codex-plugin/lib/loom-client.mjs": "33b83b0977c4a39d11bf0e9de44bc6bccd6c2bfef56f1639a26b54e14a6b7f4c", "integrations/codex-plugin/lib/namespace-health.mjs": "c8a9aab01f1e996c97643aee7b8f367bf6447f7a6c74dec01a70dc50a0caa182", - "integrations/codex-plugin/lib/prompt-pack.mjs": "82aa64beae214c40afa365855519e4c78b63da04cf13eb9c4d560f808bc6e47b", + "integrations/codex-plugin/lib/prompt-pack.mjs": "ca92d492ab7fe6b1f9157b9be3943d9a490cb241ca699bf19061e0efb922c4ef", "integrations/codex-plugin/lib/repo-scope.mjs": "1fe69b8ecaf5637dc778fb1c8593336afc74d5029f5487b9419f87bc832dd07c", "integrations/codex-plugin/lib/session-brief.mjs": "3aee492198a400ed0fa5fee733b4a4e04463efcc4d0b22ff760e1b765a76e28b", "integrations/codex-plugin/lib/session-start.mjs": "60675fae31105740885c3b76a34f50e7d18e31447d792bbea5e7c03fc1b30627", From f30bb925f5ca0abcada7b1359b9d6608693900d8 Mon Sep 17 00:00:00 2001 From: Lareb Zafar Date: Sat, 5 Dec 2026 03:38:29 +0530 Subject: [PATCH 07/13] The pick pages say a picked answer sends its first results, which open with the picks The reply holds the picks first and the rest of the ranking after them, and carries no pick count, so "at most three of the picks" said more than the hook knows. The pick-word table and the plugin README now say at most the first three results, which open with the picks. The README's cause-sentence paragraph names the third reason the sentence can name a definition with no pointer: at a medium or high risk only the first pick is listed. The hook test's comment keeps the two silent cases apart: a `low` answer sends nothing at any label, and only an answer with no word is gated by the label. Co-Authored-By: Claude Fable 5.2 Signed-off-by: Lareb Zafar --- docs/features/integrations/claude-code.md | 10 +++++----- integrations/claude-code-plugin/README.md | 8 +++++--- .../claude-code-plugin/tests/prompt-pack-hook.test.mjs | 2 +- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/docs/features/integrations/claude-code.md b/docs/features/integrations/claude-code.md index bf26aa448c..3ac2b62524 100644 --- a/docs/features/integrations/claude-code.md +++ b/docs/features/integrations/claude-code.md @@ -1343,11 +1343,11 @@ would change first and says one word for how sure it is ([how the pick ranks](../../architecture/code-index-architecture.md#query-patterns)). The hook reads that word, `pick_confidence`: -| The reply says | The hook sends | -| ---------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `high`, `medium` | at most three of the picks, or the first alone at a `medium` or `high` risk, when the first is a place to edit ([what a prompt gets](#what-a-prompt-gets)) | -| `low` | nothing | -| no word | the answer as any other prompt's | +| The reply says | The hook sends | +| ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `high`, `medium` | at most its first three results, which open with the picks, or the first alone at a `medium` or `high` risk, when the first is a place to edit ([what a prompt gets](#what-a-prompt-gets)) | +| `low` | nothing | +| no word | the answer as any other prompt's | `high` says the first pick is a definition the fix changes, `medium` that one of the picks probably is, `low` that probably none is. On `high` or `medium` the first pick diff --git a/integrations/claude-code-plugin/README.md b/integrations/claude-code-plugin/README.md index b2f9c1e772..992ef79425 100644 --- a/integrations/claude-code-plugin/README.md +++ b/integrations/claude-code-plugin/README.md @@ -563,8 +563,9 @@ Where a prompt gets code pointers from a search, one that reads as a bug report words or more, or the vocabulary of a failure) asks the server's pick model to choose them; a named question asks for no pick and keeps the 2.5 s bound, whatever it reads as. The model says one word for how sure it is. On `high` (it is confident of its first pick) -or `medium` (one of its picks probably is the place) at most three of its picks are -sent, and none when the first is no place to edit: one rule for both words, by choice. +or `medium` (one of its picks probably is the place) at most its first three results, +which open with the picks, are sent, and none when the first is no place to edit: one +rule for both words, by choice. Where the index labels such an answer `medium` or `high` risk, its first pick alone is sent: the label bands the scores of the search, which ran before the pick model read the candidates, and the reply marks no unit after the first as a pick. @@ -578,7 +579,8 @@ of the first three picks its reply carries and states which definition is at fau and why. It reads no fix, so the sentence is a candidate to check, as the pointers are. It can name a definition with no pointer above it: the call reads the reply's picks, and the block lists only those that pass the place test, one for a range and -the ranges inside it. The prompt waits for that call too, inside the same bound, and the server skips +the ranges inside it, and only the first at a `medium` or `high` risk. The prompt waits +for that call too, inside the same bound, and the server skips it when the pick left it under 2.6 s of the search's deadline: the pointers then come without it. Such a prompt has the bound `LOOM_PROMPT_PACK_PICK_TIMEOUT_MS` (6 s) for its pointers on diff --git a/integrations/claude-code-plugin/tests/prompt-pack-hook.test.mjs b/integrations/claude-code-plugin/tests/prompt-pack-hook.test.mjs index 28060659ba..8550a69d58 100644 --- a/integrations/claude-code-plugin/tests/prompt-pack-hook.test.mjs +++ b/integrations/claude-code-plugin/tests/prompt-pack-hook.test.mjs @@ -764,7 +764,7 @@ test("a bug report's first pick is sent at a medium or high risk label when the // the reply does not say the second unit is a pick, and the label does not admit it assert.doesNotMatch(block, /parser2/, `${word} ${risk}`); } - // not sure, and no word (no pick model, a pick skipped, cut or failed): the label gates the answer + // not sure: nothing at any label; no word (no pick model, a pick skipped, cut or failed): the label gates the answer for (const word of ["low", ""]) assert.deepEqual(await asked(risk, word), SILENT, `${word} ${risk}`); } // at a low label the answer is sent as before, the units after the first included From 2bc66b350cbc823db659df5efe6b1407184b4986 Mon Sep 17 00:00:00 2001 From: Lareb Zafar Date: Sat, 5 Dec 2026 04:07:11 +0530 Subject: [PATCH 08/13] The pick pages say the first pick is sent alone only where the pick's word alone admits the answer A picked answer that a set LOOM_PROMPT_PACK_MIN_CONF admits sends its first three results at any risk label, so the pages no longer say a medium or high risk always sends one. The hooks page says the hook sends the answer's first results, which open with the picks, as the other pages do, and the sentence on a search with no semantic leg names what the variable sends. Co-Authored-By: Claude Fable 5.2 Signed-off-by: Lareb Zafar --- docs/features/integrations/claude-code.md | 21 ++++++++++--------- integrations/claude-code-plugin/README.md | 8 ++++--- .../claude-code-plugin/hooks/HOOKS.md | 13 ++++++------ .../hooks/loom-prompt-pack.mjs | 5 +++-- .../codex-plugin/hooks/loom-prompt-pack.mjs | 5 +++-- tests/unit/session_content_senders.json | 4 ++-- 6 files changed, 31 insertions(+), 25 deletions(-) diff --git a/docs/features/integrations/claude-code.md b/docs/features/integrations/claude-code.md index 3ac2b62524..e55dc5e24b 100644 --- a/docs/features/integrations/claude-code.md +++ b/docs/features/integrations/claude-code.md @@ -661,8 +661,8 @@ background command ends (one that opens with ``). Ambiguous o 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. An answer the server's pick -worded `high` or `medium` is not held to the label, and sends its first pick alone where -the label is not low +worded `high` or `medium` is not held to the label: with the variable unset it sends its +first pick alone where the label is not low ([model-picked pointers](#model-picked-pointers-for-a-bug-report)). 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 @@ -732,11 +732,12 @@ the first variable says, and a repository lookup that is not cached can end up t ([the pick](#model-picked-pointers-for-a-bug-report)). A search with no semantic leg reads `medium` (confidence 0.5), so it sends no search pointer but the first pick of an answer the pick worded `high` or `medium`: 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 for +that failed or missed its deadline. `LOOM_PROMPT_PACK_MIN_CONF=0.5` sends search pointers for every indexed-code answer whose confidence is 0.5 or more, such a search's included, but not for one the pick worded `low`. A code namespace an administrator has not calibrated can read answerable prompts `medium` or `high` risk, -and then sends only the first pick of an answer the pick worded `high` or `medium` +and with the variable unset then sends only the first pick of an answer the pick worded +`high` or `medium` ([`code.calibrate`](../../operations/code-index-operations.md#first-index)). Supply a task inside `...` 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 @@ -1343,11 +1344,11 @@ would change first and says one word for how sure it is ([how the pick ranks](../../architecture/code-index-architecture.md#query-patterns)). The hook reads that word, `pick_confidence`: -| The reply says | The hook sends | -| ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `high`, `medium` | at most its first three results, which open with the picks, or the first alone at a `medium` or `high` risk, when the first is a place to edit ([what a prompt gets](#what-a-prompt-gets)) | -| `low` | nothing | -| no word | the answer as any other prompt's | +| The reply says | The hook sends | +| ---------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `high`, `medium` | at most its first three results, which open with the picks, or the first alone where only the word admits the answer, when the first is a place to edit ([what a prompt gets](#what-a-prompt-gets)) | +| `low` | nothing | +| no word | the answer as any other prompt's | `high` says the first pick is a definition the fix changes, `medium` that one of the picks probably is, `low` that probably none is. On `high` or `medium` the first pick @@ -1382,7 +1383,7 @@ reads no fix, so the sentence is a candidate to check, as the pointers are, and line's label tells the session so: a model wrote the sentence and nothing checked it. It can name a definition with no pointer above it: the call reads the reply's picks, and the block lists only those that pass the place test, one for a range and the ranges inside it, and -only the first at a `medium` or `high` risk. A reply +only the first where only the pick's word admits the answer. A reply with no sentence leaves the block as it is: a `medium` answer, a model that could not tell from the code, a call the server skipped, cut or lost, and a server that sends none. The hook prints a sentence of at most 600 characters, the most the server serves, and drops a longer one. diff --git a/integrations/claude-code-plugin/README.md b/integrations/claude-code-plugin/README.md index 992ef79425..ff55137140 100644 --- a/integrations/claude-code-plugin/README.md +++ b/integrations/claude-code-plugin/README.md @@ -566,8 +566,9 @@ model says one word for how sure it is. On `high` (it is confident of its first or `medium` (one of its picks probably is the place) at most its first three results, which open with the picks, are sent, and none when the first is no place to edit: one rule for both words, by choice. -Where the index labels such an answer `medium` or `high` risk, its first pick alone is -sent: the label bands the scores of the search, which ran before the pick model read the +Where the index labels such an answer `medium` or `high` risk and +`LOOM_PROMPT_PACK_MIN_CONF` is unset, only the model's word admits it and its first pick +alone is sent: the label bands the scores of the search, which ran before the pick model read the candidates, and the reply marks no unit after the first as a pick. On `low` none is sent, and a reply with no word is sent as any other prompt's (a server that sets no `LOOM_CODE_SEARCH_PICK_MODEL`, a pick the server skipped, cut at the @@ -579,7 +580,8 @@ of the first three picks its reply carries and states which definition is at fau and why. It reads no fix, so the sentence is a candidate to check, as the pointers are. It can name a definition with no pointer above it: the call reads the reply's picks, and the block lists only those that pass the place test, one for a range and -the ranges inside it, and only the first at a `medium` or `high` risk. The prompt waits +the ranges inside it, and only the first where only the model's word admits the answer. +The prompt waits for that call too, inside the same bound, and the server skips it when the pick left it under 2.6 s of the search's deadline: the pointers then come without it. diff --git a/integrations/claude-code-plugin/hooks/HOOKS.md b/integrations/claude-code-plugin/hooks/HOOKS.md index d32e71c28f..5cbb26721e 100644 --- a/integrations/claude-code-plugin/hooks/HOOKS.md +++ b/integrations/claude-code-plugin/hooks/HOOKS.md @@ -843,8 +843,8 @@ in. (`retrieval_risk`, banded by the deployment's settings); with `LOOM_PROMPT_PACK_MIN_CONF` set, when retrieval_confidence is at least that value instead. An answer the pick model worded `high` or `medium` - (**The listwise pick**, below) is not held to the label: where the label - is not low it sends its first pick alone. The search reads the request as one line, cut at 2,000 + (**The listwise pick**, below) is not held to the label: with the variable + unset and a label that is not low it sends its first pick alone. The search reads the request as one line, cut at 2,000 characters. A request that holds three or more Markdown heading lines (`#` to `######`, then text) outside fenced blocks is a filled-in form, and the search reads it without those lines and without the `_No response_` lines @@ -935,7 +935,7 @@ in. model, a vector leg that failed or missed its deadline) reads `medium` at confidence 0.5 and sends no pointer but the first pick of an answer the pick worded `high` or `medium`; `LOOM_PROMPT_PACK_MIN_CONF=0.5` sends - them there for every answer but one the pick worded `low`. The pointers are candidates: the text never tells the + pointers there for every answer but one the pick worded `low`. The pointers are candidates: the text never tells the model to stop searching. The repository lookup and the answer share one bound (`LOOM_PROMPT_PACK_TIMEOUT_MS`, 2,500 ms; for a bug report `LOOM_PROMPT_PACK_PICK_TIMEOUT_MS`, **The listwise pick** below): when the @@ -969,7 +969,8 @@ in. definitions it would change first, with one word for how sure it is (`pick_confidence`). The hook reads that word. `high` (the first pick is a definition the fix changes) or `medium` (one of - the picks probably is): at most 3 of those pointers are sent, and none + the picks probably is): at most its first 3 results, which open with the + picks, are sent, and none when the first is no place to edit. `medium` does not say that much of its first pick; both words are held to the one rule by choice. Such an answer is sent at a `medium` or `high` `retrieval_risk` too, as its first pick @@ -1004,8 +1005,8 @@ in. sentence is a candidate to check, as the pointers are. It is written from the reply's picks and the block can list fewer of them: a pick that fails the place test has no pointer, a range and the ranges inside it send - one, and at a medium or high `retrieval_risk` only the first pick is - listed. So the sentence can name a definition that has no pointer above it. + one, and where only the pick's word admits the answer only the first pick + is listed. So the sentence can name a definition that has no pointer above it. A reply with no sentence leaves the block as it is: the model could not tell from the code, the call diff --git a/integrations/claude-code-plugin/hooks/loom-prompt-pack.mjs b/integrations/claude-code-plugin/hooks/loom-prompt-pack.mjs index 18ab4675dc..7e9f391c78 100644 --- a/integrations/claude-code-plugin/hooks/loom-prompt-pack.mjs +++ b/integrations/claude-code-plugin/hooks/loom-prompt-pack.mjs @@ -50,8 +50,9 @@ // comes back without it. The model says one word, which decides what is sent // (`pointerBlock` in lib/prompt-pack.mjs). `high` or `medium`: the answer opens // with its picks, and at most 3 pointers are sent from its top where the index -// labels it low-risk, the first pick alone where it does not (the reply marks -// no other unit as a pick), and none when the first is no place to edit. `low`: +// labels it low-risk or it meets a set LOOM_PROMPT_PACK_MIN_CONF, the first pick +// alone where only the word admits it (the reply marks no other unit as a +// pick), and none when the first is no place to edit. `low`: // none. No word (no pick model, a pick skipped, cut or failed, a pick call the // server's inference gateway refused for the caller): the answer as any other // prompt's. Under the pointers of a `high` answer goes the server's one sentence diff --git a/integrations/codex-plugin/hooks/loom-prompt-pack.mjs b/integrations/codex-plugin/hooks/loom-prompt-pack.mjs index 18ab4675dc..7e9f391c78 100644 --- a/integrations/codex-plugin/hooks/loom-prompt-pack.mjs +++ b/integrations/codex-plugin/hooks/loom-prompt-pack.mjs @@ -50,8 +50,9 @@ // comes back without it. The model says one word, which decides what is sent // (`pointerBlock` in lib/prompt-pack.mjs). `high` or `medium`: the answer opens // with its picks, and at most 3 pointers are sent from its top where the index -// labels it low-risk, the first pick alone where it does not (the reply marks -// no other unit as a pick), and none when the first is no place to edit. `low`: +// labels it low-risk or it meets a set LOOM_PROMPT_PACK_MIN_CONF, the first pick +// alone where only the word admits it (the reply marks no other unit as a +// pick), and none when the first is no place to edit. `low`: // none. No word (no pick model, a pick skipped, cut or failed, a pick call the // server's inference gateway refused for the caller): the answer as any other // prompt's. Under the pointers of a `high` answer goes the server's one sentence diff --git a/tests/unit/session_content_senders.json b/tests/unit/session_content_senders.json index cad750e97c..502994f1c7 100644 --- a/tests/unit/session_content_senders.json +++ b/tests/unit/session_content_senders.json @@ -390,7 +390,7 @@ "integrations/claude-code-plugin/hooks/loom-code-shunt.mjs": "f4f761e9f5ed207c8cf4abd6759c1401f9354cddcae2b9065bda9835d778f04b", "integrations/claude-code-plugin/hooks/loom-flush.mjs": "a7634c8a3115aa98f0d7f5d098469cc3a87af4018fb2737c1a90fd27fc19c6e0", "integrations/claude-code-plugin/hooks/loom-namespace-health.mjs": "5f2bd718a88587c5f66b9823317bc77c18ce6a124f0602368b254d2c8c733ddb", - "integrations/claude-code-plugin/hooks/loom-prompt-pack.mjs": "1bef908170c4814b922b8972db63a3046cb4fd9d956e0769901af4d52ef03284", + "integrations/claude-code-plugin/hooks/loom-prompt-pack.mjs": "0fd84e94d004cb24a839cd8766088897b65b16ccca4e3338f5802fb228fd4480", "integrations/claude-code-plugin/hooks/loom-session-start.mjs": "31ba0130495c6cbd40a3e4e673d9709deafb0cefb0b655b117d22a2437502b78", "integrations/claude-code-plugin/lib/collections-line.mjs": "4415df00d8af1cbb64f5bc25fa1ba1176433b122c1ae35f809b3981f4439c8c9", "integrations/claude-code-plugin/lib/first-session.mjs": "ea5c41ac14f173aa81c8fefc894d72a6661be66e242d0b614f502a0de98b8646", @@ -405,7 +405,7 @@ "integrations/codex-plugin/hooks/loom-code-shunt.mjs": "f4f761e9f5ed207c8cf4abd6759c1401f9354cddcae2b9065bda9835d778f04b", "integrations/codex-plugin/hooks/loom-flush.mjs": "a7634c8a3115aa98f0d7f5d098469cc3a87af4018fb2737c1a90fd27fc19c6e0", "integrations/codex-plugin/hooks/loom-namespace-health.mjs": "5f2bd718a88587c5f66b9823317bc77c18ce6a124f0602368b254d2c8c733ddb", - "integrations/codex-plugin/hooks/loom-prompt-pack.mjs": "1bef908170c4814b922b8972db63a3046cb4fd9d956e0769901af4d52ef03284", + "integrations/codex-plugin/hooks/loom-prompt-pack.mjs": "0fd84e94d004cb24a839cd8766088897b65b16ccca4e3338f5802fb228fd4480", "integrations/codex-plugin/hooks/loom-session-start.mjs": "31ba0130495c6cbd40a3e4e673d9709deafb0cefb0b655b117d22a2437502b78", "integrations/codex-plugin/lib/collections-line.mjs": "4415df00d8af1cbb64f5bc25fa1ba1176433b122c1ae35f809b3981f4439c8c9", "integrations/codex-plugin/lib/first-session.mjs": "ea5c41ac14f173aa81c8fefc894d72a6661be66e242d0b614f502a0de98b8646", From 7f1698755204ecd20dfbb30bf4ce50943a38d4e4 Mon Sep 17 00:00:00 2001 From: Lareb Zafar Date: Sat, 5 Dec 2026 04:41:37 +0530 Subject: [PATCH 09/13] The pick pages say no field of the reply names the pick count or marks a pick The comment on `pointerBlock`, the Claude Code page and HOOKS.md said the reply does not say how many picks there are. Its `score_explanation` text does hold a count. The count is taken before the server gives each definition one slot and cuts the page at `top_k`, so it does not say which units of the page are picks, and the first unit stays the only one the reply proves a pick. The texts now say that. A reply with no word is sent as any other request's: the two sentences that tied it to the low-risk label were wrong with `LOOM_PROMPT_PACK_MIN_CONF` set, and are gone. One test comment states the rule at a low label instead of comparing it with the code before. The Codex copy is regenerated and the two sender pins of `lib/prompt-pack.mjs` are renewed; only a comment changed in that file. Co-Authored-By: Claude Fable 5.2 Signed-off-by: Lareb Zafar --- docs/features/integrations/claude-code.md | 12 +++++++----- integrations/claude-code-plugin/hooks/HOOKS.md | 13 ++++++++----- integrations/claude-code-plugin/lib/prompt-pack.mjs | 11 +++++++---- .../tests/prompt-pack-hook.test.mjs | 2 +- .../claude-code-plugin/tests/prompt-pack.test.mjs | 5 +++-- integrations/codex-plugin/lib/prompt-pack.mjs | 11 +++++++---- tests/unit/session_content_senders.json | 4 ++-- 7 files changed, 35 insertions(+), 23 deletions(-) diff --git a/docs/features/integrations/claude-code.md b/docs/features/integrations/claude-code.md index e55dc5e24b..d733ff4bd5 100644 --- a/docs/features/integrations/claude-code.md +++ b/docs/features/integrations/claude-code.md @@ -1360,12 +1360,14 @@ A `high` or `medium` answer is sent at a `medium` or `high` `retrieval_risk` too first pick alone. The risk bands the scores of the search, which ran before any model read the candidates; the pick model read them against the prompt, so its word is the later reading. The reply holds the picks first -and the rest of the search's ranking after them, and does not say how many picks there -are: its first unit is the one it proves a pick, and the units after it are sent only -where the low-risk label, or a set `LOOM_PROMPT_PACK_MIN_CONF` the answer meets, admits -them. An answer that abstains is not +and the rest of the search's ranking after them. No field of it names how many picks +there are and no unit is marked as one: the count in its `score_explanation` text is +taken before the server gives each definition one slot and cuts the page at `top_k`, so it +does not say which units of the page are picks. The first unit is the one the reply +proves a pick, and the units after it are sent only where the low-risk label, or a set +`LOOM_PROMPT_PACK_MIN_CONF` the answer meets, admits them. An answer that abstains is not sent, and a `LOOM_PROMPT_PACK_MIN_CONF` that is set is a floor under a picked answer as -under any other. A reply with no word is sent where the index labels it low-risk. +under any other. A reply carries no word when the server made no pick, when its inference gateway refused the pick's call for the caller, and diff --git a/integrations/claude-code-plugin/hooks/HOOKS.md b/integrations/claude-code-plugin/hooks/HOOKS.md index 5cbb26721e..33b4c5bd7c 100644 --- a/integrations/claude-code-plugin/hooks/HOOKS.md +++ b/integrations/claude-code-plugin/hooks/HOOKS.md @@ -977,15 +977,18 @@ in. alone: the risk bands the scores of the search, which ran before any model read the candidates, and the pick model read them against the request, so its word is the later reading. The reply holds the picks first and the rest - of the search's ranking after them and does not say how many picks there - are: its first unit is the one it proves a pick, and the units after it are - sent only where the low-risk label, or a set `LOOM_PROMPT_PACK_MIN_CONF` - the answer meets, admits them. An answer that + of the search's ranking after them. No field of it names how many picks + there are and no unit is marked as one: the count in its + `score_explanation` text is taken before the server gives each definition one + slot and cuts the page at `top_k`, so it does not say which units of + the page are picks. The first unit is the one the reply proves a pick, and + the units after it are sent only where the low-risk label, or a set + `LOOM_PROMPT_PACK_MIN_CONF` the answer meets, admits them. An answer that abstains is not sent, and with `LOOM_PROMPT_PACK_MIN_CONF` set that confidence is a floor under a picked answer as under any other. `low` (probably none is): none is sent, the ranking the pick replaced included. No word, which is any other value of the field: the answer is sent as any - other request's, where the index labels it low-risk. A server with no pick + other request's. A server with no pick model says none and answers with its ranking in the search's own time; so does one whose call failed, one whose inference gateway refused the call for the caller, and one that skipped the call or cut it at the request's diff --git a/integrations/claude-code-plugin/lib/prompt-pack.mjs b/integrations/claude-code-plugin/lib/prompt-pack.mjs index 9a0124d66e..bd4921b9f1 100644 --- a/integrations/claude-code-plugin/lib/prompt-pack.mjs +++ b/integrations/claude-code-plugin/lib/prompt-pack.mjs @@ -722,10 +722,13 @@ export function renderPack(res, { cap = 3, header, cause = "" } = {}) { * the confidence the caller names, admits the answer (`accept`), that is at * most its first `PICK_CAP` results. Where the label holds it back, the * model's word alone admits it, and it sends its first result only: the - * server serves the picks first and the rest of its ranking after them, the - * reply does not say how many picks there are, and the first result is the - * one it proves a pick (the server clears the word on a page that opens with - * another unit). `low` (probably none of its picks is the place): none is + * server serves the picks first and the rest of its ranking after them, no + * field of the reply names their count and no unit is marked as a pick, and + * the first result is the one the reply proves a pick (the server clears the + * word on a page that opens with another unit). The count in the + * `score_explanation` text is taken before the server's per-symbol pass and + * its `top_k` cut, so it does not say which units of the page are picks. + * `low` (probably none of its picks is the place): none is * sent. No word, which is any other value: the answer as served, under the * plain rules. That is an answer no pick was asked for, a deployment with no * pick model, a call the server skipped, cut at the request's deadline or diff --git a/integrations/claude-code-plugin/tests/prompt-pack-hook.test.mjs b/integrations/claude-code-plugin/tests/prompt-pack-hook.test.mjs index 8550a69d58..e4211e5055 100644 --- a/integrations/claude-code-plugin/tests/prompt-pack-hook.test.mjs +++ b/integrations/claude-code-plugin/tests/prompt-pack-hook.test.mjs @@ -767,7 +767,7 @@ test("a bug report's first pick is sent at a medium or high risk label when the // not sure: nothing at any label; no word (no pick model, a pick skipped, cut or failed): the label gates the answer for (const word of ["low", ""]) assert.deepEqual(await asked(risk, word), SILENT, `${word} ${risk}`); } - // at a low label the answer is sent as before, the units after the first included + // at a low label the label admits the answer: the units after the first are sent too assert.match(context(await asked("low", "high")), /src\/parser2\.py:10-14 combine2/); // A confidence the caller names is a floor under every answer, a picked one included. assert.deepEqual(await asked("medium", "high", { LOOM_PROMPT_PACK_MIN_CONF: "0.6" }), SILENT); diff --git a/integrations/claude-code-plugin/tests/prompt-pack.test.mjs b/integrations/claude-code-plugin/tests/prompt-pack.test.mjs index 8d22f1ec68..753be6174f 100644 --- a/integrations/claude-code-plugin/tests/prompt-pack.test.mjs +++ b/integrations/claude-code-plugin/tests/prompt-pack.test.mjs @@ -1047,8 +1047,9 @@ test("a picked page can hold units the model did not pick: past the label none o const report = "why does the upload crash on an empty bucket name"; const body = searchBody({ org: "o", namespace: "code-x" }, report, { topK: 4, token: "" }); const unit = (name) => ({ path: `src/${name}.py`, start_line: 10, end_line: 14, symbol: name, kind: "function" }); - // The server serves the picks first and the rest of its ranking after them, and the reply - // does not say how many picks there are. Here the model chose one unit. + // The server serves the picks first and the rest of its ranking after them, and no field + // of the reply names how many picks there are or marks a unit as one. Here the model chose + // one unit. const pick = unit("chosen"); const ranking = ["ranked2", "ranked3", "ranked4"].map(unit); const answer = (word, risk) => ({ diff --git a/integrations/codex-plugin/lib/prompt-pack.mjs b/integrations/codex-plugin/lib/prompt-pack.mjs index 9a0124d66e..bd4921b9f1 100644 --- a/integrations/codex-plugin/lib/prompt-pack.mjs +++ b/integrations/codex-plugin/lib/prompt-pack.mjs @@ -722,10 +722,13 @@ export function renderPack(res, { cap = 3, header, cause = "" } = {}) { * the confidence the caller names, admits the answer (`accept`), that is at * most its first `PICK_CAP` results. Where the label holds it back, the * model's word alone admits it, and it sends its first result only: the - * server serves the picks first and the rest of its ranking after them, the - * reply does not say how many picks there are, and the first result is the - * one it proves a pick (the server clears the word on a page that opens with - * another unit). `low` (probably none of its picks is the place): none is + * server serves the picks first and the rest of its ranking after them, no + * field of the reply names their count and no unit is marked as a pick, and + * the first result is the one the reply proves a pick (the server clears the + * word on a page that opens with another unit). The count in the + * `score_explanation` text is taken before the server's per-symbol pass and + * its `top_k` cut, so it does not say which units of the page are picks. + * `low` (probably none of its picks is the place): none is * sent. No word, which is any other value: the answer as served, under the * plain rules. That is an answer no pick was asked for, a deployment with no * pick model, a call the server skipped, cut at the request's deadline or diff --git a/tests/unit/session_content_senders.json b/tests/unit/session_content_senders.json index 502994f1c7..5d2230ac27 100644 --- a/tests/unit/session_content_senders.json +++ b/tests/unit/session_content_senders.json @@ -397,7 +397,7 @@ "integrations/claude-code-plugin/lib/flush-job.mjs": "e6c4ae5e42a54cba0e171b727688be621a81245023bf85a8ac093d334bc9bfd5", "integrations/claude-code-plugin/lib/loom-client.mjs": "33b83b0977c4a39d11bf0e9de44bc6bccd6c2bfef56f1639a26b54e14a6b7f4c", "integrations/claude-code-plugin/lib/namespace-health.mjs": "c8a9aab01f1e996c97643aee7b8f367bf6447f7a6c74dec01a70dc50a0caa182", - "integrations/claude-code-plugin/lib/prompt-pack.mjs": "ca92d492ab7fe6b1f9157b9be3943d9a490cb241ca699bf19061e0efb922c4ef", + "integrations/claude-code-plugin/lib/prompt-pack.mjs": "3afe2dd5e565d3af300954f5ca6cd3c0123fb40aed5d8c501c0aeed9f8b30563", "integrations/claude-code-plugin/lib/repo-scope.mjs": "1fe69b8ecaf5637dc778fb1c8593336afc74d5029f5487b9419f87bc832dd07c", "integrations/claude-code-plugin/lib/session-brief.mjs": "3aee492198a400ed0fa5fee733b4a4e04463efcc4d0b22ff760e1b765a76e28b", "integrations/claude-code-plugin/lib/session-start.mjs": "60675fae31105740885c3b76a34f50e7d18e31447d792bbea5e7c03fc1b30627", @@ -412,7 +412,7 @@ "integrations/codex-plugin/lib/flush-job.mjs": "e6c4ae5e42a54cba0e171b727688be621a81245023bf85a8ac093d334bc9bfd5", "integrations/codex-plugin/lib/loom-client.mjs": "33b83b0977c4a39d11bf0e9de44bc6bccd6c2bfef56f1639a26b54e14a6b7f4c", "integrations/codex-plugin/lib/namespace-health.mjs": "c8a9aab01f1e996c97643aee7b8f367bf6447f7a6c74dec01a70dc50a0caa182", - "integrations/codex-plugin/lib/prompt-pack.mjs": "ca92d492ab7fe6b1f9157b9be3943d9a490cb241ca699bf19061e0efb922c4ef", + "integrations/codex-plugin/lib/prompt-pack.mjs": "3afe2dd5e565d3af300954f5ca6cd3c0123fb40aed5d8c501c0aeed9f8b30563", "integrations/codex-plugin/lib/repo-scope.mjs": "1fe69b8ecaf5637dc778fb1c8593336afc74d5029f5487b9419f87bc832dd07c", "integrations/codex-plugin/lib/session-brief.mjs": "3aee492198a400ed0fa5fee733b4a4e04463efcc4d0b22ff760e1b765a76e28b", "integrations/codex-plugin/lib/session-start.mjs": "60675fae31105740885c3b76a34f50e7d18e31447d792bbea5e7c03fc1b30627", From 6987351c12a84ad5bba341ddd65b87eb808e1b19 Mon Sep 17 00:00:00 2001 From: Lareb Zafar Date: Sat, 5 Dec 2026 05:08:53 +0530 Subject: [PATCH 10/13] The Claude Code page puts the causes of a search with no semantic leg beside that search The list of causes (a server with no embedding model, or a vector leg that failed or missed its deadline) followed a colon after the pick's words, so it read as a gloss on `high` or `medium`. It now sits in parentheses after "A search with no semantic leg", as in the hook reference. Co-Authored-By: Claude Fable 5.2 Signed-off-by: Lareb Zafar --- docs/features/integrations/claude-code.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/features/integrations/claude-code.md b/docs/features/integrations/claude-code.md index d733ff4bd5..7e37d69840 100644 --- a/docs/features/integrations/claude-code.md +++ b/docs/features/integrations/claude-code.md @@ -730,9 +730,9 @@ that reads as a bug report has `LOOM_PROMPT_PACK_PICK_TIMEOUT_MS` (6 s) instead, the first variable says, and a repository lookup that is not cached can end up to 1.5 s past either bound on a slow server ([the pick](#model-picked-pointers-for-a-bug-report)). A search with no semantic leg +(a server with no embedding model, or a vector leg that failed or missed its deadline) reads `medium` (confidence 0.5), so it sends no search pointer but the first pick of an -answer the pick worded `high` or `medium`: a server with no embedding model, or a vector leg -that failed or missed its deadline. `LOOM_PROMPT_PACK_MIN_CONF=0.5` sends search pointers for +answer the pick worded `high` or `medium`. `LOOM_PROMPT_PACK_MIN_CONF=0.5` sends search pointers for every indexed-code answer whose confidence is 0.5 or more, such a search's included, but not for one the pick worded `low`. A code namespace an administrator has not calibrated can read answerable prompts `medium` or `high` risk, From 21577e673344a3ebb3b9bf2852f0d71b4bfe75c9 Mon Sep 17 00:00:00 2001 From: Lareb Zafar Date: Sat, 5 Dec 2026 05:49:37 +0530 Subject: [PATCH 11/13] The operations page, the pointers guide and the low-risk setting's comment name the unset variable the first-pick rule holds under Three sentences said a picked answer sends its first pick at a medium or high risk label, with no condition. That is the gate with LOOM_PROMPT_PACK_MIN_CONF unset. With the variable set, the confidence it names is the only gate: an answer that meets it sends its first results at any label, and a picked answer under it sends nothing. Each sentence now says "with LOOM_PROMPT_PACK_MIN_CONF unset", as the hook page and the Claude Code page already do. The configuration reference, the settings-file schema and the settings-file template are regenerated from the setting's comment. Co-Authored-By: Claude Fable 5.2 Signed-off-by: Lareb Zafar --- docs/guides/issue-code-pointers.md | 4 ++-- docs/operations/code-index-operations.md | 6 +++--- docs/reference/configuration.md | 2 +- loom.example.yaml | 6 +++--- schemas/loom-settings.schema.json | 2 +- server/settings/catalog.py | 6 +++--- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/docs/guides/issue-code-pointers.md b/docs/guides/issue-code-pointers.md index a09a6c7167..59c2e5cdb9 100644 --- a/docs/guides/issue-code-pointers.md +++ b/docs/guides/issue-code-pointers.md @@ -208,8 +208,8 @@ What the plugins do and the SDKs do not: - **Ask for the pick.** For a prompt that reads as a bug report a plugin's search asks for the listwise pick and sends the answer by the model's word ([the pick](../features/integrations/claude-code.md#model-picked-pointers-for-a-bug-report)). - At a `medium` or `high` `retrieval_risk` it still sends the first pick of an answer - the model words `high` or `medium`. The + With `LOOM_PROMPT_PACK_MIN_CONF` unset, at a `medium` or `high` `retrieval_risk` it + still sends the first pick of an answer the model words `high` or `medium`. The SDK method never asks for it, so every answer of its search is held to [the low-risk label](#send-nothing-when-the-index-does-not-stand-behind-its-answer). - **Print the cause sentence.** After a pick the model is confident of, the server's diff --git a/docs/operations/code-index-operations.md b/docs/operations/code-index-operations.md index bf85988f42..fb5f49aa40 100644 --- a/docs/operations/code-index-operations.md +++ b/docs/operations/code-index-operations.md @@ -403,9 +403,9 @@ Then: without its own calibration (`calibration.get` reads `source: cluster`) reads code on the embedder's boot calibration, which is derived from prose. On an embedding model that scores a right code hit lower than a right prose answer, answerable - searches then read `medium` or `high`, and the coding-agent plugins send one search - pointer there, the first pick, only for a bug report whose answer the pick model words - `high` or `medium` + searches then read `medium` or `high`, and with `LOOM_PROMPT_PACK_MIN_CONF` unset the + coding-agent plugins send one search pointer there, the first pick, only for a bug + report whose answer the pick model words `high` or `medium` ([the pick](../features/integrations/claude-code.md#model-picked-pointers-for-a-bug-report)). - `loom code describe --top-pct 20` (optional, LLM cost) writes one-line descriptions for the most central chunks. `--limit N` starts at most N description calls. `--max-usd D` diff --git a/docs/reference/configuration.md b/docs/reference/configuration.md index 7fe4045481..f95ab25647 100644 --- a/docs/reference/configuration.md +++ b/docs/reference/configuration.md @@ -710,7 +710,7 @@ The code index's network git (clone, fetch, ls-remote, submodule update) through | `LOOM_CODE_SEARCH_ABSTAIN_CARD_BELOW` | `float` | `0.0` | | A prose question whose nearest file card's cosine is below this abstains `off_domain`; independent of the card leg. 0 = off. | | `LOOM_CODE_SEARCH_ABSTAIN_CONFIDENCE_BELOW` | `float` | `0.35` | | The abstain score below which a code.search result is flagged `low_calibrated_confidence` (still returned). The score is not `retrieval_confidence`: it blends the top cosine, its margin over the second hit, route agreement and the pool size. The deployment sets 0.30. | | `LOOM_CODE_SEARCH_MEDIUM_RISK_FROM` | `float` | `0.35` | | The `retrieval_confidence` from which a code.search result reads `retrieval_risk` "medium"; below it the result reads "high". In the measurement behind the default about half of the prompts sent to another repository's index scored under it. | -| `LOOM_CODE_SEARCH_LOW_RISK_FROM` | `float` | `0.7` | | The `retrieval_confidence` from which a code.search result reads `retrieval_risk` "low": the best cosine is close to that of a confident hit. A prompt about other code usually scores lower, but about one in five sent to another repository's index still read low. The coding-agent plugins send their prompt pointers from it and, for a bug report, below it the first pick of an answer the pick model words `high` or `medium`. | +| `LOOM_CODE_SEARCH_LOW_RISK_FROM` | `float` | `0.7` | | The `retrieval_confidence` from which a code.search result reads `retrieval_risk` "low": the best cosine is close to that of a confident hit. A prompt about other code usually scores lower, but about one in five sent to another repository's index still read low. With `LOOM_PROMPT_PACK_MIN_CONF` unset the coding-agent plugins send their prompt pointers from it and, for a bug report, below it the first pick of an answer the pick model words `high` or `medium`. | | `LOOM_CODE_SEARCH_HYDE_KINDS` | `str` | `'responsibility'` | | The question kinds the hypothetical answer votes on. | | `LOOM_CODE_SEARCH_HYDE_CAP` | `float` | `1.0` | | Cap on the hypothetical-answer (HyDE) leg's candidate list, as a multiple of the two-leg top (the history rule). | | `LOOM_CODE_SEARCH_HYDE_MAX_TOKENS` | `int` | `220` | | Tokens the hypothetical-answer (HyDE) passage may run to. | diff --git a/loom.example.yaml b/loom.example.yaml index 93a8379870..76c67aa9fa 100644 --- a/loom.example.yaml +++ b/loom.example.yaml @@ -2234,9 +2234,9 @@ settings: # The `retrieval_confidence` from which a code.search result reads `retrieval_risk` # "low": the best cosine is close to that of a confident hit. A prompt about other # code usually scores lower, but about one in five sent to another repository's index - # still read low. The coding-agent plugins send their prompt pointers from it and, for - # a bug report, below it the first pick of an answer the pick model words `high` or - # `medium`. [restart] + # still read low. With `LOOM_PROMPT_PACK_MIN_CONF` unset the coding-agent plugins send + # their prompt pointers from it and, for a bug report, below it the first pick of an + # answer the pick model words `high` or `medium`. [restart] # code_search_low_risk_from: 0.7 # The question kinds the hypothetical answer votes on. [restart] diff --git a/schemas/loom-settings.schema.json b/schemas/loom-settings.schema.json index c766db320d..0972dbb82d 100644 --- a/schemas/loom-settings.schema.json +++ b/schemas/loom-settings.schema.json @@ -2246,7 +2246,7 @@ "code_search_low_risk_from": { "default": 0.7, "type": "number", - "description": "The `retrieval_confidence` from which a code.search result reads `retrieval_risk` \"low\": the best cosine is close to that of a confident hit. A prompt about other code usually scores lower, but about one in five sent to another repository's index still read low. The coding-agent plugins send their prompt pointers from it and, for a bug report, below it the first pick of an answer the pick model words `high` or `medium`." + "description": "The `retrieval_confidence` from which a code.search result reads `retrieval_risk` \"low\": the best cosine is close to that of a confident hit. A prompt about other code usually scores lower, but about one in five sent to another repository's index still read low. With `LOOM_PROMPT_PACK_MIN_CONF` unset the coding-agent plugins send their prompt pointers from it and, for a bug report, below it the first pick of an answer the pick model words `high` or `medium`." }, "code_search_medium_risk_from": { "default": 0.35, diff --git a/server/settings/catalog.py b/server/settings/catalog.py index f8c811f9e7..5048c31ce1 100644 --- a/server/settings/catalog.py +++ b/server/settings/catalog.py @@ -1842,9 +1842,9 @@ def _check_git_proxy(self) -> CodeSettings: # The `retrieval_confidence` from which a code.search result reads `retrieval_risk` # "low": the best cosine is close to that of a confident hit. A prompt about other # code usually scores lower, but about one in five sent to another repository's - # index still read low. The coding-agent plugins send their prompt pointers from it - # and, for a bug report, below it the first pick of an answer the pick model words - # `high` or `medium`. + # index still read low. With `LOOM_PROMPT_PACK_MIN_CONF` unset the coding-agent + # plugins send their prompt pointers from it and, for a bug report, below it the + # first pick of an answer the pick model words `high` or `medium`. code_search_low_risk_from: float = 0.70 # The question kinds the hypothetical answer votes on. code_search_hyde_kinds: str = "responsibility" From c9ce540bd524a28bbb237cf59447e3c13356237d Mon Sep 17 00:00:00 2001 From: Lareb Zafar Date: Sat, 5 Dec 2026 06:17:07 +0530 Subject: [PATCH 12/13] The status line names the unset variable its pointer rule holds under, and one test holds the first-pick rule The PASS line of the `pointers` check said a bug report gets pointers when the pick words its answer high or medium. With `LOOM_PROMPT_PACK_MIN_CONF` set, an answer under that confidence sends nothing, picked or not, so the line, its pinned test string and the page's bullet now open with the unset variable, as the other texts that state the rule do. `pointerBlock` cannot tell a page with one pick from a page with three, so the test of a page holding units the model did not pick repeated the one above it. Its one assertion of its own, that the block's text names no other unit, moves into that test, which now also holds both words at a named confidence. Co-Authored-By: Claude Fable 5.2 Signed-off-by: Lareb Zafar --- docs/features/integrations/claude-code.md | 5 ++- .../lib/pointers-status.mjs | 2 +- .../tests/loom-client-status.test.mjs | 2 +- .../tests/prompt-pack.test.mjs | 41 ++++--------------- .../codex-plugin/lib/pointers-status.mjs | 2 +- 5 files changed, 13 insertions(+), 39 deletions(-) diff --git a/docs/features/integrations/claude-code.md b/docs/features/integrations/claude-code.md index 7e37d69840..87bcc03865 100644 --- a/docs/features/integrations/claude-code.md +++ b/docs/features/integrations/claude-code.md @@ -1263,8 +1263,9 @@ and set the variable. 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`, and a bug report also - when the server's pick words its answer `high` or `medium`. + index; with `LOOM_PROMPT_PACK_MIN_CONF` unset a prompt gets pointers when its own + answer reads `low`, and a bug report also when the server's pick words its answer + `high` or `medium`. - **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 diff --git a/integrations/claude-code-plugin/lib/pointers-status.mjs b/integrations/claude-code-plugin/lib/pointers-status.mjs index cb80ff358b..6838b16d3b 100644 --- a/integrations/claude-code-plugin/lib/pointers-status.mjs +++ b/integrations/claude-code-plugin/lib/pointers-status.mjs @@ -60,7 +60,7 @@ function searchedIn(entry, standing, search) { } return [ "PASS", - `${where}; ${read}; a prompt gets pointers when its own answer reads low, a bug report also when the server's pick words its answer high or medium`, + `${where}; ${read}; with \`LOOM_PROMPT_PACK_MIN_CONF\` unset a prompt gets pointers when its own answer reads low, a bug report also when the server's pick words its answer high or medium`, ]; } diff --git a/integrations/claude-code-plugin/tests/loom-client-status.test.mjs b/integrations/claude-code-plugin/tests/loom-client-status.test.mjs index f1482941ad..0b1ea2fb33 100644 --- a/integrations/claude-code-plugin/tests/loom-client-status.test.mjs +++ b/integrations/claude-code-plugin/tests/loom-client-status.test.mjs @@ -401,7 +401,7 @@ test("pointers: the checkout's own repository in a ready index passes, with one assert.equal(grade, "PASS"); assert.match( detail, - /^prompts here are searched in code-x \(x\/y\); a test search answered in \d+ ms and read low risk; a prompt gets pointers when its own answer reads low, a bug report also when the server's pick words its answer high or medium$/, + /^prompts here are searched in code-x \(x\/y\); a test search answered in \d+ ms and read low risk; with `LOOM_PROMPT_PACK_MIN_CONF` unset a prompt gets pointers when its own answer reads low, a bug report also when the server's pick words its answer high or medium$/, ); const { search, ...facts } = section; assert.deepEqual(facts, { diff --git a/integrations/claude-code-plugin/tests/prompt-pack.test.mjs b/integrations/claude-code-plugin/tests/prompt-pack.test.mjs index 753be6174f..df98775d3a 100644 --- a/integrations/claude-code-plugin/tests/prompt-pack.test.mjs +++ b/integrations/claude-code-plugin/tests/prompt-pack.test.mjs @@ -1023,8 +1023,12 @@ test("a pick worded high or medium is sent at a medium or high risk label, as it // The label bands the scores of the search, which ran before the pick model read the // candidates: its word about them is the later reading. Past the label only that word // stands behind the answer, and the reply proves one unit to be the model's: the first. - for (const word of ["high", "medium"]) - assert.deepEqual(sent(answer(word, risk)), results.slice(0, 1), `${word} ${risk}`); + for (const word of ["high", "medium"]) { + const block = pointerBlock(body, answer(word, risk), report, { topK: 4 }); + assert.deepEqual(block.pointers, results.slice(0, 1), `${word} ${risk}`); + // The page's other units, which the model read and may not have chosen, are not in the text either. + assert.doesNotMatch(block.text, /upload[234]/, `${word} ${risk}`); + } // the model says probably none of its picks is the place assert.deepEqual(sent(answer("low", risk)), [], risk); // No word, or a value that is none of the three: no model read the answer, and the label gates it. @@ -1037,43 +1041,12 @@ test("a pick worded high or medium is sent at a medium or high risk label, as it // a confidence the caller names is a floor under every answer, a picked one included assert.deepEqual(sent(answer("high", "medium"), 0.6), []); // an answer the caller's confidence admits is sent as one the label admits: its first three - assert.deepEqual(sent(answer("high", "medium"), 0.5), results.slice(0, 3)); + for (const word of ["high", "medium"]) assert.deepEqual(sent(answer(word, "medium"), 0.5), results.slice(0, 3), word); assert.deepEqual(sent(answer("", "medium"), 0.5), results); // and it does not send an answer the pick worded low assert.deepEqual(sent(answer("low", "medium"), 0.5), []); }); -test("a picked page can hold units the model did not pick: past the label none of them is sent", () => { - const report = "why does the upload crash on an empty bucket name"; - const body = searchBody({ org: "o", namespace: "code-x" }, report, { topK: 4, token: "" }); - const unit = (name) => ({ path: `src/${name}.py`, start_line: 10, end_line: 14, symbol: name, kind: "function" }); - // The server serves the picks first and the rest of its ranking after them, and no field - // of the reply names how many picks there are or marks a unit as one. Here the model chose - // one unit. - const pick = unit("chosen"); - const ranking = ["ranked2", "ranked3", "ranked4"].map(unit); - const answer = (word, risk) => ({ - abstain: false, - retrieval_confidence: 0.5, - retrieval_risk: risk, - results: [pick, ...ranking], - pick_confidence: word, - }); - for (const word of ["high", "medium"]) { - for (const risk of ["medium", "high"]) { - const block = pointerBlock(body, answer(word, risk), report, { topK: 4 }); - assert.deepEqual(block.pointers, [pick], `${word} ${risk}`); - assert.doesNotMatch(block.text, /ranked/, `${word} ${risk}`); - } - // Where the label admits the answer, or a confidence the caller names does, the units - // after the first are sent on that gate, as they are with no pick. - const low = pointerBlock(body, answer(word, "low"), report, { topK: 4 }); - assert.deepEqual(low.pointers, [pick, ...ranking.slice(0, 2)], word); - const named = pointerBlock(body, answer(word, "medium"), report, { topK: 4, minConfidence: 0.5 }); - assert.deepEqual(named.pointers, [pick, ...ranking.slice(0, 2)], word); - } -}); - test("the cause sentence is the last line of a block built from a high pick, and of no other", () => { const report = "why does the upload crash on an empty bucket name"; const body = searchBody({ org: "o", namespace: "code-x" }, report, { topK: 4, token: "" }); diff --git a/integrations/codex-plugin/lib/pointers-status.mjs b/integrations/codex-plugin/lib/pointers-status.mjs index cb80ff358b..6838b16d3b 100644 --- a/integrations/codex-plugin/lib/pointers-status.mjs +++ b/integrations/codex-plugin/lib/pointers-status.mjs @@ -60,7 +60,7 @@ function searchedIn(entry, standing, search) { } return [ "PASS", - `${where}; ${read}; a prompt gets pointers when its own answer reads low, a bug report also when the server's pick words its answer high or medium`, + `${where}; ${read}; with \`LOOM_PROMPT_PACK_MIN_CONF\` unset a prompt gets pointers when its own answer reads low, a bug report also when the server's pick words its answer high or medium`, ]; } From 32eb4d00070a378bb227df92b32e9deee852a16e Mon Sep 17 00:00:00 2001 From: Lareb Zafar Date: Sat, 5 Dec 2026 06:36:53 +0530 Subject: [PATCH 13/13] The code index architecture page states the prompt hook's pick rule as the Claude Code page does On `high` or `medium` the hook sends at most the first three results, which open with the picks, or the first pick alone where only the word admits the answer. The page said it sends the picks, and the reply names no pick count. The sentence links to the Claude Code page's pick section, which holds the rule in full. Co-Authored-By: Claude Fable 5.2 Signed-off-by: Lareb Zafar --- docs/architecture/code-index-architecture.md | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/docs/architecture/code-index-architecture.md b/docs/architecture/code-index-architecture.md index f25cef60e3..b6c0f6e9ec 100644 --- a/docs/architecture/code-index-architecture.md +++ b/docs/architecture/code-index-architecture.md @@ -790,9 +790,12 @@ word for how sure it is: of them. Saturation spreads the units after the last pick. - **`pick_confidence`** in the reply is the model's word: `high` when it is confident its first pick is a definition the fix changes, `medium` when one of its picks - probably is, `low` when probably none is. The coding-agent plugins' prompt hook - sends the picks on `high` or `medium`, nothing on `low`, and a reply with no word as - any other answer. The word is of the + probably is, `low` when probably none is. On `high` or `medium` the coding-agent + plugins' prompt hook sends at most the first three results, which open with the + picks, or the first pick alone where only the word admits the answer; it sends + nothing on `low`, and a reply with no word as any other answer + ([the hook's rule](../features/integrations/claude-code.md#model-picked-pointers-for-a-bug-report)). + The word is of the ranking the pick handed on, its first pick first: a reply whose first result is another unit (a history anchor, or a request's `exclude_unit_ids`, `min_fan_in` or `sort_by: "fan_in"`) carries none, with or without a pick, and neither does a later