Skip to main content
Glama
README.md
# Proof Mode

Phase 1 foundation/ledger kernel, Phase 2 broker enforcement and the locked
five-tool STDIO MCP surface, plus the Phase 3 compiler and orchestration
integration.

The normative backend source is [Proof Mode Backend Schema Implementation Specification v1.0](docs/Proof_Mode_Backend_Schema_Implementation_Specification_v1.0.md). Earlier backend drafts are historical context only.

## Development

```powershell
uv sync --all-packages
uv run pytest
uv run pytest -q tests/test_phase2_broker_mcp.py
uv run proof-mode-db migrate --database .proof-mode/proof-mode.db --artifacts .proof-mode
uv run proof-mode-db verify --database .proof-mode/proof-mode.db --artifacts .proof-mode
```

The demo reset command is deliberately gated:

```powershell
uv run proof-mode-db demo-reset --data-dir .proof-mode-demo --confirm RESET
```

Phase 1 and Phase 2 acceptance are complete. Phase 3 now persists every
structured model interaction, enforces bounded compilation and exact-hash
confirmation, and records Codex run provenance. P0 trust-separation hardening
is complete: exact attempt records, L3 separate-process observation, exact
filesystem target binding, portable bundles, an offline verifier, and
tamper-invalidating verdict support are covered by the suite. The current
local regression suite is 80 passed and 3 skipped (the skips are the opt-in
Codex and live GPT-5.6 provider gates).

The P0 REST deployment profile is single-writer: run one API process with one
Uvicorn worker. Compile and confirmation mutations use an application-level
lock; multiple API processes require an external distributed writer lock.

The authenticated real-Codex and real GPT-5.6 compilation gates remain
intentionally opt-in because they require provider capacity and saved Codex
authentication:

The Phase 3 implementation is in `packages/mission_compiler` and
`packages/command_broker`: strict structured contract models, trusted
repository-binding checks, bounded repair, ambiguity refusal, canonical
contract hashing, durable interaction records, exact confirmation, and
Codex JSONL provenance.

```powershell
$env:PROOF_MODE_RUN_CODEX_E2E = "1"
uv run pytest -q tests/test_phase2_codex_runtime.py -s
```

The test preserves JSONL/stdout/stderr and exit-code evidence in
`.proof-mode/codex-runtime-evidence.json`. Provider capacity is reported as
`PROVIDER_UNAVAILABLE`; MCP startup or broker failures remain implementation
failures. The authenticated Codex/MCP gate is preserved as passed evidence;
the live GPT-5.6 compile remains `PENDING_PROVIDER_QUOTA`. P0 evidence is
recorded under `.proof-mode/p0-hardening/`.