@susu-eng/trunk-sync
v3.8.3
Published
Maximum continuous integration for multi-agent coding — every edit is committed and pushed to trunk immediately
Maintainers
Readme
trunk-sync
A distributed file system for multi-agent software engineering, built on Git.
Many Claude Code agents can work in the same repo at once — on worktrees, across remote machines, on OpenClaw, any mix. Everything stays in sync, agents work around each other, nothing gets left behind, and there's nothing manual to do. If you're confused about some code an agent wrote, you can summon its author with Seance.
Two pieces: a Claude Code / Codex CLI hook that turns Git into continuous integration for agents, and a CLI with install, config, and seance commands.
Install
npm install -g trunk-sync
trunk-sync install # Claude Code, project scope
trunk-sync install --scope user # Claude Code, all repos
trunk-sync install --client codex # OpenAI Codex CLIThat's it. Every file edit is now committed and pushed automatically.
The Codex install writes an entry to ~/.agents/plugins/marketplace.json; finish in Codex with /plugins install trunk-sync.
Prerequisites: Claude Code or Codex CLI, jq, a git repo with a remote (origin).
How it works
After every Edit or Write, the hook fires: stage, commit, pull, push. Works on main, on branches, in worktrees. No git commands to remember, no manual merging, no work left behind on a branch nobody pushed.
For multi-agent work, launch each agent in its own worktree:
claude -w # each invocation gets its own worktreeIf two agents edit the same file, trunk-sync surfaces the conflict as feedback. The agent resolves it by editing the file — then the hook completes the merge and pushes. No human intervention.
Clocking In — agents that know about each other
Agents are automatically aware of each other. On every commit, the hook writes a timecard recording the agent's branch and current task (extracted from the conversation). Timecards are committed and pushed alongside code, so agents on different machines see each other too.
When another agent is working in the same repo:
TRUNK-SYNC CLOCK-IN: 1 other agent clocked in.
- abc12345 on dev-macbook (branch: main, 30s ago) — "Fix the login bug"
Consider potential resource conflicts: ports, build locks, test databases.Agents with dead processes are automatically clocked out. Remote agents that go silent are clocked out after 5 minutes. The message is throttled to avoid noise.
Seance — summon the author of any line of code
Point at any line, and seance rewinds the codebase and the agent's session back to the exact moment that line was written. Ask the agent what it was thinking, why it made that choice, what it considered and rejected. Works for both Claude and Codex commits — seance reads the commit body's Agent: field and forks the matching CLI.
# Rewind and resume the session that wrote line 42
trunk-sync seance src/main.ts:42
# Just show which session wrote it, without launching the CLI
trunk-sync seance src/main.ts:42 --inspect
# List all trunk-sync sessions in the repo
trunk-sync seance --listUnder the hood: git blame → commit → session ID + agent → transcript rewind → checkout at that commit → resume the original CLI with the same context it had. Read-only: Claude is launched with --allowedTools Read + plan mode; Codex is launched with --sandbox read-only --ask-for-approval never. The resumed agent explains and explores but cannot edit.
Transcript commits
By default, seance finds transcripts on the local filesystem. This works for code written on the same machine, but not for code from other machines, CI, or cleaned-up sessions.
Enable transcript commits to fix this:
trunk-sync config commit-transcripts trueEach auto-commit will include a snapshot of the session transcript. Seance can then find the transcript directly in the commit via git diff-tree, regardless of which machine wrote the code. Recommended for teams and multi-machine workflows.
Security note: Transcripts contain your full conversation with Claude. With commit-transcripts=true, these are committed to git in the clear. Only enable on repos where you're comfortable with that visibility.
License
MIT
