Skip to content

refactor: generate the gather-context block from one source and run its calls in parallel - #18236

Merged
kyle-sexton merged 4 commits into
mainfrom
refactor/gather-block-single-source
Nov 23, 2026
Merged

kyle-sexton merged 4 commits into
mainfrom
refactor/gather-block-single-source

Conversation

@kyle-sexton

@kyle-sexton kyle-sexton commented Nov 22, 2026 •

Copy link
Copy Markdown
Member

No related issue: owner-approved refactor from the interview redesign's efficiency findings (PR #17965)

Draft: opened as a draft at the coordinator's request; not to be marked ready in this session.

Summary

The "Repository context. Gather first" rule text was hand-copied into 59 skills, and the copies had
drifted: the command sets differ per skill (1 to 5 commands, different bounds, git worktree list,
printenv, rename-detection diffs), and the prose came in dozens of variants. The rule's real
constraint (gather-block convention)
is separate body calls, each screened on its own; it never required one call per turn. In 73
/planning:interview eval runs all 212 gather calls ran one per turn.

  • One source. docs/conventions/gather-block/block.md holds the rule text, worded so the
    listed commands run as separate Bash calls sent in parallel in one message. It states that
    decision and points at the upstream sections, restating no harness behavior.
    scripts/sync-gather-block.py writes it between BEGIN/END GENERATED: gather-block markers in
    every skill that carries them; the markers are the consumer list. Each skill's own commands stay
    outside the markers, since they differ per skill.
  • Deletion. 18 skills whose bodies read none of the gathered values lose the section.
  • Inlined. planning:prd and planning:design read only the branch, once, at the slug step;
    that step now names git branch --show-current and the section is gone. The generated block had
    pushed their mandatory gates past the 20,000-byte re-attach slice
    plugins/planning/tests/reattach-slice.test.sh pins.
  • Kept. 37 skills carry the generated block.
  • attribution:setup resolves root, then convention home, then layers, each call taking the
    previous one's value, so it cannot run in parallel: it keeps its own sequential wording under
    "Repository context. Resolve in order".
  • source-control:commit drops its four unread git gathers; its config-layer probes (sequential by
    design) stay under "Repository context. Probe the config layers".

Fix

  • scripts/sync-gather-block.py, modeled on scripts/sync-config-cascade-semantics.py: rewrite
    mode, --check with a unified diff, exit 0/1/2. Exit 1 also covers a ## Repository context. Gather first heading with no markers, so a new hand-written copy fails CI.
  • scripts/sync-gather-block.test.sh: black-box cases on a fixture tree plus the real repository;
    its # test-scope: plugins/*/skills/*/SKILL.md header makes a SKILL.md change select it.
  • CI step gather-block beside config-cascade-semantics in pr-require-checks.yml, its outcome
    in the aggregator, a row in scripts/check-affected-gates.txt and scripts/README.md.
  • docs/conventions/gather-block/README.md gains "The gather-block rule text has one home"; the
    claim/basis record is unchanged.
  • plugins/session-flow/reference/gather.md drops workflow as a consumer;
    repo-hygiene:clean's action router no longer cites the deleted gather section.
  • docs/skill-cheat-sheet.md regenerated for the shifted SKILL.md line citations.
  • Patch fragments for the 25 touched plugins.

Session git snapshot: the deletions do not rely on it (they rest on the values being unread), but
it is documented: settings reference: includeGitInstructions
("a git status snapshot of your repository. The snapshot holds the current branch, the main branch,
git status output, and recent commits. Claude Code reads it when a conversation starts"). It is
off when includeGitInstructions is false or CLAUDE_CODE_DISABLE_GIT_INSTRUCTIONS is set, and
"Cloud sessions never include the snapshot".

Parallel calls and isolation: Worktrees: how Claude Code enforces isolation
checks each Bash command's text and says the rewrite for a refused command is "splitting it into
plain, separate commands"; nothing there ties the check to calls being in separate messages.

Inventory

Uses: which gathered value a later step reads (file:line at time of the audit, pre-change).
"weak" means the step names the value (for example a slug from the branch name) without saying it
reads the gathered one.

Skill Verdict Uses (evidence)
ai-slop:audit deleted unused; scripts/emit-findings.sh:80 re-runs git branch
architecture:adr kept status as baseline, SKILL.md:140-141
architecture:improve kept branch slug, reference/improvement-steps.md:91
attribution:audit deleted unused; scripts/emit-findings.sh:272 re-runs git branch
attribution:setup own wording root and home, SKILL.md:24, 144-150 (sequential)
bugs:scan kept shallow probe SKILL.md:276; CLAUDE_CODE_REMOTE SKILL.md:88-92
bugs:write deleted unused
code-tidying:batch-simplify kept branch, SKILL.md:93, 193
code-tidying:remove-comments kept branch slug, actions/remove.md:196-210
code-tidying:tidy kept branch, log, status, SKILL.md:56, 161
codebase-health:audit deleted unused
coupling:reduce kept branch slug (weak), SKILL.md:227
debugging:debug deleted unused
discovery:blindspot deleted unused
discovery:explore kept project root, SKILL.md:42, 165
discovery:research kept branch as topic fallback, its own section
discovery:trace-intent deleted unused
docs-hygiene:audit-derivability deleted unused
docs-hygiene:audit-noise kept .md status, SKILL.md:83, 114, 140
docs-hygiene:audit-progressive-disclosure kept .md status, SKILL.md:96-103
docs-hygiene:compress kept branch SKILL.md:144; .md status SKILL.md:103, 132-133
docs-hygiene:rename-references kept status and rename diffs, SKILL.md:101-102
docs-naming:audit-file-names kept status SKILL.md:163; root SKILL.md:93, 109, 121
docs-naming:realign-file-names kept root (weak), SKILL.md:129, 192
harness-ops:lanes deleted unused
harness-ops:observability deleted unused
implementation:implement kept branch SKILL.md:91; status SKILL.md:92
improvement:find kept branch slug (weak), context/unattended.md:139-141
improvement:improve kept branch SKILL.md:158-160; status SKILL.md:160-161, 210
mutation-testing:audit kept branch slug, context/persist-findings.md:29-30
overengineering:audit kept branch identity, SKILL.md:56, 127
overengineering:delta kept branch identity, SKILL.md:118-124
overengineering:justify kept branch identity, SKILL.md:50, 128-129
overengineering:realign kept branch identity, SKILL.md:65-74, 211-219
planning:audit-answers kept branch slug (weak), SKILL.md:67
planning:design inlined branch slug (weak), SKILL.md:113; read inline at that step
planning:design-handoff kept branch slug (weak), SKILL.md:35
planning:devils-advocate deleted unused
planning:interview kept branch slug (weak), SKILL.md:363
planning:plan kept default-branch stop, SKILL.md:117-121
planning:prd inlined branch slug (weak), SKILL.md:158; read inline at that step
prototype:explore-directions deleted unused
prototype:pressure-test deleted unused
repo-hygiene:clean deleted unused; tiers resolve the root themselves, SKILL.md:169, 195
review:council kept branch SKILL.md:265; status SKILL.md:67-68; version and remote SKILL.md:58, 125
review:fanout kept branch SKILL.md:28; status and shortstat via reference/change-set.md:55-80; remote SKILL.md:55
review:quality-gate kept branch SKILL.md:52, 57; status SKILL.md:66
session-flow:workflow deleted unused (commands lived in reference/gather.md)
source-control:commit git gathers deleted unused; probes kept
source-control:pull-request kept branch (weak), SKILL.md:125-126
source-control:worktree kept git dir and common dir (weak), SKILL.md:78
testing:cleanup kept branch, origin HEAD, status, SKILL.md:117
testing:diagnose deleted unused
testing:plan deleted unused
testing:run-e2e deleted unused
testing:write kept default-branch check, SKILL.md:87
toolchain:check kept status (weak), SKILL.md:49-51
toolchain:lint kept status (weak), SKILL.md:87
verification:confirm kept status SKILL.md:219-220; branch SKILL.md:238-239

Kept skills keep every command they listed, used or not; trimming unread commands from a kept list
is left for a follow-up.

Verification

  • bash scripts/sync-gather-block.test.sh: 20 passed.
  • python3 scripts/sync-gather-block.py --check: up to date, 37 skills.
  • bash plugins/planning/tests/reattach-slice.test.sh: 25 passed.
  • node scripts/generate-cheatsheet.mjs --check: in sync; bash scripts/generate-cheatsheet.test.sh: 66 passed.
  • bash scripts/check-skill-precompute-compose.test.sh: 15 passed;
    scripts/check-skill-precompute-compose.sh --all reports only two violations already on main
    (code-tidying:remove-comments, work-items:morning-brief), unchanged by this PR.
  • bash plugins/docs-hygiene/skills/audit-noise/scripts/detect.test.sh (extracts the audit-noise
    gather bullet): 224 passed, 4 skipped for filesystem limits.
  • scripts/check-changelog-fragments.sh --check: valid.
  • scripts/check-changed-skills.sh origin/main: planning:design crossed the 500-line
    SKILL.md cap and was fixed by shortening the generated block to four lines. The 10 failures
    left on this Windows host come from the host environment and happen on main as well: they are
    all script tests in skill folders this PR does not change. On the main checkout,
    ai-slop/skills/audit/scripts/resolve-targets.test.sh fails 3 cases and
    docs-hygiene/skills/compress/scripts/articles-setting.test.sh fails 2. The failing cases log
    sort: error while loading shared libraries. CI on Linux is the gate for these.

Related

Discoveries

  • Six architecture:map-* skills, six session-flow skills (under "## Context. Gather first")
    and plugins/session-flow/reference/gather.md keep their own copies of the rule outside the
    generated markers. This change does not touch them.
  • Some kept skills still list gather commands that no later step reads, for example recent
    commits in source-control:pull-request. The inventory above marks each one. Removing them is
    left for a follow-up.
  • scripts/check-skill-precompute-compose.sh --all --strict fails on
    code-tidying:remove-comments and work-items:morning-brief, and fails the same way on main.
    CI runs the check without --strict.

🤖 Generated with Claude Code

https://claude.ai/code/session_015XWwmeDkiEnVmSx4dtkkfh

kyle-sexton and others added 3 commits November 22, 2026 15:02
…ts calls in parallel

The "Repository context. Gather first" rule text was hand-copied, with drift, into 59 skills.
docs/conventions/gather-block/block.md is now its one home; scripts/sync-gather-block.py writes
it between generated markers in every skill that carries them, and CI runs it with --check. The
new wording sends the separate Bash calls in parallel in one message, one turn instead of one per
command. The 18 skills whose bodies read none of the gathered values lose the section.
attribution:setup keeps its order-dependent resolution under its own heading, and
source-control:commit drops four unread git gathers.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_015XWwmeDkiEnVmSx4dtkkfh
planning:design crossed the 500-line SKILL.md hard cap with the longer block. The block keeps
every rule in fewer lines, and the generator drops the blank lines inside the markers.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_015XWwmeDkiEnVmSx4dtkkfh
@kyle-sexton
kyle-sexton marked this pull request as ready for review November 23, 2026 02:32
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-23T02:34:30.086143Z affd5b0 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: affd5b015e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@github-actions

Copy link
Copy Markdown
Contributor

Lane run report

Field Value
Activity pr-refine/fix-docs

Run 45100825166, attempt 1

Field Value
Model rung 0
Leg handoff
Run job success
Activity step success
Commits pushed none (read lane)
Run 45100825166

Failed GitHub API calls

No failed call recorded by the run job's scripts.

@github-actions

github-actions Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

claude-security-review reviewed 9f80af1fc9bb44c86fc0cf601b24f755dbc45b52: read 44 of 44 changed file(s); 0 finding(s), 0 as inline comments.

Chunk 1 of 2 (40 files)

Security review: chunk 1 of 2 (incremental, 40 files)

I read every hunk of all 40 files in this chunk and found no security issues. This review was blocking only (blocking only: yes), so it reports CRITICAL and IMPORTANT findings only. None of either turned up.

What changed since affd5b01:

  • Shared block text. docs/conventions/gather-block/block.md was reworded, and the new text was regenerated into the 35 consuming SKILL.md files in this chunk.
    • Old reason clauses removed: "a worktree-isolated session screens each call on its own, and calls sent together cost one turn" and "a cap applied after the output returns bounds nothing".
    • Replaced by section-anchored pointers to worktree isolation and output limits.
  • planning:design and planning:prd. Each drops its generated gather section and names git branch --show-current inline at its slug step, with a fallback to the task text.
  • repo-hygiene:clean. In context/action-router.md, the survey step no longer points at the deleted gather section.
  • session-flow/reference/gather.md. Drops workflow from the consumer list and the table.
  • docs/skill-cheat-sheet.md. Line citations moved after regeneration.

Instruction-surface lens. I checked the removed and reworded text against the six Gate 0 classes the register adopts (docs/contracts/instruction-exception-register/README.md#L15-L18): irreversible-action, secret-handling, data-integrity, external-publication, legal-compliance and agent-authority.

  • Rules still in force.
    • Each command runs as its own Bash call, so each call is still screened on its own.
    • Bounds stay inside the command's pipe.
    • Gathers stay out of ## Pre-computed context.
  • What was removed. Only explanatory reason clauses went. Removing them changes nothing the block forbids.
  • The inlined branch reads. These are read-only git calls. They add no write, publish or credential action.
  • Result. No removed text guarded a protected class.

Trusted paths: no file in this chunk matches a TRUSTED PATHS: glob. The chunk touches no trust control, merge hold, token scope, kill switch or plugin manifest.

Settled threads: the four threads in the settled-threads file were resolved by owner replies at this head, all marked lines changed since resolution: no. The fixes they describe are the changes reviewed here, and I raise none of them again.

Embedded text: none. The PR context is a plain refactor description with no directives aimed at this lane.

Spend: none.

Chunk 2 of 2 (4 files)

Security review: chunk 2 of 2 (incremental since affd5b0, 4 files)

I read every hunk of the 4 files in this chunk and found no security issues. This lane already reviewed an earlier head, so the review was blocking only: only CRITICAL and IMPORTANT findings would be posted.

What changed:

  • The generated gather-block in toolchain:check, toolchain:lint and verification:confirm. These are re-syncs from the new docs/conventions/gather-block/block.md. The three lines of rule text become two. The rule that matters is kept: "Run each command below as its own Bash call, all sent together in one message". So each command still goes out as its own screened call, and the calls are never combined into one invocation.
    • The output-bound rule is kept: "Keep any bound in the command's own pipe".
    • The "never ## Pre-computed context lines" line is unchanged.
    • Only the explanatory clauses moved behind doc links.
    • Under the instruction-surface lens, this rewording removes no prohibition. It only shortens the text without changing what it forbids.
  • scripts/sync-gather-block.test.sh. The edit adds one header comment, # test-scope: plugins/*/skills/*/SKILL.md. scripts/affected-tests.sh (around line 709) reads these headers to decide when a suite runs. The new header tells it to run this suite when any skill body changes, so the test runs more often, not less. It narrows no gate.

Controls: none of the four files is a trusted path or a trust control. No plugin manifests changed. I judged the instruction-surface lens by consequence alone, because docs/contracts/instruction-exception-register/README.md was not consulted.

Embedded text: none seen in this chunk's inputs.

Spend: none.

critical-findings: 0

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

claude-review: 3 inline finding(s) on affd5b015eb09b2e2c3d22f93adf688baca79feb; the summary is in this lane's pull request comment.

claude-lane: claude-review

@github-actions

github-actions Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

claude-review reviewed 9f80af1fc9bb44c86fc0cf601b24f755dbc45b52: read 44 of 44 changed file(s); 0 finding(s), 0 as inline comments.

Chunk 1 of 2 (40 files)

Chunk 1 of 2 (40 files): no blocking findings. This was an incremental review of the changes since affd5b015eb09b2e2c3d22f93adf688baca79feb, in blocking-only mode: this lane already reviewed an earlier head, so advisory findings were dropped. I read every hunk of .claude-lane/chunks/chunk-1.patch.

What changed in this chunk and what I checked:

  • docs/conventions/gather-block/block.md. The source text now states the decision and links the docs instead of restating harness behavior: each command is its own Bash call, all sent together in one message, with a section-anchored link to worktree isolation. The bound-in-pipe line now points at output limits instead of making its own claim. This answers the earlier .claude/rules/skill-bodies-state-current-rules.md finding, which the owner resolved and which is settled.
  • Generated copies match the source. Every kept skill in this chunk has, between its markers, text identical to the new block.md. These are architecture, bugs, code-tidying, coupling, discovery, docs-hygiene, docs-naming, implementation, improvement, mutation-testing, overengineering, planning:{audit-answers,design-handoff,interview,plan}, review:{council,fanout,quality-gate}, source-control:{pull-request,worktree} and testing:{cleanup,write}.
  • planning:design and planning:prd read the branch inline. Their gather sections are removed, and each slug step now names git branch --show-current, falling back to the task when that call fails.
    • The prd section also dropped the recent-commits and status gathers. A grep found no later step that reads a gathered status or log value. The only git call left is prd SKILL.md:87 (git log --oneline -20), a step that runs its own command.
  • The settled threads' fixes are in this head. repo-hygiene:clean's context/action-router.md step 1 no longer cites the deleted gather section. session-flow/reference/gather.md drops workflow from the consumer list and the table, and now says "seventh copy". Both prior findings are settled, and their fixes are visible in this chunk.
  • Cheat-sheet citations. I spot-checked the new line numbers: verification/confirm SKILL.md:35 (the /toolchain:check and /toolchain:lint row), :166 and :168, and source-control/pull-request SKILL.md:76 (the fresh-context subagents line). Each falls on the cited text.

Closing issue: none. The PR body describes an owner-approved refactor with no related issue, so there are no acceptance criteria to check. The PR context and the settled-threads file contain no embedded instructions aimed at this lane.

Loosened checks would be marked: fail. That is the lane default, because the prompt carried no loosened_check_verdict: or loosened_check_patterns: lines; patterns: 0. The prompt had no loosened_check_decision_record: line, so I did not check the citation requirement. No change in this chunk loosens a check.

Spend: none in this chunk. Every change is to documentation or skill text.

Verified by me: I read the diffs and the head files with Read and Grep. I ran no scripts. The PR's --check and test results are the author's claims, and I did not confirm them.

Verifier dropped 0 of 0 candidates.

Chunk 2 of 2 (4 files)

Chunk 2 of 2 (4 files), incremental since affd5b01: no blocking findings. This review is blocking only: this lane already reviewed an earlier head.

What I checked:

  • The generated blocks match their source. In plugins/toolchain/skills/check/SKILL.md, plugins/toolchain/skills/lint/SKILL.md and plugins/verification/skills/confirm/SKILL.md, the new text between the markers matches the new docs/conventions/gather-block/block.md (chunk 1) line for line:

    • The text now states the decision: "its own Bash call, all sent together in one message".
    • It links the section-anchored worktree-isolation doc.
    • It no longer gives harness behaviour as the reason.

    This is the fix the earlier finding asked for on plugins/improvement/skills/improve/SKILL.md (that file is in chunk 1, which judges it there).

  • The scripts/sync-gather-block.test.sh header is read. The new line is # test-scope: plugins/*/skills/*/SKILL.md. It sits in the file's leading comment block, after the shebang and the shellcheck comment. scope_declarations in scripts/affected-tests.sh reads exactly that block (affected-tests.sh#L712-L726).

  • The glob covers what the suite reads. The suite runs --check against the real repository (sync-gather-block.test.sh#L116), and that check reads every skill's SKILL.md.

I did not run the sync script's --check myself. That the tree passes it is the author's claim, unverified.

Closing issue: none. The PR is an owner-approved refactor with no linked issue. The PR context has no embedded instructions aimed at the lane.

Loosened checks would be marked: fail. This is the lane default, because the prompt had no loosened_check_verdict: or loosened_check_patterns: lines; patterns: 0. The prompt also had no loosened_check_decision_record: line, so I did not check the citation requirement. No changed line in this chunk loosens a check.

Spend: none in this chunk.

Verifier dropped 0 of 0 candidates.

critical-findings: 0

The generated gather block gave Claude Code behavior as its reason
(per-call isolation screening, turn accounting, read-time caps), which
.claude/rules/skill-bodies-state-current-rules.md forbids. block.md now
states the decision only and points at the worktree-isolation and
output-limits docs sections; all 37 consumers are regenerated.

planning:prd and planning:design drop their gather sections: each reads
only the branch, once, when deriving the topic slug, so the slug step
now names `git branch --show-current` inline. The generated block had
pushed their mandatory gates past the 20,000-byte re-attach slice that
plugins/planning/tests/reattach-slice.test.sh pins; the gates are back
inside it. prd's unread recent-commits and status probes go with it
(Step 2 runs its own git log).

sync-gather-block.test.sh declares the SKILL.md glob it reads through
--check on the real tree, so a SKILL.md change selects it (Test
Selection reported 362 unselected reads).

Review fixes: repo-hygiene clean's action router no longer cites the
deleted gather section; session-flow's gather.md drops workflow from
its consumer list and table. docs/skill-cheat-sheet.md is regenerated
for the shifted SKILL.md line citations.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@kyle-sexton
kyle-sexton added this pull request to the merge queue Nov 23, 2026
Merged via the queue into main with commit aab8f85 Nov 23, 2026
116 of 117 checks passed
@kyle-sexton
kyle-sexton deleted the refactor/gather-block-single-source branch November 23, 2026 03:53
@github-actions github-actions Bot added the merge-path: owner-agent Post-merge accounting record (README.md, Merge paths) label Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-path: owner-agent Post-merge accounting record (README.md, Merge paths)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant