@curdx/flow 2.3.11 → 3.0.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.
Files changed (44) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/.claude-plugin/plugin.json +2 -20
  3. package/CHANGELOG.md +55 -2
  4. package/README.md +69 -19
  5. package/agents/flow-adversary.md +1 -0
  6. package/agents/flow-architect.md +1 -0
  7. package/agents/flow-brownfield-analyst.md +1 -0
  8. package/agents/flow-edge-hunter.md +1 -0
  9. package/agents/flow-planner.md +1 -0
  10. package/agents/flow-researcher.md +1 -0
  11. package/agents/flow-reviewer.md +1 -0
  12. package/agents/flow-ui-researcher.md +1 -0
  13. package/agents/flow-verifier.md +1 -0
  14. package/bin/curdx-flow-state +104 -0
  15. package/hooks/hooks.json +72 -0
  16. package/hooks/scripts/common.sh +191 -0
  17. package/hooks/scripts/config-change-guard.sh +94 -0
  18. package/hooks/scripts/flow-context-watch.sh +94 -0
  19. package/hooks/scripts/quick-mode-guard.sh +4 -3
  20. package/hooks/scripts/session-start.sh +14 -10
  21. package/hooks/scripts/session-title.sh +87 -0
  22. package/hooks/scripts/stop-watcher.sh +4 -3
  23. package/hooks/scripts/subagent-artifact-guard.sh +7 -74
  24. package/hooks/scripts/subagent-statusline.sh +8 -2
  25. package/hooks/scripts/task-lifecycle-guard.sh +106 -0
  26. package/hooks/scripts/teammate-idle-guard.sh +83 -0
  27. package/knowledge/claude-code-runtime-contracts.md +21 -0
  28. package/monitors/scripts/flow-state-monitor.sh +8 -5
  29. package/output-styles/curdx-fast-mode.md +42 -0
  30. package/output-styles/curdx-spec-mode.md +46 -0
  31. package/package.json +5 -3
  32. package/schemas/agent-frontmatter.schema.json +4 -1
  33. package/schemas/spec-state.schema.json +18 -0
  34. package/settings.json +2 -1
  35. package/skills/implement/SKILL.md +8 -0
  36. package/skills/implement/references/linear-execution.md +11 -0
  37. package/skills/implement/references/native-task-sync.md +107 -0
  38. package/skills/implement/references/progress-contract.md +4 -0
  39. package/skills/implement/references/state-init.md +3 -0
  40. package/skills/implement/references/stop-hook-execution.md +19 -5
  41. package/skills/implement/references/subagent-execution.md +16 -2
  42. package/skills/implement/references/wave-execution.md +18 -0
  43. package/skills/status/references/gather-contract.md +3 -0
  44. package/skills/status/references/output-contract.md +1 -0
@@ -6,11 +6,13 @@ naturally and the hook layer decides whether Claude continues.
6
6
  ## Protocol
7
7
 
8
8
  ```text
9
- 1. Execute 1 task (inline or via flow-executor, then wait for completion)
10
- 2. End the response naturally
11
- 3. stop-watcher.sh evaluates transcript markers, .state.json, and tasks.md
12
- 4. If unchecked tasks remain, the hook blocks stop and injects continuation
13
- 5. Repeat until ALL_TASKS_COMPLETE or recovery forces a halt
9
+ 1. Initialize execute_state, including native sync fields
10
+ 2. Rebuild native_task_map if the current session cannot update stored task ids
11
+ 3. Execute 1 task (inline or via flow-executor, then wait for completion)
12
+ 4. End the response naturally
13
+ 5. stop-watcher.sh evaluates transcript markers, .state.json, and tasks.md
14
+ 6. If unchecked tasks remain, the hook blocks stop and injects continuation
15
+ 7. Repeat until ALL_TASKS_COMPLETE or recovery forces a halt
14
16
  ```
15
17
 
16
18
  ## Completion Invariant
@@ -23,6 +25,14 @@ Stop-hook completion is double-checked:
23
25
  If either side disagrees, the hook resumes the first unchecked task instead of
24
26
  allowing the session to stop cleanly.
25
27
 
28
+ If native task sync is active during a continuation round:
29
+
30
+ - `.flow/specs/<name>/tasks.md` stays the source of truth
31
+ - checked rows should be mirrored back to the native task list before the next
32
+ task starts
33
+ - a stale `native_task_map` should trigger the rebuild rule from
34
+ `references/native-task-sync.md`, not a run failure
35
+
26
36
  ## Prerequisites
27
37
 
28
38
  - `--quick` should be set; otherwise `AskUserQuestion` can stall the loop
@@ -34,3 +44,7 @@ allowing the session to stop cleanly.
34
44
  During a stop-hook continuation, `stop_hook_active=true` is only a hint. The
35
45
  hook still checks transcript signals, `.state.json`, and `tasks.md` parity
36
46
  before deciding whether to continue or stop.
47
+
48
+ Native task sync is session-local UX. Continuations may resume into a different
49
+ Claude-native task list, so recovery must prefer rebuilding the UI mirror over
50
+ mutating `.flow` state.
@@ -5,6 +5,12 @@ task, but the backlog is not parallel-safe enough for waves.
5
5
 
6
6
  ## Dispatch Contract
7
7
 
8
+ Before each dispatch, if native task sync is active:
9
+
10
+ - reconcile obvious `tasks.md` vs native-task drift
11
+ - mark the outgoing task `in_progress`
12
+ - set the native active form to `Executing <task-id>` when available
13
+
8
14
  Dispatch one `flow-executor` at a time with a uniform prompt:
9
15
 
10
16
  ```text
@@ -32,12 +38,20 @@ When all tasks are done output: ALL_TASKS_COMPLETE
32
38
 
33
39
  After the agent completes, read the output marker:
34
40
 
35
- - `TASK_COMPLETE` -> mark progress and dispatch the next task
36
- - `TASK_FAILED` -> increment failure tracking and enter recovery
41
+ - `TASK_COMPLETE` -> mark progress, mark the native task `completed`, and
42
+ dispatch the next task
43
+ - `TASK_FAILED` -> increment failure tracking, keep the native task open, and
44
+ enter recovery
37
45
  - `ALL_TASKS_COMPLETE` -> mark execute complete and move to verify
38
46
 
47
+ If a stored Claude task id no longer updates, rebuild `native_task_map` from
48
+ the current `tasks.md`, then continue serial dispatch. Do not rewrite
49
+ `.state.json` task cursor or `tasks.md` just because the UI task list changed.
50
+
39
51
  ## Guardrails
40
52
 
41
53
  - This strategy is serial; a single Agent dispatch is not parallel execution
42
54
  - Do not batch multiple independent tasks into one `flow-executor` prompt
43
55
  - Do not trust narrative summaries over the end marker
56
+ - Native task sync belongs to the coordinator around the dispatch loop, not to
57
+ the `flow-executor` subagent itself
@@ -50,6 +50,12 @@ If the planner mis-tagged `[P]` (modifies the same file), split the wave automat
50
50
 
51
51
  ## Step 3: Dispatch a Single Wave (key: within a single response)
52
52
 
53
+ Before dispatching the wave, if native task sync is active:
54
+
55
+ - reconcile obvious `tasks.md` vs native-task drift
56
+ - mark every task in the upcoming wave `in_progress`
57
+ - set the active form to `Executing Wave <n>: <task ids>` when available
58
+
53
59
  ```
54
60
  # List multiple Agent tool calls in one response of the main agent:
55
61
  Agent(description="Execute 1.1", prompt=<...flow-executor + task_id=1.1...>)
@@ -106,6 +112,14 @@ for task in completed:
106
112
  warn(f"Task {task.id} modified undeclared files: {unexpected}")
107
113
  ```
108
114
 
115
+ After aggregation, if native task sync is active:
116
+
117
+ - mark each `completed` task `completed`
118
+ - leave each `failed` task open for retry/recovery
119
+ - if any `TaskUpdate` call reports a stale or missing Claude task id, rebuild
120
+ `native_task_map` from `tasks.md` and continue with `.flow` as source of
121
+ truth
122
+
109
123
  ## Step 5: Wave Failure Handling
110
124
 
111
125
  ```
@@ -137,6 +151,10 @@ failed_attempts >= 3 (cumulative):
137
151
  ▶ Wave 3/5 starting (VERIFY)...
138
152
  ```
139
153
 
154
+ When native task sync is active, the Claude task list is the short-form UI
155
+ surface for the same wave progress. Keep chat feedback compact instead of
156
+ relisting the whole backlog after every wave.
157
+
140
158
  ## Configuration
141
159
 
142
160
  `.flow/config.json`:
@@ -19,6 +19,9 @@ Gather read-only state in this order:
19
19
  - `execute_state.total_tasks`
20
20
  - `execute_state.failed_attempts`
21
21
  - `execute_state.global_iteration`
22
+ - `execute_state.native_sync_enabled`
23
+ - `execute_state.native_sync_failure_count`
24
+ - `execute_state.native_task_map` size
22
25
  5. If `tasks.md` exists, count:
23
26
  - completed tasks: lines matching `- [x] **`
24
27
  - open tasks: lines matching `- [ ] **`
@@ -15,6 +15,7 @@ Phase: <phase | unknown>
15
15
  Strategy: <strategy | auto>
16
16
  Tasks: <done>/<total from tasks.md> checked, state cursor <task_index>/<total_tasks>
17
17
  Failures: <failed_attempts>, rounds: <global_iteration>
18
+ Native sync: <on|off>, mapped tasks: <count>, sync failures: <native_sync_failure_count>
18
19
  Artifacts: [x] research [x] requirements [x] design [x] tasks [ ] verify [ ] review
19
20
  Health: OK | NEEDS_ATTENTION
20
21
  Recovery: <one concrete next command>