fv-skills-baif 2.2.1 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +24 -0
- package/README.md +17 -0
- package/agents/fvs-axiom-auditor.md +2 -2
- package/agents/fvs-crypto-executor.md +9 -6
- package/agents/fvs-crypto-thinker.md +5 -5
- package/agents/fvs-doc-syncer.md +1 -1
- package/agents/fvs-draft-investigator.md +1 -1
- package/agents/fvs-equivalence-assessor.md +1 -1
- package/agents/fvs-extract-applier.md +3 -3
- package/agents/fvs-extract-bisector.md +3 -3
- package/agents/fvs-extract-classifier.md +2 -2
- package/agents/fvs-lean-refactorer.md +2 -2
- package/commands/fvs/aeneas-extract.md +18 -2
- package/commands/fvs/crypto-execute.md +21 -3
- package/commands/fvs/crypto-followup.md +17 -1
- package/commands/fvs/crypto-plan.md +18 -2
- package/commands/fvs/fc.md +3 -2
- package/commands/fvs/help.md +21 -4
- package/commands/fvs/lean-formalise.md +21 -3
- package/commands/fvs/lean-refactor.md +22 -4
- package/commands/fvs/lean-spec-review.md +29 -0
- package/commands/fvs/lean-specify.md +54 -3
- package/commands/fvs/lean-verify.md +21 -3
- package/commands/fvs/trust-audit.md +21 -3
- package/fv-skills/VERSION +1 -1
- package/fv-skills/references/aeneas-patterns.md +1 -1
- package/fv-skills/references/crypto-plan-review.md +1 -1
- package/fv-skills/references/fc-spec-review.md +72 -0
- package/fv-skills/references/lean-refactoring.md +6 -6
- package/fv-skills/templates/config.json +3 -0
- package/fv-skills/workflows/aeneas-extract.md +24 -4
- package/fv-skills/workflows/crypto-execute.md +24 -4
- package/fv-skills/workflows/crypto-followup.md +21 -1
- package/fv-skills/workflows/crypto-plan.md +23 -3
- package/fv-skills/workflows/lean-formalise.md +20 -2
- package/fv-skills/workflows/lean-refactor.md +22 -4
- package/fv-skills/workflows/lean-spec-review.md +126 -0
- package/fv-skills/workflows/lean-specify.md +47 -3
- package/fv-skills/workflows/lean-verify.md +21 -3
- package/fv-skills/workflows/trust-audit.md +21 -3
- package/package.json +1 -1
- package/scripts/build-plugin.cjs +1 -0
- package/scripts/fvs-codex-think.mjs +1 -1
- package/scripts/fvs-spec-review.mjs +235 -0
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,30 @@ All notable changes to FVS (Formal Verification Skills) will be documented in th
|
|
|
4
4
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/).
|
|
6
6
|
|
|
7
|
+
## [2.3.0] - 2026-09-07
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
- `/fvs:lean-spec-review` adversarially reviews a functional-correctness specification against
|
|
11
|
+
its Rust implementation, extracted Lean definitions, and interpretation layer before proof work.
|
|
12
|
+
Users choose the reviewer runtime, model, and effort: Codex offers GPT Sol and Astra, Claude
|
|
13
|
+
offers Fable, cheaper or custom models remain available, and effort defaults to `max`.
|
|
14
|
+
- `/fvs:lean-specify` now offers the same review flow automatically after successful generation
|
|
15
|
+
checks. Existing projects need no migration: a missing `spec_review.automatic` setting enables
|
|
16
|
+
the menu, while `{"spec_review":{"automatic":false}}` disables only the automatic handoff.
|
|
17
|
+
- Review records preserve runtime/model provenance, source hashes, immutable history, validated
|
|
18
|
+
`PASS | REVISE | BLOCKED` verdicts, and orchestrator triage. Other providers use an exported
|
|
19
|
+
review packet and imported response rather than arbitrary command execution. This resolves
|
|
20
|
+
[GitHub issue #46](https://github.com/Beneficial-AI-Foundation/formal-verification-skills/issues/46)
|
|
21
|
+
and delivers the functional-correctness slice of
|
|
22
|
+
[GitHub issue #32](https://github.com/Beneficial-AI-Foundation/formal-verification-skills/issues/32).
|
|
23
|
+
|
|
24
|
+
### Fixed
|
|
25
|
+
- Lean workflows now retrieve the project cache before build-capable work and cap Lake concurrency
|
|
26
|
+
at four threads unless the caller overrides it. Crypto execution accepts IDE diagnostics when
|
|
27
|
+
available and keeps a documented headless fallback. This resolves
|
|
28
|
+
[GitHub issue #49](https://github.com/Beneficial-AI-Foundation/formal-verification-skills/issues/49)
|
|
29
|
+
and [GitHub issue #50](https://github.com/Beneficial-AI-Foundation/formal-verification-skills/issues/50).
|
|
30
|
+
|
|
7
31
|
## [2.2.1] - 2026-08-28
|
|
8
32
|
|
|
9
33
|
### Fixed
|
package/README.md
CHANGED
|
@@ -160,6 +160,7 @@ Commands are grouped into five bundles. Each bundle has a **router** command tha
|
|
|
160
160
|
|---------|-------------|
|
|
161
161
|
| `/fvs:fc-plan` | Pick next verification targets via greedy dependency graph traversal |
|
|
162
162
|
| `/fvs:lean-specify` | Generate a style-checked Lean spec skeleton with `@[step]` theorem pattern |
|
|
163
|
+
| `/fvs:lean-spec-review` | Adversarially review an FC specification with a chosen runtime, model, and effort |
|
|
163
164
|
| `/fvs:lean-verify` | Attempt proof with domain tactics while blocking new target-style violations |
|
|
164
165
|
| `/fvs:natural-language` | Generate natural language explanation of module or function with pre/post conditions |
|
|
165
166
|
| `/fvs:lean-refactor` | Refactor, simplify, and decompose verified proofs (dead code removal, simp sharpening, tactic golf) — *also in Formalise* |
|
|
@@ -171,6 +172,22 @@ Commands are grouped into five bundles. Each bundle has a **router** command tha
|
|
|
171
172
|
rejects ordinary Lean identifiers with three or more namespace dots, steering generated code
|
|
172
173
|
toward scoped namespaces, `open`, and local names.
|
|
173
174
|
|
|
175
|
+
After `lean-specify`, a review menu offers the other runtime first, a fresh reviewer in the current
|
|
176
|
+
runtime, or another provider. Choose GPT Sol or Astra for Codex, Fable for Claude, or a cheaper/custom
|
|
177
|
+
model; effort defaults to `max` and can be lowered. Other providers use an exported source packet
|
|
178
|
+
and imported response. Reviews and source hashes live under `.formalising/spec-reviews/`.
|
|
179
|
+
|
|
180
|
+
Automatic review works even without a config file. To disable the automatic menu, merge this
|
|
181
|
+
setting into `.formalising/fvs-config.json` (or create that file with just this object):
|
|
182
|
+
|
|
183
|
+
```json
|
|
184
|
+
{"spec_review": {"automatic": false}}
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
`/fvs:lean-spec-review <spec.lean>` remains available when automation is disabled. No migration or
|
|
188
|
+
health command is needed. Missing/authentication failures offer setup and an explicit fallback;
|
|
189
|
+
reviewer changes are never silent. A PASS approves the statement for proof work, not the proof.
|
|
190
|
+
|
|
174
191
|
`lean-specify`, `lean-verify`, and `lean-formalise` share an indexed proof-engineering store at
|
|
175
192
|
`.formalising/proof-engineering/`. Commands read `index.md` first, load at most eight relevant
|
|
176
193
|
lessons as delimited untrusted reference data, and reconcile at most three evidence-backed
|
|
@@ -31,7 +31,7 @@ Iterate exactly the parent-supplied canonical atom IDs. For each entry, introspe
|
|
|
31
31
|
|
|
32
32
|
## 2. Introspect each declaration with `#print axioms`
|
|
33
33
|
For each usable FQN, run `#print axioms <FQN>` via `lake env lean` (introspection only -- if you
|
|
34
|
-
must rebuild anything use `nice -n 19 lake build`, NEVER a bare `lake build`). `#print axioms` is the
|
|
34
|
+
must rebuild anything use `LEAN_NUM_THREADS="${LEAN_NUM_THREADS:-4}" nice -n 19 lake build`, NEVER a bare `lake build`). `#print axioms` is the
|
|
35
35
|
authoritative oracle; static grep never determines inventory membership or classification.
|
|
36
36
|
|
|
37
37
|
## 3. Classify from the `#print axioms` output
|
|
@@ -64,7 +64,7 @@ count; unresolved entries are explicit, never omitted.
|
|
|
64
64
|
</process>
|
|
65
65
|
|
|
66
66
|
<fvs_hard_rules>
|
|
67
|
-
- NEVER run a bare `lake build` -- use `nice -n 19 lake build` if you must rebuild; introspection uses `lake env lean` + `#print axioms`.
|
|
67
|
+
- NEVER run a bare `lake build` -- use `LEAN_NUM_THREADS="${LEAN_NUM_THREADS:-4}" nice -n 19 lake build` if you must rebuild; introspection uses `lake env lean` + `#print axioms`.
|
|
68
68
|
- NEVER edit generated Lean (`Types.lean` / `Funs.lean`) -- you introspect them, you never write them.
|
|
69
69
|
- Read-only: never write or modify any file -- you RETURN the classified, ordered table as text; the command body persists it and fires the gate.
|
|
70
70
|
- Never widen the inventory beyond the strictly-scoped target; surface cone prerequisites separately, never fold them in.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: fvs-crypto-executor
|
|
3
3
|
description: Write-capable executor for the crypto formalisation loop. Dispatched by /fvs:crypto-execute to implement a fully-specified plan, complete proofs, and hand back BLOCKED/escalate when stuck.
|
|
4
|
-
tools: Read, Bash, Grep, Glob, Write
|
|
4
|
+
tools: Read, Bash, Grep, Glob, Write, mcp__ide__getDiagnostics
|
|
5
5
|
color: pink
|
|
6
6
|
---
|
|
7
7
|
|
|
@@ -44,7 +44,10 @@ in your prompt. Execute the discipline below in order.
|
|
|
44
44
|
3. **Complete the proofs.** Drive each proof to a closed goal. Use the `mcp__ide__getDiagnostics`
|
|
45
45
|
runtime tool to read the live goal state and error/warning diagnostics as you work — it is your
|
|
46
46
|
in-loop feedback signal, not a substitute for the authoritative build in step 4. Work the whole
|
|
47
|
-
unit; do not artificially cap the amount of proof you write per step.
|
|
47
|
+
unit; do not artificially cap the amount of proof you write per step. In a headless runtime where
|
|
48
|
+
the IDE MCP tool is not registered, or when its call fails because the tool/server is unavailable,
|
|
49
|
+
fall back to Bash: use `lake env lean <file>` for file diagnostics and the bounded full-project
|
|
50
|
+
build in step 4 as the authoritative check.
|
|
48
51
|
|
|
49
52
|
4. **Self-fix mechanical issues, and run the build as the style authority.** After the proofs close
|
|
50
53
|
under diagnostics, run the build and fix mechanical fallout yourself (unresolved identifiers,
|
|
@@ -79,7 +82,7 @@ user-compiles-between-steps pair-programming. That discipline belongs to the FC
|
|
|
79
82
|
</process>
|
|
80
83
|
|
|
81
84
|
<fvs_hard_rules>
|
|
82
|
-
- NEVER run a bare `lake build` -- always `nice -n 19 lake build` with the `set -o pipefail` / `${PIPESTATUS` guard so a piped build failure is never masked.
|
|
85
|
+
- NEVER run a bare `lake build` -- always `LEAN_NUM_THREADS="${LEAN_NUM_THREADS:-4}" nice -n 19 lake build` with the `set -o pipefail` / `${PIPESTATUS` guard so a piped build failure is never masked.
|
|
83
86
|
- NEVER edit generated Lean (`Types.lean` / `Funs.lean`).
|
|
84
87
|
- All writes MUST use the Write tool -- never echo, cat, or Bash redirection. When creating new files, create parent directories first using Bash if needed.
|
|
85
88
|
- Escalate, do not overrule: never change an immutable public statement to force a proof through -- HALT and ask, then record the approved before/after.
|
|
@@ -96,7 +99,7 @@ On successful completion, end your output with:
|
|
|
96
99
|
|
|
97
100
|
**Iteration:** nN
|
|
98
101
|
**Files written:** {list of file paths, including IMPLEMENTATION_nN.md}
|
|
99
|
-
**Build:** green via `nice -n 19 lake build`
|
|
102
|
+
**Build:** green via `LEAN_NUM_THREADS="${LEAN_NUM_THREADS:-4}" nice -n 19 lake build`
|
|
100
103
|
**Obligations:** {named allowed-sorry obligations with their statements, or "none"}
|
|
101
104
|
**Summary:** {1-2 sentences on what was implemented and proven}
|
|
102
105
|
```
|
|
@@ -119,7 +122,7 @@ When genuinely stuck:
|
|
|
119
122
|
|
|
120
123
|
**Iteration:** nN
|
|
121
124
|
**Blocker:** {the concrete missing prerequisite, red build, or modeling decision}
|
|
122
|
-
**Build state:** {last known state from `nice -n 19 lake build`}
|
|
125
|
+
**Build state:** {last known state from `LEAN_NUM_THREADS="${LEAN_NUM_THREADS:-4}" nice -n 19 lake build`}
|
|
123
126
|
**What would unblock:** {the specific input needed}
|
|
124
127
|
```
|
|
125
128
|
|
|
@@ -128,7 +131,7 @@ When genuinely stuck:
|
|
|
128
131
|
<success_criteria>
|
|
129
132
|
- [ ] Implemented the fully-specified plan as a whole unit (no unauthorised `sorry`; immutable public statements preserved verbatim)
|
|
130
133
|
- [ ] Kernel-checked signatures, then completed proofs using `mcp__ide__getDiagnostics` for in-loop goal/diagnostic feedback
|
|
131
|
-
- [ ] Ran `nice -n 19 lake build` as the style authority and self-fixed mechanical + style fallout (expecting style warnings that surface only at build time, not in isolation checks)
|
|
134
|
+
- [ ] Ran `LEAN_NUM_THREADS="${LEAN_NUM_THREADS:-4}" nice -n 19 lake build` as the style authority and self-fixed mechanical + style fallout (expecting style warnings that surface only at build time, not in isolation checks)
|
|
132
135
|
- [ ] Escalated (never overruled) any immutable-public-statement change; handed back BLOCKED when genuinely stuck
|
|
133
136
|
- [ ] Did NOT use the one-`sorry` / ≤3-line / user-compiles-between-steps proof-attempt grind
|
|
134
137
|
- [ ] Wrote the run report to `IMPLEMENTATION_nN.md` and returned with a ## IMPLEMENTATION COMPLETE / ## ESCALATE / ## BLOCKED header
|
|
@@ -41,7 +41,7 @@ coarse go/no-go compile check, and only when viability genuinely hinges on an ar
|
|
|
41
41
|
That single go/no-go probe is a viability check, NOT a style certification -- `lake build` in the
|
|
42
42
|
executor's loop remains the style authority (a planner that does not fully compile cannot certify
|
|
43
43
|
style). `Bash` stays in your tool list SOLELY for that one permitted go/no-go probe, and so the plan
|
|
44
|
-
can author the `nice -n 19 lake build` command as text the executor runs; it is not a license to
|
|
44
|
+
can author the `LEAN_NUM_THREADS="${LEAN_NUM_THREADS:-4}" nice -n 19 lake build` command as text the executor runs; it is not a license to
|
|
45
45
|
iterate a proof while planning.
|
|
46
46
|
|
|
47
47
|
The plan is bounded and runtime-neutral -- it must be executable by a Claude, Codex, or other
|
|
@@ -60,7 +60,7 @@ runtime's executor with no thinker in the loop. State EVERY field explicitly:
|
|
|
60
60
|
6. **Stop conditions** -- the explicit conditions under which the executor halts (target reached,
|
|
61
61
|
build red after N attempts, a modeling decision needed). A modeling decision or any change to a
|
|
62
62
|
public statement is ESCALATED to the user -- never decided by the thinker.
|
|
63
|
-
7. **Verification commands** -- ALWAYS `nice -n 19 lake build` (never a bare `lake build`), with the
|
|
63
|
+
7. **Verification commands** -- ALWAYS `LEAN_NUM_THREADS="${LEAN_NUM_THREADS:-4}" nice -n 19 lake build` (never a bare `lake build`), with the
|
|
64
64
|
`set -o pipefail` / `${PIPESTATUS` guard so a piped build failure is never masked.
|
|
65
65
|
8. **Expected artifact updates** -- which `fv-plans/<topic>/{plans,reviews,sources,merge}` files the
|
|
66
66
|
run is expected to produce or update.
|
|
@@ -104,7 +104,7 @@ that silently picks one side of a modeling decision -- the ruling is reserved fo
|
|
|
104
104
|
|
|
105
105
|
If the prior eval was `FOLLOWUP`, author the next bounded plan using the full `plan`-mode contract
|
|
106
106
|
(branch/state, exact targets, immutable public statements, allowed-`sorry` policy, stop conditions,
|
|
107
|
-
`nice -n 19 lake build` verification, expected artifact updates).
|
|
107
|
+
`LEAN_NUM_THREADS="${LEAN_NUM_THREADS:-4}" nice -n 19 lake build` verification, expected artifact updates).
|
|
108
108
|
|
|
109
109
|
End with `## PLAN COMPLETE` (a follow-up plan) or `## ERROR` (HALT for an HUMAN_RULING you cannot
|
|
110
110
|
resolve without the human).
|
|
@@ -113,7 +113,7 @@ resolve without the human).
|
|
|
113
113
|
</process>
|
|
114
114
|
|
|
115
115
|
<fvs_hard_rules>
|
|
116
|
-
- NEVER run a bare `lake build` -- always `nice -n 19 lake build` with the `set -o pipefail` / `${PIPESTATUS` guard so a piped build failure is never masked.
|
|
116
|
+
- NEVER run a bare `lake build` -- always `LEAN_NUM_THREADS="${LEAN_NUM_THREADS:-4}" nice -n 19 lake build` with the `set -o pipefail` / `${PIPESTATUS` guard so a piped build failure is never masked.
|
|
117
117
|
- NEVER edit generated Lean (`Types.lean` / `Funs.lean`).
|
|
118
118
|
- Author-by-return: never write or modify a project file -- you RETURN the plan/eval/followup as text; the command body persists it under `fv-plans/<topic>/`.
|
|
119
119
|
- On an `HUMAN_RULING`, HALT and ask -- never fabricate a plan that silently makes the modeling decision.
|
|
@@ -155,7 +155,7 @@ On HALT / failure:
|
|
|
155
155
|
</return_format>
|
|
156
156
|
|
|
157
157
|
<success_criteria>
|
|
158
|
-
- [ ] In `plan`/`followup` mode, authored a bounded, runtime-neutral plan stating branch/state, exact target files+theorems, immutable public statements, old->new API map (if a port), allowed-`sorry` policy, stop conditions, `nice -n 19 lake build` verification, and expected artifact updates
|
|
158
|
+
- [ ] In `plan`/`followup` mode, authored a bounded, runtime-neutral plan stating branch/state, exact target files+theorems, immutable public statements, old->new API map (if a port), allowed-`sorry` policy, stop conditions, `LEAN_NUM_THREADS="${LEAN_NUM_THREADS:-4}" nice -n 19 lake build` verification, and expected artifact updates
|
|
159
159
|
- [ ] In `eval` mode, took an adversarial posture (tried to refute), judged each `sorry` as a named obligation not by count, and ended in exactly one of ACCEPT | FOLLOWUP | HUMAN_RULING | BLOCKED
|
|
160
160
|
- [ ] On `HUMAN_RULING`, HALTed and asked for the modeling decision -- never fabricated a plan
|
|
161
161
|
- [ ] Author-by-return: no project file written or modified; no `gh` auto-open; Lean-via-Aeneas pipeline only; no bare `lake build`
|
package/agents/fvs-doc-syncer.md
CHANGED
|
@@ -74,7 +74,7 @@ The parent provides a `<sync_mode>` tag. Execute the matching mode.
|
|
|
74
74
|
<fvs_hard_rules>
|
|
75
75
|
- Reconcile-not-append: never duplicate an existing catalog entry or reference section; update in place.
|
|
76
76
|
- "Fixed in upstream main" is NOT "fixed for us" -- never auto-retire a catalog entry until the resolved pin carries the fix.
|
|
77
|
-
- NEVER run a bare `lake build` (use `nice -n 19 lake build` if a build is ever needed).
|
|
77
|
+
- NEVER run a bare `lake build` (use `LEAN_NUM_THREADS="${LEAN_NUM_THREADS:-4}" nice -n 19 lake build` if a build is ever needed).
|
|
78
78
|
- NEVER edit generated Lean (`Types.lean` / `Funs.lean`).
|
|
79
79
|
- NEVER call `gh` to OPEN/create an upstream artifact (gh api READ for fetching docs/issues is allowed).
|
|
80
80
|
- Propose each change for approval; all writes use the Write/Edit tool.
|
|
@@ -78,7 +78,7 @@ the local-clone commit, the existing-issue numbers you dedup'd against, the cata
|
|
|
78
78
|
- ESCAPE all interpolated MFE/error/tool output when writing `*.html` (error strings can contain markup).
|
|
79
79
|
- Quote and validate every clone path as a directory before `git -C`; never `eval` a path.
|
|
80
80
|
- Dedup first: cite an existing issue rather than drafting a duplicate.
|
|
81
|
-
- NEVER run a bare `lake build` (use `nice -n 19 lake build` if you must reproduce anything).
|
|
81
|
+
- NEVER run a bare `lake build` (use `LEAN_NUM_THREADS="${LEAN_NUM_THREADS:-4}" nice -n 19 lake build` if you must reproduce anything).
|
|
82
82
|
- NEVER edit generated Lean (`Types.lean` / `Funs.lean`).
|
|
83
83
|
- Write only to the workspace; all writes use the Write/Edit tool.
|
|
84
84
|
- This is a Lean-via-Aeneas pipeline only -- no other-framework verification paths.
|
|
@@ -82,7 +82,7 @@ This is the load-bearing constraint of your role:
|
|
|
82
82
|
<fvs_hard_rules>
|
|
83
83
|
- NEVER write section 7 or the ratification token -- you are not the proposer and not the human reviewer.
|
|
84
84
|
- Read-only: never write or modify a file (return the drafted sections as text).
|
|
85
|
-
- NEVER run a bare `lake build` (use `nice -n 19 lake build` if you must reproduce anything).
|
|
85
|
+
- NEVER run a bare `lake build` (use `LEAN_NUM_THREADS="${LEAN_NUM_THREADS:-4}" nice -n 19 lake build` if you must reproduce anything).
|
|
86
86
|
- NEVER edit generated Lean (`Types.lean` / `Funs.lean`).
|
|
87
87
|
- NEVER call `gh` to open or create any upstream artifact.
|
|
88
88
|
- This is a Lean-via-Aeneas pipeline only -- no other-framework verification paths.
|
|
@@ -83,12 +83,12 @@ crate root using the Write tool:
|
|
|
83
83
|
- append the trusted assumption to `src-assumptions.md` when the recipe axiomatizes, excludes, or
|
|
84
84
|
gates an item (every A-opacity and every gated build-script edit leaves an assumption).
|
|
85
85
|
|
|
86
|
-
Then rebuild to confirm the recipe cleared the blocker, ALWAYS with `nice -n 19 lake build`.
|
|
86
|
+
Then rebuild to confirm the recipe cleared the blocker, ALWAYS with `LEAN_NUM_THREADS="${LEAN_NUM_THREADS:-4}" nice -n 19 lake build`.
|
|
87
87
|
|
|
88
88
|
</process>
|
|
89
89
|
|
|
90
90
|
<fvs_hard_rules>
|
|
91
|
-
- NEVER run a bare `lake build`. Always `nice -n 19 lake build`.
|
|
91
|
+
- NEVER run a bare `lake build`. Always `LEAN_NUM_THREADS="${LEAN_NUM_THREADS:-4}" nice -n 19 lake build`.
|
|
92
92
|
- NEVER edit generated Lean (`Types.lean` / `Funs.lean`). A-opacity edits the RUST source or the
|
|
93
93
|
hand-authored external files; `tweaks-substitution` repairs generated text only via the guarded
|
|
94
94
|
substitution mechanism, never a hand edit of a generated file.
|
|
@@ -139,7 +139,7 @@ On failure:
|
|
|
139
139
|
- [ ] Generated Lean (`Types.lean` / `Funs.lean`) never edited by hand
|
|
140
140
|
- [ ] Reversible records written (src-modifications + src-assumptions where an assumption arises)
|
|
141
141
|
- [ ] `tweaks-substitution` guards honored (>= 1 match; 0-match is a HARD failure)
|
|
142
|
-
- [ ] Rebuild run with `nice -n 19 lake build`, never bare
|
|
142
|
+
- [ ] Rebuild run with `LEAN_NUM_THREADS="${LEAN_NUM_THREADS:-4}" nice -n 19 lake build`, never bare
|
|
143
143
|
- [ ] All writes via the Write tool; no `gh` auto-open; Lean-via-Aeneas pipeline only
|
|
144
144
|
- [ ] Result returned with the appropriate header
|
|
145
145
|
- [ ] No @-references used (all reference content is inlined by the parent)
|
|
@@ -28,7 +28,7 @@ tool.
|
|
|
28
28
|
1. **Shrink.** Starting from the failing input, remove code until the failure disappears, then
|
|
29
29
|
restore the smallest unit that brings it back. Drive every step by an oracle run -- the actual
|
|
30
30
|
extraction step that the classifier said failed (read its exit status with `set -o pipefail` /
|
|
31
|
-
`${PIPESTATUS[0]}`, never the tail of a piped log; rebuild with `nice -n 19 lake build` when the
|
|
31
|
+
`${PIPESTATUS[0]}`, never the tail of a piped log; rebuild with `LEAN_NUM_THREADS="${LEAN_NUM_THREADS:-4}" nice -n 19 lake build` when the
|
|
32
32
|
failing layer is `lean`).
|
|
33
33
|
2. **Grow.** From that minimal core, add back only what is needed to make the example
|
|
34
34
|
self-contained and reproducible. The result is the MFE: the smallest standalone reproduction of
|
|
@@ -73,7 +73,7 @@ proposal awaiting a separate disposition.
|
|
|
73
73
|
|
|
74
74
|
<fvs_hard_rules>
|
|
75
75
|
- NEVER auto-apply a fix and NEVER stamp a ratification token -- you propose, never dispose.
|
|
76
|
-
- NEVER run a bare `lake build`. Always `nice -n 19 lake build`.
|
|
76
|
+
- NEVER run a bare `lake build`. Always `LEAN_NUM_THREADS="${LEAN_NUM_THREADS:-4}" nice -n 19 lake build`.
|
|
77
77
|
- NEVER edit generated Lean (`Types.lean` / `Funs.lean`).
|
|
78
78
|
- NEVER call `gh` to open or create any upstream artifact.
|
|
79
79
|
- A catalog candidate with an empty `evidence` field is malformed -- evidence is the real MFE path,
|
|
@@ -119,7 +119,7 @@ On failure:
|
|
|
119
119
|
|
|
120
120
|
<success_criteria>
|
|
121
121
|
- [ ] Two-phase shrink-then-grow minimization driven by the actual failing-layer oracle
|
|
122
|
-
- [ ] Exit status read via `set -o pipefail` / `${PIPESTATUS[0]}`; rebuilds use `nice -n 19 lake build`
|
|
122
|
+
- [ ] Exit status read via `set -o pipefail` / `${PIPESTATUS[0]}`; rebuilds use `LEAN_NUM_THREADS="${LEAN_NUM_THREADS:-4}" nice -n 19 lake build`
|
|
123
123
|
- [ ] Variant budget enforced as a hard cap; exhaustion emits best partial + ESCALATE
|
|
124
124
|
- [ ] Catalog candidate is schema-conformant with `status: candidate`, REAL `evidence` (the MFE path), and `pin_context`
|
|
125
125
|
- [ ] Category assigned by the safe-by-construction A/B test (meaning judgment -> B)
|
|
@@ -52,7 +52,7 @@ tool's own exit status:
|
|
|
52
52
|
# Illustrative only: this is what the ORCHESTRATOR ran. You (the classifier) are
|
|
53
53
|
# read-only -- you read the resulting build.log to interpret it, you do NOT re-run the build.
|
|
54
54
|
set -o pipefail
|
|
55
|
-
nice -n 19 lake build 2>&1 | tee build.log
|
|
55
|
+
LEAN_NUM_THREADS="${LEAN_NUM_THREADS:-4}" nice -n 19 lake build 2>&1 | tee build.log
|
|
56
56
|
status=${PIPESTATUS[0]} # the build's exit status, not tee's
|
|
57
57
|
```
|
|
58
58
|
|
|
@@ -91,7 +91,7 @@ bisection by the parent, not to a recipe.
|
|
|
91
91
|
<fvs_hard_rules>
|
|
92
92
|
These FVS invariants bind you even though you do not write files:
|
|
93
93
|
|
|
94
|
-
- NEVER run a bare `lake build`. Always `nice -n 19 lake build`.
|
|
94
|
+
- NEVER run a bare `lake build`. Always `LEAN_NUM_THREADS="${LEAN_NUM_THREADS:-4}" nice -n 19 lake build`.
|
|
95
95
|
- NEVER edit generated Lean (`Types.lean` / `Funs.lean`) -- you are read-only regardless.
|
|
96
96
|
- NEVER call `gh` to open or create any upstream artifact.
|
|
97
97
|
- This is a Lean-via-Aeneas pipeline only -- no other-framework verification paths.
|
|
@@ -80,7 +80,7 @@ After applying a refactoring:
|
|
|
80
80
|
**Tier:** {1|2|3|4}
|
|
81
81
|
**Lines:** {before} -> {after}
|
|
82
82
|
|
|
83
|
-
Verify: nice -n 19 lake build
|
|
83
|
+
Verify: LEAN_NUM_THREADS="${LEAN_NUM_THREADS:-4}" nice -n 19 lake build
|
|
84
84
|
```
|
|
85
85
|
|
|
86
86
|
When no further refactoring is possible:
|
|
@@ -108,7 +108,7 @@ When something goes wrong:
|
|
|
108
108
|
- NEVER touch `unfold + step` structural backbone
|
|
109
109
|
- NEVER write changes without explaining the specific heuristic being applied
|
|
110
110
|
- If a change breaks the build, REVERT and return ERROR with the build output
|
|
111
|
-
- Use `nice -n 19 lake build` for all build checks, NEVER plain `lake build`
|
|
111
|
+
- Use `LEAN_NUM_THREADS="${LEAN_NUM_THREADS:-4}" nice -n 19 lake build` for all build checks, NEVER plain `lake build`
|
|
112
112
|
- After a failed refactoring attempt, do not retry the same heuristic
|
|
113
113
|
- Prefer conservative changes -- when in doubt, leave it alone
|
|
114
114
|
- Do NOT use @-references. All reference knowledge is inlined by the parent command.
|
|
@@ -91,6 +91,22 @@ Follow the PRE-FLIGHT step of the workflow:
|
|
|
91
91
|
Initialise the workspace tree `<extract_workspace>/<target>/` with subdirs `equivalence-gate/`,
|
|
92
92
|
`mwe/`, `drafts/`, `catalog-candidates/`, `escalations/`.
|
|
93
93
|
|
|
94
|
+
Run the mandatory cache preflight from the validated Lean project root. A failure stops the
|
|
95
|
+
workflow before extraction, delegation, or build:
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
if { [ ! -f lakefile.lean ] && [ ! -f lakefile.toml ]; } || [ ! -f lean-toolchain ]; then
|
|
99
|
+
echo "FVS >> ERROR: run from the Lean project root" >&2
|
|
100
|
+
exit 1
|
|
101
|
+
fi
|
|
102
|
+
LEAN_NUM_THREADS="${LEAN_NUM_THREADS:-4}" nice -n 19 lake exe cache get
|
|
103
|
+
CACHE_STATUS=$?
|
|
104
|
+
if [ "$CACHE_STATUS" -ne 0 ]; then
|
|
105
|
+
echo "FVS >> ERROR: Lake cache preflight failed; stopping workflow" >&2
|
|
106
|
+
exit "$CACHE_STATUS"
|
|
107
|
+
fi
|
|
108
|
+
```
|
|
109
|
+
|
|
94
110
|
## Step 3: Run the bounded loop
|
|
95
111
|
|
|
96
112
|
Repeat EXTRACT -> CLASSIFY -> DISPATCH -> DOCUMENT until clean or escalated, enforcing the
|
|
@@ -98,7 +114,7 @@ loop bounds (per-blocker attempt-cap 3, per-run cycle hard-cap ~25, bisection va
|
|
|
98
114
|
~12, no-progress key `sha256(layer || signature)` -- a same-key recurrence after an applied
|
|
99
115
|
fix escalates immediately).
|
|
100
116
|
|
|
101
|
-
- **EXTRACT:** run extraction and build under `set -o pipefail` + `nice -n 19 lake build`;
|
|
117
|
+
- **EXTRACT:** run extraction and build under `set -o pipefail` + `LEAN_NUM_THREADS="${LEAN_NUM_THREADS:-4}" nice -n 19 lake build`;
|
|
102
118
|
read the tool's real exit status via `${PIPESTATUS[0]}`, never the tail of a piped log.
|
|
103
119
|
Clean -> success oracle (Step 5). Failure -> classify.
|
|
104
120
|
- **CLASSIFY:** `Task(subagent_type="fvs-extract-classifier", model="$CLASSIFIER_MODEL", ...)`
|
|
@@ -204,7 +220,7 @@ per model-profiles runtime handling).
|
|
|
204
220
|
<success_criteria>
|
|
205
221
|
- [ ] `<path>` auto-detected into crate/folder/file; the loop scoped accordingly.
|
|
206
222
|
- [ ] Pin-audit warn-and-confirm on drift records `pin_context`; clone staleness reported gracefully.
|
|
207
|
-
- [ ] EXTRACT reads the tool's real exit status (`set -o pipefail` / `${PIPESTATUS[0]}`); always `nice -n 19 lake build`.
|
|
223
|
+
- [ ] EXTRACT reads the tool's real exit status (`set -o pipefail` / `${PIPESTATUS[0]}`); always `LEAN_NUM_THREADS="${LEAN_NUM_THREADS:-4}" nice -n 19 lake build`.
|
|
208
224
|
- [ ] The orchestrator fires the gate itself, dispatching `fvs-equivalence-assessor` distinctly from `fvs-extract-bisector`; the success oracle greps `equivalence-ratified:` and refuses completion without it.
|
|
209
225
|
- [ ] Reversible records at the crate root; generated Lean never written; annotations preferred.
|
|
210
226
|
- [ ] Attempt-cap 3 + no-progress rule enforced; escalation is a human decision point and a valid outcome.
|
|
@@ -94,6 +94,24 @@ Read the bounded executor plan for this iteration -- `plans/EXEC_PLAN_nN.md`, or
|
|
|
94
94
|
the executor needs (it is runtime-neutral and bounded -- branch/state, exact targets, immutable public
|
|
95
95
|
statements, allowed-`sorry` policy, stop conditions, verification command).
|
|
96
96
|
|
|
97
|
+
## Step 2a: Warm the project cache
|
|
98
|
+
|
|
99
|
+
Before dispatch, confirm the current directory is the Lean project root and run the project-resolved
|
|
100
|
+
cache executable. Cache failure is fatal: do not dispatch the executor or attempt a build.
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
if { [ ! -f lakefile.lean ] && [ ! -f lakefile.toml ]; } || [ ! -f lean-toolchain ]; then
|
|
104
|
+
echo "FVS >> ERROR: run from the Lean project root" >&2
|
|
105
|
+
exit 1
|
|
106
|
+
fi
|
|
107
|
+
LEAN_NUM_THREADS="${LEAN_NUM_THREADS:-4}" nice -n 19 lake exe cache get
|
|
108
|
+
CACHE_STATUS=$?
|
|
109
|
+
if [ "$CACHE_STATUS" -ne 0 ]; then
|
|
110
|
+
echo "FVS >> ERROR: Lake cache preflight failed; refusing executor dispatch" >&2
|
|
111
|
+
exit "$CACHE_STATUS"
|
|
112
|
+
fi
|
|
113
|
+
```
|
|
114
|
+
|
|
97
115
|
## Step 3: Resolve the executor model + effort + dispatch
|
|
98
116
|
|
|
99
117
|
Resolve `$EXECUTOR_MODEL` and `$EXECUTOR_EFFORT` for `fvs-crypto-executor` AT DISPATCH TIME -- never
|
|
@@ -151,11 +169,11 @@ Return `none` when nothing reusable was learned.
|
|
|
151
169
|
## Step 4: Verify under the green-build guard
|
|
152
170
|
|
|
153
171
|
Run the verification build and read the TOOL's real exit status -- never the tail of a pipe (a pipe
|
|
154
|
-
reports the filter's status `0`, masking a real failure). Always build under `nice -n 19 lake build`:
|
|
172
|
+
reports the filter's status `0`, masking a real failure). Always build under `LEAN_NUM_THREADS="${LEAN_NUM_THREADS:-4}" nice -n 19 lake build`:
|
|
155
173
|
|
|
156
174
|
```bash
|
|
157
175
|
set -o pipefail
|
|
158
|
-
nice -n 19 lake build 2>&1 | tee "$ROOT/build.log"
|
|
176
|
+
LEAN_NUM_THREADS="${LEAN_NUM_THREADS:-4}" nice -n 19 lake build 2>&1 | tee "$ROOT/build.log"
|
|
159
177
|
test ${PIPESTATUS[0]} -eq 0 || echo "FVS >> build red -- a proof did not close"
|
|
160
178
|
```
|
|
161
179
|
|
|
@@ -209,7 +227,7 @@ at install time, so the per-run `--effort` flag is a no-op there).
|
|
|
209
227
|
- [ ] Topic + iteration resolved; shell metacharacters rejected; every path quoted; no `eval`.
|
|
210
228
|
- [ ] At most eight relevant crypto/shared lessons loaded and passed as untrusted executor context.
|
|
211
229
|
- [ ] The bounded plan (`EXEC_PLAN_nN.md` / `FOLLOWUP_PLAN_nN.md`) read and inlined; `fvs-crypto-executor` dispatched (`subagent_type="fvs-crypto-executor"`).
|
|
212
|
-
- [ ] The build runs under `set -o pipefail` + `${PIPESTATUS` reading the tool's real status; always `nice -n 19 lake build` (never a bare `lake build`).
|
|
230
|
+
- [ ] The build runs under `set -o pipefail` + `${PIPESTATUS` reading the tool's real status; always `LEAN_NUM_THREADS="${LEAN_NUM_THREADS:-4}" nice -n 19 lake build` (never a bare `lake build`).
|
|
213
231
|
- [ ] The executor's ESCALATE/BLOCKED return is routed to the user (short interactive redirect early, never a long unattended grind).
|
|
214
232
|
- [ ] At most three build/diagnostic-evidenced candidates reconciled as one file each plus index updates.
|
|
215
233
|
- [ ] No `gh` open/create; no generated-Lean write.
|
|
@@ -110,6 +110,22 @@ This command will NOT author a follow-up that silently picks a side.
|
|
|
110
110
|
Only AFTER the user supplies the ruling does the command author a follow-up plan that encodes the
|
|
111
111
|
ruling (returning to Step 4). Never invent a follow-up on `HUMAN_RULING` without the human's ruling.
|
|
112
112
|
|
|
113
|
+
Run the mandatory cache preflight from the validated Lean project root before either thinker path.
|
|
114
|
+
A failure stops the workflow before delegation or any authored build plan:
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
if { [ ! -f lakefile.lean ] && [ ! -f lakefile.toml ]; } || [ ! -f lean-toolchain ]; then
|
|
118
|
+
echo "FVS >> ERROR: run from the Lean project root" >&2
|
|
119
|
+
exit 1
|
|
120
|
+
fi
|
|
121
|
+
LEAN_NUM_THREADS="${LEAN_NUM_THREADS:-4}" nice -n 19 lake exe cache get
|
|
122
|
+
CACHE_STATUS=$?
|
|
123
|
+
if [ "$CACHE_STATUS" -ne 0 ]; then
|
|
124
|
+
echo "FVS >> ERROR: Lake cache preflight failed; stopping workflow" >&2
|
|
125
|
+
exit "$CACHE_STATUS"
|
|
126
|
+
fi
|
|
127
|
+
```
|
|
128
|
+
|
|
113
129
|
## Step 4: Resolve the thinker + dispatch (followup mode)
|
|
114
130
|
|
|
115
131
|
Default (no `--codex`) -- dispatch the in-runtime thinker. Resolve `$THINKER_MODEL` for
|
|
@@ -160,7 +176,7 @@ The thinker (in-runtime or Codex) authors the follow-up plan; THIS command body
|
|
|
160
176
|
`plans/FOLLOWUP_PLAN_nN.md` carrying
|
|
161
177
|
the full bounded-plan contract (branch/state, exact target files + theorems, immutable public
|
|
162
178
|
statements that must not change, allowed-`sorry` policy, stop conditions, the verification command
|
|
163
|
-
`nice -n 19 lake build` under the `set -o pipefail` / `${PIPESTATUS` guard, expected artifact
|
|
179
|
+
`LEAN_NUM_THREADS="${LEAN_NUM_THREADS:-4}" nice -n 19 lake build` under the `set -o pipefail` / `${PIPESTATUS` guard, expected artifact
|
|
164
180
|
updates).
|
|
165
181
|
|
|
166
182
|
The artifact MUST also record:
|
|
@@ -130,6 +130,22 @@ Then PROCEED only at the user's explicit choice in a LABELED DEGRADED mode -- re
|
|
|
130
130
|
formalisation was not paper-grounded. Do NOT silently continue; do NOT repeat the loud-fail on
|
|
131
131
|
every question (loud-fail ONCE, then degrade or stop on the user's choice).
|
|
132
132
|
|
|
133
|
+
Run the mandatory cache preflight from the validated Lean project root before either thinker path.
|
|
134
|
+
A failure stops the workflow before delegation or any authored build plan:
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
if { [ ! -f lakefile.lean ] && [ ! -f lakefile.toml ]; } || [ ! -f lean-toolchain ]; then
|
|
138
|
+
echo "FVS >> ERROR: run from the Lean project root" >&2
|
|
139
|
+
exit 1
|
|
140
|
+
fi
|
|
141
|
+
LEAN_NUM_THREADS="${LEAN_NUM_THREADS:-4}" nice -n 19 lake exe cache get
|
|
142
|
+
CACHE_STATUS=$?
|
|
143
|
+
if [ "$CACHE_STATUS" -ne 0 ]; then
|
|
144
|
+
echo "FVS >> ERROR: Lake cache preflight failed; stopping workflow" >&2
|
|
145
|
+
exit "$CACHE_STATUS"
|
|
146
|
+
fi
|
|
147
|
+
```
|
|
148
|
+
|
|
133
149
|
## Step 5: Dispatch the thinker (author the bounded plan)
|
|
134
150
|
|
|
135
151
|
Default (no `--codex`) -- dispatch the in-runtime thinker. `cat` the topic artifacts and the cached
|
|
@@ -200,7 +216,7 @@ Carry the BOUNDED-PLAN CONTRACT verbatim into `EXEC_PLAN_nN.md`:
|
|
|
200
216
|
5. **Allowed-`sorry` policy** -- which `sorry`s are permitted as NAMED obligations with the exact
|
|
201
217
|
statement each must carry (never judged by count).
|
|
202
218
|
6. **Stop conditions** -- the explicit conditions under which the executor HALTS.
|
|
203
|
-
7. **Verification commands** -- ALWAYS `nice -n 19 lake build` (never a bare `lake build`), under
|
|
219
|
+
7. **Verification commands** -- ALWAYS `LEAN_NUM_THREADS="${LEAN_NUM_THREADS:-4}" nice -n 19 lake build` (never a bare `lake build`), under
|
|
204
220
|
the `set -o pipefail` / `${PIPESTATUS` guard so a piped build failure is never masked.
|
|
205
221
|
8. **Expected artifact updates** -- which `fv-plans/<topic>/{plans,reviews,sources,merge}` files the
|
|
206
222
|
run is expected to produce or update.
|
|
@@ -251,7 +267,7 @@ auto-picks a default, never writes an upstream artifact).
|
|
|
251
267
|
- [ ] At most eight relevant crypto/shared lessons loaded and snapshotted for either thinker runtime.
|
|
252
268
|
- [ ] `$THINKER_MODEL` resolved via the model-profiles sequence; the thinker dispatched (`subagent_type="fvs-crypto-thinker"`) with inlined context.
|
|
253
269
|
- [ ] KB grounded intensively when configured; cached under `sources/` and re-read before re-querying; loud-fail-once + labeled-degrade + `/fvs:kb-setup` when unconfigured.
|
|
254
|
-
- [ ] The bounded-plan contract (stop conditions, verification commands `nice -n 19 lake build`, immutable public statements, allowed-`sorry`) is written into `EXEC_PLAN_nN.md`.
|
|
270
|
+
- [ ] The bounded-plan contract (stop conditions, verification commands `LEAN_NUM_THREADS="${LEAN_NUM_THREADS:-4}" nice -n 19 lake build`, immutable public statements, allowed-`sorry`) is written into `EXEC_PLAN_nN.md`.
|
|
255
271
|
- [ ] Both plan artifacts record truthful `Authoring runtime:` provenance; the next action is
|
|
256
272
|
independent `/fvs:crypto-review`, not direct execution.
|
|
257
273
|
- [ ] At most three evidence-gated lesson candidates reconciled as one file each plus index updates.
|
package/commands/fvs/fc.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: fvs:fc
|
|
3
|
-
description: "formal-verification core | plan specify verify explain refactor"
|
|
3
|
+
description: "formal-verification core | plan specify review verify explain refactor"
|
|
4
4
|
argument-hint: ""
|
|
5
5
|
allowed-tools:
|
|
6
6
|
- Read
|
|
7
7
|
- Skill
|
|
8
|
-
requires: [fc-plan, lean-specify, lean-verify, natural-language, lean-refactor, trust-audit]
|
|
8
|
+
requires: [fc-plan, lean-specify, lean-spec-review, lean-verify, natural-language, lean-refactor, trust-audit]
|
|
9
9
|
---
|
|
10
10
|
|
|
11
11
|
Route to the appropriate formal-verification-core skill based on the user's intent.
|
|
@@ -19,6 +19,7 @@ When invoked WITH a request, match it against the table below and invoke the mat
|
|
|
19
19
|
|---|---|
|
|
20
20
|
| Pick next verification targets | fvs:fc-plan |
|
|
21
21
|
| Generate a Lean spec skeleton | fvs:lean-specify |
|
|
22
|
+
| Adversarially review a specification against source | fvs:lean-spec-review |
|
|
22
23
|
| Attempt a proof | fvs:lean-verify |
|
|
23
24
|
| Explain a module/function in natural language | fvs:natural-language |
|
|
24
25
|
| Refactor / simplify / decompose a proof | fvs:lean-refactor |
|
package/commands/fvs/help.md
CHANGED
|
@@ -27,7 +27,7 @@ Commands are grouped into five bundles. Each bundle has a router command (e.g. `
|
|
|
27
27
|
1. `/fvs:aeneas-extract <path>` - Extract Rust → Lean 4 via the bounded Aeneas repair loop
|
|
28
28
|
2. `/fvs:map-code` - Analyze project, build dependency graph
|
|
29
29
|
3. `/fvs:fc-plan` - Select verification targets
|
|
30
|
-
4. `/fvs:lean-specify <function>` - Generate spec with sorry
|
|
30
|
+
4. `/fvs:lean-specify <function>` - Generate spec with sorry, then choose an adversarial reviewer
|
|
31
31
|
5. `/fvs:lean-verify <spec_path>` - Attempt proof interactively
|
|
32
32
|
6. `/fvs:lean-refactor <spec_path>` - Golf and clean up verified proofs
|
|
33
33
|
7. `/fvs:trust-audit <target>` - Audit the sorry/axiom trust surface
|
|
@@ -39,7 +39,7 @@ Commands are grouped into five bundles. Each bundle has a router command (e.g. `
|
|
|
39
39
|
## Core Workflow
|
|
40
40
|
|
|
41
41
|
```
|
|
42
|
-
Code track: /fvs:aeneas-extract → /fvs:map-code → /fvs:fc-plan → /fvs:lean-specify → /fvs:lean-verify → /fvs:lean-refactor → /fvs:trust-audit
|
|
42
|
+
Code track: /fvs:aeneas-extract → /fvs:map-code → /fvs:fc-plan → /fvs:lean-specify → /fvs:lean-spec-review → /fvs:lean-verify → /fvs:lean-refactor → /fvs:trust-audit
|
|
43
43
|
Paper track: /fvs:lean-formalise → /fvs:lean-verify → /fvs:lean-refactor
|
|
44
44
|
Crypto loop: /fvs:crypto-plan → /fvs:crypto-review → /fvs:crypto-execute → /fvs:crypto-eval → /fvs:crypto-followup → /fvs:crypto-review → repeat
|
|
45
45
|
```
|
|
@@ -50,7 +50,7 @@ Five router commands group the skills. Invoke a router bare to print its routing
|
|
|
50
50
|
|
|
51
51
|
- `/fvs:aeneas` — Aeneas/Charon extraction maintenance (aeneas-extract, sync-aeneas-verif)
|
|
52
52
|
- `/fvs:context` — Codebase context (map-code)
|
|
53
|
-
- `/fvs:fc` — Formal-correctness core (fc-plan, lean-specify, lean-verify, natural-language, lean-refactor, trust-audit)
|
|
53
|
+
- `/fvs:fc` — Formal-correctness core (fc-plan, lean-specify, lean-spec-review, lean-verify, natural-language, lean-refactor, trust-audit)
|
|
54
54
|
- `/fvs:formalise` — Paper formalisation (lean-formalise, lean-refactor)
|
|
55
55
|
- `/fvs:manage` — Management (help, update, checkpoint, pause-work, resume-work, reapply-patches, kb-setup)
|
|
56
56
|
|
|
@@ -132,6 +132,23 @@ Generate Lean spec skeleton following @[step] theorem pattern.
|
|
|
132
132
|
Usage: `/fvs:lean-specify scalar_mul_inner`
|
|
133
133
|
Result: `Specs/{path}/{FunctionName}.lean` with sorry placeholder
|
|
134
134
|
|
|
135
|
+
**`/fvs:lean-spec-review <spec.lean> [--reviewer codex|claude|other] [--model ID] [--effort LEVEL]`**
|
|
136
|
+
Adversarially review an FC specification against Rust, extracted Lean, and interpretation definitions.
|
|
137
|
+
|
|
138
|
+
- Offers reviewer -> model -> effort menus; the other runtime appears first
|
|
139
|
+
- Codex suggestions: GPT Sol and Astra; Claude suggestion: Fable; cheaper/custom models allowed
|
|
140
|
+
- Effort defaults to `max`; lower settings and `runtime-default` remain selectable
|
|
141
|
+
- Uses fresh reviewers and labels cross-runtime versus same-runtime review
|
|
142
|
+
- Other providers use an exported packet and imported response; missing CLIs offer setup/fallback
|
|
143
|
+
- Preserves the spec and records findings, input hashes, and triage in `.formalising/spec-reviews/`
|
|
144
|
+
- PASS readies the statement for proof; REVISE/BLOCKED need corrections or evidence
|
|
145
|
+
|
|
146
|
+
Runs automatically after `lean-specify` by default, even on projects without config. To disable
|
|
147
|
+
only automation, merge `"spec_review": {"automatic": false}` into `.formalising/fvs-config.json`,
|
|
148
|
+
or create the file with `{"spec_review": {"automatic": false}}`. Manual invocation still works.
|
|
149
|
+
|
|
150
|
+
Usage: `/fvs:lean-spec-review Specs/Scalar/Mul.lean --reviewer codex --model gpt-6-astra --effort max`
|
|
151
|
+
|
|
135
152
|
**`/fvs:lean-verify <spec_file_path>`**
|
|
136
153
|
Attempt proof using domain tactics with interactive feedback.
|
|
137
154
|
|
|
@@ -173,7 +190,7 @@ Usage: `/fvs:lean-refactor Specs/Backend/Field/Sub.lean --theorem sub_spec --rep
|
|
|
173
190
|
**`/fvs:trust-audit <target spec file | module subtree>`**
|
|
174
191
|
Build-backed trust audit of an Aeneas-extracted Lean target.
|
|
175
192
|
|
|
176
|
-
- Runs `nice -n 19 lake build` as a green-build-guarded precondition; HALTs if the target layer does not compile
|
|
193
|
+
- Runs `LEAN_NUM_THREADS="${LEAN_NUM_THREADS:-4}" nice -n 19 lake build` as a green-build-guarded precondition; HALTs if the target layer does not compile
|
|
177
194
|
- Dispatches the read-only `fvs-axiom-auditor` to introspect every in-scope declaration via `#print axioms`
|
|
178
195
|
- Classifies each: `sorryAx` ⇒ sorry, classical trio (propext / Classical.choice / Quot.sound) auto-noted, project-custom axioms require justification
|
|
179
196
|
- Strictly-scoped inventory (Rust path convention); cone members surfaced as prerequisites, never inventory rows
|
|
@@ -124,6 +124,24 @@ For images (PNG/JPG): note they will be read via Claude's vision capability (Rea
|
|
|
124
124
|
|
|
125
125
|
If no resources and no KB: warn that the researcher will have limited context, but continue -- the user may be working from general mathematical knowledge.
|
|
126
126
|
|
|
127
|
+
### Mandatory Lake cache preflight
|
|
128
|
+
|
|
129
|
+
Run this from the validated Lean project root before either subagent dispatch. A failure stops the
|
|
130
|
+
workflow before delegation or build:
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
if { [ ! -f lakefile.lean ] && [ ! -f lakefile.toml ]; } || [ ! -f lean-toolchain ]; then
|
|
134
|
+
echo "FVS >> ERROR: run from the Lean project root" >&2
|
|
135
|
+
exit 1
|
|
136
|
+
fi
|
|
137
|
+
LEAN_NUM_THREADS="${LEAN_NUM_THREADS:-4}" nice -n 19 lake exe cache get
|
|
138
|
+
CACHE_STATUS=$?
|
|
139
|
+
if [ "$CACHE_STATUS" -ne 0 ]; then
|
|
140
|
+
echo "FVS >> ERROR: Lake cache preflight failed; stopping workflow" >&2
|
|
141
|
+
exit "$CACHE_STATUS"
|
|
142
|
+
fi
|
|
143
|
+
```
|
|
144
|
+
|
|
127
145
|
## Step 2a: Load Bounded Proof-Engineering Memory
|
|
128
146
|
|
|
129
147
|
Follow `proof-engineering-loop.md` and initialize `.formalising/proof-engineering/`. Classify this
|
|
@@ -331,12 +349,12 @@ Check:
|
|
|
331
349
|
## Step 9: Optional Build Check
|
|
332
350
|
|
|
333
351
|
```bash
|
|
334
|
-
nice -n 19 lake build 2>&1 | tail -20
|
|
352
|
+
LEAN_NUM_THREADS="${LEAN_NUM_THREADS:-4}" nice -n 19 lake build 2>&1 | tail -20
|
|
335
353
|
```
|
|
336
354
|
|
|
337
355
|
- sorry warnings are expected and correct at this stage
|
|
338
356
|
- Import errors or type errors noted for user
|
|
339
|
-
- NEVER run plain `lake build`. Always use `nice -n 19 lake build`.
|
|
357
|
+
- NEVER run plain `lake build`. Always use `LEAN_NUM_THREADS="${LEAN_NUM_THREADS:-4}" nice -n 19 lake build`.
|
|
340
358
|
|
|
341
359
|
## Step 9a: Reconcile Proof-Engineering Lessons
|
|
342
360
|
|
|
@@ -377,7 +395,7 @@ Status: [??] Ready for verification (contains sorry)
|
|
|
377
395
|
- [ ] Researcher's proposed structure reviewed by user before execution
|
|
378
396
|
- [ ] Executor subagent created both definition files AND spec files
|
|
379
397
|
- [ ] Generated files validated (sorry present, imports consistent)
|
|
380
|
-
- [ ] Build check uses nice -n 19 lake build (never plain lake build)
|
|
398
|
+
- [ ] Build check uses LEAN_NUM_THREADS="${LEAN_NUM_THREADS:-4}" nice -n 19 lake build (never plain lake build)
|
|
381
399
|
- [ ] At most three evidence-gated candidates reconciled as one lesson per file plus index updates
|
|
382
400
|
- [ ] Summary uses FVS >> FORMALISE banner with file list
|
|
383
401
|
- [ ] Clear next step offered: /fvs:lean-verify
|