Skip to main content

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.0
  • pyyaml>=6.0

License

MIT

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

triad_base-0.2.1.tar.gz (35.0 kB view details)

Uploaded Source

Built Distribution

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

triad_base-0.2.1-py3-none-any.whl (25.6 kB view details)

Uploaded Python 3

File details

Details for the file triad_base-0.2.1.tar.gz.

File metadata

  • Download URL: triad_base-0.2.1.tar.gz
  • Upload date:
  • Size: 35.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for triad_base-0.2.1.tar.gz
Algorithm Hash digest
SHA256 ce18586e387fafbc69c285618ed1a7d3b449feaaade7880785a11681c6b0f146
MD5 92941e5425ca74c1a623656587fcbdb5
BLAKE2b-256 fb7052c18ef9e77fa8ef1c6ca5cf0bf30191eebfb16969593be3e9314becb756

See more details on using hashes here.

Provenance

The following attestation bundles were made for triad_base-0.2.1.tar.gz:

Publisher: release-triad-base.yml on m0j0d/libs

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

File details

Details for the file triad_base-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: triad_base-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 25.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for triad_base-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0aa214b6eb384f1d56f06ff3250db3b32d0dc5b5c51afb2d519f7f2470c2366f
MD5 7bffe2aa67010a7a48f6f39df53c697e
BLAKE2b-256 a1cf6c98bf954f27b961b6322dfb5148a58fd8686810870720bc71d8447e4a28

See more details on using hashes here.

Provenance

The following attestation bundles were made for triad_base-0.2.1-py3-none-any.whl:

Publisher: release-triad-base.yml on m0j0d/libs

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

Release history Release notifications | RSS feed

0.2.2

2 files

This release

0.2.1 This release

2 files

0.2.0

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page