Skip to main content

Pipeline overview

SPECA is a six-stage pipeline. The first three stages convert a specification into typed properties (Knowledge Structuring); the last three audit those properties against an implementation (Systematic Auditing).

SPECA pipeline

Phase numbering — paper vs. internal IDs

The two SPECA papers number the stages Phase 1–6. The codebase uses internal IDs that reflect the original development order (01a, 01b, 01e, 02c, 03, 04). Both refer to the same stages:

PaperInternal IDPlain-English namePage
Phase 101aSpec Discovery01a
Phase 201bSubgraph Extraction01b
Phase 301eProperty Generation01e
Phase 402cCode Pre-resolution02c
Phase 503Property Audit (Map / Prove / Stress-Test)03
Phase 604Severity Review (3-gate FP filter)04

The CLI and orchestrator everywhere use the internal IDs (e.g. speca run --target 04).

Dependency chain

01a (Spec Discovery)

01b (Subgraph Extraction)

01e (Property Generation) ← BUG_BOUNTY_SCOPE.json required

02c (Code Pre-resolution) ← TARGET_INFO.json required

03 (Audit Map: Map → Prove → Stress-Test)

04 (Review: Dead Code → Trust Boundary → Scope)

The first three phases (01a / 01b / 01e) depend only on the specification and the scope rubric — they can be run once and cached across implementations. The last three (02c / 03 / 04) depend on the target codebase and run per implementation.

Inputs and outputs

IDNameInputOutput
01aSpec DiscoverySPEC_URLS env01a_STATE.json
01bSubgraph Extraction01a_STATE.jsonMermaid .mmd + 01b_PARTIAL_*.json
01eProperty GenerationSubgraphs + STRIDE/CWE Top 2501e_PARTIAL_*.json
02cCode ResolutionProperties + source02c_PARTIAL_*.json
03Audit MapProperties + code03_PARTIAL_*.json
04ReviewPhase 03 findings04_PARTIAL_*.json (six verdicts)

Data flow conventions

  • Partial files: outputs/<phase_id>_PARTIAL_W{worker}B{batch}_{timestamp}.json
  • Queue files: outputs/<phase_id>_QUEUE_{worker}.json
  • Logs: outputs/logs/{phase_id}_*.jsonl

Each phase consumes upstream partial files via glob patterns, skips already-processed items (resume), and writes results immediately after each batch — partial progress is never blocked on validation.

Cross-cutting harness features

The orchestrator provides four features that apply to every phase. They are described in detail under Agent design — Harness:

  • Circuit Breaker — shared across all workers in a phase. Trips on consecutive failures, total retries, or repeated empty results.
  • Cost Tracker — per-phase USD budget; raises BudgetExceeded and hard-stops the phase when crossed.
  • Resume Manager — scans *_PARTIAL_*.json to identify already-processed items so re-runs skip them by default.
  • Log Watcher — tails the stream-json log in real time and forwards events to the TUI dashboard.

For the model assignment per phase and the prompt / skill split, see Prompts and skills.