Repository navigation
A pointer block lists the first-ranked file's place first - #2104
Merged
Merged
Conversation
The places of a search answer were listed by the rank of the unit sent for each. A long class ranked first is sent as a method the answer holds inside it, and a first result that is no place (a file's leading comments) is sent as nothing, so a unit of another file ranked between them took the first line of the block although the first-ranked file had a place in it. `places` in the prompt hook's library, its Codex copy and the Python and TypeScript SDK helpers moves the first place in the first result's file to the front after the place rules ran. The other places keep rank order, as all do when that file has no place. A picked answer keeps the order its model chose. The pointers sent are the same unless the place moved to the front ranked below the count, where it takes the last one's line. The request is unchanged. Plugin 1.2.165. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
Both plugin manifests keep 1.2.165, above the 1.2.162 main holds. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
A picked answer kept rank order, on the reason that its model chose the order. The model chose the first result, not the unit the place rules send for it: a first pick that is a long class is sent as a method ranked lower, and a unit of another file between them was listed first. That is the case the rule fixes for an unpicked answer, so `places` now applies it to both. The pointers of a picked answer are the same ones: its results are cut to the cap before the rules run. The comment on `places` in the four copies states the order once, and `test_an_issue_gets_the_places_it_is_about` asserts the rule as it is: the first place of the first result's file, then the others in rank order. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
"The first place in the file" could be read as the place on the earliest line. The rule takes the place the index ranked highest in that file. The three doc pages, the comments on the four copies of the rule and the SDK test comment now say so, and a shared fixture case holds the four copies to it: of two places in the first-ranked file, the higher-ranked one is listed first though it starts on a later line. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
The test line under the pointers is for the first listed pointer whose definition the prompt names (`checkPointer`), so it follows the order `places` lists. With the first result's file leading, a prompt that names a definition in each of two files gets the test of the first result's file where it got the test of the file whose unit ranked higher. A prompt carries one test line, so the other file's test is not named with it; the test gate names it when the session edits that file. No test had an answer with two named pointers. The new case in `prompt-pack-hook.test.mjs` sends a first result that is no place, a function of another file and a function of the first file: the first file's function is listed first and the line names its test. The same answer without the leading result lists the other file first and names that file's test. With `places` of `main` the first assertion fails: the other file is listed first and its test is named. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
…thing The answer of test_an_issue_gets_the_places_it_is_about cannot trigger the lead rule, so its assertion is the one-line order check again; the shared fixture cases hold the rule. The hook test names its two block lines after the pointers they are. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
Its assertion sat inside the test of another rule, and the unpicked assertion beside it repeated a shared fixture case. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
zlareb1
added a commit
that referenced
this pull request
Dec 3, 2026
Main took plugin 1.2.165 (#2104) and another open PR now holds 1.2.167; both manifests move to 1.2.169, which no open PR uses. The sender pins are renewed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related: #2015
Changelog category (leave one):
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):
The code pointers a prompt gets list the highest-ranked place in the first search result's file first, in the plugins' prompt hook and the Python and TypeScript SDKs. Plugin 1.2.165.
Why
places()listed the pointers by the rank of the unit sent for each. Three of its own rules move a file's pointer down from the rank the search gave the file:In all three, the file the search ranked first had a place in the block and was not on its first line.
places()now runs its rules as before and then moves the first of the chosen places whose path is the first result's path to the front. The other places keep rank order.The rule holds for a picked answer (
LOOM_PROMPT_PACK_PICK) as for any other. Its model chose the first result, not the unit the place rules send for it: a first pick that is a long class is sent as a method ranked lower, and another file's unit between them was listed first. The pointers of a picked answer are the same ones in the new order: its results are cut to the cap before the rules run.Two limits keep the rule narrow:
Scope and risk
places()inintegrations/claude-code-plugin/lib/prompt-pack.mjs, its Codex copy,_placesinsdk/python/loom/pointers.pyandplacesinsdk/typescript/src/pointers.ts: three lines at the return of each JavaScript and TypeScript copy, four in Python. The four shareintegrations/claude-code-plugin/tests/fixtures/pointer-block.json, whose cases each one's tests run.docs/guides/issue-code-pointers.md,hooks/HOOKS.mdanddocs/features/integrations/claude-code.md.searchBody,top_k, the token budget), the hook file,isPlace,pickHolds, the pick request, the block's lead line and shape, the cap of three, the SDK signatures and the server.checkPointer), so it follows the new order. A prompt that names a definition in each of two files gets the test of the first result's file where it got the test of the file whose unit ranked higher. A prompt carries one test line, so the other file's test is not named with it; the test gate names it when the session edits that file.places()in all copies. Whichever lands second merges by hand. Under its rule (the first pointer only, when the prompt names none of them) this order decides which pointer is kept.Compatibility, rollout and rollback
Tests
Five cases added to
integrations/claude-code-plugin/tests/fixtures/pointer-block.json, run by the plugin's tests,tests/unit/test_sdk_pointer_block.pyandsdk/typescript/src/pointers.test.ts:One test added to
prompt-pack.test.mjs: in a picked answer, a first-ranked long class, another file's function and a method of that class list the method first. The first fixture case holds the same for an unpicked answer.One case added to
prompt-pack-hook.test.mjs, run through the hook: a prompt names a definition in each of two files that each have one test, and the answer is a first result that is no place, the other file's function, then the first file's function. The first file's function is listed first and the test line names its test; the same answer without the leading result lists the other file first and names that file's test. Withplaces()ofmainthe first assertion fails: the other file is listed first and its test is named.test_an_issue_gets_the_places_it_is_aboutintests/unit/test_sdk_pointer_block.pykeeps its rank-order assertion: the lead rule moves nothing in its answer. Only its comment changed.Before the change, with
sdk/python/loom/pointers.pyandlib/prompt-pack.mjsofmainunder the tests of this branch:tests/unit/test_sdk_pointer_block.pyfails the first, second, fourth and fifth new fixture case (4 failed, 97 passed), andnode --test integrations/claude-code-plugin/tests/prompt-pack.test.mjsfails its shared-fixture test and the new picked-answer test (2 of 34). The third case passes before and after: it pins that the rule does not walk on to the next file. The TypeScript suite was first run after the change.After the change:
node --test integrations/claude-code-plugin/tests/prompt-pack.test.mjs integrations/claude-code-plugin/tests/prompt-pack-hook.test.mjs: 123 pass.pytest tests/unit/test_sdk_pointer_block.py tests/unit/test_session_content_senders.py tests/unit/test_agent_instructions.py tests/unit/test_doc_links.py tests/unit/test_public_copy.py tests/unit/test_codex_plugin.py tests/unit/test_plugin_code_query_contract.py: 655 pass.npm --prefix sdk/typescript run check: 792 tests pass, no type errors.npm --prefix sdk/typescript run check:distran beforemainwas merged in.make format,make lint(every generator's--check, the Codex copy included) andmake typecheck: pass.claude plugin validate integrations/claude-code-plugin --profile directory --strictandnode --checkon both copies ofprompt-pack.mjs: pass.node --test integrations/claude-code-plugin/tests/*.test.mjs: 1,148 pass and 7 skip beforemainwas merged in. On the pushed head one run gave 1,150 pass, 7 skip and one failed timing test offile-context-read.test.mjson a loaded machine; that file passes when run alone and does not callplaces().Not run locally, left to CI: the full unit suite, the Python SDK wheel steps and the integration suite. No benchmark was run and no provider was called.
make formaton the merged head also rewraps one line offrontend/src/views/assistant/Chat.test.tsx, a file this pull request does not touch. That change is not included here: theformatcheck fails on that line onmaintoo, and #2107 formats it.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. The agent wrote the fixture cases, saw them fail, made the change in the four copies and ran the checks above; no human has reviewed the diff yet.
I can explain every line of this diff and how it interacts with the rest of Loom.
Checklist
make test-unitand applicable integration results are reported by CI; a full local run is not required before pushing.docs/reference/configuration.mdand thedocs/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).main; no merged migration is edited.hooks/,lib/,bin/,skills/,.mcp.json, the Codexplugin-defaults.json) bumps both plugin manifests' version, and no other open PR uses that version.npm --prefix frontend run build) and its tests pass, iffrontend/changed.docs/describe the system as it now is, and this description names any operator steps and wire changes.tests/unit/test_public_copy.py).git commit -s), as CONTRIBUTING.md asks.🤖 Generated with Claude Code
Note
Medium Risk
Reordering can surface a wrong-file pointer first when retrieval ranks the wrong file at #1; cap can drop the last pointer if the promoted one was below the limit.
Overview
Code pointer blocks now lead with the first search hit’s file. After the existing place-selection rules (
places()/_places), the highest-ranked pointer whose path matches the first search result’s file is moved to the top of the list. Other entries keep index rank order; if that file has no place, ordering is unchanged.The same logic ships in Claude Code and Codex
prompt-pack.mjs, Pythonloom/pointers.py, and TypeScriptpointers.ts. Docs and hook copy describe the new ordering. Plugin version is 1.2.165. Shared fixture cases and hook/SDK tests cover long-class-as-method, non-place first results, cap overflow, and pytest test-line attachment following the first listed named pointer.Reviewed by Cursor Bugbot for commit 02f23d4. Bugbot is set up for automated code reviews on this repo. Configure here.