Skip to content

The prompt hook sends a bug report's first pick at a medium or high risk label when the pick model words the answer high or medium - #2172

Merged
zlareb1 merged 14 commits into
mainfrom
fix/picked-answer-passes-risk-gate
Dec 5, 2026
Merged

zlareb1 merged 14 commits into
mainfrom
fix/picked-answer-passes-risk-gate

Conversation

@zlareb1

@zlareb1 zlareb1 commented Dec 4, 2026 •

Copy link
Copy Markdown
Member

Related: #2105

Changelog category (leave one):

  • Improvement

Changelog entry (one or two sentences a user of Loom can read without the diff; the release pull request collects these into the release notes):

For a bug report whose server pick is worded high or medium, the Claude Code and Codex plugins' prompt hook sends the first pick where the index labels the answer medium or high risk; that label used to drop the answer. A pick worded low, an answer with no pick word, an abstention and a set LOOM_PROMPT_PACK_MIN_CONF keep their rules.

Why

For a bug report the hook asks code.search for the listwise pick. The server's pick model reads one line for each of the first 100 ranked units against the report, puts the definitions it would change first and says one word, pick_confidence. The hook then held the answer to three gates in a row: the word (low sends nothing), the index's risk label (anything but low sends nothing) and the place test on the first pick.

The label and the word judge the same answer at different times. retrieval_risk bands retrieval_confidence, which is computed from the scores of the search, before any model reads a candidate. The pick model has read the candidates against the report when it says high or medium, so its word is the later reading and the one made with more of the evidence. Holding that answer to the earlier reading dropped picks the model stood behind. It did so most where the label says least: a code namespace nobody calibrated, and a search whose vector leg did not run, which reads medium for every answer.

The change is in accept and pointerBlock (lib/prompt-pack.mjs). accept takes picked, and with no confidence named a picked answer passes without the label being read. pointerBlock caps an answer that passes that way at one unit.

What is sent past the label: the first pick, alone. The server serves the picks first and the rest of its ranking after them (_pick_units). No field of the reply names how many picks there are and no unit is marked as one. The score_explanation text does hold a count (rerank=pick(<word>, picks=<n>)), but it is taken before the server gives each definition one slot and cuts the page at top_k (_diversify), so the first n units of a page are not always the n picks. The model may pick one unit and say high, and then the second and third units of the page are ones it read and did not choose. At a low-risk label those units go out on the label, as they do with no pick. At a medium or high label nothing stands behind them: the label does not admit them and the model's word is not about them. The reply proves one unit to be a pick, the first: the server clears the word on a page that opens with another unit. So an answer that only the word admits sends that unit and no other. A medium answer says one of its picks probably is the place, not that the first is; it is cut to the first as well, because the first is the only pick the reply identifies.

What counts as a pick word. pick_confidence is exactly the string high or medium. pointerBlock already used that test to choose the picked rules of places (the first pick decides), so one condition selects both. low sends nothing, as before. Every other value is no word. When no pick answered (no pick model, a call skipped, cut, failed or refused, a page whose first unit is not the pick's first) the reply carries no pick_confidence field. The hook reads an empty string, and a string that is none of the three, the same way as the absent field. An answer with no word keeps its gate: the label, or LOOM_PROMPT_PACK_MIN_CONF when that is set.

Design calls:

  • An abstention sends nothing, whatever word the reply carries. The server decides abstain apart from the confidence, and the hook reads that flag before the label.
  • A set LOOM_PROMPT_PACK_MIN_CONF is a floor under a picked answer too. The operator named that number for every answer. The alternative, letting a picked answer pass a named confidence, would make the setting gate only answers with no pick and would leave no way back to the old rule without a new setting. As written there is one: LOOM_PROMPT_PACK_MIN_CONF at the deployment's low-risk cut-off (LOOM_CODE_SEARCH_LOW_RISK_FROM, 0.7 by default) holds every answer to the label's band again.
  • The count in score_explanation is not read. It is free text, and it counts the picks before the page is ordered and cut, so it does not say which units of the page are picks. A field that marks the picks of the page would let the hook send every pick past the label. That is a new response field, with its SDK tables and a server release the hook would wait for. This change needs neither and sends what today's reply can prove. Such a field can follow on its own.
  • No new setting.

Scope and risk

  • Touches the gate and the cap of the prompt hook's pointer block (accept, pointerBlock), the comments and documentation that state them, the generated Codex copy, and the two plugin manifests.
  • Two more texts stated the old rule and now name the pick: the last sentence of the pointers line of /loom:loom-status (lib/pointers-status.mjs, with its test's pinned string, and the bullet of docs/features/integrations/claude-code.md that paraphrases it), which now opens with the unset LOOM_PROMPT_PACK_MIN_CONF the rule holds under, and the comment on LOOM_CODE_SEARCH_LOW_RISK_FROM in server/settings/catalog.py, from which docs/reference/configuration.md, schemas/loom-settings.schema.json and loom.example.yaml are generated.
  • docs/architecture/code-index-architecture.md states the hook's rule in one sentence beside pick_confidence. It now reads as the pick-word table of the Claude Code page does and links to that section.
  • Leaves alone: the place test, the low rule, the cause sentence's own rule (high only), the request the hook sends, what the server does (only that one setting's comment changes), and the SDK pointer helpers. The SDK helpers never ask for the pick: they send rerank: "none", or with server defaults name no reranker, and a deployment's default reranker is never the pick. So they get no pick word, and they do not read the field; the shared fixture integrations/claude-code-plugin/tests/fixtures/pointer-block.json is unchanged and all three renderers still pass every case.
  • What changes for a session: a bug report in an index whose answer reads medium or high now gets one pointer, the first pick, and the cause sentence under a high pick, where it got nothing. A wrong first pick the model worded high or medium reaches the session there; the label hid it before. The block still calls its lines candidates to check, and a first pick that fails the place test still sends nothing.
  • The cause sentence is written from the first three picks of the reply, so under a one-pointer block it can name a definition that has no pointer. It already could: a pick that fails the place test has none. The pages say so.
  • Not changed: at a low-risk label, and at a named confidence the answer meets, a picked answer still sends its first three results, which can hold units the model did not pick. That is main's behaviour, and there the label or the operator's number admits them.
  • For a bug report about code the index does not hold, the label was a second guard. The guards left are the server's abstention and the pick model saying low. The tests here hold the rule; how often the model's word is right is a property of the server's pick model and is not something a unit test shows.
  • Hooks in a user's session: no new request and no longer wait. The search and the pick were already made and waited for on these prompts; only what is printed for the reply changes.
  • tests/unit/session_content_senders.json: the sha256 pins of hooks/loom-prompt-pack.mjs and lib/prompt-pack.mjs (both plugins) are renewed. Neither file's request builders changed, so nothing new is sent.
  • Three tables (the plugin README's hook table, the hook table and the pick-word table in docs/features/integrations/claude-code.md) are re-aligned by the formatter: one cell in each grew.

Compatibility, rollout and rollback

  • Wire: none. No op or field is added, changed or removed. The hook reads pick_confidence and retrieval_risk as the server already serves them, so the change needs no server release.
  • Operator steps: none.
  • Rollback: revert the commit. Nothing is stored. Without a revert, LOOM_PROMPT_PACK_MIN_CONF set to the deployment's low-risk cut-off keeps the label's band as the gate for every answer. Both manifests go to 1.2.181; 1.2.179 and 1.2.180 are held by open pull requests.

Tests

The first commit holds the tests alone, and they fail on main's code: four tests, each with a high or medium pick at a medium or high label that sends nothing. The one-pointer rule came from review: its tests are a commit of their own too, and fail on the commit before them, which sent three.

  • tests/prompt-pack.test.mjs
    • accept: a picked answer passes at a medium and a high label; an abstention, an empty answer and a named confidence above the answer's still refuse it.
    • pointerBlock, at both labels: high and medium send the first unit alone, and the block's text names none of the page's other units; low sends nothing; no word ("", an absent field, a string that is none of the three) sends nothing; a first pick that fails the place test sends nothing under either word. An abstention carrying high sends nothing. With a confidence named, a picked answer under it sends nothing, one at it sends its first three under either word, an answer with no word at it sends every result, and an answer the pick worded low sends nothing at a confidence that passes.
    • The cause sentence is printed under the one pointer of a high pick at a medium label, and not for an abstention.
  • tests/prompt-pack-hook.test.mjs runs the hook process against a local server with a two-unit reply: at both labels a bug report whose reply says high or medium gets the first unit and not the second; low and no word print nothing; at a low label the second unit is printed too; LOOM_PROMPT_PACK_MIN_CONF=0.6 over a reply at 0.5 prints nothing.

What I ran:

node --test --test-concurrency=2 integrations/claude-code-plugin/tests/*.test.mjs   # 1257 tests: 1250 pass, 7 skipped, 0 fail
node --test integrations/grep-shim/tests/*.test.mjs integrations/cline/tests/*.test.mjs   # 47 tests, 0 fail
LOOM_ENV_FILE= .venv/bin/python -m pytest tests/unit/test_sdk_pointer_block.py tests/unit/test_session_content_senders.py \
  tests/unit/test_codex_plugin.py tests/unit/test_plugin_code_query_contract.py tests/unit/test_agent_instructions.py \
  tests/unit/test_doc_links.py tests/unit/test_public_copy.py tests/unit/test_release_prepare.py \
  tests/unit/test_settings_reference.py -q -n auto   # 782 passed
LOOM_ENV_FILE= make format lint typecheck                                 # clean; the Codex copy and the settings outputs are current
  • At node's default file concurrency, and four files at a time, the same set failed one timing test of file-context-read.test.mjs ("a server that never answers holds a read for the lookup bound") on my machine, which was busy with other work. This change touches neither that file nor the hook it runs. The file passes alone, and the whole set passes two files at a time, the run above.
  • claude plugin validate integrations/claude-code-plugin --profile directory --strict fails on my machine's CLI (2.1.337) with one warning about the plugin's bin/ folder, which this change does not touch; claude plugin validate . passes.
  • The last commit changes one documentation page. After it I ran the pytest line, make format lint typecheck and the two prompt-pack test files again; the full node set ran on the commit before it.
  • Not run locally: the TypeScript SDK's tests (no SDK file and no fixture changed), the full unit suite and the integration suite. CI runs them.

AI assistance in the code (leave one; writing this description with AI is fine):

  • AI-generated (an agent wrote most of the diff): Claude Code. I read every caller of accept, the server code that sets and clears pick_confidence, and each documentation line that stated the old rule, and ran the checks above.

  • I can explain every line of this diff and how it interacts with the rest of Loom.

Checklist

  • Local format, lint, type checks and focused tests pass. The full make test-unit and applicable integration results are reported by CI; a full local run is not required before pushing.
  • Generated files are regenerated in this PR, not by hand: the SDK op tables, docs/reference/configuration.md and the docs/reference/ tables (python scripts/codegen/docs_reference.py), the reach manifest, schemas/schema.sql (make schema-dump), the Codex plugin copies (python3 scripts/codegen/agent_plugin_sync.py) and the standalone skill bundles (python3 scripts/codegen/standalone_skills.py).
  • A new migration is additive and numbered after the latest on main; no merged migration is edited. (No migration.)
  • A behaviour change to any file a plugin ships (hooks/, lib/, bin/, skills/, .mcp.json, the Codex plugin-defaults.json) bumps both plugin manifests' version, and no other open PR uses that version.
  • The frontend builds (npm --prefix frontend run build) and its tests pass, if frontend/ changed. (Not changed.)
  • Docs under docs/ describe the system as it now is, and this description names any operator steps and wire changes.
  • Repository text has no dates, people, host names, internal namespaces, ticket or decision numbers; the history goes in this description (tests/unit/test_public_copy.py).
  • Commits are signed off (git commit -s), as CONTRIBUTING.md asks.
  • I signed the Contributor License Agreement (CLA) if CLA assistant requested a signature.

🤖 Generated with Claude Code

zlareb1 and others added 2 commits December 5, 2026 01:31
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 <noreply@anthropic.com>
Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
… 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 <noreply@anthropic.com>
Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
@vercel

vercel Bot commented Dec 4, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
loom-docs Ready Ready Preview Dec 5, 2026 1:11am UTC
loom-telemetry Ready Ready Preview Dec 5, 2026 1:11am UTC

Request Review

zlareb1 and others added 5 commits December 5, 2026 02:19
…-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 <lareb.zafar@clickhouse.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
… 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 <noreply@anthropic.com>
Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
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 <noreply@anthropic.com>
Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
…k 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 <noreply@anthropic.com>
Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
@zlareb1 zlareb1 changed the title The prompt hook sends a bug report's picks at any risk label when the pick model words them high or medium The prompt hook sends a bug report's first pick at a medium or high risk label when the pick model words the answer high or medium Dec 4, 2026
zlareb1 and others added 7 commits December 5, 2026 03:38
…n 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 <noreply@anthropic.com>
Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
… 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 <noreply@anthropic.com>
Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
…s 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 <noreply@anthropic.com>
Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
… 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 <noreply@anthropic.com>
Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
…mment 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 <noreply@anthropic.com>
Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
…, 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 <noreply@anthropic.com>
Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
…s 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 <noreply@anthropic.com>
Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
@zlareb1
zlareb1 merged commit 8c9e1dd into main Dec 5, 2026
90 of 93 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant