How frenzymath/rethlas works
1. Overall system shape
- Rethlas is a two-agent math reasoning pipeline.
- The generation agent creates an informal proof blueprint from a Markdown problem statement.
- The verification agent independently checks that blueprint and returns a structured verdict.
- The architecture is intentionally looped: generation produces a draft, verification evaluates it, and generation can repair based on verifier feedback.
2. Primary runtime boundary
- The two agents are separated into distinct directories and execution environments under agents/generation and agents/verification.
- The verifier is designed to run as a local HTTP service, while the generator is run through the Codex CLI.
- This separation is the main architectural boundary: one service exposes verification, the other orchestrates reasoning and file production.
3. Generation agent responsibilities
- The generation side reads a problem from agents/generation/data/*.md.
- It produces a draft proof blueprint in agents/generation/results/<problem-id>/blueprint.md.
- It also records execution logs and memory artifacts, which suggests an iterative reasoning process with persistent intermediate state.
4. Generation-side tooling
- agents/generation/mcp/server.py and mcp/requirements.txt indicate a Python-based MCP server used by the generation agent as its tool layer.
- The .agents/skills/ directory contains modular reasoning behaviors such as direct proving, recursive proving, toy examples, counterexamples, subgoal decomposition, memory querying, and proof verification.
- These skills are the reasoning primitives the generator uses to decompose and repair proofs rather than a single monolithic prompt.
5. Verification agent responsibilities
- The verification side ingests proof text and checks claims against referenced statements.
- It emits a structured verification output defined by agents/verification/schemas/verification_output.schema.json.
- The verifier’s role is not to generate the proof itself, but to validate logical consistency and summarize failures or success.
6. Verification-side service layout
- agents/verification/api/server.py exposes the verification functionality as an HTTP API.
- agents/verification/mcp/server.py suggests a second tool-facing entrypoint, likely for agent integration via MCP.
- The presence of both API and MCP layers means verification can be consumed either as a web service or as an agent tool.
7. Data flow through the system
- Input starts as a Markdown math problem in the generation data directory.
- Generation creates a draft blueprint, then submits it to the verification service.
- Verification returns structured feedback, which can drive another generation pass.
- Final artifacts are split into draft and verified outputs, preserving the evolution of the reasoning process.
8. Persistence and artifact model
- The generator writes three main artifact classes: logs, memory, and results.
- Logs capture the run trace, memory captures reusable reasoning state, and results capture the proof output itself.
- The blueprint_verified.md file is only produced when verification succeeds, making verified outputs a distinct terminal artifact.
9. Schemas and contracts
- The verification output schema is a key contract boundary in the repo.
- It anchors the structure of verdicts so the generation agent can consume verification results reliably.
- This makes the verifier’s output machine-actionable rather than freeform text.
10. Operational orchestration
- The repository expects a specific execution order: start verification first, then run generation.
- The included tests/run_example.sh script is the practical integration harness for the whole system.
- agents/verification/scripts/test_verify_endpoint.py suggests there is also an endpoint-level smoke test for the verifier.
11. Configuration and agent definitions
- Both subprojects contain .codex configuration and .agents skill definitions.
- These directories indicate the system is built around Codex-managed agent execution with explicit skill routing.
- The architecture is therefore agent-centric, not service-centric: behavior is composed from skills and configs rather than a single application framework.
12. Repository-level mental model for a diagram
- Draw two major boxes: Generation and Verification.
- Put the Markdown problem files, logs, memory, and result blueprints inside the Generation box.
- Put the HTTP API, MCP server, and output schema inside the Verification box.
- Show a one-way verification call from Generation to Verification, with a feedback loop back into Generation for proof repair.
Main entry points: mcp/server.py MCP Server · api/server.py HTTP API · run_example.sh Example Run · mcp/server.py MCP Server
Components 15
Generation
Draft proof creation, memory, and repair loop
- Problem Markdown · Markdown math problems consumed by generation
agents/generation/data/example.md - Codex Config · Codex-managed generation runtime configuration
agents/generation/.codex/config.toml - MCP Server · Python tool layer for the generation agent
agents/generation/mcp/server.py - Reasoning Skills · Modular proving and repair behaviors used by generation
agents/generation/.agents/skills - Proof Artifacts · Generated drafts, logs, memory, and verified outputs
- Draft Blueprint · Informal proof blueprint produced by generation
- Verified Blueprint · Terminal blueprint emitted after successful verification
- Run Logs · Trace of generation and repair attempts
- Memory Store · Persistent reasoning state and reusable observations
Verification
Structured proof checking and verdict service
- HTTP API · Local verification endpoint
agents/verification/api/server.py - MCP Server · Tool-facing verification entrypoint
agents/verification/mcp/server.py - Verdict Schema · Structured output contract for verification results
agents/verification/schemas/verification_output.schema.json - Check Skills · Verification behaviors for statement checking and reporting
agents/verification/.agents/skills - Verification Result · Machine-actionable pass/fail and failure summary
Other components
- Example Run · End-to-end smoke test for the repository flow
agents/generation/tests/run_example.sh
Connections 21
- Problem Markdown → MCP Server: read problem · Generation consumes the Markdown problem through its tool/runtime boundary
- Codex Config → MCP Server: configure · Codex configuration steers the generation runtime
- Reasoning Skills → MCP Server: guide reasoning · Skills provide the proving and repair behaviors used during generation
- MCP Server → Draft Blueprint: draft proof · Generation writes an informal proof blueprint
- MCP Server → Run Logs: record run · Execution traces are persisted for iterative reasoning
- MCP Server → Memory Store: persist memory · Reusable state is stored for later proof attempts
- Draft Blueprint → HTTP API: submit for check · Draft blueprint is sent to the verification service
- Draft Blueprint → MCP Server: tool check · Verification can also be consumed through MCP
- Check Skills → HTTP API: drive checks · Verification skills implement statement checking and synthesis
- Verdict Schema → HTTP API: shape verdict · The schema constrains the structure of verification output
- HTTP API → Verification Result: return result · HTTP API emits a structured verification verdict
- MCP Server → Verification Result: return result · MCP entrypoint exposes the same structured verdict
- Verification Result → MCP Server: feedback · Verification feedback returns to generation for repair
- MCP Server → Draft Blueprint: repair draft · Generation revises the blueprint based on verifier feedback
- Draft Blueprint → Verified Blueprint: accept if valid · A successful verification promotes the blueprint to verified output
- Draft Blueprint → Proof Artifacts: store artifact · Draft outputs are organized under the generation results area
- Verified Blueprint → Proof Artifacts: store artifact · Verified outputs are organized under the generation results area
- Run Logs → Proof Artifacts: store artifact · Run logs are persisted alongside other generation artifacts
- Memory Store → Proof Artifacts: store artifact · Persistent reasoning state is retained with run artifacts
- Example Run → Draft Blueprint: orchestrate · Integration harness exercises the full generation-to-verification loop
- Example Run → HTTP API: smoke test · Harness also checks the verification endpoint