Primitives for thinker / doer / checker agent triads — types, prompt builders, preflight gates, agent-state schemas
Project description
triad-base
Primitives for building thinker / doer / checker agent triads with Claude (or any LLM).
What's in the box
| Module | What it gives you |
|---|---|
triad_base.types |
AgentType / PlanStatus enums; Plan, AgentMetadata, ExecutionResult dataclasses; parse_agent_metadata() parser |
triad_base.state.schema |
Pydantic v2 models for agent state JSON (ThinkerState / DoerState / CheckerState / Heartbeat / ExecutionRecord / interventions) + load_state / save_state / validate_state_file |
triad_base.state.validation |
validate_file / validate_directory / migrate_file / migrate_directory / check_schema_compatibility |
triad_base.preflight |
HealthChecker (disk space · state-dir writable · stale locks · optional config valid · Claude CLI present) + create_checkpoint / restore_checkpoint / clear_checkpoint (git-stash rollback) |
triad_base.orchestrator |
TriadContext + build_thinker_prompt / build_doer_prompt / build_checker_prompt + format_prior_suggestions |
triad_base.verdict |
Typed gate/judge verdict contract (schema v1) — Verdict / Finding / ReviewerError / ReviewerResult + to_json_schema(); pool-pure, pydantic-only |
Design
Pure plumbing, no transport. The library assembles prompts and parses output; it does not call Claude. Consumers wire the prompts to their own transport (CLI subprocess, Anthropic SDK, direct API). Transport is intentionally out of scope so different consumers can diverge in dispatch (CLI vs SDK vs API) without dragging shared transport glue along.
Narrow surface. Five small modules. No CLI, no __main__, no opinionated workflow. You compose the parts you need.
Install
pip install triad-base
Usage sketch
from pathlib import Path
from triad_base.types import AgentType, Plan, PlanStatus
from triad_base.orchestrator import TriadContext, build_thinker_prompt
from triad_base.preflight import HealthChecker
# Preflight before kicking off
report = HealthChecker(
portfolio_root=Path("/repo"),
state_dir=Path("/repo/.state"),
).run_all_checks()
if not report.ok:
raise RuntimeError(report.summary())
# Build a thinker prompt
plan = Plan(id="ex-001", target_project="myproject", status=PlanStatus.READY, ...)
ctx = TriadContext(
plan=plan,
state_dir=Path("/repo/.state"),
working_dir=Path("/repo"),
prior_suggestions=None,
test_output="",
thinking_context="",
execution_context_tail="", # add your own logging / state-persistence block
)
prompt = build_thinker_prompt(ctx)
# Hand `prompt` to your Claude transport of choice; you own that part.
Versioning
Semantic versioning. 0.x.y series — interface may change between minor versions during early use; pin in your consumer's requirements.txt or pyproject.toml accordingly.
Dependencies
pydantic>=2.0pyyaml>=6.0
License
MIT
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 triad_base-0.2.0.tar.gz.
File metadata
- Download URL: triad_base-0.2.0.tar.gz
- Upload date:
- Size: 33.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d4648edafd37fdf96cf703a1e88694b19b804625a0fccc72c9cca6bc9184f723
|
|
| MD5 |
ca744795b5ef74b17d5034cdc9dfb783
|
|
| BLAKE2b-256 |
e6afb0693a04ccbbe1738d81b348f5e14d7122b8792722eab2c05b0cb3380fe7
|
Provenance
The following attestation bundles were made for triad_base-0.2.0.tar.gz:
Publisher:
release-triad-base.yml on m0j0d/libs
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
triad_base-0.2.0.tar.gz -
Subject digest:
d4648edafd37fdf96cf703a1e88694b19b804625a0fccc72c9cca6bc9184f723 - Sigstore transparency entry: 2137179117
- Sigstore integration time:
-
Permalink:
m0j0d/libs@458570eccb8b5feca8352702be8f5c71caf9d934 -
Branch / Tag:
refs/tags/triad-base-v0.2.0 - Owner: https://github.com/m0j0d
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-triad-base.yml@458570eccb8b5feca8352702be8f5c71caf9d934 -
Trigger Event:
push
-
Statement type:
File details
Details for the file triad_base-0.2.0-py3-none-any.whl.
File metadata
- Download URL: triad_base-0.2.0-py3-none-any.whl
- Upload date:
- Size: 24.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
098741524e4b7f127262938e6a318670d5cd63c818385d548fbaa34a44c01802
|
|
| MD5 |
dc7da84d01c788cde77aee186a3b8c02
|
|
| BLAKE2b-256 |
5ce743c9de9826fc529343bbcba1b333d149debd3f04d897c459de77a9b052f2
|
Provenance
The following attestation bundles were made for triad_base-0.2.0-py3-none-any.whl:
Publisher:
release-triad-base.yml on m0j0d/libs
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
triad_base-0.2.0-py3-none-any.whl -
Subject digest:
098741524e4b7f127262938e6a318670d5cd63c818385d548fbaa34a44c01802 - Sigstore transparency entry: 2137179162
- Sigstore integration time:
-
Permalink:
m0j0d/libs@458570eccb8b5feca8352702be8f5c71caf9d934 -
Branch / Tag:
refs/tags/triad-base-v0.2.0 - Owner: https://github.com/m0j0d
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-triad-base.yml@458570eccb8b5feca8352702be8f5c71caf9d934 -
Trigger Event:
push
-
Statement type: