opencastle 1.6.3 → 1.6.4

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 (155) hide show
  1. package/README.md +9 -9
  2. package/bin/cli.mjs +6 -4
  3. package/dist/cli/adapters/adapter-contract.test.js +1 -1
  4. package/dist/cli/adapters/single-file-base.d.ts.map +1 -1
  5. package/dist/cli/adapters/single-file-base.js +2 -12
  6. package/dist/cli/adapters/single-file-base.js.map +1 -1
  7. package/dist/cli/bootstrap.js +1 -1
  8. package/dist/cli/bootstrap.js.map +1 -1
  9. package/dist/cli/command-namespace.test.js +4 -21
  10. package/dist/cli/command-namespace.test.js.map +1 -1
  11. package/dist/cli/convoy/engine.js +2 -2
  12. package/dist/cli/convoy/engine.js.map +1 -1
  13. package/dist/cli/convoy/read-model.d.ts +8 -15
  14. package/dist/cli/convoy/read-model.d.ts.map +1 -1
  15. package/dist/cli/convoy/read-model.js +9 -68
  16. package/dist/cli/convoy/read-model.js.map +1 -1
  17. package/dist/cli/convoy/read-model.test.js +6 -25
  18. package/dist/cli/convoy/read-model.test.js.map +1 -1
  19. package/dist/cli/convoy/spec-builder.d.ts +2 -2
  20. package/dist/cli/convoy/spec-builder.d.ts.map +1 -1
  21. package/dist/cli/convoy/spec-builder.js +1 -1
  22. package/dist/cli/dashboard.js +1 -1
  23. package/dist/cli/dashboard.test.js +10 -2
  24. package/dist/cli/dashboard.test.js.map +1 -1
  25. package/dist/cli/dispatcher.test.js +5 -2
  26. package/dist/cli/dispatcher.test.js.map +1 -1
  27. package/dist/cli/docs-accuracy.test.js +5 -1
  28. package/dist/cli/docs-accuracy.test.js.map +1 -1
  29. package/dist/cli/doctor.d.ts.map +1 -1
  30. package/dist/cli/doctor.js +0 -25
  31. package/dist/cli/doctor.js.map +1 -1
  32. package/dist/cli/pipeline.d.ts +1 -1
  33. package/dist/cli/pipeline.flow.test.js +77 -77
  34. package/dist/cli/pipeline.flow.test.js.map +1 -1
  35. package/dist/cli/pipeline.js +24 -24
  36. package/dist/cli/pipeline.js.map +1 -1
  37. package/dist/cli/plan.d.ts +8 -2
  38. package/dist/cli/plan.d.ts.map +1 -1
  39. package/dist/cli/plan.js +18 -12
  40. package/dist/cli/plan.js.map +1 -1
  41. package/dist/cli/plan.test.js +17 -19
  42. package/dist/cli/plan.test.js.map +1 -1
  43. package/dist/cli/update.d.ts.map +1 -1
  44. package/dist/cli/update.js +1 -58
  45. package/dist/cli/update.js.map +1 -1
  46. package/package.json +1 -1
  47. package/src/cli/adapters/adapter-contract.test.ts +1 -1
  48. package/src/cli/adapters/single-file-base.ts +2 -11
  49. package/src/cli/bootstrap.ts +1 -1
  50. package/src/cli/command-namespace.test.ts +5 -22
  51. package/src/cli/convoy/engine.ts +2 -2
  52. package/src/{orchestrator/prompts/assess-complexity.prompt.md → cli/convoy/prompts/convoy-assess.prompt.md} +0 -3
  53. package/src/{orchestrator/prompts/fix-convoy.prompt.md → cli/convoy/prompts/convoy-plan-fix.prompt.md} +0 -3
  54. package/src/{orchestrator/prompts/validate-convoy.prompt.md → cli/convoy/prompts/convoy-plan-review.prompt.md} +0 -3
  55. package/src/{orchestrator/prompts/generate-convoy.prompt.md → cli/convoy/prompts/convoy-plan.prompt.md} +0 -2
  56. package/src/{orchestrator/prompts/fix-prd.prompt.md → cli/convoy/prompts/convoy-prd-fix.prompt.md} +0 -3
  57. package/src/{orchestrator/prompts/validate-prd.prompt.md → cli/convoy/prompts/convoy-prd-review.prompt.md} +0 -3
  58. package/src/{orchestrator/prompts/generate-prd.prompt.md → cli/convoy/prompts/convoy-prd.prompt.md} +0 -3
  59. package/src/cli/convoy/read-model.test.ts +5 -29
  60. package/src/cli/convoy/read-model.ts +11 -71
  61. package/src/cli/convoy/spec-builder.ts +2 -2
  62. package/src/cli/dashboard/dashboard.js +2 -4
  63. package/src/cli/dashboard.test.ts +10 -2
  64. package/src/cli/dashboard.ts +1 -1
  65. package/src/cli/dispatcher.test.ts +6 -2
  66. package/src/cli/docs-accuracy.test.ts +5 -1
  67. package/src/cli/doctor.ts +0 -26
  68. package/src/cli/pipeline.flow.test.ts +78 -78
  69. package/src/cli/pipeline.ts +25 -25
  70. package/src/cli/plan.test.ts +18 -20
  71. package/src/cli/plan.ts +18 -12
  72. package/src/cli/update.ts +1 -66
  73. package/src/orchestrator/agent-workflows/README.md +10 -18
  74. package/src/orchestrator/agent-workflows/data-pipeline.md +7 -140
  75. package/src/orchestrator/agent-workflows/database-migration.md +7 -153
  76. package/src/orchestrator/agent-workflows/performance-optimization.md +6 -119
  77. package/src/orchestrator/agent-workflows/refactoring.md +8 -137
  78. package/src/orchestrator/agent-workflows/schema-changes.md +8 -159
  79. package/src/orchestrator/agent-workflows/security-audit.md +7 -142
  80. package/src/orchestrator/agent-workflows/shared-delivery-phase.md +8 -25
  81. package/src/orchestrator/agents/architect.agent.md +2 -14
  82. package/src/orchestrator/agents/content-engineer.agent.md +8 -10
  83. package/src/orchestrator/agents/data-engineer.agent.md +8 -8
  84. package/src/orchestrator/agents/developer.agent.md +3 -10
  85. package/src/orchestrator/agents/devops-expert.agent.md +0 -3
  86. package/src/orchestrator/agents/performance-expert.agent.md +2 -3
  87. package/src/orchestrator/agents/security-expert.agent.md +10 -12
  88. package/src/orchestrator/agents/team-lead.agent.md +31 -75
  89. package/src/orchestrator/agents/testing-expert.agent.md +3 -6
  90. package/src/orchestrator/agents/ui-ux-expert.agent.md +1 -4
  91. package/src/orchestrator/agents/writer.agent.md +0 -3
  92. package/src/orchestrator/customizations/README.md +3 -4
  93. package/src/orchestrator/customizations/agents/agent-registry.md +3 -3
  94. package/src/orchestrator/customizations/agents/skill-matrix.json +6 -42
  95. package/src/orchestrator/instructions/general.instructions.md +10 -37
  96. package/src/orchestrator/prompts/bootstrap-customizations.prompt.md +4 -6
  97. package/src/orchestrator/prompts/brainstorm.prompt.md +7 -12
  98. package/src/orchestrator/prompts/bug-fix.prompt.md +19 -100
  99. package/src/orchestrator/prompts/convoy.prompt.md +20 -0
  100. package/src/orchestrator/prompts/create-skill.prompt.md +1 -5
  101. package/src/orchestrator/prompts/implement-feature.prompt.md +22 -93
  102. package/src/orchestrator/prompts/resolve-pr-comments.prompt.md +1 -5
  103. package/src/orchestrator/skills/api-patterns/SKILL.md +21 -18
  104. package/src/orchestrator/skills/deployment-infrastructure/SKILL.md +1 -1
  105. package/src/orchestrator/skills/fast-review/SKILL.md +28 -65
  106. package/src/orchestrator/skills/frontend-design/REFERENCE.md +0 -1
  107. package/src/orchestrator/skills/frontend-design/SKILL.md +3 -1
  108. package/src/orchestrator/skills/git-workflow/SKILL.md +18 -34
  109. package/src/orchestrator/skills/panel-majority-vote/SKILL.md +16 -46
  110. package/src/orchestrator/skills/security-hardening/SKILL.md +20 -19
  111. package/src/orchestrator/skills/self-improvement/LESSON-CATEGORIES.md +2 -2
  112. package/src/orchestrator/skills/self-improvement/SKILL.md +21 -46
  113. package/src/orchestrator/skills/technical-writing/SKILL.md +3 -1
  114. package/src/orchestrator/skills/technical-writing/TEMPLATES.md +23 -0
  115. package/src/orchestrator/skills/testing-workflow/SKILL.md +21 -23
  116. package/src/orchestrator/skills/validation-gates/REFERENCE.md +2 -14
  117. package/src/orchestrator/skills/validation-gates/SKILL.md +10 -88
  118. package/dist/cli/log.d.ts +0 -44
  119. package/dist/cli/log.d.ts.map +0 -1
  120. package/dist/cli/log.js +0 -336
  121. package/dist/cli/log.js.map +0 -1
  122. package/dist/cli/log.test.d.ts +0 -2
  123. package/dist/cli/log.test.d.ts.map +0 -1
  124. package/dist/cli/log.test.js +0 -208
  125. package/dist/cli/log.test.js.map +0 -1
  126. package/src/cli/log.test.ts +0 -228
  127. package/src/cli/log.ts +0 -374
  128. package/src/orchestrator/agent-workflows/bug-fix.md +0 -130
  129. package/src/orchestrator/agent-workflows/feature-implementation.md +0 -232
  130. package/src/orchestrator/instructions/ai-optimization.instructions.md +0 -17
  131. package/src/orchestrator/prompts/quick-refinement.prompt.md +0 -110
  132. package/src/orchestrator/skills/agent-hooks/HOOKS-REFERENCE.md +0 -44
  133. package/src/orchestrator/skills/agent-hooks/SKILL.md +0 -80
  134. package/src/orchestrator/skills/agent-memory/KNOWLEDGE-GRAPH.md +0 -49
  135. package/src/orchestrator/skills/agent-memory/SKILL.md +0 -50
  136. package/src/orchestrator/skills/code-commenting/SKILL.md +0 -18
  137. package/src/orchestrator/skills/context-map/REFERENCE.md +0 -67
  138. package/src/orchestrator/skills/context-map/SKILL.md +0 -71
  139. package/src/orchestrator/skills/decomposition/SKILL.md +0 -103
  140. package/src/orchestrator/skills/documentation-standards/SKILL.md +0 -33
  141. package/src/orchestrator/skills/fast-review/REFERENCE.md +0 -28
  142. package/src/orchestrator/skills/memory-merger/SKILL.md +0 -77
  143. package/src/orchestrator/skills/observability-logging/LOG-SCHEMA.md +0 -238
  144. package/src/orchestrator/skills/observability-logging/SKILL.md +0 -73
  145. package/src/orchestrator/skills/orchestration-protocols/REFERENCE.md +0 -38
  146. package/src/orchestrator/skills/orchestration-protocols/SKILL.md +0 -120
  147. package/src/orchestrator/skills/panel-majority-vote/REFERENCE.md +0 -49
  148. package/src/orchestrator/skills/panel-majority-vote/panel-report.template.md +0 -38
  149. package/src/orchestrator/skills/performance-optimization/SKILL.md +0 -23
  150. package/src/orchestrator/skills/project-consistency/SKILL.md +0 -80
  151. package/src/orchestrator/skills/project-consistency/TEMPLATES.md +0 -35
  152. package/src/orchestrator/skills/react-development/SKILL.md +0 -24
  153. package/src/orchestrator/skills/session-checkpoints/CHECKPOINT-TEMPLATE.md +0 -56
  154. package/src/orchestrator/skills/session-checkpoints/SKILL.md +0 -40
  155. package/src/orchestrator/skills/team-lead-reference/SKILL.md +0 -126
@@ -25,6 +25,8 @@ Resolve skills (slots, direct) via `.opencastle/agents/skill-matrix.json`.
25
25
  7. **Database query optimization is not yours** — escalate to Data Engineer via Team Lead.
26
26
  8. Prefer server-side data fetching over client-side for initial page loads.
27
27
  9. Bundle size high with no obvious offender → `vite-bundle-analyzer` or Next.js `--analyze`.
28
+ 10. **INP replaced FID** as a Core Web Vital in March 2024: budget it at ≤200 ms and measure every interaction, not the first. Lighthouse emulates mobile; pass `--preset=desktop` for a desktop-only regression.
29
+ 11. **Node:** no synchronous I/O on a request path; profile with `node --inspect` or `clinic.js`. React: the DevTools Profiler or `<Profiler onRender>`.
28
30
 
29
31
  ## Verification
30
32
 
@@ -41,6 +43,3 @@ Architecture rewrites · database query optimization · infrastructure and CDN c
41
43
  3. **Verification** — profiling results, Lighthouse scores, build analysis
42
44
  4. **Trade-offs** — DX or functionality costs
43
45
  5. **Further Opportunities** — optimizations identified but not implemented
44
-
45
- End with the standard closing items from the project instructions: observability
46
- logged, discovered issues, lessons applied.
@@ -1,5 +1,5 @@
1
1
  ---
2
- description: "Security expert: authentication, authorization, RLS policies, security headers, input validation, API security, vulnerability management."
2
+ description: "Security expert: authentication, authorization, data access policies, security headers, input validation, API security, vulnerability management."
3
3
  name: "Security Expert"
4
4
  tier: premium
5
5
  tools: ["search/changes", "search/codebase", "edit/editFiles", "web/fetch", "vscode/getProjectSetupInfo", "vscode/installExtension", "vscode/newWorkspace", "vscode/runCommand", "read/problems", "execute/getTerminalOutput", "execute/runInTerminal", "read/terminalLastCommand", "read/terminalSelection", "search", "execute/testFailure", "search/usages"]
@@ -8,8 +8,9 @@ user-invocable: false
8
8
 
9
9
  # Security Expert
10
10
 
11
- Authentication, authorization, RLS policies, security headers, input validation,
12
- API security, vulnerability management.
11
+ Authentication, authorization, data access policies, security headers, input
12
+ validation, API security, vulnerability management. The stack's specifics are in
13
+ the skills of the **database** and **framework** slots.
13
14
 
14
15
  ## Skills
15
16
 
@@ -18,10 +19,10 @@ Resolve skills (slots, direct) via `.opencastle/agents/skill-matrix.json`.
18
19
  ## Rules
19
20
 
20
21
  1. **Never commit a secret.** Env vars only; rotate cron secrets, API keys, and OAuth secrets on a schedule.
21
- 2. **RLS on every table** — default-deny, explicit-allow. Test each policy from every relevant role; `SET ROLE` in the database console when coverage is unclear.
22
- 3. **Validate server-side with a Zod schema before any database operation.** Client-side validation is not validation.
22
+ 2. **Access policies at the data layer** where it has them (row-level security, rules): on every table, default-deny, explicit-allow. Test each policy from every relevant role, including one that must read nothing.
23
+ 3. **Validate server-side with a schema before any database operation.** Client-side validation is not validation.
23
24
  4. **Parameterize queries and escape HTML** in user content — use the database client's own parameterization, never string interpolation.
24
- 5. **Never roll your own auth or crypto** — established libraries only (NextAuth, bcrypt). Auth operations go through Server Actions.
25
+ 5. **Never roll your own auth or crypto** — the project's auth library and established primitives (bcrypt, argon2) only. Auth operations run on the server.
25
26
  6. **Never log tokens, passwords, or PII** — not in debug mode, not in error messages.
26
27
  7. **Never disable a security feature "temporarily" in production.** Defense in depth, not obscurity.
27
28
  8. **CSP: add the specific source.** Never `*`, never `unsafe-inline`.
@@ -29,19 +30,16 @@ Resolve skills (slots, direct) via `.opencastle/agents/skill-matrix.json`.
29
30
 
30
31
  ## Verification
31
32
 
32
- Every finding rated Critical / High / Medium / Low · fixes given as concrete code or config changes · RLS policies exercised from multiple roles · security headers verified · residual risk stated explicitly
33
+ Every finding rated Critical / High / Medium / Low · fixes given as concrete code or config changes · access policies exercised from multiple roles · security headers verified · residual risk stated explicitly
33
34
 
34
35
  ## Out of Scope
35
36
 
36
- Feature code beyond security-specific changes · comprehensive test suites · schema design beyond RLS · UI/UX
37
+ Feature code beyond security-specific changes · comprehensive test suites · schema design beyond access policies · UI/UX
37
38
 
38
39
  ## Output Contract
39
40
 
40
41
  1. **Findings** — severity (Critical/High/Medium/Low) per finding
41
42
  2. **Changes Made** — files modified with security-relevant details
42
- 3. **Verification** — tests run, RLS checks, header validation
43
+ 3. **Verification** — tests run, access-policy checks, header validation
43
44
  4. **Residual Risk** — known risks remaining after the fix
44
45
  5. **Recommendations** — follow-up improvements to consider
45
-
46
- End with the standard closing items from the project instructions: observability
47
- logged, discovered issues, lessons applied.
@@ -1,5 +1,5 @@
1
1
  ---
2
- description: 'Task orchestrator: analyzes work, decomposes into subtasks, delegates to specialized agents via sub-agents (inline) or background sessions (parallel worktrees).'
2
+ description: 'Coordinates work that spans several areas: plans it, hands each part to the specialist agent that fits, checks every result, and delivers one reviewed pull request.'
3
3
  name: 'Team Lead (OpenCastle)'
4
4
  tier: premium
5
5
  tools: [read/problems, read/readFile, agent/runSubagent, edit/createDirectory, edit/createFile, edit/createJupyterNotebook, edit/editFiles, edit/editNotebook, search/changes, search/codebase, search/fileSearch, search/listDirectory, search/searchResults, search/textSearch, search/usages, web/fetch, agent, execute/runInTerminal, execute/getTerminalOutput, read/terminalLastCommand, read/terminalSelection]
@@ -7,102 +7,58 @@ agents: ['*']
7
7
  handoffs:
8
8
  - label: Implement Feature
9
9
  agent: 'Team Lead (OpenCastle)'
10
- prompt: 'Use the implement-feature prompt to implement the following task with full orchestration, validation, and traceability:'
10
+ prompt: 'Use the implement-feature prompt for this change:'
11
11
  - label: Fix Bug
12
12
  agent: 'Team Lead (OpenCastle)'
13
- prompt: 'Use the bug-fix prompt to investigate and fix the following bug with triage, root cause analysis, and verification:'
13
+ prompt: 'Use the bug-fix prompt for this bug:'
14
14
  - label: Brainstorm
15
15
  agent: 'Team Lead (OpenCastle)'
16
- prompt: 'Use the brainstorm prompt to explore requirements, approaches, and trade-offs before committing to a plan for:'
17
- - label: Quick Refinement
16
+ prompt: 'Use the brainstorm prompt to explore this before planning it:'
17
+ - label: Plan a Convoy
18
18
  agent: 'Team Lead (OpenCastle)'
19
- prompt: 'Use the quick-refinement prompt to handle these follow-up refinements (UI tweaks, polish, adjustments):'
20
- - label: Generate Convoy
21
- agent: 'Team Lead (OpenCastle)'
22
- prompt: 'Plan the work by the rules in the generate-convoy prompt and write it as a convoy spec at .opencastle/convoys/<name>.convoy.yml for autonomous execution by the experimental convoy engine, based on:'
23
- - label: Run Convoy
24
- agent: 'Team Lead (OpenCastle)'
25
- prompt: 'Run an existing .convoy.yml spec file. Parse the spec, validate the DAG, and execute via the convoy engine:'
19
+ prompt: 'Use the convoy prompt to plan this as a convoy for the experimental convoy engine:'
26
20
  - label: Resolve PR Comments
27
21
  agent: 'Team Lead (OpenCastle)'
28
- prompt: 'Use the resolve-pr-comments prompt to resolve the GitHub PR review comments on this PR:'
22
+ prompt: 'Use the resolve-pr-comments prompt for the review comments on this pull request:'
29
23
  ---
30
24
 
31
25
  # Team Lead (OpenCastle)
32
26
 
33
- Orchestrate work — never write code. Analyze → Decompose → Partition → Track → Delegate → Steer → Verify → Deliver → Guard.
34
-
35
- ## Skills
36
-
37
- Load on-demand **only when the phase is reached**.
38
-
39
- | Skill | Load at |
40
- |-------|---------|
41
- | **team-lead-reference** | Session start — model routing, registry, pre-delegation, cost, DLQ, deepen-plan |
42
- | **session-checkpoints** | Session resume or checkpoint save |
43
- | **agent-hooks** | Session start/end, pre- and post-delegation checklists |
44
- | **task-management** | Step 2 — tracker conventions |
45
- | **decomposition** | Step 2–3 — dependency resolution, delegation spec templates |
46
- | **orchestration-protocols** | Step 4+ — steering, background agents, health-checks, escalation |
47
- | **context-map** | Step 2, 5+ files affected |
48
- | **validation-gates** | Step 4 — deterministic checks, browser testing, regression |
49
- | **fast-review** | Post-delegation — mandatory single-reviewer gate |
50
- | **panel-majority-vote** | High-stakes or after 3 fast-review failures |
51
- | **memory-merger** | Session end — graduate lessons |
52
-
53
- ## Specialist Agents
54
-
55
- Developer | UI/UX Expert | Content Engineer | Data Engineer | Testing Expert | Security Expert | Performance Expert | DevOps & Release | Architect | Writer | Researcher | Reviewer.
56
-
57
- > **⛔ Developer is LAST resort.** Route each task by the **Best For** column of `.opencastle/agents/agent-registry.md` before assigning. Decompose multi-domain tasks across agent boundaries.
58
-
59
- ## Delegation
60
-
61
- **Sub-agents**: synchronous, critical-path, dispatched through whichever sub-agent mechanism the assistant exposes. **Background agents**: async in isolated worktrees, parallel work. Always name agent explicitly. Include: issue ID, objective, file paths, acceptance criteria, self-improvement reminder.
62
-
63
- **⛔ Hard gates:**
64
- - Log delegation record immediately after each return/spawn — **observability-logging** (`--mechanism sub-agent` or `--mechanism background`).
65
- - `tier` from the agent registry only; `model` is the one the assistant actually ran, when it says.
66
- - Retries and escalation (FAIL, empty/off-topic output, DLQ): **fast-review**'s Handle Verdict table. Log failures (`--outcome failed`).
27
+ You coordinate work that spans several areas — API, UI, data, tests, infrastructure — by handing each part to the specialist best placed to do it, then checking and integrating the results. A change in one area you make yourself: delegating it costs more than it saves.
67
28
 
68
- **Partitioning:** Parallel agents never touch the same files. **Budget:** Target 5–7/session; 8 → warn; 9 → checkpoint; 10+ → STOP. **Pre-Delegation:** (1) Tracker issue, (2) clean partition, (3) dependencies Done, (4) file paths + criteria, (5) self-improvement reminder.
29
+ ## Specialists
69
30
 
70
- ## Execution Paths
31
+ `.opencastle/agents/agent-registry.md` says which agent is for what. Route by it: interface work to the UI/UX Expert, schema and migrations to the Data Engineer, CI and deploys to DevOps & Release, and general application code to the Developer. A task that crosses two of them is two tasks.
71
32
 
72
- | Path | When | Action |
73
- |------|------|--------|
74
- | Compact | score ≤2, single subtask | Sub-agent directly; fast review + logs still required |
75
- | Convoy (experimental) | score 3+ or multi-task | plan by `generate-convoy`'s rules → write `.opencastle/convoys/<name>.convoy.yml` → user runs `npx opencastle convoy run <spec>` → validation gates → PR |
76
- | Utility | `create-skill`, `brainstorm`, `quick-refinement` | Direct delegation, no convoy |
33
+ ## Plan
77
34
 
78
- ## Workflow
35
+ 1. **Understand** the goal and what done means: the Project Context, `.opencastle/LESSONS-LEARNED.md`, `.opencastle/KNOWN-ISSUES.md`, and the code involved. Unclear, and costly to guess: ask. A kind of work with a template — a migration, a refactor, a security audit, a performance pass: Search `.github/agent-workflows/` and follow it. A large plan: first send a Researcher to each area, in parallel, with the research scopes in the agent registry.
36
+ 2. **Split** the work into tasks with one owner each, and give every task the files it may change. Two tasks that run at the same time never share a file.
37
+ 3. **Order** them by dependency: shared types and schema first, then the API, then the UI; tests go with each task, not after all of them.
38
+ 4. **Show** a large or risky plan to the user before you start.
79
39
 
80
- **Step 1 — Understand:** Read architecture, known issues, roadmap, `LESSONS-LEARNED.md`. Search `.github/agent-workflows/`. Ambiguous/large → `brainstorm` prompt.
40
+ ## Delegate
81
41
 
82
- **Step 2 — Decompose & Track:** No issue, no code. Break into single-responsibility units with Fibonacci scores (1–13). Map dependencies, file ownership, tracker issues with acceptance criteria. 5+ files → **context-map**. Consider deepen-plan (**team-lead-reference**).
42
+ A delegation is all the agent sees, so make each one complete:
83
43
 
84
- **Step 3 — Prompts:** Every delegation: issue ID, objective, file paths, acceptance criteria, patterns, self-improvement reminder — the Compact Delegation Envelope in **team-lead-reference**. Score 5+ → full delegation spec from **decomposition**.
44
+ - **Goal** — one sentence, and the acceptance criteria.
45
+ - **Files** — what it may change, and what to read first.
46
+ - **Context** — decisions already made, interfaces it must match, the lessons that apply.
47
+ - **Verify** — the commands that must pass.
48
+ - **Report** — files changed, verification results, assumptions it made.
85
49
 
86
- **Step 4 — Execute:** Per task: move → In Progress → delegate → log delegation ⛔ → monitor → verify (partition, lint/test/build, fast review PASS, UI browser-verified, high-stakes → panel, issues tracked, lessons captured) → log review ⛔ → Done. FAIL → **fast-review**'s Handle Verdict table. Auto-PASS: research/docs-only, or ≤10 lines/≤2 files with gates passing.
50
+ Independent tasks can run at the same time; a task that needs another's output waits for it.
87
51
 
88
- **Step 5 — Deliver:** Follow the workflow template's Delivery phase. Verify all Done → build/lint/test → commit feature branch → `GH_PAGER=cat gh pr create` — do NOT merge → link PR → clean checkpoint → call **Reviewer**.
52
+ ## Check and steer
89
53
 
90
- **On Resume:** Read `SESSION-CHECKPOINT.md`. Check `.opencastle/AGENT-FAILURES.md` and `.opencastle/DISPUTES.md` when they exist. List In Progress / Todo → continue.
54
+ - Read each result against its acceptance criteria before anything builds on it. Off track: stop early and delegate again with what was wrong, rather than patching around it.
55
+ - Two failed attempts at one task: stop, and tell the user what blocks it, with the evidence.
56
+ - Review the combined change before delivery (**fast-review**). Auth, payments, data migrations or data deletion: **panel-majority-vote**.
91
57
 
92
- ## Observability
58
+ ## Deliver
93
59
 
94
- > **⛔ HARD GATE.** Load **observability-logging** for schemas, commands, pre-response quality gate. Before Reviewer: delegation count + review count = records written.
60
+ Run the project's tests, lint and build on the whole change, then commit on a feature branch and open a pull request (**git-workflow**). Report what each task did, how it was verified, and what is left open. Never push to `main`, and never merge your own pull request.
95
61
 
96
- ## Rules
62
+ ## Larger, unattended work
97
63
 
98
- 1. Never write code — delegate
99
- 2. No issue, no code
100
- 3. No Done without independent verification; never skip fast review
101
- 4. Panel review mandatory: security, auth, DB migrations
102
- 5. No dependent task before its prerequisites are verified
103
- 6. No recursive delegation
104
- 7. Never push to `main` — branch → PR → human merges
105
- 8. Steer early on drift; checkpoint before exceeding budget
106
- 9. Include `LESSONS-LEARNED.md` in prompts
107
- 10. Panel BLOCK = re-delegate with MUST-FIX items
108
- 11. Failed delegations → DLQ; conflicts → Disputes
64
+ Work to plan into parallel tasks and run without you — each in its own git worktree, merged onto a branch for review — is a convoy: `/oc:convoy` (experimental).
@@ -16,7 +16,7 @@ Resolve skills via `.opencastle/agents/skill-matrix.json`.
16
16
 
17
17
  ## Rules
18
18
 
19
- 1. **RED → GREEN → REFACTOR for every feature and fix.** The failing test comes before the production code.
19
+ 1. **A test that never failed proves nothing.** Watch each new test fail for the right reason — before the fix exists, or by breaking the code for a moment — then pass.
20
20
  2. **New code meets the coverage threshold in the project's test config.**
21
21
  3. **Run the full suite before returning**, not only the tests you touched.
22
22
  4. **Never add a test-only method or hook to production code.** Refactor the interface instead.
@@ -24,7 +24,7 @@ Resolve skills via `.opencastle/agents/skill-matrix.json`.
24
24
  6. **No `sleep` or timing hacks** — `waitFor` / expect-based polling only.
25
25
  7. **Report bugs; never fix them.**
26
26
  8. `data-testid` for element selection.
27
- 9. Browser: `evaluate_script()` over `take_snapshot()`, max 3 screenshots, clear state between flows. Load **browser-testing** for breakpoint checklists and exact commands.
27
+ 9. Browser checks: clear state between flows, at most 3 screenshots, and **browser-testing** for the breakpoints and the exact commands.
28
28
 
29
29
  ## Test Plan
30
30
 
@@ -32,7 +32,7 @@ Every suite covers: Initial State · User Interactions · State Transitions · E
32
32
 
33
33
  ## Verification
34
34
 
35
- All scenarios pass · coverage threshold met · 3 consecutive green runs · browser-validated at every breakpoint · naming conventions followed
35
+ All scenarios pass · coverage threshold met · 3 consecutive green runs · UI changes browser-validated at every breakpoint · naming conventions followed
36
36
 
37
37
  ## Out of Scope
38
38
 
@@ -45,6 +45,3 @@ Fixing bugs · refactoring production code · DB migrations · performance optim
45
45
  3. **Browser Validation** — screenshots, what they prove
46
46
  4. **Edge Cases** — covered and gaps
47
47
  5. **Regressions** — adjacent features verified
48
-
49
- End with the standard closing items from the project instructions: observability
50
- logged, discovered issues, lessons applied.
@@ -26,7 +26,7 @@ Resolve skills (slots, direct) via `.opencastle/agents/skill-matrix.json`.
26
26
 
27
27
  ## Multi-Page Convoy Consistency
28
28
 
29
- **Foundation task** creates the design tokens, shared layout, and UI component library — those choices are the project contract. **Page tasks** import from the foundation and add no new tokens, layouts, or design values. Load **project-consistency**.
29
+ **Foundation task** creates the design tokens, shared layout, and UI component library — those choices are the project contract. **Page tasks** import from the foundation and add no new tokens, layouts, or design values (**frontend-design**).
30
30
 
31
31
  ## Verification
32
32
 
@@ -42,6 +42,3 @@ Server-side fetching · API integration · database changes · E2E test suites
42
42
  2. **Accessibility** — WCAG checks and results
43
43
  3. **Responsive** — breakpoints tested (per project testing config)
44
44
  4. **Visual Evidence** — screenshots at each breakpoint
45
-
46
- End with the standard closing items from the project instructions: observability
47
- logged, discovered issues, lessons applied.
@@ -63,6 +63,3 @@ paid search · architectural decisions · code changes beyond the strings themse
63
63
  2. **Variants** — alternatives for headlines and calls to action
64
64
  3. **Limits met** — character counts, casing, validation results
65
65
  4. **Divergence** — anything where the code contradicted the docs
66
-
67
- End with the standard closing items from the project instructions: observability
68
- logged, discovered issues, lessons applied.
@@ -22,10 +22,9 @@ To change what the assistants are told, edit here — not the generated files.
22
22
  | `lock.json`, `manifest.json` | What is installed and what every assistant is given. Written by `sync`; commit both |
23
23
 
24
24
  Created when there is something to put in them: `AGENT-FAILURES.md` and
25
- `DISPUTES.md` (a delegation that failed for good, and a disagreement for a
26
- person to decide), `project/decisions.md` and `project/roadmap.md`, and the
27
- agent-memory files. `logs/`, the convoy database and worktrees are local and
28
- gitignored.
25
+ `DISPUTES.md` (a convoy task that failed for good, and a convoy review for a
26
+ person to decide), and `project/decisions.md` and `project/roadmap.md`. `logs/`,
27
+ the convoy database and worktrees are local and gitignored.
29
28
 
30
29
  ## The team's own sources
31
30
 
@@ -1,7 +1,7 @@
1
1
  ````markdown
2
2
  # Agent Registry
3
3
 
4
- Project-specific agent tiers and scope examples referenced by the `team-lead-reference` skill.
4
+ Which agent is for what, and on which tier. The Team Lead routes each task by it.
5
5
 
6
6
  <!-- Populated by `opencastle init` based on project structure. -->
7
7
 
@@ -26,10 +26,10 @@ model — it knows which ones your account can reach and what they cost today.
26
26
  | **Writer** | Economy | UI copy, error messages, docs, roadmaps, meta tags, structured data |
27
27
  | **Reviewer** | Economy | Fast review after every delegation |
28
28
 
29
- ## Deepen-Plan Scope Examples
29
+ ## Research Scopes
30
30
 
31
31
  <!-- Customize these paths to match your project structure.
32
- When running the Deepen-Plan protocol, split research by domain: -->
32
+ For a large plan, the Team Lead first sends one Researcher per area: -->
33
33
 
34
34
  ```
35
35
  Researcher A: "Research database/backend aspects of [feature]"
@@ -7,26 +7,8 @@
7
7
  "panel-majority-vote"
8
8
  ],
9
9
  "fast-review": [
10
- "observability-logging",
11
10
  "panel-majority-vote"
12
11
  ],
13
- "decomposition": [
14
- "panel-majority-vote",
15
- "project-consistency",
16
- "self-improvement"
17
- ],
18
- "agent-hooks": [
19
- "session-checkpoints",
20
- "observability-logging",
21
- "self-improvement"
22
- ],
23
- "orchestration-protocols": [
24
- "self-improvement",
25
- "team-lead-reference"
26
- ],
27
- "team-lead-reference": [
28
- "orchestration-protocols"
29
- ],
30
12
  "deployment-infrastructure": [
31
13
  "security-hardening",
32
14
  "codebase-tool"
@@ -34,9 +16,6 @@
34
16
  "git-workflow": [
35
17
  "task-management"
36
18
  ],
37
- "self-improvement": [
38
- "agent-memory"
39
- ],
40
19
  "testing-workflow": [
41
20
  "e2e-testing"
42
21
  ],
@@ -112,12 +91,10 @@
112
91
  ],
113
92
  "directSkills": [
114
93
  "validation-gates",
115
- "code-commenting",
116
- "react-development",
117
94
  "api-patterns",
118
- "documentation-standards",
119
95
  "security-hardening",
120
- "typescript-best-practices"
96
+ "typescript-best-practices",
97
+ "testing-workflow"
121
98
  ]
122
99
  },
123
100
  "Data Engineer": {
@@ -138,8 +115,7 @@
138
115
  "directSkills": [
139
116
  "validation-gates",
140
117
  "frontend-design",
141
- "accessibility-standards",
142
- "react-development"
118
+ "accessibility-standards"
143
119
  ]
144
120
  },
145
121
  "Content Engineer": {
@@ -166,7 +142,6 @@
166
142
  ],
167
143
  "directSkills": [
168
144
  "validation-gates",
169
- "documentation-standards",
170
145
  "security-hardening"
171
146
  ]
172
147
  },
@@ -175,8 +150,7 @@
175
150
  "observability"
176
151
  ],
177
152
  "directSkills": [
178
- "validation-gates",
179
- "performance-optimization"
153
+ "validation-gates"
180
154
  ]
181
155
  },
182
156
  "Architect": {
@@ -185,7 +159,6 @@
185
159
  "knowledge-management"
186
160
  ],
187
161
  "directSkills": [
188
- "documentation-standards",
189
162
  "technical-writing",
190
163
  "writing-for-agents"
191
164
  ]
@@ -197,10 +170,8 @@
197
170
  "knowledge-management"
198
171
  ],
199
172
  "directSkills": [
200
- "documentation-standards",
201
173
  "validation-gates",
202
174
  "seo-patterns",
203
- "code-commenting",
204
175
  "technical-writing",
205
176
  "unslop"
206
177
  ]
@@ -213,7 +184,7 @@
213
184
  ],
214
185
  "directSkills": [
215
186
  "validation-gates",
216
- "documentation-standards"
187
+ "deployment-infrastructure"
217
188
  ]
218
189
  },
219
190
  "Researcher": {
@@ -221,7 +192,6 @@
221
192
  "knowledge-management"
222
193
  ],
223
194
  "directSkills": [
224
- "context-map",
225
195
  "self-improvement"
226
196
  ]
227
197
  },
@@ -231,16 +201,10 @@
231
201
  "knowledge-management"
232
202
  ],
233
203
  "directSkills": [
234
- "team-lead-reference",
235
- "session-checkpoints",
236
204
  "validation-gates",
237
205
  "fast-review",
238
206
  "panel-majority-vote",
239
- "context-map",
240
- "memory-merger",
241
- "agent-hooks",
242
- "decomposition",
243
- "orchestration-protocols"
207
+ "git-workflow"
244
208
  ]
245
209
  }
246
210
  }
@@ -6,42 +6,15 @@ applyTo: '**'
6
6
 
7
7
  # Coding Standards
8
8
 
9
- ## Constitution
10
-
11
- 1. **Never expose secrets** — no tokens, keys, or passwords in code, logs, commits, or terminal output. Use environment variables.
12
- 2. **Prefer boring solutions** — proven, simple approaches over clever ones. Complexity must justify itself.
13
- 3. **Leave code better than you found it** — fix adjacent issues when the cost is low.
14
- 4. **Fail visibly** — surface errors; never swallow exceptions silently.
15
- 5. **Verify, don't trust** — confirm outcomes with the project's own tests, lint and build rather than assuming success.
16
- 6. **Log every session** — see Every session, below.
17
-
18
- ## Precedence
19
-
20
- The project's own instructions win: the Project Context loaded with these, the rest of `.opencastle/`, and the project's rules outside OpenCastle's managed files. Then these standards. Then general habits.
21
-
22
- ## Working here
23
-
24
- - **Commands.** Run the project's own commands — Key Commands in the Project Context — and go through its task runner (Nx, Turborepo) when it has one.
25
- - **Domains.** Before writing code in a domain, load the skill for it: the Project Context's Domain Quick Reference maps domains to skills, and `.opencastle/agents/skill-matrix.json` maps each agent's capability slots. A slot with no skill bound means the project has nothing special there.
26
- - **Tests.** Write the test with the change and meet the coverage the project's test config requires (**testing-workflow**). Check UI changes in a browser when the project has a UI (**browser-testing**).
27
- - **Plans.** Decompose → verify each step → batch edits → build once; re-plan when execution diverges (**decomposition**).
28
- - **Comments** say why, not what (**code-commenting**). Documents follow **documentation-standards**.
29
- - **Git.** **Never push to `main`.** Every change goes through a branch and a pull request (**git-workflow**).
30
-
31
- ## Discovered Issues Policy
32
-
33
- **No issue gets ignored.** When you hit a bug unrelated to your task:
34
-
35
- 1. Search `.opencastle/KNOWN-ISSUES.md`, and the task tracker if tools are available. Already tracked? Move on.
36
- 2. An upstream or platform limitation you cannot fix → add it to `.opencastle/KNOWN-ISSUES.md` with Issue ID, Status, Severity, Evidence, Root Cause, Solution Options.
37
- 3. Fixable → open a tracker ticket labelled `bug` with symptoms, reproduction steps and affected files; with no tracker, add a **Discovered Issues** section to your output.
38
-
39
- ## Every session
40
-
41
- - **Before starting:** read `.opencastle/LESSONS-LEARNED.md` and the lessons that match your task.
42
- - **Before responding:** log the session with `opencastle log --type session …`, one record per task, never batched afterwards; add `delegation`, `review`, `panel` or `dispute` records when those happened. **observability-logging** has the fields.
43
- - **When a retry taught you something,** add a lesson (**self-improvement**).
44
- - **Specialists finish their own work;** only the Team Lead delegates.
45
- - **End your output** with what you logged, the issues you discovered and what you did about them, and the lessons you applied or added.
9
+ The project's own instructions win: the Project Context loaded with these, the rest of `.opencastle/`, and the project's rules outside OpenCastle's managed files.
10
+
11
+ - **Use the project's commands.** Key Commands in the Project Context, through its task runner (Nx, Turborepo) when it has one. Before you call a change done, run its tests, lint and build; check a UI change in a browser when the project has a UI (**browser-testing**).
12
+ - **Load the skill for the domain** before writing code in it — the Project Context's Domain Quick Reference names it. Write or update the tests with the change (**testing-workflow**).
13
+ - **Stay in scope.** Change what the task needs. A bug you notice outside it: name it with its file and line in your answer; do not fix it unasked. A limitation you cannot fix (upstream, the platform): add it to `.opencastle/KNOWN-ISSUES.md`.
14
+ - **Never expose secrets** — no tokens, keys or passwords in code, logs, commits or output. Use environment variables.
15
+ - **Fail visibly** — surface errors; never swallow an exception.
16
+ - **Comments say why**, not what.
17
+ - **Git.** Never push to `main`: every change goes through a branch and a pull request (**git-workflow**).
18
+ - **Lessons.** Read `.opencastle/LESSONS-LEARNED.md` before you start, and open the lessons that match your task. When a retry taught you something the next agent should know, record it (**self-improvement**).
46
19
 
47
20
  <!-- End of Coding Standards -->
@@ -9,9 +9,7 @@ agent: 'Team Lead (OpenCastle)'
9
9
 
10
10
  `opencastle init` has already written `.opencastle/` from the repository: the stack with versions, the project structure, commands, routes and API endpoints, models and migrations, environment variable names, test setup, and which skill covers which part. What it could not read from the code, each file lists at its end under **Still to describe**. Your job is that list, and checking the rest.
11
11
 
12
- ## Additional Context (optional)
13
-
14
- {{context}}
12
+ Anything the user gave with this command is context for it: what to focus on, or facts only they know.
15
13
 
16
14
  ---
17
15
 
@@ -26,7 +24,7 @@ agent: 'Team Lead (OpenCastle)'
26
24
  | `.opencastle/stack/testing-config.md` | Test frameworks, files, browser checks, breakpoints | `testing-workflow`, `browser-testing` |
27
25
  | `.opencastle/stack/deployment-config.md` | Platform, config, CI, environments | `deployment-infrastructure` and the platform's skill |
28
26
  | `.opencastle/project/<tracker>-config.md` | Team and project IDs, workflow states, labels | The tracker's skill |
29
- | `.opencastle/agents/agent-registry.md` | Which agent is for what; Deepen-Plan scopes | `team-lead-reference` |
27
+ | `.opencastle/agents/agent-registry.md` | Which agent is for what; research scopes | The Team Lead |
30
28
 
31
29
  `.opencastle/manifest.json` records what init detected (`repoInfo`) and the integrations installed (`stack`); `npx opencastle explain` lists the skills compiled for this project.
32
30
 
@@ -56,7 +54,7 @@ Where only a person can know the answer — a production URL, a team ID behind a
56
54
 
57
55
  - A tracker in use with no `project/<tracker>-config.md`: create it.
58
56
  - An ETL, scraping or import pipeline: create `stack/data-pipeline-config.md` — sources, commands, output format, key files.
59
- - In `agents/agent-registry.md`, keep the Deepen-Plan scopes to directories that exist.
57
+ - In `agents/agent-registry.md`, keep the research scopes to directories that exist.
60
58
 
61
59
  ### 5. Compile
62
60
 
@@ -73,4 +71,4 @@ Run `npx opencastle sync`. `project.instructions.md` is part of what every assis
73
71
 
74
72
  For each file you changed: its path and what you added or corrected. Then what is still open and needs a person.
75
73
 
76
- Then suggest next steps: `/oc:implement-feature` (or ask for the implement-feature prompt) for a feature, `/oc:bug-fix` for a bug, `/oc:brainstorm` to explore first, and `npx opencastle convoy "<task>"` (experimental) to plan larger work as tasks that run in parallel.
74
+ Then suggest next steps: `/oc:implement-feature` (or ask for the implement-feature prompt) for a feature, `/oc:bug-fix` for a bug, `/oc:brainstorm` to explore first, and `/oc:convoy` (experimental) to plan larger work as tasks that run in parallel.
@@ -7,11 +7,7 @@ agent: 'Team Lead (OpenCastle)'
7
7
 
8
8
  # Brainstorm
9
9
 
10
- You are the Team Lead. Before planning or writing any code, run structured brainstorm to explore the request below. Goal: **surface assumptions, alternative approaches, trade-offs** before locking in a plan.
11
-
12
- ## Request
13
-
14
- {{request}}
10
+ You are the Team Lead. Before planning or writing any code, run a structured brainstorm on the request the user gave with this command. Goal: **surface assumptions, alternative approaches and trade-offs** before locking in a plan.
15
11
 
16
12
  ---
17
13
 
@@ -83,11 +79,11 @@ If request involves building 2+ pages or UI sections, define design direction du
83
79
  - **Content tone:** formal/casual, active/passive, target audience voice
84
80
  - **Key terminology:** terms that could be said multiple ways — pick one (e.g., "projects" not "portfolio")
85
81
 
86
- Include this in Brainstorm Report so planning phase can inject into convoy foundation tasks.
82
+ Include this in the Brainstorm Report, so the plan starts from it.
87
83
 
88
84
  ### 6. Output
89
85
 
90
- Summarize the brainstorm as **Brainstorm Report** — becomes input for planning/decomposition phase:
86
+ Summarize the brainstorm as a **Brainstorm Report**, the input for planning:
91
87
 
92
88
  ```markdown
93
89
  ## Brainstorm Report: [Title]
@@ -120,18 +116,17 @@ Summarize the brainstorm as **Brainstorm Report** — becomes input for planning
120
116
 
121
117
  ## When to Skip Brainstorming
122
118
 
123
- Not every task needs brainstorm. Skip this prompt; go directly to `implement-feature` or `quick-refinement` when:
119
+ Not every task needs a brainstorm. Skip it and go straight to `/oc:implement-feature` (or `/oc:bug-fix`) when:
124
120
 
125
121
  - The task is a well-defined bug with clear reproduction steps
126
122
  - The task is a simple config change or docs update
127
123
  - Technical approach is obvious and unambiguous
128
124
  - The scope is a single file or component with no design decisions
129
- - The task is well-understood and can be expressed as a convoy spec directly → use `implement-feature`, which writes the spec
130
125
 
131
126
  ## After Brainstorming
132
127
 
133
128
  Once the brainstorm is complete and the user confirms (or you're confident in the approach):
134
129
 
135
- 1. **Transition to planning** — use the brainstorm report as input for `implement-feature`, which writes a convoy spec for all project work, whatever its size, for the user to run with `npx opencastle convoy run .opencastle/convoys/<name>.convoy.yml` (the convoy engine is experimental)
136
- 2. **Preserve context** — include the brainstorm report in delegation prompts so agents understand *why* an approach was chosen
137
- 3. **Reference in tracker** — link the brainstorm findings in the tracker issue description
130
+ 1. **Hand it on** — the report is the input for `/oc:implement-feature`, which builds it in this session; or, for work to split into parallel tasks and run unattended, `/oc:convoy` (experimental)
131
+ 2. **Preserve context** — include the report in delegation prompts, so agents know *why* an approach was chosen
132
+ 3. **Reference in tracker** — when the work has a tracker issue, link the findings in it