valent-pipeline 0.2.17 → 0.2.19

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "valent-pipeline",
3
- "version": "0.2.17",
3
+ "version": "0.2.19",
4
4
  "description": "v3 multi-agent AI pipeline for software development lifecycle",
5
5
  "type": "module",
6
6
  "bin": {
@@ -69,10 +69,15 @@ Spawn teammates from `agents-manifest.yaml` with:
69
69
 
70
70
  The lead watches the board, not the work. It reads the shared task list to track task states (`pending`, `in_progress`, `completed`). It does NOT read handoff documents to judge quality -- that is the JUDGE gates' job.
71
71
 
72
+ ### Heartbeat Timer
73
+
74
+ At the start of Phase 2, the lead creates a `CronCreate` job that fires every 4 minutes (aligned within Claude's 5-minute prompt cache TTL for near-zero token cost). Each heartbeat triggers a liveness check: call `TaskList`, verify at least one non-Knowledge agent is `in_progress`. If uncompleted tasks exist but no agent is working, the lead diagnoses the deadlock (stale blockers, missed unblocks, dead teammates) and acts. The cron job is deleted during Phase 3 teardown.
75
+
72
76
  ### What the Lead Watches
73
77
 
74
78
  - Task status transitions on the shared task list
75
79
  - Time-in-state for stall detection
80
+ - Heartbeat liveness checks (every 4 minutes via cron timer)
76
81
  - Inbox messages from teammates (escalations, questions, completion notifications)
77
82
 
78
83
  ### What the Lead Does NOT Do
@@ -49,10 +49,12 @@ You receive many message types. Process each by type:
49
49
  | `[DESIGN-COUNCIL]` | Agent requests deliberation. Route to relevant peers or participate. |
50
50
  | `[ESCALATION]` | Agent requests your intervention. Assess and act. |
51
51
  | `[BUG]` | QA-B filed a bug. No action -- QA-B routes directly to devs. Monitor bug count. |
52
+ | `[HEARTBEAT]` | Timer-fired liveness check. Run the Heartbeat Liveness Check procedure below. |
52
53
 
53
54
  Your outbound messages follow the same terse format:
54
55
  - `[SPAWN] Spawning {agent} for {story_id}. Role: {role}. Shared context: {story_output_dir}.`
55
56
  - `[CHECK-IN] {agent}: task {task} has been in_progress for {minutes}min. Status?`
57
+ - `[REVIEW-READY] Story {story_id}` — sent to READINESS immediately when a story reaches `readiness-review` during sprint grooming. Do not batch — send as soon as QA-A hands off each story.
56
58
  - `[TEARDOWN] Tearing down all teammates for {story_id}.`
57
59
  - `[ESCALATION] See escalation block below.`
58
60
 
@@ -430,6 +432,37 @@ Wait for `[KNOWLEDGE-READY]` response before spawning other agents. The Knowledg
430
432
 
431
433
  You watch task status, NOT agent outputs. You do NOT read handoff documents to judge quality -- that is the JUDGE gates' and CRITIC's job.
432
434
 
435
+ ### Heartbeat Setup
436
+
437
+ At the start of Phase 2, create a recurring heartbeat timer using `CronCreate`:
438
+
439
+ ```
440
+ CronCreate:
441
+ cron: "*/4 * * * *"
442
+ prompt: "[HEARTBEAT] Run liveness check — verify at least one agent is actively working."
443
+ recurring: true
444
+ ```
445
+
446
+ This fires every 4 minutes — aligned to stay within Claude's 5-minute prompt cache TTL so each heartbeat is near-zero cost. Store the returned job ID in your tracking state so you can delete it during teardown.
447
+
448
+ ### Heartbeat Liveness Check
449
+
450
+ When you receive a `[HEARTBEAT]` message:
451
+
452
+ 1. Call `TaskList` to get current task states
453
+ 2. Count tasks that are `in_progress` (exclude Knowledge Agent — it is reactive and has no task)
454
+ 3. Count tasks that are NOT `completed` (pending or in_progress)
455
+ 4. Evaluate:
456
+ - **All tasks completed:** All work is done. Proceed to Phase 3 if JUDGE has approved. If JUDGE has not approved yet, check why — JUDGE's task should be `in_progress` or `completed`.
457
+ - **Uncompleted tasks exist AND at least one is `in_progress`:** Healthy. No action needed.
458
+ - **Uncompleted tasks exist AND zero are `in_progress`:** All agents are idle with work remaining. This is the deadlock edge case. Diagnose:
459
+ a. Check which tasks are `pending` and what they are `blockedBy`
460
+ b. Verify the blocking tasks are truly not completed (task state may be stale)
461
+ c. If a blocker is completed but the downstream task was not unblocked, unblock it now
462
+ d. If an agent should be working but is not, send `[CHECK-IN]` to that teammate
463
+ e. If a teammate has died (no response to `[CHECK-IN]`), respawn it using crash recovery (see Phase 4)
464
+ f. If the dependency graph itself is stuck (circular or impossible), escalate to user
465
+
433
466
  ### Stall Detection
434
467
 
435
468
  If a task is `in_progress` longer than `{stall_threshold_minutes}`:
@@ -577,8 +610,8 @@ All agent outputs persist in `{story_output_dir}`: handoff files, reviews, bug r
577
610
  ### Step 3: Verify Story Report
578
611
  JUDGE writes `story-report.md` as part of its SHIP verdict (Step 14b). Verify the file exists in `{story_output_dir}`. If missing (JUDGE error), write it yourself using the template at `.valent-pipeline/templates/story-report.template.md`.
579
612
 
580
- ### Step 4: Tear Down Teammates
581
- Tear down all per-story teammates. Send `shutdown_request` to each individually.
613
+ ### Step 4: Tear Down Heartbeat and Teammates
614
+ Delete the heartbeat cron job using `CronDelete` with the stored job ID. Then tear down all per-story teammates. Send `shutdown_request` to each individually.
582
615
 
583
616
  **Knowledge Agent exception:** If `{is_epic_run}` is true, do NOT tear down the Knowledge Agent. It persists across stories in an epic to avoid respawn overhead (~15-20k tokens per story). It will receive a `[STORY-RESET]` at the next story's kick-off. Tear down Knowledge only at epic completion (final story in the epic).
584
617
 
@@ -12,7 +12,10 @@ Read `.valent-pipeline/steps/common/agent-protocol.md` for Communication Standar
12
12
 
13
13
  You are spawned at story kick-off but do NOT begin work immediately.
14
14
 
15
- - **Wait for:** `[HANDOFF]` from QA-A
15
+ **Standalone mode:** Wait for `[HANDOFF]` from QA-A, then review that story.
16
+
17
+ **Sprint mode (`{is_sprint_mode}` is true):** Lead sends you `[REVIEW-READY] Story {story_id}` each time a story reaches `readiness-review`. Begin reviewing that story immediately. When you finish (approve or reject), return to idle and wait for the next `[REVIEW-READY]` from Lead. You may receive the next signal while still reviewing — queue it and process sequentially.
18
+
16
19
  - **On approval:** Send `[READINESS-APPROVAL]` to BEND (and FEND if active). Send `[DONE]` to Lead. Mark task completed.
17
20
  - **On rejection:** Send `[READINESS-REJECTION]` to the **responsible agent** (REQS, UXA, or QA-A — see Rejection Routing below) AND to Lead. Do NOT send `[DONE]`. Do NOT mark task completed. Task stays `in_progress` — keeps BEND/FEND blocked. After agent revises and downstream re-completes, re-review.
18
21
  - **Escalate to:** Lead — for `[BLOCKER]`, `[ESCALATION]`, or any issue you cannot resolve peer-to-peer.
@@ -43,7 +43,8 @@ Process stories using assembly-line parallelism. Each agent moves to the next av
43
43
  --story-id {story_id} \
44
44
  --sprint-id {current_sprint_id}
45
45
  ```
46
- 9. READINESS reviews specs + cross-story checks
46
+ 9. Lead sends `[REVIEW-READY] Story {story_id}` to READINESS **immediately** do not wait for other stories to reach this status. READINESS begins reviewing as soon as it receives the signal (or queues it if already reviewing another story).
47
+ 10. READINESS reviews specs + cross-story checks
47
48
 
48
49
  **Status-based self-selection with type filtering:**
49
50