feed-the-machine 1.4.1 → 1.5.1

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.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: ftm-audit
3
- description: Dual-purpose wiring audit that verifies all code is actually connected to the running application. Combines static analysis (knip) with adversarial LLM audit and auto-fixes anything it finds. Use when user says "audit", "wiring check", "verify wiring", "dead code", "check imports", "unused code", "find dead code", or "audit wiring". Also auto-invoked by ftm-executor after each task.
3
+ description: Triple-layer wiring audit that verifies all code is actually connected to the running application and documented in INTENT.md. Combines static analysis (knip), documentation coverage checking (INTENT.md entries for every changed function), and adversarial LLM audit auto-fixes anything it finds. Use when user says "audit", "wiring check", "verify wiring", "dead code", "check imports", "unused code", "find dead code", "audit wiring", "check docs", or "documentation coverage". Also auto-invoked by ftm-executor after each task.
4
4
  ---
5
5
 
6
6
  ## Events
@@ -121,6 +121,79 @@ Layer 1 findings:
121
121
 
122
122
  **Helper script:** `scripts/run-knip.sh` handles execution and returns structured JSON output.
123
123
 
124
+ ## Layer 1.5: Documentation Coverage Check
125
+
126
+ **Purpose:** Verify that every new or changed function has a corresponding INTENT.md entry. This catches the most common documentation skip — agents write code and tests but forget to update INTENT.md, leaving the documentation layer stale.
127
+
128
+ **When to run:** After Layer 1, before Layer 2. Only runs if the project has an INTENT.md documentation layer (root INTENT.md exists). If no INTENT.md exists anywhere in the project, skip this layer silently — it's not a documentation-first project.
129
+
130
+ **Scope:** Analyze the current git diff to find new or changed functions/classes/methods.
131
+
132
+ **Check protocol:**
133
+
134
+ 1. **Find changed files:** `git diff HEAD~1 --name-only -- '*.py' '*.ts' '*.tsx' '*.js' '*.jsx'` (or equivalent for the project's language)
135
+ 2. **For each changed source file:**
136
+ - Identify the module directory (e.g., `src/risk/` for `src/risk/position_sizer.py`)
137
+ - Check if `[module_dir]/INTENT.md` exists
138
+ - If it exists, read it and extract all documented function signatures
139
+ - Parse the changed file for public function/class/method definitions
140
+ - Compare: flag any public function that exists in code but has NO entry in INTENT.md
141
+ 3. **For new module directories** (directories created in this diff):
142
+ - Check if `[new_module_dir]/INTENT.md` was created
143
+ - Check if root INTENT.md module map has a row for the new module
144
+ - Flag if either is missing
145
+
146
+ **Finding types:**
147
+
148
+ | Finding | Severity | Auto-fixable? |
149
+ |---------|----------|---------------|
150
+ | `MISSING_INTENT_ENTRY` — function exists in code but no INTENT.md entry | HARD FAIL | Yes — generate entry from code |
151
+ | `STALE_INTENT_ENTRY` — INTENT.md entry for a function that no longer exists | WARN | Yes — remove entry |
152
+ | `MISSING_MODULE_INTENT` — new module directory has no INTENT.md file | HARD FAIL | Yes — create from template |
153
+ | `MISSING_MODULE_MAP_ROW` — new module not in root INTENT.md module map | HARD FAIL | Yes — add row |
154
+
155
+ **Output format:**
156
+ ```
157
+ Layer 1.5 findings:
158
+ - [MISSING_INTENT_ENTRY] src/risk/position_sizer.py:45 — `calculate_dynamic_size()` has no entry in src/risk/INTENT.md
159
+ - [STALE_INTENT_ENTRY] src/risk/INTENT.md — entry for `old_function()` but function no longer exists in code
160
+ - [MISSING_MODULE_INTENT] src/newmodule/ — directory created but no INTENT.md file
161
+ - [MISSING_MODULE_MAP_ROW] src/newmodule/ — not listed in root INTENT.md module map
162
+ ```
163
+
164
+ **Auto-fix strategy for `MISSING_INTENT_ENTRY`:**
165
+
166
+ Generate the entry from the function's code. Read the function body and produce:
167
+ ```markdown
168
+ ### function_name(param1: Type, param2: Type) -> ReturnType
169
+ - **Does**: [infer from function body — one sentence]
170
+ - **Why**: [infer from context and callers — one sentence, or "Why unknown — inferred from usage: [inference]"]
171
+ - **Relationships**: [grep for callers/callees — one sentence]
172
+ - **Decisions**: [note any non-obvious choices, or "None"]
173
+ ```
174
+
175
+ Append the entry to the module's INTENT.md under the `## Functions` section.
176
+
177
+ **Auto-fix strategy for `MISSING_MODULE_INTENT`:**
178
+
179
+ Create `[module_dir]/INTENT.md` with:
180
+ ```markdown
181
+ # [Module Name] — Intent
182
+
183
+ ## Functions
184
+
185
+ [generate entries for all public functions in the module]
186
+ ```
187
+
188
+ **Auto-fix strategy for `MISSING_MODULE_MAP_ROW`:**
189
+
190
+ Append a row to the root INTENT.md module map table:
191
+ ```markdown
192
+ | [module_path] | [infer purpose from code] | [infer relationships from imports] |
193
+ ```
194
+
195
+ ---
196
+
124
197
  ## Layer 2: LLM Adversarial Audit
125
198
 
126
199
  **Mindset:** You are an adversary trying to PROVE code is dead. Not "confirm it works" — PROVE it's dead. Every new/modified export is guilty until proven innocent. You must find a complete chain from app entry point to the code in question, or it's flagged.
@@ -192,6 +265,10 @@ Layer 2 findings:
192
265
  | `UNCALLED_API` | If a hook or component should call this (check wiring contract), add the invocation. If truly unused, remove the function. | Flag — API integration decision needed |
193
266
  | `UNUSED_DEP` | Remove from package.json `dependencies` or `devDependencies`. | Flag if it might be used in scripts, config files, or CLI |
194
267
  | `UNLISTED_DEP` | Run `npm install <package>` (or appropriate package manager command). | Flag if the import might be wrong |
268
+ | `MISSING_INTENT_ENTRY` | Generate INTENT.md entry from function code (Does/Why/Relationships/Decisions). Append to module's INTENT.md. | Flag if function purpose is ambiguous |
269
+ | `STALE_INTENT_ENTRY` | Remove the entry from INTENT.md. | Flag if unsure whether function was renamed vs deleted |
270
+ | `MISSING_MODULE_INTENT` | Create module INTENT.md with entries for all public functions. | Flag if module has no clear public API |
271
+ | `MISSING_MODULE_MAP_ROW` | Add row to root INTENT.md module map table. | Flag if module purpose is unclear |
195
272
 
196
273
  **Fix Protocol (for each finding):**
197
274
 
@@ -430,12 +507,13 @@ When invoked (manually via `/ftm-audit` or automatically post-task):
430
507
 
431
508
  1. Run Phase 0 (detect project patterns — framework, router, state, API layer)
432
509
  2. Run Layer 1 (knip static analysis)
433
- 3. Run Layer 2 (LLM adversarial audit, calibrated to detected patterns)
434
- 4. Combine findings, deduplicate
435
- 5. Run Layer 3 (auto-fix) for each finding
436
- 6. Re-verify (re-run Layers 1+2)
437
- 7. Run Phase 3 (runtime wiring via ftm-browse, if prerequisites met)
438
- 8. Produce final changelog report
510
+ 3. Run Layer 1.5 (documentation coverage check INTENT.md entries for changed functions)
511
+ 4. Run Layer 2 (LLM adversarial audit, calibrated to detected patterns)
512
+ 5. Combine findings, deduplicate
513
+ 6. Run Layer 3 (auto-fix) for each finding (including missing INTENT.md entries)
514
+ 7. Re-verify (re-run Layers 1+1.5+2)
515
+ 8. Run Phase 3 (runtime wiring via ftm-browse, if prerequisites met)
516
+ 9. Produce final changelog report
439
517
 
440
518
  ## Blackboard Write
441
519
 
@@ -458,6 +536,10 @@ After completing, update the blackboard:
458
536
  - Findings: [N]
459
537
  - [list each finding with file:line]
460
538
 
539
+ ### Layer 1.5: Documentation Coverage
540
+ - Findings: [N]
541
+ - [list each finding — missing entries, stale entries, missing module docs]
542
+
461
543
  ### Layer 2: Adversarial Audit
462
544
  - Findings: [N]
463
545
  - [list each finding with file:line and evidence]
@@ -128,7 +128,7 @@ For FAIL findings, suggest specific fixes.
128
128
  ```
129
129
 
130
130
  **Interpret the result:**
131
- - **PASS**: Proceed to Phase 1
131
+ - **PASS**: Proceed to Phase 0.7 → Phase 1 → Phase 1.5 (documentation bootstrap) → Phase 2
132
132
  - **WARN**: Show warnings to user, proceed unless they object
133
133
  - **FAIL**: Present blockers and suggested fixes. Ask user: fix the plan and re-run, or override and execute anyway?
134
134
 
@@ -174,22 +174,43 @@ Parallel waves:
174
174
  Final: Task [N] (integration/cleanup)
175
175
  ```
176
176
 
177
- ### Phase 1.5: Documentation Layer Bootstrap
177
+ **After outputting the summary, proceed IMMEDIATELY to Phase 1.5.** Do NOT skip to Phase 2. The documentation bootstrap must run before any agents are dispatched.
178
178
 
179
- Before dispatching any agents, check if the project has the required documentation layer. If any of these files are missing, create them.
179
+ ---
180
+
181
+ ### Phase 1.5: Documentation Layer Bootstrap (MANDATORY)
182
+
183
+ **This phase is non-skippable.** The documentation layer is required for ftm-verify to assess plan completion, for ftm-codex-gate to detect intent conflicts, and for agents to update docs as they work. Without it, every downstream verification step is degraded.
180
184
 
181
- **Check for and create if missing:**
182
- 1. **INTENT.md** (project root) — If missing, bootstrap from the plan's Vision and Architecture Decisions sections. Use the ftm-intent skill's root template format.
183
- 2. **ARCHITECTURE.mmd** (project root)If missing, bootstrap by scanning the codebase for modules and their import relationships. Use the ftm-diagram skill's root template format.
184
- 3. **STYLE.md** (project root) — If missing, copy from `~/.claude/skills/ftm-executor/references/STYLE-TEMPLATE.md` into the project root.
185
- 4. **DEBUG.md** (project root) — If missing, create with a header:
185
+ Before dispatching any agents, check if the project has the required documentation layer. If any of these files are missing, create them. If they already exist, verify they're non-empty and well-formed.
186
+
187
+ **Required documentation filescreate if missing:**
188
+ 1. **INTENT.md** (project root) — Bootstrap from the plan's Vision and Architecture Decisions sections. Use the ftm-intent skill's root template format. Must include: Vision, Architecture Decisions table, Module Map.
189
+ 2. **ARCHITECTURE.mmd** (project root) — Bootstrap by scanning the codebase for modules and their import relationships. Use the ftm-diagram skill's root template format. Must have at least one node and one edge.
190
+ 3. **STYLE.md** (project root) — Copy from `~/.claude/skills/ftm-executor/references/STYLE-TEMPLATE.md` into the project root.
191
+ 4. **DEBUG.md** (project root) — Create with a header:
186
192
  ```markdown
187
193
  # Debug Log
188
194
 
189
195
  Failed approaches and their outcomes. Codex and Claude append here — never retry what's already logged.
190
196
  ```
191
197
 
192
- This bootstrap runs once at the start of execution. If the files already exist, skip this phase entirely.
198
+ **Phase 1.5 Gate:** After creating any missing files, verify all 4 exist:
199
+ ```bash
200
+ for f in INTENT.md ARCHITECTURE.mmd STYLE.md DEBUG.md; do
201
+ [ -f "$f" ] || echo "MISSING: $f"
202
+ done
203
+ ```
204
+ If any file is still missing after the bootstrap attempt, STOP and report:
205
+ ```
206
+ Documentation bootstrap failed — missing: [list]
207
+ Cannot proceed without documentation layer. Fix manually or re-run.
208
+ ```
209
+ Do NOT proceed to Phase 2 with missing documentation files.
210
+
211
+ **Phase 1.5 complete.** All documentation files verified. Proceed to Phase 2.
212
+
213
+ **CRITICAL FLOW REMINDER: The execution sequence is Phase 0 → 0.5 → 0.7 → 1 → 1.5 → 2 → 3 → 3.5 → 4. Phase 1.5 MUST execute between Phase 1 and Phase 2. If you are reading this and have not yet created/verified the documentation layer, STOP and do it now before dispatching any agents.**
193
214
 
194
215
  ---
195
216
 
package/ftm-verify.yml ADDED
@@ -0,0 +1,2 @@
1
+ name: ftm-verify
2
+ description: Comprehensive post-execution verification and auto-remediation engine using dual-model adversarial analysis. Replaces ftm-retro. After ftm-executor completes a plan, this skill runs two independent verification passes in parallel — Codex (OpenAI) and Gemini (Google) — each reading the entire codebase to check plan fulfillment, documentation fidelity, build health, test quality, and wiring integrity. Falls back to Claude subagents if either CLI is unavailable. Reconciles findings from both models, auto-remediates with parallel fix agents, and reports what was found, disagreed on, and fixed. Use when user says "verify", "is the plan done", "check everything", "verify plan", "ftm-verify", "did we miss anything", "is it complete", "validate the build", "check the plan", "verify execution", "post-execution check", or after any ftm-executor run completes. Also triggers on "retro", "retrospective", "how did that go", "execution review" since this skill supersedes ftm-retro. Even if the user just says "are we good?" after a plan execution — this is the skill.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "feed-the-machine",
3
- "version": "1.4.1",
3
+ "version": "1.5.1",
4
4
  "description": "A unified intelligence layer for Claude Code — 22 skills with OODA-based reasoning, persistent memory, multi-model deliberation, and optional operator cockpit inbox",
5
5
  "license": "MIT",
6
6
  "author": "kkudumu",