Skip to main content

A step-gated micro-change protocol CLI for coding agents: propose, approve, execute, verify — one small step at a time.

Project description

stepgate

PyPI version Python License: MIT

A step-gated micro-change protocol for coding agents.

Coding agents (Claude Code, Codex, …) working on large or loosely-scoped tasks tend to mix contexts, silently expand scope, touch files unrelated to the original request, or declare success without real evidence. stepgate makes the correct workflow — investigate, propose, wait for approval, execute only what was approved, verify, suggest the next step — the single natural path of action, so that deviating from it is visible and recorded, never silent.

stepgate is not an enforcement tool. It never blocks your code, your editor, your commits, or git. You can always edit anything, commit anything, and cancel any agent session at any time. What it gives you is structure and an honest, append-only trail of what was proposed, approved, executed, and verified — across every agent working on the repo, even concurrently.

Install

pipx install stepgate   # recommended: one global install per machine
# or: pip install stepgate

Then, at the root of any project:

stepgate init

This creates .stepgate/ (state + append-only history) and injects an instruction block into AGENTS.md/CLAUDE.md telling agents to use the protocol. It is idempotent and never overwrites anything you wrote in those files — only the text between its own markers is ever touched. If your project already has a domain guardrails document, point to it with --guardrails GUARDRAILS.md and the generated block will reference it.

The protocol

Every micro-change is a proposal moving through a state machine, validated by the CLI itself:

PENDING ──approve──► APPROVED ──exec-log──► EXECUTED ──verify──► VERIFIED ──close──► CLOSED
   │
   └─reject──► REJECTED          (any non-terminal state) ──abandon──► ABANDONED

A proposal covers six points, each written as natural flowing prose (not a telegraphic form): what will change now, why this step comes first, where (files/contracts/flows touched), how it will be implemented, the expected result, and the verification that will demonstrate it.

Key rule: a micro-change reduces the scope of execution, never the depth of investigation — the agent still investigates everything it needs to understand before proposing, even if it will only implement a small piece.

A real cycle

You ask your agent to fix a race condition. It investigates, then proposes:

stepgate propose --agent claude --file plan.json

You read it rendered as prose, and approve with a tweak:

stepgate show
stepgate approve --adjust --note "rename the function to apply_sanity_loss_atomic"

The agent implements only what was approved, logs it (a git diff --stat is captured automatically as objective evidence), and verifies:

stepgate exec-log --summary "atomic decrement migration + typing" --files "migrations/013.sql,types.ts"
stepgate verify --evidence "type-check ok, simulated concurrency test passed"

You close the cycle; the agent suggests — but does not start — the next step:

stepgate close
stepgate next --suggest "wire SalaJogo.tsx to the new function via supabase.rpc(...)"

The suggestion stays visible in stepgate status until a new proposal is opened. The full trail lives in stepgate history — chronological, across all sessions and agents, append-only.

Commands

Command Purpose
stepgate init Create .stepgate/, inject the agent instruction block
stepgate propose --agent X --file plan.json Register a micro-change plan (PENDING)
stepgate show Render the active proposal as readable prose
stepgate approve [--adjust --scope ... --note ...] Approve (optionally with reduced scope)
stepgate reject --note "..." Reject a pending proposal
stepgate exec-log --summary "..." --files "..." Record execution (+ automatic git diff --stat)
stepgate verify --evidence "..." Record verification evidence
stepgate close Close a verified micro-change
stepgate abandon --reason "..." Cleanly abandon from any non-terminal state
stepgate next [--suggest "..."] With --suggest, record a next-step suggestion; without it, show the current one

The four flow verbs also accept Portuguese aliases — English stays the default: aprovar = approve, rejeitar = reject, fechar = close, proximo = next. | stepgate status | Current session + aggregated project view | | stepgate history [--session X] [--since DATE] | Append-only, cross-session log | | stepgate doctor | Report corrupted/invalid state files (fixes nothing) |

Multiple agents can work concurrently: each session has its own state file (.stepgate/sessions/claude-2026-07-09-1.json — human-readable names, not hashes), writes are file-locked, and propose/status warn — informationally, never blockingly — when two active proposals touch the same files.

Design principles

  • Never block. No git hooks, no file locks on your code, no commit gates. The file lock in .stepgate/ protects only stepgate's own state files.
  • Never act silently. No auto-repair, no auto-expiry of stale sessions, no rewriting of history. doctor diagnoses; a human decides.
  • Non-interactive by design. No prompts or confirmations, so it behaves identically in a terminal, a desktop app, or an IDE side-panel extension.
  • Structure when you opt in. Editing code without a proposal is a legitimate flow, not an error. The state machine gives shape to the agent workflow — it is never a requirement for the code to change.

License

MIT © Leo Costta

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

stepgate-0.2.0.tar.gz (20.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

stepgate-0.2.0-py3-none-any.whl (21.8 kB view details)

Uploaded Python 3

File details

Details for the file stepgate-0.2.0.tar.gz.

File metadata

  • Download URL: stepgate-0.2.0.tar.gz
  • Upload date:
  • Size: 20.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for stepgate-0.2.0.tar.gz
Algorithm Hash digest
SHA256 fe3515c44912ce9f93aaef7a5a23e8e1e8201c70ce3d5f2d5c1557cddaaa4f07
MD5 8c2b40ab875d9f46bdc435ac4a321ae7
BLAKE2b-256 f48fb2af8bfb2934673895bb2ed415017014b30ee8ad3d52c5a873d0fd614486

See more details on using hashes here.

File details

Details for the file stepgate-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: stepgate-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 21.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for stepgate-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 951320fbfcfdbb1b36a661cf0c4c22b4a1b071ada7072ef1d5df2ef43d88695d
MD5 f886e75bf96cd09bab10ae1a1a2f42f6
BLAKE2b-256 a7c80c419b5ab6cce60cff1f52e1b1ac926134c5f86af6faa1eb92bb0549fd57

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page