Skip to main content

A persistent, governed AI team for Claude Code — a named cast of specialists, enforced governance hooks, a shared decision log, and an autonomous issue-triage loop.

Project description

Troupe

A persistent, governed AI team for Claude Code.

Troupe gives your repository a named cast of AI specialists — a lead, a backend dev, a frontend dev, a tester — that live in your repo as files. They keep their names, charters, and accumulated knowledge across sessions, share an append-only architectural decision log, work under governance rules enforced by real Claude Code hooks (not polite prompt suggestions), and can optionally triage your GitHub issues overnight.

⚠️ Alpha software. Interfaces may change between releases. Reeve (the autonomous watch) spends real money when you pass --execute — read its safety model first.

$ uvx troupe init

Cast:
  Wright     Lead
  Mason      Backend
  Webster    Frontend
  Sawyer     Tester
Created 24 file(s), left 0 untouched.

Why Troupe when Agent Teams exists

Claude Code's experimental Agent Teams already does orchestration well: a team lead, parallel teammates with their own context windows, a shared task list, inter-agent messaging. Troupe builds none of that. It fills the gaps that are file-shaped — the things that vanish when the session ends:

Agent Teams (native) Troupe adds
Team identity Session-scoped; teams are named session-… and dissolve on exit A persistent cast with names, charters, and per-member history, committed to the repo
Rules & memory Task list persists per session, holds ephemeral work items decisions.md (append-only decision log) + directives.md (standing rules), injected into every session
Governance Permission modes and hook capability Enforced policy content: file-write guard, PII scrub, reviewer lockout, bounded idle nudge — emitted as working hooks
Unattended work Reeve: a schedulable issue watch with hard cost/turn/time ceilings

Compared to its prior art, Squad (which pioneered this model for GitHub Copilot CLI): Troupe is Python-native, targets Claude Code, and leans on Agent Teams for all orchestration instead of shipping its own coordinator. Compared to orchestrators like Gas Town or Multiclaude, Troupe doesn't compete on spawn mechanics at all — it's the persistence and governance layer underneath whatever does the orchestrating.

Works with the Agent Teams flag on (cast members become teammate types); degrades gracefully to plain subagents when it's off. Both paths use the same .claude/agents/ definitions.

Quick start

Requirements: Python 3.11+, uv (or pip), Claude Code. gh CLI only if you use Reeve.

cd your-project
uvx troupe init                       # default cast: lead, backend, frontend, tester
uvx troupe init --roles lead,backend,frontend,tester,security,devops,docs
git add .troupe .claude && git commit -m "cast the troupe"

Then open Claude Code in the project. The SessionStart hook injects the roster, standing rules, and recent decisions into every session automatically. Spawn cast members as subagents (or, with CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1, as teammates) by their agent type:

Spawn a teammate using the mason agent type to build the API endpoints,
and sawyer to write tests for them.

Check or repair a setup any time:

uvx troupe doctor      # diagnoses scaffold, hooks, wiring, environment
uvx troupe upgrade     # refreshes troupe-owned files; never touches team state

What gets created

.troupe/
├── team.md              # roster
├── decisions.md         # append-only decision log (auto-fed by hook)
├── directives.md        # standing rules, edit in place
├── policy.json          # governance policy: protected paths, PII, gates
├── config.json · casting-state.json
└── agents/{name}/
    ├── charter.md       # role definition — yours to edit
    └── history.md       # accumulated knowledge — the agent appends
.claude/
├── settings.json        # hook wiring (merged non-destructively)
├── hooks/               # six self-contained governance scripts (stdlib-only)
└── agents/{name}.md     # compiled definitions: teammate types AND subagents

Commit .troupe/ and .claude/. Anyone who clones gets the team — same names, same knowledge, same rules.

The cast

Names come from English occupational surnames, chosen so the etymology quietly maps to the role: Wright (master builder) leads, Mason (foundations) takes backend, Webster (weaver — of webs) takes frontend, Sawyer (cuts things open) tests, Ward (watchman) does security, Piper (keeps pipes flowing) does DevOps, Page does docs. A 24-name pool with role affinities backs larger casts; names are never reused within a project, even after a member retires.

Governance — enforced, not suggested

troupe init emits six hook scripts into .claude/hooks/ — self-contained, stdlib-only Python, so they run on any machine with no troupe install on the per-tool-call hot path:

Hook Event What it enforces
File guard PreToolUse Blocks agent writes to protected paths (casting state, charters, policy itself, hooks, .env*, keys) per policy.json
PII scrub PreToolUse Redacts email addresses in place before content is written; allowlist for intentional ones
Decision log TaskCompleted Appends a structured entry to decisions.md for every completed task
Review gate TaskCompleted Opt-in: blocks completion until a human drops a marker in .troupe/approvals/ — which is itself write-protected, so agents can't self-approve
Idle nudge TeammateIdle Sends idling teammates back for a final sweep — strictly bounded (2 nudges/agent/session), so no infinite keep-alive
Session context SessionStart Injects roster + directives + recent decisions into every session

Policy lives in .troupe/policy.json — patterns, allowlists, and toggles are yours to edit; the file guard protects the file itself from agents.

Reeve — the autonomous issue watch

A reeve was the manorial overseer: the one who made sure the estate's work actually got done. Reeve polls GitHub issues labeled troupe and, only when explicitly told, dispatches headless Claude Code sessions to work them.

uvx troupe watch --once               # one read-only triage cycle (cron-friendly)
uvx troupe watch                      # poll every 10 min, still read-only
uvx troupe watch --execute            # actually work issues (costs money)

Safety model, in order of the walls you'd hit:

  • Triage-only by default. No --execute → no writes, no agent runs, no cost. Ever.
  • Reeve itself never writes to GitHub. Comments happen inside the governed Claude session, under its permission rules (acceptEdits + a narrow gh/git-read allowlist). --skip-permissions exists but is refused without --execute.
  • Governance stays on during unattended work. Runs are non-bare and pass --settings explicitly, so the file guard and PII scrub fire exactly when nobody's watching.
  • Three independent ceilings per run: --max-turns (30), --max-budget-usd (native cost cap), and --timeout-minutes (30, hard wall-clock kill for hangs).
  • Two accumulating ceilings: --max-cost-per-cycle ($2) and --max-cost-per-day ($10), tracked from the JSON output's total_cost_usd.
  • Per-issue backoff: a failing issue cools down 2 cycles per failure and escalates to humans after 3 failures (--reset-backoff clears the ledger).
  • Clean shutdown: touch .troupe/reeve-stop — Reeve finishes the cycle and exits. The sentinel is write-protected from agents; only you can stop the overseer.

Run it from cron, a systemd timer, or Task Scheduler with --once. Point it at a throwaway repo first.

Upgrading

uv tool upgrade troupe   # or: pip install -U troupe
uvx troupe upgrade       # refresh hook scripts, agent definitions, policy sections

troupe upgrade never touches team state (charters, histories, decisions, directives, casting) and never modifies policy keys you've edited — it only adds missing sections.

Development

git clone https://github.com/KevinIssaDev/troupe && cd troupe
uv sync --dev
uv run pytest            # 86 tests; gh and claude are stubbed throughout
uv run ruff check . && uv run pyright

CI runs the suite on Ubuntu, macOS, and Windows (cross-platform is a first-class concern — paths via pathlib, subprocess in list form, no shell strings). Releases publish to PyPI via Trusted Publishing on version tags.

License

MIT — see LICENSE. Squad (MIT, by @bradygaster) is gratefully acknowledged as prior art for the architecture and conventions; Troupe shares no code, name, or cast with it.

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

troupe-0.2.0.tar.gz (96.2 kB view details)

Uploaded Source

Built Distribution

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

troupe-0.2.0-py3-none-any.whl (66.6 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for troupe-0.2.0.tar.gz
Algorithm Hash digest
SHA256 caaffded393908e272758c3e5fa3fd865e5583df7a32d714098d12bfbfd9fcaf
MD5 78cc212e74bcc26c977147147798078a
BLAKE2b-256 89724178fc0c91636090c298b8fd5806b0a818c7e252d6baf36852abdbbbea29

See more details on using hashes here.

Provenance

The following attestation bundles were made for troupe-0.2.0.tar.gz:

Publisher: release.yml on KevinIssaDev/troupe

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

File details

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

File metadata

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

File hashes

Hashes for troupe-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 92089c952d4664ceb6b173bdf8b71f53fcc4494b0f6ee5ee70e497f55d761aff
MD5 0e4d754432353dad1d9ce7fb23d0cfc1
BLAKE2b-256 a57cd8350e350492fed21d2dfc2f5276d2c563f93ffee264e74a398816d250ef

See more details on using hashes here.

Provenance

The following attestation bundles were made for troupe-0.2.0-py3-none-any.whl:

Publisher: release.yml on KevinIssaDev/troupe

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