fv-skills-baif 2.3.2 → 2.3.4

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.
Files changed (78) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/README.md +27 -7
  3. package/agents/fvs-crypto-thinker.md +27 -18
  4. package/bin/install.js +64 -35
  5. package/commands/fvs/aeneas-extract.md +21 -23
  6. package/commands/fvs/configure.md +159 -0
  7. package/commands/fvs/crypto-eval.md +52 -28
  8. package/commands/fvs/crypto-execute.md +14 -28
  9. package/commands/fvs/crypto-followup.md +21 -13
  10. package/commands/fvs/crypto-plan.md +26 -16
  11. package/commands/fvs/crypto-review.md +44 -23
  12. package/commands/fvs/fc-plan.md +10 -5
  13. package/commands/fvs/help.md +23 -12
  14. package/commands/fvs/lean-formalise.md +10 -15
  15. package/commands/fvs/lean-refactor.md +10 -15
  16. package/commands/fvs/lean-spec-review.md +26 -5
  17. package/commands/fvs/lean-specify.md +10 -15
  18. package/commands/fvs/lean-verify.md +10 -15
  19. package/commands/fvs/manage.md +3 -2
  20. package/commands/fvs/map-code.md +10 -19
  21. package/commands/fvs/natural-language.md +12 -2
  22. package/commands/fvs/reapply-patches.md +28 -21
  23. package/commands/fvs/sync-aeneas-verif.md +12 -13
  24. package/commands/fvs/trust-audit.md +11 -6
  25. package/fv-skills/VERSION +1 -1
  26. package/fv-skills/references/crypto-plan-review.md +10 -3
  27. package/fv-skills/references/fc-spec-review.md +4 -2
  28. package/fv-skills/references/model-profiles.md +252 -169
  29. package/fv-skills/references/review-diagnostics.md +10 -8
  30. package/fv-skills/templates/config.json +28 -4
  31. package/fv-skills/workflows/aeneas-extract.md +13 -5
  32. package/fv-skills/workflows/crypto-eval.md +34 -15
  33. package/fv-skills/workflows/crypto-execute.md +6 -3
  34. package/fv-skills/workflows/crypto-followup.md +4 -2
  35. package/fv-skills/workflows/crypto-plan.md +4 -2
  36. package/fv-skills/workflows/crypto-review.md +34 -14
  37. package/fv-skills/workflows/fc-plan.md +4 -5
  38. package/fv-skills/workflows/lean-formalise.md +4 -13
  39. package/fv-skills/workflows/lean-refactor.md +7 -13
  40. package/fv-skills/workflows/lean-spec-review.md +66 -42
  41. package/fv-skills/workflows/lean-specify.md +4 -13
  42. package/fv-skills/workflows/lean-verify.md +4 -13
  43. package/fv-skills/workflows/map-code.md +4 -14
  44. package/fv-skills/workflows/sync-aeneas-verif.md +8 -5
  45. package/fv-skills/workflows/trust-audit.md +13 -4
  46. package/package.json +11 -3
  47. package/pi/skills/fvs-aeneas/SKILL.md +23 -0
  48. package/pi/skills/fvs-aeneas-extract/SKILL.md +224 -0
  49. package/pi/skills/fvs-checkpoint/SKILL.md +154 -0
  50. package/pi/skills/fvs-configure/SKILL.md +160 -0
  51. package/pi/skills/fvs-context/SKILL.md +22 -0
  52. package/pi/skills/fvs-crypto-eval/SKILL.md +204 -0
  53. package/pi/skills/fvs-crypto-execute/SKILL.md +218 -0
  54. package/pi/skills/fvs-crypto-followup/SKILL.md +272 -0
  55. package/pi/skills/fvs-crypto-plan/SKILL.md +322 -0
  56. package/pi/skills/fvs-crypto-review/SKILL.md +162 -0
  57. package/pi/skills/fvs-fc/SKILL.md +31 -0
  58. package/pi/skills/fvs-fc-plan/SKILL.md +289 -0
  59. package/pi/skills/fvs-formalise/SKILL.md +37 -0
  60. package/pi/skills/fvs-help/SKILL.md +457 -0
  61. package/pi/skills/fvs-kb-setup/SKILL.md +322 -0
  62. package/pi/skills/fvs-lean-formalise/SKILL.md +397 -0
  63. package/pi/skills/fvs-lean-refactor/SKILL.md +293 -0
  64. package/pi/skills/fvs-lean-spec-review/SKILL.md +61 -0
  65. package/pi/skills/fvs-lean-specify/SKILL.md +424 -0
  66. package/pi/skills/fvs-lean-verify/SKILL.md +461 -0
  67. package/pi/skills/fvs-manage/SKILL.md +29 -0
  68. package/pi/skills/fvs-map-code/SKILL.md +349 -0
  69. package/pi/skills/fvs-natural-language/SKILL.md +220 -0
  70. package/pi/skills/fvs-pause-work/SKILL.md +154 -0
  71. package/pi/skills/fvs-reapply-patches/SKILL.md +27 -0
  72. package/pi/skills/fvs-resume-work/SKILL.md +96 -0
  73. package/pi/skills/fvs-sync-aeneas-verif/SKILL.md +235 -0
  74. package/pi/skills/fvs-trust-audit/SKILL.md +234 -0
  75. package/pi/skills/fvs-update/SKILL.md +24 -0
  76. package/scripts/build-plugin.cjs +128 -6
  77. package/scripts/fvs-codex-think.mjs +128 -54
  78. package/scripts/fvs-spec-review.mjs +135 -39
@@ -1,244 +1,327 @@
1
1
  <overview>
2
2
 
3
- Model profile system for FVS subagent dispatch. Controls which models are used for
4
- research vs execution subagents across the four main commands. Configuration is stored
5
- in `.formalising/fvs-config.json` per project.
3
+ FVS resolves subagent models and reasoning effort at dispatch time from
4
+ `.formalising/fvs-config.json`. Model IDs are runtime- and provider-owned. A model valid in Claude
5
+ Code may be nonsense in Codex, and a short name in Pi may be ambiguous across providers.
6
6
 
7
- Three profiles:
8
- - **quality** -- best results, highest cost. Default. Recommended for formal verification where correctness matters more than speed.
9
- - **balanced** -- good results, moderate cost. Suitable for iterative development cycles.
10
- - **budget** -- fastest, lowest cost. Suitable for exploration and mapping tasks.
7
+ `inherit` remains the only universal model fallback, but the `quality` profile is role-aware: it
8
+ selects a preferred model only after that runtime/provider reports a matching model in its current
9
+ catalog. FVS never sends a foreign, guessed, or unavailable model slug.
11
10
 
12
- Commands read the active profile at dispatch time and resolve the model for each
13
- subagent before calling Task(). The profile table below defines the mapping.
11
+ Use `/fvs:configure` (Pi: `/skill:fvs-configure`) for menu-driven editing, or edit the JSON directly.
14
12
 
15
13
  </overview>
16
14
 
17
- <quick_reference>
15
+ <profiles>
18
16
 
19
- ## Profile Table
17
+ ## Built-in profiles
20
18
 
21
- | Agent | quality | balanced | budget |
22
- |--------------------------|---------|----------|--------|
23
- | fvs-researcher | inherit | sonnet | haiku |
24
- | fvs-executor | inherit | sonnet | sonnet |
25
- | fvs-lean-refactorer | inherit | sonnet | sonnet |
26
- | fvs-explainer | inherit | sonnet | haiku |
27
- | fvs-dependency-analyzer | sonnet | haiku | haiku |
28
- | fvs-code-reader | sonnet | sonnet | haiku |
29
- | fvs-extract-classifier | inherit | sonnet | haiku |
30
- | fvs-extract-applier | inherit | sonnet | sonnet |
31
- | fvs-extract-bisector | inherit | sonnet | sonnet |
32
- | fvs-equivalence-assessor | inherit | sonnet | sonnet |
33
- | fvs-draft-investigator | inherit | sonnet | sonnet |
34
- | fvs-doc-syncer | inherit | sonnet | sonnet |
35
- | fvs-crypto-thinker | inherit | sonnet | sonnet |
36
- | fvs-axiom-auditor | inherit | sonnet | haiku |
19
+ | Profile | Model policy | Effort policy |
20
+ |---------|--------------|---------------|
21
+ | quality | detected runtime-native model by stage tier | authority `max`; work `xhigh`; scout `high` |
22
+ | balanced | `inherit` | `high` |
23
+ | budget | `inherit` | `medium` |
37
24
 
38
- Quality uses `inherit` (= parent model, typically Opus) for the agents that matter most:
39
- researcher, executor, and explainer. These handle spec generation, proof attempts, and
40
- NL explanation — tasks where reasoning quality directly impacts correctness.
25
+ Balanced and budget stay runtime-neutral. Only quality automatically selects a concrete model.
41
26
 
42
- ## Resolution
27
+ ## Canonical quality stage map
43
28
 
44
- `inherit` means the subagent uses the same model as the parent command. This avoids
45
- organization policy conflicts that can occur with explicit model name references. When
46
- a command dispatches with `model="inherit"`, the Task() system uses whatever model is
47
- currently running the parent.
29
+ Each dispatch declares one exact stage key. Shared agents do not determine the tier.
48
30
 
49
- For non-inherit values, the model name is passed directly to Task() as the `model`
50
- parameter.
31
+ | Tier | Stage keys | Intent |
32
+ |------|------------|--------|
33
+ | authority | `fc_plan`, `fc_spec`, `fc_proof_plan`, `crypto_plan`, `crypto_followup`, `spec_review`, `crypto_review` | Author or adversarially review specifications and plans |
34
+ | work | `fc_proof_execution`, `lean_refactor`, `crypto_execute`, `extract_apply`, `extract_bisect` | Execute plans, fill proofs, verify, refactor, or apply extraction changes |
35
+ | scout | `research`, `map_code`, `crypto_eval`, `trust_audit`, `extract_classify`, `extract_assess`, `extract_investigate`, `doc_sync`, `explain` | Retrieve, summarize, classify, evaluate, audit, or explain |
51
36
 
52
- ## Config File
37
+ This table is the sole stage/tier authority. Commands reference stage keys instead of copying the
38
+ table.
39
+
40
+ ## Canonical quality runtime preferences
41
+
42
+ These family names are matching preferences, not dispatch slugs. Resolve them to an exact ID or
43
+ stable alias present in the selected runtime/provider catalog.
44
+
45
+ | Runtime/provider | Authority | Work | Scout |
46
+ |------------------|-----------|------|-------|
47
+ | Claude Code | detected Fable + `max` | detected Opus + `xhigh` | detected Sonnet + `high` |
48
+ | Codex / OpenAI | detected Astra + `max` | detected Sol + `xhigh` | detected Terra + `high` |
49
+
50
+ Pi uses the row belonging to its active provider with exact provider-qualified IDs. Ordinary Pi
51
+ work never switches providers automatically. An Anthropic-backed Pi provider uses the Claude-family
52
+ row only when Pi reports a valid authenticated Anthropic model; an OpenAI/Codex-backed provider uses
53
+ the OpenAI row. OpenCode and Gemini receive no guessed family mapping: ask interactively or require
54
+ an exact stage override.
55
+
56
+ If the preferred quality model is absent, do not choose a lower family silently. Interactive runs
57
+ ask the user to select a detected model for this run, save an exact runtime+stage override, or
58
+ cancel. Noninteractive runs stop before dispatch and print the exact override key required.
59
+
60
+ Valid effort values are the exact values the selected runtime/model reports; common normalized
61
+ values are `none`, `minimal`, `low`, `medium`, `high`, `xhigh`, and `max`. If the selected model does
62
+ not support the requested effort, interactive runs show its supported values and offer one-run or
63
+ saved stage-scoped choices. Noninteractive runs stop with exact remediation. Never silently claim
64
+ the profile effort was applied.
65
+
66
+ </profiles>
67
+
68
+ <config>
69
+
70
+ ## Config file
53
71
 
54
72
  **Location:** `.formalising/fvs-config.json`
55
73
 
56
74
  ```json
57
75
  {
58
- "model_profile": "balanced",
76
+ "model_profile": "quality",
77
+ "stage_overrides": {
78
+ "claude": {},
79
+ "codex": {},
80
+ "pi": {},
81
+ "opencode": {},
82
+ "gemini": {}
83
+ },
59
84
  "model_overrides": {
60
- "fvs-crypto-thinker": "inherit"
85
+ "claude": {},
86
+ "codex": {},
87
+ "pi": {},
88
+ "opencode": {},
89
+ "gemini": {}
90
+ },
91
+ "effort_overrides": {
92
+ "claude": {},
93
+ "codex": {},
94
+ "pi": {},
95
+ "opencode": {},
96
+ "gemini": {}
97
+ },
98
+ "spec_review": {
99
+ "automatic": true,
100
+ "reviewer": null,
101
+ "model": null,
102
+ "effort": null
103
+ },
104
+ "crypto_review": {
105
+ "automatic": true,
106
+ "reviewer": null,
107
+ "model": null,
108
+ "effort": null
61
109
  }
62
110
  }
63
111
  ```
64
112
 
65
- The config file is optional. If it does not exist, commands default to the `quality`
66
- profile. The shipped template uses `balanced` for routine work but pins
67
- `fvs-crypto-thinker` to `inherit`: crypto planning, adversarial evaluation, and
68
- follow-up design must not silently fall to the balanced/budget profile's lower model.
69
- Both keys are top-level because that is the schema every command's dispatch resolver
70
- reads.
71
-
72
- ### Overriding Specific Agents
73
-
74
- Use `model_overrides` to change the model for a single agent without switching the
75
- entire profile:
113
+ A stage override is an object containing either or both fields:
76
114
 
77
115
  ```json
78
116
  {
79
- "model_profile": "balanced",
80
- "model_overrides": {
81
- "fvs-lean-prover": "inherit"
117
+ "stage_overrides": {
118
+ "codex": {
119
+ "crypto_review": {
120
+ "model": "<exact reviewer catalog ID>",
121
+ "effort": "<supported effort>"
122
+ },
123
+ "crypto_plan": {
124
+ "model": "<exact Codex catalog ID>",
125
+ "effort": "<supported effort>"
126
+ }
127
+ },
128
+ "pi": {
129
+ "fc_proof_execution": {
130
+ "model": "<active-provider>/<exact-model-id>",
131
+ "effort": "<supported effort>"
132
+ }
133
+ }
82
134
  }
83
135
  }
84
136
  ```
85
137
 
86
- This runs most agents at balanced tier but keeps the prover at inherit (parent model)
87
- for maximum proof quality.
138
+ Concrete IDs must belong to the containing runtime; Pi IDs are provider-qualified. Existing
139
+ `model_overrides[runtime][agent]` and `effort_overrides[runtime][agent]` remain supported as broader
140
+ compatibility overrides. Review values are scoped by their adjacent `reviewer` runtime. Explicit
141
+ one-run selections always win.
88
142
 
89
- ### Valid Override Values
143
+ Legacy flat overrides are safe only when their value is `inherit`. Ignore any other flat model value
144
+ with a migration warning; never guess which runtime it targeted.
90
145
 
91
- - `"inherit"` -- use parent model
92
- - `"sonnet"` -- Claude Sonnet
93
- - `"haiku"` -- Claude Haiku
146
+ </config>
94
147
 
95
- </quick_reference>
148
+ <resolution>
96
149
 
97
- <patterns>
150
+ ## Dispatch resolution
98
151
 
99
- ## Dispatch Pattern
152
+ For every distinct stage used by a command:
100
153
 
101
- Commands resolve the model for each subagent dispatch using this sequence:
154
+ 1. Identify the active runtime and provider from host/adapter identity. If unknown, ask.
155
+ 2. Read the complete config; malformed JSON is an error.
156
+ 3. Resolve `model_profile`, defaulting to `quality`; unknown profiles warn and use `quality`.
157
+ 4. Apply an explicit one-run flag or confirmed manifest adjustment.
158
+ 5. For `spec_review` or `crypto_review`, apply non-null saved review values.
159
+ 6. Apply `stage_overrides[runtime][stage]`.
160
+ 7. Apply compatibility `model_overrides[runtime][agent]` and
161
+ `effort_overrides[runtime][agent]` for still-unset fields.
162
+ 8. Apply the profile: quality resolves the stage tier and an exact detected model from the runtime
163
+ matrix; balanced/budget use `inherit`. Apply the tier/profile effort.
164
+ 9. Validate model and effort against the selected runtime/model. For ordinary Pi stages, also
165
+ validate that the candidate model's catalog provider equals Pi's active provider.
166
+ 10. Inspect the actual dispatch schema/capabilities. A requested model or effort is unresolved when
167
+ the runtime cannot apply it, even if the catalog advertises it.
168
+ 11. Build the command-level selection manifest from settings the dispatch can actually honor and
169
+ obtain the required confirmation before the first dispatch.
102
170
 
103
- 1. Read `.formalising/fvs-config.json` (or use defaults if file is missing)
104
- 2. Determine the active profile: `config.model_profile` or `"quality"` if unset
105
- 3. Check `config.model_overrides` for the target agent name
106
- 4. If no override, look up the profile table for the agent and profile
107
- 5. Pass the resolved model to the Task() call
171
+ Pseudo-code:
108
172
 
109
173
  ```
110
- // In command workflow:
174
+ runtime, provider = detect_runtime_provider_or_ask()
175
+ profile = valid_profile(config.model_profile) ? config.model_profile : "quality"
176
+ stage = required_stage_key(dispatch)
177
+
178
+ model, effort = explicit_one_run_selection(stage)
179
+ model, effort ??= saved_review_values(stage)
180
+ model, effort ??= config.stage_overrides[runtime][stage]
181
+ model ??= config.model_overrides[runtime][agent]
182
+ effort ??= config.effort_overrides[runtime][agent]
183
+
184
+ if profile == "quality":
185
+ tier = QUALITY_STAGE_TIER[stage]
186
+ model ??= exact_detected_match(runtime, provider, QUALITY_MODEL[runtime][tier])
187
+ effort ??= QUALITY_EFFORT[tier]
188
+ else:
189
+ model ??= "inherit"
190
+ effort ??= PROFILE_EFFORT[profile]
111
191
 
112
- // 1. Read config (graceful default)
113
- config = read .formalising/fvs-config.json
114
- if config missing:
115
- config = { model_profile: "quality", model_overrides: {} }
192
+ validate_runtime_model_effort_and_pi_provider(model, effort, stage)
193
+ validate_dispatch_capability_or_request_decision(model, effort, stage)
194
+ ```
116
195
 
117
- profile = config.model_profile || "quality"
196
+ Missing fields are resolved independently. A model override does not erase the tier effort, and an
197
+ effort override does not erase the tier model.
118
198
 
119
- // 2. Resolve model for target agent
120
- if agent_name in config.model_overrides:
121
- model = config.model_overrides[agent_name]
122
- else:
123
- model = PROFILE_TABLE[agent_name][profile]
124
-
125
- // 3. Dispatch subagent
126
- Task(
127
- subagent_type = agent_name,
128
- model = model,
129
- description = "...",
130
- prompt = "..."
131
- )
132
- ```
199
+ For ordinary Pi work (all stages except `spec_review` and `crypto_review`), compare the candidate's
200
+ provider metadata from Pi's live catalog with the active Pi provider. A persisted stage or agent
201
+ override from another provider is a capability exception, not permission to switch: ask for an
202
+ active-provider one-run/save choice interactively, and fail before dispatch noninteractively.
203
+ Provider-qualified string prefixes may be used only when the catalog exposes no separate provider
204
+ field. Reviews follow the explicit opposite-provider routing policy instead.
133
205
 
134
- ## Graceful Defaults
206
+ After catalog validation, inspect the real child-dispatch schema. Pass every resolved effort through
207
+ the runtime's supported effort field. If a runtime cannot set a per-child model (for example, a
208
+ Codex `spawn_agent` schema with no model field), the only directly runnable model selection is its
209
+ reported active/inherited model. Rebuild the manifest around that actual setting and ask explicitly,
210
+ or choose a capable external runner; fail before dispatch in noninteractive mode. Apply the same
211
+ rule when the dispatch cannot set the selected effort and its installed/runtime default differs.
212
+ Never confirm a requested value and then omit it or replace it with a warning.
135
213
 
136
- - **Config file missing:** Use `quality` profile. Do not create the file automatically.
137
- - **Unknown agent name:** Use `inherit`. New agents default to parent model.
138
- - **Invalid profile name:** Fall back to `quality` with a warning.
139
- - **Empty overrides:** Ignored. Equivalent to no overrides.
140
- - **Shipped crypto-thinker override:** Keep
141
- `model_overrides["fvs-crypto-thinker"] = "inherit"` unless the user explicitly
142
- chooses a different model. This takes precedence over all three profile rows.
214
+ ## Command-level confirmation manifest
143
215
 
144
- ## crypto-execute Model + Effort Knob
216
+ Interactive commands show one manifest before their first dispatch, grouping repeated uses of the
217
+ same stage. Each row records:
145
218
 
146
- `/fvs:crypto-execute` resolves the model + effort for `fvs-crypto-executor` ABOVE the profile table,
147
- at its own dispatch site (command Step 3) -- not from a `PROFILE_TABLE` row. The crypto executor is
148
- intentionally NOT pinned, so there is deliberately **no `fvs-crypto-executor` row and no `opus`
149
- value** in the table above. The resolution ladder is:
219
+ - stage key and tier;
220
+ - agent/reviewer and runtime/provider;
221
+ - exact model or `inherit`, plus whether it came from one-run input, review settings, stage override,
222
+ agent override, or profile/catalog matching;
223
+ - effort and its source;
224
+ - review runner/provenance when applicable.
150
225
 
151
- 1. A per-run `--model` / `--effort` flag on the command.
152
- 2. Else a top-level override `model_overrides["fvs-crypto-executor"]` in `.formalising/fvs-config.json`
153
- (read at the top-level `model_overrides` key this resolver consults, not the template's nested
154
- `model.model_profile`).
155
- 3. Else an interactive `AskUserQuestion` offering "inherit / default".
156
- 4. Else the default `inherit`.
226
+ Offer `Continue once`, `Adjust once`, `Save override`, and `Cancel`, while retaining the question
227
+ UI's notes/custom-answer path. `Save override` defaults to
228
+ `stage_overrides[runtime][stage]`; review stages save into their matching review object. Notes are
229
+ interpreted as requested selection/stage adjustments, then the manifest is rebuilt and must be
230
+ confirmed again. Notes never become unchecked model IDs or silently alter unrelated stages.
157
231
 
158
- The resolved value is an opaque, runtime-valid string passed straight to `Task(model=...)`; FVS keeps
159
- no cross-provider taxonomy. On Codex `model=` is ignored and per-agent effort is fixed at install
160
- time, so the per-run `--effort` flag is a Claude / OpenCode / Gemini nicety.
232
+ One confirmation covers the command, not every child. If later evidence introduces a new stage,
233
+ provider, model, or unsupported effort, rebuild and reconfirm the manifest.
161
234
 
162
- ## Two-Phase Dispatch
235
+ In noninteractive/autonomous mode, a complete valid explicit selection or persisted override may
236
+ run without a prompt and must be logged only when dispatch capability can honor it. Any unresolved
237
+ confirmation, absent preferred model, provider mismatch, unsupported effort, or unavailable
238
+ per-child control fails before dispatch with exact flags/config keys. Do not fall back silently.
163
239
 
164
- Each main command dispatches two subagents in sequence:
240
+ </resolution>
165
241
 
166
- ```
167
- /fvs:map-code
168
- -> Task(fvs-researcher, model=resolve("fvs-researcher"), research_mode="map-code")
169
- -> Task(fvs-executor, model=resolve("fvs-executor"), execution_mode="map-code")
242
+ <review_routing>
170
243
 
171
- /fvs:fc-plan
172
- -> Task(fvs-researcher, model=resolve("fvs-researcher"), research_mode="plan")
173
- -> Task(fvs-executor, model=resolve("fvs-executor"), execution_mode="plan")
244
+ ## Adversarial review routing
174
245
 
175
- /fvs:lean-specify
176
- -> Task(fvs-researcher, model=resolve("fvs-researcher"), research_mode="spec-generation")
177
- -> Task(fvs-executor, model=resolve("fvs-executor"), execution_mode="spec-generation")
246
+ Quality treats `spec_review` and `crypto_review` as authority stages. Detect the authoring runtime
247
+ and recommend an authenticated opposite provider/runtime, then confirm reviewer, model, effort, and
248
+ one-run skip:
178
249
 
179
- /fvs:lean-verify
180
- -> Task(fvs-researcher, model=resolve("fvs-researcher"), research_mode="proof-attempt")
181
- -> Task(fvs-executor, model=resolve("fvs-executor"), execution_mode="proof-attempt")
250
+ - OpenAI/Codex-authored artifact: prefer Claude Code CLI with detected Fable + `max`.
251
+ - Claude-authored artifact: from Pi prefer a fresh provider-qualified OpenAI Pi seat with detected
252
+ Astra + `max`, then Codex CLI; outside Pi prefer Codex CLI.
253
+ - Unknown/Other author: show the explicit reviewer menu without claiming independence.
182
254
 
183
- /fvs:lean-refactor
184
- -> Task(fvs-researcher, model=resolve("fvs-researcher"), research_mode="lean-refactor")
185
- -> Task(fvs-lean-refactorer, model=resolve("fvs-lean-refactorer"), refactor_mode="iterative")
186
- ```
255
+ Do not route a Claude Code subscription through Pi. Use Claude Code's own authenticated CLI unless
256
+ Pi independently reports a valid Anthropic provider credential. OpenAI review may use a fresh Pi
257
+ OpenAI seat or Codex CLI as described above.
187
258
 
188
- The researcher gathers context (read-only), the executor writes files based on findings.
259
+ Preflight the selected runner and authentication. A Pi reviewer additionally requires a fresh-child
260
+ facility that accepts the selected provider-qualified model and per-child effort and reports the
261
+ completed child's run ID, actual model, and actual effort for its hash-bound dispatch receipt. If
262
+ that capability is absent, Pi is unavailable; never infer receipt values from the request. If no
263
+ opposite runner is ready, ask among setup/retry, fresh same-runtime review, Other packet handoff,
264
+ one-run skip, or cancel. Never switch silently. Label same-runtime and unverified provenance
265
+ honestly.
189
266
 
190
- </patterns>
267
+ A one-run skip records exactly `Unreviewed (user skipped)` and stops at the review boundary. It never
268
+ auto-starts proof or crypto execution; the user may invoke execution explicitly afterward.
191
269
 
192
- <runtime_models>
270
+ Saved `spec_review` / `crypto_review` values and explicit flags override profile recommendations.
271
+ Null values keep profile routing and the confirmation menu active.
193
272
 
194
- ## Runtime-Specific Model Handling
273
+ </review_routing>
195
274
 
196
- Model selection works differently across runtimes. Commands should only use `Task(model=...)`
197
- on runtimes that support it.
275
+ <stable_rules>
198
276
 
199
- ### Claude Code
277
+ ## Stable fallback rules
200
278
 
201
- Supports inline model selection via `Task(model="...")`. The profile system works natively:
202
- - `"inherit"` — subagent uses the parent session's model (typically Opus)
203
- - `"sonnet"` — Claude Sonnet
204
- - `"haiku"` — Claude Haiku
279
+ - Missing config: profile `quality`; resolve detected stage defaults and require the interactive
280
+ command manifest confirmation. Do not create a file.
281
+ - Unknown stage: stop and fix the command; do not guess a tier.
282
+ - Empty/null override: ignore it.
283
+ - Foreign-runtime override: ignore it completely.
284
+ - Pi ordinary-stage override from a non-active provider: ask one-run/save/cancel interactively; fail
285
+ with remediation noninteractively. Never activate that provider implicitly.
286
+ - Unavailable model: ask one-run/save/cancel interactively; fail with remediation noninteractively.
287
+ - Unsupported effort: ask one-run/save/cancel interactively; fail with remediation noninteractively.
288
+ - Never guess a replacement slug, switch providers silently, or mutate config during a one-run
289
+ choice.
205
290
 
206
- ### Codex
291
+ </stable_rules>
207
292
 
208
- Does NOT support dynamic model selection. Models are pre-configured per agent in `.toml`
209
- files at install time. The `Task(model="...")` parameter is omitted when converting commands
210
- to Codex skills. Model choice is determined by the Codex configuration, not by FVS.
293
+ <runtime_notes>
211
294
 
212
- ### OpenCode / Gemini CLI
295
+ ## Runtime detection and adapters
213
296
 
214
- Similar to Claude Code — support inline model parameters with runtime-specific model name
215
- mappings. The same `Task(model="...")` pattern applies.
297
+ Prefer identity supplied by the host or adapter. Pi exposes `PI_CODING_AGENT=true` and
298
+ `AI_AGENT=pi`. Other adapters may expose `AI_AGENT`. If identity is unknown, ask instead of
299
+ inferring it from `.claude`, `.codex`, or `.pi` directories.
216
300
 
217
- ### Implication for Commands
301
+ Claude Code accepts only confirmed Claude aliases/IDs. Never send Astra, Sol, Terra, or Luna to it.
302
+ Codex accepts only exact IDs reported by its catalog. Never send Fable, Opus, Sonnet, or Haiku to
303
+ it. Codex agent TOMLs provide installation-time fallbacks, not proof that a stage selection was
304
+ applied. When `spawn_agent` lacks a per-child model or effort field, compare the selection with the
305
+ reported active model and installed/runtime effort; rebuild and reconfirm a truthful manifest or
306
+ fail before dispatch. Never omit a requested value and continue with only a warning.
218
307
 
219
- Commands should resolve the model from the profile table and pass it to `Task()`. On runtimes
220
- that don't support dynamic model selection (Codex), the parameter is silently ignored. This
221
- means the same command files work across all runtimes without conditional logic.
308
+ Pi uses exact provider/model IDs. When its subagent facility supports a thinking suffix, use
309
+ `provider/model:<effort>`; otherwise use its separate effort field. `inherit` omits model override.
310
+ OpenCode and Gemini use only exact IDs returned by their own catalogs.
222
311
 
223
- </runtime_models>
312
+ </runtime_notes>
224
313
 
225
314
  <anti_patterns>
226
315
 
227
- ## Anti-Patterns
228
-
229
- - **Hardcoding "opus" in profile table:** Use `inherit` instead. Organization policies may restrict model access. `inherit` defers to whatever the parent is running.
230
- - **Creating fvs-config.json automatically:** The file is user-created. Commands use defaults when it is missing.
231
- - **Ignoring overrides:** Always check `model_overrides` before the profile table. User overrides take precedence.
232
- - **Dispatching without resolution:** Never pass a profile name ("quality") as the model. Always resolve to a concrete model name or "inherit" first.
316
+ - A dispatch without an exact stage key.
317
+ - Choosing a tier from an agent name when that agent serves several stages.
318
+ - Sending a Claude alias to Codex or a Codex family name to Claude.
319
+ - Using a bare Pi nickname without its provider/model identity.
320
+ - Automatically dropping from Astra to Sol, Fable to Opus, or another family when the preferred
321
+ model is absent.
322
+ - Switching Pi providers without confirmation.
323
+ - Claiming unsupported effort was honored.
324
+ - Rewriting persisted config for a one-run adjustment.
325
+ - Launching before notes have produced a rebuilt, reconfirmed manifest.
233
326
 
234
327
  </anti_patterns>
235
-
236
- <summary>
237
-
238
- The model profile system gives users control over cost/quality tradeoffs across all FVS
239
- subagent dispatches. The quality profile (default) uses inherit for top-tier agents and
240
- sonnet for utility agents. The balanced and budget profiles progressively reduce model
241
- capability for cost savings. Per-agent overrides allow fine-grained control without
242
- switching the entire profile.
243
-
244
- </summary>
@@ -8,19 +8,21 @@ instruction budget: three probes, about 40 lines each, at most one correction ea
8
8
  Record exact code, commands, exit status and relevant output. Report uncertainty when
9
9
  the budget or available tools cannot answer the question. This is not a CPU quota.
10
10
 
11
- Keep prototypes disposable and in the permitted scratch directory. Preserve reviewed
12
- sources and plans. Do not implement planned definitions or proofs, perform extended
13
- proof search, or rewrite the plan. Scratch location does not authorize implementation.
11
+ Keep prototypes only in the permitted scratch directory, which the wrapper saves with the review
12
+ attempt. Preserve reviewed sources and plans. Do not implement planned definitions or proofs,
13
+ perform extended proof search, or rewrite the plan. Scratch location does not authorize
14
+ implementation.
14
15
  For Lean, prefer `#check`, `#print axioms`, and statement-only signature stubs;
15
16
  successful elaboration is not proof of the target claim.
16
17
 
17
18
  A necessary build of existing sources is separate from the probe budget. The Claude
18
19
  provider permits only explicitly listed generated Lake `.lake/build` and `.lake/config`
19
- outputs, including installed packages. Use bounded targets and the configured thread
20
- budget. Try `nice -n 19` where available; if priority adjustment is denied, report that
21
- and run the same bounded check without it. Other toolchains put outputs in scratch;
22
- report blocked checks if their required output paths are unavailable. Codex retains
23
- its native read-only sandbox: do not assume Lake cache writes are available there.
20
+ outputs, including installed packages. `LEAN_NUM_THREADS` defaults to 4 and must be a positive safe
21
+ integer; the wrapper rejects invalid or unsafe values before launching the reviewer. Use bounded targets and
22
+ that thread budget. Try `nice -n 19` where available; if priority adjustment is denied, report that
23
+ and run the same bounded check without it. Other toolchains put outputs in scratch; report blocked
24
+ checks if their required output paths are unavailable. Codex runs with its saved scratch directory
25
+ writable and the repository read-only; do not assume repository Lake cache writes are available.
24
26
 
25
27
  Sandbox initialization failure or redirected output paths stop the review. Select any
26
28
  alternative runtime/model explicitly. Do not bypass sandbox restrictions or fetch
@@ -13,15 +13,39 @@
13
13
  "aeneas_clone_path": null,
14
14
  "extract_workspace": ".formalising/extract"
15
15
  },
16
- "model_profile": "balanced",
16
+ "model_profile": "quality",
17
+ "stage_overrides": {
18
+ "claude": {},
19
+ "codex": {},
20
+ "pi": {},
21
+ "opencode": {},
22
+ "gemini": {}
23
+ },
17
24
  "model_overrides": {
18
- "fvs-crypto-thinker": "inherit"
25
+ "claude": {},
26
+ "codex": {},
27
+ "pi": {},
28
+ "opencode": {},
29
+ "gemini": {}
30
+ },
31
+ "effort_overrides": {
32
+ "claude": {},
33
+ "codex": {},
34
+ "pi": {},
35
+ "opencode": {},
36
+ "gemini": {}
19
37
  },
20
38
  "spec_review": {
21
- "automatic": true
39
+ "automatic": true,
40
+ "reviewer": null,
41
+ "model": null,
42
+ "effort": null
22
43
  },
23
44
  "crypto_review": {
24
- "automatic": true
45
+ "automatic": true,
46
+ "reviewer": null,
47
+ "model": null,
48
+ "effort": null
25
49
  },
26
50
  "behavior": {
27
51
  "mode": "interactive"
@@ -28,6 +28,14 @@ Hard invariants this workflow preserves:
28
28
 
29
29
  <process>
30
30
 
31
+ <step name="resolve_models">
32
+ Use the command's confirmed selection manifest from `model-profiles.md` with exact stage keys:
33
+ `extract_classify` for the classifier, `extract_apply` for the applier, `extract_bisect` for the
34
+ bisector, `extract_assess` for the independent assessor, and `extract_investigate` for the draft
35
+ investigator. If any stage needed by the chosen path is absent, rebuild and reconfirm the manifest
36
+ before dispatch. Never derive tiers from agent names or silently fall back.
37
+ </step>
38
+
31
39
  <step name="pre_flight">
32
40
  ## Step 1: PRE-FLIGHT -- target detection, clone resolution, pin audit
33
41
 
@@ -165,7 +173,7 @@ Dispatch the read-only classifier to reduce the raw failure log to a stable sign
165
173
  earliest failing layer (`charon -> aeneas -> split -> tweaks -> lean`):
166
174
 
167
175
  ```
168
- Task(subagent_type="fvs-extract-classifier", model=$CLASSIFIER_MODEL, ...)
176
+ Task(subagent_type="fvs-extract-classifier", model=$CLASSIFIER_MODEL, reasoning_effort=$CLASSIFIER_EFFORT, ...)
169
177
  ```
170
178
 
171
179
  It returns `{ layer, symbol, signature, match }` where `signature` is the stripped,
@@ -184,7 +192,7 @@ Route the classified blocker:
184
192
  records:
185
193
 
186
194
  ```
187
- Task(subagent_type="fvs-extract-applier", model=$APPLIER_MODEL, ...)
195
+ Task(subagent_type="fvs-extract-applier", model=$APPLIER_MODEL, reasoning_effort=$APPLIER_EFFORT, ...)
188
196
  ```
189
197
 
190
198
  The coverage-escalation guard fires here: **A-opacity applied to a function inside required
@@ -197,7 +205,7 @@ Route the classified blocker:
197
205
  never disposes:
198
206
 
199
207
  ```
200
- Task(subagent_type="fvs-extract-bisector", model=$BISECTOR_MODEL, ...)
208
+ Task(subagent_type="fvs-extract-bisector", model=$BISECTOR_MODEL, reasoning_effort=$BISECTOR_EFFORT, ...)
201
209
  ```
202
210
 
203
211
  A NOVEL B-fix routes to the GATE.
@@ -224,7 +232,7 @@ command body), never by a fixing agent.** The independence is structural:
224
232
  rationale). The assessor is NOT the proposer and never writes section 7 / the token:
225
233
 
226
234
  ```
227
- Task(subagent_type="fvs-equivalence-assessor", model=$ASSESSOR_MODEL, ...)
235
+ Task(subagent_type="fvs-equivalence-assessor", model=$ASSESSOR_MODEL, reasoning_effort=$ASSESSOR_EFFORT, ...)
228
236
  ```
229
237
 
230
238
  (The bisector dispatch `subagent_type="fvs-extract-bisector"` and this assessor dispatch
@@ -292,7 +300,7 @@ escalate condition:
292
300
  draft-investigator (dedup-first precedent mining + an evidence-cited HTML+MD draft to disk):
293
301
 
294
302
  ```
295
- Task(subagent_type="fvs-draft-investigator", model=$DRAFT_MODEL, ...)
303
+ Task(subagent_type="fvs-draft-investigator", model=$DRAFT_MODEL, reasoning_effort=$DRAFT_EFFORT, ...)
296
304
  ```
297
305
 
298
306
  The draft is HTML+MD to the workspace `drafts/` directory ONLY. No upstream artifact is