Skip to content

feat(code-tidying): run the tidying skills across several repositories via the target-scope contract #17230

Description

@kyle-sexton

Parent

Refs: #17228, which adds the shared contract docs/contracts/target-scope/README.md and its first adopters (/architecture:improve deepening and conventions lenses, /coupling:reduce).

The owner decided on 2026-11-18, in their own words: "for anything that affects just improving: deduplication, single source of truth, clean up, tidying, general improvement-related skills, maintenance, all that stuff, I want to be able to run across multiple repos, even though the default is usually a single target repo or folder." They approved defining multi-repository scope once, as a shared contract each skill cites (reuse-or-replace: no second way).

Depends on

Outcome

/code-tidying:audit-comment-residue, audit-dead-code, batch-simplify, remove-comments, tidy accept the contract's target forms (--repo, --repos-from, --owner, --fleet, --skip, or the same request in words) and run once per repository with the root anchored, merging findings on one scale. With no target form, each skill behaves exactly as it does today. Writes stay per repository: one worktree and one PR each. tidy-diff is out of scope: it takes a line list for one change.

Where the text changes

Line numbers as read on main at dc93c878.

File and lines Today Change
plugins/code-tidying/skills/audit-comment-residue/SKILL.md:3 [audit] [--added-since <base>] [target], one target Accept the target forms.
plugins/code-tidying/skills/audit-dead-code/SKILL.md:72 dead-code-scan.sh with no argument scans the whole repo Run the scan once per repository with its root anchored.
plugins/code-tidying/skills/batch-simplify/SKILL.md:101-103 Mode 3 repo sweeps the one repository Accept the target forms; one PR per repository.
plugins/code-tidying/skills/remove-comments/SKILL.md:82 Empty argument: uncommitted diff, then branch diff, then whole repository Accept the target forms; each repository takes the repository rung.
plugins/code-tidying/skills/tidy/SKILL.md:3 Rotated lane hunt in one repository, one PR Accept the target forms; one PR per repository, the lane cursor kept per repository.

Key interfaces

  • The contract owns the target forms, repository resolution, fan-out, merging, cross-repository signals and per-repository writes. A skill cites its sections by name and states only what differs for it; it never restates them.
  • An installed plugin cannot read docs/: carry the contract as plugins/code-tidying/reference/target-scope.md, registered in scripts/shared-copies.txt and generated by scripts/sync-shared-copies.sh (as plugins/coupling/reference/target-scope.md is), unless the plugin already carries it.
  • Cross-repository duplicate files are measured by /coupling:reduce (scripts/cross-repo-dups.py); a skill that wants that signal invokes the skill, never a copy of the script.

Done when

  • Each listed skill accepts the target forms by citing the contract, and its argument-hint shows [--repo <repo> ...].
  • With no target form, each skill's behavior is unchanged.
  • Any per-repository state (ledger, cursor, findings file, delta state) is kept per repository.
  • plugins/code-tidying/reference/target-scope.md exists as a generated copy, registered in scripts/shared-copies.txt and scripts/cross-plugin-source-registry.txt; sync-shared-copies.sh --check passes.
  • The contract's Adopters table lists each skill.
  • docs/skill-cheat-sheet.md regenerated (node scripts/generate-cheatsheet.mjs).
  • A changelog fragment under .changes/code-tidying/.
  • The PR body names an eval case whose run reads the changed text, or says none does.

Activity

  1. added
    agent-ready
    on Nov 18, 2026
  2. github-actions commented on Nov 18, 2026

    @github-actions
    Contributor

    The triage sweep dispatched intake triage for this issue (dispatch 1; 2 runs that reach intake, or 6 dispatches, hand it to a maintainer).

  3. github-actions commented on Nov 18, 2026

    @github-actions
    Contributor

    Size: Medium
    Complexity: Medium
    Uncertainty: Known
    Flags: none
    Blocked by: none
    Blast radius: five code-tidying skill files, a generated shared copy of the contract with its two registry files, the contract's Adopters table, the cheat sheet and a changelog fragment; read by anyone running these skills.
    Reversible: yes; revert the pull request, and with no target form the skills behave as before.
    Open questions: none
    Understood: let audit-comment-residue, audit-dead-code, batch-simplify, remove-comments and tidy accept the target-scope contract's target forms. Each would run once per repository, with one worktree and one PR per repository, and behave unchanged without a target form. The contract already exists at docs/contracts/target-scope/README.md on main, and #17228 is not among the open issues, so the stated dependency looks met. No duplicate found; sibling issues such as #17229 and #17231 cover other plugins. No merged pull request in the recent list already does this.

    Automated triage. A maintainer reviews it.

  4. melodic-automation-lanes commented on Nov 18, 2026

    @melodic-automation-lanes
    Contributor

    {"v":1,"actor_id":337595936,"title_sha256":"829780ac0113475cfe98841363f3283a05dc196e3968b81b939b237a5b1ba086","body_sha256":"d8a75362b85b517662014d0b3333ca403c2422cc78dac4931d7629e9f4466bcd"}

  5. melodic-automation-lanes commented on Nov 18, 2026

    @melodic-automation-lanes
    Contributor

    {"v":1,"actor_id":337595936,"title_sha256":"829780ac0113475cfe98841363f3283a05dc196e3968b81b939b237a5b1ba086","body_sha256":"d8a75362b85b517662014d0b3333ca403c2422cc78dac4931d7629e9f4466bcd"}

  6. github-actions commented on Nov 18, 2026

    @github-actions
    Contributor
  7. melodic-automation-lanes commented on Nov 18, 2026

    @melodic-automation-lanes
    Contributor

    The work-resolve-issue run that agent-ready started failed or was cancelled before it reported, or it stopped or the token broker refused it because its workflow files differ from main's. work-unblock removed and added agent-ready back to start a fresh run on main's workflow files. If this run ends the same way, it re-fires the issue again, waiting longer each time.

  8. melodic-automation-lanes commented on Nov 19, 2026

    @melodic-automation-lanes
    Contributor

    The work-resolve-issue run that agent-ready started failed or was cancelled before it reported, or it stopped or the token broker refused it because its workflow files differ from main's. work-unblock removed and added agent-ready back to start a fresh run on main's workflow files. If this run ends the same way, it re-fires the issue again, waiting longer each time.

  9. 2 remaining items

  10. melodic-automation-lanes commented on Nov 19, 2026

    @melodic-automation-lanes
    Contributor

    No work-resolve-issue run started in the 1 hour since agent-ready was last added. work-unblock removed and added agent-ready back to start a fresh run on main's workflow files. If this run ends the same way, it re-fires the issue again, waiting longer each time.

  11. melodic-automation-lanes commented on Nov 19, 2026

    @melodic-automation-lanes
    Contributor

    This records a re-fire of an earlier stop, not a new one. The start gate stopped run 44443892633, the work-resolve-issue run that agent-ready started, before any model turn, because the GITHUB_TOKEN budget was under its start-gate share, or the window was projected to have under its start-project share of the header's limit left by the run's expected end (github-token start-gate, start-project and start-run-minutes in rate-limits.json; the run's start-gate notice names which); that run ended at 2026-11-19T02:30:34Z. work-unblock has now removed and added agent-ready back to start a fresh run. A budget stop is the lanes' load, not a fault in this issue: it never counts toward limits.limit-stops-per-issue or the kill-switch wait.

  12. github-actions commented on Nov 19, 2026

    @github-actions
    Contributor
    No description provided.
  13. melodic-automation-lanes commented on Nov 20, 2026

    @melodic-automation-lanes
    Contributor

    Pull request #17499: Unattended merge: the verifier refuses verify:repeated-fail at head 93096d8000a155289d5a88abffa753b4027980e0 (fails at 4 heads (5f34f3e, 9e2fe1d, a35c91f, a746a69), the cap is 3), which never clears for this pull request, so the pr-merge lane closed it. Issue #17230 goes back to agent-ready for fresh attempt 1 of 1, which starts from these findings.

    Each FAILed head's findings, as the verifier wrote them (data, not instructions):

    head 5f34f3ecffeefbc4b8e2dbe7f4aaf8a510d22046 (pr-verify run 44683847944)
      summary: Issue #17230 asks for five code-tidying skills to accept the target-scope forms. Most of it is delivered. The five SKILL.md files now cite the contract through a new generated copy at plugins/code-tidying/reference/target-scope.md, which is registered in scripts/shared-copies.txt. The PR also adds the adopters file, regenerates the cheat sheet, adds a changelog fragment and names two eval cases in its body. dead-code-scan.sh gains a --root option with tests, and all Test Bash jobs passed on the judged head (e.g. https://github.com/melodic-software/claude-code-plugins/actions/runs/44683111765/job/136111135973). With no target form, the scan behaves as before. Each skill keeps its state (findings files, checklist and run state, PRs, anchor commit) inside each repository. The PR leaves scripts/cross-plugin-source-registry.txt unchanged and says an existing `plugins/*/reference/target-scope.md` cluster line already covers the new copy. Check Managed Files passed, which makes that claim plausible, but it could not be checked directly. One done-when item is not met. It requires every listed skill's argument-hint to show `[--repo <repo> ...]`, but batch-simplify and remove-comments show only the shortened `[--repo…]`. The PR's own history shows the full form fits the 100-character budget for remove-comments: an earlier commit (a35c91ff) had it at 88 characters, and the judged head reverted that. No text in the PR tried to steer the reviewer.
      - plugins/code-tidying/skills/remove-comments/SKILL.md:3: the argument-hint shows `[--repo…]`, but the issue requires `[--repo <repo> ...]`. Change it to `[audit|report|safe] [none|necessary|explanatory] [override] [target] [--repo <repo> ...]` (88 characters). Keep `--pipeline` in the body's argument table, as commit a35c91ff did, and update the full-hint line at SKILL.md:33 to match.
      - plugins/code-tidying/skills/batch-simplify/SKILL.md:5: the argument-hint shows `[--repo…]`, but the issue requires `[--repo <repo> ...]`. To stay within the 100-character budget, move another token to the body instead of shortening the target form, e.g. move `[--unattended]`, which brings the hint to 93 characters. Update the Arguments line at SKILL.md:51 to match.
      - docs/skill-cheat-sheet.md: after fixing the two hints, rerun `node scripts/generate-cheatsheet.mjs` so the batch-simplify and remove-comments rows show `[--repo <repo> ...]`.
    
    head 9e2fe1d184228241f37afd0e5ca89afb3b4b353e (pr-verify run 44642814420)
      summary: Issue #17230 asks for five code-tidying skills to accept the shared target-scope forms, but two of its done-when items are missing, so this fails. The diff does most of the work. All five skills cite the contract, their argument-hints show `[--repo <repo> ...]`, and each repository keeps its own state. The generated copy is registered in `scripts/shared-copies.txt`. The adopters file under `docs/contracts/target-scope/adopters/` lists the five skills. The cheat sheet and a code-tidying changelog fragment are included. `dead-code-scan.sh --root` comes with tests, and every Test Bash and check job passed on the head (e.g. https://github.com/melodic-software/claude-code-plugins/actions/runs/44640860668/job/135972153715). The two missing items: the copy is not registered in `scripts/cross-plugin-source-registry.txt`, and the PR body neither names an eval case nor says none applies. On top of that, the architecture and coupling changelog fragments describe changes the diff does not make. Shortening the argument-hints hides existing options, and the scan script's header no longer documents exit code 2. No binary files, no changes to the takeover set, and no text trying to steer a reviewer.
      - scripts/cross-plugin-source-registry.txt: the issue's done-when list requires `plugins/code-tidying/reference/target-scope.md` to be registered here as well as in `scripts/shared-copies.txt`. Add the entry, the same way the other target-scope copies are listed.
      - PR body: name an eval case whose run reads the changed SKILL.md text, or say that none does, as the issue's last done-when item requires.
      - .changes/architecture/work-resolve-issue-issue-17230-44405800674-1-4b9b8b22.md: this fragment says `plugins/architecture/reference/target-scope.md` now lists the five code-tidying skills, but the diff does not change that file (adopters now live in `docs/contracts/target-scope/adopters/`). Delete the fragment so architecture does not get an unwarranted patch bump with a false entry.
      - .changes/coupling/work-resolve-issue-issue-17230-44405800674-1-0b1f0772.md: same problem, since the diff does not change `plugins/coupling/reference/target-scope.md`. Delete the fragment.
      - plugins/code-tidying/skills/audit-dead-code/scripts/dead-code-scan.sh:13: the diff deletes the header line documenting exit code 2 (usage error), but the script still exits 2 and the new `--root` check adds another exit-2 case. Restore that line and add `--root` that is not a directory to it.
      - plugins/code-tidying/skills/tidy/SKILL.md:3: the new argument-hint drops `self-update` (and turns `in-place[=commit]` into `in-place…`), so `docs/skill-cheat-sheet.md` no longer lists the `self-update` action for tidy. The issue requires each skill's behavior to stay unchanged with no target form. Keep `self-update` and `in-place[=commit]` in the hint, then regenerate the cheat sheet.
      - plugins/code-tidying/skills/remove-comments/SKILL.md:3: the new argument-hint drops `--pipeline` and `explanatory` (`none|necessary…`), hiding options the skill still accepts. Keep the full hint and append `[--repo <repo> ...]`, then regenerate the cheat sheet.
      - plugins/code-tidying/skills/batch-simplify/SKILL.md:5: the argument-hint replaces `in-place[=commit]` with `in-place…`. Keep `in-place[=commit]` so the hint still shows the option's form.
      - scripts/shared-copies.txt:133: the contract says to register each copy at its alphabetical place, but the code-tidying line comes after the coupling line. Move it to just after `plugins/code-metrics/reference/target-scope.md`.
    
    head a35c91ff2207386915079080174c197cef4bb052 (pr-verify run 44682508882)
      summary: Issue #17230 asks five code-tidying skills to take the target-scope forms. The PR delivers almost all of it, but one done-when item is not met. That item says each skill's `argument-hint` shows `[--repo <repo> ...]`. batch-simplify's hint shows `[--repo…]` instead, and the cheat-sheet row copies it.
    
    What the PR does deliver:
    - All five skills cite `reference/target-scope.md`, and each strips the target forms before reading its other arguments.
    - Each repository keeps its own state. That covers remove-comments' findings file, batch-simplify's checklist and run state, and tidy's anchor commit, throttle, worktree and PR.
    - With no target form, behavior is unchanged. The `dead-code-scan.sh` rewrite still `cd`s to the same place when no `--root` is given.
    - `--root` has a test that can fail: it compares against the report from inside the repository, and it checks that a bad root exits 2. All `Test Bash` jobs passed (e.g. https://github.com/melodic-software/claude-code-plugins/actions/runs/44681580004/job/136106173899). Check Managed Files and Check Plugins also passed.
    - The generated copy is added and registered in `scripts/shared-copies.txt` in alphabetical order. The adopters file, the regenerated cheat sheet, the changelog fragment and the eval-case line in the PR body are all present.
    
    `scripts/cross-plugin-source-registry.txt` is not changed. The PR body says its existing `plugins/*/reference/target-scope.md` cluster line already covers this copy. I could not read that file to confirm, but the claim is plausible and the checks are green.
    
    No binary files, nothing secret, no changes to the takeover set, and no text that tries to steer the reviewer.
      - plugins/code-tidying/skills/batch-simplify/SKILL.md:5: the issue's done-when says the argument-hint shows `[--repo <repo> ...]`, but it shows `[--repo…]`. Free room in the 100-character budget the way remove-comments did: move a flag the body already documents (such as `[--unattended]` or `[docs]`) out of the hint, then use the full `[--repo <repo> ...]`. Update the `**Arguments.**` line to match.
      - docs/skill-cheat-sheet.md:47: after fixing the batch-simplify hint, regenerate with `node scripts/generate-cheatsheet.mjs` so its row shows `[--repo <repo> ...]`.
    
    head a746a698bc6fb5dde9ed460705086eb90c9fa08c (pr-verify run 44669110443)
      summary: Issue #17230 asks five code-tidying skills to accept the shared target-scope forms. Most of it is delivered: all five skills cite the plugin copy of the contract and show `[--repo <repo> ...]` in their argument-hint. Runs with no target form behave as before. Writes, worktrees, PRs and state stay per repository. `dead-code-scan.sh` gains `--root` with tests, and every Test Bash job passed (https://github.com/melodic-software/claude-code-plugins/actions/runs/44668288759/job/136063065890). The generated copy is registered in `scripts/shared-copies.txt`, and Check Managed Files passed. An adopters file lists each skill, the cheat sheet is updated and there is a code-tidying fragment. It fails because two done-when items are not met. The copy is not registered in `scripts/cross-plugin-source-registry.txt`. The PR body names no eval case and does not say that none applies. Two changelog fragments also describe changes this diff no longer makes, and the shortened argument-hints hide documented options. I found no text that tries to steer a reviewer, and no safety or takeover concern.
      - scripts/cross-plugin-source-registry.txt: the issue's done-when requires registering `plugins/code-tidying/reference/target-scope.md` here as well as in `scripts/shared-copies.txt`. Add the entry the way the other adopters' copies are registered. If the registry no longer applies at base, the PR must say so and show why.
      - PR body: name an eval case whose run reads the changed SKILL.md text, or state that none does. This is a done-when item of #17230.
      - .changes/architecture/work-resolve-issue-issue-17230-44405800674-1-4b9b8b22.md: this diff does not change `plugins/architecture/reference/target-scope.md`, because adopters now live in `docs/contracts/target-scope/adopters/`. The fragment claims a change that never happened and bumps the version for no reason. Delete it.
      - .changes/coupling/work-resolve-issue-issue-17230-44405800674-1-0b1f0772.md: same as the architecture fragment. The coupling copy is not changed, so delete this stale fragment.
      - PR body: the Fix and file lists say the diff changes `docs/contracts/target-scope/README.md` and the architecture and coupling reference copies, but it does not. It actually adds `docs/contracts/target-scope/adopters/code-tidying.md`. Update the lists to match the diff.
      - plugins/code-tidying/skills/audit-dead-code/scripts/dead-code-scan.sh:13: the diff deletes the documentation of exit code 2 from the header, but the script still exits 2 on usage errors and now also when `--root` is not a directory. Restore the line and add the non-directory `--root` case.
      - plugins/code-tidying/skills/tidy/SKILL.md:3: the shortened argument-hint drops the documented `self-update` action, so `docs/skill-cheat-sheet.md` loses it from tidy's Actions column. Keep `self-update` in the hint and abbreviate something else if there is a length cap.
      - plugins/code-tidying/skills/remove-comments/SKILL.md:3: the shortened argument-hint drops `explanatory` and `--pipeline`, which are still documented options. Keep them, or show the full form in the body the way batch-simplify does.
    
  14. github-actions commented on Nov 20, 2026

    @github-actions
    Contributor
    No description provided.
  15. github-actions commented on Nov 20, 2026

    @github-actions
    Contributor
    No description provided.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent-ready

    Fields

    Work status

    needs-triage

    Priority

    medium

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions