feat: add templates for epics, product brief, and requirements PRD

- Created a new directory structure for epics and stories with templates for individual epics and an index file.
- Added a product brief template for generating product brief documents in Phase 2.
- Introduced a requirements PRD template for generating a Product Requirements Document as a directory of individual requirement files in Phase 3.

feat: implement V2PipelineTab component for Memory V2 management

- Developed the V2PipelineTab component to manage extraction and consolidation processes.
- Included ExtractionCard and ConsolidationCard components to handle respective functionalities.
- Added JobsList component to display job statuses and allow filtering by job kind.

feat: create hooks for Memory V2 pipeline

- Implemented custom hooks for managing extraction and consolidation statuses, as well as job listings.
- Added mutation hooks to trigger extraction and consolidation processes with automatic query invalidation on success.
This commit is contained in:
catlog22
2026-02-27 13:27:27 +08:00
parent 99a3561f71
commit dd72e95e4d
57 changed files with 11018 additions and 1915 deletions

View File

@@ -84,7 +84,7 @@ EXPECTED: JSON with: problem_statement, target_users[], domain, constraints[], e
```
Task({
subagent_type: "Explore",
subagent_type: "cli-explore-agent",
run_in_background: false,
description: "Explore general context",
prompt: "Explore codebase for: <topic>
@@ -139,10 +139,25 @@ Task({
```
**Discuss result handling**:
- `consensus_reached` -> include in report, proceed normally
- `consensus_blocked` -> flag in SendMessage, coordinator decides next step
**Report**: complexity, codebase presence, problem statement, exploration dimensions, discuss verdict, output paths.
| Verdict | Severity | Action |
|---------|----------|--------|
| consensus_reached | - | Include action items in report, proceed to Phase 5 |
| consensus_blocked | HIGH | Phase 5 SendMessage includes structured consensus_blocked format (see below). Do NOT self-revise. |
| consensus_blocked | MEDIUM | Phase 5 SendMessage includes warning. Proceed normally. |
| consensus_blocked | LOW | Treat as consensus_reached with notes. |
**consensus_blocked SendMessage format**:
```
[analyst] RESEARCH-001 complete. Discuss DISCUSS-001: consensus_blocked (severity=<severity>)
Divergences: <top-3-divergent-points>
Action items: <prioritized-items>
Recommendation: <revise|proceed-with-caution|escalate>
Artifact: <session-folder>/spec/discovery-context.json
Discussion: <session-folder>/discussions/DISCUSS-001-discussion.md
```
**Report**: complexity, codebase presence, problem statement, exploration dimensions, discuss verdict + severity, output paths.
**Success**: Both JSON files created; discuss record written; design-intelligence.json created if UI mode.

View File

@@ -170,6 +170,80 @@ When a worker has unexpected status (not completed, not in_progress):
2. Log via team_msg (type: error)
3. Report to user: task reset, will retry on next resume
### Fast-Advance Failure Recovery
When coordinator detects a fast-advanced task has failed (task in_progress but no callback and worker gone):
```
handleCallback / handleResume detects:
+- Task is in_progress (was fast-advanced by predecessor)
+- No active_worker entry for this task
+- Original fast-advancing worker has already completed and exited
+- Resolution:
1. TaskUpdate -> reset task to pending
2. Remove stale active_worker entry (if any)
3. Log via team_msg (type: error, summary: "Fast-advanced task <ID> failed, resetting for retry")
4. -> handleSpawnNext (will re-spawn the task normally)
```
**Detection in handleResume**:
```
For each in_progress task in TaskList():
+- Has matching active_worker? -> normal, skip
+- No matching active_worker? -> orphaned (likely fast-advance failure)
+- Check creation time: if > 5 minutes with no progress callback
+- Reset to pending -> handleSpawnNext
```
**Prevention**: Fast-advance failures are self-healing. The coordinator reconciles orphaned tasks on every `resume`/`check` cycle. No manual intervention required unless the same task fails repeatedly (3+ resets -> escalate to user).
### Consensus-Blocked Handling
When a produce role reports `consensus_blocked` in its callback:
```
handleCallback receives message with consensus_blocked flag
+- Extract: divergence_severity, blocked_round, action_recommendation
+- Route by severity:
|
+- severity = HIGH (rating <= 2 or critical risk)
| +- Is this DISCUSS-006 (final sign-off)?
| | +- YES -> PAUSE: output warning, wait for user `resume` with decision
| | +- NO -> Create REVISION task:
| | +- Same role, same doc type, incremented suffix (e.g., DRAFT-001-R1)
| | +- Description includes: divergence details + action items from discuss
| | +- blockedBy: none (immediate execution)
| | +- Max 1 revision per task (DRAFT-001 -> DRAFT-001-R1, no R2)
| | +- If already revised once -> PAUSE, escalate to user
| +- Update session: mark task as "revised", log revision chain
|
+- severity = MEDIUM (rating spread or single low rating)
| +- Proceed with warning: include divergence in next task's context
| +- Log action items to wisdom/issues.md for downstream awareness
| +- Normal handleSpawnNext
|
+- severity = LOW (minor suggestions only)
+- Proceed normally: treat as consensus_reached with notes
+- Normal handleSpawnNext
```
**Revision task template** (for HIGH severity):
```
TaskCreate({
subject: "<ORIGINAL-ID>-R1",
description: "Revision of <ORIGINAL-ID>: address consensus-blocked divergences.\n
Session: <session-folder>\n
Original artifact: <artifact-path>\n
Divergences:\n<divergence-details>\n
Action items:\n<action-items-from-discuss>\n
InlineDiscuss: <same-round-id>",
owner: "<same-role>",
status: "pending"
})
```
## Phase 4: Validation
| Check | Criteria |
@@ -179,6 +253,8 @@ When a worker has unexpected status (not completed, not in_progress):
| Pipeline completeness | All expected tasks exist per mode |
| Completion detection | readySubjects=0 + inProgressSubjects=0 -> PIPELINE_COMPLETE |
| Fast-advance tracking | Detect tasks already in_progress via fast-advance, sync to active_workers |
| Fast-advance orphan check | in_progress tasks without active_worker entry -> reset to pending |
| Consensus-blocked routing | HIGH -> revision/pause, MEDIUM -> warn+proceed, LOW -> proceed |
## Error Handling
@@ -189,3 +265,7 @@ When a worker has unexpected status (not completed, not in_progress):
| All workers still running on resume | Report status, suggest check later |
| Pipeline stall (no ready, no running) | Check for missing tasks, report to user |
| Fast-advance conflict | Coordinator reconciles, no duplicate spawns |
| Fast-advance task orphaned | Reset to pending, re-spawn via handleSpawnNext |
| consensus_blocked HIGH | Create revision task (max 1) or pause for user |
| consensus_blocked MEDIUM | Proceed with warning, log to wisdom/issues.md |
| Revision task also blocked | Escalate to user, pause pipeline |

View File

@@ -83,7 +83,7 @@ For each uncached angle, call the shared explore subagent:
```
Task({
subagent_type: "Explore",
subagent_type: "cli-explore-agent",
run_in_background: false,
description: "Explore: <angle>",
prompt: "Explore codebase for: <task-description>

View File

@@ -105,15 +105,16 @@ Requirements: 2-7 tasks with id, title, files[].change, convergence.criteria, de
**Session files**:
```
<session-folder>/explorations/ (shared cache, written by explore subagent)
+-- cache-index.json
+-- explore-<angle>.json
<session-folder>/plan/
+-- exploration-<angle>.json (per angle, from shared cache)
+-- explorations-manifest.json (summary)
+-- explorations-manifest.json (summary, references ../explorations/)
+-- plan.json
+-- .task/TASK-*.json
```
Note: exploration files may be symlinked or referenced from `<session-folder>/explorations/` (shared cache location).
---
## Error Handling

View File

@@ -118,8 +118,25 @@ Task({
```
**Discuss result handling**:
- `consensus_reached` -> include in quality report as final endorsement
- `consensus_blocked` -> flag in SendMessage, report specific divergences
| Verdict | Severity | Action |
|---------|----------|--------|
| consensus_reached | - | Include as final endorsement in quality report, proceed to Phase 5 |
| consensus_blocked | HIGH | **DISCUSS-006 is final sign-off gate**. Phase 5 SendMessage includes structured format. Coordinator always pauses for user decision. |
| consensus_blocked | MEDIUM | Phase 5 SendMessage includes warning. Proceed to Phase 5. Coordinator logs to wisdom. |
| consensus_blocked | LOW | Treat as consensus_reached with notes. |
**consensus_blocked SendMessage format**:
```
[reviewer] QUALITY-001 complete. Discuss DISCUSS-006: consensus_blocked (severity=<severity>)
Divergences: <top-3-divergent-points>
Action items: <prioritized-items>
Recommendation: <revise|proceed-with-caution|escalate>
Artifact: <session-folder>/spec/readiness-report.md
Discussion: <session-folder>/discussions/DISCUSS-006-discussion.md
```
> **Note**: DISCUSS-006 HIGH always triggers user pause regardless of revision count, since this is the spec->impl gate.
---

View File

@@ -19,10 +19,10 @@ Multi-CLI document generation for 4 document types. Each uses parallel or staged
| Doc Type | Task | Template | Discussion Input | Output |
|----------|------|----------|-----------------|--------|
| product-brief | DRAFT-001 | templates/product-brief.md | discuss-001-scope.md | spec/product-brief.md |
| requirements | DRAFT-002 | templates/requirements-prd.md | discuss-002-brief.md | spec/requirements/_index.md |
| architecture | DRAFT-003 | templates/architecture-doc.md | discuss-003-requirements.md | spec/architecture/_index.md |
| epics | DRAFT-004 | templates/epics-template.md | discuss-004-architecture.md | spec/epics/_index.md |
| product-brief | DRAFT-001 | templates/product-brief.md | DISCUSS-001-discussion.md | spec/product-brief.md |
| requirements | DRAFT-002 | templates/requirements-prd.md | DISCUSS-002-discussion.md | spec/requirements/_index.md |
| architecture | DRAFT-003 | templates/architecture-doc.md | DISCUSS-003-discussion.md | spec/architecture/_index.md |
| epics | DRAFT-004 | templates/epics-template.md | DISCUSS-004-discussion.md | spec/epics/_index.md |
### Progressive Dependencies

View File

@@ -118,10 +118,25 @@ Task({
```
**Discuss result handling**:
- `consensus_reached` -> include action items in report
- `consensus_blocked` -> flag in SendMessage, include divergence details
**Report**: doc type, validation status, discuss verdict, average rating, summary, output path.
| Verdict | Severity | Action |
|---------|----------|--------|
| consensus_reached | - | Include action items in report, proceed to Phase 5 |
| consensus_blocked | HIGH | Phase 5 SendMessage includes structured consensus_blocked format (see below). Do NOT self-revise -- coordinator creates revision task. |
| consensus_blocked | MEDIUM | Phase 5 SendMessage includes warning. Proceed to Phase 5 normally. |
| consensus_blocked | LOW | Treat as consensus_reached with notes. |
**consensus_blocked SendMessage format**:
```
[writer] <task-id> complete. Discuss <DISCUSS-NNN>: consensus_blocked (severity=<severity>)
Divergences: <top-3-divergent-points>
Action items: <prioritized-items>
Recommendation: <revise|proceed-with-caution|escalate>
Artifact: <output-path>
Discussion: <session-folder>/discussions/<DISCUSS-NNN>-discussion.md
```
**Report**: doc type, validation status, discuss verdict + severity, average rating, summary, output path.
---