Discover MCPs & agents
Loading MCPs and agents…
Loading MCPs and agents…
Two Claude Code skills for running parallel AI coding sessions in one repo without them overwriting each other. /start-session snapshots the working tree, agrees a scope, and picks main vs branch vs git worktree. /end-session works out which dirty files are actually yours, closes the loose ends, and writes the handoff before you archive.
Jump to setup instructionsFetched from the repository for this visit.
Two Claude Code skills that stop parallel AI coding sessions from trampling each other's work — and stop you losing what a session figured out when you close its tab.
/start-session · /end-session · works in every project on your machine · plain Markdown, no runtime, no dependencies beyond git and jq
Picture several people editing the same folder on one computer at the same time, and none of them can see the others. When one finishes, they can't tell which files are theirs. So they either grab everything — breaking somebody else's half-finished work — or grab nothing, and leave their own work stranded. Then they close their notebook, and everything they worked out is gone with it.
That is what happens when you run more than one AI coding session in one project. Which almost everyone now does.
These two skills fix it with something boring: a note taken at the start.
/start-session writes down, before any work happens: what this session is for, how you'll know it's finished, and a photo of exactly what the folder looked like at that moment./end-session compares the folder to that photo. Now it knows precisely which files are yours. It closes the loose ends — commit, push, deploy, tests — writes down what happened somewhere your next session will actually read it, and only then lets you close the tab.The photo is the whole trick. Everything else follows from it.
If you've hit any of these, this is the fix:
git add -A and swept in another session's workgit status shows 40 changed files and I have no idea which ones are from this sessiongit clean and deleted my other session's work. There was no warning and no undocurl -fsSL https://raw.githubusercontent.com/edwardyen724-g/claude-session-skills/main/install.sh | bash
Or clone and run ./install.sh. Or just copy the two folders yourself:
cp -R skills/start-session skills/end-session ~/.claude/skills/
cp session-ledger/SPEC.md ~/.claude/session-ledger/SPEC.md
They install at user level (~/.claude/skills/), so they work in every project without per-repo setup. They read each project's own CLAUDE.md, memory and git state at runtime, so they adapt instead of hardcoding one repo's conventions.
Then, in a new session:
/start-session add rate limiting to the public API
and when you're done:
/end-session
/start-sessionCLAUDE.md, the relevant one to three memory entries, the newest handoff doc, and — through the Claude Code session tools — which other sessions are live in this repo right now and what they claim.main, a branch, or a git worktree — and says why in one line.The isolation rule that matters most: any code change while another session is live in the same checkout goes in a worktree. Not a suggestion — that's the collision, and a worktree is the fix.
/end-sessionMINE, CARRIED (already dirty when you started — not yours), AMBIGUOUS (dirty before and touched by you), GONE (someone else committed it while you worked).git add -A.CLAUDE.md or the backlog when a standing fact changed; a full handoff doc when the work earns one.It has two modes: done (finished, archive it) and relay (context filling up, a fresh session continues — same sweep, plus a paste-ready brief for the successor, and the branch is deliberately kept).
/start-session agrees three lines before any work:
In scope Fix the three auth error pages so body text renders in the text column.
Not this Other CSS misuse on the site; the sign-in flow itself.
Done when All three render full-width in production, tests green, API deployed.
Not this is the line that does the work. A scope with no stated exclusion excludes nothing. It names the thing you can already feel the session turning into.
Done when has to be observable. "All five panes open at scroll position 0 with no console errors" is a done-condition. "The dashboard is better" is not.
Then the skill guards it. Before starting anything that isn't plainly the scoped work, one test: does it share the surface, and would it be finished by the same Done when?
Two things count as drift even when each piece looks small: accumulation (three unrelated small items — flagged once, at the third) and a satisfied Done when (work started after that point runs in a context already full of shipped work).
It never blocks and never nags. Say "do it here anyway" and that's a re-scope — recorded, not re-argued.
Deferred items land in the ledger's followUps. /end-session puts them in the record, and the next /start-session lifts one out as its new In scope. Drift becomes the next session instead of contaminating this one.
One small JSON file per session, written outside every repo, at ~/.claude/session-ledger/<project>/<session-id>.json:
{
"goal": "your own words",
"isolation": "worktree",
"branch": "fix-auth-pages",
"baseHead": "f165e07",
"baseStatus": ["M docs/BACKLOG.md", "?? ads/scripts/hook.mjs", "…197 more"],
"scope": { "inScope": "…", "outOfScope": "…", "doneWhen": "…" },
"followUps": [],
"status": "open"
}
baseStatus is the photo. At close time:
jq -r '.baseStatus[]' "$LEDGER" | pathof | sort -u > /tmp/base-paths
git status --porcelain -uall | pathof | sort -u > /tmp/cur-paths
comm -13 /tmp/base-paths /tmp/cur-paths # MINE
comm -12 /tmp/base-paths /tmp/cur-paths # CARRIED — not yours
comm -23 /tmp/base-paths /tmp/cur-paths # GONE — someone else committed it
That's the entire mechanism. Full contract in session-ledger/SPEC.md.
Each of these was found by testing against a real repo with 197 dirty paths from six concurrent sessions. Change any one of them and the skills quietly start lying to you.
1 · git status --porcelain -uall, never plain porcelain. Plain porcelain collapses an untracked directory to a single entry (ads/). A file you create inside an already-untracked directory therefore produces no new entry — and gets filed as somebody else's work. Verified in a throwaway repo: the file vanished from MINE with plain porcelain and appeared correctly with -uall.
2 · The project key comes from git rev-parse --path-format=absolute --git-common-dir, never pwd. That returns the main checkout's .git even from inside a linked worktree, so both resolve to the same bucket. Key it off pwd and a worktree session files itself privately — and sends its memory to a directory no other session ever loads.
3 · Never git add -A, never unscoped git clean / restore / stash. In a shared tree those reach other sessions' uncommitted work. This isn't hypothetical: in the repo this was built in, a git clean -fd in one session destroyed every untracked file another session had created. No warning, nothing in git to recover.
4 · Scratch comparison files go in /tmp. Write them into the repo you're examining and they show up in the next git status and report themselves as your work. Found this one by making the mistake.
5 · "Pushed" is not "shipped." Plenty of projects have a deploy step no CI performs. /end-session reads the ship rule out of your CLAUDE.md rather than assuming a green push means live — and asks once, then remembers, if your project hasn't written one down.
| Ledger write + read-back | ✅ verified, 197/197 paths captured |
| The four-bucket split | ✅ verified, including the -uall blind spot |
| Worktree-safe project key | ✅ verified from inside a linked worktree |
/end-session on a real session | ✅ ran end to end; rescued a live production bug that existed nowhere but that session's transcript |
/start-session steps 1–5 | ✅ real reads, real isolation decision |
/start-session steps 6–7 | ⚠️ untested — ledger write and tab titling in a genuinely new session |
EnterWorktree | ⚠️ untested — the worktree has always been proposed, never yet created |
These are prompt files, not code. There is no test suite and there won't be one; the verification is the runs above.
SKILL.md files in ~/.claude/skills/.git and jq (brew install jq).Because they share one working tree and neither can see the other. Git shows both of them the same dirty files with no attribution. Nothing in git records which session made a change before it's committed, so a session that wants to commit has to guess. These skills add the missing attribution by snapshotting the tree at session start.
Run /end-session in relay mode. It performs the same sweep as a normal close, keeps the branch or worktree, writes the handoff, and hands you a paste-ready block for /start-session in the next tab — carrying the same scope and Done when, because it's the same work.
Compare the current git status --porcelain -uall against a snapshot taken before the agent started. That's what the ledger stores and what /end-session diffs. Without a snapshot it's guesswork — and after a context compaction the agent's own recollection isn't reliable either.
Not always — a worktree costs setup and starts from origin/main, so it won't contain uncommitted work you may need. The rule these skills use: any code change while another session is live in the same checkout goes in a worktree. Research, reading and planning don't need one. Neither does a one-file fix in a clean tree with nobody else around.
Only after the knowledge in it is written down somewhere else, and — if it's a worktree session — after that worktree is merged, because archiving cleans up the worktree by default. /end-session gates the archive on exactly those conditions.
The ideas do; the files don't. SKILL.md is a Claude Code format. The ledger mechanism is about forty lines of shell and portable to any agent harness.
/start-session costs about two minutes. /end-session costs a few more. The comparison isn't against zero — it's against re-deriving context you already had, and against untangling a commit that swept in someone else's files.
docs/build-log.md is the unedited account: the problem, every design decision and why, the mistakes made along the way, and what the first real run found.
MIT. See LICENSE.
GitHub checked 16h ago - refresh overdue. Recently viewed repositories target hourly refresh.
Find a documented setup for your client. No sign-in, installation, or tool execution.
If this MCP is also published on mcpchannel.ai, you can subscribe from Browse and use the gateway config there instead.