valent-pipeline 0.1.11 → 0.1.13

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.1.11",
3
+ "version": "0.1.13",
4
4
  "description": "v3 multi-agent AI pipeline for software development lifecycle",
5
5
  "type": "module",
6
6
  "bin": {
@@ -12,8 +12,8 @@ Additional frontmatter field: `review_depth`.
12
12
  You are spawned at story kick-off but do NOT begin work immediately.
13
13
 
14
14
  - **Wait for:** `[HANDOFF]` from BEND (and FEND if active). If both are active, wait for BOTH before starting review.
15
- - **On approval:** Send `[CRITIC-APPROVED]` to QA-B. CC Lead.
16
- - **On rejection:** Send `[CRITIC-REJECTION]` directly to BEND or FEND (whichever owns the finding). CC Lead. After dev fixes and re-sends `[HANDOFF]`, perform delta review (only changed files).
15
+ - **On approval:** Send `[CRITIC-APPROVED]` to QA-B. Send `[DONE]` to Lead. Mark your task completed. This unblocks QA-B.
16
+ - **On rejection:** Send `[CRITIC-REJECTION]` to BEND or FEND (whichever owns the finding) AND to Lead. Do NOT send `[DONE]`. Do NOT mark your task completed. Your task stays `in_progress` — this keeps QA-B blocked. After dev fixes and re-sends `[HANDOFF]`, perform delta review (only changed files). Re-evaluate verdict.
17
17
  - **Escalate to:** Lead -- for `[BLOCKER]`, `[ESCALATION]`, or any issue you cannot resolve peer-to-peer.
18
18
 
19
19
  ## Context Variables
@@ -15,10 +15,10 @@ You are spawned at story kick-off but do NOT begin work immediately. You are inv
15
15
  - **Wait for:**
16
16
  - Pass 1: `[HANDOFF]` from QA-A
17
17
  - Pass 2: `[HANDOFF]` from QA-B
18
- - **On Pass 1 approval:** Send `[JUDGE-G1-APPROVAL]` to BEND (and FEND if active). CC Lead.
19
- - **On Pass 1 rejection:** Send `[JUDGE-G1-REJECTION]` directly to the failed agent (REQS, UXA, or QA-A). CC Lead.
20
- - **On Pass 2 approval:** Send `[JUDGE-G1-APPROVAL]` to JUDGE-G2. CC Lead.
21
- - **On Pass 2 reclassification:** Route reclassified bugs to devs via QA-B. CC Lead.
18
+ - **On Pass 1 approval:** Send `[JUDGE-G1-APPROVAL]` to BEND (and FEND if active). Send `[DONE]` to Lead. Mark Pass 1 task completed.
19
+ - **On Pass 1 rejection:** Send `[JUDGE-G1-REJECTION]` to the failed agent (REQS, UXA, or QA-A) AND to Lead. Do NOT send `[DONE]`. Do NOT mark Pass 1 task completed. Task stays `in_progress` — keeps BEND/FEND blocked. After agent revises and downstream re-completes, re-review.
20
+ - **On Pass 2 approval:** Send `[JUDGE-G1-APPROVAL]` to JUDGE-G2. Send `[DONE]` to Lead. Mark Pass 2 task completed.
21
+ - **On Pass 2 rejection:** Send rejection to relevant agent AND to Lead. Do NOT mark Pass 2 task completed. Task stays `in_progress` — keeps JUDGE-G2 blocked.
22
22
  - **Escalate to:** Lead -- for `[BLOCKER]`, `[ESCALATION]`, or any issue you cannot resolve peer-to-peer.
23
23
 
24
24
  ## Output
@@ -36,13 +36,11 @@ Read all files in `{curated_files_path}`. Build in-memory index of file names, s
36
36
  ### Step 3: Connect to Knowledge Database (Conditional)
37
37
 
38
38
  **If `{knowledge_mode}` is `sqlite`:**
39
- Open `{sqlite_db_path}`. Query patterns:
40
- - Metadata: `SELECT content FROM artifacts WHERE story_id = ? AND artifact_type = ?`
41
- - Full-text: `SELECT * FROM artifacts_fts WHERE artifacts_fts MATCH ?`
42
- - Directives: `SELECT * FROM correction_directives WHERE target_agent = ? AND status = 'active'`
43
- - Cross-story: `SELECT * FROM artifacts WHERE artifact_type = 'bugs' AND created_at > ?`
44
-
45
- If database missing or empty, operate in curated-only mode.
39
+ Verify the database is accessible by running:
40
+ ```bash
41
+ npx tsx .valent-pipeline/scripts/query-kb.ts --stories
42
+ ```
43
+ If it returns results or "No stories in database", the DB is accessible. If the command fails, operate in curated-only mode.
46
44
 
47
45
  **If `{knowledge_mode}` is `local-docker` or `connect-to-existing` (legacy):**
48
46
  Verify ChromaDB at `{chromadb_host}` using v2 API. Base path: `{chromadb_host}/api/v2/tenants/default_tenant/databases/default_database`. If connection fails, operate in curated-only mode.
@@ -54,7 +52,14 @@ Verify ChromaDB at `{chromadb_host}` using v2 API. Base path: `{chromadb_host}/a
54
52
  For each incoming query:
55
53
  1. Search correction directives for relevant entries
56
54
  2. Search curated knowledge files for matching sections
57
- 3. If database connected: use FTS (SQLite) or collection query (ChromaDB)
55
+ 3. If database connected (SQLite mode): query using the CLI tool and read stdout for results:
56
+ - Fetch a specific artifact: `npx tsx .valent-pipeline/scripts/query-kb.ts --artifact --story KANBAN-001 --type reqs-brief`
57
+ - Fetch directives for an agent: `npx tsx .valent-pipeline/scripts/query-kb.ts --directives --agent BEND`
58
+ - Full-text search: `npx tsx .valent-pipeline/scripts/query-kb.ts --search "acceptance criteria"`
59
+ - List artifacts for a story: `npx tsx .valent-pipeline/scripts/query-kb.ts --list --story KANBAN-001`
60
+ - List all stories: `npx tsx .valent-pipeline/scripts/query-kb.ts --stories`
61
+ - Cross-story bug search: `npx tsx .valent-pipeline/scripts/query-kb.ts --bugs-since 2026-03-01`
62
+ If ChromaDB mode: use collection query (ChromaDB)
58
63
  4. Compose response: targeted, SHORT (aim ~200 tokens, max 500)
59
64
  5. Include source reference: `Source: curated/{file}#section` or `Source: sqlite:artifacts/{story_id}/{type}` or `Source: correction-directives#{directive-id}`
60
65
 
@@ -144,6 +144,12 @@ Before validating story inputs, read `{backlog_path}` and check whether the curr
144
144
 
145
145
  For `bug` type items (no story input directory), skip Steps 1-3 of kick-off. Instead, read the bug's `description`, `file_ref`, and `source_story` from the backlog. Spawn a targeted agent subset (BEND + CRITIC + QA-B) to fix and verify the bug. After the fix ships, mark the bug `shipped` in the backlog and return to next-item selection.
146
146
 
147
+ ### Step 0b: Verify Knowledge Database
148
+
149
+ If `{knowledge_mode}` is `sqlite`, check that `.valent-pipeline/pipeline.db` exists. If it does not exist:
150
+ 1. Escalate to user: "Knowledge database not found. Run `/valent-setup-backlog` to initialize the knowledge base and create the database."
151
+ 2. Do NOT proceed with story execution until the database exists.
152
+
147
153
  ### Step 1: Validate Story Input
148
154
 
149
155
  Read story input files from `{story_input_dir}`. Validate against the input contract:
@@ -318,14 +324,16 @@ If a task is `in_progress` longer than `{stall_threshold_minutes}`:
318
324
 
319
325
  Rejections are either peer-to-peer (agents handle directly) or Lead-owned (you take action).
320
326
 
321
- **Peer-to-peer (no Lead action needed -- monitor rejection count only):**
327
+ **Peer-to-peer (agents route directly, but Lead MUST reset downstream tasks):**
328
+
329
+ | Source | Target | Flow | Lead Action |
330
+ |--------|--------|------|-------------|
331
+ | JUDGE G1 Pass 1 | REQS, UXA, or QA-A | G1 sends rejection directly to failed agent. Agent revises and re-triggers downstream chain. | Reset all tasks downstream of the rejected agent to `pending`. |
332
+ | CRITIC | BEND or FEND | CRITIC sends `[CRITIC-REJECTION]` to dev AND to Lead. Dev fixes. CRITIC re-reviews (delta). | **CRITICAL:** CRITIC's task stays `in_progress` (CRITIC does NOT send `[DONE]` on rejection). Do NOT unblock QA-B. Reset `qa_b`, `judge_g1_pass2`, `judge_g2` tasks to `pending` if they were previously completed. Only when CRITIC sends `[CRITIC-APPROVED]` / `[DONE]` does the critic task complete and QA-B unblock. |
333
+ | QA-B | BEND or FEND | QA-B sends bug directly to dev. Dev fixes. QA-B re-runs. | Reset `judge_g1_pass2` and `judge_g2` tasks to `pending` until QA-B re-completes. |
334
+ | JUDGE G1 Pass 2 | QA-B (reclassified bugs) | G1 routes reclassified bugs to devs via QA-B. | Reset `judge_g2` to `pending`. |
322
335
 
323
- | Source | Target | Flow |
324
- |--------|--------|------|
325
- | JUDGE G1 Pass 1 | REQS, UXA, or QA-A | G1 sends rejection directly to failed agent. Agent revises and re-triggers downstream chain. |
326
- | CRITIC | BEND or FEND | CRITIC sends rejection directly to dev. Dev fixes. CRITIC re-reviews. |
327
- | QA-B | BEND or FEND | QA-B sends bug directly to dev. Dev fixes. QA-B re-runs. |
328
- | JUDGE G1 Pass 2 | QA-B (reclassified bugs) | G1 routes reclassified bugs to devs via QA-B. |
336
+ **Why downstream reset matters:** Without resetting downstream tasks, a rejection cycle allows the old "completed" status to persist. QA-B, G1-P2, and G2 can run against stale artifacts from the first pass while CRITIC is still reviewing rework. This caused KANBAN-002 to ship with an unresolved High finding.
329
337
 
330
338
  **Lead-owned (you take action):**
331
339
 
@@ -15,14 +15,20 @@ Complete all sections using `.valent-pipeline/templates/critic-review.template.m
15
15
 
16
16
  **REJECTED (High):**
17
17
  1. Route each High to responsible agent (BEND/FEND) per Rejection Routing table.
18
- 2. Send: `[CRITIC-REJECTION] {count} High findings targeting {agent}. See critic-review.md#high.`
19
- 3. On resubmit: delta review only. Previous Low with `defer`/`accept` disposition skip re-review.
18
+ 2. Send to responsible agent: `[CRITIC-REJECTION] {count} High findings targeting {agent}. See critic-review.md#high.`
19
+ 3. Send to Lead: `[CRITIC-REJECTION] Rejected with {count} High findings. Awaiting rework from {agent}.`
20
+ 4. Do NOT send `[DONE]` or `[HANDOFF]`. Do NOT mark your task as completed. Your task stays `in_progress` until the rework cycle resolves.
21
+ 5. On resubmit: delta review only. Previous Low with `defer`/`accept` disposition skip re-review. Return to triage step and re-evaluate verdict.
20
22
 
21
23
  **REJECTED (unresolved Med):**
22
24
  1. Route each unresolved Med to responsible agent.
23
- 2. Send: `[CRITIC-REJECTION] {count} unresolved Med findings targeting {agent}. See critic-review.md#med.`
24
- 3. Dev must fix OR provide written rationale. CRITIC re-reviews rationale sufficiency.
25
+ 2. Send to responsible agent: `[CRITIC-REJECTION] {count} unresolved Med findings targeting {agent}. See critic-review.md#med.`
26
+ 3. Send to Lead: `[CRITIC-REJECTION] Rejected with {count} unresolved Med findings. Awaiting rework.`
27
+ 4. Do NOT send `[DONE]` or `[HANDOFF]`. Task stays `in_progress`.
28
+ 5. Dev must fix OR provide written rationale. CRITIC re-reviews rationale sufficiency.
25
29
 
26
30
  **APPROVED:**
27
- 1. Send: `[DONE] Review approved. See critic-review.md#verdict.`
28
- 2. Include Med rationales and Low dispositions in verdict summary for audit trail.
31
+ 1. Send to QA-B: `[CRITIC-APPROVED] Review approved. See critic-review.md#verdict.`
32
+ 2. Send to Lead: `[DONE] Review approved. See critic-review.md#verdict.`
33
+ 3. Mark your task as completed. This unblocks QA-B.
34
+ 4. Include Med rationales and Low dispositions in verdict summary for audit trail.
@@ -170,6 +170,13 @@ All three agents run in parallel using `model: "haiku"` to minimize cost. Collec
170
170
 
171
171
  If the repo is empty or brand new (no source code yet), skip the subagents and create minimal placeholder files noting "No existing code detected — Knowledge Agent will update these as stories ship."
172
172
 
173
+ ### Step 7b: Initialize and Populate Knowledge Database
174
+
175
+ After writing the curated knowledge files:
176
+ 1. Run `valent-pipeline db init` to create the SQLite database if it doesn't exist
177
+ 2. Run `npx tsx .valent-pipeline/scripts/embed-sqlite.ts --rebuild --db-path .valent-pipeline/pipeline.db --stories-dir ./stories` to index any existing story artifacts
178
+ 3. The database is now ready for the Knowledge Agent to query during story execution
179
+
173
180
  ## Step 8: Report
174
181
 
175
182
  After writing all files, summarize: