fv-skills-baif 2.0.3 → 2.1.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 +22 -0
- package/README.md +21 -7
- package/agents/fvs-executor.md +22 -0
- package/agents/fvs-researcher.md +6 -2
- package/bin/install.js +26 -0
- package/commands/fvs/crypto-eval.md +4 -3
- package/commands/fvs/crypto-execute.md +2 -2
- package/commands/fvs/crypto-followup.md +18 -6
- package/commands/fvs/crypto-plan.md +21 -6
- package/commands/fvs/crypto-review.md +181 -0
- package/commands/fvs/formalise.md +6 -2
- package/commands/fvs/help.md +25 -2
- package/commands/fvs/lean-specify.md +83 -11
- package/commands/fvs/lean-verify.md +89 -11
- package/commands/fvs/sync-aeneas-verif.md +33 -0
- package/fv-skills/VERSION +1 -1
- package/fv-skills/references/crypto-plan-review.md +195 -0
- package/fv-skills/references/lean-spec-conventions.md +37 -0
- package/fv-skills/references/model-profiles.md +12 -3
- package/fv-skills/templates/config.json +4 -2
- package/fv-skills/workflows/crypto-followup.md +5 -0
- package/fv-skills/workflows/crypto-plan.md +6 -0
- package/fv-skills/workflows/crypto-review.md +80 -0
- package/fv-skills/workflows/lean-specify.md +44 -3
- package/fv-skills/workflows/lean-verify.md +44 -4
- package/fv-skills/workflows/sync-aeneas-verif.md +24 -0
- package/hooks/dist/fvs-statusline.js +1 -1
- package/package.json +1 -1
- package/scripts/fvs-codex-think.mjs +315 -23
- package/scripts/fvs-lean-style-check.mjs +486 -0
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,28 @@ 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.1.0] - 2026-07-26
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
- `/fvs:crypto-review` sends an initial or follow-up crypto plan to authenticated Codex for an
|
|
11
|
+
independent pre-execution adversarial review. Codex runs xhigh, effort-only, ephemeral, and
|
|
12
|
+
read-only; the FVS wrapper persists one validated review artifact and the primary planning seat
|
|
13
|
+
records its evidence-backed response. Codex-authored/unknown-provenance plans and non-APPROVE
|
|
14
|
+
verdicts fail closed before execution.
|
|
15
|
+
|
|
16
|
+
### Changed
|
|
17
|
+
- `/fvs:lean-specify` and `/fvs:lean-verify` now discover and fully load the target repository's
|
|
18
|
+
style guide (configurable with `project.style_guide_path`) into both research and execution
|
|
19
|
+
prompts. A shipped post-write checker enforces the repository line limit (100-column fallback)
|
|
20
|
+
and rejects new ordinary identifiers with three or more namespace dots; verification preserves
|
|
21
|
+
legacy debt only through an explicit baseline and requires full compliance for statement edits.
|
|
22
|
+
|
|
23
|
+
### Fixed
|
|
24
|
+
- FVS installs now verify the shipped Aeneas `_sync-meta.json` mapping and the sync command reports
|
|
25
|
+
real update/reinstall recovery instead of a nonexistent Aeneas installer option.
|
|
26
|
+
- The config template now uses the top-level model schema consumed by commands and defaults
|
|
27
|
+
`fvs-crypto-thinker` to `inherit`.
|
|
28
|
+
|
|
7
29
|
## [2.0.3] - 2026-07-04
|
|
8
30
|
|
|
9
31
|
### Changed
|
package/README.md
CHANGED
|
@@ -121,12 +121,18 @@ Commands are grouped into five bundles. Each bundle has a **router** command tha
|
|
|
121
121
|
| Command | Description |
|
|
122
122
|
|---------|-------------|
|
|
123
123
|
| `/fvs:fc-plan` | Pick next verification targets via greedy dependency graph traversal |
|
|
124
|
-
| `/fvs:lean-specify` | Generate Lean spec skeleton with `@[step]` theorem pattern |
|
|
125
|
-
| `/fvs:lean-verify` | Attempt proof
|
|
124
|
+
| `/fvs:lean-specify` | Generate a style-checked Lean spec skeleton with `@[step]` theorem pattern |
|
|
125
|
+
| `/fvs:lean-verify` | Attempt proof with domain tactics while blocking new target-style violations |
|
|
126
126
|
| `/fvs:natural-language` | Generate natural language explanation of module or function with pre/post conditions |
|
|
127
127
|
| `/fvs:lean-refactor` | Refactor, simplify, and decompose verified proofs (dead code removal, simp sharpening, tactic golf) — *also in Formalise* |
|
|
128
128
|
| `/fvs:trust-audit` | Build-backed audit of every sorry/axiom affecting a target layer; `#print axioms` classification, fail-if-unjustified gate, dependency-ordered table |
|
|
129
129
|
|
|
130
|
+
`lean-specify` and `lean-verify` load a target style guide from
|
|
131
|
+
`.formalising/fvs-config.json` (`project.style_guide_path`) or discover standard files such as
|
|
132
|
+
`doc/STYLE_GUIDE`. With no guide they enforce a 100-column fallback. Their post-write gate also
|
|
133
|
+
rejects ordinary Lean identifiers with three or more namespace dots, steering generated code
|
|
134
|
+
toward scoped namespaces, `open`, and local names.
|
|
135
|
+
|
|
130
136
|
### Formalise (Paper Track) — `/fvs:formalise`
|
|
131
137
|
|
|
132
138
|
| Command | Description |
|
|
@@ -134,6 +140,7 @@ Commands are grouped into five bundles. Each bundle has a **router** command tha
|
|
|
134
140
|
| `/fvs:lean-formalise` | Formalise paper/math content into Lean 4 specs and definitions (one-shot) |
|
|
135
141
|
| `/fvs:lean-refactor` | Refactor, simplify, and decompose verified proofs — *also in Formal-Core* |
|
|
136
142
|
| `/fvs:crypto-plan` | Author the next bounded, runtime-neutral plan for a topic-based crypto formalisation iteration (KB-grounded, cached under `sources/`) |
|
|
143
|
+
| `/fvs:crypto-review` | Send an initial or follow-up crypto plan to authenticated Codex for independent, read-only adversarial review before execution |
|
|
137
144
|
| `/fvs:crypto-execute` | Run the current iteration's bounded plan under the green-build guard |
|
|
138
145
|
| `/fvs:crypto-eval` | Adversarially evaluate the iteration; ends in one of ACCEPT / FOLLOWUP / HUMAN_RULING / BLOCKED |
|
|
139
146
|
| `/fvs:crypto-followup` | Convert eval findings into the next follow-up plan; HALTs on HUMAN_RULING |
|
|
@@ -184,11 +191,18 @@ This track verifies Rust that Aeneas has lowered to Lean 4. Starting from a Rust
|
|
|
184
191
|
The paper track formalises papers directly into Lean 4 — no Rust, no Aeneas. Two entry points:
|
|
185
192
|
|
|
186
193
|
- **One-shot:** `/fvs:lean-formalise` reads your PDFs / images / LaTeX (optionally grounded in a NotebookLM knowledge base via `/fvs:kb-setup`) and produces Lean definition and spec files in a single pass.
|
|
187
|
-
- **Iterative crypto loop:** for larger crypto formalisations, a topic-based, restartable loop
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
194
|
+
- **Iterative crypto loop:** for larger crypto formalisations, a topic-based, restartable loop with
|
|
195
|
+
an independent pre-execution review gate:
|
|
196
|
+
|
|
197
|
+
`/fvs:crypto-plan` → `/fvs:crypto-review` → `/fvs:crypto-execute` → `/fvs:crypto-eval` → `/fvs:crypto-followup` → `/fvs:crypto-review` → repeat
|
|
198
|
+
|
|
199
|
+
A high-effort thinker authors each bounded plan. Before execution, authenticated Codex
|
|
200
|
+
independently attacks the plan or follow-up under a read-only sandbox and returns an
|
|
201
|
+
evidence-backed APPROVE / APPROVE-WITH-EDITS / REJECT verdict. The executor runs an approved plan
|
|
202
|
+
under a green-build guard; the post-execution adversarial eval tries to refute the spec, proof,
|
|
203
|
+
and assumptions and ends in exactly one of ACCEPT / FOLLOWUP / HUMAN_RULING / BLOCKED. Follow-up
|
|
204
|
+
turns findings into the next plan (halting for a human modeling ruling) and is reviewed again
|
|
205
|
+
before execution.
|
|
192
206
|
|
|
193
207
|
**Single- vs dual-runtime (`--codex`).** By default the loop is single-runtime — the thinking stages (`crypto-plan`, `crypto-eval`, `crypto-followup`) run the in-runtime `fvs-crypto-thinker`. Pass `--codex` to hand a stage's thinking to an independent **Codex CLI** thinker instead, so the adversarial planner/evaluator runs on a *different engine* than the executor and blind spots don't correlate. `crypto-execute` is the runtime-neutral executor and takes no `--codex`. Without the Codex CLI installed, a `--codex` stage stops with an install hint rather than silently falling back.
|
|
194
208
|
|
package/agents/fvs-executor.md
CHANGED
|
@@ -68,6 +68,7 @@ Your parent command provides `<execution_mode>` and `<research_findings>` tags.
|
|
|
68
68
|
- Postcondition candidates
|
|
69
69
|
- Similar spec examples as patterns
|
|
70
70
|
- Dependency specs
|
|
71
|
+
- The complete target repository style guide and its mechanical limits
|
|
71
72
|
2. Generate a Lean specification file containing:
|
|
72
73
|
- Import statements
|
|
73
74
|
- Spec theorem with appropriate postconditions
|
|
@@ -75,6 +76,9 @@ Your parent command provides `<execution_mode>` and `<research_findings>` tags.
|
|
|
75
76
|
- Comments linking to the source function
|
|
76
77
|
3. Write the spec file to the project-conventional Specs/ directory
|
|
77
78
|
4. Use established naming convention: `{FunctionName}_spec`
|
|
79
|
+
5. Treat the target style guide as a hard output contract. Wrap at its line limit (100 columns
|
|
80
|
+
when unspecified), and replace identifiers with three or more namespace dots by a scoped
|
|
81
|
+
namespace/open or a local name/abbreviation.
|
|
78
82
|
</mode>
|
|
79
83
|
|
|
80
84
|
<mode name="proof-attempt">
|
|
@@ -85,6 +89,12 @@ Your parent command provides `<execution_mode>` and `<research_findings>` tags.
|
|
|
85
89
|
|
|
86
90
|
CRITICAL BEHAVIORAL CONSTRAINT: Work ONE sorry at a time. Write small tactic blocks (have, calc, unfold + step). The user checks that Lean compiles between each step.
|
|
87
91
|
|
|
92
|
+
The theorem name and statement are immutable in ordinary proof-attempt mode: replace only the
|
|
93
|
+
targeted proof `sorry`. If the user explicitly authorizes a statement edit, preserve its
|
|
94
|
+
mathematical meaning and apply the complete target style guide to the edited declaration. Never
|
|
95
|
+
introduce a line over the configured limit or an ordinary identifier with three or more namespace
|
|
96
|
+
dots.
|
|
97
|
+
|
|
88
98
|
1. Read the research findings to identify:
|
|
89
99
|
- Which sorry to target (first unresolved, or as directed by user)
|
|
90
100
|
- Available @[step] lemmas from dependencies
|
|
@@ -119,6 +129,17 @@ For spec-generation mode:
|
|
|
119
129
|
- Express bounds from Rust source analysis, not guesses
|
|
120
130
|
- Include `sorry` placeholder -- do not attempt proof
|
|
121
131
|
- Follow lean-spec-conventions from the inlined reference
|
|
132
|
+
- Follow the inlined target repository style guide as a hard constraint. It takes precedence over
|
|
133
|
+
generic template presentation, but never over mathematical/source fidelity.
|
|
134
|
+
- Default to at most 100 columns when the guide has no explicit limit.
|
|
135
|
+
- Prefer `namespace`, `open`, and local names/abbreviations over identifiers with three or more
|
|
136
|
+
namespace dots.
|
|
137
|
+
|
|
138
|
+
For proof-attempt mode:
|
|
139
|
+
- Follow the inlined target repository style guide for every inserted line.
|
|
140
|
+
- Do not edit a theorem name or statement unless the user explicitly requested that semantic
|
|
141
|
+
surface. An authorized statement edit must pass the full style gate, not a legacy baseline
|
|
142
|
+
exemption.
|
|
122
143
|
|
|
123
144
|
For map-code and plan modes:
|
|
124
145
|
- Overwrite existing CODEMAP.md or PLAN.md (these are regenerated, not appended)
|
|
@@ -164,6 +185,7 @@ On failure:
|
|
|
164
185
|
- [ ] Mode-specific output produced matching expected format
|
|
165
186
|
- [ ] For proof-attempt: one sorry targeted at a time, small tactic blocks
|
|
166
187
|
- [ ] For spec-generation: sorry placeholder included, correct Lean types
|
|
188
|
+
- [ ] Target repository style guide followed; no new long-line or deep-qualification violation
|
|
167
189
|
- [ ] For map-code/plan: complete structured document generated
|
|
168
190
|
- [ ] Result returned with ## EXECUTION COMPLETE or ## NEEDS INPUT header
|
|
169
191
|
- [ ] No @-references used (all context is inlined by parent)
|
package/agents/fvs-researcher.md
CHANGED
|
@@ -58,7 +58,9 @@ Your parent command provides a `<research_mode>` tag specifying what kind of res
|
|
|
58
58
|
4. Check for existing stubs in .formalising/stubs/ for the target function
|
|
59
59
|
5. Search for similar verified specs in the Specs/ directory to use as pattern examples
|
|
60
60
|
6. Read dependency specs -- any functions called by the target that already have specs
|
|
61
|
-
7.
|
|
61
|
+
7. Read the inlined target repository style guide and identify its naming, namespace, line-length,
|
|
62
|
+
comment, and layout rules. Prefer repository examples that comply with that guide.
|
|
63
|
+
8. Analyze the function for:
|
|
62
64
|
- Control flow (branches, loops, error paths)
|
|
63
65
|
- Arithmetic operations and overflow potential
|
|
64
66
|
- Type dependencies
|
|
@@ -76,7 +78,9 @@ Your parent command provides a `<research_mode>` tag specifying what kind of res
|
|
|
76
78
|
4. Gather tactic examples from similar proofs in the project
|
|
77
79
|
5. Read dependency specs that may provide useful @[step] lemmas
|
|
78
80
|
6. If user feedback is provided (error messages, goal state), incorporate it
|
|
79
|
-
7.
|
|
81
|
+
7. Apply the inlined target repository style guide when recommending tactic shapes or any
|
|
82
|
+
explicitly requested theorem-statement edit.
|
|
83
|
+
8. Return structured findings with:
|
|
80
84
|
- Current proof state (which sorry is targeted)
|
|
81
85
|
- Available lemmas and tactics
|
|
82
86
|
- Recommended proof strategy
|
package/bin/install.js
CHANGED
|
@@ -2909,6 +2909,32 @@ function install(isGlobal, runtime = 'claude') {
|
|
|
2909
2909
|
failures.push('fv-skills');
|
|
2910
2910
|
}
|
|
2911
2911
|
|
|
2912
|
+
// The Aeneas sync command cannot operate without its mapping metadata. A
|
|
2913
|
+
// recursive directory copy can otherwise look successful even when a
|
|
2914
|
+
// packaging omission drops this single non-Markdown file, so verify both
|
|
2915
|
+
// presence and the minimum schema explicitly (#29).
|
|
2916
|
+
const syncMetaDest = path.join(skillDest, 'upstream', 'aeneas', '_sync-meta.json');
|
|
2917
|
+
if (!verifyFileInstalled(syncMetaDest, 'Aeneas sync metadata')) {
|
|
2918
|
+
failures.push('fv-skills/upstream/aeneas/_sync-meta.json');
|
|
2919
|
+
} else {
|
|
2920
|
+
try {
|
|
2921
|
+
const syncMeta = JSON.parse(fs.readFileSync(syncMetaDest, 'utf8'));
|
|
2922
|
+
if (
|
|
2923
|
+
typeof syncMeta.upstream_source !== 'string' ||
|
|
2924
|
+
!Array.isArray(syncMeta.mapping) ||
|
|
2925
|
+
syncMeta.mapping.length === 0 ||
|
|
2926
|
+
!syncMeta.tactic_renames ||
|
|
2927
|
+
typeof syncMeta.tactic_renames !== 'object'
|
|
2928
|
+
) {
|
|
2929
|
+
throw new Error('missing upstream_source, mapping entries, or tactic_renames');
|
|
2930
|
+
}
|
|
2931
|
+
console.log(` ${green}✓${reset} Verified Aeneas sync metadata`);
|
|
2932
|
+
} catch (e) {
|
|
2933
|
+
console.error(` ${yellow}✗${reset} Invalid Aeneas sync metadata: ${e.message}`);
|
|
2934
|
+
failures.push('fv-skills/upstream/aeneas/_sync-meta.json (invalid)');
|
|
2935
|
+
}
|
|
2936
|
+
}
|
|
2937
|
+
|
|
2912
2938
|
// Copy agents to agents directory
|
|
2913
2939
|
const agentsSrc = path.join(src, 'agents');
|
|
2914
2940
|
if (fs.existsSync(agentsSrc)) {
|
|
@@ -50,8 +50,8 @@ NEVER `eval` a path.
|
|
|
50
50
|
```bash
|
|
51
51
|
TOPIC_RAW="$1"
|
|
52
52
|
case "$TOPIC_RAW" in
|
|
53
|
-
*[';|&$`()<>'*]* ) echo "FVS >> ERROR: topic contains shell metacharacters" >&2; exit 1 ;;
|
|
54
53
|
*..*|*/* ) echo "FVS >> ERROR: topic contains '..' or '/' (path traversal); refusing" >&2; exit 1 ;;
|
|
54
|
+
*[![:alnum:]_[:space:]-]* ) echo "FVS >> ERROR: topic contains unsupported characters" >&2; exit 1 ;;
|
|
55
55
|
esac
|
|
56
56
|
SLUG=$(printf '%s' "$TOPIC_RAW" | tr -s '[:space:]' '-')
|
|
57
57
|
ROOT=".formalising/fv-plans/$SLUG"
|
|
@@ -93,7 +93,7 @@ EXITS -- there is NO live cross-process bridge. The helper is EFFORT-ONLY: it pa
|
|
|
93
93
|
|
|
94
94
|
```bash
|
|
95
95
|
# --codex mode: swap the in-runtime thinker for the FVS-owned Codex thinker (eval stage).
|
|
96
|
-
node scripts/fvs-codex-think.mjs eval --topic "$ROOT" --effort xhigh
|
|
96
|
+
node ~/.claude/scripts/fvs-codex-think.mjs eval --topic "$ROOT" --effort xhigh
|
|
97
97
|
```
|
|
98
98
|
|
|
99
99
|
If `--codex` is passed but `codex` is unavailable, the helper surfaces its graceful install message
|
|
@@ -133,7 +133,8 @@ Review: reviews/EVAL_{ITER}.md
|
|
|
133
133
|
|
|
134
134
|
<codex_skill_adapter>
|
|
135
135
|
The `--codex` flag swaps the thinker for a Codex thinker at THIS eval stage via the FVS-owned helper
|
|
136
|
-
|
|
136
|
+
`~/.claude/scripts/fvs-codex-think.mjs`
|
|
137
|
+
(`node ~/.claude/scripts/fvs-codex-think.mjs eval --topic "$ROOT" --effort xhigh`).
|
|
137
138
|
The helper is FVS-owned and self-contained: it does NOT import or depend on the openai-codex plugin;
|
|
138
139
|
it spawns `codex` via an argv array (never a shell string), is EFFORT-ONLY (passes `--effort xhigh`,
|
|
139
140
|
NO `--model`), and points Codex at the topic folder as its working root. Coordination is
|
|
@@ -59,8 +59,8 @@ while [ $# -gt 0 ]; do
|
|
|
59
59
|
esac
|
|
60
60
|
done
|
|
61
61
|
case "$TOPIC_RAW" in
|
|
62
|
-
*[';|&$`()<>'*]* ) echo "FVS >> ERROR: topic contains shell metacharacters" >&2; exit 1 ;;
|
|
63
62
|
*..*|*/* ) echo "FVS >> ERROR: topic contains '..' or '/' (path traversal); refusing" >&2; exit 1 ;;
|
|
63
|
+
*[![:alnum:]_[:space:]-]* ) echo "FVS >> ERROR: topic contains unsupported characters" >&2; exit 1 ;;
|
|
64
64
|
esac
|
|
65
65
|
case "$ITER" in
|
|
66
66
|
n[0-9]* ) : ;;
|
|
@@ -68,7 +68,7 @@ case "$ITER" in
|
|
|
68
68
|
esac
|
|
69
69
|
for FLAGVAL in "$EXEC_MODEL" "$EXEC_EFFORT"; do
|
|
70
70
|
case "$FLAGVAL" in
|
|
71
|
-
*[
|
|
71
|
+
*[![:alnum:]_.:/+-]* ) echo "FVS >> ERROR: --model/--effort contains unsupported characters" >&2; exit 1 ;;
|
|
72
72
|
esac
|
|
73
73
|
done
|
|
74
74
|
SLUG=$(printf '%s' "$TOPIC_RAW" | tr -s '[:space:]' '-')
|
|
@@ -17,7 +17,8 @@ Convert the latest adversarial eval's findings into the next bounded follow-up p
|
|
|
17
17
|
high-effort `fvs-crypto-thinker` (followup mode) re-derives the follow-up from the eval; this
|
|
18
18
|
command body persists the returned plan under `plans/`.
|
|
19
19
|
|
|
20
|
-
This command is the FOLLOWUP stage of the
|
|
20
|
+
This command is the FOLLOWUP stage of the loop. Every follow-up is independently reviewed before it
|
|
21
|
+
is handed back to the executor.
|
|
21
22
|
When the prior eval decided `HUMAN_RULING`, this command MUST HALT and ask the user for the modeling
|
|
22
23
|
decision -- it NEVER fabricates a follow-up that silently picks one side of a modeling ruling.
|
|
23
24
|
|
|
@@ -51,8 +52,8 @@ shell metacharacters, QUOTE every path expansion, NEVER `eval` a path.
|
|
|
51
52
|
```bash
|
|
52
53
|
TOPIC_RAW="$1"
|
|
53
54
|
case "$TOPIC_RAW" in
|
|
54
|
-
*[';|&$`()<>'*]* ) echo "FVS >> ERROR: topic contains shell metacharacters" >&2; exit 1 ;;
|
|
55
55
|
*..*|*/* ) echo "FVS >> ERROR: topic contains '..' or '/' (path traversal); refusing" >&2; exit 1 ;;
|
|
56
|
+
*[![:alnum:]_[:space:]-]* ) echo "FVS >> ERROR: topic contains unsupported characters" >&2; exit 1 ;;
|
|
56
57
|
esac
|
|
57
58
|
SLUG=$(printf '%s' "$TOPIC_RAW" | tr -s '[:space:]' '-')
|
|
58
59
|
ROOT=".formalising/fv-plans/$SLUG"
|
|
@@ -133,7 +134,7 @@ EFFORT-ONLY: it passes `--effort xhigh` (>= xhigh enforced) and NO `--model`.
|
|
|
133
134
|
|
|
134
135
|
```bash
|
|
135
136
|
# --codex mode: swap the in-runtime thinker for the FVS-owned Codex thinker (followup stage).
|
|
136
|
-
node scripts/fvs-codex-think.mjs followup --topic "$ROOT" --effort xhigh
|
|
137
|
+
node ~/.claude/scripts/fvs-codex-think.mjs followup --topic "$ROOT" --effort xhigh
|
|
137
138
|
```
|
|
138
139
|
|
|
139
140
|
If `--codex` is passed but `codex` is unavailable, the helper surfaces its graceful install message
|
|
@@ -147,6 +148,15 @@ statements that must not change, allowed-`sorry` policy, stop conditions, the ve
|
|
|
147
148
|
`nice -n 19 lake build` under the `set -o pipefail` / `${PIPESTATUS` guard, expected artifact
|
|
148
149
|
updates).
|
|
149
150
|
|
|
151
|
+
The artifact MUST also record:
|
|
152
|
+
|
|
153
|
+
```
|
|
154
|
+
Authoring runtime: {Claude Code | OpenCode | Gemini | Codex | Codex CLI}
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
Use `Codex CLI` for `--codex`; otherwise name the actual host runtime. This provenance is mandatory
|
|
158
|
+
for `/fvs:crypto-review` to prove the reviewer is independent.
|
|
159
|
+
|
|
150
160
|
## Step 5: Run-end banner + next command
|
|
151
161
|
|
|
152
162
|
```
|
|
@@ -157,15 +167,15 @@ Decision: {FOLLOWUP | HUMAN_RULING -> ruled}
|
|
|
157
167
|
Plan: plans/FOLLOWUP_PLAN_n{N}.md
|
|
158
168
|
|
|
159
169
|
>> Next Up
|
|
160
|
-
/fvs:crypto-
|
|
170
|
+
/fvs:crypto-review <topic> n{N} --target followup
|
|
161
171
|
```
|
|
162
172
|
|
|
163
173
|
</process>
|
|
164
174
|
|
|
165
175
|
<codex_skill_adapter>
|
|
166
176
|
The `--codex` flag swaps the thinker for a Codex thinker at THIS followup stage via the FVS-owned
|
|
167
|
-
helper
|
|
168
|
-
(`node scripts/fvs-codex-think.mjs followup --topic "$ROOT" --effort xhigh`). The helper is FVS-owned
|
|
177
|
+
helper `~/.claude/scripts/fvs-codex-think.mjs`
|
|
178
|
+
(`node ~/.claude/scripts/fvs-codex-think.mjs followup --topic "$ROOT" --effort xhigh`). The helper is FVS-owned
|
|
169
179
|
and self-contained: it does NOT import or depend on the openai-codex plugin; it spawns `codex` via an
|
|
170
180
|
argv array (never a shell string), is EFFORT-ONLY (passes `--effort xhigh`, NO `--model`), and points
|
|
171
181
|
Codex at the topic folder as its working root. Coordination is ARTIFACT-MEDIATED: the Codex thinker
|
|
@@ -183,5 +193,7 @@ unchanged.
|
|
|
183
193
|
- [ ] Latest `EVAL_nN.md` read; decision routed (`ACCEPT` stop / `BLOCKED` pause / `FOLLOWUP` author / `HUMAN_RULING` HALT).
|
|
184
194
|
- [ ] On `HUMAN_RULING` the command HALTs and asks the user -- it NEVER fabricates a follow-up plan.
|
|
185
195
|
- [ ] On `FOLLOWUP` the thinker is dispatched (`subagent_type="fvs-crypto-thinker"`) and the bounded follow-up plan written to `plans/`.
|
|
196
|
+
- [ ] The follow-up records truthful `Authoring runtime:` provenance and routes next to
|
|
197
|
+
`/fvs:crypto-review --target followup`.
|
|
186
198
|
- [ ] No bare `lake build`, no `gh` open/create, no generated-Lean write.
|
|
187
199
|
</success_criteria>
|
|
@@ -17,7 +17,8 @@ executor plan. The high-effort `fvs-crypto-thinker` re-derives the plan from the
|
|
|
17
17
|
the paper-grounded KB sources; this command body persists the returned plan under
|
|
18
18
|
`.formalising/fv-plans/<topic>/{plans,reviews,sources,merge}`.
|
|
19
19
|
|
|
20
|
-
This command is the PLAN stage of the
|
|
20
|
+
This command is the PLAN stage of the loop
|
|
21
|
+
(plan -> independent review -> execute -> eval -> followup -> independent review).
|
|
21
22
|
The plan it produces is RUNTIME-NEUTRAL: it must be executable by any runtime's executor with no
|
|
22
23
|
thinker in the loop. The loop is restartable from its own on-disk records.
|
|
23
24
|
|
|
@@ -54,8 +55,8 @@ and friends), QUOTE every path expansion, and NEVER `eval` a path.
|
|
|
54
55
|
TOPIC_RAW="$1"
|
|
55
56
|
# reject shell metacharacters before the slug ever touches a path
|
|
56
57
|
case "$TOPIC_RAW" in
|
|
57
|
-
*[';|&$`()<>'*]* ) echo "FVS >> ERROR: topic contains shell metacharacters" >&2; exit 1 ;;
|
|
58
58
|
*..*|*/* ) echo "FVS >> ERROR: topic contains '..' or '/' (path traversal); refusing" >&2; exit 1 ;;
|
|
59
|
+
*[![:alnum:]_[:space:]-]* ) echo "FVS >> ERROR: topic contains unsupported characters" >&2; exit 1 ;;
|
|
59
60
|
esac
|
|
60
61
|
SLUG=$(printf '%s' "$TOPIC_RAW" | tr -s '[:space:]' '-')
|
|
61
62
|
ROOT=".formalising/fv-plans/$SLUG"
|
|
@@ -64,7 +65,8 @@ mkdir -p "$ROOT/plans" "$ROOT/reviews" "$ROOT/sources" "$ROOT/merge"
|
|
|
64
65
|
|
|
65
66
|
The four subfolders split the loop's records by role (artifact contract):
|
|
66
67
|
- `plans/` -- `PLAN_nN.md` (high-level) + `EXEC_PLAN_nN.md` (bounded executor plan) + `FOLLOWUP_PLAN_nN.md`.
|
|
67
|
-
- `reviews/` -- `
|
|
68
|
+
- `reviews/` -- pre-execution `PLAN_REVIEW_nN.md` / `FOLLOWUP_REVIEW_nN.md`, plus
|
|
69
|
+
post-execution `EVAL_nN.md` (decides ACCEPT / FOLLOWUP / HUMAN_RULING / BLOCKED).
|
|
68
70
|
- `sources/` -- paper excerpts, theorem maps, advantage/probability normalization choices, and CACHED KB answers.
|
|
69
71
|
- `merge/` -- branch integration state: the conflict files, the conflict themes, and the next safe action when an accepted iteration lands back on the project branch.
|
|
70
72
|
|
|
@@ -148,7 +150,7 @@ EFFORT-ONLY: it passes `--effort xhigh` (>= xhigh enforced) and NO `--model`.
|
|
|
148
150
|
|
|
149
151
|
```bash
|
|
150
152
|
# --codex mode: swap the in-runtime thinker for the FVS-owned Codex thinker (plan stage).
|
|
151
|
-
node scripts/fvs-codex-think.mjs plan --topic "$ROOT" --effort xhigh
|
|
153
|
+
node ~/.claude/scripts/fvs-codex-think.mjs plan --topic "$ROOT" --effort xhigh
|
|
152
154
|
```
|
|
153
155
|
|
|
154
156
|
If `--codex` is passed but the `codex` CLI is unavailable, the helper surfaces its graceful
|
|
@@ -160,6 +162,16 @@ The thinker (in-runtime or Codex) authors the plan; THIS command body writes:
|
|
|
160
162
|
- `plans/PLAN_nN.md` -- the high-level plan.
|
|
161
163
|
- `plans/EXEC_PLAN_nN.md` -- the bounded executor plan.
|
|
162
164
|
|
|
165
|
+
Both artifacts MUST record a top-level metadata line:
|
|
166
|
+
|
|
167
|
+
```
|
|
168
|
+
Authoring runtime: {Claude Code | OpenCode | Gemini | Codex | Codex CLI}
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
Use `Codex CLI` when `--codex` authored the plan; otherwise name the actual host runtime. Never
|
|
172
|
+
write a generic or guessed marker. `/fvs:crypto-review` uses it to prevent Codex self-review and
|
|
173
|
+
fails closed when provenance is missing.
|
|
174
|
+
|
|
163
175
|
Carry the BOUNDED-PLAN CONTRACT verbatim into `EXEC_PLAN_nN.md`:
|
|
164
176
|
1. **Branch and current state** -- the branch name and what already compiles / is proven.
|
|
165
177
|
2. **Exact target files and theorems** -- precise files + named theorems/defs; no "etc.".
|
|
@@ -185,14 +197,15 @@ Plans: plans/PLAN_n{NEXT}.md, plans/EXEC_PLAN_n{NEXT}.md
|
|
|
185
197
|
Sources: {K} cached under sources/
|
|
186
198
|
|
|
187
199
|
>> Next Up
|
|
188
|
-
/fvs:crypto-
|
|
200
|
+
/fvs:crypto-review <topic> n{NEXT} --target plan
|
|
189
201
|
```
|
|
190
202
|
|
|
191
203
|
</process>
|
|
192
204
|
|
|
193
205
|
<codex_skill_adapter>
|
|
194
206
|
The `--codex` flag swaps the thinker for a Codex thinker at THIS stage via the FVS-owned helper
|
|
195
|
-
|
|
207
|
+
`~/.claude/scripts/fvs-codex-think.mjs`
|
|
208
|
+
(`node ~/.claude/scripts/fvs-codex-think.mjs plan --topic "$ROOT" --effort xhigh`).
|
|
196
209
|
The helper is FVS-owned and self-contained: it does NOT import or depend on the openai-codex plugin;
|
|
197
210
|
it spawns `codex` via an argv array (never a shell string), is EFFORT-ONLY (passes `--effort xhigh`,
|
|
198
211
|
NO `--model`), and points Codex at the topic folder as its working root. Coordination is
|
|
@@ -210,5 +223,7 @@ auto-picks a default, never writes an upstream artifact).
|
|
|
210
223
|
- [ ] `$THINKER_MODEL` resolved via the model-profiles sequence; the thinker dispatched (`subagent_type="fvs-crypto-thinker"`) with inlined context.
|
|
211
224
|
- [ ] KB grounded intensively when configured; cached under `sources/` and re-read before re-querying; loud-fail-once + labeled-degrade + `/fvs:kb-setup` when unconfigured.
|
|
212
225
|
- [ ] 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`.
|
|
226
|
+
- [ ] Both plan artifacts record truthful `Authoring runtime:` provenance; the next action is
|
|
227
|
+
independent `/fvs:crypto-review`, not direct execution.
|
|
213
228
|
- [ ] No bare `lake build`, no `gh` open/create, no generated-Lean write.
|
|
214
229
|
</success_criteria>
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: fvs:crypto-review
|
|
3
|
+
description: Send an initial or follow-up crypto plan to authenticated Codex for independent adversarial review
|
|
4
|
+
argument-hint: "<topic> [nN] [--target plan|followup]"
|
|
5
|
+
allowed-tools:
|
|
6
|
+
- Read
|
|
7
|
+
- Bash
|
|
8
|
+
- Glob
|
|
9
|
+
- Grep
|
|
10
|
+
- Write
|
|
11
|
+
- Edit
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
<objective>
|
|
15
|
+
Put an FVS crypto plan through an independent, pre-execution adversarial review by the Codex CLI.
|
|
16
|
+
Review either the initial `PLAN_nN.md` + `EXEC_PLAN_nN.md` pair or a
|
|
17
|
+
`FOLLOWUP_PLAN_nN.md`, persist exactly one reviewer artifact under `reviews/`, then have the
|
|
18
|
+
primary planning seat verify and triage every finding.
|
|
19
|
+
|
|
20
|
+
This is not the post-execution `/fvs:crypto-eval` stage. It attacks the PLAN before an executor
|
|
21
|
+
spends effort. Codex is the independent reviewer; it never authors or edits the plan.
|
|
22
|
+
</objective>
|
|
23
|
+
|
|
24
|
+
<execution_context>
|
|
25
|
+
@~/.claude/fv-skills/workflows/crypto-review.md
|
|
26
|
+
@~/.claude/fv-skills/references/crypto-plan-review.md
|
|
27
|
+
@~/.claude/fv-skills/references/ui-brand.md
|
|
28
|
+
</execution_context>
|
|
29
|
+
|
|
30
|
+
<context>
|
|
31
|
+
Topic and optional iteration/target: $ARGUMENTS.
|
|
32
|
+
|
|
33
|
+
Default target selection is `followup` when `FOLLOWUP_PLAN_nN.md` exists, otherwise `plan`.
|
|
34
|
+
The optional `--target` makes that choice explicit.
|
|
35
|
+
</context>
|
|
36
|
+
|
|
37
|
+
<process>
|
|
38
|
+
|
|
39
|
+
## Step 0: Preflight Codex installation and authentication
|
|
40
|
+
|
|
41
|
+
Before reading plan contents or doing any later work, verify that the Codex CLI is installed and
|
|
42
|
+
signed in:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
command -v codex >/dev/null 2>&1 \
|
|
46
|
+
&& codex login status >/dev/null 2>&1 \
|
|
47
|
+
&& echo "CODEX_OK" \
|
|
48
|
+
|| echo "CODEX_NOT_READY"
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
If the result is `CODEX_NOT_READY`, STOP:
|
|
52
|
+
|
|
53
|
+
```
|
|
54
|
+
FVS >> CODEX ISN'T READY
|
|
55
|
+
|
|
56
|
+
This review needs the OpenAI Codex CLI installed and signed in.
|
|
57
|
+
1. Install: npm install -g @openai/codex
|
|
58
|
+
2. Sign in: codex login
|
|
59
|
+
3. Verify: codex login status
|
|
60
|
+
|
|
61
|
+
Then re-run /fvs:crypto-review. There is no silent same-runtime fallback because that would not be
|
|
62
|
+
an independent review.
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Step 1: Resolve topic, iteration, and target safely
|
|
66
|
+
|
|
67
|
+
Treat all arguments as untrusted. Collapse topic whitespace to `-`, preserve meaningful
|
|
68
|
+
capitalization, reject shell metacharacters, `..`, and `/`, quote every path, and never `eval`.
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
TOPIC_RAW="$1"
|
|
72
|
+
case "$TOPIC_RAW" in
|
|
73
|
+
*..*|*/* ) echo "FVS >> ERROR: topic contains '..' or '/' (path traversal); refusing" >&2; exit 1 ;;
|
|
74
|
+
*[![:alnum:]_[:space:]-]* ) echo "FVS >> ERROR: topic contains unsupported characters" >&2; exit 1 ;;
|
|
75
|
+
esac
|
|
76
|
+
SLUG=$(printf '%s' "$TOPIC_RAW" | tr -s '[:space:]' '-')
|
|
77
|
+
ROOT=".formalising/fv-plans/$SLUG"
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
Require an existing topic directory. Resolve `nN` from the explicit argument or the highest numeric
|
|
81
|
+
plan/follow-up iteration; never use lexical ordering. Validate the iteration against
|
|
82
|
+
`^n[1-9][0-9]*$`.
|
|
83
|
+
|
|
84
|
+
Resolve the target:
|
|
85
|
+
|
|
86
|
+
- `plan`: require both `plans/PLAN_nN.md` and `plans/EXEC_PLAN_nN.md`; output
|
|
87
|
+
`reviews/PLAN_REVIEW_nN.md`.
|
|
88
|
+
- `followup`: require `plans/FOLLOWUP_PLAN_nN.md`; also expose the matching eval and original plan
|
|
89
|
+
when present; output `reviews/FOLLOWUP_REVIEW_nN.md`.
|
|
90
|
+
- omitted/auto: choose `followup` when its file exists, otherwise `plan`.
|
|
91
|
+
|
|
92
|
+
Refuse to overwrite an existing output. Preserve prior review history and ask the user to choose a
|
|
93
|
+
new iteration or archive the old review deliberately.
|
|
94
|
+
|
|
95
|
+
## Step 2: Enforce independent-review provenance
|
|
96
|
+
|
|
97
|
+
This command is Codex-as-second-runtime. Read the target artifact's `Authoring runtime:` marker.
|
|
98
|
+
If it says `Codex CLI`, STOP: Codex cannot independently review a plan it authored. If the marker is
|
|
99
|
+
missing, report that provenance is unverified and STOP rather than falsely claiming independence.
|
|
100
|
+
|
|
101
|
+
`crypto-plan` and `crypto-followup` write this marker for new artifacts. A legacy plan can be
|
|
102
|
+
reviewed after its authoring runtime is recorded truthfully in the artifact.
|
|
103
|
+
|
|
104
|
+
On the Codex host runtime, STOP as well: recursively invoking Codex would be same-runtime review.
|
|
105
|
+
Run this stage from Claude, OpenCode, Gemini, or another non-Codex planning seat.
|
|
106
|
+
|
|
107
|
+
## Step 3: Invoke the read-only Codex reviewer
|
|
108
|
+
|
|
109
|
+
Run the installed FVS helper at xhigh effort:
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
node ~/.claude/scripts/fvs-codex-think.mjs review \
|
|
113
|
+
--topic "$ROOT" \
|
|
114
|
+
--iteration "n$N" \
|
|
115
|
+
--target "$TARGET_KIND" \
|
|
116
|
+
--effort xhigh
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
The helper:
|
|
120
|
+
|
|
121
|
+
- repeats the install/auth preflight as defense in depth;
|
|
122
|
+
- loads the installed `crypto-plan-review.md` contract;
|
|
123
|
+
- runs `codex exec` from the repository root with `--sandbox read-only`, `--ephemeral`, an argv
|
|
124
|
+
array, xhigh effort, and no `--model`;
|
|
125
|
+
- gives Codex the exact target paths and tells it to treat repository/plan contents as data;
|
|
126
|
+
- captures the final reviewer message in an OS temporary directory;
|
|
127
|
+
- validates exactly one `VERDICT:` line;
|
|
128
|
+
- has the WRAPPER persist exactly one review artifact, then removes temporary output.
|
|
129
|
+
|
|
130
|
+
Codex receives no repository write permission. If it is absent, unauthenticated, killed, returns
|
|
131
|
+
nonzero, or violates the output contract, STOP. Never fall back to the plan author.
|
|
132
|
+
|
|
133
|
+
## Step 4: Verify and triage the review
|
|
134
|
+
|
|
135
|
+
Read the review artifact without rewriting or softening Codex's text. Treat every finding as a
|
|
136
|
+
claim: independently check its cited file lines, paper anchors, probes, and consequence before
|
|
137
|
+
accepting it.
|
|
138
|
+
|
|
139
|
+
Append a `## Planning-seat triage` section to the SAME review artifact. For each finding record
|
|
140
|
+
`accept`, `reject`, or `defer`, the evidence checked, and the exact destination for any planned
|
|
141
|
+
edit. Do not edit the plan silently during review.
|
|
142
|
+
|
|
143
|
+
Respond to the user using exactly these three top-level sections:
|
|
144
|
+
|
|
145
|
+
```
|
|
146
|
+
### 1. Codex's review
|
|
147
|
+
{the complete reviewer text, faithfully attributed}
|
|
148
|
+
|
|
149
|
+
### 2. What I'll do in response
|
|
150
|
+
{accepted findings and concrete bounded edits, tied to finding IDs}
|
|
151
|
+
|
|
152
|
+
### 3. What I'll deliberately NOT do
|
|
153
|
+
{rejected/deferred findings and retained assumptions, each with one-line evidence-based reason}
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
Routing:
|
|
157
|
+
|
|
158
|
+
- `APPROVE`: the plan may proceed to `/fvs:crypto-execute`.
|
|
159
|
+
- `APPROVE-WITH-EDITS`: STOP before execution; revise the named plan sections and run a fresh
|
|
160
|
+
independently recorded review.
|
|
161
|
+
- `REJECT`: STOP before execution; return to `/fvs:crypto-plan` or `/fvs:crypto-followup`.
|
|
162
|
+
|
|
163
|
+
</process>
|
|
164
|
+
|
|
165
|
+
<codex_skill_adapter>
|
|
166
|
+
This command itself is a cross-runtime bridge to the Codex CLI; it does not dispatch a Codex
|
|
167
|
+
subagent. On the Codex host runtime it fails closed because Codex reviewing Codex is not independent.
|
|
168
|
+
All coordination is artifact-mediated. Interactive ambiguity degrades to a plain-text question and
|
|
169
|
+
waits; it never guesses provenance, iteration, or overwrite intent.
|
|
170
|
+
</codex_skill_adapter>
|
|
171
|
+
|
|
172
|
+
<success_criteria>
|
|
173
|
+
- [ ] Codex install + login preflight ran before plan review work; no silent fallback.
|
|
174
|
+
- [ ] Topic/iteration/target resolved safely; path traversal and overwrite refused.
|
|
175
|
+
- [ ] Initial plans and follow-up plans are both supported.
|
|
176
|
+
- [ ] Codex-authored or unknown-provenance plans are not mislabeled as independently reviewed.
|
|
177
|
+
- [ ] Reviewer ran xhigh, effort-only, ephemeral, and read-only from the repo root.
|
|
178
|
+
- [ ] Wrapper persisted exactly one well-formed review with one allowed verdict.
|
|
179
|
+
- [ ] Planning seat re-verified and triaged findings without softening Codex's review.
|
|
180
|
+
- [ ] Non-APPROVE verdicts stop before execution.
|
|
181
|
+
</success_criteria>
|
|
@@ -5,7 +5,7 @@ argument-hint: ""
|
|
|
5
5
|
allowed-tools:
|
|
6
6
|
- Read
|
|
7
7
|
- Skill
|
|
8
|
-
requires: [lean-formalise, lean-refactor, crypto-plan, crypto-execute, crypto-eval, crypto-followup]
|
|
8
|
+
requires: [lean-formalise, lean-refactor, crypto-plan, crypto-review, crypto-execute, crypto-eval, crypto-followup]
|
|
9
9
|
---
|
|
10
10
|
|
|
11
11
|
Route to the appropriate paper-formalisation skill based on the user's intent.
|
|
@@ -17,10 +17,14 @@ When invoked WITH a request, match it against the table below and invoke the mat
|
|
|
17
17
|
| Formalise a paper/topic into Lean (one-shot) | fvs:lean-formalise |
|
|
18
18
|
| Refactor / simplify / decompose a proof | fvs:lean-refactor |
|
|
19
19
|
| Start/plan a topic-based crypto formalisation iteration | fvs:crypto-plan |
|
|
20
|
+
| Independently review an initial or follow-up crypto plan | fvs:crypto-review |
|
|
20
21
|
| Run the current iteration's plan | fvs:crypto-execute |
|
|
21
22
|
| Adversarially evaluate the iteration | fvs:crypto-eval |
|
|
22
23
|
| Write a follow-up plan from eval findings | fvs:crypto-followup |
|
|
23
24
|
|
|
24
|
-
The
|
|
25
|
+
The crypto iteration loop is
|
|
26
|
+
plan -> independent review -> execute -> eval -> follow-up -> independent review -> repeat,
|
|
27
|
+
restartable from records under `fv-plans/<topic>/`. `lean-formalise` stays the one-shot paper-track
|
|
28
|
+
command; the loop sits beside it for topic-based, multi-iteration crypto work.
|
|
25
29
|
|
|
26
30
|
Invoke the matched skill directly using the Skill tool.
|