git-discipline
Branch-per-initiative git discipline for all delivery workflows.
Skill by xoai
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/xoai-git-discipline
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Use cases: productivity
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md and code. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/git-discipline
What's inside
- Skill name
git-discipline- Description
- Branch-per-initiative git discipline for all delivery workflows. Defines branch naming by workflow, the propose-confirm creation protocol, dirty-tree and detached-HEAD handling, the always user-gated merge protocol, worktree support for parallel sessions, and abandonment cleanup. Activates only in git repositories — silently inactive everywhere else. Use when starting /build, /fix, /architect, or /build-x at Standard+ scope, when resuming an initiative, when offering a merge at a completion checkpoint, or when the user wants a second concurrent initiative.
- License
- MIT
- Instructions
- 337 lines in SKILL.md · view on GitHub
Files (1)
- SKILL.md
SKILL.md (first lines)
<!-- sage-metadata cost-tier: haiku activation: auto tags: [git, branching, worktree, merge, discipline, parallel-sessions] inputs: [initiative-slug, workflow-mode] outputs: [initiative-branch, manifest-branch-record] --> # Git Discipline One branch per initiative. Merge only when the user says so. This capability is the **single source of truth** for branch naming, creation, merging, worktrees, and cleanup. Workflows cite it — they never restate its rules. If a workflow's text and this file disagree, this file wins; flag the workflow as the defect. ## Branch vs worktree — the decision rule These solve different problems; pick by how many sessions run at once: - **Branch** isolates *history* — one initiative's commits don't interleave with the default branch. A branch is **sufficient for one session at a time** (sequential initiatives). This is the default (`isolation: branch` in `.sage/config.yaml`). - **Worktree** isolates the *working tree* — its own directory on disk. A worktree is **required for simultaneous sessions**: two `claude` processes in one checkout share one working tree and one HEAD, so they clobber each other's files regardless of branch, and `git checkout -b` in one moves HEAD for the other. Branches cannot fix a working-tree race; only a directory-per-session can. **The hard constraint.** A Claude session is bound to the directory it was launched in and **cannot relocate itself** into a worktree it creates. So the parallel path is always launch-time: create the worktree *first*, then start a session *inside* it. The front door is **`sage worktree <slug>`** (creates branch + worktree + copies the gitignored runtime + prints the `cd … && claude` line). Opt in with `isolation: worktree`; until then, sequential branch-in-place is unchanged. ## Availability check Activate only when `git rev-parse --git-dir` exits 0. On failure (not a git repository): silently inactive — no error, no prompt, no mention. Every workflow runs exactly as it would without this capability. Never run any other `git` command before this check passes. ## Branch naming | Workflow | Branch | |----------|--------| | `/build` | `feat/<slug>` | | `/fix` | `fix/<slug>` | | `/architect` | `arch/<slug>` | | `/build-x` | `feat/<slug>` or `fix/<slug>` — planner proposes from the task shape, user confirms | | `/autoresearch` | `autoresearch/<slug>` (pre-existing discipline, unchanged by this capability) | `<slug>` is the initiative's work-dir slug **without** the date prefix: `.sage/work/20260612-payment-retry/` → `feat/payment-retry`. The full dated slug remains the work-dir key. On a name collision (the branch already exists), append `-2`, `-3`, … — and never reuse an existing branch without the user's explicit choice (see "Already on a branch" below). The naming extends the project's conventional-commit convention (feat, fix, chore, docs) to branch names. ## Worktree bounce (`isolation: worktree` in the main checkout) Read `isolation:` from `.sage/config.yaml` (default `branch`). When it is `worktree` AND the workflow is starting in the **main checkout** (not a linked worktree — the test is `git rev-parse --git-dir` == `git rev-parse --git-common-dir`; equal → main checkout), do not branch in place. Present a **guided menu** (never a hard refusal — a lone sequential session must still be able to proceed): - `[1]` **Set up an isolated worktree** (recommended for parallel) — run / instruct `sage worktree <slug>`; open a session in the new directory and continue there. This session stops here. - `[2]` **Proceed here in the shared checkout (not isolated)** — fall back to the normal in-place branch flow below; record the choice in the initiative decision log. - `[3]` **Sequential, this once** — same as `[2]`, noting `isolation: worktree` was overridden for this initiative. When already running **in a linked worktree** (the user launched via `sage worktree`), skip the bounce and branch/commit in place as usual — the session is already isolated (merging: "Worktree sessions" below). With `isolation: branch` (default), the bounce never fires. In Claude Desktop, the same bounce is simpler: offer to start a new Desktop session with a worktree for the initiative instead of `sage worktree`. ## Branch creation (propose-confirm) At the workflow step that consumes this capability, when HEAD is on the default branch with a clean tree: 1. **Propose** the branch name from the table above. 2. **Let the user confirm or rename.** Never create silently. In Desktop mode the proposal is one button question: create it (Recommended), rename it, or stay on the default branch (the decline, recorded below). 3. `git checkout -b <branch>` 4. **Record the actual branch name** in the initiative's manifest frontmatter: `branch: feat/payment-retry`. Resume matching reads this recorded field — never re-derives from names (see "Branch ↔ work-dir mapping" below). **Dirty tree at creation time:** stop and present three options — stash and proceed, commit current changes first (the user writes or approves the message), or abort the workflow. Never stash silently. **Already on a branch** (HEAD on a non-default branch): ask whether to (a) continue on it — the user may have prepared one — or (b) create the initiative branch from the default branch. Record the choice in the initiative decision log. In a worktree session (Claude Desktop, `claude --worktree`) do not ask: see "Worktree sessions" below.
From xoai/sage, MIT.
More from xoai/sage
- 0.651score
implement
xoai
Implements a single task from the plan using TDD discipline.
SkillAFreshness: A★ 30Claude Code +9 - 0.651score
build-loop
xoai
Drives task-by-task execution from an approved plan with quality gates between each task.
SkillAFreshness: A★ 30Claude Code +9 - 0.651score
scope-guard
xoai
Monitors implementation scope and prevents drift beyond the plan.
SkillAFreshness: A★ 30Claude Code +9 - 0.651score
session-bridge
xoai
Preserves and restores context across agent sessions using plan file checkboxes as source of truth.
SkillAFreshness: A★ 30Claude Code +9 - 0.651score
tdd
xoai
Enforces test-driven development: write failing test, write minimal code to pass, refactor.
SkillAFreshness: A★ 30Claude Code +9 - 0.651score
systematic-debug
xoai
Four-phase debugging framework that finds root causes before attempting fixes.
SkillAFreshness: A★ 30Claude Code +9 - 0.651score
verify-completion
xoai
Verifies implementations and fixes actually work by executing commands and observing real results.
SkillAFreshness: A★ 30Claude Code +9 - 0.651score
codebase-scan
xoai
Scans relevant codebase areas to understand existing patterns, conventions, dependencies, and architecture before making changes.
SkillAFreshness: A★ 30Claude Code +9 - 0.651score
deep-elicit
xoai
Comprehensive requirements elicitation through Socratic conversation, producing a product brief with problem, users, scope, and success criteria in ~10 minutes.
SkillAFreshness: A★ 30Claude Code +9 - 0.651score
quick-elicit
xoai
Guided specification through 4 focused question rounds in ~3 minutes.
SkillAFreshness: A★ 30Claude Code +9 - 0.651score
tool-use
xoai
Guides tool selection across three layers: local scripts (zero context cost), MCP proxy (minimal context), and subagent dispatch (isolated context).
SkillAFreshness: A★ 30Claude Code +9 - 0.651score
onboard
xoai
First-run project setup that detects tech stack, selects quality packs, and generates .sage/ directory with CLAUDE.md.
SkillAFreshness: A★ 30Claude Code +9
Signals
- Stars
- 30
- Forks
- 7
- Open issues
- 0
- Last commit (this folder)
- Jun 17, 2026 (4 months ago)
- Last release
- Sep 28, 2026 (1 month ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- MIT
- Repository
- github.com/xoai/sage
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from xoai
- 0.651score
scope-guard
xoai
Monitors implementation scope and prevents drift beyond the plan.
SkillAFreshness: A★ 30Claude Code +9 - 0.651score
session-bridge
xoai
Preserves and restores context across agent sessions using plan file checkboxes as source of truth.
SkillAFreshness: A★ 30Claude Code +9 - 0.651score
tool-use
xoai
Guides tool selection across three layers: local scripts (zero context cost), MCP proxy (minimal context), and subagent dispatch (isolated context).
SkillAFreshness: A★ 30Claude Code +9 - 0.651score
systematic-debug
xoai
Four-phase debugging framework that finds root causes before attempting fixes.
SkillAFreshness: A★ 30Claude Code +9 - 0.651score
verify-completion
xoai
Verifies implementations and fixes actually work by executing commands and observing real results.
SkillAFreshness: A★ 30Claude Code +9 - 0.651score
codebase-scan
xoai
Scans relevant codebase areas to understand existing patterns, conventions, dependencies, and architecture before making changes.
SkillAFreshness: A★ 30Claude Code +9
Cite this page
git-discipline skill. Agent Mart. https://agentmart.dev/skills/xoai-git-discipline (last updated 2026-10-24)