Repository navigation
Propose simplifications of each week's merges as draft pull requests - #1902
Merged
Merged
Conversation
Every Saturday at 02:00 UTC, Claude Code reads the past week's merges into master and proposes at most two
behaviour-preserving simplifications of the code they changed, each as a draft pull request. It targets what per-PR
review misses: duplication and leftovers that only show across PRs. While a proposal awaits review, the workflow
proposes nothing new. It files no issues and posts no comments. A manual run is a dry run: it only uploads the
patches.
The repository is public, so what the agent reads and writes is untrusted. It gets only file tools, confined to a
directory with the merges and the code, and nothing it writes runs in the workflow. A separate job holding the machine
account's PAT checks each patch and pushes it: only PHP, TypeScript, Vue and LESS files under `src/`,
`tests/phpunit/` and `resources/ext.neowiki/{src,tests}/`, no mode change, symlink or binary, fewer lines added than
removed, and at most 50 lines added and 300 changed. CI then runs the proposals, so the CI workflows now get a
read-only `GITHUB_TOKEN` instead of the repository default, which can write nearly everything. None of them needs
more, and none uses a secret.
The machine account, ProWikiExperts, needs write access to NeoWiki before the first scheduled run; it has read access.
The workflow uses the `CLAUDE_CODE_OAUTH_TOKEN` and `PR_TOKEN_PROWIKIEXPERTS` repository secrets.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
A proposal no longer has to stay under 50 added and 300 changed lines: it only has to remove more lines than it adds. The caps were guesses that no proposal so far came near. A cap that is too tight fails unseen, as a warning on a run, while an oversized pull request is seen and closed in seconds. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Every Saturday at 02:00 UTC, Claude Code reads the past week's merges into master and proposes at most two behaviour-preserving simplifications of the code they changed, each as a draft pull request. It targets what per-PR review misses: duplication and leftovers that only show across PRs. While a proposal awaits review, the workflow proposes nothing new. It files no issues and posts no comments. A manual run is a dry run: it only uploads the patches. This is a smaller alternative to #1810; a table below sets the two side by side.
Human input
Goal and shape: goal set by @JeroenDeDauw in one ask; the requirements drawn from it and the design are Claude's, and @JeroenDeDauw then reshaped the bar a proposal has to clear.
Outcome: product: @JeroenDeDauw questioned the bar from Claude's summary of it and of the dry runs. Architecture and code: no human review of the files is on record. The workflow has never run in Actions. Left for you:
.github/workflows/simplify.yml, the prompt in.github/workflows/simplify.md, and whether the bar suits the team.Claude's calls
simplify/PR by ProWikiExperts is open.permissions: contents: readin this PR, rather than through the repository setting.gh.Compared with #1810
The same in both: the two secrets, Saturday 02:00 UTC, Opus 5.5 at xhigh, a publish job that runs nothing the agent wrote, and read-only tokens for the five CI workflows.
The change
Start with the prompt,
.github/workflows/simplify.md(85 lines): it decides what reaches your review queue. Then read the last step of.github/workflows/simplify.yml, which is the security boundary.The repository is public, so what the agent reads and writes is untrusted. It gets only file tools, confined to a directory with the merges and the code, and nothing it writes runs in the workflow. A separate job holding the machine account's PAT checks each patch and pushes it: only PHP, TypeScript, Vue and LESS files under
src/,tests/phpunit/andresources/ext.neowiki/{src,tests}/, no mode change, symlink or binary, and fewer lines added than removed. CI then runs the proposals, so the CI workflows now get a read-onlyGITHUB_TOKENinstead of the repository default, which can write nearly everything. None of them needs more, and none uses a secret.Before the first scheduled run
CLAUDE_CODE_OAUTH_TOKENandPR_TOKEN_PROWIKIEXPERTSrepository secrets.proposalsartifact. A manual run opens nothing.permissionsblock cannot write either.Verification evidence
simplify.yml.gh..github/workflows/, to a.json,.jsordocs/file and to.gitattributes; a mode change, a symlink, a rename and binaries; a..path, a quoted path and a path with a newline; as many or more lines added than removed; a missing title.@and[skip ci]in the agent's text were neutralised, and$(…)and backticks in it never ran./proc/self/environand writes to.gitfiles were refused, and only Read, Grep, Glob, Edit and Write existed.CdxDialogStuband import the shared one (+3/−23). With it, the 41 tests of those specs pass, and ESLint andvue-tsc -bare clean.simplify/branch, an emptied new file was published as an empty file, and an abandoned edit could join the next proposal.