specula-org/Specula

Specula: An agentic tool for finding deep bugs in system code using TLA+

What it solves

Specula addresses the difficulty of finding deep, complex bugs in concurrent and distributed systems. Manually writing formal specifications for such systems is time-consuming and requires specialized expertise, making it hard to scale formal verification to large open-source projects.

How it works

Specula uses AI coding agents to automate the formal verification pipeline. The process follows these steps:

  1. Analysis & Specification: Coding agents read the system's source code to infer correctness properties (invariants) and write formal specifications in TLA+.
  2. Model Checking: The system model-checks these specifications to identify potential violations of the invariants.
  3. Bug Reproduction: When a violation is found, the agents reason about the counterexamples to reproduce the bug at the actual code level.

It can be operated in an "Auto Mode" for end-to-end execution or an "Interactive Mode" where users trigger specific skills like code-analysis, spec-generation, and bug-confirmation sequentially.

Who it’s for

It is designed for software engineers and researchers working on concurrent or distributed systems who want to find deep architectural or synchronization bugs without manually writing every formal spec.

Highlights

  • Autonomous TLA+ Generation: Uses LLM-based agents to translate implementation code into formal models.
  • Code-Level Reproduction: Bridges the gap between abstract model-checking violations and concrete code bugs.
  • Agent Integration: Supports multiple coding agents including Claude Code, Codex, Copilot CLI, OpenCode, and Pi.
  • Extensible Tooling: Includes MCP (Model Context Protocol) tools for trace debugging and specification analysis.

Related

  • Project
  • Dispatch
  • Project
  • Project
  • Project