Skip to content

tools: context_pack.py, issue -> path:start-end pointers from the self-scan DB (Part of #5521) - #5532

Merged
squid-protocol merged 1 commit into
mainfrom
churn/5521-20261018T2034Z
Oct 18, 2026
Merged

squid-protocol merged 1 commit into
mainfrom
churn/5521-20261018T2034Z

Conversation

@squid-protocol

Copy link
Copy Markdown
Owner

Part of #5521 (promoter-bot wiring is a follow-up, not this PR).

What

tests/tools/context_pack.py <issue> [--db] [--max-tokens 3000] [--body-file F]: extracts paths, backticked identifiers and snake/camelCase names from the issue, resolves them against file_data / function_data / class_data, and prints a Markdown block: path:start-end, complexity, one hop of callers/callees from fcall_data, import fan-in from edge_data, "BIG, read only the named ranges" above 8k tokens. Nothing resolved -> prints nothing. Names shorter than 4 chars and bare extensions are ignored; a name defined in >4 places only counts when the issue names the file; an issue word equal to a languages/<x>.py stem points at that file.

Docs fixed: self-scan-orientation.md (brief lives on generated; start_line exists), self_scan.py docstring, self-scan-query SKILL.md ("no line numbers").

Hit rate (11 recent merged churn PRs, DB at current main, 0.03-0.24 s each, packs 80-250 tokens)

Source/test file the merged PR changed appears in the pack: 6/11 PRs (any file); 3/5 PRs that changed source files had >=1 source file named (#5465->glsl.py, #5467->detector.py + statistical_auditor.py). Misses are mostly epics ("Part of #N") whose bodies name no code, so the tool has nothing to resolve: this is a ceiling set by issue text, not a ranking issue. The acceptance asks for 5 closed churn issues each naming the changed files; on this sample that is met only by #5467 and #4048, so the criterion is NOT shown as met for the general case.

Class sweep

Class: "ways a worker finds the code from an issue". Handled: explicit path, function name, class name, language-stem word. Sibling gaps: none filed by me; see Remaining slices.

Remaining slices

  • promoter-bot wiring into churn worker prompt.md (separate repo; follow-up issue/PR not yet filed).
  • Delta-mode briefs written to worktrees report "0 analyzed artifact(s), 0 LOC": not investigated (5-file limit).
  • Per-commit DB refresh before worker launch (self_scan.py delta mode) is orchestrator-side.
  • Weak spot: epics naming no code; could fall back to the last PRs that referenced the epic (git log --grep).

Gates

pr_gates --fast 6/6 pass; test_context_pack.py 8 pass; tree-guard tests pass; audit_check mypy lists 16 findings all in untouched files (shared venv mypy), none in changed files.

🤖 Generated with Claude Code

…om the self-scan DB (Part of #5521)

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@squid-protocol squid-protocol added the shepherd:merge Maintainer: merge when green (auto-merge, squash). Guide: docs/ci.md label Oct 18, 2026
@squid-protocol

Copy link
Copy Markdown
Owner Author

No description provided.

@squid-protocol
squid-protocol marked this pull request as ready for review October 18, 2026 20:47
@squid-protocol
squid-protocol enabled auto-merge (squash) October 18, 2026 20:51
@github-actions

Copy link
Copy Markdown
Contributor

🐦‍⬛ Muninn Security Scan

✅ No security issues found.

🐦‍⬛ Powered by Muninn · Skald Lab

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

shepherd:merge Maintainer: merge when green (auto-merge, squash). Guide: docs/ci.md

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant