Skip to main content

Sutra: governed AI coding flow for Codex/Gemini and Claude Code

Project description

Sutra CLI

Sutra is a governed AI development orchestrator that lets Codex or Gemini plan, Claude Code execute, and Sutra validate, confirm, track, and report the flow.

It is intentionally lightweight: a local Python CLI that can be installed directly into a repo and used from terminal.


What Sutra does

  • Validates that Codex/Gemini and Claude Code are available from the same developer shell.
  • Confirms the chain: Codex/Gemini -> Sutra -> Claude Code.
  • Converts a requirement file into bounded Claude Code tasks.
  • Shows the tasks before execution.
  • Requires confirmation before running tasks unless --yes / --auto-approve is used.
  • Runs Claude Code task-by-task with timeout, max turns, model, budget, and allowed tools.
  • Runs validation commands after every task.
  • Tracks progress in .sutra/runs/<RUN_ID>/progress.json and docs/progress.md.
  • Tracks Claude token usage or estimated usage in .sutra/runs/<RUN_ID>/token-ledger.json.
  • Produces a run summary.

Installation

Option 1: From PyPI (Recommended)

Install the standalone tool globally using pipx:

pipx install sutra-cli

Or using standard pip:

python -m pip install sutra-cli

Option 2: Standalone Binary

Download the pre-compiled binary for your operating system from the Latest Releases page. No Python installation is required.

Option 3: From GitHub Source

Install the latest development version directly from the repository:

pipx install git+https://github.com/sairintechnologycom/sutra.git

Option 4: Local Development

If you are contributing to Sutra, install it in editable mode:

git clone https://github.com/sairintechnologycom/sutra.git
cd code_orchestrator
python -m pip install -e .

Verify the installation:

sutra --help

Prerequisites

Install and authenticate the CLIs you want to use:

claude --version
codex --version
# or
gemini --version

Sutra does not directly authenticate these tools. It validates that they are installed, callable, and usable in headless mode.


First-time setup in a repo

sutra init

This creates:

.sutra/config.json
CLAUDE.md
AGENTS.md
GEMINI.md
.claude/settings.json
.claude/skills/implement-task/SKILL.md
docs/progress.md
docs/decisions.md
requirements/REQ-001.md

Confirm Codex/Gemini is connected to Claude through Sutra

For Codex:

sutra doctor --engine codex --smoke-test

For Gemini:

sutra doctor --engine gemini --smoke-test

Expected successful output includes:

CHAIN CONFIRMED: codex -> Sutra -> Claude Code

or:

CHAIN CONFIRMED: gemini -> Sutra -> Claude Code

This means Sutra can invoke the planner and Claude Code from the same environment.


Normal developer flow

1. Write a requirement

Example:

requirements/REQ-001.md
# Requirement: Add Student Progress Dashboard

## Goal
Build a dashboard that shows progress by subject, topic, quiz score, and mastery level.

## Expected Outcome
- Dashboard page created
- API endpoint added if required
- Tests added
- Existing tests pass

## Constraints
- Use existing frontend layout
- Do not introduce a new UI library
- Do not change authentication flow

## Validation
- npm test passes
- npm run lint passes

2. Generate task plan

sutra plan --input requirements/REQ-001.md --engine codex

or:

sutra plan --input requirements/REQ-001.md --engine gemini

Sutra shows the generated tasks immediately.

3. Validate

sutra validate --run REQ-001

4. Approve

sutra approve --run REQ-001

5. Run

sutra run --run REQ-001 --smoke-test

Sutra shows each task before and during execution:

▶ Executing T001: Inspect repository, confirm scope, and identify required files
  model=sonnet timeout=300s max_turns=2
  allowed_tools=Read, Bash(git status *), Bash(git diff *)

Fully automated mode

sutra run \
  --input requirements/REQ-001.md \
  --engine codex \
  --auto-approve \
  --smoke-test

Use this only when .claude/settings.json and .sutra/config.json are properly locked down.


Dry run

Dry run shows the planned task execution without invoking Claude Code:

sutra run --run REQ-001 --dry-run -y --skip-doctor

Token report

sutra tokens report --run REQ-001

Important: actual token usage is used when Claude output exposes usage metadata. Otherwise, Sutra estimates token usage using prompt/output size and calculates savings against the configured baseline multiplier.

Config location:

.sutra/config.json

Default baseline:

{
  "policy": {
    "token_baseline_multiplier": 1.5
  }
}

Formula:

tokens_saved = estimated_baseline_tokens - actual_or_estimated_tokens

Main commands

sutra init
sutra doctor --engine codex --smoke-test
sutra plan --input requirements/REQ-001.md --engine codex
sutra validate --run REQ-001
sutra approve --run REQ-001
sutra run --run REQ-001
sutra run-task --run REQ-001 --task T002
sutra status --run REQ-001
sutra summarize --run REQ-001
sutra tokens report --run REQ-001

Safety model

Sutra uses several controls:

  • CLI chain validation before execution.
  • Task plan validation.
  • Human confirmation before execution by default.
  • Claude timeout per task.
  • Claude max-turns per task.
  • Claude allowed tools per task.
  • Validation command allow-list.
  • Dangerous command deny-list.
  • Progress and token ledger after each task.

Current MVP limitations

  • Token savings are estimates unless Claude Code emits usage details in structured output.
  • Codex/Gemini planner output must be valid JSON; otherwise Sutra falls back to a local deterministic starter plan unless --strict-planner is used.
  • Sutra validates the chain via Sutra-mediated execution, not a direct native integration between Codex/Gemini and Claude.
  • The CLI is local-first and does not yet include a remote dashboard.

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

sutra_cli-0.3.3.tar.gz (28.8 kB view details)

Uploaded Source

Built Distribution

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

sutra_cli-0.3.3-py3-none-any.whl (26.8 kB view details)

Uploaded Python 3

File details

Details for the file sutra_cli-0.3.3.tar.gz.

File metadata

  • Download URL: sutra_cli-0.3.3.tar.gz
  • Upload date:
  • Size: 28.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for sutra_cli-0.3.3.tar.gz
Algorithm Hash digest
SHA256 75cea527604b2acb853d9864e01a33b13852bf6b2919a6cf279409181a22c463
MD5 f8cc31d62ee54ff58c1c4ce86af5d416
BLAKE2b-256 b4bda8756ab560901b8fe1be1c7801af56eac9deadd09cbc377c7e7eb3ee9280

See more details on using hashes here.

Provenance

The following attestation bundles were made for sutra_cli-0.3.3.tar.gz:

Publisher: release.yml on sairintechnologycom/sutra

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file sutra_cli-0.3.3-py3-none-any.whl.

File metadata

  • Download URL: sutra_cli-0.3.3-py3-none-any.whl
  • Upload date:
  • Size: 26.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for sutra_cli-0.3.3-py3-none-any.whl
Algorithm Hash digest
SHA256 ce31595378ba601af35421308ef354e4950d624f2e832da5a0269a29b9c68719
MD5 b47dfba686f2f199240391fb26314e74
BLAKE2b-256 633739c8b7d5d5e101f2009e6e2ccd3fcaa153ddae6127acb597674df1075802

See more details on using hashes here.

Provenance

The following attestation bundles were made for sutra_cli-0.3.3-py3-none-any.whl:

Publisher: release.yml on sairintechnologycom/sutra

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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