Skip to main content
Glama

Why commit discipline?

Coding agents can solve large tasks quickly, but their Git history often arrives as one oversized commit—or a trail of commits made before tests ran. commit-discipline-mcp puts a small, deterministic control loop around that work.

Common failure mode

Built-in guardrail

One giant, hard-to-review commit

Every task is planned into 2–4 ordered stages

Tests are run after the commit

The detected test suite must pass before staging

Unrelated files sneak into a commit

Files outside the active stage block the operation

An agent skips ahead

Only the next pending stage can be committed

Manual commits invalidate the plan

Unexpected HEAD movement is detected

A tool silently pushes code

This package never pushes or rewrites Git history

It works with Codex, Claude Code, Cursor, and any MCP client that supports stdio tools. The same workflow is also available as a regular CLI.

Related MCP server: Development Workflow MCP Server

Quick start

Requirements: Node.js 18+, Git, and a clean Git repository.

npx -y commit-discipline-mcp@latest init --client all --yes

That command adds project-scoped MCP configuration and a reusable commit-discipline skill. Commit the generated files, reload your coding client, and ask:

Use commit-discipline to split this task into small test-gated stages. Commit each completed stage and finish the task when the worktree is clean.

Choose clients explicitly when needed:

npx -y commit-discipline-mcp@latest init --client codex --yes
npx -y commit-discipline-mcp@latest init --client claude --yes
npx -y commit-discipline-mcp@latest init --client cursor --yes

Client

MCP configuration

Installed skill

Codex

.codex/config.toml

.codex/skills/commit-discipline/SKILL.md

Claude Code

.mcp.json

.claude/skills/commit-discipline/SKILL.md

Cursor

.cursor/mcp.json

.cursor/skills/commit-discipline/SKILL.md

Use --dry-run to preview changes. Existing configuration is merged and backed up; --force is required to replace a conflicting entry.

How it works

flowchart LR
    A[Clean repository] --> B[Plan 2–4 stages]
    B --> C[Work on current stage]
    C --> D{Tests pass?}
    D -- No --> C
    D -- Yes --> E[Validate scope and limits]
    E --> F[Create focused commit]
    F --> G{Stages left?}
    G -- Yes --> C
    G -- No --> H[Finish with clean worktree]

The MCP server exposes four focused tools:

Tool

Purpose

plan_task

Record 2–4 stages with exact repository-relative files

commit_stage

Test, validate, stage, and commit only the active stage

task_status

Report progress and the next permitted stage

finish_task

Verify all stages are complete and the worktree is clean

Plan state is stored locally in .commit-discipline/plan.json and ignored by default.

CLI workflow

Prefer a terminal? Install the binary globally:

npm install --global commit-discipline-mcp

Create a stage file:

[
  {
    "id": "core",
    "title": "Build the core",
    "description": "Implement the service layer",
    "files": ["src/core.ts"]
  },
  {
    "id": "tests",
    "title": "Add coverage",
    "description": "Cover the service behavior",
    "files": ["tests/core.test.ts"]
  }
]

Then run the lifecycle:

commit-discipline plan-task --description "Build the feature" --stages-file stages.json
commit-discipline task-status
commit-discipline commit-stage core --message "feat: add core service"
commit-discipline commit-stage tests --message "test: cover core service"
commit-discipline finish-task

See the guided throwaway-repository demo for copy-pasteable PowerShell and Bash examples.

Configuration

Add commit-discipline.config.json to the repository root when the defaults need adjustment:

{
  "schemaVersion": 1,
  "enforcement": "strict",
  "maxFiles": 15,
  "maxLines": 400,
  "testTimeoutMs": 900000,
  "planVisibility": "local",
  "testCommand": {
    "command": "npm",
    "args": ["test"]
  }
}

Option

Default

Behavior

enforcement

warn

Use strict to block stages over configured limits

maxFiles

15

Maximum changed files per stage

maxLines

400

Maximum added and deleted lines per stage

testTimeoutMs

900000

Test-process timeout in milliseconds

planVisibility

local

Store plan state locally or as tracked project state

testCommand

auto-detected

Override the test command and arguments

Without an override, the tool detects one JavaScript, Python, Go, Rust, or Make test ecosystem. If several ecosystems are present, set testCommand explicitly. Failed tests always block a commit.

  • --file <path> commits a subset of the active stage's declared files.

  • --max-files N and --max-lines N apply one-off limits.

  • --dry-run validates a stage without tests, staging, commits, or state changes.

  • --json returns machine-readable output for scripts and agents.

Safety by design

  • Plans start only from a clean worktree.

  • Absolute paths and path traversal are rejected.

  • Pre-existing staged files and out-of-scope changes are blocked.

  • Tests run before staging; scope is checked again afterward.

  • Dry runs do not mutate Git or plan state.

  • No runtime network calls and no telemetry.

  • No git push, force operations, resets, or history rewriting.

Platform support

Every release is exercised across Windows, Ubuntu, and macOS on Node.js 18, 20, and 22. Packed-package smoke tests cover the full CLI lifecycle and the MCP stdio handshake.

Platform

Native launch path

Status

Windows

cmd.exe + npm shim

Tested in PowerShell and Command Prompt

Linux

npx

Tested in Bash

macOS

npx

Tested in Zsh

For implementation details and trust boundaries, read the architecture overview. Reusable starting points are available in examples/.

Development

git clone https://github.com/ayush-singh-0601/commit-discipline-mcp.git
cd commit-discipline-mcp
npm ci
npm run verify
npm run smoke:package
npm run benchmark:git

The release gate includes type checking, 46+ unit and integration tests, package installation, a complete CLI/MCP lifecycle, and a Git-overhead benchmark against the PRD's 300 ms target.

Community

If this project makes your agent-generated Git history easier to review, consider starring it—it helps other developers discover the tool.

License

MIT © Ayush Singh

Available Tools

4 tools
commit_stageCommit the next stageA
Destructive

Test, size-check, stage, and commit only the next declared plan stage.

ParametersJSON Schema
NameRequiredDescriptionDefault
filesNo
stageYes
dryRunNo
messageYes
maxFilesNo
maxLinesNo

TDQS

A3.5/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already declare destructiveHint=true, and the description adds the workflow pattern of testing, size-checking, staging, and committing, as well as the scoping to a single declared stage. It does not contradict annotations, and it enriches the behavioral context beyond just 'destructive'. However, it does not disclose failure modes or side effects such as what happens if tests fail.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The entire description is a single, front-loaded sentence that clearly communicates the action and scope. No filler or redundancy.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

With six parameters, a destructive annotation, and no output schema, the description is quite minimal. It does not mention prerequisites (e.g., a declared plan), what happens if size checks fail, or the effect of dryRun. This leaves important gaps for an agent aiming to invoke the tool correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters1/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description makes no reference to the six input parameters. Schema coverage is 0%, and the description does not compensate by explaining what 'files', 'dryRun', 'maxFiles', or 'maxLines' mean. The only implicit mention is 'stage', but it is not tied to the parameter definition.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description uses a specific compound verb ('Test, size-check, stage, and commit') and identifies the resource as 'the next declared plan stage' with a scoping constraint ('only'). This distinguishes it from sibling tools like plan_task, task_status, and finish_task, making its purpose clear.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies when to use the tool (when a plan stage is ready to commit) but does not explicitly state exclusions or mention alternative tools. The phrase 'only the next declared plan stage' provides some contextual constraint but lacks explicit 'use when' or 'instead of' guidance.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

finish_taskFinish a taskA
Idempotent

Mark a complete, clean task plan as finished.

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

A4.1/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

The annotations already declare idempotentHint=true and destructiveHint=false, so the safety profile is covered. The description adds the behavioral precondition that the plan must be complete and clean, which is valuable context beyond annotations. It does not describe side effects of finishing, but given annotations, this is sufficient.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single sentence with no wasted words. It front-loads the action 'Mark' and immediately specifies the target and qualifiers. It is appropriately concise for a simple tool.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The tool has no parameters, no output schema, and annotations cover idempotency and safety. The description provides the purpose and a precondition, which is sufficient for an agent to decide when to use it. It could mention the absence of return values, but that is not required without an output schema.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool takes zero parameters, and the schema is trivially complete with 100% coverage. The baseline for zero-parameter tools is 4, and the description contains no parameter information because none is needed. This is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description uses a specific verb 'Mark' and identifies the resource 'task plan' and the resulting state 'finished'. It clearly distinguishes from siblings like plan_task and task_status by indicating the finalization action. However, it does not explicitly contrast with sibling tools, so it stops short of a 5.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description states the precondition 'complete, clean task plan,' which implies when the tool should be used and implicitly warns against using it on incomplete or unclean plans. It does not mention alternative tools, but the condition provides clear usage context. There are no explicit exclusions beyond the condition.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

plan_taskPlan a taskA

Create an ordered 2-4 stage commit plan from a clean Git worktree.

ParametersJSON Schema
NameRequiredDescriptionDefault
stagesYes
descriptionYes

TDQS

A3.7/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations are all false, so the description must disclose behavioral traits. It adds the clean-worktree precondition but does not explain side effects (e.g., where the plan is stored), validation behavior, or return output. This is partial transparency.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single sentence that front-loads the action and object, includes key constraints (ordered, 2-4 stages, clean worktree), and contains no filler.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

With no output schema, no parameter documentation, and only a terse description, the agent lacks essential context about how to construct stages, what the plan is used for, or how it relates to sibling tools. The workflow context is not explained, leaving significant gaps for a tool with nested parameters.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, and the description does not explain what the top-level 'description' parameter means or what the stage object fields (e.g., 'files') represent. The term 'commit plan' hints at context, but the description leaves too much to inference for a nested structure.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states a specific action ('Create'), a concrete resource ('ordered 2-4 stage commit plan'), and a condition ('from a clean Git worktree'). This clearly differentiates plan_task from siblings like commit_stage and task_status by focusing on the planning phase.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It provides a clear prerequisite ('clean Git worktree') and scope ('2-4 stage'), which imply usage during initial planning. However, it does not explicitly mention when not to use or name alternatives, stopping short of full usage guidance.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

task_statusRead task statusA
Read-onlyIdempotent

Read the active plan, completed commits, and next stage.

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

A4.2/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already declare readOnlyHint, idempotentHint, and destructiveHint=false. The description adds useful context by specifying exactly what is read (active plan, completed commits, next stage), which enriches the behavioral picture without contradicting annotations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

A single, concise sentence conveys the tool's purpose and contents without any filler or repetition. It front-loads the key information effectively.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a zero-parameter, read-only tool with supportive annotations, the description adequately explains the tool. It could mention the return format, but given the simplicity and absence of parameters, the current description is sufficient for an agent to select and invoke it correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has zero parameters, so the baseline of 4 applies. The description does not need to explain parameters, and there is no ambiguity to resolve.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description uses the specific verb 'Read' and names the resource 'task status', then details the content ('active plan, completed commits, and next stage'). This clearly distinguishes it from sibling tools like plan_task and commit_stage, which imply mutation.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies this tool is for checking status without modifying anything, and sibling names suggest it as an alternative to planning/committing. However, it provides no explicit when-to-use or when-not-to-use guidance, leaving the context to inference.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. 4 tool updatesv0.1.0
    • First observedcommit_stage
    • First observedfinish_task
    • First observedplan_task
    • First observedtask_status

TDQS

A4.1/5.0
Disambiguation5/5

Each tool has a unique, non-overlapping role: plan creation, stage execution, status inspection, and task completion. No ambiguity in purpose.

Naming Consistency5/5

All tool names follow the consistent verb_noun pattern (plan_task, commit_stage, task_status, finish_task), making the API predictable.

Tool Count5/5

4 tools provide a focused, well-scoped workflow for commit discipline without unnecessary bloat or missing essentials.

Completeness5/5

The toolset covers the full lifecycle: create plan, execute stages, check status, and finish. No obvious gaps in the workflow.

Maintenance

ActivityMaintained
ResponsivenessSyncing

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/ayush-singh-0601/commit-discipline-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server