You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add per-plan task classification and debug routing to `execute-phase.md` so that bug-fix plans get routed through `/nf:debug` (Loop 1 autoresearch-refine) before execution, with constraints injected into executor prompts — matching the `quick.md` Step 5.8 pattern.
12
+
13
+
## Must-Haves
14
+
15
+
1. Per-plan Haiku task classification (bug_fix/feature/refactor) in the execute_waves step, before spawning each executor
16
+
2. Debug routing: bug_fix plans (confidence >= 0.7) dispatched through `/nf:debug` before executor spawn
17
+
3. Debug context injection: `<debug_context>` block conditionally injected into executor prompt with constraints, verdict, and reproducing model
18
+
4. Fail-open: all new logic skips silently on Haiku unavailability, debug errors, or missing modules
19
+
5. Sync repo source → installed copy after edit
20
+
21
+
## Tasks
22
+
23
+
### Task 1: Add per-plan task classification to execute_waves step
24
+
25
+
In `core/workflows/execute-phase.md`, inside `<step name="execute_waves">`, add a classification sub-step BEFORE spawning executor agents (before item 2 "Spawn executor agents"). For each plan in the wave:
26
+
27
+
1. Read the plan's `<objective>` text
28
+
2. Spawn Haiku subagent to classify the plan objective as bug_fix/feature/refactor (same prompt as quick.md Step 2.7 sub-step 1.5)
29
+
3. Store `$PLAN_CLASSIFICATION` per plan
30
+
4. Fail-open: default to `{ type: "feature", confidence: 0.0 }` if Haiku unavailable
31
+
32
+
### Task 2: Add debug routing step between classification and executor spawn
33
+
34
+
Add a new sub-step after classification, before executor spawn:
35
+
36
+
1.**Skip if:**`$PLAN_CLASSIFICATION.type` is NOT `bug_fix`, OR confidence < 0.7
37
+
2.**If routing:** Spawn `/nf:debug` as Task subagent with the plan objective as failure context (same pattern as quick.md Step 5.8 item 2)
4. Fail-open: on error, set all debug vars to null and continue
40
+
41
+
### Task 3: Inject debug_context block into executor prompt
42
+
43
+
Modify the executor Task spawn (item 2 in execute_waves) to conditionally include a `<debug_context>` block after the `</formal_coverage_auto_detection>` section:
| 1 | Per-plan Haiku task classification before executor spawn | PASS | Step 1.5a at line 108 — Haiku classifies plan objective as bug_fix/feature/refactor |
8
+
| 2 | Debug routing for bug_fix plans (confidence >= 0.7) | PASS | Step 1.5b at line 145 — spawns /nf:debug before executor |
9
+
| 3 | debug_context block injected into executor prompt | PASS | Lines 253-262 — conditional block with constraints, verdict, reproducing model |
10
+
| 4 | Fail-open on all new logic | PASS | Line 139 (classification fallback), line 148 (debug vars null on skip), line 185 (debug error → null + continue) |
"approach": "Add phase-level task classification and debug routing to execute-phase.md's plan execution loop, dispatching bug-fix phases through /nf:debug before execution and injecting formal constraints into executor prompts, matching the quick.md Step 5.8 pattern.",
6
+
"out_of_scope": [
7
+
"Rewriting the /nf:debug skill itself — only phase-level routing and constraint injection are in scope",
8
+
"Cross-phase bug-fix dependencies — phase classification is per-plan, not per-milestone",
9
+
"Modifying quick.md — only execute-phase.md is in scope"
description: "Push Loop 2 and debug_context into execute-plan.md Pattern A spawn prompt"
4
+
formal_artifacts: none
5
+
---
6
+
7
+
# Plan: Push Loop 2 + debug_context into Pattern A
8
+
9
+
## Objective
10
+
11
+
Expand the Pattern A spawn prompt in `execute-plan.md` to include `<formal_coverage_auto_detection>` (Loop 2) and `<debug_context>` blocks, so the nested child nf-executor inherits both verification loops when committing.
12
+
13
+
## Must-Haves
14
+
15
+
1. Pattern A spawn prompt includes `<formal_coverage_auto_detection>` block with Loop 2 (solution-simulation-loop)
16
+
2. Pattern A spawn prompt includes conditional `<debug_context>` passthrough from parent context
17
+
3. Pattern B confirmed safe (orchestrator commits, not subagent) — no changes needed
18
+
4. Fail-open preserved on all new blocks
19
+
5. Sync repo source → installed copy
20
+
21
+
## Analysis
22
+
23
+
-**Pattern A** (line 121): Currently a one-liner prose description. Expand to include formal blocks in the prompt specification.
24
+
-**Pattern B** (line 123): Segment subagents do NOT commit — orchestrator (main context) commits. Orchestrator has Loop 2. **No change needed.**
25
+
-**Pattern C** (line 125): Executes in main context. Has Loop 2. **No change needed.**
26
+
-**Pattern D** (lines 130+): Worktree executors with minimal prompts. Opt-in only (--parallel flag). **Defer to separate task.**
27
+
28
+
## Tasks
29
+
30
+
### Task 1: Expand Pattern A spawn description to include formal blocks
31
+
32
+
Replace the Pattern A one-liner at line 121 with an expanded prompt specification that includes:
33
+
1. The existing instructions (execute plan, autonomous, all tasks, SUMMARY, commit, deviation/auth rules)
34
+
2.`<formal_coverage_auto_detection>` block (same as execute-phase.md lines 217-251)
35
+
3.`<debug_context>` passthrough: `${PARENT_DEBUG_CONTEXT || ''}` — the parent executor passes any debug_context it received from the orchestrator
36
+
37
+
Note: The parent nf-executor (spawned by execute-phase.md) receives `$DEBUG_CONSTRAINTS`, `$DEBUG_FORMAL_VERDICT`, `$DEBUG_REPRODUCING_MODEL` from the orchestrator's debug routing. When spawning the Pattern A child, the parent must forward these as a `<debug_context>` block in the child's prompt.
"task_description": "Push Loop 2 (formal_coverage_auto_detection + solution-simulation-loop) and debug_context into execute-plan.md Pattern A spawn prompt",
5
+
"approach": "Inject formal_coverage_auto_detection, solution-simulation-loop, and debug_context constraint blocks into the Pattern A nf-executor spawn prompt in execute-plan.md so nested child executors inherit both verification loops.",
6
+
"out_of_scope": [
7
+
"Implementation of Loop modules (already exist)",
8
+
"Changes to Pattern B, C, or D routing",
9
+
"Loop 1 debug routing integration (already handled at orchestrator level)"
- Good: "Procedural terrain generator using Perlin noise — creates height maps, biome zones, and collision meshes. Required before vehicle physics can interact with ground."
103
103
104
+
1.5. **Classify plan type and debug routing (ROUTE-02, ROUTE-03):**
105
+
106
+
For each plan, classify its objective and optionally route through `/nf:debug` before execution.
107
+
108
+
**1.5a. Classify plan type via Haiku subagent:**
109
+
110
+
Spawn a Haiku subagent to classify the plan's objective:
111
+
112
+
```
113
+
Task(
114
+
subagent_type="general-purpose",
115
+
model="haiku",
116
+
description="Classify plan type for debug routing",
117
+
prompt="
118
+
You are classifying a development plan into exactly one category.
119
+
120
+
## Plan Objective
121
+
{plan_objective_text from <objective> tag}
122
+
123
+
## Categories
124
+
- bug_fix: The plan fixes a bug, error, regression, crash, or broken behavior.
125
+
- feature: The plan adds new functionality or capability.
126
+
- refactor: The plan reorganizes, renames, cleans up, or simplifies existing code without changing behavior.
0 commit comments