External orchestrator for spec-kitty, integrating via the orchestrator-api contract
Project description
spec-kitty-orchestrator
External orchestrator for the spec-kitty workflow system.
Coordinates multiple AI agents to autonomously implement and review work packages (WPs) in parallel. Integrates with spec-kitty exclusively via the versioned orchestrator-api CLI contract — no direct file access, no internal imports.
How it works
spec-kitty-orchestrator
│
│ spec-kitty orchestrator-api <cmd> --json
▼
spec-kitty (host)
│
└── kitty-specs/<feature>/tasks/WP01..WPn.md
The orchestrator polls the host for ready work packages, spawns AI agents in worktrees, and transitions each WP through planned → claimed → in_progress → for_review → done by calling the host API at each step. All workflow state lives in spec-kitty; the orchestrator only tracks provider-local data (retry counts, log paths, agent choices).
Requirements
- Python 3.10+
- spec-kitty ≥ 2.x installed and on PATH (provides the
orchestrator-apicontract) - At least one supported AI agent CLI installed (see Supported agents)
Installation
pip install spec-kitty-orchestrator
Or from source:
git clone https://github.com/spec-kitty/spec-kitty-orchestrator
cd spec-kitty-orchestrator
pip install -e ".[dev]"
Quick start
# Verify contract compatibility with the installed spec-kitty
spec-kitty orchestrator-api contract-version --json
# Dry-run to validate configuration
spec-kitty-orchestrator orchestrate --feature 034-my-feature --dry-run
# Run the orchestration loop
spec-kitty-orchestrator orchestrate --feature 034-my-feature
The orchestrator will:
- List all WPs with satisfied dependencies
- Claim each ready WP via the host API
- Spawn the implementation agent in the WP's worktree
- Submit to review when implementation completes
- Transition to
doneon review approval, or re-implement with feedback on rejection - Accept the feature when all WPs are done
CLI reference
spec-kitty-orchestrator orchestrate --feature <slug>
[--impl-agent <id>]
[--review-agent <id>]
[--max-concurrent <n>]
[--actor <identity>]
[--repo-root <path>]
[--dry-run]
spec-kitty-orchestrator status [--repo-root <path>]
spec-kitty-orchestrator resume [--actor <identity>]
[--repo-root <path>]
spec-kitty-orchestrator abort [--cleanup-worktrees]
[--repo-root <path>]
orchestrate
Starts a new orchestration run for the named feature. Runs until all WPs reach a terminal lane (done, canceled, or blocked) or a dependency deadlock is detected.
| Flag | Default | Description |
|---|---|---|
--feature |
required | Feature slug (e.g. 034-auth-system) |
--impl-agent |
claude-code |
Override implementation agent |
--review-agent |
claude-code |
Override review agent |
--max-concurrent |
4 |
Max WPs in flight simultaneously |
--actor |
spec-kitty-orchestrator |
Actor identity recorded in events |
--dry-run |
off | Validate config only, don't execute |
status
Shows the provider-local run state (retry counts, agent choices, errors) from the most recent run.
resume
Resumes an interrupted run from saved state. The host already tracks lane state, so the loop simply re-polls for ready WPs.
abort
Records the run as aborted. Use --cleanup-worktrees to delete the provider state file.
Configuration
Optional YAML config at .kittify/orchestrator.yaml:
max_concurrent_wps: 4
agents:
implementation:
- claude-code
- gemini
review:
- claude-code
max_retries: 2
timeout_seconds: 3600
single_agent_mode: false
Supported agents
| Agent ID | CLI binary | stdin? | Notes |
|---|---|---|---|
claude-code |
claude |
yes | Default; JSON output via --output-format json |
codex |
codex |
yes | codex exec - with --full-auto |
copilot |
gh |
no | Requires gh extension install github/gh-copilot |
gemini |
gemini |
yes | Specific exit codes for auth/rate-limit errors |
qwen |
qwen |
yes | Fork of Gemini CLI |
opencode |
opencode |
yes | Multi-provider; JSONL streaming output |
kilocode |
kilocode |
no | Prompt as positional arg with -a --yolo -j |
augment |
auggie |
no | --acp mode; no JSON output |
cursor |
cursor |
no | Always wrapped with timeout to prevent hangs |
The orchestrator detects installed agents automatically at startup:
python3 -c "from spec_kitty_orchestrator.agents import detect_installed_agents; print(detect_installed_agents())"
Policy metadata
Every host mutation call includes a PolicyMetadata block that declares the orchestrator's identity and capability scope. The host validates and records this alongside every WP event, creating a full audit trail.
PolicyMetadata(
orchestrator_id="spec-kitty-orchestrator",
orchestrator_version="0.1.0",
agent_family="claude",
approval_mode="full_auto", # full_auto | interactive | supervised
sandbox_mode="workspace_write", # workspace_write | read_only | none
network_mode="none", # allowlist | none | open
dangerous_flags=[],
)
Policy fields are validated on both sides: the provider rejects secret-like values before sending; the host rejects missing or malformed policy on run-affecting commands.
Security boundary
The orchestrator has no direct access to spec-kitty internals:
- No imports from
specify_cliorspec_kitty_events - No direct reads or writes to
kitty-specs/ - No git operations — worktree creation is delegated to the host via
start-implementation - All state mutations go through
HostClientsubprocess calls
This is enforced at test time:
# Boundary check (must print OK)
grep -r "specify_cli\|spec_kitty_events" src/spec_kitty_orchestrator/ && echo "FAIL" || echo "OK"
# AST-level import check in conformance suite
python3.11 -m pytest tests/conformance/test_contract.py::TestBoundaryCheck
Provider-local state
The orchestrator writes only to .kittify/orchestrator-run-state.json (a file it owns). This tracks:
- Retry counts per WP per role
- Which agents were tried (for fallback)
- Log file paths
- Review feedback from rejected cycles
Lane/status fields are never stored locally — those are always read from the host.
Conformance tests
The tests/conformance/fixtures/ directory contains 13 canonical JSON fixtures that define the exact shape of every host API response. Both the host and provider test suites use these as source of truth.
python3.11 -m pytest tests/conformance/ -v
Development
pip install -e ".[dev]"
python3.11 -m pytest tests/
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file spec_kitty_orchestrator-0.1.0.tar.gz.
File metadata
- Download URL: spec_kitty_orchestrator-0.1.0.tar.gz
- Upload date:
- Size: 30.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
428b49c6445301d512f28374f664ff1d41bb6b68ca058cb9f5820743803d8d31
|
|
| MD5 |
9002d4c13b80119e907b5cc18f702b0c
|
|
| BLAKE2b-256 |
1c5bfefa387e6eeff0442f64a0075c40189673f05047561821b6c45530b9c1ae
|
Provenance
The following attestation bundles were made for spec_kitty_orchestrator-0.1.0.tar.gz:
Publisher:
publish-pypi.yml on Priivacy-ai/spec-kitty-orchestrator
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
spec_kitty_orchestrator-0.1.0.tar.gz -
Subject digest:
428b49c6445301d512f28374f664ff1d41bb6b68ca058cb9f5820743803d8d31 - Sigstore transparency entry: 962645980
- Sigstore integration time:
-
Permalink:
Priivacy-ai/spec-kitty-orchestrator@8b7addcf3b0e54a1b5c75374a51de58956ef4269 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/Priivacy-ai
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@8b7addcf3b0e54a1b5c75374a51de58956ef4269 -
Trigger Event:
release
-
Statement type:
File details
Details for the file spec_kitty_orchestrator-0.1.0-py3-none-any.whl.
File metadata
- Download URL: spec_kitty_orchestrator-0.1.0-py3-none-any.whl
- Upload date:
- Size: 37.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2986d6acc9350d50945c91fdbb29415cc86e1dae53a2ff9d92b7facc47ffe92f
|
|
| MD5 |
f79e2b495d29fa98b20923466e79642a
|
|
| BLAKE2b-256 |
231cebc973b8268b621ae08236d4304d6db735b891395a1318c1d9c5d4ec6bb7
|
Provenance
The following attestation bundles were made for spec_kitty_orchestrator-0.1.0-py3-none-any.whl:
Publisher:
publish-pypi.yml on Priivacy-ai/spec-kitty-orchestrator
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
spec_kitty_orchestrator-0.1.0-py3-none-any.whl -
Subject digest:
2986d6acc9350d50945c91fdbb29415cc86e1dae53a2ff9d92b7facc47ffe92f - Sigstore transparency entry: 962645983
- Sigstore integration time:
-
Permalink:
Priivacy-ai/spec-kitty-orchestrator@8b7addcf3b0e54a1b5c75374a51de58956ef4269 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/Priivacy-ai
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@8b7addcf3b0e54a1b5c75374a51de58956ef4269 -
Trigger Event:
release
-
Statement type: