How specular-org/specular works
Specular uses coding agents to analyze a target, generate TLA+ specifications and harnesses, validate them with TLC, and confirm and reproduce violations. Its CLI supports automated phased and single-session orchestration, resumable runs, and incremental continuous verification; agents can also use separately exposed MCP tools for trace debugging, invariant inspection, and specification analysis. The graph preserves these documented capabilities. Some subsystem links are documented only at workflow level because the sampled source excerpts omit their runtime wiring.
Main entry points: pipelinelib.py Phased pipeline · phaselib.py Phase execution · cli.py CLI · single_session.py Single session
Components 26
Run orchestration
- CLI
src/specular/cli.py - Phased pipeline
src/specular/pipelinelib.py - Single session
src/specular/single_session.py - Run resume
src/specular/resumelib.py - Continuous verification
src/specular/ci_workflow.py
Agent workflow
- Phase execution
src/specular/phaselib.py - Agent adapters
src/specular/adapters/claude_code.py - Adapter policy
src/specular/adapters/utils/policy.py - Transient handling
src/specular/adapters/utils/transient.py - Output contract
src/specular/output_contract.py - Context control
src/specular/context_control.py - Agent notes
src/specular/notes.py - Workflow rules
src/specular/rules.py
Model verification
- Bug confirmation
src/specular/confirmlib.py - TLC tasks
src/specular/tlc_tasks.py - Resource summaries
src/specular/resource_summary.py
Analysis tools
- Trace debugger MCP
tools/trace_debugger/src/tla_mcp/mcp_server.py - Debug sessions
tools/trace_debugger/src/debugger/session.py - DAP client
tools/trace_debugger/src/client/dap_client.py - TLC output MCP
tools/inv_checking_tool/src/mcp/server.py - TLC output reader
tools/inv_checking_tool/src/tlc_output_reader.py - Spec analyzer MCP
tools/spec_analyzer/src/spec_mcp/handlers/vav_handler.py - CFA analyzer
tools/cfa/src/main/java/CFG/SANYCFGBuilder.java
Agent integrations
- Coding agent
- TLC model checker
Other components
- Engineer
Connections 24
- Engineer → CLI: runs
README.md - CLI → Phased pipeline: starts
- Phased pipeline → Phase execution: runs phases
src/specular/pipelinelib.py - Phase execution → Agent adapters: uses agents
- Phase execution → Adapter policy: consults
src/specular/phaselib.py - Phase execution → Transient handling: handles transient errors
src/specular/phaselib.py - Phased pipeline → Single session: selects orchestration
src/specular/pipelinelib.py - Phased pipeline → Run resume: restores runs
src/specular/pipelinelib.py - Phased pipeline → Output contract: checks outputs
src/specular/pipelinelib.py - Single session → Context control: handles handoffs
src/specular/single_session.py - Phase execution → Agent notes: adds prompt notes
src/specular/phaselib.py - Phase execution → Workflow rules: loads rules
src/specular/phaselib.py - Phased pipeline → Bug confirmation: confirms findings
src/specular/pipelinelib.py - Phased pipeline → Continuous verification: supports incremental runs
src/specular/pipelinelib.py - Phased pipeline → Resource summaries: completes summaries
src/specular/pipelinelib.py - Phase execution → TLC tasks: uses TLC tasks
src/specular/phaselib.py - TLC tasks → TLC model checker: launches checks
- Coding agent → Trace debugger MCP: uses MCP tools
README.md - Trace debugger MCP → Debug sessions: dispatches
tools/trace_debugger/src/tla_mcp/mcp_server.py - Debug sessions → DAP client: sends requests
tools/trace_debugger/src/debugger/session.py - Coding agent → TLC output MCP: uses MCP tools
README.md - TLC output MCP → TLC output reader: reads output
- Coding agent → Spec analyzer MCP: uses MCP tools
README.md - Spec analyzer MCP → CFA analyzer: runs analysis
tools/spec_analyzer/src/spec_mcp/handlers/vav_handler.py