# Init Commit Discipline

> Use this skill when initializing commit discipline — AGENTS.md rules and SessionStart hooks where agents support them.

- Skill: `cyberuni/init-commit-discipline` (Agent Skill, multi-file: 2 files)
- Install (CLI): `npx skillmds@latest add cyberuni/init-commit-discipline`
- Raw SKILL.md: https://api.skillmd.com/api/skills/cyberuni/init-commit-discipline/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: cyberuni (https://skillmd.com/u/cyberuni)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/cyberuni/init-commit-discipline

---


# Init Commit Discipline

Inject always-on commit discipline into the repo: an AGENTS.md section for every agent, plus SessionStart hooks on agents that support them.

This skill **requires** the cyberplace CLI — see **Ensure cyberplace CLI** below.

## Prerequisites

- `AGENTS.md` should exist (run the `init` skill first if missing).

## Ensure cyberplace CLI

Before any subcommand:

1. Resolve exact semver: `npm view cyberplace version` (never `@latest`, never a literal `<version>` placeholder).
2. Run `npx cyberplace@<exact> <subcommand>`.

If step 2 fails (npx install prompt, `command not found`, or other non-zero exit), the `init` skill (a prerequisite) handles the install consent flow. Tell the user to run `init` first, then return here. Stop this skill until then.

## Commit helper skill

Commit discipline references a **commit helper skill** for staging, splitting, and message writing. Resolve one before injecting AGENTS.md.

```bash
npx cyberplace@<exact> commit resolve-skill --check
```

If none are detected, ask the user to choose:

| Option | Action |
|--------|--------|
| **A — Recommended** | Install [`softaworks/agent-toolkit@commit-work`](https://github.com/softaworks/agent-toolkit): `npx skills add softaworks/agent-toolkit --skill commit-work -g` |
| **B — User override** | User names another commit skill to install or reference |
| **C — Bundled fallback** | Install cyberplace' minimal `commit` skill project-scoped: `npx skills add cyberuni/cyberplace --skill commit` |

Do not proceed until a commit helper skill name is chosen.

## Workflow

1. Resolve commit helper skill (above).
2. Ask whether to enable **auto-commit** — commit each unit of work immediately when complete and verified, without waiting for the user to ask.
3. Inject AGENTS.md section:

```bash
# With auto-commit (opt-in):
npx cyberplace@<exact> commit inject --commit-skill <name> --auto-commit

# Without auto-commit:
npx cyberplace@<exact> commit inject --commit-skill <name>
```

4. Register SessionStart hook:

```bash
npx cyberplace@<exact> hook register \
  --name commit-discipline \
  --event SessionStart \
  --extract AGENTS.md \
  --heading "Commit Discipline"
```

If the user consented to npm install during the `init` skill (earlier in this session), edit the registered SessionStart command to use `npx --yes cyberplace@<exact>` instead of `npx cyberplace@<exact>` so SessionStart can run non-interactively.

Pass `--verbose` on inject or register for a human-readable summary. Pass `--dry-run` to preview without writing.

> **Hook semver upgrade:** Re-running `hook register` replaces an existing hook when `--name` and hook flags match but the pinned `npx cyberplace@<semver>` differs (for example after upgrading the CLI). Legacy shell-script hooks are replaced when register runs.

> **Stale hook caveat:** `hook register` skips hooks it considers fully equivalent. If the SessionStart command is wrong in other ways, edit agent settings manually or re-run register with the flags above.

## What gets applied

Injected content is **agent-first**: normative commit rules in the section body; optional depth in `### References` at the bottom. No links to other repository files — commit-helper skill name and `governance show` one-liners only.

**AGENTS.md** (all agents): `## Commit Discipline` with unit-of-work definition, agent-compatible staging (`git add <files>` plus `git diff --cached`; never `git add .`, `git add -A`, or interactive `git add -p`), Conventional Commits guidance, and `### References` pointing to the chosen commit helper skill. When the user opts in to auto-commit, the inject step adds the **Auto-commit rule** block before the unit-of-work rules.

**Example injected shape:**

```markdown
## Commit Discipline

**Auto-commit rule:** … (only when opted in)

**Unit of work:** …

- Conventional Commits: …
- One concern per commit; …
- Stage only files for this unit: …
- Never commit with red tests; …

### References

- **`commit-work` skill** — staging, splitting, and message writing when committing
```

**Runtime hook** (Claude Code, Cursor, Codex): SessionStart injection of the Commit Discipline section so agents are reminded of the rules at the start of every session.

For agents without hook support, AGENTS.md alone applies the rules.

## Related skills

- **`init`** — create AGENTS.md and symlink CLAUDE.md
- **`commit`** — bundled minimal commit helper (cyber-asana-style)
- **`commit-work`** — full staging/splitting workflow from softaworks/agent-toolkit (recommended)

