An agent orchestration framework to grow your AI's context.
Project description
Petri
An agent orchestration framework to grow your AI's context via Claude Code. Decomposes claims into DAGs of logical units and validates them bottom-up through a multi-agent adversarial review pipeline.
What results are a repository of curated information, citations, and URLs, organized by concepts, how they relate to each other, and the nuances of the claims. This is quite useful for AI agents to have pre-loaded context assets available for reference.
Petri includes both a CLI tool intended for AI agents and an interactive UI mode to help keep track of all active agents within Petri and to review the context, reasoning, and citations curated by the AI agents.
📖 Read the Petri Vision → — where Petri is headed: durable, auditable, model-independent deep research you own and can reshape.
Demo
https://github.com/user-attachments/assets/ef47dc07-741d-4ac5-9f35-2afb12fc9046
⚠️ Cost Warning ⚠️
Petri uses Claude via Claude Code, which costs money. Each cell goes through 13 agents across multiple iterations, generating significant token usage. A single colony with 10+ cells can produce thousands of LLM calls across Socratic analysis, research, critique, debate, red team, and evaluation phases.
The default model is claude-sonnet-4-6. You can switch models in petri.yaml or the setup wizard:
model:
name: claude-opus-4-6 # most capable, higher cost
Monitor your usage. Start with small claims to understand the cost profile before running large colonies.
Alternatively, you can use an open-source model in Claude Code via Ollama, by following this documentation. But this requires a bit of setup on your side, and you need hardware capable of running a model locally.
Setup
Petri needs Python 3.11+ and the Claude Code CLI (which provides the LLM inference). The cleanest path is to install both into a fresh uv environment.
1. Install uv
curl -LsSf https://astral.sh/uv/install.sh | sh
2. Create and activate a Python 3.11+ virtual environment
uv venv --python 3.11 .venv
source .venv/bin/activate # macOS / Linux
# .venv\Scripts\activate # Windows PowerShell
Every command from here on assumes this venv is active. If you open a new shell, re-run the source .venv/bin/activate line.
3. Install petri-grow into the venv
uv pip install petri-grow
4. Install and authenticate Claude Code
Petri uses Claude Code as its agent harness. Follow the install + login steps at https://docs.anthropic.com/en/docs/claude-code, then verify:
claude --version
5. Verify the full prerequisite chain
petri inspect
This reports any missing pieces (Python version, Claude Code login, PATH issues) without modifying your system.
Quickstart
Petri has two modes. Start with Interactive Mode — it's the fastest path from zero to a running colony.
Interactive Mode (recommended)
mkdir my-research && cd my-research
petri launch
petri launch auto-creates .petri/ from defaults, opens the Petri Lab dashboard at http://127.0.0.1:8090, and walks you through dish setup, seeding, growing, and inspection in the browser. No other commands required.
CLI Mode (AI-agent friendly)
Petri is designed to be AI agent first for UX. It's highly recommended to have a Claude Code session already started and pass this README file link (https://github.com/onthemarkdata/petri/blob/main/README.md) directly to Claude Code to set up.
# 1. Initialize a petri dish
mkdir my-research && cd my-research
petri init
# → Initialized petri dish 'my-research' at /path/to/my-research
# Model: claude-sonnet-4-6
# 2. Seed a colony from a claim
petri seed "Open source models will catch up to current frontier models in the next 6 months."
# → Colony 'open-source-models' created with 6 nodes across 3 levels
# 3. Check status
petri check
# → Shows a table of all cells with status PENDING
# 4. Grow cells through the validation pipeline
petri grow
# → Processes every eligible cell bottom-up: Socratic → Research → Critique → Red Team → Evaluation
# 5. Feed new evidence (requires cells that have completed validation)
petri feed https://arxiv.org/abs/2026.12345
# → Ingests content, matches to relevant cells, flags for re-validation
# 6. Analyze
petri graph # text tree / DOT export
petri launch # Live web dashboard on port 8090
petri scan --fix # contradiction scanner
# → `graph` shows the colony DAG as text;
# `launch` opens the full Petri Lab dashboard (Computer tab,
# Lab overview, Colony DAG, Logs, Cell detail)
# 7. Stop
petri stop
# → Gracefully halts any active processing
See ARCHITECTURE.md for the full pipeline and state machine details.
CLI Reference
petri --help
| Command | Description | Key Flags |
|---|---|---|
petri init |
Create .petri/ directory with defaults (interactive setup wizard) |
--name, --no-questions |
petri seed <claim> |
Decompose a claim into a colony DAG | --no-questions, --colony |
petri check |
Show cell statuses across colonies | --colony, --cell, --json |
petri grow |
Run cells through the validation pipeline (defaults to all eligible) | --cell, --colony, --dry-run, --max-concurrent |
petri feed <source> |
Ingest new evidence and flag affected cells | --colony, --auto-reopen |
petri graph |
Render the colony DAG as text tree or DOT | --format, --colony |
petri scan |
Run the contradiction scanner | --fix, --loop |
petri connect <a> <b> |
Inspect or create a dependency edge between two cells | |
petri launch |
Open the live web dashboard | --port, --host |
petri stop |
Gracefully halt active processing | --force |
petri inspect |
Check that all prerequisites are installed |
Typical workflow:
petri init-- one-time setuppetri seed "your claim"-- decompose into a colonypetri grow-- validate bottom-up (leaf cells first, then parents)petri check-- inspect progresspetri feed <url>-- add evidence, re-open affected cellspetri grow-- re-validate impacted cellspetri graph-- view the final colony structure
Note:
petri growwith no flags processes every currently eligible cell. For multi-level colonies, run it multiple times until all levels are resolved — leaf cells validate first, unlocking their parents. Scope to a subset with--cell <id>(repeatable) or--colony <name>.
How It Works
Each cell in the colony goes through:
- Socratic questioning -- Clarify terms, challenge assumptions, identify what evidence is needed
- Research phase -- Investigator gathers evidence with URL-cited sources, Freshness Checker verifies currency, Dependency Auditor checks prerequisites
- Critique phase -- Specialist agents assess in parallel, Cell Lead mediates structured debates
- Convergence check -- All blocking verdicts must pass (mechanical check, no LLM)
- Circuit breaker -- Max 3 iterations per cycle; if not converged, flags for human guidance
- Red Team -- Dedicated adversarial phase builds the strongest case against the cell
- Evidence Evaluation -- Neutral weighing of all evidence: VALIDATED, DISPROVEN, or DEFER
Citation-first evidence model: Every agent must back claims with URL-linked sources ranked by a 6-level hierarchy (direct measurement → community report). Summaries are kept terse to prevent context rot across iterations.
Every action is logged as an immutable event in the cell's JSONL file, identified by a composite key ({dish}-{colony}-{level}-{seq}-{8hex}).
Architecture
- Multi-agent pipeline: lead orchestrators + specialists (blocking and advisory)
- Event sourcing: append-only JSONL per cell, rolled up to SQLite for the dashboard
- Queue state machine: enforced transitions, file-locked for concurrency
- Claude Code native: Petri runs on top of the Claude Code CLI as its agent harness — Claude Code is a hard dependency, not a pluggable option. The
adapters/layer exists for internal separation of concerns, not to enable other harnesses. - Live dashboard: single-file SPA with PTY-backed terminal, interactive colony DAG, and per-cell detail pages
See ARCHITECTURE.md for the full design, state machine diagram, and agent details.
Development
uv pip install -e ".[all]"
uv run pytest tests/
Contributing
Petri is mid-flight on its v2 migration — re-platforming onto Pydantic AI, pydantic-graph,
and DBOS while staying zero-infrastructure. The roadmap lives in
docs/v2/MIGRATION_PLAN.md, broken into milestone epics with scoped,
claimable issues — including
good first issues
that need no prior context. See CONTRIBUTING.md for the branch model
(dev for PRs, main for releases), setup, and how to claim an issue.
Credit
- Image Credits: Gemini Pro, April 2026
- Music by Karl Casey @ White Bat Audio
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 petri_grow-0.3.7.tar.gz.
File metadata
- Download URL: petri_grow-0.3.7.tar.gz
- Upload date:
- Size: 13.1 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2abec5ed31f662597c65850807fba7344985c72768e62f8603f9ecf935040ff2
|
|
| MD5 |
4d17de39a4e3466d27d07f38e167ce45
|
|
| BLAKE2b-256 |
c5174da8132f9e1898fd2f533d49e896d7a74603d4e59eb672090d631b212276
|
Provenance
The following attestation bundles were made for petri_grow-0.3.7.tar.gz:
Publisher:
publish.yml on onthemarkdata/petri
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
petri_grow-0.3.7.tar.gz -
Subject digest:
2abec5ed31f662597c65850807fba7344985c72768e62f8603f9ecf935040ff2 - Sigstore transparency entry: 2176161661
- Sigstore integration time:
-
Permalink:
onthemarkdata/petri@b5a1713900cba572b59264546d01bc9712661cfe -
Branch / Tag:
refs/tags/v0.3.7 - Owner: https://github.com/onthemarkdata
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@b5a1713900cba572b59264546d01bc9712661cfe -
Trigger Event:
release
-
Statement type:
File details
Details for the file petri_grow-0.3.7-py3-none-any.whl.
File metadata
- Download URL: petri_grow-0.3.7-py3-none-any.whl
- Upload date:
- Size: 12.2 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3e4c7b4cc23e39bdbe8a61496770ce2b8f77e02d1e7010fd8d2bb0bce54baea4
|
|
| MD5 |
9af90bae4a29d5de6ffa54e7d89af07d
|
|
| BLAKE2b-256 |
a7f39ac5f773dc28f677084dcb8181615931fd3be999aa868931ecb3e0531702
|
Provenance
The following attestation bundles were made for petri_grow-0.3.7-py3-none-any.whl:
Publisher:
publish.yml on onthemarkdata/petri
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
petri_grow-0.3.7-py3-none-any.whl -
Subject digest:
3e4c7b4cc23e39bdbe8a61496770ce2b8f77e02d1e7010fd8d2bb0bce54baea4 - Sigstore transparency entry: 2176161679
- Sigstore integration time:
-
Permalink:
onthemarkdata/petri@b5a1713900cba572b59264546d01bc9712661cfe -
Branch / Tag:
refs/tags/v0.3.7 - Owner: https://github.com/onthemarkdata
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@b5a1713900cba572b59264546d01bc9712661cfe -
Trigger Event:
release
-
Statement type: