/commit — Context-Enriched Committer
Create git commits that track AI context evolution alongside application changes. When AI-layer files are part of the commit, a Context: section is appended to the commit body — making git log long-term, queryable memory for future sessions and agents.
Current state
!git status
!git --no-pager diff --stat HEAD
Recent commits (style reference):
!git log --oneline -5
If the blocks above show errors or unexpanded variables, run the commands yourself with Bash.
Execution Flow
Parse arguments. If $ARGUMENTS starts with the standalone word push (case-insensitive): enable push-after-commit, use the remainder as the commit message (may be empty).
Check for committable changes in the state above. Nothing staged, unstaged, or untracked → report "Nothing to commit — working tree clean." and stop. Run git --no-pager diff HEAD for the full diff when the stat summary is not enough to write an accurate message.
Classify every changed and untracked file:
- Application code — stage normally
- AI context files (paths below) — stage normally; flag for the Context section
- Sensitive files (
.env, *.key, *.pem, credentials.*, *secret*) — do not stage; warn the user
- Unrelated concerns — if changes span multiple unrelated concerns and
$ARGUMENTS gives no hint, ask before bundling
Stage files individually (git add <file>). Never git add -A or git add ..
Detect AI context changes. Check git --no-pager diff --cached --name-only against the AI Context Paths below.
Draft the message.
$ARGUMENTS provided: use it; prepend a conventional prefix (feat:, fix:, refactor:, docs:, test:, chore:) if missing, inferred from the changes.
- Empty: auto-generate from the staged diff — focus on why, not what.
Append the Context section when AI-layer files are staged (omit entirely otherwise):
Context:
- <create|update|remove|rename> <path> — <what changed>
Commit via heredoc:
git commit -m "$(cat <<'EOF'
<prefix>: <description>
<optional body>
Context:
- <action> <path> — <annotation>
EOF
)"
Verify and report: short hash, subject line, whether a Context section was included and how many AI-layer files it tracked.
Push (if requested). git push; no upstream → git push -u origin <current-branch>. On failure: report the error, never retry with --force.
AI Context Paths
.wisci/** — WISCI context store (context files, handoffs, primer, index)
CLAUDE.md, .claude/CLAUDE.md — project instructions
.claude/rules/**, .claude/commands/**, .claude/skills/**, .claude/agents/**, .claude/hooks/** — Claude project config
.claude/settings.json, .claude/plugins/** — Claude settings and plugins
.mcp.json — MCP server config
skills/**, .claude-plugin/**, hooks/** — plugin/skill definitions (when the repo is itself a plugin)
.agents/** — cross-client agent skills
.cursorrules, .cursor/rules/** — Cursor rules
.github/copilot-instructions.md — Copilot instructions
AGENTS.md, codex.md, .codex/** — Codex instructions
GEMINI.md, .gemini/** — Gemini CLI instructions and config
A staged file matches if its path starts with a directory prefix above or exactly matches a filename entry.
Examples
Application + context changes:
feat: add token refresh to auth middleware
Automatic refresh when access token expires. One retry before 401.
Context:
- update .wisci/context/auth-research.md — added token refresh decision and rationale
Context-only changes:
docs: persist Stripe integration research
Context:
- create .wisci/context/stripe-integration.md — /isolate research results
- update .wisci/handoff/payments.md — Stripe added to in-progress work
Key Constraints
- Never
--no-verify. Pre-commit hook fails → report and stop.
- Never force-push.
- Never
git add -A / git add .. Stage by name.
- Never stage sensitive files.
- Context section is conditional — only when AI-layer files are actually staged.
- One logical commit — ask before bundling unrelated concerns.
- Respect user intent — a provided message is used as-is apart from prefix and Context additions.
- All diffs with
--no-pager.
1---2name: commit3description: Creates conventional git commits enriched with a Context section that logs AI-layer changes (.wisci/, CLAUDE.md, skills, rules), turning git history into queryable long-term memory. Use to commit changes, optionally pushing afterward.4---56# /commit — Context-Enriched Committer78Create git commits that track AI context evolution alongside application changes. When AI-layer files are part of the commit, a `Context:` section is appended to the commit body — making `git log` long-term, queryable memory for future sessions and agents.910## Current state1112!`git status`1314!`git --no-pager diff --stat HEAD`1516Recent commits (style reference):17!`git log --oneline -5`1819> If the blocks above show errors or unexpanded variables, run the commands yourself with Bash.2021## Execution Flow22231. **Parse arguments.** If `$ARGUMENTS` starts with the standalone word `push` (case-insensitive): enable push-after-commit, use the remainder as the commit message (may be empty).24252. **Check for committable changes** in the state above. Nothing staged, unstaged, or untracked → report "Nothing to commit — working tree clean." and stop. Run `git --no-pager diff HEAD` for the full diff when the stat summary is not enough to write an accurate message.26273. **Classify every changed and untracked file:**28 - **Application code** — stage normally29 - **AI context files** (paths below) — stage normally; flag for the Context section30 - **Sensitive files** (`.env`, `*.key`, `*.pem`, `credentials.*`, `*secret*`) — **do not stage**; warn the user31 - **Unrelated concerns** — if changes span multiple unrelated concerns and `$ARGUMENTS` gives no hint, ask before bundling32334. **Stage files individually** (`git add <file>`). Never `git add -A` or `git add .`.34355. **Detect AI context changes.** Check `git --no-pager diff --cached --name-only` against the AI Context Paths below.36376. **Draft the message.**38 - `$ARGUMENTS` provided: use it; prepend a conventional prefix (`feat:`, `fix:`, `refactor:`, `docs:`, `test:`, `chore:`) if missing, inferred from the changes.39 - Empty: auto-generate from the staged diff — focus on why, not what.40417. **Append the Context section** when AI-layer files are staged (omit entirely otherwise):42 ```43 Context:44 - <create|update|remove|rename> <path> — <what changed>45 ```46478. **Commit** via heredoc:48 ```bash49 git commit -m "$(cat <<'EOF'50 <prefix>: <description>5152 <optional body>5354 Context:55 - <action> <path> — <annotation>56 EOF57 )"58 ```59609. **Verify and report:** short hash, subject line, whether a Context section was included and how many AI-layer files it tracked.616210. **Push (if requested).** `git push`; no upstream → `git push -u origin <current-branch>`. On failure: report the error, never retry with `--force`.6364## AI Context Paths6566- `.wisci/**` — WISCI context store (context files, handoffs, primer, index)67- `CLAUDE.md`, `.claude/CLAUDE.md` — project instructions68- `.claude/rules/**`, `.claude/commands/**`, `.claude/skills/**`, `.claude/agents/**`, `.claude/hooks/**` — Claude project config69- `.claude/settings.json`, `.claude/plugins/**` — Claude settings and plugins70- `.mcp.json` — MCP server config71- `skills/**`, `.claude-plugin/**`, `hooks/**` — plugin/skill definitions (when the repo is itself a plugin)72- `.agents/**` — cross-client agent skills73- `.cursorrules`, `.cursor/rules/**` — Cursor rules74- `.github/copilot-instructions.md` — Copilot instructions75- `AGENTS.md`, `codex.md`, `.codex/**` — Codex instructions76- `GEMINI.md`, `.gemini/**` — Gemini CLI instructions and config7778A staged file matches if its path starts with a directory prefix above or exactly matches a filename entry.7980## Examples8182**Application + context changes:**83```84feat: add token refresh to auth middleware8586Automatic refresh when access token expires. One retry before 401.8788Context:89- update .wisci/context/auth-research.md — added token refresh decision and rationale90```9192**Context-only changes:**93```94docs: persist Stripe integration research9596Context:97- create .wisci/context/stripe-integration.md — /isolate research results98- update .wisci/handoff/payments.md — Stripe added to in-progress work99```100101## Key Constraints102103- **Never `--no-verify`.** Pre-commit hook fails → report and stop.104- **Never force-push.**105- **Never `git add -A` / `git add .`.** Stage by name.106- **Never stage sensitive files.**107- **Context section is conditional** — only when AI-layer files are actually staged.108- **One logical commit** — ask before bundling unrelated concerns.109- **Respect user intent** — a provided message is used as-is apart from prefix and Context additions.110- All diffs with `--no-pager`.