openspec-git-discipline

A set of rules for managing Git while using OpenSpec, a workflow that records proposed changes before they are implemented and archived.

In plain words
What is it for?
Use it during OpenSpec propose, continue, apply, verify, archive, branch, merge, and worktree workflows to check when changes must reach main.
Why use it?
It prevents proposal, implementation, and archive artifacts from appearing in the wrong branch or in the wrong order in the project history.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/intent-driven-dev/intent-driven-template/openspec-git-discipline
Any agent
npx skills add intent-driven-dev/intent-driven-template --skill openspec-git-discipline
Clone the repo
git clone --depth 1 https://github.com/intent-driven-dev/intent-driven-template

Made for: Claude Code, Codex.

Per session 41 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 646 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00041 $0.00646
Opus 5 $0.00020 $0.00323
Sonnet 5 $0.00008 $0.00129
Haiku 4.5 $0.00004 $0.00065

Measured yesterday against content hash a5d5bcbfaaa9, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

openspec-git-discipline scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.agents/skills/openspec-git-discipline/SKILL.md · 62 lines

How it starts

The opening of the file, as written. The whole thing — 62 lines — stays where its author put it; the contents beside it link to each section on GitHub.

OpenSpec Git Discipline

Core Rule

Every OpenSpec state change must cross main before the next lifecycle phase depends on it.

  • Propose/continue artifacts may be drafted on a branch, but must be committed and merged to main before apply starts.
  • Apply may run on main, a branch, or a worktree only if that exact proposal change is already available on main.
  • Archive may run only from main after implementation is merged back.

Never create commits, branches, or merges unless the user explicitly asks.

Gates

Moment Gate
Before propose Prefer main; if not, warn and ask whether to continue intentionally.
During continue Before creating the next artifact, ask the user to commit completed artifact changes or explicitly continue without that checkpoint.
After propose Ask the user to commit proposal artifacts; offer to create a PR branch for review.
Before apply Confirm the proposal change is committed on main; then apply may run from main, a branch, or a worktree.
Before archive Stop unless implementation is merged back to main and archive is running from main.
After archive Ask the user to commit archive/spec sync changes.

Required Checks

Before apply:

  1. Run git status --short.
  2. Verify openspec/changes/<change>/ has no uncommitted proposal files.
  3. Verify the proposal change exists on main before applying from any branch/worktree.

Use this language if the proposal has not reached main:

I should not apply this yet because the proposal change has not reached main. A proposal can be drafted on a branch, but apply must start only after that proposal state is available on main. Please merge or commit the proposal to main first, then I can apply from main, a branch, or a worktree.

Before archive:

  1. Run git branch --show-current and git status --short.
  2. Stop if not on main.
  3. Stop if implementation work has not been merged back to main.

Use this language:

Read the full file on GitHub · 62 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 62 lines · 41 tokens per session scan A a5d5bcbfaaa9

Subscribe to this mod's changes

openspec-git-discipline is a skill published in the GitHub repository intent-driven-dev/intent-driven-template (121 stars, last pushed 8d ago), licensed MIT. It adds 41 tokens to every session and 646 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.