opencastle 0.10.7 → 0.11.0

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 (103) hide show
  1. package/README.md +4 -0
  2. package/bin/cli.mjs +4 -0
  3. package/dist/cli/dashboard.d.ts.map +1 -1
  4. package/dist/cli/dashboard.js +5 -1
  5. package/dist/cli/dashboard.js.map +1 -1
  6. package/dist/cli/init.test.js +1 -1
  7. package/dist/cli/init.test.js.map +1 -1
  8. package/dist/cli/lesson.d.ts +17 -0
  9. package/dist/cli/lesson.d.ts.map +1 -0
  10. package/dist/cli/lesson.js +294 -0
  11. package/dist/cli/lesson.js.map +1 -0
  12. package/dist/cli/log.d.ts +7 -0
  13. package/dist/cli/log.d.ts.map +1 -0
  14. package/dist/cli/log.js +131 -0
  15. package/dist/cli/log.js.map +1 -0
  16. package/dist/cli/run/executor.js.map +1 -1
  17. package/dist/cli/run/loop-executor.d.ts +3 -0
  18. package/dist/cli/run/loop-executor.d.ts.map +1 -0
  19. package/dist/cli/run/loop-executor.js +154 -0
  20. package/dist/cli/run/loop-executor.js.map +1 -0
  21. package/dist/cli/run/loop-reporter.d.ts +6 -0
  22. package/dist/cli/run/loop-reporter.d.ts.map +1 -0
  23. package/dist/cli/run/loop-reporter.js +112 -0
  24. package/dist/cli/run/loop-reporter.js.map +1 -0
  25. package/dist/cli/run/reporter.d.ts.map +1 -1
  26. package/dist/cli/run/reporter.js +28 -1
  27. package/dist/cli/run/reporter.js.map +1 -1
  28. package/dist/cli/run/schema.d.ts.map +1 -1
  29. package/dist/cli/run/schema.js +104 -52
  30. package/dist/cli/run/schema.js.map +1 -1
  31. package/dist/cli/run/schema.test.js +214 -0
  32. package/dist/cli/run/schema.test.js.map +1 -1
  33. package/dist/cli/run.d.ts.map +1 -1
  34. package/dist/cli/run.js +84 -3
  35. package/dist/cli/run.js.map +1 -1
  36. package/dist/cli/types.d.ts +59 -1
  37. package/dist/cli/types.d.ts.map +1 -1
  38. package/dist/cli/update.d.ts.map +1 -1
  39. package/dist/cli/update.js +54 -1
  40. package/dist/cli/update.js.map +1 -1
  41. package/package.json +1 -1
  42. package/src/cli/dashboard.ts +5 -1
  43. package/src/cli/init.test.ts +1 -1
  44. package/src/cli/lesson.ts +312 -0
  45. package/src/cli/log.ts +133 -0
  46. package/src/cli/run/executor.ts +8 -8
  47. package/src/cli/run/loop-executor.ts +198 -0
  48. package/src/cli/run/loop-reporter.ts +125 -0
  49. package/src/cli/run/reporter.ts +30 -1
  50. package/src/cli/run/schema.test.ts +242 -2
  51. package/src/cli/run/schema.ts +115 -59
  52. package/src/cli/run.ts +82 -5
  53. package/src/cli/types.ts +67 -1
  54. package/src/cli/update.ts +62 -1
  55. package/src/dashboard/dist/index.html +14 -15
  56. package/src/dashboard/node_modules/.vite/deps/_metadata.json +6 -6
  57. package/src/dashboard/scripts/generate-seed-data.ts +23 -43
  58. package/src/dashboard/seed-data/events.ndjson +104 -0
  59. package/src/dashboard/src/pages/index.astro +14 -15
  60. package/src/orchestrator/agents/api-designer.agent.md +1 -1
  61. package/src/orchestrator/agents/architect.agent.md +1 -1
  62. package/src/orchestrator/agents/content-engineer.agent.md +1 -1
  63. package/src/orchestrator/agents/copywriter.agent.md +1 -1
  64. package/src/orchestrator/agents/data-expert.agent.md +1 -1
  65. package/src/orchestrator/agents/database-engineer.agent.md +1 -1
  66. package/src/orchestrator/agents/developer.agent.md +1 -1
  67. package/src/orchestrator/agents/devops-expert.agent.md +1 -1
  68. package/src/orchestrator/agents/documentation-writer.agent.md +1 -1
  69. package/src/orchestrator/agents/performance-expert.agent.md +1 -1
  70. package/src/orchestrator/agents/release-manager.agent.md +1 -1
  71. package/src/orchestrator/agents/security-expert.agent.md +1 -1
  72. package/src/orchestrator/agents/seo-specialist.agent.md +1 -1
  73. package/src/orchestrator/agents/session-guard.agent.md +9 -21
  74. package/src/orchestrator/agents/team-lead.agent.md +8 -34
  75. package/src/orchestrator/agents/testing-expert.agent.md +1 -1
  76. package/src/orchestrator/agents/ui-ux-expert.agent.md +1 -1
  77. package/src/orchestrator/customizations/AGENT-PERFORMANCE.md +11 -12
  78. package/src/orchestrator/customizations/DISPUTES.md +2 -2
  79. package/src/orchestrator/customizations/README.md +1 -3
  80. package/src/orchestrator/customizations/logs/README.md +66 -14
  81. package/src/orchestrator/instructions/ai-optimization.instructions.md +21 -132
  82. package/src/orchestrator/instructions/general.instructions.md +35 -181
  83. package/src/orchestrator/plugins/nx/SKILL.md +1 -1
  84. package/src/orchestrator/prompts/bootstrap-customizations.prompt.md +4 -8
  85. package/src/orchestrator/prompts/bug-fix.prompt.md +4 -4
  86. package/src/orchestrator/prompts/implement-feature.prompt.md +3 -3
  87. package/src/orchestrator/prompts/quick-refinement.prompt.md +3 -3
  88. package/src/orchestrator/prompts/resolve-pr-comments.prompt.md +1 -1
  89. package/src/orchestrator/skills/agent-hooks/SKILL.md +11 -11
  90. package/src/orchestrator/skills/decomposition/SKILL.md +1 -1
  91. package/src/orchestrator/skills/fast-review/SKILL.md +4 -19
  92. package/src/orchestrator/skills/git-workflow/SKILL.md +72 -0
  93. package/src/orchestrator/skills/memory-merger/SKILL.md +1 -1
  94. package/src/orchestrator/skills/observability-logging/SKILL.md +129 -0
  95. package/src/orchestrator/skills/orchestration-protocols/SKILL.md +2 -2
  96. package/src/orchestrator/skills/panel-majority-vote/SKILL.md +4 -7
  97. package/src/orchestrator/skills/self-improvement/SKILL.md +13 -26
  98. package/src/orchestrator/skills/team-lead-reference/SKILL.md +2 -2
  99. package/src/orchestrator/customizations/logs/delegations.ndjson +0 -1
  100. package/src/orchestrator/customizations/logs/panels.ndjson +0 -1
  101. package/src/orchestrator/customizations/logs/reviews.ndjson +0 -0
  102. package/src/orchestrator/customizations/logs/sessions.ndjson +0 -1
  103. /package/src/orchestrator/customizations/logs/{disputes.ndjson → events.ndjson} +0 -0
@@ -142,11 +142,9 @@ Files are organized into subdirectories by domain:
142
142
  ├── project/ # Project management config
143
143
  │ ├── docs-structure.md
144
144
  │ └── <tracker>-config.md # e.g. linear-config.md, jira-config.md
145
- └── logs/ # Append-only NDJSON session logs
145
+ └── logs/ # Append-only NDJSON event log
146
146
  ├── README.md
147
- ├── sessions.ndjson
148
- ├── delegations.ndjson
149
- └── panels.ndjson
147
+ └── events.ndjson
150
148
  ```
151
149
 
152
150
  #### Root Files (always create)
@@ -241,10 +239,8 @@ Files are organized into subdirectories by domain:
241
239
 
242
240
  #### `logs/` — Session Logs (always create)
243
241
 
244
- 16. **`logs/README.md`** — Schema documentation for the NDJSON log files
245
- 17. **`logs/sessions.ndjson`** — Empty file for structured session log entries
246
- 18. **`logs/delegations.ndjson`** — Empty file for delegation log entries
247
- 19. **`logs/panels.ndjson`** — Empty file for panel review log entries
242
+ 16. **`logs/README.md`** — Schema documentation for the unified NDJSON event log
243
+ 17. **`logs/events.ndjson`** — Empty file for all structured event log entries (sessions, delegations, reviews, panels, disputes)
248
244
 
249
245
  ### Phase 3: Cross-Reference Verification
250
246
 
@@ -93,7 +93,7 @@ Delegate to the appropriate specialist agent via **sub-agent** (inline). For bug
93
93
  - **File paths** — Exact files to read and modify
94
94
  - **Reproduction steps** — So the agent can verify the fix
95
95
  - **Boundaries** — "Only modify files listed above. Fix the bug, do not refactor surrounding code."
96
- - **Self-improvement reminder** — include per `general.instructions.md` § Self-Improvement Protocol
96
+ - **Self-improvement reminder** — include per the **self-improvement** skill
97
97
 
98
98
  #### Implementation Rules
99
99
 
@@ -121,13 +121,13 @@ Every bug fix must pass ALL applicable gates:
121
121
 
122
122
  ### 6. Delivery
123
123
 
124
- Follow the **Delivery Outcome** defined in `general.instructions.md` — commit, push, open PR (not merged), and link to the tracker.
124
+ Follow the **Delivery Outcome** defined in the **git-workflow** skill — commit, push, open PR (not merged), and link to the tracker.
125
125
 
126
126
  ### 7. Wrap Up
127
127
 
128
128
  1. **Move tracker issue to Done** — Only after all validation passes
129
129
  2. **Update Known Issues** — If this was a documented known issue, remove or update the entry in `.github/customizations/KNOWN-ISSUES.md`
130
- 3. **Capture lessons** — If the root cause reveals a pattern that other agents should know about, add it to `.github/customizations/LESSONS-LEARNED.md`
130
+ 3. **Capture lessons** — If the root cause reveals a pattern that other agents should know about, use the **self-improvement** skill to add a lesson
131
131
  4. **Note prevention** — If this class of bug could be caught earlier (by a lint rule, test, or type check), note that in the tracker issue as a follow-up suggestion
132
132
 
133
133
  ### 8. Completion Criteria
@@ -142,7 +142,7 @@ The bug fix is complete when:
142
142
  - [ ] Bug verified fixed in the browser
143
143
  - [ ] No regressions in adjacent functionality
144
144
  - [ ] Both apps checked if shared code was modified
145
- - [ ] Delivery Outcome completed (see `general.instructions.md`) — branch pushed, PR opened (not merged), tracker linked
145
+ - [ ] Delivery Outcome completed (see the **git-workflow** skill) — branch pushed, PR opened (not merged), tracker linked
146
146
  - [ ] Tracker issue moved to Done
147
147
  - [ ] Known issues updated if applicable
148
148
  - [ ] Lessons learned captured if any retries occurred
@@ -64,7 +64,7 @@ Every subtask must be tracked. **No issue = no implementation.** This step produ
64
64
 
65
65
  #### Self-Improvement
66
66
 
67
- Include the self-improvement reminder in every delegation prompt (see `general.instructions.md` § Self-Improvement Protocol).
67
+ Include the self-improvement reminder in every delegation prompt (see the **self-improvement** skill).
68
68
 
69
69
  #### Visual Consistency
70
70
 
@@ -91,7 +91,7 @@ Every subtask must pass ALL gates before being marked Done:
91
91
 
92
92
  ### 5. Delivery
93
93
 
94
- Follow the **Delivery Outcome** defined in `general.instructions.md` — commit, push, open PR (not merged), and link to the tracker.
94
+ Follow the **Delivery Outcome** defined in the **git-workflow** skill — commit, push, open PR (not merged), and link to the tracker.
95
95
 
96
96
  ### 6. Documentation & Traceability
97
97
 
@@ -127,5 +127,5 @@ The roadmap task is complete when:
127
127
  - [ ] Documentation updated (roadmap, known issues, decisions)
128
128
  - [ ] Panel review passed for any high-stakes changes
129
129
  - [ ] Roadmap item marked complete in `.github/customizations/project/roadmap.md`
130
- - [ ] Delivery Outcome completed (see `general.instructions.md`) — branch pushed, PR opened (not merged), tracker linked
130
+ - [ ] Delivery Outcome completed (see the **git-workflow** skill) — branch pushed, PR opened (not merged), tracker linked
131
131
  - [ ] Lessons learned captured if any retries occurred
@@ -84,7 +84,7 @@ Delegate to the appropriate specialist agent(s). Since follow-ups are scoped and
84
84
  - **Where** — exact file paths to read and modify
85
85
  - **How to verify** — what the result should look like or how to test it
86
86
  - **Boundaries** — "Only modify files listed above. Do not refactor unrelated code."
87
- - **Self-improvement reminder** — include per `general.instructions.md` § Self-Improvement Protocol
87
+ - **Self-improvement reminder** — include per the **self-improvement** skill
88
88
 
89
89
  #### Implementation Rules
90
90
 
@@ -110,7 +110,7 @@ Every follow-up, no matter how small, must pass these gates:
110
110
 
111
111
  ### 6. Delivery
112
112
 
113
- If triage determined this follow-up needs tracker tracking, follow the **Delivery Outcome** defined in `general.instructions.md` — commit, push, open PR (not merged), and link to the tracker.
113
+ If triage determined this follow-up needs tracker tracking, follow the **Delivery Outcome** defined in the **git-workflow** skill — commit, push, open PR (not merged), and link to the tracker.
114
114
 
115
115
  If triage determined no tracker tracking is needed (pure cosmetic/isolated/trivial), commit the changes to the current working branch. A dedicated branch and PR are not required because the Team Lead will include these changes in the parent task's existing PR — the "every change goes through a PR" rule is still satisfied via the parent PR.
116
116
 
@@ -138,6 +138,6 @@ The follow-up is complete when:
138
138
  - [ ] **Visual changes verified in Chrome with screenshot taken as proof**
139
139
  - [ ] No regressions in adjacent functionality
140
140
  - [ ] Shared component changes tested across all consuming apps
141
- - [ ] Delivery Outcome completed if tracked (see `general.instructions.md`) — branch pushed, PR opened (not merged), tracker linked
141
+ - [ ] Delivery Outcome completed if tracked (see the **git-workflow** skill) — branch pushed, PR opened (not merged), tracker linked
142
142
  - [ ] Lessons learned captured if any retries occurred
143
143
  - [ ] Known issues updated if a new limitation was discovered
@@ -113,4 +113,4 @@ After resolving comments, report:
113
113
  - **Preserve the reviewer's intent** — don't just technically satisfy the comment, address the underlying concern
114
114
  - **Don't over-fix** — resolve only what was commented on. Save unrelated improvements for a separate PR
115
115
  - **Respond to every comment** — nothing should be silently ignored
116
- - **Self-improvement** — Follow `general.instructions.md` § Self-Improvement Protocol
116
+ - **Self-improvement** — Follow the **self-improvement** skill
@@ -53,13 +53,13 @@ Load relevant skills before writing code.
53
53
 
54
54
  **When:** Before the agent yields control back to the user — every time, unconditionally.
55
55
 
56
- > **⛔ HARD GATE — Run the Pre-Response Quality Gate checklist from `general.instructions.md` before responding.**
56
+ > **⛔ HARD GATE — Run the Pre-Response Quality Gate checklist from the **observability-logging** skill before responding.**
57
57
  > A session without log records is a failed session. A session without lessons captured after retries is a failed session.
58
58
 
59
59
  ### Actions
60
60
 
61
61
  1. **Call Session Guard** (Team Lead only) — Delegate to the **Session Guard** agent with a session summary (delegations, retries, discoveries, files changed). Execute any fix commands it returns. This replaces the manual Pre-Response Quality Gate checklist — the guard runs it automatically with a fresh context window.
62
- 2. **For specialist agents** (not Team Lead) — Run the Pre-Response Quality Gate checklist from `general.instructions.md` manually. Specialist agents don't have access to the Session Guard.
62
+ 2. **For specialist agents** (not Team Lead) — Run the Pre-Response Quality Gate checklist from the **observability-logging** skill manually. Specialist agents don't have access to the Session Guard.
63
63
  3. **Save checkpoint** (Team Lead only) — If work is incomplete, write `.github/customizations/SESSION-CHECKPOINT.md` with current state so the next session can resume. Load **session-checkpoints** skill for format.
64
64
  4. **Memory merge check** — If `LESSONS-LEARNED.md` has grown significantly (5+ new entries this session), flag for memory merge consideration.
65
65
  5. **Clean up** — Remove any temporary files created during the session (e.g., test fixtures, debug outputs).
@@ -67,9 +67,9 @@ Load relevant skills before writing code.
67
67
  ### Template for Delegation Prompts
68
68
 
69
69
  ```
70
- **Session End:** Run the Pre-Response Quality Gate from general.instructions.md:
71
- - Log your session to `.github/customizations/logs/sessions.ndjson` (Constitution rule #6)
72
- - If you retried anything with a different approach that worked, add a lesson to `.github/customizations/LESSONS-LEARNED.md`
70
+ **Session End:** Run the Pre-Response Quality Gate from the **observability-logging** skill:
71
+ - Log your session using the observability-logging skill's session record command (Constitution rule #6)
72
+ - If you retried anything with a different approach that worked, use the **self-improvement** skill to add a lesson
73
73
  - Track any discovered issues in KNOWN-ISSUES.md or a tracker ticket
74
74
  - Clean up temp files
75
75
  ```
@@ -92,26 +92,26 @@ Run the 5-point Pre-Delegation Checks from the Team Lead agent file: (1) Tracker
92
92
 
93
93
  ### Actions
94
94
 
95
- 0. **Log the delegation** — Append a record to `.github/customizations/logs/delegations.ndjson` **before** proceeding to review or verification.
96
- Use the delegation echo command template from the Team Lead agent file § Delegation.
97
- 1. **Fast review (mandatory)** — Run the `fast-review` skill against the agent's output. This is a **non-skippable gate**. See the fast-review skill for the full procedure (single reviewer sub-agent, automatic retry, escalation). Log the review to `reviews.ndjson` immediately after. Only after the fast review passes do you proceed to the remaining post-delegate actions below.
95
+ 0. **Log the delegation (⛔ hard gate)** — Use the **observability-logging** skill's delegation record command. Do NOT proceed to review or any other action until the delegation is logged and verified.
96
+ 1. **Fast review (mandatory)** — Run the `fast-review` skill against the agent's output. This is a **non-skippable gate**. See the fast-review skill for the full procedure (single reviewer sub-agent, automatic retry, escalation). **Log the review (⛔ hard gate)** using the **observability-logging** skill's review record command immediately after — do NOT proceed until logged. Only after both the fast review passes and the review is logged do you proceed to the remaining post-delegate actions below.
98
97
  2. **Verify output** — Read changed files. Check that changes stay within the agent's file partition.
99
98
  2. **Run verification** — Execute appropriate checks: lint, type-check, tests, or visual inspection.
100
99
  3. **Check acceptance criteria** — Compare output against the tracker issue's acceptance criteria. Each criterion must be independently verified.
101
100
  4. **Discovered issues tracked** — Verify the agent followed the Discovered Issues Policy. If they found issues, check that they're in KNOWN-ISSUES.md or a new tracker ticket.
102
- 5. **Lessons captured** — If the agent retried anything, verify a lesson was added to LESSONS-LEARNED.md.
101
+ 5. **Lessons captured** — If the agent retried anything, verify a lesson was added via the **self-improvement** skill.
103
102
  6. **Update tracker** — Move the issue to Done (if passing) or add failure notes and re-delegate (if failing).
104
103
 
105
104
  ### Quick Checklist
106
105
 
107
106
  ```
108
107
  Post-Delegate:
109
- ☐ Delegation logged to delegations.ndjson (before review — verify with tail -1)
108
+ Delegation logged (observability-logging skill — verify with tail -1) — BLOCKING
110
109
  ☐ Changed files reviewed
111
110
  ☐ Files within partition
112
111
  ☐ Lint/test/build passes
113
112
  ☐ Fast review PASS (mandatory — load fast-review skill)
114
- ☐ Review logged to reviews.ndjson (verify with tail -1)
113
+ Review logged (observability-logging skill verify with tail -1) — BLOCKING
114
+ ☐ ⛔ Panel logged if escalated (observability-logging skill — verify with tail -1) — BLOCKING
115
115
  ☐ Acceptance criteria met
116
116
  ☐ Discovered issues tracked (not ignored)
117
117
  ☐ Lessons captured (if retries occurred)
@@ -70,7 +70,7 @@ Return a structured summary with:
70
70
  **Note:** Follow the Structured Output Contract from the team-lead-reference skill. Include all standard fields plus agent-specific extensions.
71
71
 
72
72
  ### Self-Improvement
73
- Read `.github/customizations/LESSONS-LEARNED.md` before starting. If you retry any command/tool with a different approach that works, immediately add a lesson to that file.
73
+ Read `.github/customizations/LESSONS-LEARNED.md` before starting. If you retry any command/tool with a different approach that works, use the **self-improvement** skill to add a lesson immediately.
74
74
  ```
75
75
 
76
76
  For simpler tasks (score 1-3), the existing prompt format (objective + files + criteria) is sufficient. Don't over-engineer delegation for trivial work.
@@ -221,24 +221,9 @@ CONFIDENCE: low | medium | high
221
221
 
222
222
  ## Logging
223
223
 
224
- Append a JSON line to `.github/customizations/logs/reviews.ndjson` after each fast review:
225
-
226
- ```json
227
- {
228
- "timestamp": "2026-02-28T14:30:00Z",
229
- "tracker_issue": "PRJ-42",
230
- "agent": "Developer",
231
- "reviewer_model": "gpt-5-mini",
232
- "verdict": "pass",
233
- "attempt": 1,
234
- "issues_critical": 0,
235
- "issues_major": 0,
236
- "issues_minor": 2,
237
- "confidence": "high",
238
- "escalated": false,
239
- "duration_sec": 45
240
- }
241
- ```
224
+ > **⛔ HARD GATE — Do NOT proceed to the next task or accept the review result until the review is logged.**
225
+
226
+ After each fast review, log the result using the **observability-logging** skill's review record command. See the skill for the exact CLI syntax, required fields, and verify step. An unlogged review is a failed review.
242
227
 
243
228
  ## Integration with Existing Workflow
244
229
 
@@ -326,7 +311,7 @@ For autonomous overnight sessions, fast review is the primary quality gate. Addi
326
311
 
327
312
  ## Metrics & Continuous Improvement
328
313
 
329
- Track these metrics from `reviews.ndjson` to optimize the review process:
314
+ Track these metrics from `events.ndjson` (filter by `"type":"review"`) to optimize the review process:
330
315
 
331
316
  | Metric | Target | Action if Off-Target |
332
317
  |--------|--------|---------------------|
@@ -0,0 +1,72 @@
1
+ ---
2
+ name: git-workflow
3
+ description: "Git branching, PR workflow, delivery requirements, discovered issues policy, and task tracking conventions. Load when committing, pushing, or opening PRs."
4
+ ---
5
+
6
+ # Git Workflow & Delivery
7
+
8
+ ## Git Workflow
9
+
10
+ **NEVER commit or push directly to the `main` branch.** All changes must go through a feature/fix branch and a pull request.
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
17
+
18
+ Branch naming convention: `<type>/<ticket-id>-<short-description>` where type is `fix`, `feat`, `chore`, `refactor`, `perf`, or `docs`.
19
+
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
41
+
42
+ ## Discovered Issues Policy
43
+
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 `.github/customizations/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 `.github/customizations/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.
57
+
58
+ ## Task Tracking
59
+
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:
65
+
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
@@ -49,7 +49,7 @@ Each lesson has a natural home in the instruction/skill hierarchy:
49
49
  | `cms` | The skill mapped by the `cms` slot in the skill matrix |
50
50
  | `database` | The skill mapped by the `database` slot in the skill matrix |
51
51
  | `browser-testing` | The skill mapped by the `e2e-testing` slot in the skill matrix |
52
- | `git-workflow` | `.github/instructions/general.instructions.md` |
52
+ | `git-workflow` | `.github/skills/git-workflow/SKILL.md` |
53
53
  | `deployment` | `.github/skills/deployment-infrastructure/SKILL.md` |
54
54
  | `delegation` | `.github/agents/team-lead.agent.md` or `.github/skills/team-lead-reference/SKILL.md` |
55
55
  | `testing` | `.github/skills/testing-workflow/SKILL.md` |
@@ -0,0 +1,129 @@
1
+ ---
2
+ name: observability-logging
3
+ description: "Session logging, delegation records, review/panel/dispute NDJSON logging, pre-response checklists. Load before responding to verify all logs are written."
4
+ ---
5
+
6
+ # Observability Logging
7
+
8
+ ## Observability Logging (Mandatory)
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.
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.
15
+
16
+ ### What to log
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 `.github/customizations/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 `.github/customizations/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):
29
+ ```sh
30
+ opencastle log --type session --agent Developer --model claude-opus-4-6 \
31
+ --task "Fix login redirect bug" --outcome success --duration_min 15 \
32
+ --files_changed 3 --retries 0
33
+ ```
34
+
35
+ **Delegation record** (Team Lead only, **immediately after each delegation — not at session end**):
36
+ ```sh
37
+ opencastle log --type delegation --session_id feat/prj-57 --agent Developer \
38
+ --model claude-sonnet-4-6 --tier quality --mechanism sub-agent \
39
+ --tracker_issue PRJ-57 --outcome success --retries 0 --phase 2 \
40
+ --file_partition "src/components/"
41
+ ```
42
+ Verify: `tail -1 .github/customizations/logs/events.ndjson`
43
+
44
+ > **`model` and `tier` must reflect the delegated agent's assignment from the agent registry** — not the Team Lead's own model.
45
+
46
+ **Fast review record** (Team Lead, **immediately after each fast review**):
47
+ ```sh
48
+ opencastle log --type review --tracker_issue PRJ-42 --agent Developer \
49
+ --reviewer_model gpt-5-mini --verdict pass --attempt 1 \
50
+ --issues_critical 0 --issues_major 0 --issues_minor 2 \
51
+ --confidence high --escalated false --duration_sec 45
52
+ ```
53
+ Verify: `tail -1 .github/customizations/logs/events.ndjson`
54
+
55
+ **Panel record** (Panel runner, **immediately after each panel majority vote**):
56
+ ```sh
57
+ opencastle log --type panel --panel_key auth-review --verdict pass \
58
+ --pass_count 3 --block_count 0 --must_fix 0 --should_fix 3 \
59
+ --reviewer_model claude-opus-4-6 --weighted false --attempt 1 \
60
+ --tracker_issue PRJ-42 --artifacts_count 5
61
+ ```
62
+ Verify: `tail -1 .github/customizations/logs/events.ndjson`
63
+
64
+ **Dispute record** (Team Lead, **immediately after each dispute**):
65
+ ```sh
66
+ opencastle log --type dispute --dispute_id DSP-001 --tracker_issue PRJ-42 \
67
+ --priority high --trigger panel-3x-block --implementing_agent Developer \
68
+ --reviewing_agents "Reviewer,Panel (3x)" --total_attempts 6 --status pending
69
+ ```
70
+ Verify: `tail -1 .github/customizations/logs/events.ndjson`
71
+
72
+ ### Pre-Response Logging Checklist
73
+
74
+ **STOP before responding to the user.** Verify each applicable item:
75
+
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
81
+
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.
90
+
91
+ ## Universal Agent Rules
92
+
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 `.github/customizations/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 `.github/customizations/logs/events.ndjson` after every session using `opencastle log --type session ...`. No exceptions. This is Constitution rule #6 — a blocking gate, not optional.
99
+
100
+ ## Base Output Contract
101
+
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 `.github/customizations/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** — `.github/customizations/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)
@@ -122,7 +122,7 @@ Common failure modes and how to recover:
122
122
  ### Agent Stuck in Retry Loop
123
123
 
124
124
  **Symptom:** Agent retries the same failing command 3+ times without changing approach.
125
- **Recovery:** Intervene immediately. Read the error output, identify the root cause, and re-delegate with explicit fix instructions. Add a lesson to lessons learned.
125
+ **Recovery:** Intervene immediately. Read the error output, identify the root cause, and re-delegate with explicit fix instructions. Use the **self-improvement** skill to add a lesson.
126
126
 
127
127
  ### MCP Tool Unavailable
128
128
 
@@ -137,7 +137,7 @@ Common failure modes and how to recover:
137
137
  ### Merge Conflict from Parallel Agents
138
138
 
139
139
  **Symptom:** Two background agents modified overlapping files.
140
- **Recovery:** (1) This should never happen if file partitioning was followed. (2) Accept one agent's changes first (the one with more complex work). (3) Re-delegate the simpler changes to adapt to the new state. (4) Add the conflict to your lessons learned.
140
+ **Recovery:** (1) This should never happen if file partitioning was followed. (2) Accept one agent's changes first (the one with more complex work). (3) Re-delegate the simpler changes to adapt to the new state. (4) Use the **self-improvement** skill to add a lesson about the conflict.
141
141
 
142
142
  ### Context Window Exhausted
143
143
 
@@ -82,13 +82,10 @@ The isolated runner subagent must:
82
82
  6. Print a concise summary to chat
83
83
  - Overall verdict + vote tally + path to `<panelDir>/<panelKey>.md`.
84
84
 
85
- 7. Log the panel result
86
- - Append a JSON line to `.github/customizations/logs/panels.ndjson` with the panel record schema (see `.github/customizations/logs/README.md`).
87
- - Include: `timestamp`, `panel_key`, `verdict`, `pass_count`, `block_count`, `must_fix`, `should_fix`, `reviewer_model`, `weighted`, `attempt`, `tracker_issue`, `artifacts_count`, `report_path`.
88
- - Example:
89
- ```bash
90
- echo '{"timestamp":"'$(date -u +%Y-%m-%dT%H:%M:%SZ)'","panel_key":"instruction-refactoring","verdict":"pass","pass_count":3,"block_count":0,"must_fix":0,"should_fix":5,"reviewer_model":"claude-opus-4-6","weighted":false,"attempt":1,"artifacts_count":14,"report_path":".github/customizations/logs/panel/instruction-refactoring.md"}' >> .github/customizations/logs/panels.ndjson
91
- ```
85
+ 7. Log the panel result **(⛔ hard gate — do NOT return the verdict or proceed until logged)**
86
+ - Log the panel result using the **observability-logging** skill's panel record command. An unlogged panel is a failed panel.
87
+ - Include: `panel_key`, `verdict`, `pass_count`, `block_count`, `must_fix`, `should_fix`, `reviewer_model`, `weighted`, `attempt`, `tracker_issue`, `artifacts_count`, `report_path`.
88
+ - The skill's panel record command includes a verify step.
92
89
 
93
90
  Finally: ensure whatever produced the claim being verified links the consolidated panel report as verification evidence.
94
91
 
@@ -21,41 +21,28 @@ This is the team's collective memory — a structured log of tool/command pitfal
21
21
 
22
22
  ## Protocol for All Agents
23
23
 
24
- The core protocol (read lessons → write on retry → log session) is defined in `general.instructions.md` § Self-Improvement Protocol. This skill provides the detailed reference material for writing lessons.
24
+ The core protocol (read lessons → write on retry → log session) is referenced from `general.instructions.md` via the **Workflow & Governance** table. This skill provides the detailed reference material for writing lessons.
25
25
 
26
26
  ## How to Write a Lesson
27
27
 
28
- ### Step 1: Determine the next lesson ID
28
+ > **⛔ HARD GATE — Use the CLI to write lessons. Do NOT edit LESSONS-LEARNED.md directly.**
29
29
 
30
- Look at the last `LES-XXX` entry in `.github/customizations/LESSONS-LEARNED.md` and increment by 1.
30
+ Use the `opencastle lesson` CLI command. It auto-increments the lesson ID, formats the entry, and updates the category index.
31
31
 
32
- ### Step 2: Write the entry
33
-
34
- Add it **before** the `## Index by Category` section, following this template:
35
-
36
- ```markdown
37
- ### LES-XXX: Short descriptive title
38
-
39
- | Field | Value |
40
- |-------|-------|
41
- | **Category** | `category-name` |
42
- | **Added** | YYYY-MM-DD |
43
- | **Severity** | `high` / `medium` / `low` |
44
-
45
- **Problem:** What went wrong and what error/behavior was observed.
46
-
47
- **Wrong approach:** The obvious/intuitive approach that fails (with code block).
48
-
49
- **Correct approach:** The working solution (with code block).
50
-
51
- **Why:** Root cause explanation (if known).
32
+ ```sh
33
+ opencastle lesson --title "Short descriptive title" --category general --severity high \
34
+ --problem "What went wrong and what error/behavior was observed" \
35
+ --wrong "The obvious/intuitive approach that fails" \
36
+ --correct "The working solution" \
37
+ --why "Root cause explanation"
52
38
  ```
53
39
 
54
- ### Step 3: Update the index
40
+ Required flags: `--title`, `--category`, `--severity`, `--problem`
41
+ Optional flags: `--wrong`, `--correct`, `--why`
55
42
 
56
- Add the lesson ID to the appropriate category row in the `## Index by Category` table.
43
+ Run `opencastle lesson --help` for full usage and valid category/severity values.
57
44
 
58
- ### Step 4: Update related instruction files (if applicable)
45
+ ### After writing the lesson
59
46
 
60
47
  If the lesson reveals a gap in existing instruction/skill files, **also update those files** to include the correct approach. This prevents the pitfall at the source level, not just as a retroactive note.
61
48
 
@@ -234,7 +234,7 @@ When automated resolution is exhausted (panel 3x BLOCK, approach conflicts, or c
234
234
  5. **Present resolution options** — At least 2 concrete options with rationale and risk for each
235
235
  6. **Recommend an action** — Which option the Team Lead thinks is best, with specific next steps
236
236
  7. **Link artifacts** — Panel reports, review logs, changed files, DLQ entries
237
- 8. **Log to disputes.ndjson** — Append a machine-readable record (see logs README)
237
+ 8. **Log to events.ndjson** — Use the **observability-logging** skill's dispute record command
238
238
  9. **Update the tracker issue** — Add the dispute ID and link to the dispute record
239
239
  10. **Update the Index table** — Add the new dispute to the bottom of the Index
240
240
 
@@ -245,7 +245,7 @@ When a human resolves a dispute:
245
245
  2. Record which option was chosen and any additional instructions
246
246
  3. If `resolved` → re-delegate the task with the human's decision as an explicit constraint
247
247
  4. If `deferred` → create a follow-up tracker issue and continue with other work
248
- 5. Log the resolution in `disputes.ndjson` (update the existing record or append a resolution event)
248
+ 5. Log the resolution in `events.ndjson` using the **observability-logging** skill's dispute record command (update or append a resolution event)
249
249
 
250
250
  ### Session Start: Check Disputes
251
251