Skip to content

Convention: one worktree per session under .worktrees/ - #3

Merged
BunsDev merged 1 commit into
mainfrom
chore/worktree-convention
Sep 25, 2026
Merged

BunsDev merged 1 commit into
mainfrom
chore/worktree-convention

Conversation

@BunsDev

@BunsDev BunsDev commented Sep 25, 2026

Copy link
Copy Markdown
Contributor

Sets the working convention for this repo, and follows it (this PR was authored from .worktrees/worktree-convention).

  • AGENTS.md (canonical; CLAUDE.md imports it with @AGENTS.md): primary checkout stays on main, never edited; each session — human, Claude Code, Codex, or Modex driving them — works in .worktrees/<name> on branch <name> from origin/main; no two sessions share a worktree/branch; land via signed commits → PR → green CI → squash.
  • scripts/worktree.sh: new <name> (creates + npm installs), list, remove <name> (refuses on uncommitted changes; deletes the local branch only if merged), check (exit 1 from the primary checkout — agents call it first).
  • .worktrees/ git-ignored; README section.

Context: two sessions were pushing to the same branch earlier today (#1). This makes that structurally unlikely.

🤖 Generated with Claude Code

- AGENTS.md (canonical; CLAUDE.md imports it): the primary checkout stays on
  main and is never edited; every session — human, Claude Code, Codex, or
  Modex driving them — works in .worktrees/<name> on branch <name> cut from
  origin/main; no two sessions share a worktree or branch; landing is worktree
  → signed commits → PR → green CI → squash merge.
- scripts/worktree.sh: new / list / remove / check. `check` exits 1 from the
  primary checkout so agents can self-verify before editing; `remove` refuses
  on uncommitted changes and deletes the local branch only when merged.
- .worktrees/ git-ignored; README points at the convention.

This change was made from .worktrees/worktree-convention.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Copilot AI lite review requested due to automatic review settings September 25, 2026 09:36
@BunsDev
BunsDev merged commit fe7ff11 into main Sep 25, 2026
3 checks passed

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Address the three unresolved worktree script issues before approval.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 1 High severity

Open (1)
What changed in this PR

Establishes a one-worktree-per-session convention with supporting automation and documentation.

Changes:

  • Adds scripts/worktree.sh for worktree lifecycle management.
  • Adds canonical AGENTS.md guidance and CLAUDE.md import.
  • Documents the workflow and ignores .worktrees/.
File Summary
scripts/​worktree.sh Adds lifecycle tooling; requires stricter name validation, existing-branch handling, and robust common-directory resolution.
README.md Documents the worktree convention.
CLAUDE.md Imports AGENTS.md.
AGENTS.md Defines repository workflow conventions.
.gitignore Ignores local worktrees.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread scripts/worktree.sh
case "${1:-}" in
new)
name="${2:-}"; [ -n "$name" ] || { echo "usage: scripts/worktree.sh new <name>" >&2; exit 2; }
case "$name" in */*|*..*|.*|"") echo "name must be a simple slug (letters, digits, - _)" >&2; exit 2;; esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants