Loading...
Loading...
Implement code against an existing Quint specification. Uses Research → Plan → Implement workflow (ACE-FCA style) grounded by the spec as the source of truth. Use when the user wants to refactor code, add a new feature, or close a gap between implementation and spec — with the Quint spec as the formal constraint that all changes must satisfy.
npx skill4agent add quint-co/quint-llm-kit quint-execute-specquint-modeling.qnt[Quint spec] + [Desired change description]
↓
┌────────────────────────────────────────────────────────────┐
│ Phase 0: Orient │
│ → Read the spec: what does it guarantee? │
│ → Clarify the change: what new behavior is needed? │
│ → Decide: is this a spec change or a code change? │
└────────────────────────────────────────────────────────────┘
↓
┌────────────────────────────────────────────────────────────┐
│ Phase 1: Research (compact) │
│ → Map the gap between spec and code │
│ → Output: compact gap analysis (target: under 300 lines) │
└────────────────────────────────────────────────────────────┘
↓
┌────────────────────────────────────────────────────────────┐
│ Phase 2: Plan │
│ → Precise steps: files to change, expected state delta │
│ → For each step: how to verify it satisfies the spec │
│ → Identify which Quint properties to run at each gate │
│ → Present plan to user before implementing │
└────────────────────────────────────────────────────────────┘
↓
┌────────────────────────────────────────────────────────────┐
│ Phase 3: Implement │
│ → Follow plan phase by phase │
│ → After each phase: run Quint tools, verify properties │
│ → Compact status back into the plan after each phase │
└────────────────────────────────────────────────────────────┘
↓
┌────────────────────────────────────────────────────────────┐
│ Phase 4: Verify │
│ → Run all witnesses (expect VIOLATED) │
│ → Run all invariants (expect no violation) │
│ → If any invariant fails: return to Phase 2, fix plan │
└────────────────────────────────────────────────────────────┘Given the Quint spec atand the source files[spec path]:[file list from handoff]
- For each state variable in the spec, find where it is managed in source code
- For each action in the spec, find the corresponding function(s) in source code
- Identify any spec behaviors that have no corresponding source code (gaps)
- Identify any source code behaviors not captured in the spec (out-of-scope)
- For the change
: which source files are affected?[change description]Output a compact summary. Do not read files that are not relevant. Target: under 300 lines.
## Change: [one-sentence description]
### Spec impact
- Properties that must continue to hold: [list]
- Properties that will change (if any): [list] — REQUIRES USER APPROVAL BEFORE IMPLEMENTATION
### Implementation steps
#### Step 1: [file] — [what changes]
- Expected behavior change: [description]
- Quint verification gate: `quint run` / `quint verify` — invariant `[name]`
#### Step 2: [file] — [what changes]
...
### Rollback criteria
If invariant `[name]` fails after Step N, stop and return to planning. Do not proceed.quint typecheckquint runquint testquint verify## Status (after Step N)
- Steps 1–N: DONE ✓
- Current: Step N+1
- Blocking issues: [none / description]
- Next verification gate: [invariant name]| Need | Tool |
|---|---|
| Type-check spec after any edit | Run |
| Verify witnesses are reachable | |
| Verify safety invariants hold | |
| Interactive exploration | |
quint runwitnessesCounterexample foundquint runquint verify| Anti-pattern | Why it breaks the workflow |
|---|---|
| Modify spec to pass a failing invariant | Destroys the spec as ground truth |
| Skip verification gates between steps | Breaks incremental verification; bugs compound |
| Read the whole codebase into main context | Floods context; catalog compactly in Phase 1 instead |
| Plan in prose, implement "roughly" | Plan must be precise enough to verify step-by-step |
| Treat spec as advisory documentation | Spec is a formal constraint — machine-checkable |
| Fix invariant failure by weakening the invariant | Invariants must be fixed in code, not loosened |
quint run