code-integrate
Skill0 starsChanged 15 days agoApache-2.0View on GitHub
Integrate a Code Writer's patch files into a part branch, run the gates and measure the size, then squash the branch into one signed commit and push it. Use when a Writer report arrives with format-patch files, when a part branch needs its commits applied and checked, or when a checked part is ready to squash and push. Not for choosing commit messages (see /commit), for restacking branches, or for syncing open pull requests.
In this repository19 other files it gives its agents.
- AGENTS.mdAGENTS.md
- code-checkSkill
- code-formatSkill
- code-genSkill
- code-restackSkill
- code-reviewSkill
- code-syncSkill
- code-testSkill
- commitSkill
- feat-discoverySkill
- feat-statusSkill
- feat-validateSkill
- releaseSkill
- code-rules-checkSkill
- code-rulesSkill
- docs-rules-checkSkill
- docs-rules-creatorSkill
- docs-rulesSkill
- skills-checkSkill
The file
We split this skill into the rules it gives an agent
2 rules. About 0 are common, 0 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 24
Run on a clean working tree.
- Very specific: line 53
After apply --rebase, it uses the recorded base and lease SHA and allows the rebased branch not to contain origin/<branch>.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Code Integrate
Two mechanical steps of integrating a Writer's work, as one command each. Every command prints ONE compact JSON
result and writes the raw git and gate output to a log file, named in the result as log; read the log only when
the result says something failed. Judgement stays with the caller: the commit message, the split, the review.
When to Use
apply: a Writer's patch files are ready to go onto a part branch, and the gates and size are wanted.squash: the applied branch is accepted and is to become one signed commit on its base, pushed.
The scripts never resolve a conflict, never commit unsigned, never use plain --force, and never merge or
close a pull request.
Commands
Run on a clean working tree. --repo names the repository and defaults to the current directory, so the call
needs no cd; patch and message-file paths are read from the caller's directory, not from --repo.
python3 <repo>/.agents/skills/code-integrate/scripts/integrate.py apply --repo <repo> --branch lnsd/<slug> --base origin/main <patch>...
python3 <repo>/.agents/skills/code-integrate/scripts/integrate.py apply --repo <repo> --branch lnsd/<slug> --base origin/main --rebase <patch>...
python3 <repo>/.agents/skills/code-integrate/scripts/integrate.py squash --repo <repo> --branch lnsd/<slug> --base origin/main --message-file <file>| Argument | Meaning |
--repo | The repository to work in; default the current directory |
--branch | The part branch, as named on the remote |
--base | The ref the part sits on: origin/main, or the branch of the part below |
<patch>... | The git format-patch files, in order |
--message-file | The commit message, written by the caller with the commit skill |
--rebase | apply only: start the part branch at --base, not origin/<branch>, for patches from a Writer REBASE |
apply fetches, switches to the branch (created at the base when it is not on the remote, otherwise at
origin/<branch>; a local branch that already descends from that start is continued, so a FIX after a failed
gate lands on top of the commits applied before), applies the patches with git am --3way, runs the gates
fmt-check, check, typecheck, test and check-docs in that order, stopping at the first failure, and
measures the size against the base. With --rebase, it starts at --base even when the local branch still points
to the old remote head, and records that fetched remote SHA for squash's lease. The default behavior is unchanged.
A FIX after a failed apply --rebase must pass --rebase again to keep the same mode.
A gate that passes but leaves the tree changed is reported as gates_failed.
squash soft-resets to the base, commits with -s -S, checks that %G? is G, then pushes: -u when the
branch is new on the remote, otherwise --force-with-lease pinned to the origin/<branch> that apply fetched.
After apply --rebase, it uses the recorded base and lease SHA and allows the rebased branch not to contain
origin/<branch>. A remote update after apply still makes the lease fail. It refuses when the tree is not clean,
when the default-mode branch does not contain origin/<branch>, and when the push is rejected; each time it puts
the branch back and pushes nothing, as it does when the commit is not signed.
Result
{"status":"ok","branch":"lnsd/x","base_sha":"…","start_sha":"…","head_sha":"…","commits":2,"size":243,"gates":{"fmt-check":"pass","check":"pass"},"log":"…"}apply:statusisok,gates_failed(the failed gate isfailand later gates did not run, or a gate left the tree changed, with areason) orneeds_rebase. In rebase mode,lease_shais the remote SHA fetched for the later push lease.sizeis lines added plus deleted against the base, lockfiles and binary files excluded.squash:statusisokwithhead_sha,signature(G) andpush(neworlease).refusedanderrorcarry areason.
Exit codes
| Code | Meaning | What the caller does |
| 0 | ok | Continue |
| 1 | A gate failed | Read the log, send the failure back as a FIX |
| 2 | The patches do not apply; git am was aborted and the branch is untouched | Resolve the patch conflict with the Writer against the selected base |
| 3 | Refused (--repo is not a git repository, dirty tree, local branch not descending from its start, unsigned commit, base not an ancestor, remote ahead of the branch in default mode, or stale rebase lease) or a git command failed | Read reason; fix the setup, do not work around it |
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

