using-git-worktrees
OBobra/superpowers298k近 7 天新增 2,631 个 star
Branch-local durable PR state -- issue brief, decisions log, and session handoffs. Read the brief, decisions, and latest handoff at session start; append decisions as you work; write a handoff only on user request or explicit session turnover.
This directory is the home for durable PR/branch state that outlives a single session. Three surfaces:
| File / dir | Role | Lifetime |
|---|---|---|
issue-brief.md | Synthesis of the issue(s) this branch addresses | Rewritten only when adopting or re-syncing a branch |
pr-decisions.md | Append-only log of non-obvious PR-shaping decisions | Append forever; supersede, never edit |
handoffs/ + handoffs-index.md | Append-only session handoffs for the next agent | Never overwrite a handoff file; index points at the latest |
The instances (issue-brief.md, pr-decisions.md, handoffs-index.md,
handoffs/) are per-branch and git-ignored. The scaffolding (this file, the
scripts, the *.template.md files) is committed. Instantiate the instances from
the templates, or via /adopt-pr when a PR already exists.
On start, before coding:
branch: field
(git rev-parse --abbrev-ref HEAD).issue-brief.md, pr-decisions.md, and handoffs-index.md.handoffs-index.md points at
its file under handoffs/. That is what the previous session left for you.
If the index has no entries, there is no handoff yet; start from the brief./adopt-pr when a PR already exists, or write it from the linked issue when
starting fresh.While working -- persist without being asked:
pr-decisions.md via append-pr-decision.sh in
the same turn you make it, not "later".issue-brief.mdRewritten only when adopting a branch (/adopt-pr) or re-syncing after new
issue activity. Do not freestyle-edit it mid-session.
pr-decisions.mdAppend whenever you make a decision the issue did not already spell out:
.claude/skills/branch-context/append-pr-decision.sh \
--title "<short title>" \
--decision "<one-line decision>" \
--why "<one-line why>" \
--source "<source url -- mandatory>" \
[--iter N] [--supersedes "<earlier title>"]
Named flags are preferred (they resist arg-order mistakes). Positional order is
title decision why source [iter] [supersedes] -- do not pass iter as the
second argument.
Entry shape (the script writes this):
## YYYY-MM-DD · <short title> · iter <N or "-">
- Decision: <one line>
- Why: <one line>
- Source: <link -- mandatory>
- Supersedes: <earlier title, if applicable>
When the decision restates a modal claim (always / never / only if / must / unless), quote that clause verbatim instead of paraphrasing -- "always X unless Y" compressed to "always X" is a different instruction.
One handoff per session, newest last. Never overwrite another session's handoff.
.claude/skills/branch-context/append-handoff.sh [--writer <name>] "<one-line summary>" [path-to-body.md]
--writer tags the index line with the skill that produced the handoff. If you
omit the body path, the script writes a stub you must fill in via Write/Edit
before stopping; prefer writing the full body first and passing its path. To
revise a handoff you already wrote this session, edit the file in place rather
than appending a second index entry.
Handoff body sections (required):
# Handoff · YYYY-MM-DD · <summary>
## Done
- ...
## Next
- ... (ordered; first item is what the next agent starts on)
## Commitments & constraints carried forward
- ... (verbatim; or "none")
## Key paths
- `path` -- why
## Open questions
- ... (or "none")
## Branch-context pointers
- Brief: issue-brief.md (still valid? yes/no)
- Decisions appended this session: <titles or "none">
- Related plan file (if any): <path>
Commitments & constraints is a required check, not an optional extra. Before writing the handoff, sweep the session for two things and quote them verbatim -- do not paraphrase, the modality is the payload:
A longer, accurate handoff beats a short lossy one. Do not compress this section to save space.
Write the handoff (and any unlogged decisions) when the user turns the session
over. If the harness has a plan mode, capture the remaining work as a concrete
plan (next steps, files, verification), persist the handoff, then exit plan mode
so the fresh session inherits it. If the harness has no plan mode, persist the
handoff and tell the user to start a new session in this worktree whose first
action is to read handoffs-index.md and the latest handoff.
.claude/skills/branch-context/status.sh # JSON: brief/decisions/handoffs state
.claude/skills/branch-context/append-pr-decision.sh ...
.claude/skills/branch-context/append-handoff.sh ...
OBobra/superpowers298k近 7 天新增 2,631 个 star
OBobra/superpowers298k近 7 天新增 2,631 个 star
OBobra/superpowers298k近 7 天新增 2,631 个 star
MAmattpocock/skills288k近 7 天新增 10,178 个 star
MAmattpocock/skills288k近 7 天新增 10,178 个 star
MAmattpocock/skills288k近 7 天新增 10,178 个 star