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.
- package/README.md +13 -3
- package/bin/cli.mjs +2 -0
- package/package.json +1 -1
- package/src/dashboard/node_modules/.vite/deps/_metadata.json +6 -6
- package/src/orchestrator/agents/api-designer.agent.md +25 -34
- package/src/orchestrator/agents/architect.agent.md +40 -84
- package/src/orchestrator/agents/content-engineer.agent.md +29 -31
- package/src/orchestrator/agents/copywriter.agent.md +35 -60
- package/src/orchestrator/agents/data-expert.agent.md +24 -30
- package/src/orchestrator/agents/database-engineer.agent.md +26 -31
- package/src/orchestrator/agents/developer.agent.md +32 -34
- package/src/orchestrator/agents/devops-expert.agent.md +31 -26
- package/src/orchestrator/agents/documentation-writer.agent.md +29 -29
- package/src/orchestrator/agents/performance-expert.agent.md +36 -33
- package/src/orchestrator/agents/release-manager.agent.md +25 -34
- package/src/orchestrator/agents/researcher.agent.md +41 -95
- package/src/orchestrator/agents/reviewer.agent.md +24 -34
- package/src/orchestrator/agents/security-expert.agent.md +35 -39
- package/src/orchestrator/agents/seo-specialist.agent.md +25 -32
- package/src/orchestrator/agents/session-guard.agent.md +20 -79
- package/src/orchestrator/agents/team-lead.agent.md +50 -254
- package/src/orchestrator/agents/testing-expert.agent.md +37 -49
- package/src/orchestrator/agents/ui-ux-expert.agent.md +33 -39
- package/src/orchestrator/customizations/KNOWN-ISSUES.md +0 -1
- package/src/orchestrator/customizations/agents/skill-matrix.json +12 -0
- package/src/orchestrator/instructions/general.instructions.md +24 -84
- package/src/orchestrator/plugins/astro/SKILL.md +23 -179
- package/src/orchestrator/plugins/convex/SKILL.md +38 -12
- package/src/orchestrator/plugins/netlify/SKILL.md +17 -13
- package/src/orchestrator/plugins/nextjs/SKILL.md +55 -261
- package/src/orchestrator/plugins/nx/SKILL.md +20 -72
- package/src/orchestrator/plugins/playwright/SKILL.md +5 -17
- package/src/orchestrator/plugins/slack/SKILL.md +28 -190
- package/src/orchestrator/plugins/teams/SKILL.md +10 -140
- package/src/orchestrator/plugins/vitest/SKILL.md +2 -2
- package/src/orchestrator/prompts/bug-fix.prompt.md +25 -63
- package/src/orchestrator/prompts/implement-feature.prompt.md +29 -66
- package/src/orchestrator/prompts/quick-refinement.prompt.md +31 -66
- package/src/orchestrator/skills/accessibility-standards/SKILL.md +50 -105
- package/src/orchestrator/skills/agent-hooks/SKILL.md +60 -110
- package/src/orchestrator/skills/agent-memory/SKILL.md +44 -93
- package/src/orchestrator/skills/api-patterns/SKILL.md +20 -68
- package/src/orchestrator/skills/code-commenting/SKILL.md +49 -101
- package/src/orchestrator/skills/context-map/SKILL.md +47 -88
- package/src/orchestrator/skills/data-engineering/SKILL.md +27 -74
- package/src/orchestrator/skills/decomposition/SKILL.md +50 -98
- package/src/orchestrator/skills/deployment-infrastructure/SKILL.md +44 -107
- package/src/orchestrator/skills/documentation-standards/SKILL.md +28 -89
- package/src/orchestrator/skills/fast-review/SKILL.md +51 -276
- package/src/orchestrator/skills/frontend-design/SKILL.md +53 -163
- package/src/orchestrator/skills/git-workflow/SKILL.md +18 -54
- package/src/orchestrator/skills/memory-merger/SKILL.md +51 -88
- package/src/orchestrator/skills/observability-logging/SKILL.md +29 -75
- package/src/orchestrator/skills/orchestration-protocols/SKILL.md +58 -117
- package/src/orchestrator/skills/panel-majority-vote/SKILL.md +65 -140
- package/src/orchestrator/skills/performance-optimization/SKILL.md +21 -85
- package/src/orchestrator/skills/project-consistency/SKILL.md +62 -281
- package/src/orchestrator/skills/react-development/SKILL.md +38 -86
- package/src/orchestrator/skills/security-hardening/SKILL.md +40 -84
- package/src/orchestrator/skills/self-improvement/SKILL.md +26 -60
- package/src/orchestrator/skills/seo-patterns/SKILL.md +40 -105
- package/src/orchestrator/skills/session-checkpoints/SKILL.md +26 -68
- package/src/orchestrator/skills/team-lead-reference/SKILL.md +66 -206
- package/src/orchestrator/skills/testing-workflow/SKILL.md +42 -112
- package/src/orchestrator/skills/validation-gates/SKILL.md +39 -170
- package/src/orchestrator/snippets/base-output-contract.md +14 -0
- package/src/orchestrator/snippets/discovered-issues-policy.md +15 -0
- package/src/orchestrator/snippets/logging-mandatory.md +11 -0
- package/src/orchestrator/snippets/never-expose-secrets.md +22 -0
|
@@ -3,164 +3,109 @@ name: accessibility-standards
|
|
|
3
3
|
description: "WCAG 2.2 Level AA accessibility patterns for React/HTML/CSS. Use when creating or modifying UI components, forms, navigation, tables, images, or any user-facing elements. Covers keyboard navigation, screen reader semantics, low vision contrast, voice access, and inclusive language."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
<!-- ⚠️ This file is managed by OpenCastle. Edits will be overwritten on update. Customize in the .opencastle/ directory instead. -->
|
|
7
|
-
|
|
8
6
|
# Accessibility Standards
|
|
9
7
|
|
|
10
|
-
Code must conform to [WCAG 2.2 Level AA](https://www.w3.org/TR/WCAG22/).
|
|
11
|
-
|
|
12
|
-
## Workflow
|
|
8
|
+
Code must conform to [WCAG 2.2 Level AA](https://www.w3.org/TR/WCAG22/).
|
|
13
9
|
|
|
14
|
-
|
|
15
|
-
2. After generating code, review against WCAG 2.2 and these patterns. Iterate until compliant.
|
|
16
|
-
3. Inform the user the code was built with accessibility in mind but may still have issues. Suggest [Accessibility Insights](https://accessibilityinsights.io/) for testing.
|
|
10
|
+
**Workflow:** Plan accessible implementation → generate → review against WCAG 2.2 → iterate. Suggest [Accessibility Insights](https://accessibilityinsights.io/) for testing.
|
|
17
11
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
- Use people-first language ("person using a screen reader," not "blind user").
|
|
21
|
-
- Avoid stereotypes or assumptions about ability.
|
|
22
|
-
- Flag uncertain implementations — include reasoning or references to standards.
|
|
12
|
+
**Language:** People-first ("person using a screen reader," not "blind user"). No ability stereotypes. Flag uncertain implementations with reasoning.
|
|
23
13
|
|
|
24
14
|
## Cognitive
|
|
25
15
|
|
|
26
|
-
|
|
27
|
-
- Use consistent page structure (landmarks) across the application.
|
|
28
|
-
- Keep navigation items in the same order across pages.
|
|
29
|
-
- Keep the interface clean — reduce unnecessary distractions.
|
|
16
|
+
Plain language; consistent landmarks and nav order across pages; minimal distractions.
|
|
30
17
|
|
|
31
18
|
## Keyboard
|
|
32
19
|
|
|
33
|
-
- All interactive elements
|
|
34
|
-
-
|
|
35
|
-
-
|
|
36
|
-
- Static (non-interactive) elements should NOT have `tabindex`. Exception: elements receiving programmatic focus (e.g., headings) get `tabindex="-1"`.
|
|
37
|
-
- Hidden elements must not be keyboard focusable.
|
|
20
|
+
- All interactive elements keyboard-navigable with visible focus in reading order.
|
|
21
|
+
- No `tabindex` on static elements; `tabindex="-1"` only for elements receiving programmatic focus.
|
|
22
|
+
- Hidden elements must not be focusable.
|
|
38
23
|
|
|
39
|
-
|
|
24
|
+
**Composite components** (grids, listboxes, menus, tabs, toolbars): tab stop on container; arrow keys navigate children via roving tabindex or `aria-activedescendant`; on focus restore last/first child.
|
|
40
25
|
|
|
41
|
-
|
|
42
|
-
- Arrow keys navigate children (roving tabindex or `aria-activedescendant`).
|
|
43
|
-
- On focus: show selected child, or previously focused child, or first interactive child.
|
|
26
|
+
**Roving tabindex:** First child `tabindex="0"`, rest `-1`; on arrow key set prev to `-1`, new to `0`, call `.focus()`.
|
|
44
27
|
|
|
45
|
-
|
|
28
|
+
**`aria-activedescendant`:** Container `tabindex="0"` + `aria-activedescendant="IDREF"`; CSS draws outline on referenced element; arrow keys update attribute.
|
|
46
29
|
|
|
47
|
-
|
|
30
|
+
**Skip link** (first focusable element):
|
|
48
31
|
|
|
49
32
|
```html
|
|
50
|
-
<
|
|
51
|
-
<a href="#maincontent" class="sr-only">Skip to main</a>
|
|
52
|
-
</header>
|
|
33
|
+
<a href="#maincontent" class="sr-only">Skip to main</a>
|
|
53
34
|
<main id="maincontent"></main>
|
|
54
35
|
```
|
|
55
36
|
|
|
56
37
|
```css
|
|
57
|
-
.sr-only:not(:focus):not(:active) {
|
|
58
|
-
clip: rect(0 0 0 0);
|
|
59
|
-
clip-path: inset(50%);
|
|
60
|
-
height: 1px;
|
|
61
|
-
overflow: hidden;
|
|
62
|
-
position: absolute;
|
|
63
|
-
white-space: nowrap;
|
|
64
|
-
width: 1px;
|
|
65
|
-
}
|
|
38
|
+
.sr-only:not(:focus):not(:active) { clip: rect(0 0 0 0); clip-path: inset(50%); height: 1px; overflow: hidden; position: absolute; white-space: nowrap; width: 1px; }
|
|
66
39
|
```
|
|
67
40
|
|
|
68
|
-
### Common Keys
|
|
69
|
-
|
|
70
41
|
| Key | Action |
|
|
71
42
|
|-----|--------|
|
|
72
43
|
| `Tab` | Next interactive element |
|
|
73
44
|
| `Arrow` | Navigate within composite component |
|
|
74
45
|
| `Enter` | Activate focused control |
|
|
75
|
-
| `Escape` | Close
|
|
76
|
-
|
|
77
|
-
### Roving Tabindex Pattern
|
|
78
|
-
|
|
79
|
-
1. Initial: `tabindex="0"` on first focusable child, `tabindex="-1"` on rest.
|
|
80
|
-
2. On arrow key: set previous to `-1`, new target to `0`, call `element.focus()`.
|
|
81
|
-
|
|
82
|
-
### `aria-activedescendant` Pattern
|
|
83
|
-
|
|
84
|
-
- Container has `tabindex="0"` and `aria-activedescendant="IDREF"`.
|
|
85
|
-
- CSS draws focus outline on referenced element.
|
|
86
|
-
- Arrow keys update `aria-activedescendant`.
|
|
46
|
+
| `Escape` | Close dialogs/menus |
|
|
87
47
|
|
|
88
48
|
## Low Vision
|
|
89
49
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
50
|
+
| Rule | Requirement |
|
|
51
|
+
|------|-------------|
|
|
52
|
+
| Text contrast | ≥4.5:1 (≥3:1 for large text: 18.5px bold / 24px) |
|
|
53
|
+
| Graphics/controls | ≥3:1 with adjacent colors |
|
|
54
|
+
| State indicators (pressed, focus, checked) | ≥3:1 |
|
|
55
|
+
| Color | Never the sole conveyor of information |
|
|
95
56
|
|
|
96
57
|
## Screen Reader
|
|
97
58
|
|
|
98
|
-
-
|
|
99
|
-
-
|
|
100
|
-
-
|
|
59
|
+
- Correct semantics (name, role, value, states). Prefer native HTML; ARIA only when necessary.
|
|
60
|
+
- Landmarks: `<header>`, `<nav>`, `<main>`, `<footer>`.
|
|
61
|
+
- One `<h1>` per page; `<h1>`–`<h6>` introduce sections; no skipping levels.
|
|
101
62
|
|
|
102
63
|
## Voice Access
|
|
103
64
|
|
|
104
|
-
-
|
|
105
|
-
- `aria-label` must
|
|
65
|
+
- Interactive element accessible name must contain its visible label text.
|
|
66
|
+
- `aria-label` must include the visible label.
|
|
106
67
|
|
|
107
68
|
## Forms
|
|
108
69
|
|
|
109
|
-
- Labels
|
|
70
|
+
- Labels accurately describe control purpose.
|
|
110
71
|
- Required fields: asterisk in label + `aria-required="true"`.
|
|
111
|
-
- Errors: `aria-invalid="true"`
|
|
112
|
-
-
|
|
113
|
-
- Submit buttons should NOT be disabled — trigger error messages instead.
|
|
114
|
-
- On submit with invalid input, focus the first invalid field.
|
|
72
|
+
- Errors: `aria-invalid="true"` + `aria-describedby` pointing to error message.
|
|
73
|
+
- Don't disable submit — show errors instead; focus first invalid field on submit.
|
|
115
74
|
|
|
116
|
-
##
|
|
75
|
+
## Images
|
|
117
76
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
77
|
+
| Type | Pattern |
|
|
78
|
+
|------|---------|
|
|
79
|
+
| Informative | `alt="[meaning]"` on `<img>`; `role="img"` + `aria-label` on `<svg>` / icon fonts |
|
|
80
|
+
| Decorative | `alt=""` on `<img>`; `aria-hidden="true"` on `role="img"` |
|
|
121
81
|
|
|
122
82
|
## Input Labels
|
|
123
83
|
|
|
124
|
-
-
|
|
125
|
-
-
|
|
126
|
-
-
|
|
127
|
-
- Help text: associate via `aria-describedby`.
|
|
84
|
+
- `<label for="id">` for form inputs; all interactive elements need visible labels.
|
|
85
|
+
- Disambiguate repeated labels (e.g., "Remove") with `aria-label`.
|
|
86
|
+
- Help text via `aria-describedby`.
|
|
128
87
|
|
|
129
88
|
## Navigation
|
|
130
89
|
|
|
131
90
|
```html
|
|
132
|
-
<nav>
|
|
133
|
-
<
|
|
134
|
-
<li>
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
<li><a href="..." tabindex="-1">Link 1</a></li>
|
|
138
|
-
</ul>
|
|
139
|
-
</li>
|
|
140
|
-
<li>
|
|
141
|
-
<button aria-expanded="false" tabindex="-1">Section 2</button>
|
|
142
|
-
<ul hidden>
|
|
143
|
-
<li><a href="..." tabindex="-1">Link 1</a></li>
|
|
144
|
-
</ul>
|
|
145
|
-
</li>
|
|
146
|
-
</ul>
|
|
147
|
-
</nav>
|
|
91
|
+
<nav><ul>
|
|
92
|
+
<li><button aria-expanded="false" tabindex="0">Section 1</button>
|
|
93
|
+
<ul hidden><li><a href="..." tabindex="-1">Link 1</a></li></ul>
|
|
94
|
+
</li>
|
|
95
|
+
</ul></nav>
|
|
148
96
|
```
|
|
149
97
|
|
|
150
|
-
-
|
|
151
|
-
- Toggle `aria-expanded` on expand/collapse.
|
|
152
|
-
- Roving tabindex
|
|
153
|
-
- `Escape` closes expanded menus.
|
|
98
|
+
- Use `<nav>` + `<ul>`, NOT `menu`/`menubar` roles.
|
|
99
|
+
- Toggle `aria-expanded` on expand/collapse; `Escape` closes menus.
|
|
100
|
+
- Roving tabindex across main items; arrow down into sub-menus.
|
|
154
101
|
|
|
155
102
|
## Page Title
|
|
156
103
|
|
|
157
|
-
-
|
|
158
|
-
-
|
|
159
|
-
- Front-load unique information: `"[Page] - [Section] - [Site]"`.
|
|
104
|
+
- `<title>` describes page purpose, unique per page.
|
|
105
|
+
- Front-load unique info: `"[Page] - [Section] - [Site]"`.
|
|
160
106
|
|
|
161
|
-
## Tables
|
|
107
|
+
## Tables & Grids
|
|
162
108
|
|
|
163
|
-
- Column headers
|
|
164
|
-
- `role="gridcell"`
|
|
165
|
-
-
|
|
166
|
-
- Use `<table>` for static data, `role="grid"` for interactive data (date pickers, calendars).
|
|
109
|
+
- Column headers: `<th>` in first `<tr>`; row headers: `<th>` in each row.
|
|
110
|
+
- `role="gridcell"` nested within `role="row"`.
|
|
111
|
+
- `<table>` for static data; `role="grid"` for interactive (date pickers, calendars).
|
|
@@ -3,150 +3,100 @@ name: agent-hooks
|
|
|
3
3
|
description: "Lifecycle hooks for AI agent sessions — reusable actions that run at specific points (session start, session end, pre-delegation, post-delegation). Defines what to do at each lifecycle event so agents behave consistently."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
<!-- ⚠️ This file is managed by OpenCastle. Edits will be overwritten on update. Customize in the .opencastle/ directory instead. -->
|
|
7
|
-
|
|
8
6
|
# Agent Lifecycle Hooks
|
|
9
7
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
## Hook Execution Model
|
|
13
|
-
|
|
14
|
-
Hooks are **conventions, not automated triggers**. Agents must explicitly follow them. The Team Lead includes hook reminders in delegation prompts; specialist agents include them in their own workflow.
|
|
8
|
+
Conventions (not auto-triggers) agents execute at specific lifecycle points. Team Lead includes hook reminders in delegation prompts; specialists follow them in their own workflow.
|
|
15
9
|
|
|
16
10
|
```
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
on-pre-delegate → on-post-delegate
|
|
11
|
+
on-session-start → [work loop] → on-session-end
|
|
12
|
+
↓ ↑
|
|
13
|
+
on-pre-delegate → on-post-delegate
|
|
21
14
|
```
|
|
22
15
|
|
|
23
16
|
---
|
|
24
17
|
|
|
25
|
-
##
|
|
26
|
-
|
|
27
|
-
**When:** First action in any agent session (Team Lead or specialist).
|
|
28
|
-
|
|
29
|
-
### Actions
|
|
30
|
-
|
|
31
|
-
1. **Read lessons learned** — Scan `.opencastle/LESSONS-LEARNED.md` for entries relevant to the current task domain. Apply proactively.
|
|
32
|
-
2. **Check for checkpoint** — If `.opencastle/SESSION-CHECKPOINT.md` exists, read it. Resume from last known state instead of re-analyzing.
|
|
33
|
-
3. **Check pending approvals** — If the checkpoint has a `## Pending Approvals` section, check for replies using the configured messaging provider's MCP tools (e.g., `conversations_replies` for Slack). Read `.opencastle.json` → `stack.teamTools` to determine the provider. If no messaging is configured, skip this step.
|
|
34
|
-
4. **Check dead letter queue** — Scan `.opencastle/AGENT-FAILURES.md` for pending failures related to the current scope.
|
|
35
|
-
5. **Validate skill-matrix bindings** — Open `.opencastle/agents/skill-matrix.json` and check whether the `bindings` object has any slots with non-empty `entries` arrays. If all entries are empty, **warn the user** that the bootstrap hasn't been run and capability slots will not resolve. Suggest running the *"Bootstrap Customizations"* prompt first. Do NOT silently continue with empty bindings.
|
|
36
|
-
6. **Check project context** — If `.opencastle/project.instructions.md` has only empty template rows (`| | | |`), warn the user that bootstrap hasn't populated project context.
|
|
37
|
-
7. **Load domain skills** — Based on the task description, load the appropriate skills before writing code. Don't start coding without the relevant skill loaded.
|
|
38
|
-
|
|
39
|
-
### Template for Delegation Prompts
|
|
18
|
+
## on-session-start — First action in any session
|
|
40
19
|
|
|
41
|
-
|
|
20
|
+
| # | Action | Detail |
|
|
21
|
+
|---|--------|--------|
|
|
22
|
+
| 1 | Read lessons | Scan `.opencastle/LESSONS-LEARNED.md` for task-relevant entries. |
|
|
23
|
+
| 2 | Check checkpoint | If `.opencastle/SESSION-CHECKPOINT.md` exists, resume from it. |
|
|
24
|
+
| 3 | Check pending approvals | If checkpoint has `## Pending Approvals`, check replies via messaging provider (`stack.teamTools` in `.opencastle.json`). Skip if no messaging configured. |
|
|
25
|
+
| 4 | Check DLQ | Scan `.opencastle/AGENT-FAILURES.md` for failures in current scope. |
|
|
26
|
+
| 5 | Validate skill-matrix | Open `.opencastle/agents/skill-matrix.json` — if all `bindings` entries are empty, **warn** user to run *"Bootstrap Customizations"* prompt first. |
|
|
27
|
+
| 6 | Check project context | If `.opencastle/project.instructions.md` has only empty template rows, warn bootstrap hasn't run. |
|
|
28
|
+
| 7 | Load domain skills | Load appropriate skills before writing code. |
|
|
42
29
|
|
|
30
|
+
**Delegation reminder:**
|
|
43
31
|
```
|
|
44
|
-
|
|
45
|
-
Check `.opencastle/SESSION-CHECKPOINT.md` for prior state and pending approvals.
|
|
46
|
-
If pending approvals exist, check for replies via the messaging provider.
|
|
47
|
-
Validate `.opencastle/agents/skill-matrix.json` — warn if skill bindings are empty (bootstrap not run).
|
|
48
|
-
Load relevant skills before writing code.
|
|
32
|
+
Session Start: Read `.opencastle/LESSONS-LEARNED.md`. Check `.opencastle/SESSION-CHECKPOINT.md` for prior state and pending approvals. Validate `.opencastle/agents/skill-matrix.json` — warn if bindings empty. Load relevant skills before coding.
|
|
49
33
|
```
|
|
50
34
|
|
|
51
35
|
---
|
|
52
36
|
|
|
53
|
-
##
|
|
37
|
+
## on-session-end — Before yielding control, every time unconditionally
|
|
54
38
|
|
|
55
|
-
|
|
39
|
+
> **⛔ HARD GATE** — See [logging-mandatory](../../snippets/logging-mandatory.md). Run the Pre-Response Quality Gate from the **observability-logging** skill.
|
|
56
40
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
3. **Save checkpoint** (Team Lead only) — If work is incomplete, write `.opencastle/SESSION-CHECKPOINT.md` with current state so the next session can resume. Load **session-checkpoints** skill for format.
|
|
65
|
-
4. **Memory merge check** — If `LESSONS-LEARNED.md` has grown significantly (5+ new entries this session), flag for memory merge consideration.
|
|
66
|
-
5. **Clean up** — Remove any temporary files created during the session (e.g., test fixtures, debug outputs).
|
|
67
|
-
|
|
68
|
-
### Template for Delegation Prompts
|
|
41
|
+
| # | Action | Who |
|
|
42
|
+
|---|--------|-----|
|
|
43
|
+
| 1 | Call Session Guard with session summary; execute fix commands it returns | Team Lead only |
|
|
44
|
+
| 2 | Run Pre-Response Quality Gate checklist from **observability-logging** skill | Specialists only |
|
|
45
|
+
| 3 | Write `.opencastle/SESSION-CHECKPOINT.md` if work is incomplete (load **session-checkpoints** skill) | Team Lead only |
|
|
46
|
+
| 4 | Flag for memory merge if 5+ new lessons this session | All |
|
|
47
|
+
| 5 | Remove temp files created during session | All |
|
|
69
48
|
|
|
49
|
+
**Delegation reminder (specialists):**
|
|
70
50
|
```
|
|
71
|
-
|
|
72
|
-
- Log your session using the observability-logging skill's session record command (Constitution rule #6)
|
|
73
|
-
- If you retried anything with a different approach that worked, use the **self-improvement** skill to add a lesson
|
|
74
|
-
- Track any discovered issues in KNOWN-ISSUES.md or a tracker ticket
|
|
75
|
-
- Clean up temp files
|
|
51
|
+
Session End: Log session via observability-logging skill (Constitution rule #6). Add lesson via self-improvement if retried. Track discovered issues in KNOWN-ISSUES.md or tracker. Clean up temp files.
|
|
76
52
|
```
|
|
77
53
|
|
|
78
|
-
> **Note for Team Lead:** You do NOT use this template yourself. Instead, call the **Session Guard** agent (step 10 in your role). This template is only for specialist agents you delegate to.
|
|
79
|
-
|
|
80
|
-
---
|
|
81
|
-
|
|
82
|
-
## Hook: on-pre-delegate
|
|
83
|
-
|
|
84
|
-
**When:** Team Lead only — before every delegation (sub-agent or background agent).
|
|
85
|
-
|
|
86
|
-
Run the 5-point Pre-Delegation Checks from the Team Lead agent file: (1) Tracker issue exists, (2) File partition clean, (3) Dependencies verified Done, (4) Prompt has file paths + acceptance criteria, (5) Self-improvement reminder included. For complex tasks (5+ files), also generate a context map.
|
|
87
|
-
|
|
88
54
|
---
|
|
89
55
|
|
|
90
|
-
##
|
|
91
|
-
|
|
92
|
-
**When:** Team Lead only — after receiving results from a delegated agent.
|
|
56
|
+
## on-pre-delegate — Team Lead only, before every delegation
|
|
93
57
|
|
|
94
|
-
|
|
58
|
+
Run the 5-point Pre-Delegation Checks from the Team Lead agent file: (1) Tracker issue exists, (2) File partition clean, (3) Dependencies verified Done, (4) Prompt has file paths + acceptance criteria, (5) Self-improvement reminder included. For 5+ files, generate a context map.
|
|
95
59
|
|
|
96
|
-
|
|
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 (⛔ 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
|
-
2. **Verify output** — Read changed files. Check that changes stay within the agent's file partition.
|
|
99
|
-
2. **Run verification** — Execute appropriate checks: lint, type-check, tests, or visual inspection.
|
|
100
|
-
3. **Check acceptance criteria** — Compare output against the tracker issue's acceptance criteria. Each criterion must be independently verified.
|
|
101
|
-
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 via the **self-improvement** skill.
|
|
103
|
-
6. **Update tracker** — Move the issue to Done (if passing) or add failure notes and re-delegate (if failing). On 3rd failure → log to `.opencastle/AGENT-FAILURES.md` (DLQ format in file header).
|
|
104
|
-
7. **Update agent expertise** — In `.opencastle/AGENT-EXPERTISE.md`: first-attempt success → add strong area; 2+ retries → add weak area. Update file familiarity with touched files.
|
|
105
|
-
8. **Append knowledge graph** — Add file-to-file relationships the agent touched to `.opencastle/KNOWLEDGE-GRAPH.md` (one row per dependency discovered).
|
|
60
|
+
## on-post-delegate — Team Lead only, after receiving delegation results
|
|
106
61
|
|
|
107
|
-
|
|
62
|
+
| # | Action |
|
|
63
|
+
|---|--------|
|
|
64
|
+
| 0 | **⛔ Log delegation** via observability-logging skill — BLOCKING |
|
|
65
|
+
| 1 | **Fast review (mandatory)** — run `fast-review` skill; **⛔ log review** — BLOCKING. Escalate to panel if needed; **⛔ log panel** — BLOCKING |
|
|
66
|
+
| 2 | Read changed files; verify within file partition |
|
|
67
|
+
| 3 | Run lint, type-check, tests |
|
|
68
|
+
| 4 | Verify each acceptance criterion against tracker issue |
|
|
69
|
+
| 5 | Confirm Discovered Issues Policy followed (KNOWN-ISSUES.md or tracker ticket) |
|
|
70
|
+
| 6 | If agent retried, verify lesson added via **self-improvement** skill |
|
|
71
|
+
| 7 | Move issue to Done or re-delegate; on 3rd failure → log to `.opencastle/AGENT-FAILURES.md` |
|
|
72
|
+
| 8 | Update `.opencastle/AGENT-EXPERTISE.md` (strong/weak area + file familiarity) |
|
|
73
|
+
| 9 | Append file relationships to `.opencastle/KNOWLEDGE-GRAPH.md` |
|
|
108
74
|
|
|
75
|
+
**Quick checklist:**
|
|
109
76
|
```
|
|
110
|
-
|
|
111
|
-
☐
|
|
112
|
-
☐ Changed files reviewed
|
|
113
|
-
☐ Files within partition
|
|
77
|
+
☐ ⛔ Delegation logged (verify: tail -1 events.ndjson) — BLOCKING
|
|
78
|
+
☐ Changed files reviewed; within partition
|
|
114
79
|
☐ Lint/test/build passes
|
|
115
|
-
☐ Fast review PASS
|
|
116
|
-
☐ ⛔
|
|
117
|
-
☐ ⛔ Panel logged if escalated (observability-logging skill — verify with tail -1) — BLOCKING
|
|
80
|
+
☐ Fast review PASS; ⛔ Review logged — BLOCKING
|
|
81
|
+
☐ ⛔ Panel logged if escalated — BLOCKING
|
|
118
82
|
☐ Acceptance criteria met
|
|
119
|
-
☐ Discovered issues tracked
|
|
120
|
-
☐ Lessons captured (if retries
|
|
83
|
+
☐ Discovered issues tracked
|
|
84
|
+
☐ Lessons captured (if retries)
|
|
121
85
|
☐ Issue updated
|
|
122
|
-
☐
|
|
123
|
-
☐
|
|
86
|
+
☐ AGENT-EXPERTISE.md updated
|
|
87
|
+
☐ KNOWLEDGE-GRAPH.md appended
|
|
124
88
|
```
|
|
125
89
|
|
|
126
90
|
---
|
|
127
91
|
|
|
128
|
-
## Hook Integration
|
|
129
|
-
|
|
130
|
-
### For Team Lead
|
|
131
|
-
|
|
132
|
-
The on-pre-delegate and on-post-delegate hooks are already encoded in the Team Lead's orchestration workflow. Reference this skill to ensure consistency.
|
|
133
|
-
|
|
134
|
-
### For Specialist Agents
|
|
135
|
-
|
|
136
|
-
Include on-session-start and on-session-end actions in every delegation prompt. Use the templates above.
|
|
137
|
-
|
|
138
|
-
### For Workflow Templates
|
|
139
|
-
|
|
140
|
-
Each workflow's **Delivery phase** naturally serves as the on-session-end hook for that workflow type. The Delivery phase steps should include session logging, lesson verification, and memory merge checks.
|
|
141
|
-
|
|
142
|
-
---
|
|
143
|
-
|
|
144
92
|
## Anti-Patterns
|
|
145
93
|
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
-
|
|
152
|
-
|
|
94
|
+
| Anti-pattern | Why it matters |
|
|
95
|
+
|---|---|
|
|
96
|
+
| Skipping on-session-start | Repeated mistakes already in lessons learned |
|
|
97
|
+
| Forgetting session logging | Observability dashboard empty; #1 most common failure |
|
|
98
|
+
| Treating logging as optional | Every session logged — no threshold, no exceptions |
|
|
99
|
+
| Batch-logging retrospectively | Log each task as it completes, not all at end |
|
|
100
|
+
| Partial post-delegate checks | Must verify acceptance criteria, not just "it compiled" |
|
|
101
|
+
| No cleanup | Temp files accumulate and confuse future sessions |
|
|
102
|
+
| Hooks as blockers | Hooks add ~2 min overhead — skip optional parts if needed |
|
|
@@ -3,19 +3,11 @@ name: agent-memory
|
|
|
3
3
|
description: "Agent expertise tracking and cross-session knowledge graph. Use when delegating tasks to track agent strengths/weaknesses, or when building context about file relationships and patterns."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
<!-- ⚠️ This file is managed by OpenCastle. Edits will be overwritten on update. Customize in the .opencastle/ directory instead. -->
|
|
7
|
-
|
|
8
6
|
# Agent Memory Protocol
|
|
9
7
|
|
|
10
|
-
## Purpose
|
|
11
|
-
|
|
12
|
-
Track which agents have expertise with which files, patterns, and tools across sessions. This information helps the Team Lead make better delegation decisions by matching tasks to agents with proven track records.
|
|
13
|
-
|
|
14
8
|
## Expertise File
|
|
15
9
|
|
|
16
|
-
Location
|
|
17
|
-
|
|
18
|
-
Template structure:
|
|
10
|
+
**Location:** `.opencastle/AGENT-EXPERTISE.md`
|
|
19
11
|
|
|
20
12
|
```markdown
|
|
21
13
|
# Agent Expertise Registry
|
|
@@ -24,123 +16,82 @@ Template structure:
|
|
|
24
16
|
### Strong Areas
|
|
25
17
|
| Area | Evidence | Last Updated |
|
|
26
18
|
|------|----------|-------------|
|
|
27
|
-
| Feature implementation |
|
|
28
|
-
| Server-side logic | Fixed auth flow (TAS-ZZ) | YYYY-MM-DD |
|
|
19
|
+
| Feature implementation | Built 5 pages (TAS-XX, TAS-YY) | YYYY-MM-DD |
|
|
29
20
|
|
|
30
21
|
### Weak Areas
|
|
31
22
|
| Area | Evidence | Last Updated |
|
|
32
23
|
|------|----------|-------------|
|
|
33
|
-
| Styling
|
|
24
|
+
| Styling | 2 retries on TAS-AA | YYYY-MM-DD |
|
|
34
25
|
|
|
35
26
|
### File Familiarity
|
|
36
|
-
- `apps/web-app/places/` — 3 tasks
|
|
37
|
-
- `libs/queries/src/lib/` — 2 tasks completed
|
|
27
|
+
- `apps/web-app/places/` — 3 tasks
|
|
38
28
|
```
|
|
39
29
|
|
|
40
|
-
##
|
|
30
|
+
## Update Triggers
|
|
41
31
|
|
|
42
32
|
| Trigger | Action |
|
|
43
33
|
|---------|--------|
|
|
44
|
-
|
|
|
45
|
-
|
|
|
46
|
-
|
|
|
47
|
-
|
|
|
48
|
-
| >3 months
|
|
49
|
-
|
|
50
|
-
## Memory Retrieval Protocol
|
|
51
|
-
|
|
52
|
-
1. Before delegating, check `.opencastle/AGENT-EXPERTISE.md` for the candidate agent
|
|
53
|
-
2. If the task matches a Strong Area, include in the prompt: *"You have prior experience with [area] from [TAS-XX]. Apply the same patterns."*
|
|
54
|
-
3. If the task matches a Weak Area, either: (a) add extra context to the prompt to compensate, or (b) consider a different agent
|
|
55
|
-
4. If the file has high familiarity, mention it: *"You've worked on [file] before in [TAS-XX]."*
|
|
56
|
-
|
|
57
|
-
## Memory Pruning Rules
|
|
58
|
-
|
|
59
|
-
- Remove entries older than 6 months without recent updates
|
|
60
|
-
- Consolidate similar entries (e.g., 5 "App Router pages" entries → 1 entry with count)
|
|
61
|
-
- Remove File Familiarity entries for files that no longer exist
|
|
62
|
-
- The Team Lead should prune at the start of major feature work (not every session)
|
|
34
|
+
| First-attempt success | Add/update Strong Area |
|
|
35
|
+
| 2+ retries | Add/update Weak Area |
|
|
36
|
+
| File modified | Increment File Familiarity |
|
|
37
|
+
| DLQ failure | Add Weak Area with ref |
|
|
38
|
+
| >3 months stale | Mark as "stale" |
|
|
63
39
|
|
|
64
|
-
##
|
|
40
|
+
## Retrieval & Delegation
|
|
65
41
|
|
|
66
|
-
|
|
42
|
+
Check `.opencastle/AGENT-EXPERTISE.md` before delegating. Add to prompt:
|
|
67
43
|
|
|
68
44
|
```
|
|
69
|
-
### Agent Context
|
|
70
|
-
- Strong: Server Components, CMS queries (3
|
|
71
|
-
- Weak: Component styling (
|
|
72
|
-
- Familiar
|
|
45
|
+
### Agent Context
|
|
46
|
+
- Strong: Server Components, CMS queries (3 tasks) → "Prior experience from TAS-XX."
|
|
47
|
+
- Weak: Component styling (retry TAS-AA) → add context or reassign
|
|
48
|
+
- Familiar: libs/queries/src/lib/search/ (2 tasks) → "You've worked on [file] in TAS-XX."
|
|
73
49
|
```
|
|
74
50
|
|
|
75
|
-
##
|
|
51
|
+
## Pruning
|
|
76
52
|
|
|
77
|
-
|
|
53
|
+
- Remove entries >6 months old; consolidate repetitive entries; remove familiarity for deleted files
|
|
54
|
+
- Prune at start of major feature work
|
|
78
55
|
|
|
79
|
-
|
|
56
|
+
## Knowledge Graph
|
|
80
57
|
|
|
81
|
-
|
|
58
|
+
**Location:** `.opencastle/KNOWLEDGE-GRAPH.md` (append-only)
|
|
82
59
|
|
|
83
|
-
|
|
84
|
-
|-------------|----------|----------|
|
|
85
|
-
| `File` | `libs/queries/src/lib/search/searchModule.ts` | `F:path` |
|
|
86
|
-
| `Agent` | Developer, Security Expert | `A:name` |
|
|
87
|
-
| `Pattern` | Server Component data fetching, RLS policy structure | `P:name` |
|
|
88
|
-
| `Decision` | "Use Jotai over Redux" (from DECISIONS.md) | `D:name` |
|
|
89
|
-
| `Bug` | Known issue KI-XXX | `B:id` |
|
|
90
|
-
| `Lesson` | LES-XXX from LESSONS-LEARNED.md | `L:id` |
|
|
60
|
+
### Entities & Relationships
|
|
91
61
|
|
|
92
|
-
|
|
62
|
+
| Entity | Notation | Relationships |
|
|
63
|
+
|--------|----------|--------------|
|
|
64
|
+
| File | `F:path` | `depends-on`, `blocks` |
|
|
65
|
+
| Agent | `A:name` | `expert-in` |
|
|
66
|
+
| Pattern/Decision | `P:name` / `D:name` | `related-to`, `obsoletes` |
|
|
67
|
+
| Bug/Lesson | `B:id` / `L:id` | `caused-by`, `related-to` |
|
|
93
68
|
|
|
94
|
-
|
|
95
|
-
|-------------|---------|---------|
|
|
96
|
-
| `depends-on` | X requires Y to function | `F:places/page.tsx depends-on F:searchModule.ts` |
|
|
97
|
-
| `caused-by` | X was caused by Y | `B:KI-042 caused-by D:use-server-components` |
|
|
98
|
-
| `expert-in` | Agent X has expertise in Y | `A:Content Engineer expert-in P:CMS-queries` |
|
|
99
|
-
| `related-to` | Loose conceptual connection | `L:LES-15 related-to P:RLS-policies` |
|
|
100
|
-
| `obsoletes` | X replaces/supersedes Y | `D:use-app-router obsoletes D:use-pages-router` |
|
|
101
|
-
| `blocks` | X prevents Y from working | `B:KI-099 blocks F:auth/middleware.ts` |
|
|
102
|
-
|
|
103
|
-
### Knowledge Graph File
|
|
104
|
-
|
|
105
|
-
Location: `.opencastle/KNOWLEDGE-GRAPH.md` — an append-only relationship log.
|
|
106
|
-
|
|
107
|
-
Template structure:
|
|
69
|
+
### Graph Template
|
|
108
70
|
|
|
109
71
|
```markdown
|
|
110
72
|
# Knowledge Graph
|
|
111
|
-
|
|
112
73
|
## Relationships
|
|
113
|
-
|
|
114
74
|
| Source | Relationship | Target | Added | Context |
|
|
115
75
|
|--------|-------------|--------|-------|---------|
|
|
116
|
-
| A:Content Engineer | expert-in | P:CMS-queries | 2026-02-23 |
|
|
117
|
-
| F:searchModule.ts | depends-on | F:cms-client.ts | 2026-02-23 |
|
|
118
|
-
| L:LES-15 | related-to | P:cookie-sessions | 2026-02-23 | Lesson about auth token format |
|
|
76
|
+
| A:Content Engineer | expert-in | P:CMS-queries | 2026-02-23 | 3 tasks |
|
|
77
|
+
| F:searchModule.ts | depends-on | F:cms-client.ts | 2026-02-23 | |
|
|
119
78
|
```
|
|
120
79
|
|
|
121
|
-
###
|
|
122
|
-
|
|
123
|
-
| Trigger | What to Record |
|
|
124
|
-
|---------|---------------|
|
|
125
|
-
| Agent completes a task touching multiple files | `depends-on` between the files |
|
|
126
|
-
| A lesson is added that relates to a pattern | `related-to` between lesson and pattern |
|
|
127
|
-
| An agent demonstrates expertise | `expert-in` between agent and domain |
|
|
128
|
-
| A decision causes a known issue | `caused-by` between bug and decision |
|
|
129
|
-
| A new pattern supersedes an old approach | `obsoletes` between decisions/patterns |
|
|
80
|
+
### Add Relationships When
|
|
130
81
|
|
|
131
|
-
|
|
82
|
+
| Trigger | Record |
|
|
83
|
+
|---------|--------|
|
|
84
|
+
| Task touches multiple files | `depends-on` |
|
|
85
|
+
| Lesson relates to a pattern | `related-to` |
|
|
86
|
+
| Agent demonstrates expertise | `expert-in` |
|
|
87
|
+
| Decision causes known issue | `caused-by` |
|
|
88
|
+
| Pattern supersedes old approach | `obsoletes` |
|
|
132
89
|
|
|
133
|
-
|
|
90
|
+
### Pre-Delegation Queries
|
|
134
91
|
|
|
135
|
-
|
|
136
|
-
2. Follow `depends-on` edges to identify related files the agent might need to read
|
|
137
|
-
3. Follow `expert-in` edges to confirm the right agent is assigned
|
|
138
|
-
4. Follow `related-to` edges from relevant lessons to discover applicable patterns
|
|
139
|
-
5. Check for `blocks` edges that might indicate known issues affecting the task
|
|
92
|
+
Follow `depends-on` for related reads, `expert-in` to confirm agent, `related-to` for patterns, `blocks` for known issues.
|
|
140
93
|
|
|
141
|
-
### Maintenance
|
|
94
|
+
### Maintenance
|
|
142
95
|
|
|
143
|
-
- Add
|
|
144
|
-
-
|
|
145
|
-
- Keep the graph focused — max ~100 active relationships. Archive old ones quarterly
|
|
146
|
-
- Relationships are append-only during a session; pruning happens between sessions
|
|
96
|
+
- Add as discovered; prune between sessions
|
|
97
|
+
- Max ~100 active relationships; archive quarterly
|