opencastle 0.32.5 → 0.32.6

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 (69) hide show
  1. package/README.md +13 -3
  2. package/bin/cli.mjs +2 -0
  3. package/package.json +1 -1
  4. package/src/dashboard/node_modules/.vite/deps/_metadata.json +6 -6
  5. package/src/orchestrator/agents/api-designer.agent.md +25 -34
  6. package/src/orchestrator/agents/architect.agent.md +40 -84
  7. package/src/orchestrator/agents/content-engineer.agent.md +29 -31
  8. package/src/orchestrator/agents/copywriter.agent.md +35 -60
  9. package/src/orchestrator/agents/data-expert.agent.md +24 -30
  10. package/src/orchestrator/agents/database-engineer.agent.md +26 -31
  11. package/src/orchestrator/agents/developer.agent.md +32 -34
  12. package/src/orchestrator/agents/devops-expert.agent.md +31 -26
  13. package/src/orchestrator/agents/documentation-writer.agent.md +29 -29
  14. package/src/orchestrator/agents/performance-expert.agent.md +36 -33
  15. package/src/orchestrator/agents/release-manager.agent.md +25 -34
  16. package/src/orchestrator/agents/researcher.agent.md +41 -95
  17. package/src/orchestrator/agents/reviewer.agent.md +24 -34
  18. package/src/orchestrator/agents/security-expert.agent.md +35 -39
  19. package/src/orchestrator/agents/seo-specialist.agent.md +25 -32
  20. package/src/orchestrator/agents/session-guard.agent.md +20 -79
  21. package/src/orchestrator/agents/team-lead.agent.md +50 -254
  22. package/src/orchestrator/agents/testing-expert.agent.md +37 -49
  23. package/src/orchestrator/agents/ui-ux-expert.agent.md +33 -39
  24. package/src/orchestrator/customizations/KNOWN-ISSUES.md +0 -1
  25. package/src/orchestrator/customizations/agents/skill-matrix.json +12 -0
  26. package/src/orchestrator/instructions/general.instructions.md +24 -84
  27. package/src/orchestrator/plugins/astro/SKILL.md +23 -179
  28. package/src/orchestrator/plugins/convex/SKILL.md +38 -12
  29. package/src/orchestrator/plugins/netlify/SKILL.md +17 -13
  30. package/src/orchestrator/plugins/nextjs/SKILL.md +55 -261
  31. package/src/orchestrator/plugins/nx/SKILL.md +20 -72
  32. package/src/orchestrator/plugins/playwright/SKILL.md +5 -17
  33. package/src/orchestrator/plugins/slack/SKILL.md +28 -190
  34. package/src/orchestrator/plugins/teams/SKILL.md +10 -140
  35. package/src/orchestrator/plugins/vitest/SKILL.md +2 -2
  36. package/src/orchestrator/prompts/bug-fix.prompt.md +25 -63
  37. package/src/orchestrator/prompts/implement-feature.prompt.md +29 -66
  38. package/src/orchestrator/prompts/quick-refinement.prompt.md +31 -66
  39. package/src/orchestrator/skills/accessibility-standards/SKILL.md +50 -105
  40. package/src/orchestrator/skills/agent-hooks/SKILL.md +60 -110
  41. package/src/orchestrator/skills/agent-memory/SKILL.md +44 -93
  42. package/src/orchestrator/skills/api-patterns/SKILL.md +20 -68
  43. package/src/orchestrator/skills/code-commenting/SKILL.md +49 -101
  44. package/src/orchestrator/skills/context-map/SKILL.md +47 -88
  45. package/src/orchestrator/skills/data-engineering/SKILL.md +27 -74
  46. package/src/orchestrator/skills/decomposition/SKILL.md +50 -98
  47. package/src/orchestrator/skills/deployment-infrastructure/SKILL.md +44 -107
  48. package/src/orchestrator/skills/documentation-standards/SKILL.md +28 -89
  49. package/src/orchestrator/skills/fast-review/SKILL.md +51 -276
  50. package/src/orchestrator/skills/frontend-design/SKILL.md +53 -163
  51. package/src/orchestrator/skills/git-workflow/SKILL.md +18 -54
  52. package/src/orchestrator/skills/memory-merger/SKILL.md +51 -88
  53. package/src/orchestrator/skills/observability-logging/SKILL.md +29 -75
  54. package/src/orchestrator/skills/orchestration-protocols/SKILL.md +58 -117
  55. package/src/orchestrator/skills/panel-majority-vote/SKILL.md +65 -140
  56. package/src/orchestrator/skills/performance-optimization/SKILL.md +21 -85
  57. package/src/orchestrator/skills/project-consistency/SKILL.md +62 -281
  58. package/src/orchestrator/skills/react-development/SKILL.md +38 -86
  59. package/src/orchestrator/skills/security-hardening/SKILL.md +40 -84
  60. package/src/orchestrator/skills/self-improvement/SKILL.md +26 -60
  61. package/src/orchestrator/skills/seo-patterns/SKILL.md +40 -105
  62. package/src/orchestrator/skills/session-checkpoints/SKILL.md +26 -68
  63. package/src/orchestrator/skills/team-lead-reference/SKILL.md +66 -206
  64. package/src/orchestrator/skills/testing-workflow/SKILL.md +42 -112
  65. package/src/orchestrator/skills/validation-gates/SKILL.md +39 -170
  66. package/src/orchestrator/snippets/base-output-contract.md +14 -0
  67. package/src/orchestrator/snippets/discovered-issues-policy.md +15 -0
  68. package/src/orchestrator/snippets/logging-mandatory.md +11 -0
  69. package/src/orchestrator/snippets/never-expose-secrets.md +22 -0
@@ -3,25 +3,19 @@ name: session-checkpoints
3
3
  description: "Protocol for saving and restoring session state across agent sessions. Enables replay, fork, and resume of interrupted work — inspired by Sandcastle Run Time Machine."
4
4
  ---
5
5
 
6
- <!-- ⚠️ This file is managed by OpenCastle. Edits will be overwritten on update. Customize in the .opencastle/ directory instead. -->
7
-
8
6
  # Skill: Session Checkpoints
9
7
 
10
- Use this skill when working on multi-session features or when a session may be interrupted. Checkpoints allow any future session to resume work without re-analyzing the entire codebase.
11
-
12
8
  ## When to Checkpoint
13
9
 
14
- Create a checkpoint:
15
-
16
- - **Before delegation** After decomposition but before first agent delegation
17
- - **After each phase** When a group of parallel tasks completes
18
- - **Before risky work** Before DB migrations, large refactors, or security changes
19
- - **On session end** Always checkpoint before ending a session with incomplete work
20
- - **On interruption** — If context is running low, checkpoint immediately
21
-
22
- ## Checkpoint Format
10
+ | Trigger | Action |
11
+ |---------|--------|
12
+ | Before first delegation | After decomposition, before agents start |
13
+ | After each phase | When a parallel batch completes |
14
+ | Before risky work | DB migrations, large refactors, security changes |
15
+ | Session end | Any session with incomplete work |
16
+ | Context running low | Checkpoint immediately |
23
17
 
24
- Create or update the file `.opencastle/SESSION-CHECKPOINT.md` with this structure:
18
+ ## Checkpoint Format (`.opencastle/SESSION-CHECKPOINT.md`)
25
19
 
26
20
  ```markdown
27
21
  # Session Checkpoint
@@ -29,105 +23,69 @@ Create or update the file `.opencastle/SESSION-CHECKPOINT.md` with this structur
29
23
  **Last Updated:** YYYY-MM-DD HH:MM
30
24
  **Feature:** Short feature name
31
25
  **Branch:** git branch name
32
- **Tracker Issues:** TAS-XX, TAS-YY, TAS-ZZ
26
+ **Tracker Issues:** TAS-XX, TAS-YY
33
27
 
34
28
  ## Current Phase
35
29
 
36
- Phase N of M — Brief description of what this phase does
37
-
38
30
  ## Completed Work
39
31
 
40
32
  | Task | Tracker | Agent | Status | Files |
41
33
  |------|---------|-------|--------|-------|
42
- | Description | TAS-XX | Agent Name | ✅ Done | file1.ts, file2.ts |
43
- | Description | TAS-YY | Agent Name | ✅ Done | file3.ts |
34
+ | Description | TAS-XX | Agent | ✅ Done | file1.ts |
44
35
 
45
36
  ## In Progress
46
37
 
47
38
  | Task | Tracker | Agent | Status | Notes |
48
39
  |------|---------|-------|--------|-------|
49
- | Description | TAS-ZZ | Agent Name | 🔄 In Progress | What's been done so far |
40
+ | Description | TAS-ZZ | Agent | 🔄 In Progress | what's done |
50
41
 
51
42
  ## Remaining Work
52
43
 
53
44
  | Task | Tracker | Agent | Dependencies | Files |
54
45
  |------|---------|-------|-------------|-------|
55
- | Description | TAS-AA | Agent Name | TAS-ZZ | file4.ts, file5.ts |
46
+ | Description | TAS-AA | Agent | TAS-ZZ | file4.ts |
56
47
 
57
48
  ## Pending Approvals
58
49
 
59
- Approval requests posted to the messaging provider that haven't been answered yet.
60
- The `on-session-start` hook checks for replies when a new session begins.
61
-
62
50
  | Provider | Channel | Thread ID | Question | Posted At |
63
51
  |----------|---------|-----------|----------|-----------|
64
52
  | slack | C0AHAQFJ7C1 | 1772393542.345149 | Run migration on production? | 2026-03-01 14:30 |
65
53
 
66
- If the user answered in the VS Code chat during the previous session, remove
67
- the row from this table — the approval was already resolved.
68
-
69
- ## Key Decisions Made
70
-
71
- - Decision 1: Why this approach was chosen
72
- - Decision 2: Why alternative X was rejected
54
+ Remove row once answered (VS Code chat reply also counts as resolved).
73
55
 
74
- ## Blockers & Issues
56
+ ## Decisions & Blockers
75
57
 
76
- - Blocker 1: Description and what's needed to unblock
77
- - Issue found: DLQ-XXX reference if logged
58
+ - Decision: rationale
59
+ - Blocker: what's needed to unblock
78
60
 
79
61
  ## Delegation Cost Log
80
62
 
81
- Track each delegation to monitor budget and optimize future model assignments:
82
-
83
63
  | # | Agent | Tracker | Model Tier | Est. Tokens | Duration | Status |
84
- |---|-------|--------|------------|-------------|----------|--------|
64
+ |---|-------|---------|------------|-------------|----------|--------|
85
65
  | 1 | Content Engineer | TAS-XX | Standard | ~20K | 8 min | ✅ Done |
86
- | 2 | DB Engineer | TAS-YY | Standard | ~25K | 12 min | ✅ Done |
87
- | 3 | UI Expert | TAS-ZZ | Standard | ~30K | ❌ Failed → retry |
88
-
89
- **Running totals:** 3 delegations / ~75K tokens / 0 panel reviews
90
66
 
91
67
  ## File Partitions
92
68
 
93
69
  ```
94
70
  Agent A: dir1/, dir2/
95
- Agent B: dir3/, dir4/
96
- Agent C: .opencastle/
71
+ Agent B: dir3/
97
72
  ```
98
73
 
99
74
  ## Resume Instructions
100
75
 
101
- Step-by-step instructions for a new session to pick up where this one left off:
102
-
103
76
  1. Check out branch `feat/xxx`
104
- 2. Read tracker issues TAS-XX, TAS-YY for context
77
+ 2. Read tracker issues TAS-XX for context
105
78
  3. Start Phase N+1: [specific instructions]
106
79
  ```
107
80
 
108
- ## Resuming from a Checkpoint
109
-
110
- When starting a new session:
111
-
112
- 1. **Check for checkpoint** — Read `.opencastle/SESSION-CHECKPOINT.md` if it exists
113
- 2. **Verify state** — Run `git status`, check branch, verify files match checkpoint
114
- 3. **Check tracker** — List in-progress and todo issues for current feature
115
- 4. **Follow resume instructions** — Execute the specific steps listed in the checkpoint
116
- 5. **Update checkpoint** — After resuming, update the checkpoint with current progress
117
-
118
- ## Cleanup
119
-
120
- After a feature is fully complete (all tracker issues Done):
81
+ ## Resuming
121
82
 
122
- 1. Archive the checkpoint content to the relevant tracker issue comments
123
- 2. Delete `.opencastle/SESSION-CHECKPOINT.md` to keep the workspace clean
124
- 3. The next feature starts with a fresh checkpoint
83
+ Read checkpoint `git status` check tracker follow resume instructions → update progress.
125
84
 
126
- ## Integration with Team Lead
85
+ ## Cleanup & Team Lead
127
86
 
128
- The Team Lead should:
87
+ When all issues Done: archive to tracker, delete `.opencastle/SESSION-CHECKPOINT.md`.
129
88
 
130
- - Create a checkpoint after Step 2 (Decompose & Partition) of the Decomposition Flow
131
- - Update the checkpoint after each verification pass
132
- - Include checkpoint reading in session resume workflow
133
- - Reference the checkpoint file in delegation prompts for context
89
+ - Checkpoint after decomposition (Step 2 of Decomposition Flow)
90
+ - Update after each verification pass
91
+ - Reference checkpoint in delegation prompts
@@ -3,206 +3,100 @@ name: team-lead-reference
3
3
  description: "Reference data for Team Lead orchestration — model routing, pre-delegation checks, cost tracking template, and DLQ format. Load when starting a delegation session."
4
4
  ---
5
5
 
6
- <!-- ⚠️ This file is managed by OpenCastle. Edits will be overwritten on update. Customize in the .opencastle/ directory instead. -->
7
-
8
6
  # Team Lead Reference
9
7
 
10
8
  For the specialist agent registry and model assignments, see [agent-registry.md](../../.opencastle/agents/agent-registry.md).
11
9
 
12
10
  ## Cost-Aware Model Routing
13
11
 
14
- Choose models deliberately based on task complexity. Not every task needs the most expensive model.
15
-
16
- ### Model Cost Tiers
17
-
18
12
  | Tier | Cost | Use For |
19
13
  |------|------|---------|
20
14
  | **Premium** | $$$$ | Team Lead orchestration, highest-stakes decisions |
21
- | **Quality** | $$$ | Feature implementation, UI/frontend, security audits, architecture, complex reasoning |
22
- | **Standard** | $$ | Large-scale analysis, schema design, cost-efficient coding, repo-level exploration |
15
+ | **Quality** | $$$ | Feature implementation, UI/frontend, security, architecture, complex reasoning |
16
+ | **Standard** | $$ | Large-scale analysis, schema design, cost-efficient coding, repo exploration |
23
17
  | **Fast** | $$ | Terminal-heavy tasks, E2E tests, data pipelines, agentic workflows |
24
- | **Economy** | $ | Documentation, simple config changes, formatting, boilerplate |
18
+ | **Economy** | $ | Docs, simple config, formatting, boilerplate |
25
19
 
26
- ### Selection Rules
27
-
28
- 1. **Default to the agent's assigned model** — the registry maps tasks to appropriate tiers
29
- 2. **Downgrade when possible** — If a task is pure docs/config with no reasoning needed, prefer Economy tier
30
- 3. **Upgrade for ambiguity** — If the task involves security, architecture decisions, or complex tradeoffs, use Quality/Premium
31
- 4. **Never use Premium/Quality for boilerplate** — Writing test scaffolding, updating docs, or config changes should use Economy/Fast/Standard
32
- 5. **Parallel sub-agents are cost multipliers** — When firing 3+ parallel sub-agents, prefer Economy/Fast/Standard unless precision is critical
20
+ **Selection:** Default to agent's assigned tier. Downgrade pure docs/config → Economy. Upgrade security/architecture ambiguity → Quality/Premium. Never Premium/Quality for boilerplate. 3+ parallel agents → prefer Economy/Fast/Standard.
33
21
 
34
22
  ## Complexity-Based Task Scoring
35
23
 
36
- During decomposition, assign a **complexity score** (Fibonacci: 1, 2, 3, 5, 8, 13) to each subtask. The score determines which model tier handles the task.
37
-
38
- ### Scoring Criteria
39
-
40
- | Factor | Low (1-2) | Medium (3-5) | High (8-13) |
41
- |--------|-----------|--------------|-------------|
42
- | **Files touched** | 1-2 files | 3-5 files | 6+ files or cross-library |
43
- | **Reasoning depth** | Mechanical / boilerplate | Pattern matching, moderate logic | Architecture decisions, security, tradeoffs |
44
- | **Ambiguity** | Clear spec, obvious approach | Some judgment calls | Multiple valid approaches, needs exploration |
45
- | **Risk** | No data loss, easily reversible | Moderate impact, testable | DB migrations, auth changes, breaking changes |
46
- | **Dependencies** | None | 1-2 upstream tasks | Complex dependency chain |
47
-
48
- ### Score to Model Tier Mapping
24
+ | Factor | Low High |
25
+ |--------|------------|
26
+ | **Files touched** | 1–2 → 3–5 → 6+ / cross-library |
27
+ | **Reasoning depth** | Boilerplate → pattern matching → architecture/security/tradeoffs |
28
+ | **Ambiguity** | Clear spec some judgment multiple valid approaches |
29
+ | **Risk** | Reversible → moderate impact → DB/auth/breaking |
30
+ | **Dependencies** | None → 12 upstream complex chain |
49
31
 
50
32
  | Score | Tier | Examples |
51
33
  |-------|------|----------|
52
- | **1-2** | Economy/Fast | Docs update, config tweak, rename, simple test |
53
- | **3-5** | Standard/Quality | Component build, CMS query, API route, migration |
54
- | **8** | Quality | Architecture decision, security audit, complex refactor |
55
- | **13** | Quality + Panel | DB migration with data transform, auth flow redesign |
56
-
57
- ### Override Rules
34
+ | 12 | Economy/Fast | Docs update, config tweak, rename, simple test |
35
+ | 35 | Standard/Quality | Component, CMS query, API route, migration |
36
+ | 8 | Quality | Architecture decision, security audit, complex refactor |
37
+ | 13 | Quality + Panel | DB migration with data transform, auth flow redesign |
58
38
 
59
- - **Blocker tasks** (blocking 2+ downstream tasks): Upgrade one tier regardless of score
60
- - **Security-touching tasks**: Always Quality or higher, regardless of score
61
- - **Pure documentation**: Always Economy, regardless of estimated scope
62
- - The agent registry default model takes precedence unless the task complexity clearly warrants an upgrade/downgrade
39
+ **Overrides:** Blocker (blocking 2+ downstream) upgrade one tier. Security-touching Quality+. Pure docs → Economy. Registry default takes precedence unless complexity clearly warrants change.
63
40
 
64
41
  ## Deepen-Plan Protocol
65
42
 
66
- After initial decomposition, **enrich the plan** with concrete codebase evidence before delegating. This prevents agents from wasting time on discovery that the Team Lead can do upfront.
67
-
68
- ### When to Deepen
69
-
70
43
  | Plan Complexity | Action |
71
44
  |----------------|--------|
72
- | 1-2 subtasks, familiar area | Skip — proceed directly to delegation |
73
- | 3-5 subtasks, mixed familiarity | Quick deepen — single Researcher sub-agent |
74
- | 6+ subtasks, unfamiliar area | Full deepen — parallel Researcher sub-agents |
75
-
76
- ### Quick Deepen (Single Researcher)
45
+ | 12 subtasks, familiar | Skip — delegate directly |
46
+ | 35 subtasks, mixed | Quick deepen — single Researcher sub-agent |
47
+ | 6+ subtasks, unfamiliar | Full deepen — parallel Researcher sub-agents |
77
48
 
78
- Fire one **Researcher** sub-agent with this prompt:
79
-
80
- ```
81
- Research the following planned subtasks and enrich each with:
82
- 1. Exact file paths and line numbers for code that will change
83
- 2. Existing patterns to follow (with file:line examples)
84
- 3. Related lessons from .opencastle/LESSONS-LEARNED.md
85
- 4. Risks or blockers (missing dependencies, known issues)
86
-
87
- Subtasks:
88
- - [Subtask 1 description]
89
- - [Subtask 2 description]
90
- - ...
91
-
92
- Return a structured report per subtask.
93
- ```
94
-
95
- ### Full Deepen (Parallel Researchers)
96
-
97
- For large plans, split research by domain and fire parallel Researcher sub-agents. See [agent-registry.md](../../.opencastle/agents/agent-registry.md) for project-specific scope examples.
98
-
99
- ### What Deepening Produces
100
-
101
- After deepening, each subtask in the plan should have:
49
+ **Quick deepen:** Fire one Researcher for exact file paths & line numbers, patterns to follow (file:line examples), relevant lessons from `LESSONS-LEARNED.md`, and risks/blockers per subtask.
50
+ **Full deepen:** Split by domain into parallel Researchers. See [agent-registry.md](../../.opencastle/agents/agent-registry.md) for scope examples.
102
51
 
103
52
  | Field | Before Deepen | After Deepen |
104
- |-------|--------------|--------------|
105
- | **Files** | "some component" | Exact file path with line range |
106
- | **Pattern** | "follow existing style" | Specific file:line reference to follow |
53
+ |-------|--------------|------------------|
54
+ | **Files** | "some component" | Exact path + line range |
55
+ | **Pattern** | "follow existing style" | Specific file:line reference |
107
56
  | **Risks** | unknown | Known issues identified |
108
57
  | **Lessons** | unchecked | Relevant lessons applied |
109
58
  | **Dependencies** | assumed | Verified with exact imports |
110
59
 
111
- ### Integrating Results
60
+ ## Agent Output Status Handling
112
61
 
113
- Take the Researcher output and update delegation prompts with concrete file paths, patterns, and lessons. This transforms vague prompts into precise instructions that agents can execute without discovery overhead.
62
+ | Status | Action |
63
+ |--------|--------|
64
+ | Complete | All AC addressed → fast review |
65
+ | Complete with concerns | Resolve correctness/scope before review |
66
+ | Needs context | Provide info, re-dispatch same agent |
67
+ | Blocked | Provide context/upgrade model/escalate; never re-dispatch unchanged |
114
68
 
115
69
  ## Pre-Delegation Policy Checks
116
70
 
117
- See the Team Lead agent file § Pre-Delegation Checks for the mandatory 5-point checklist (tracker issue, file partition, dependencies, prompt specifics, self-improvement reminder).
118
-
119
- **Additional checks for feature work:** (6) Known issues reviewed, (7) Architecture docs read, (8) Existing code searched.
120
-
121
- **Additional checks for high-risk work:** (9) Panel review planned, (10) Rollback path identified.
122
-
123
- ## Cost Tracking Convention
124
-
125
- After completing a feature (all tracker issues Done), add a cost summary to the roadmap update:
126
-
127
- ```markdown
128
- **Cost Summary:**
129
- | Metric | Value |
130
- |--------|-------|
131
- | Sub-agent delegations | X |
132
- | Background agent delegations | X |
133
- | Panel reviews | X |
134
- | Model tiers used | Premium: X, Standard: X, Utility: X, Economy: X |
135
- | Upgrades/downgrades | [reason if any] |
136
- | Est. total tokens | ~XXK |
71
+ See Team Lead agent § Pre-Delegation Checks for the mandatory 5-point checklist.
72
+ - **Feature work** adds: (6) Known issues reviewed, (7) Architecture docs read, (8) Existing code searched.
73
+ - **High-risk work** adds: (9) Panel review planned, (10) Rollback path identified.
74
+
75
+ ## Compact Delegation Envelope
76
+
77
+ ```json
78
+ {
79
+ "tracker": "TAS-XX",
80
+ "agent": "Agent Name",
81
+ "objective": "One sentence: what to do and why.",
82
+ "files": ["path/to/file.ts", "path/to/other.ts"],
83
+ "acceptance_criteria": ["AC 1", "AC 2"],
84
+ "constraints": "Only modify listed files. Read LESSONS-LEARNED.md first.",
85
+ "output_contract": "Return: files changed, lint/type/test pass/fail, discovered issues."
86
+ }
137
87
  ```
138
88
 
139
- This data helps optimize future model assignments. If no meaningful data was collected, skip the summary.
140
-
141
- During execution, maintain a running delegation log in the session checkpoint (see the **session-checkpoints** skill § Delegation Cost Log). Update it after each delegation completes or fails.
89
+ `tracker` required; `acceptance_criteria` verbatim from tracker; `files` = exact resolved paths (not globs); `output_contract` = agent's Base Output Contract. Maintain running delegation log in session checkpoint (see **session-checkpoints** skill).
142
90
 
143
91
  ## Context Source Tagging
144
92
 
145
- When collecting results from multiple sub-agents or background agents, **tag each result by its source** to prevent context confusion:
146
-
147
- ```markdown
148
- ### [Content Engineer] TAS-42 Schema
149
- - Created `schemas/review.ts` with star rating field
150
- - Deployed to CMS studio
151
- - Verification: lint ✅, type-check ✅
152
-
153
- ### [DB Engineer] TAS-43 Migration
154
- - Created migration file for reviews table
155
- - RLS policies for authenticated users
156
- - Verification: migration applied ✅, tests ✅
157
- ```
158
-
159
- **Rules:**
160
- - Prefix each agent's output summary with `### [Agent Name] TAS-XX Description`
161
- - Never merge outputs from different agents into a single undifferentiated block
162
- - When referencing prior agent output in a delegation prompt, cite the source: *"The Content Engineer created `schemas/review.ts` — follow that pattern"*
163
- - In the session checkpoint "Completed Work" table, always include the Agent column
164
-
165
- This prevents the Team Lead from confusing which agent produced what, especially after 5+ delegations when context is dense.
93
+ Prefix each agent's output summary `### [Agent Name] TAS-XX Description`. Never merge outputs from different agents. Cite source agent when referencing prior output. Include Agent column in checkpoint "Completed Work" tables.
166
94
 
167
95
  ## Dead Letter Queue Format
168
96
 
169
- Log to `.opencastle/AGENT-FAILURES.md` when:
170
- - A delegated agent fails to complete its task after 2+ attempts
171
- - A background agent produces output that fails all verification gates
172
- - An agent encounters an unrecoverable error (e.g., MCP server down, tool unavailable)
173
-
174
- > **Note:** When a panel review BLOCKs 3 times, create a **dispute record** instead of a DLQ entry. See § Dispute Protocol below.
175
-
176
- ### Failure Entry Format
177
-
178
- ```markdown
179
- ### DLQ-XXX: Short description
180
-
181
- | Field | Value |
182
- |-------|-------|
183
- | **Date** | YYYY-MM-DD |
184
- | **Agent** | Agent name |
185
- | **Tracker Issue** | TAS-XX (if applicable) |
186
- | **Failure Type** | `verification-fail` / `tool-error` / `panel-block` / `timeout` / `scope-creep` |
187
- | **Attempts** | Number of attempts before logging |
188
- | **Est. Tokens Spent** | ~XXK across all attempts |
189
- | **Model Tier** | Economy / Utility / Standard / Premium |
190
-
191
- **Task:** What was the agent supposed to do?
192
-
193
- **Failure Details:** What went wrong? Include error messages, failed checks, or panel BLOCK reasons.
97
+ Log to `.opencastle/AGENT-FAILURES.md` when agent fails 2+ attempts, background output fails all gates, or unrecoverable error occurs. Panel 3x BLOCK → create dispute instead.
194
98
 
195
- **Root Cause:** Why did it fail? (if known)
196
-
197
- **Resolution:** How was it eventually resolved? (or "pending" if unresolved)
198
- ```
199
-
200
- ### Review Cadence
201
-
202
- At the start of each session, scan the agent failures doc for:
203
- - **Pending failures** that need retry
204
- - **Patterns** — same agent failing repeatedly may indicate a prompt or skill issue
205
- - **Tool issues** — MCP servers or external dependencies that need attention
99
+ Entry (`DLQ-XXX: Short description`): **Date**, **Agent**, **Tracker Issue**, **Failure Type** (`verification-fail` / `tool-error` / `panel-block` / `timeout` / `scope-creep`), **Attempts**, **Task**, **Failure Details**, **Resolution**. Scan DLQ for pending retries at session start.
206
100
 
207
101
  ## Error Recovery
208
102
 
@@ -210,56 +104,22 @@ For common failure modes and recovery procedures, load the **orchestration-proto
210
104
 
211
105
  ## Dispute Protocol
212
106
 
213
- When automated resolution is exhausted (panel 3x BLOCK, approach conflicts, or criteria contradictions), create a **formal dispute record** in `.opencastle/DISPUTES.md`. Inspired by the [Steroids CLI](https://github.com/UnlikeOtherAI/steroids-cli) dispute/escalation pattern.
214
-
215
- ### When to Create a Dispute (vs. DLQ Entry)
216
-
217
107
  | Scenario | Action |
218
108
  |----------|--------|
219
- | Tool error, timeout, MCP failure | DLQ entry |
109
+ | Tool error / timeout / MCP failure | DLQ entry |
220
110
  | Scope creep | DLQ entry + redirect |
221
111
  | Agent fails 2+ times (simple) | DLQ entry |
222
- | Panel BLOCKs 3 times | **Dispute record** |
223
- | Agent and reviewer fundamentally disagree | **Dispute record** |
224
- | Acceptance criteria contradict each other | **Dispute record** |
225
- | Multiple valid approaches, agents can't converge | **Dispute record** |
226
- | Fix requires external/human action | **Dispute record** |
227
-
228
- ### Dispute Creation Procedure
229
-
230
- 1. **Number the dispute** Increment from the last `DSP-XXX` ID in the Index table
231
- 2. **Set priority** Use the priority guidelines in DISPUTES.md (critical/high/medium/low)
232
- 3. **Document both perspectives** — Agent's position AND reviewer's position with specific file/code references
233
- 4. **Build attempt history** List every fast review and panel attempt with one-line verdict summaries
234
- 5. **Present resolution options** — At least 2 concrete options with rationale and risk for each
235
- 6. **Recommend an action** — Which option the Team Lead thinks is best, with specific next steps
236
- 7. **Link artifacts** — Panel reports, review logs, changed files, DLQ entries
237
- 8. **Log to events.ndjson** — Use the **observability-logging** skill's dispute record command
238
- 9. **Update the tracker issue** — Add the dispute ID and link to the dispute record
239
- 10. **Update the Index table** — Add the new dispute to the bottom of the Index
240
-
241
- ### After Human Resolution
242
-
243
- When a human resolves a dispute:
244
- 1. Update the dispute `Status` → `resolved` or `deferred`
245
- 2. Record which option was chosen and any additional instructions
246
- 3. If `resolved` → re-delegate the task with the human's decision as an explicit constraint
247
- 4. If `deferred` → create a follow-up tracker issue and continue with other work
248
- 5. Log the resolution in `events.ndjson` using the **observability-logging** skill's dispute record command (update or append a resolution event)
249
-
250
- ### Session Start: Check Disputes
251
-
252
- At the start of each session, after checking the DLQ, also check `DISPUTES.md` for:
253
- - **Pending disputes** that a human has resolved since the last session → act on the resolution
254
- - **Critical/high disputes** that are still pending → flag to the user before proceeding
255
- - **Patterns** — recurring disputes may indicate a skill gap, ambiguous instructions, or a need for a new validation gate
256
-
257
- ## Background Agent Git Merge Strategy
258
-
259
- Background agents work in isolated Git worktrees. When merging their output:
260
-
261
- 1. **Merge order matters:** Merge the most foundational changes first (DB migrations -> queries -> components -> pages -> tests -> docs)
262
- 2. **Test after each merge:** Run affected tests after merging each agent's work
263
- 3. **Resolve conflicts immediately:** Don't accumulate multiple agent outputs before merging
264
- 4. **Discard stale worktrees:** If an agent's output is no longer compatible with the main branch (due to other agents' changes merging first), re-delegate rather than force-merge
265
- 5. **Atomic merge preference:** Use `git merge --no-ff` to keep agent work traceable in history
112
+ | Panel 3x BLOCK / agent-reviewer disagreement / criteria contradictions / no convergence / needs human | Dispute record |
113
+
114
+ Create in `.opencastle/DISPUTES.md` (inspired by [Steroids CLI](https://github.com/UnlikeOtherAI/steroids-cli)):
115
+
116
+ 1. Number (`DSP-XXX`) and set priority (critical/high/medium/low)
117
+ 2. Document both perspectives with file/code references
118
+ 3. Build attempt history with one-line verdict summaries
119
+ 4. Present ≥2 options with rationale/risk; note recommended action
120
+ 5. Link panel reports, review logs, changed files, DLQ entries
121
+ 6. Log with **observability-logging** dispute command; add ID to tracker and Index
122
+
123
+ **After human resolution:** Set `Status` `resolved`/`deferred`. Record chosen option. Resolved → re-delegate with decision as explicit constraint. Deferred → create follow-up issue. Log in `events.ndjson`.
124
+
125
+