Repository navigation
Description
Priority / sequencing
P1 / priority: next. Child of #508. Lands after #512, which ships sumo_qa_load_skill_context(mode="bundle") and wires it into reviewing-before-merge only.
Suggested labels
- tooling
- ux
Roadmap fields
Status: In review; Priority: P1; Size: L; Order: 1; Depends on: none
Problem
#512's acceptance criterion "a routed skill obtains its working context in one tool call" is met for sumo-qa-reviewing-before-merge only. The other routed skills still chain separate loader calls (load_standards, load_rules, load_techniques, load_principles, load_skill_context), and #512 measured that chained loader calls are the main session-token multiplier because every extra turn re-sends the whole conversation.
The bundle today carries the body, modules, classification entries and filtered standards and rules. It cannot carry techniques or principles, which most of the remaining skills need.
Expected outcome
Every routed skill gets its working context in one call after routing, so a QA workflow reaches its first real output in fewer turns, with no loss of answer quality.
Scope
- First, re-check the premise. On a real review of fix(repo-map): resolve src-layout Python imports and add Python/Java import-edge fixtures #790 with haiku, the bundled review context cost about 6% more tokens than the per-loader path with the same number of calls (measurement on [Task]: Make session bootstrap conditional, collapse skill-loading turns, and enforce context token budgets #512). Before wiring more skills, measure one representative workflow per skill family, per-loader vs bundled, with
compare-mcp-versions --review-mode. Wire a family only where the bundle is equal or cheaper, or where it fixes a measured loss of answer quality. - Add a
catalogues=parameter to bundle mode so it can include techniques and principles, each part byte-identical to its single loader. - Wire the bundle into:
preparing-for-work,creating-test-plan,security-testing,strategising,answering-testing-question,implementing-with-tdd,strengthening-tests. - Consider letting
deciding-approachhand off straight to a bundle call so the routed skill's body arrives in the same call. - SKILL.md changes authored through skill-creator.
- Extend the [Task]: Make session bootstrap conditional, collapse skill-loading turns, and enforce context token budgets #512 context-budget audit with each wired workflow's per-loader vs bundled call count.
Acceptance criteria
- A per-family before/after measurement decides which skills are wired, and the PR states the result for each family.
- Bundle mode accepts techniques and principles, and each part is byte-identical to the matching single loader.
- Each listed skill loads its working context in one call after routing.
- The audit reports per-loader vs bundled call counts for each wired workflow and fails its configured budgets.
- One real before/after session per wired skill family with the
compare-mcp-versionsharness shows equal or fewer turns and total tokens, or the PR states the measured regression and why it is accepted. - Promptfoo evals for each changed skill show no material regression (lift, not a loosened rubric).
Test plan
- Bundle parity tests for techniques and principles.
- Per-skill promptfoo eval, proportionate to the change.
- Before/after session measurement with
compare-mcp-versions. - Full Python suite.
Context
Split from #512 (the review skill and the bundle foundation land there). Related: #798, whose split skills deliver their modules through this bundle.
Activity
feat(context): compact the session bootstrap, bundle a routed skill's…
sumithr commentedon Oct 3, 2026
Premise re-check: per-loader vs bundled context, one representative workflow per skill family.
Setup:
compare-mcp-versions --review-mode, haiku, one run per family, an identical non-interactive prompt on both sides. Base is a clean copy of main at 99bf3ad. Candidate is the same tree with the router handing each routed skill one bundled call (body plus catalogues). Fixture: a fresh repo made fromtests/fixtures/repo_map/python_project.Reading: on haiku, single sessions are dominated by Read/Bash turns, and the router's handoff instruction was ignored in 3 of 5 runs, so one run per family is noisy at the ±20% level. Only the security family showed a saving attributable to the bundle, so only it is wired in the PR for this issue. The acceptance criterion "each listed skill loads its working context in one call" is therefore met for security-testing only, and this issue stays open for the remaining families pending repeat measurements.
fix(context): make the bundled security entry visible to conformance …
fix(conformance): count only successful bundle entries and apply the …
fix(conformance): read bundle errors from live tool results and toler…
sumithr commentedon Oct 3, 2026
Verification of PR #829 at head
abb46ad9cb0e4390797ca55a2fd3a3221cbb0b5e(merge-base 99bf3ad).Acceptance criteria, checked against the branch
src/sumo_qa/skill_manifest.py_CATALOGUE_LOADERS+_bundle;tests/test_skill_context_bundle.pyparity per catalogue; ledger rows 2 to 4 on the real serverskills/sumo-qa-deciding-approach/SKILL.mdhandoff line; ledger rows 6 and 7scripts/audit_context_budget.py+pyproject.tomlworkflow; ledger row 8Verification evidence
mutation.ymldispatch on the head, run 37160155382: "All modules: kill counts >= baseline and 0 survivors. Strict gate passed."sumo-qa-reviewing-before-mergeover all 19 files (origin/main...HEAD): SAFE, no high or medium findings. One low:docs/ARCHITECTURE.md:67andREADME.md:90list the bundle parts without catalogues (incomplete, not false)./code-reviewhigh: the full diff and every fix delta were reviewed during development (rounds 1 to 3 fixed real defects; the last delta round was clean). No fix was made in this pass.Behaviour ledger (branch wheel in a clean venv, driven by headless haiku through the MCP tools)
gh pr view 829 --json body+gh api .../issues/802/comments(measurement comment 5970662857,compare-mcp-versions --review-mode, haiku)catalogues="techniques"part byte-identical tosumo_qa_load_techniques(AC2)load_skill_context(skill_name="sumo-qa-security-testing", mode="bundle", include_body=false, catalogues="techniques"), call 2sumo_qa_load_techniques(); served texts compared from the stream-json tool_resultscatalogues="principles"part byte-identical tosumo_qa_load_principles(AC2)catalogues="principles")catalogues="classifications,approaches"parts byte-identical to their single loadersload_skill_context(..., mode="bundle", catalogues="techniques,widgets"){"error": "Unknown catalogue(s) ['widgets'].", "available_catalogues": ["approaches","classifications","principles","techniques"]}(159 chars); haiku: "8. Error: "Unknown catalogue(s) ['widgets']." Available catalogues: approaches, classifications, principles, techniques"using_sumo_qa->sumo_qa_deciding_approach-> [A2 only:load_classifications,load_approaches] ->sumo_qa_load_skill_context {"skill_name":"sumo-qa-security-testing","mode":"bundle","classification":"security_change","catalogues":"techniques"}; nosumo_qa_security_testingcall, no separate standards/rules/techniques loader. Bundle keys: body, classifications (security_change entry), standards, rules (security_change must_consider), catalogues.techniques; 17,910 chars, ~4,449 tokens. Answers use it: "state transition (ISSUED -> CONSUMED -> REVOKED)", "boundary value analysis", "decision table", token replay/expiry/tampering, account enumeration, rate limiting, residual risk (rules + techniques + skill step 3). Turns 4/6/4 vs main (A-main x3) 8/9/9, where main called the skill tool then 3 loaders.answering_testing_question->load_principles+load_techniques; C3/C4-pr:implementing_with_tdd->load_techniques). The #802 measurement showed no saving for these families.uv run --no-sync python scripts/audit_context_budget.pyin the PR worktree, then--configcopy with the security bundle budget set to 4000workflow security testing (per-loader) ... calls 8 re-sent 78101;bundle security testing 17910 chars 4478 tokens budget 4600;workflow security testing (bundled) ... calls 5 re-sent 43331;context budget: OK, exit 0. Tight config:bundle security testing ... 4000 OVER,FAIL bundle security testing: ~4478 est. tokens > budget 4000,context budget: FAILED, exit 1compare-mcp-versionssession per wired family shows equal or fewer turns and tokens (AC5)sumo_qa_security_testingtranscript_from_debug_dir(cap-A-pr)+validate_transcript(validator from the installed branch wheel), scenarioexpected_entry_skill=sumo_qa_security_testingcalls=[('using_sumo_qa', None), ('sumo_qa_deciding_approach', None), ('sumo_qa_load_skill_context', False)],passed: True violations: [](main's skill-tool capture also passes)catalogues="techniques,widgets", include_body true, output.json"error": true); also all of run B's capture[('using_sumo_qa', None), ('sumo_qa_deciding_approach', None), ('sumo_qa_load_skill_context', True)] passed: False [('wrong_skill_routing', "expected entry skill 'sumo_qa_security_testing' was never invoked"), ('first_hop_violation', "router chain broken: 'sumo_qa_security_testing' does not first fire after using_sumo_qa -> sumo_qa_deciding_approach")]; the same capture with the successful bundle instead passesrun-eval.shon the two changed skills' configs, worktree clean at abb46ad (seeevalsslot)/Users/SumithRamsookbhai/Desktop/repos/apo/sumo-qa-pr-829, a worktree of the real sumo-qa clone at the PR head, with its full history. The audit ran on the same worktree. The conformance captures are the realSUMO_QA_DEBUG_DIRoutput of those runs.sumo_qa-0.71.1-py3-none-any.whlbuilt withuv build --wheelfrom abb46ad and installed into a clean venv (sumo_qa.__file__=.../finish-829/venv-pr/lib/python3.14/site-packages/sumo_qa/__init__.py). The server ran viapython -m sumo_qawith a temp HOME. Each run:ENABLE_TOOL_SEARCH=false claude -p ... --model haiku --strict-mcp-config --mcp-config <cfg> --allowedTools mcp__sumo-qa --disallowedTools Bash Write Edit NotebookEdit Skill Agent --disable-slash-commands. Init tool lists held no Skill, Bash, Write or Edit.using_sumo_qa,load_classificationsandload_approachesoutputs: identical.sumo_qa_deciding_approachoutput: 33 diff lines, only the PR's intended edits (step 2 wording, step 8 "(security testing: via its bundle)", routing-table row, the catalogue-list handoff line, shortened red-flag rows). Routing outcomes: branch {no skill entered x1, answering_testing_question x1, implementing_with_tdd x2}; main {implementing_with_tdd x3, answering_testing_question x1}.eval-reuse-check.pyfirst: all three RERUN (no stored run of skill-deciding-approach.yaml; .ab: none of 21 stored runs matches HEAD, latest has no results; security-testing: none of 6 matches, cases and vars differ). Reran each once, ownPROMPTFOO_CONFIG_DIR,SUMO_EVAL_REPEAT=1: skill-deciding-approach eval-C6a-2026-10-03T23:04:005 passed (100%), exit 0; the checker now reportsREUSABLE: eval-C6a... 5/5 passed, inputs identical to HEAD. skill-deciding-approach.ab eval-ZWc-2026-10-03T23:04:0010 passed, 17 failed, exit 3, by leg:B - full skill (current) 9/9,A1 - catalogues only 1/9,A0 - no skill 0/9(controls are expected to fail). skill-security-testing eval-SRv-2026-10-03T23:04:005 passed (100%), exit 0; the known-flaky checklist case passed first time. The checker still says RERUN for .ab and security-testing on these fresh runs: it reads the controls' deliberately missingskill_content, and the classification-filtered rules/standards, as mismatches. Other configs: evals not run, because the diff feeds only these two skills (user rule: proportionate).Observations (not blockers):
load_classifications+load_approachescalls were skipped in 2 of 3 branch runs, against 0 of 3 on main. The routing was still correct, and the bundle carries thesecurity_changeentry.feat(context): bundle whole catalogues and enter security-testing thr…
fix(context): make the bundled security entry visible to conformance …
fix(conformance): count only successful bundle entries and apply the …
fix(conformance): read bundle errors from live tool results and toler…
fix(audit): validate the loaders, catalogues and handoff workflow key…
feat(context): bundle whole catalogues and enter security-testing thr…
fix(context): make the bundled security entry visible to conformance …
fix(conformance): count only successful bundle entries and apply the …
fix(conformance): read bundle errors from live tool results and toler…
fix(audit): validate the loaders, catalogues and handoff workflow key…
fix(audit): budget the full tools/list for the bundle's catalogues= p…
fix(router): fall back to the security-testing skill tool when its en…
sumithr commentedon Oct 5, 2026
Verification of PR #829 at head
602d3fb0de0bb52e65101b4c4960bd7377c65770Rebased onto main
36b90d14(merge-base). The PR head wasDIRTYagainst main: main's capability-profile gate (#826/#836/#845) and this PR both added a parameter toload_skill_context. Resolved by keeping both (profile=is passed by the server and kept out of the conformance capture args;catalogues=from this PR).Fixes made during this finish pass
c2ff77c6catalogues=adds 66. Core budget unchanged (9,261 of 9,400).602d3fb0errorfrom the security bundle, callsumo_qa_security_testing. Wording test on haiku (router SKILL.md as system prompt, a real oversize error envelope): without the clause 0 of 5 fell back (all 5 retried withinclude_body=Falseplusload_techniques, so the skill body never arrived); with it 4 of 5 called the skill tool, and the normal handoff still made the bundle call in 5 of 5. Compressed to fit the 3,510-token router budget (now 3,510).Review
sumo-qa-reviewing-before-mergeover every changed file's full post-change content vsorigin/main...HEAD(generatedtests/fixtures/mcp_tools_list_snapshot.jsonskipped: its regen script leaves the tree clean). Verdict SAFE, no material findings on the final head.src/sumo_qa/conformance.py,server.py,skill_manifest.py,scripts/audit_context_budget.py,scripts/live_first_hop.py,pyproject.toml,skills/sumo-qa-security-testing/SKILL.md, the five docs, the five test modules: SAFE, low findings only.skills/sumo-qa-deciding-approach/SKILL.md: one medium (no fallback when the entry bundle errors), fixed in602d3fb0, re-reviewed in full: SAFE, lows only./code-reviewhigh, round 1 on the rebase resolution and budget (c2ff77c6): the profile gate holds for bundles (a core-profile bundle for a gated skill returns only the capability error); one low finding. Round 2 onc2ff77c6..602d3fb0: wording-only findings, none blocking; stop rule applied. Open low notes, not fixed here:include_body=False; measured at 1 of 5 haiku reps.Acceptance criteria (#802), checked against the branch
_CATALOGUE_LOADERSinskill_manifest.py; parity tests intests/test_skill_context_bundle.py; ledger rows 1-2Refs)scripts/audit_context_budget.pysecurity workflow;tests/test_audit_context_budget.py; ledger row 6Behaviour ledger (4.7), observed on the real product surface
catalogues=techniques and principles (AC2)load_skill_context(skill_name="sumo-qa-security-testing", mode="bundle", include_body=false, catalogues="techniques"), thencatalogues="principles", thencatalogues="classifications,approaches"cataloguesobject with the named parts (results 6,327 / 3,664 / 7,266 chars); agent: "1. No error ... 7. No error"catalogues=part is byte-identical to its single loader (AC2)sumo_qa_load_<name>(); served texts compared from the stream-json tool_resultscatalogues[techniques] len=5926 sha=1fc37ec98f3a = load_techniques;principles len=3317 sha=b158d13d9f08;classifications len=3353 sha=4b39f2834faf;approaches len=3468 sha=343f7bf4b652; identical=True for all 4load_skill_context(..., mode="bundle", catalogues="techniques,widgets"){"error": "Unknown catalogue(s) ['widgets'].", "available_catalogues": ["approaches","classifications","principles","techniques"]}; agent: "8. Error: "Unknown catalogue(s) ['widgets']." Available catalogues: approaches, classifications, principles, techniques"using_sumo_qa->sumo_qa_deciding_approach->sumo_qa_load_skill_context {skill_name: sumo-qa-security-testing, mode: bundle, classification: security_change, catalogues: techniques}; no skill tool, no separate loaders. Bundle keys: body, modules, classifications, standards, rules (security_change: must_consider: - Token lifecycle (issue, refresh, rotate, revoke) - Replay protection ...), catalogues; 17,910 chars. Answers: A1 token lifecycle, enumeration, rate limit, expiry, replay (rules; no technique named); A2 boundary value, state transition, decision table, token lifecycle, replay, residual risk; A4 boundary value, state transition, decision table, equivalence, token lifecycle, residual risk. A 4th run (A3) invented tool names (mcp__sumo_qa__using_sumo_qa: "No such tool available"), never read the router and entered via the skill tool; not countedusing_sumo_qa->sumo_qa_security_testing->sumo_qa_load_standards {classification: security_change}->sumo_qa_load_rules {classification: security_change}->sumo_qa_load_techniques; answer: token lifecycle, enumeration, rate limit, expiry, replay, residual riskscripts/audit_context_budget.py; then--configcopies with (a) security bundle budget 4000, (b)handoff = "false", (c)loaders = " , "workflow security testing (per-loader) 54217 13555 - 8 78101;bundle security testing 17910 4478 4600;workflow security testing (bundled) 55212 13803 - 5 43331;context budget: OKexit 0. (a)FAIL bundle security testing: ~4478 est. tokens > budget 4000/context budget: FAILEDexit 1. (b)config error: context-budget workflow[3] handoff must be true or falseexit 2. (c)config error: context-budget workflow[3] loaders must name at least one loaderexit 2transcript_from_debug_dir+validate_transcript, scenarioexpected_entry_skill=sumo_qa_security_testing, on the realSUMO_QA_DEBUG_DIRcaptures of runs A1/A2/A4 and of main's A1; and the A1 router captures followed by run B's real error bundle capture (include_body: true, catalogues: "techniques,widgets", output"error": true)[('using_sumo_qa', None), ('sumo_qa_deciding_approach', None), ('sumo_qa_load_skill_context', False)] passed: True []; cap-A1-main (skill tool):passed: True []; router + errored bundle:[..., ('sumo_qa_load_skill_context', True)] passed: False [wrong_skill_routing: "expected entry skill 'sumo_qa_security_testing' was never invoked", first_hop_violation: ...]gh api repos/sumithr/sumo-qa/issues/comments/5970662857(compare-mcp-versions --review-mode, haiku, one run per family) + PR bodycompare-mcp-versions, haiku, security) + this session's A runs, branch 602d3fb wheel vs origin/main 36b90d1 wheel, same agent and promptnpm run eval -- <config>(candidate haiku, judge claude-opus-5-5), single pass, ownPROMPTFOO_CONFIG_DIReach; seeevalsslotRefs #802, issue stays open for them.Supporting slots
/Users/SumithRamsookbhai/Desktop/repos/apo/sumo-qa-pr-829, the real sumo-qa worktree at the rebased local head, full history. The audit ran in the same worktree. The conformance captures are the realSUMO_QA_DEBUG_DIRoutput of those runs.sumo_qa-0.75.0-py3-none-any.whlbuilt withuv build --wheelfromgit archive 602d3fb0(and from c2ff77c for run B), installed into a clean venv (sumo_qa.__file__=.../scratchpad/v/venv-pr/lib/python3.14/site-packages/sumo_qa/__init__.py), served viapython -m sumo_qawith a temp HOME. Each run:ENABLE_TOOL_SEARCH=false claude -p "<prompt>" --model haiku --strict-mcp-config --mcp-config <cfg> --allowedTools mcp__sumo-qa --disallowedTools Bash Write Edit NotebookEdit Skill Agent --disable-slash-commands --output-format stream-json --verbose; all runs exit 0.using_sumo_qa,load_classifications,load_approaches,implementing_with_tddidentical;sumo_qa_deciding_approach21 diff lines, only the PR's intended edits (step 2 wording, step 8 "(security testing: via its bundle)", routing-table row, catalogue-responsibilities handoff bullet with the error fallback, the shortened principles line and red-flag rows, the creating-test-plan line). Routing outcomes: main 4/4 entered a skill (implementing_with_tdd x4); branch 5/6 entered a skill (implementing_with_tdd x3, answering_testing_question x2), 1 answered directly after the router without entering a skill (C2 at 602d3fb). The earlier session saw 4/4 on both sides, so across sessions branch 9/10 vs main 8/8: within haiku noise, not identical.eval-reuse-check.pyfirst, against every stored db: all three configs RERUN (the rebase brought main's judge config and changed standards/rules files). Ran each once on the Claude pair with its ownPROMPTFOO_CONFIG_DIR. skill-security-testing on c2ff77c:5 passed (100%), exit 0 (eval-E8i-2026-10-05T10:26:53). skill-deciding-approach first run on c2ff77c 4/5 (case "executable runner package under tests/" chose tdd-scaffold, not verify-existing); stopped the in-flight .ab run when the router fix changed its input; on 602d3fb:5 passed (100%), exit 0, checkerREUSABLE: eval-Vag-2026-10-05T10:38:33 ... 5/5 passed, inputs identical to HEAD. That one case x3 on branch 602d3fb 3/3, on main 36b90d1 2/3: candidate variance, present on main. skill-deciding-approach.ab on 602d3fb:10 passed (37.04%), by legB - full skill (current)9/9,A1 - catalogues only1/9,A0 - no skill0/9 (controls fail as designed). The checker still says RERUN on the fresh .ab and security-testing runs for structural reasons (the .ab controls omitskill_content; security-testing's classification-filteredrules/standardsvars).Suite, CI and mutation
602d3fb0):pytest (pre-push)...Passed,6289 passed, 8 skipped, 1 xfailed,Required test coverage of 100% reached. Total coverage: 100.00%;mutmut (pre-push, scoped ...)...Passed.602d3fb0(pytest matrix ubuntu 3.10-3.14, macOS and Windows 3.10/3.14, ruff, mypy, drift-and-schemas, context token budget, pip/uvx installs on 3 OSes, plugin-dir handshake, CodeQL, pip-audit, shellcheck, markdown links, no em-dashes).mutation.ymldispatch on602d3fb0, run 37299520097):All modules: kill counts >= baseline and 0 survivors. Strict gate passed.mergeStateStatusBEHIND after main gained #840, #841, #846, #850, #851 (action and ruff bumps, release 0.75.1);git merge-treeagainst main is clean, so it squash-merges directly.feat(context): bundle whole catalogues and enter security-testing thr…