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
@@ -5,68 +5,32 @@ description: "Git branching, PR workflow, delivery requirements, discovered issu
5
5
 
6
6
  # Git Workflow & Delivery
7
7
 
8
- ## Git Workflow
8
+ **NEVER push directly to `main`.** All changes go through a feature/fix branch → PR.
9
9
 
10
- **NEVER commit or push directly to the `main` branch.** All changes must go through a feature/fix branch and a pull request.
10
+ ## Branch & Commit Rules
11
11
 
12
- 1. **Create a branch** from `main` before making any changes: `git checkout -b <type>/<ticket-id>-<short-description>` (e.g., `fix/tas-21-places-redirect-loop`, `feat/tas-15-new-filter`)
13
- 2. **Commit to the branch** — never to `main`. Reference the task tracker issue ID in every commit message (e.g., `TAS-42: Fix token refresh logic`)
14
- 3. **Push the branch** and open a pull request on GitHub. **Do NOT merge** — PRs are opened for review only
15
- 4. **Link the PR to the task tracker** Update the issue description with the PR URL so progress is traceable
16
- 5. **Merge via PR** the only way code reaches `main`, and only after review/approval
12
+ | Rule | Detail |
13
+ |------|--------|
14
+ | Branch from `main` | `git checkout -b <type>/<ticket-id>-<slug>` |
15
+ | Types | `fix`, `feat`, `chore`, `refactor`, `perf`, `docs` |
16
+ | Commit messages | Must reference issue ID `TAS-42: Fix token refresh` |
17
+ | No force-push | Never `--force` or `--amend` on shared branches; `--force-with-lease` on personal only |
18
+ | No secrets | No tokens/keys in commits, PR descriptions, or output (rotate immediately if leaked) |
17
19
 
18
- Branch naming convention: `<type>/<ticket-id>-<short-description>` where type is `fix`, `feat`, `chore`, `refactor`, `perf`, or `docs`.
20
+ ## Delivery Checklist (Every Task)
19
21
 
20
- **This rule has NO exceptions.** Not for "small fixes", not for "just config changes", not for urgent hotfixes. Every change goes through a PR.
21
-
22
- ### PR Safety Rules
23
-
24
- - **Never** use `git push --force` or `git commit --amend` on shared branches
25
- - **Never** expose secrets in commits, PR descriptions, or terminal output (per Constitution #1)
26
- - Use `git push --force-with-lease` only when explicitly asked and on personal branches
27
- - If a secret is accidentally committed, immediately rotate it — git history is permanent
28
-
29
- ### Delivery Outcome (Required for Every Task)
30
-
31
- Every task that produces code changes — whether a roadmap feature, bug fix, follow-up, data pipeline, or refactor — must deliver:
32
-
33
- 1. **Dedicated branch** — `<type>/<ticket-id>-<short-description>` created from `main`
34
- 2. **Atomic commits** — Each commit references the issue ID (e.g., `TAS-42: Add filter component`)
35
- 3. **Pushed branch** — Branch pushed to origin
36
- 4. **Open PR** — Use `gh` CLI to create the PR. **Do NOT merge** — PRs are opened for review only:
37
- ```bash
38
- GH_PAGER=cat gh pr create --base main --title "TAS-XX: Short description" --body "Resolves TAS-XX"
39
- ```
40
- 5. **Task tracker linkage** — The issue is updated with the PR URL, and the PR description references the issue ID
22
+ 1. Branch `<type>/<ticket-id>-<slug>` from `main`
23
+ 2. Atomic commits referencing issue ID
24
+ 3. Push branch to origin
25
+ 4. Open PR (do NOT merge): `GH_PAGER=cat gh pr create --base main --title "TAS-XX: …" --body "Resolves TAS-XX"`
26
+ 5. Update issue with PR URL
41
27
 
42
28
  ## Discovered Issues Policy
43
29
 
44
- > **⛔ No issue gets ignored.** Untracked bugs discovered during work are a quality gate failure.
45
-
46
- When you encounter a bug, error, or unexpected behavior that is unrelated to the current task:
47
-
48
- 1. **Check if already tracked:**
49
- - Search `.opencastle/KNOWN-ISSUES.md` for a matching entry
50
- - If you have task tracker tools available, also search for open bugs (use `search_issues` or `list_issues` with bug label)
51
- 2. **If found tracked** — skip it, continue with your current work
52
- 3. **If NOT tracked** — you must act:
53
- - **Unfixable limitation** (third-party constraint, platform restriction, upstream dependency) → add it to `.opencastle/KNOWN-ISSUES.md` with: Issue ID, Status, Severity, Evidence, Root Cause, Solution Options
54
- - **Fixable bug** → if you have task tracker tools, create a ticket with label `bug`, appropriate priority, and a clear description of the symptoms, reproduction steps, and affected files. If you do NOT have task tracker tools, add a `**Discovered Issues**` section to your output listing the bug details so the Team Lead can track it.
55
-
56
- Never assume a pre-existing issue is somebody else's problem. If it's not tracked, track it.
30
+ > Inherits: [discovered-issues-policy](../../snippets/discovered-issues-policy.md)
57
31
 
58
32
  ## Task Tracking
59
33
 
60
- Feature work is tracked in the **task tracker** (see `tracker-config.md` for project details). The Team Lead agent creates and updates issues via MCP. For conventions, load the **task-management** skill.
61
-
62
- ### When Task Tracker MCP Tools Are Unavailable
63
-
64
- If task tracker MCP tools are not available in the current session, do NOT block on issue creation. Instead:
34
+ Tracked in the **task tracker** (`tracker-config.md`). Team Lead creates/updates issues via MCP. Load **task-management** skill for conventions.
65
35
 
66
- 1. **Document planned issues** in your output with the title, description, and acceptance criteria you would have used
67
- 2. **Proceed with implementation** — the work is still valuable without a ticket number
68
- 3. **Placeholder value for `tracker_issue`:**
69
- - **No tracker configured** (no `task-management` slot bound in `skill-matrix.json`) → use `"N/A"`
70
- - **Tracker configured but tools unavailable** → use the project prefix + `PENDING` (e.g., `"TAS-PENDING"`)
71
- 4. **Ask the user** to create the issues manually if tracking is critical for the task
72
- 5. After implementation, update commit messages and PR descriptions when issue IDs become available
36
+ **If MCP tools unavailable:** Document planned issues (title + AC) in output, use `"N/A"` (no tracker) or `"TAS-PENDING"` (tracker configured), proceed with work, update IDs when available.
@@ -3,123 +3,86 @@ name: memory-merger
3
3
  description: "Protocol for graduating mature lessons from LESSONS-LEARNED.md into permanent instruction and skill files. Closes the self-improvement loop by codifying validated knowledge at the source level."
4
4
  ---
5
5
 
6
- <!-- ⚠️ This file is managed by OpenCastle. Edits will be overwritten on update. Customize in the .opencastle/ directory instead. -->
6
+ # Memory Merger
7
7
 
8
- # Skill: Memory Merger
9
-
10
- This skill automates the final step of the self-improvement cycle: promoting validated lessons into the instruction and skill files where they have structural, permanent impact.
11
-
12
- ## Why Merge?
13
-
14
- `.opencastle/LESSONS-LEARNED.md` is a flatfile that grows over time. Lessons buried in a 400+ line file lose their impact — agents skim past them or miss relevant entries. The most valuable lessons should **graduate** into the instruction/skill files where they're encountered naturally during every task.
8
+ Promotes validated lessons from `.opencastle/LESSONS-LEARNED.md` into instruction/skill files where they have permanent impact.
15
9
 
16
10
  ## When to Run
17
11
 
18
- Invoke a memory merge when:
19
-
20
- - **LESSONS-LEARNED.md exceeds 50 entries** — periodic cleanup
21
- - **A lesson has been cited 3+ times** — it's clearly a recurring pattern
22
- - **A lesson is older than 60 days** mature enough to be considered stable
23
- - **After a major feature ships** good checkpoint to extract patterns
24
- - **Team Lead's discretion** — any time the lessons file feels stale
12
+ | Trigger | Threshold |
13
+ |---------|-----------|
14
+ | File size | >50 entries |
15
+ | Citation count | Cited 3+ times |
16
+ | Age | >60 days old |
17
+ | Category cluster | 5+ lessons in same category |
18
+ | Discretionary | Lessons file feels stale |
25
19
 
26
20
  ## Merge Protocol
27
21
 
28
- ### Step 1: Scan for Merge Candidates
29
-
30
- Read `.opencastle/LESSONS-LEARNED.md` and identify lessons that meet any of these criteria:
22
+ ### 1 Scan Candidates
31
23
 
32
24
  | Criterion | Signal |
33
25
  |-----------|--------|
34
- | **High frequency** | Cited or re-discovered 3+ times |
35
- | **High severity** | Marked `high` severity |
36
- | **Age** | Added more than 60 days ago and still relevant |
37
- | **Category concentration** | 5+ lessons in the same category → extract a pattern |
38
- | **Tool-specific** | Lesson about a specific MCP tool, codebase-tool command, or framework pattern |
39
-
40
- ### Step 2: Map Lessons to Target Files
41
-
42
- Each lesson has a natural home in the instruction/skill hierarchy:
43
-
44
- | Lesson Category | Target File |
45
- |----------------|-------------|
46
- | `task-management` | The skill mapped by the `task-management` slot in the skill matrix |
47
- | `mcp-tools` | The corresponding agent file or skill that uses the tool |
48
- | `codebase-tool` | The skill mapped by the `codebase-tool` slot in the skill matrix |
49
- | `cms` | The skill mapped by the `cms` slot in the skill matrix |
50
- | `database` | The skill mapped by the `database` slot in the skill matrix |
51
- | `browser-testing` | The skill mapped by the `e2e-testing` slot in the skill matrix |
26
+ | Frequency | Cited/re-discovered 3+ times |
27
+ | Severity | Marked `high` |
28
+ | Age | >60 days, still relevant |
29
+ | Concentration | 5+ in same category → extract pattern |
30
+ | Tool-specific | MCP tool, codebase-tool command, or framework pattern |
31
+
32
+ ### 2 Map to Target File
33
+
34
+ | Category | Target |
35
+ |----------|--------|
36
+ | `task-management` | skill-matrix `task-management` slot |
37
+ | `mcp-tools` | agent/skill that uses the tool |
38
+ | `codebase-tool` | skill-matrix `codebase-tool` slot |
39
+ | `cms` / `database` | respective skill-matrix slots |
40
+ | `browser-testing` | skill-matrix `e2e-testing` slot |
52
41
  | `git-workflow` | `.github/skills/git-workflow/SKILL.md` |
53
42
  | `deployment` | `.github/skills/deployment-infrastructure/SKILL.md` |
54
- | `delegation` | `.github/agents/team-lead.agent.md` or `.github/skills/team-lead-reference/SKILL.md` |
43
+ | `delegation` | `.github/agents/team-lead.agent.md` or `team-lead-reference` skill |
55
44
  | `testing` | `.github/skills/testing-workflow/SKILL.md` |
56
- | `ui` / `framework` | The skill mapped by the `framework` slot or the `react-development` direct skill |
57
- | Cross-cutting pattern | `.github/instructions/general.instructions.md` |
58
-
59
- ### Step 3: Draft the Merge
45
+ | `ui` / `framework` | `framework` slot or `react-development` skill |
46
+ | Cross-cutting | `.github/instructions/general.instructions.md` |
60
47
 
61
- For each candidate lesson, draft a concrete edit to the target file:
48
+ ### 3 Draft Edit
62
49
 
63
- ```markdown
64
- **Lesson:** LES-XXX — [title]
65
- **Target:** [target file path]
66
- **Section:** [which section to add to or modify]
67
- **Edit:** [exact text to add or modify]
68
- **Rationale:** [why this belongs here rather than staying in lessons]
69
50
  ```
51
+ Lesson: LES-XXX — [title]
52
+ Target: [file path]
53
+ Section: [section name]
54
+ Edit: [exact text]
55
+ ```
56
+ Strategies: add rule, add anti-pattern, add code example, expand existing rule, add table row.
70
57
 
71
- #### Merge Strategies
72
-
73
- - **Add a rule** — if the lesson reveals a new "always do X" or "never do Y", add it to the target file's rules section
74
- - **Add an anti-pattern** — if the lesson describes a common mistake, add it to an anti-patterns or "Common Mistakes" section
75
- - **Add a code example** — if the lesson includes a correct approach with a code block, add it as a documented pattern
76
- - **Expand existing rule** — if a rule already exists but the lesson adds nuance (edge case, exception), update the rule
77
- - **Add a table row** — if the target has a reference table, add the lesson as a new row
78
-
79
- ### Step 4: Apply Edits
58
+ ### 4 — Apply & Attribute
80
59
 
81
- 1. Edit each target file with the drafted changes
82
- 2. Add a comment or note attributing the source: `<!-- Merged from LES-XXX -->`
83
- 3. Verify the edit reads naturally in context (not just pasted in)
60
+ Edit target file; add `<!-- Merged from LES-XXX -->` attribution inline.
84
61
 
85
- ### Step 5: Archive the Merged Lessons
62
+ ### 5 Archive
86
63
 
87
- Move merged lessons from the main body of `LESSONS-LEARNED.md` to an `## Archived (Merged)` section at the bottom of the file:
64
+ Move merged lessons to `## Archived (Merged)` at the bottom of `LESSONS-LEARNED.md`:
88
65
 
89
66
  ```markdown
90
- ## Archived (Merged)
91
-
92
- Lessons below have been merged into instruction/skill files. They are kept here for historical reference.
93
-
94
- ### LES-XXX: [title] → Merged to `[target file]` on YYYY-MM-DD
67
+ ### LES-XXX: [title] → Merged to `[target]` on YYYY-MM-DD
95
68
  ```
96
69
 
97
- **Do NOT delete lessons.** Archive them so they remain searchable and traceable.
70
+ **Never delete lessons** archive for traceability.
98
71
 
99
- ### Step 6: Update the Index
72
+ ### 6 Update Index
100
73
 
101
- Update the `## Index by Category` table in `LESSONS-LEARNED.md` to reflect which lessons are now archived.
74
+ Update `## Index by Category` in `LESSONS-LEARNED.md` to mark archived lessons.
102
75
 
103
76
  ## Quality Gates
104
77
 
105
- Before finalizing a merge:
106
-
107
- - [ ] The merged content reads naturally in the target file (not copy-pasted)
108
- - [ ] The target file's structure and tone are preserved
109
- - [ ] No duplicate information created (check if a similar rule already exists)
110
- - [ ] The archived lesson references the target file
111
- - [ ] The lesson's core insight is preserved — don't lose nuance when summarizing
78
+ - [ ] Merged content reads naturally (not copy-pasted)
79
+ - [ ] No duplicate rules created
80
+ - [ ] Archived lesson references target file
81
+ - [ ] Core insight preserved no loss of nuance
112
82
 
113
83
  ## Anti-Patterns
114
84
 
115
- - **Don't merge too eagerly**a lesson needs to prove itself (3+ citations or 60+ days) before graduating
116
- - **Don't copy verbatim**lessons are written as incident reports; instruction files should read as rules/guidelines
117
- - **Don't merge conflicting lessons**if two lessons contradict, resolve the conflict first
118
- - **Don't merge without context** if the lesson only makes sense with the full story, either include enough context in the target file or keep it in LESSONS-LEARNED.md
119
- - **Don't create new files for merged content** — merge INTO existing files; only create new skills if a genuinely new domain emerges
120
-
121
- ## Frequency
122
-
123
- - **Quarterly review** — schedule a full scan of LESSONS-LEARNED.md every ~3 months
124
- - **Post-feature review** — after major features ship, scan for relevant lessons
125
- - **Ad-hoc** — any time an agent notices "this lesson should be a permanent rule"
85
+ - Merge too eagerly — must meet 3+ citations or 60+ day threshold
86
+ - Copy verbatim — rewrite as rules/guidelines, not incident reports
87
+ - Merge conflicting lessons — resolve conflict first
88
+ - Create new files for merged content merge INTO existing files only
@@ -5,125 +5,79 @@ description: "Session logging, delegation records, review/panel/dispute NDJSON l
5
5
 
6
6
  # Observability Logging
7
7
 
8
- ## Observability Logging (Mandatory)
8
+ > **⛔ HARD GATE.** Every agent MUST log every session to `events.ndjson` before responding. No exceptions. A session without logs is a failed session.
9
9
 
10
- > **⛔ HARD GATE This is a blocking requirement, not a suggestion.**
11
- > Do NOT respond to the user until you have appended the required log records.
12
- > A session without log records is a failed session regardless of code quality.
10
+ | File | Event types | Who | When |
11
+ |------|------------|-----|------|
12
+ | `events.ndjson` | `session`, `delegation`, `review`, `panel`, `dispute` | All agents / Team Lead / Panel runner | After each applicable event |
13
13
 
14
- **Every agent MUST log every session to the observability NDJSON files.** No exceptions. No threshold. No "too small to log." The dashboard depends on this data.
14
+ See `.opencastle/logs/README.md` for full schema.
15
15
 
16
- ### What to log
16
+ Use `opencastle log` CLI. One record per task; never batch-log retrospectively.
17
17
 
18
- | File | Event types | Who appends | When |
19
- |------|------------|------------|------|
20
- | `events.ndjson` | `session`, `delegation`, `review`, `panel`, `dispute` | All agents / Team Lead / Panel runner | After every applicable event — use `--type` to discriminate |
21
-
22
- See `.opencastle/logs/README.md` for the full schema of each record type.
23
-
24
- ### How to log
25
-
26
- Use the `opencastle log` CLI to append events to `.opencastle/logs/events.ndjson`. When the Team Lead works directly, use the agent role that best describes the work (e.g., `--agent Developer`, `--agent "UI-UX Expert"`). If a single conversation involves multiple distinct tasks, log one record per task.
27
-
28
- **Session record** (ALL agents, EVERY session):
18
+ **Session** (ALL agents, EVERY session):
29
19
  ```sh
30
20
  opencastle log --type session --agent Developer --model claude-opus-4-6 \
31
21
  --task "Fix login redirect bug" --outcome success --duration_min 15 \
32
22
  --files_changed 3 --retries 0
33
23
  ```
34
24
 
35
- **Delegation record** (Team Lead only, **immediately after each delegation not at session end**):
25
+ **Delegation** (Team Lead immediately after each delegation, not at session end):
36
26
  ```sh
37
27
  opencastle log --type delegation --session_id feat/prj-57 --agent Developer \
38
28
  --model claude-sonnet-4-6 --tier quality --mechanism sub-agent \
39
29
  --tracker_issue PRJ-57 --outcome success --retries 0 --phase 2 \
40
30
  --file_partition "src/components/"
41
31
  ```
42
- Verify: `tail -1 .opencastle/logs/events.ndjson`
43
32
 
44
- > **`model` and `tier` must reflect the delegated agent's assignment from the agent registry** — not the Team Lead's own model.
33
+ > `model` and `tier` must reflect the delegated agent's assignment from the agent registry.
45
34
 
46
- **Fast review record** (Team Lead, **immediately after each fast review**):
35
+ **Review** (Team Lead immediately after each fast review):
47
36
  ```sh
48
37
  opencastle log --type review --tracker_issue PRJ-42 --agent Developer \
49
38
  --reviewer_model gpt-5-mini --verdict pass --attempt 1 \
50
39
  --issues_critical 0 --issues_major 0 --issues_minor 2 \
51
40
  --confidence high --escalated false --duration_sec 45
52
41
  ```
53
- Verify: `tail -1 .opencastle/logs/events.ndjson`
54
42
 
55
- **Panel record** (Panel runner, **immediately after each panel majority vote**):
43
+ **Panel** (Panel runner immediately after each panel vote):
56
44
  ```sh
57
45
  opencastle log --type panel --panel_key auth-review --verdict pass \
58
46
  --pass_count 3 --block_count 0 --must_fix 0 --should_fix 3 \
59
47
  --reviewer_model claude-opus-4-6 --weighted false --attempt 1 \
60
48
  --tracker_issue PRJ-42 --artifacts_count 5
61
49
  ```
62
- Verify: `tail -1 .opencastle/logs/events.ndjson`
63
50
 
64
- **Dispute record** (Team Lead, **immediately after each dispute**):
51
+ **Dispute** (Team Lead immediately after each dispute):
65
52
  ```sh
66
53
  opencastle log --type dispute --dispute_id DSP-001 --tracker_issue PRJ-42 \
67
54
  --priority high --trigger panel-3x-block --implementing_agent Developer \
68
55
  --reviewing_agents "Reviewer,Panel (3x)" --total_attempts 6 --status pending
69
56
  ```
70
- Verify: `tail -1 .opencastle/logs/events.ndjson`
71
57
 
72
- ### Pre-Response Logging Checklist
58
+ Verify any append: `tail -1 .opencastle/logs/events.ndjson`
73
59
 
74
- **STOP before responding to the user.** Verify each applicable item:
60
+ ## Pre-Response Checklist
75
61
 
76
- - [ ] **Session logged**`events.ndjson` has a new `session` record for this session (ALWAYS required)
77
- - [ ] **Delegations logged** — `events.ndjson` has a `delegation` record for **each** delegation (Team Lead only). Count delegations → count records → must match
78
- - [ ] **Reviews logged** — `events.ndjson` has a `review` record for **each** fast review performed. Count reviews → count records → must match
79
- - [ ] **Panels logged** — `events.ndjson` has a `panel` record for **each** panel review performed. Count panels → count records → must match
80
- - [ ] **Disputes logged** — `events.ndjson` has a `dispute` record for **each** dispute created. Count disputes → count records → must match
62
+ **⛔ STOP.** Verify before respondingfix any missing log NOW.
81
63
 
82
- If ANY required log is missing, run `opencastle log --type <type> ...` NOW before responding.
83
-
84
- ### Rules
85
-
86
- - **Log before yielding to the user** — logging is the LAST action before responding. This is Constitution rule #6.
87
- - **Log per task**, not per conversation. Multiple tasks = multiple records.
88
- - **Never batch-log retrospectively** across sessions.
89
- - **Verify the append succeeded** — if unsure, `tail -1` the file to confirm.
64
+ - [ ] **Lessons read** `.opencastle/LESSONS-LEARNED.md` read at session start
65
+ - [ ] **Lessons captured** — new lesson added via **self-improvement** if any retry occurred
66
+ - [ ] **Discovered issues tracked** — pre-existing bugs added to `KNOWN-ISSUES.md` or tracker
67
+ - [ ] **Lint/type/test pass** — no new errors after code changes
68
+ - [ ] **Session logged** — `events.ndjson` has a `session` record (ALWAYS)
69
+ - [ ] **Delegations logged** `delegation` record per delegation (Team Lead)
70
+ - [ ] **Reviews logged** — `review` record per fast review (if any)
71
+ - [ ] **Panels logged** — `panel` record per panel vote (if any)
72
+ - [ ] **Disputes logged** — `dispute` record per dispute (if any)
90
73
 
91
74
  ## Universal Agent Rules
92
75
 
93
- These rules apply to ALL specialist agents automatically. **Do not duplicate them in individual agent files.**
94
-
95
- 1. **Never delegate** — Specialist agents complete their own work and return results. Never invoke the Team Lead or spawn sub-agents. If work requires another domain, document the need in your output contract.
96
- 2. **Follow the Discovered Issues Policy** — Track any pre-existing bugs found during your work (see the **git-workflow** skill).
97
- 3. **Read and update lessons** — Read `.opencastle/LESSONS-LEARNED.md` before starting. If you retry anything with a different approach that works, use the **self-improvement** skill to add a lesson immediately.
98
- 4. **Log every session** — Append to `.opencastle/logs/events.ndjson` after every session using `opencastle log --type session ...`. No exceptions. This is Constitution rule #6 — a blocking gate, not optional.
76
+ 1. **Never delegate** complete own work; document cross-domain needs in output contract.
77
+ 2. **Follow Discovered Issues Policy** — See [discovered-issues-policy](../../snippets/discovered-issues-policy.md).
78
+ 3. **Read and update lessons** Read `.opencastle/LESSONS-LEARNED.md` before starting; add lessons after retries via **self-improvement** skill.
79
+ 4. **Log every session** — See [logging-mandatory](../../snippets/logging-mandatory.md).
99
80
 
100
81
  ## Base Output Contract
101
82
 
102
- Every specialist agent's Output Contract MUST end with these standard items (in addition to domain-specific items above them):
103
-
104
- - **Observability Logged** — Confirm ALL applicable log records were appended to `events.ndjson` (Constitution rule #6):
105
- - `--type session` — ALWAYS (every agent, every session)
106
- - `--type delegation` — if delegations occurred (Team Lead only)
107
- - `--type review` — if fast reviews occurred
108
- - `--type panel` — if panel reviews occurred
109
- - `--type dispute` — if disputes were created
110
- - **Discovered Issues** — Pre-existing bugs or anomalies found during work, with tracking action taken per the Discovered Issues Policy
111
- - **Lessons Applied** — Lessons from `.opencastle/LESSONS-LEARNED.md` that influenced this work, and any new lessons added
112
-
113
- Agents reference this contract with: `See **Base Output Contract** in the observability-logging skill for the standard closing items.`
114
-
115
- ## Pre-Response Quality Gate
116
-
117
- > **⛔ STOP before responding to the user.** Run through this checklist. If ANY required item is missing, fix it NOW.
118
-
119
- This is the single exit gate for every session. All items are mandatory unless marked conditional.
120
-
121
- - [ ] **Lessons read** — `.opencastle/LESSONS-LEARNED.md` was read at session start (Self-Improvement Protocol)
122
- - [ ] **Lessons captured** — If any retry occurred, a new lesson was added via the **self-improvement** skill
123
- - [ ] **Discovered issues tracked** — Any pre-existing bugs found were added to `KNOWN-ISSUES.md` or a tracker ticket was created (Discovered Issues Policy)
124
- - [ ] **Lint/type/test pass** — No new errors introduced; verification ran after code changes (Constitution rule #5)
125
- - [ ] **Session logged** — `events.ndjson` has a new `session` record for this session (Constitution rule #6 — ALWAYS required)
126
- - [ ] **Delegations logged** — `events.ndjson` has a `delegation` record for each delegation (Team Lead only)
127
- - [ ] **Reviews logged** — `events.ndjson` has a `review` record for each fast review performed (if any)
128
- - [ ] **Panels logged** — `events.ndjson` has a `panel` record for each panel review performed (if any)
129
- - [ ] **Disputes logged** — `events.ndjson` has a `dispute` record for each dispute created (if any)
83
+ > Inherits: [base-output-contract](../../snippets/base-output-contract.md)