Repository navigation
Open
Labels
enhancementNew feature, sensor, or structural signatureperformancepriority: lowUI tweaks, documentation, and minor optimizationsscope:infraCI, tooling, churn/factory, docs infrastructure
Milestone
Description
Why
A cost audit of nyx's churn workers (2026-10-18, 16 worker sessions, 10 merged PRs at ~$2/PR) found:
- Workers get only the issue number and title. Each one finds the code itself, taking 5-14 grep/
sed -nrequests before its first edit. Orientation accounts for ~45% of worker spend, though most of that is the fixed ~40k-token starting context that every request re-reads. - Whole-file reads are the main trap.
gitgalaxy/core/detector.pyis ~135k tokens, and seven files are over 60k tokens each. The golden-master JSON fixtures run up to 606k lines. - The self-scan already has what is needed to point a worker straight at the code, but nothing turns it into a per-issue slice:
- The master DB's
function_datahasstart_line,loc, complexity, fan-in/fan-out andtoken_mass. fcall_dataholds the resolved call graph andedge_datathe import edges.file_datahastoken_mass, churn and blast radius.- The existing LLM brief (
_llm.md) is ~137 KB (~34k tokens), too big to inject.
- The master DB's
What
Add a tool, e.g. tests/tools/context_pack.py <issue> [--db docs/self_scan/gitgalaxy_master.db] [--max-tokens 3000]. Given an issue, it would:
- Pull out the paths, file names, function, class and symbol names, and backticked identifiers named in the issue body and title (
gh issue view --json title,body). - Resolve them against the master DB (
file_data,function_data,class_data). Fuzzy-match bare names and rank matches by how often they are mentioned. - For each hit, emit
path:start-end(fromstart_line+loc), complexity and token size. Add one hop of callers and callees fromfcall_data, each with its ownpath:start-end, and import fan-in fromedge_data. - Flag large files (
token_mass> 8k, asdev_agent_firewalldoes) with "read only the named ranges". - Print a Markdown block capped at about 1-3k tokens that a worker brief can include verbatim. If nothing resolves, print nothing; never pad.
Freshness: keep one DB per origin/main commit (tests/tools/self_scan.py already does delta mode, ~6-8 s; a full scan is ~1.5 min). Run the pack before the worker launches, so a stale DB is off by at most the commits since the last refresh. Line ranges are hints and the worker still reads the code.
Integration (separate PR in squid-protocol/promoter-bot): churn worker runs the tool and adds its output to prompt.md under "Where to look". That is a few lines once the tool exists.
Related cleanups found during the audit
CLAUDE.md:103points agents atdocs/gitgalaxy_architecture_brief.md. That file moved to thegeneratedbranch, so a local checkout has nothing there.docs/agents/self-scan-orientation.mdsays the DB "has no line numbers". That is stale:function_data.start_lineis populated.- Delta-mode briefs written into worker worktrees (e.g.
churn-5464_galaxy_llm.md) report "0 analyzed artifact(s), 0 LOC". Either fix them or stop writing them.
Acceptance
-
context_pack.pyproduces a pack of 3k tokens or less for at least 5 recent closed churn issues, and for each one the pack names the file(s) the merged PR actually changed. Show the hit rate in the PR body. (context_pack: --eval hit rate against merged PRs (Part of #5521) #6354) - Unit tests on a small fixture DB: exact path, bare function name, class name, no matches (empty output) and the token cap. (context_pack: epic fallback via earlier PRs; test_galaxyscope stops writing 0-LOC briefs (Part of #5521) #6145)
- Runs in under 10 s against an existing DB. It needs no network access apart from
gh issue view, and it accepts--body-filefor offline use. (context_pack: epic fallback via earlier PRs; test_galaxyscope stops writing 0-LOC briefs (Part of #5521) #6145) - The doc fixes above. (context_pack: epic fallback via earlier PRs; test_galaxyscope stops writing 0-LOC briefs (Part of #5521) #6145)
- Follow-up issue or PR filed on promoter-bot to wire it into
churn worker.
Metadata
Metadata
Assignees
Labels
enhancementNew feature, sensor, or structural signatureperformancepriority: lowUI tweaks, documentation, and minor optimizationsscope:infraCI, tooling, churn/factory, docs infrastructure
Activity
tools: context_pack.py turns an issue into path:start-end pointers fr…
squid-protocol commentedon Oct 19, 2026
Churn run
5521-20261019T0924Z(host nyx) ended without a PR. Nothing to do: slice 1 had already merged in #5532. The remaining slices are noted on the issue, which stays open.🤖 Generated with Claude Code
context_pack: earlier PRs for the issue; test_galaxyscope writes no a…
squid-protocol commentedon Oct 23, 2026
#6145 merged: a partial slice of [c:530ba3ea] "
context_pack.pyproduces a pack of 3k tokens or less for at least 5 recent closed churn issues, and for each one the pack names the file(s) the merged PR actually changed. Show the hit rate in the P"; left: 17/24 (71%) hit rate shown above; the criterion asks that each of >=5 issues name the changed files, which holds for a minority (e.g. #5736, #4707, #5168) and not for all. (promoter-bot)squid-protocol commentedon Oct 23, 2026
#6145 merged: a partial slice of [c:8c9805b3] "Follow-up issue or PR filed on promoter-bot to wire it into
churn worker."; left: promoter-bot wiring not filed (worker may not file issues); listed as a remaining slice. (promoter-bot)Regenerate docs_read_by_tests.txt for the new context_pack tests (Par…
context_pack: no literal docs/ prefix (it made every doc a test-read …
context_pack: --eval hit rate against merged PRs (Part of #5521) (#6354)
docs: how churn worker wires in context_pack.py (Part of #5521) (#6533)
squid-protocol commentedon Oct 24, 2026
#6533 merged: a partial slice of [c:8c9805b3] "Follow-up issue or PR filed on promoter-bot to wire it into
churn worker."; left: the promoter-bot issue/PR itself is still to be filed; workers may not file issues or edit other repos. (promoter-bot)squid-protocol commentedon Oct 25, 2026
Churn run
5521-20261025T2331Z(host nyx) ended without a PR. No gitgalaxy change; remaining item is promoter-bot wiring of context_pack.py into churn worker (outside worker scope, owner/tick side). Other 4 boxes ticked.