opencastle 0.38.0 → 0.38.1

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 (41) hide show
  1. package/dist/cli/adapters/rules-dir-base.d.ts.map +1 -1
  2. package/dist/cli/adapters/rules-dir-base.js +28 -4
  3. package/dist/cli/adapters/rules-dir-base.js.map +1 -1
  4. package/dist/cli/adapters/rules-dir-base.test.js +17 -1
  5. package/dist/cli/adapters/rules-dir-base.test.js.map +1 -1
  6. package/dist/cli/bootstrap-on-init.test.d.ts +2 -0
  7. package/dist/cli/bootstrap-on-init.test.d.ts.map +1 -0
  8. package/dist/cli/bootstrap-on-init.test.js +90 -0
  9. package/dist/cli/bootstrap-on-init.test.js.map +1 -0
  10. package/dist/cli/init.d.ts.map +1 -1
  11. package/dist/cli/init.js +9 -2
  12. package/dist/cli/init.js.map +1 -1
  13. package/package.json +1 -1
  14. package/src/cli/adapters/rules-dir-base.test.ts +21 -1
  15. package/src/cli/adapters/rules-dir-base.ts +42 -6
  16. package/src/cli/bootstrap-on-init.test.ts +106 -0
  17. package/src/cli/init.ts +10 -2
  18. package/src/dashboard/node_modules/.vite/deps/_metadata.json +6 -6
  19. package/src/orchestrator/agents/team-lead.agent.md +1 -1
  20. package/src/orchestrator/plugins/astro/SKILL.md +1 -1
  21. package/src/orchestrator/plugins/nx/SKILL.md +7 -7
  22. package/src/orchestrator/plugins/strapi/SKILL.md +1 -1
  23. package/src/orchestrator/skills/agent-hooks/HOOKS-REFERENCE.md +1 -1
  24. package/src/orchestrator/skills/agent-hooks/SKILL.md +2 -2
  25. package/src/orchestrator/skills/api-patterns/SKILL.md +1 -1
  26. package/src/orchestrator/skills/context-map/SKILL.md +11 -9
  27. package/src/orchestrator/skills/deployment-infrastructure/SKILL.md +1 -1
  28. package/src/orchestrator/skills/documentation-standards/SKILL.md +5 -2
  29. package/src/orchestrator/skills/fast-review/SKILL.md +8 -3
  30. package/src/orchestrator/skills/frontend-design/SKILL.md +0 -1
  31. package/src/orchestrator/skills/orchestration-protocols/SKILL.md +9 -11
  32. package/src/orchestrator/skills/panel-majority-vote/SKILL.md +1 -1
  33. package/src/orchestrator/skills/performance-optimization/SKILL.md +2 -1
  34. package/src/orchestrator/skills/project-consistency/SKILL.md +2 -2
  35. package/src/orchestrator/skills/react-development/SKILL.md +4 -7
  36. package/src/orchestrator/skills/security-hardening/SKILL.md +1 -1
  37. package/src/orchestrator/skills/session-checkpoints/CHECKPOINT-TEMPLATE.md +1 -1
  38. package/src/orchestrator/skills/session-checkpoints/SKILL.md +2 -2
  39. package/src/orchestrator/skills/team-lead-reference/SKILL.md +2 -2
  40. package/src/orchestrator/skills/validation-gates/REFERENCE.md +1 -1
  41. package/src/orchestrator/skills/validation-gates/SKILL.md +3 -3
@@ -116,11 +116,21 @@ export function createRulesDirAdapter(config: RulesDirConfig): RulesDirAdapter {
116
116
  interface ConvertFileOptions {
117
117
  alwaysApply?: boolean
118
118
  descriptionFallback?: string
119
+ /**
120
+ * Rewrites the body before the rule is assembled.
121
+ *
122
+ * A skill's siblings land at `skills/<skill>/<NAME><ruleExt>` while the skill
123
+ * itself is `skills/<skill><ruleExt>`, so a pointer the source writes as
124
+ * `REFERENCE.md` is wrong twice over here: wrong directory and wrong
125
+ * extension. Fourteen skills point at a sibling this way, and on Cursor and
126
+ * Windsurf every one of those pointers led nowhere.
127
+ */
128
+ rewriteBody?: (_body: string) => string
119
129
  }
120
130
 
121
131
  async function convertFile(
122
132
  srcPath: string,
123
- { alwaysApply = false, descriptionFallback = '' }: ConvertFileOptions = {},
133
+ { alwaysApply = false, descriptionFallback = '', rewriteBody }: ConvertFileOptions = {},
124
134
  ): Promise<string> {
125
135
  const content = await readFile(srcPath, 'utf8')
126
136
  const { frontmatter, body } = splitFrontmatter(content)
@@ -138,7 +148,7 @@ export function createRulesDirAdapter(config: RulesDirConfig): RulesDirAdapter {
138
148
  applyTo: meta['applyTo'],
139
149
  alwaysApply,
140
150
  tier: meta['tier'],
141
- }), '---', '', body.trim(), '']
151
+ }), '---', '', (rewriteBody ? rewriteBody(body) : body).trim(), '']
142
152
  return lines.join('\n')
143
153
  }
144
154
 
@@ -221,6 +231,26 @@ export function createRulesDirAdapter(config: RulesDirConfig): RulesDirAdapter {
221
231
  }
222
232
  }
223
233
 
234
+ /**
235
+ * Points a skill's sibling references at where this adapter actually puts them.
236
+ *
237
+ * `REFERENCE.md` and `./REFERENCE.md` both become `<skill>/REFERENCE<ruleExt>`,
238
+ * which covers the markdown links most skills use and the bare prose mentions
239
+ * a few of them use instead.
240
+ */
241
+ function retargetSiblings(body: string, skill: string, extras: string[]): string {
242
+ let out = body
243
+ for (const extra of extras) {
244
+ const target = `${skill}/${ruleName(extra)}`
245
+ // Escaped because sibling names carry dots, and one carries two
246
+ // (`panel-report.template.md`), each of which would otherwise match any
247
+ // character and retarget text that is not a path.
248
+ const escaped = extra.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
249
+ out = out.replace(new RegExp(`(?<![\\w/-])(?:\\./)?${escaped}(?![\\w-])`, 'g'), target)
250
+ }
251
+ return out
252
+ }
253
+
224
254
  async function convertSkills(
225
255
  srcRoot: string,
226
256
  destDir: string,
@@ -239,17 +269,23 @@ export function createRulesDirAdapter(config: RulesDirConfig): RulesDirAdapter {
239
269
  const skillFile = resolve(skillsDir, entry.name, 'SKILL.md')
240
270
  if (!existsSync(skillFile)) continue
241
271
 
272
+ // Extra files in the skill directory (e.g. templates). Resolved before the
273
+ // skill is written, because the skill's own pointers at them have to be
274
+ // rewritten to where they actually land.
275
+ const files = await readdir(resolve(skillsDir, entry.name))
276
+ const extras = files.filter((f) => f !== 'SKILL.md' && f.endsWith('.md'))
277
+
242
278
  await writeConverted(
243
279
  skillFile,
244
280
  resolve(destDir, `${entry.name}${ruleExt}`),
245
- { descriptionFallback: `Skill: ${entry.name}` },
281
+ {
282
+ descriptionFallback: `Skill: ${entry.name}`,
283
+ rewriteBody: (body) => retargetSiblings(body, entry.name, extras),
284
+ },
246
285
  results,
247
286
  overwrite,
248
287
  )
249
288
 
250
- // Extra files in the skill directory (e.g. templates)
251
- const files = await readdir(resolve(skillsDir, entry.name))
252
- const extras = files.filter((f) => f !== 'SKILL.md' && f.endsWith('.md'))
253
289
  if (extras.length > 0) {
254
290
  const subDest = resolve(destDir, entry.name)
255
291
  await mkdir(subDest, { recursive: true })
@@ -0,0 +1,106 @@
1
+ /**
2
+ * `init` must actually scan the project it is initialising.
3
+ *
4
+ * `bootstrapCustomizations` fills `.opencastle/` in from what the repo turned
5
+ * out to be: the project name, the tech-stack table, and the key-commands block
6
+ * that records which package manager to use. It is guarded so that a re-run
7
+ * cannot overwrite notes the user has since written, because its stack-config
8
+ * step writes unconditionally.
9
+ *
10
+ * That guard read `.opencastle/agents`, and the scaffold step eighteen lines
11
+ * above it creates `.opencastle/agents`. So it was true on the first run too,
12
+ * and the scan never executed for anybody: every marker in
13
+ * `project.instructions.md` stayed bare. The visible symptom was six skills
14
+ * hardcoding `pnpm`, having no populated file to read it from.
15
+ *
16
+ * Both halves are asserted here, because fixing the first by deleting the guard
17
+ * would destroy user content on the second.
18
+ */
19
+ import { describe, it, expect, beforeEach, afterEach } from 'vitest'
20
+ import { execFileSync } from 'node:child_process'
21
+ import { mkdtempSync, rmSync, writeFileSync, readFileSync, existsSync, appendFileSync } from 'node:fs'
22
+ import { tmpdir } from 'node:os'
23
+ import { join, resolve } from 'node:path'
24
+
25
+ const repoRoot = resolve(import.meta.dirname, '..', '..')
26
+ const cli = join(repoRoot, 'bin', 'cli.mjs')
27
+
28
+ // `bin/cli.mjs` loads the command modules from `dist/`, so with no build these
29
+ // would all fail on a missing import rather than on anything they assert. CI
30
+ // builds before `npm test`, so nothing here is skipped there.
31
+ const cliBuilt = existsSync(join(repoRoot, 'dist', 'cli', 'init.js'))
32
+
33
+ function run(cwd: string, ...args: string[]): string {
34
+ try {
35
+ return execFileSync('node', [cli, ...args], { cwd, encoding: 'utf8', stdio: ['ignore', 'pipe', 'pipe'] })
36
+ } catch (err) {
37
+ return String((err as { stdout?: string }).stdout ?? '')
38
+ }
39
+ }
40
+
41
+ describe.skipIf(!cliBuilt)('init scans the project it initialises', () => {
42
+ let projectRoot: string
43
+
44
+ beforeEach(() => {
45
+ projectRoot = mkdtempSync(join(tmpdir(), 'oc-bootstrap-'))
46
+ execFileSync('git', ['init', '-q'], { cwd: projectRoot })
47
+ writeFileSync(join(projectRoot, 'CLAUDE.md'), '# House rules\n')
48
+ writeFileSync(
49
+ join(projectRoot, 'package.json'),
50
+ JSON.stringify({
51
+ name: 'demo-app',
52
+ description: 'a demo app',
53
+ scripts: { dev: 'next dev', build: 'next build', test: 'vitest run', lint: 'eslint .' },
54
+ }),
55
+ )
56
+ // The lockfile is how the package manager is detected.
57
+ writeFileSync(join(projectRoot, 'pnpm-lock.yaml'), '')
58
+ })
59
+
60
+ afterEach(() => {
61
+ rmSync(projectRoot, { recursive: true, force: true })
62
+ })
63
+
64
+ const instructions = (): string =>
65
+ readFileSync(join(projectRoot, '.opencastle', 'project.instructions.md'), 'utf8')
66
+
67
+ it('records the detected package manager and its commands', () => {
68
+ run(projectRoot, 'init', '--yes')
69
+ const text = instructions()
70
+ expect(text).toContain('**Package manager:** `pnpm`')
71
+ expect(text).toContain('pnpm run test')
72
+ })
73
+
74
+ it('records what the repo is, not just what the template says', () => {
75
+ run(projectRoot, 'init', '--yes')
76
+ const text = instructions()
77
+ expect(text).toContain('**Project:** demo-app')
78
+ expect(text).toContain('**Description:** a demo app')
79
+ expect(text).toMatch(/\|\s*Package Manager\s*\|\s*pnpm\s*\|/)
80
+ })
81
+
82
+ it('leaves the user’s own notes alone when init is re-run', () => {
83
+ run(projectRoot, 'init', '--yes')
84
+ const stackFile = join(projectRoot, '.opencastle', 'stack', 'testing-config.md')
85
+ expect(existsSync(stackFile)).toBe(true)
86
+ appendFileSync(stackFile, '\nNOTES THE USER WROTE\n')
87
+
88
+ run(projectRoot, 'init', '--yes')
89
+ expect(readFileSync(stackFile, 'utf8')).toContain('NOTES THE USER WROTE')
90
+ })
91
+
92
+ it('leaves them alone after remove --keep-files, which drops only the manifest', () => {
93
+ run(projectRoot, 'init', '--yes')
94
+ const stackFile = join(projectRoot, '.opencastle', 'stack', 'testing-config.md')
95
+ appendFileSync(stackFile, '\nNOTES THE USER WROTE\n')
96
+
97
+ run(projectRoot, 'remove', '--keep-files', '--yes')
98
+ // No manifest means `isReinit` is false, so only the directory check stands
99
+ // between the user's notes and bootstrap's unconditional writes.
100
+ expect(existsSync(join(projectRoot, '.opencastle', 'manifest.json'))).toBe(false)
101
+ expect(existsSync(join(projectRoot, '.opencastle', 'agents'))).toBe(true)
102
+
103
+ run(projectRoot, 'init', '--yes')
104
+ expect(readFileSync(stackFile, 'utf8')).toContain('NOTES THE USER WROTE')
105
+ })
106
+ })
package/src/cli/init.ts CHANGED
@@ -495,6 +495,14 @@ export default async function init({ pkgRoot, args }: CliContext): Promise<void>
495
495
  }
496
496
 
497
497
  // ── Scaffold customizations to .opencastle/ ──────────────────────────────
498
+ // Sampled before the copy below, which creates `.opencastle/agents` itself.
499
+ // Read after it, this was true on every run including the first, so the
500
+ // bootstrap guard downstream never let the project scan execute at all: no
501
+ // tech-stack table, no key commands, not even the project name. Every skill
502
+ // that wanted the package manager hardcoded one instead, because the file
503
+ // that was supposed to record it was never filled in.
504
+ const alreadyScaffolded = existsSync(resolve(projectRoot, '.opencastle', 'agents'))
505
+
498
506
  const custSrcDir = resolve(getOrchestratorRoot(pkgRoot), 'customizations')
499
507
  if (existsSync(custSrcDir)) {
500
508
  const custDestDir = resolve(projectRoot, '.opencastle')
@@ -516,8 +524,8 @@ export default async function init({ pkgRoot, args }: CliContext): Promise<void>
516
524
  // the manifest, by design) and a manifest with merge-conflict markers, which
517
525
  // `readManifest` reports as "no install". Both then ran bootstrap's
518
526
  // unconditional renames over a populated `.opencastle/` and replaced the
519
- // user's own stack notes with a blank template.
520
- const alreadyScaffolded = existsSync(resolve(projectRoot, '.opencastle', 'agents'))
527
+ // user's own stack notes with a blank template. `alreadyScaffolded` is
528
+ // sampled above, before the scaffold step supplies its own answer.
521
529
  const bootstrapResult = isReinit || alreadyScaffolded
522
530
  ? { populated: [], removed: [], renamed: [] }
523
531
  : await bootstrapCustomizations(projectRoot, combinedRepoInfo, stack)
@@ -1,25 +1,25 @@
1
1
  {
2
- "hash": "659a9160",
2
+ "hash": "e372da9f",
3
3
  "configHash": "30f8ea04",
4
- "lockfileHash": "1ef29fb1",
5
- "browserHash": "0b22b5fe",
4
+ "lockfileHash": "0c747fc2",
5
+ "browserHash": "69a1f03f",
6
6
  "optimized": {
7
7
  "astro > cssesc": {
8
8
  "src": "../../../../../node_modules/cssesc/cssesc.js",
9
9
  "file": "astro___cssesc.js",
10
- "fileHash": "c8f7fff8",
10
+ "fileHash": "213cb247",
11
11
  "needsInterop": true
12
12
  },
13
13
  "astro > aria-query": {
14
14
  "src": "../../../../../node_modules/aria-query/lib/index.js",
15
15
  "file": "astro___aria-query.js",
16
- "fileHash": "3d9eae1a",
16
+ "fileHash": "f660feae",
17
17
  "needsInterop": true
18
18
  },
19
19
  "astro > axobject-query": {
20
20
  "src": "../../../../../node_modules/axobject-query/lib/index.js",
21
21
  "file": "astro___axobject-query.js",
22
- "fileHash": "427f9c5a",
22
+ "fileHash": "c1a1f686",
23
23
  "needsInterop": true
24
24
  }
25
25
  },
@@ -59,7 +59,7 @@ Developer | UI/UX Expert | Content Engineer | Data Engineer | Testing Expert | S
59
59
 
60
60
  ## Delegation
61
61
 
62
- **Sub-agents** (`runSubagent`): synchronous, critical-path. **Background agents**: async in isolated worktrees, parallel work. Always name agent explicitly. Include: issue ID, objective, file paths, acceptance criteria, self-improvement reminder.
62
+ **Sub-agents**: synchronous, critical-path, dispatched through whichever sub-agent mechanism the assistant exposes. **Background agents**: async in isolated worktrees, parallel work. Always name agent explicitly. Include: issue ID, objective, file paths, acceptance criteria, self-improvement reminder.
63
63
 
64
64
  **⛔ Hard gates:**
65
65
  - Log delegation record immediately after each return/spawn — **observability-logging** (`--mechanism sub-agent` or `--mechanism background`).
@@ -27,6 +27,6 @@ Docs: https://docs.astro.build
27
27
  1. Declare it in `src/content.config.ts` via `defineCollection` + Zod schema; export from `collections`.
28
28
  2. Add `src/content/<name>/` with one sample file.
29
29
  3. Query with `getCollection('<name>', filterFn)`.
30
- 4. `pnpm build` must exit zero — collection types are generated at build time, so type errors only surface after a build.
30
+ 4. The build must exit zero — collection types are generated at build time, so type errors only surface after a build.
31
31
 
32
32
  Integrations: `astro add react tailwind mdx sitemap` etc. — never hand-edit the integrations array.
@@ -17,13 +17,13 @@ npm test | npm run test | npm run lint | npm run build | npm run dev | npm start
17
17
  npx jest | npx eslint | jest --coverage | eslint --fix
18
18
  ```
19
19
 
20
- Always `yarn nx run <project>:<target>` for one project, `yarn nx affected -t <target>` for multi-project changes.
20
+ Always `npx nx run <project>:<target>` for one project, `npx nx affected -t <target>` for multi-project changes.
21
21
 
22
22
  ## Requirements
23
23
 
24
24
  - Minimum coverage **95%** for new components/functions. Reports land in `reports/coverage/jest/`.
25
- - Lint always with `--fix`. CSS/SCSS uses a separate target: `yarn nx run <project>:lint-styles --fix`.
26
- - `yarn nx run <project>:test -u` updates snapshots. `yarn nx format --fix` after any generation.
25
+ - Lint always with `--fix`. CSS/SCSS uses a separate target: `npx nx run <project>:lint-styles --fix`.
26
+ - `npx nx run <project>:test -u` updates snapshots. `npx nx format --fix` after any generation.
27
27
 
28
28
  ## MCP tools — query, don't guess
29
29
 
@@ -44,15 +44,15 @@ Always `yarn nx run <project>:<target>` for one project, `yarn nx affected -t <t
44
44
  Prefer **local** generators over plugin generators — they encode repo conventions. Manual file creation is a last resort after `nx_generators` and `nx_available_plugins` both come up empty. Read `nx_generator_schema`, then read the generator source for side effects (config edits, dep installs).
45
45
 
46
46
  ```bash
47
- yarn nx generate <generator> <options> --dry-run --no-interactive # preview
48
- yarn nx generate <generator> <options> --no-interactive
47
+ npx nx generate <generator> <options> --dry-run --no-interactive # preview
48
+ npx nx generate <generator> <options> --no-interactive
49
49
  ```
50
50
 
51
51
  - **`--no-interactive` is mandatory** — prompts hang the run with no output.
52
52
  - **Verify cwd first** — generators derive file placement from it.
53
53
 
54
- After generating: `yarn nx format --fix`, then lint/test/build the affected projects.
54
+ After generating: `npx nx format --fix`, then lint/test/build the affected projects.
55
55
 
56
56
  ## Running tasks
57
57
 
58
- Check `nx_current_running_tasks_details` before starting anything. **Continuous targets (`serve`, `dev`) are already running — read their output instead of re-running.** To rerun, use `yarn nx run <taskId>` so NX context is preserved.
58
+ Check `nx_current_running_tasks_details` before starting anything. **Continuous targets (`serve`, `dev`) are already running — read their output instead of re-running.** To rerun, use `npx nx run <taskId>` so NX context is preserved.
@@ -32,4 +32,4 @@ Strapi discovers code by path — a correct file in the wrong place is simply ig
32
32
 
33
33
  ## Verify
34
34
 
35
- `yarn develop`, confirm the type appears in admin, create a test entry, then assert `GET /api/<type>?pagination[page]=1` returns 200 with a `data` array and `GET /api/<type>?populate=*` returns the expected relations. Schema errors surface under `yarn build`.
35
+ the `develop` script, confirm the type appears in admin, create a test entry, then assert `GET /api/<type>?pagination[page]=1` returns 200 with a `data` array and `GET /api/<type>?populate=*` returns the expected relations. Schema errors surface under the `build` script.
@@ -30,7 +30,7 @@ Log delegation: `opencastle log --type=delegation --issue=TAS-123 --status=start
30
30
  |---|--------|---------|
31
31
  | 1 | Log completion | `opencastle log --type=delegation --issue=TAS-XX --status=complete` |
32
32
  | 2 | Fast review | `opencastle log --type=review --issue=TAS-XX --verdict=PASS` |
33
- | 3 | CI checks | `pnpm lint && pnpm typecheck && pnpm test` |
33
+ | 3 | CI checks | Lint, typecheck, and test (commands via the **codebase-tool** slot) |
34
34
  | 4 | Verify ACs | Check each acceptance criterion against tracker issue |
35
35
  | 5 | Track issues | `rg -n "Discovered issue" KNOWN-ISSUES.md || gh issue create` |
36
36
  | 6 | Lesson check | If agent retried, verify lesson added via **self-improvement** |
@@ -55,7 +55,7 @@ See [HOOKS-REFERENCE.md](HOOKS-REFERENCE.md) for extended startup checks (approv
55
55
  | 5 | Prompt includes "Read LESSONS-LEARNED.md first" |
56
56
  | 6 | 5+ files → load **context-map** skill |
57
57
 
58
- All 6 must pass before `runSubagent`. See [HOOKS-REFERENCE.md](HOOKS-REFERENCE.md) for example commands per check.
58
+ All 6 must pass before the sub-agent is dispatched. See [HOOKS-REFERENCE.md](HOOKS-REFERENCE.md) for example commands per check.
59
59
 
60
60
  ## on-post-delegate — Team Lead only
61
61
 
@@ -63,7 +63,7 @@ All 6 must pass before `runSubagent`. See [HOOKS-REFERENCE.md](HOOKS-REFERENCE.m
63
63
  |---|--------|
64
64
  | 1 | **⛔** `opencastle log --type=delegation --issue=TAS-XX --status=complete` |
65
65
  | 2 | Run **fast-review** skill |
66
- | 3 | `pnpm lint && pnpm typecheck && pnpm test` |
66
+ | 3 | Lint, typecheck, and test (commands via the **codebase-tool** slot) |
67
67
  | 4 | `gh issue view TAS-XX --json body -q '.body'` — verify each AC met |
68
68
  | 5 | If agent retried → verify lesson added via **self-improvement** |
69
69
  | 6 | Move to Done or re-delegate; 3rd failure → `.opencastle/AGENT-FAILURES.md` |
@@ -5,7 +5,7 @@ description: "Creates API route handlers, implements Server Actions with Zod sch
5
5
 
6
6
  # API Patterns
7
7
 
8
- Project-specific config: [api-config.md](../../.opencastle/stack/api-config.md).
8
+ Project-specific config: `.opencastle/stack/api-config.md`.
9
9
 
10
10
  ## Architecture
11
11
 
@@ -23,17 +23,19 @@ Identify files that MUST change from task description.
23
23
 
24
24
  ### 2 — Trace Outward (dependents)
25
25
  Find consumers of entry-point exports:
26
+ ```bash
27
+ rg -n "import .*from .*libs/auth" # find importers
28
+ rg -n "\bAuthCard\b" --type ts --type tsx # find component consumers
29
+ rg -n "auth.*route|/auth" # find route references
26
30
  ```
27
- grep_search("import.*from.*places", isRegexp=true) # find importers
28
- vscode_listCodeUsages("PlaceCard") # find component consumers
29
- grep_search("places.*route|/places", isRegexp=true) # find route references
30
- ```
31
+ If the assistant exposes a code-usage lookup (find-references), prefer it for
32
+ symbols: it resolves re-exports and aliases that a text search misses.
31
33
 
32
34
  ### 3 — Trace Inward (sources)
33
35
  Find what entry points depend on:
34
- ```
35
- grep_search("from.*libs/", includePattern="src/places/**") # shared lib deps
36
- grep_search("from.*config", includePattern="src/places/**") # config deps
36
+ ```bash
37
+ rg -n "from .*libs/" src/auth/ # shared lib deps
38
+ rg -n "from .*config" src/auth/ # config deps
37
39
  ```
38
40
 
39
41
  ### 4 — Build the Map
@@ -59,11 +61,11 @@ Context Map — Feature: Add priceRange
59
61
  - src/components/Account/**
60
62
  ```
61
63
 
62
- Validation checkpoint: every `grep_search` / `vscode_listCodeUsages` hit lands in the map; all listed files open without errors (CI: `pnpm typecheck`). Full template, depth levels, partition derivation, Team Lead integration: see [REFERENCE.md](./REFERENCE.md).
64
+ Validation checkpoint: every search hit lands in the map; all listed files open without errors (typecheck via the **codebase-tool** slot). Full template, depth levels, partition derivation, Team Lead integration: see [REFERENCE.md](./REFERENCE.md).
63
65
 
64
66
  ## Anti-Patterns
65
67
 
66
68
  - Skipping for "obvious" tasks — shared libs cascade unexpectedly
67
- - Guessing dependencies instead of using `grep_search` / `list_code_usages`
69
+ - Guessing dependencies instead of searching for them
68
70
  - Over-mapping a 2-file fix
69
71
  - Using a stale map after plan changes
@@ -5,7 +5,7 @@ description: "Configures deployment pipelines, manages environment variables, sc
5
5
 
6
6
  # Deployment Infrastructure
7
7
 
8
- See [deployment-config.md](../../.opencastle/stack/deployment-config.md) for full architecture, env vars, cron jobs, caching headers.
8
+ See `.opencastle/stack/deployment-config.md` for full architecture, env vars, cron jobs, caching headers.
9
9
 
10
10
  ## Environment Variables
11
11
 
@@ -5,7 +5,7 @@ description: "Scaffolds issue docs, ADRs, README outlines, changelog entries, ro
5
5
 
6
6
  # Documentation Standards
7
7
 
8
- Project directory structure and practices: [docs-structure.md](../../.opencastle/project/docs-structure.md). Writing guidelines, formatting rules, anti-patterns: [WRITING-GUIDE.md](WRITING-GUIDE.md).
8
+ Project directory structure and practices: `.opencastle/project/docs-structure.md`. Writing guidelines, formatting rules, anti-patterns: `WRITING-GUIDE.md`, beside this file.
9
9
 
10
10
  ## Templates
11
11
 
@@ -23,6 +23,9 @@ One concern per diagram, max 10–12 nodes. `flowchart TD` for pipelines, `LR` f
23
23
 
24
24
  ## Validate
25
25
 
26
+ Check links and formatting before committing docs. Resolve the formatter
27
+ command via the **codebase-tool** slot; the link checker is standalone:
28
+
26
29
  ```bash
27
- npx markdown-link-check docs/**/*.md && pnpm prettier --check "docs/**/*.md"
30
+ npx markdown-link-check docs/**/*.md
28
31
  ```
@@ -23,10 +23,15 @@ Issue + acceptance criteria, file diff, file partition, deterministic results (l
23
23
 
24
24
  ### 2 — Spawn Reviewer
25
25
 
26
- Single `runSubagent`. Context = acceptance criteria, diff, partition, deterministic results **only** — no session history, no delegation prompt.
26
+ One sub-agent, dispatched as the Reviewer. Context = acceptance criteria, diff, partition, deterministic results **only** — no session history, no delegation prompt.
27
27
 
28
- ```js
29
- runSubagent({ agentName: 'Reviewer', prompt: `Review against ACs:\n${criteria}\nDiff:\n${diff}\nGates: lint ✅ test ✅ build ✅` });
28
+ ```
29
+ Agent: Reviewer
30
+ Review against these acceptance criteria:
31
+ [criteria]
32
+ Diff:
33
+ [diff]
34
+ Deterministic gates: lint ✅ test ✅ build ✅
30
35
  ```
31
36
 
32
37
  Full reviewer prompt template: [REFERENCE.md](REFERENCE.md).
@@ -1,7 +1,6 @@
1
1
  ---
2
2
  name: frontend-design
3
3
  description: "Defines named visual aesthetic, selects typography pairings, builds CSS token systems, adds entrance animations for high-design-quality pages. Use when user asks to design landing page, style marketing site, create distinctive UI theme, pick fonts, or add CSS animations — specifically when visual polish, brand identity matter rather than generic component scaffolding."
4
- license: Complete terms in LICENSE.txt
5
4
  ---
6
5
 
7
6
  <!-- ⚠️ This file is managed by OpenCastle. Edits will be overwritten on update. Customize in the .opencastle/ directory instead. -->
@@ -99,15 +99,13 @@ opencastle convoy retry
99
99
 
100
100
  **Post-run verification (copy-paste checks):**
101
101
 
102
- ```bash
103
- if [ $? -ne 0 ]; then
104
- echo "convoy failed — inspect .opencastle/convoy.log" \
105
- && tail -n 200 .opencastle/convoy.log && exit 1
106
- fi
107
-
108
- npx opencastle convoy
102
+ Convoy records to `.opencastle/convoy.db` and `.opencastle/logs/`; there is no
103
+ plain-text run log to tail.
109
104
 
110
- grep -i "error\|failed" .opencastle/convoy.log || echo "no obvious errors in logs"
105
+ ```bash
106
+ opencastle convoy --json # last run's status, machine-readable
107
+ opencastle convoy run --status # current convoy state from convoy.db
108
+ tail -n 50 .opencastle/logs/events.ndjson | jq -c 'select(.outcome != "success")'
111
109
  ```
112
110
 
113
111
  ## Validation & Verification Checkpoints
@@ -115,9 +113,9 @@ grep -i "error\|failed" .opencastle/convoy.log || echo "no obvious errors in log
115
113
  | Phase | Check | Command / Action |
116
114
  |-------|-------|-----------------|
117
115
  | Pre-spawn | Inputs present (task, scope, ACs) | `test -s convoy.yml \|\| exit 1` |
118
- | During-run | Tail for fatal errors | `tail -F .opencastle/convoy.log \| grep -i "fatal\|error"` |
119
- | Pre-merge | All agents exited 0 | `jq -e '.agents[] \| .exit_code == 0' .opencastle/results.json` |
120
- | Output schema | Required fields present | `jq -e '.agents[] \| (.findings and .file_paths)' .opencastle/results.json` |
116
+ | During-run | Watch for failures | `opencastle convoy run --status` |
117
+ | Pre-merge | No task left failed or gate-failed | `opencastle convoy --json \| jq -e '.failed == 0'` |
118
+ | Dead letters | Queue is empty | `opencastle convoy run --dlq-list` |
121
119
  | Post-merge | Lint + smoke tests pass | `npm run lint && npm test -- -t "smoke"` |
122
120
  | Blocker | Any failure | Block merge; reopen to original researcher(s) |
123
121
 
@@ -20,7 +20,7 @@ description: "Runs 3 isolated reviewer sub-agents; consolidates PASS/BLOCK verdi
20
20
 
21
21
  1. **Validate scope** — every artifact path under `<runRoot>`; list sufficient to answer question.
22
22
 
23
- 2. **Spawn 3 reviewers in parallel** — three `runSubagent` calls with identical prompts (same question, artifact list, constraints), each isolated. Required reviewer output sections (no others): `VERDICT: PASS | BLOCK`, `MUST-FIX:`, `SHOULD-FIX:`, `QUESTIONS:`, `TEST IDEAS:`, `CONFIDENCE: low | med | high`.
23
+ 2. **Spawn 3 reviewers in parallel** — three sub-agent dispatches with identical prompts (same question, artifact list, constraints), each isolated. Required reviewer output sections (no others): `VERDICT: PASS | BLOCK`, `MUST-FIX:`, `SHOULD-FIX:`, `QUESTIONS:`, `TEST IDEAS:`, `CONFIDENCE: low | med | high`.
24
24
 
25
25
  3. **Persist outputs** — write `<panelDir>/<panelKey>-reviewer-outputs.md` with a header (run root, panel key, question, artifacts) and each reviewer output verbatim, separated.
26
26
 
@@ -11,11 +11,12 @@ Measure before changing anything. Add `React.memo`/`useMemo`/`useCallback` only
11
11
 
12
12
  - Node: async APIs only — never `readFileSync` or other sync I/O on a request path.
13
13
  - Debounce input-driven fetches at 300 ms.
14
+ - INP replaced FID as a Core Web Vital in March 2024: budget it at ≤200 ms, and measure every interaction, not just the first.
14
15
  - Profile Node with `clinic.js` or `node --inspect`; profile React with `<Profiler onRender>` or the DevTools Profiler.
15
16
 
16
17
  ## Profiling Workflow
17
18
 
18
- 1. Lighthouse (or the CI perf job) for a baseline; name the failing metric (LCP/CLS/FID/TTI). If results are noisy, reproduce locally with `--emulated-form-factor=mobile`.
19
+ 1. Lighthouse (or the CI perf job) for a baseline; name the failing metric (LCP/CLS/INP/TTI). Lighthouse emulates mobile by default; pass `--preset=desktop` when the regression is desktop-only.
19
20
  2. Profile to locate the hotspot call stacks / long tasks.
20
21
  3. Apply the minimal fix (code-split, memoize, shrink payloads, defer non-critical work); confirm in the profiler that the measured hotspot actually shrank.
21
22
  4. Re-run Lighthouse / the CI perf job. Ship only at ≥10% improvement or once inside budget.
@@ -22,7 +22,7 @@ Phase 1 (sequential): `foundation-setup` creates tokens, Layout, UI library, sty
22
22
 
23
23
  **Validation checkpoints:**
24
24
  1. Foundation complete: `tokens.css` has all palette/type/spacing vars, Layout renders, UI components compile.
25
- 2. Per-page: `grep -r .style={{. src/pages/` returns 0 hits (no inline styles). All imports resolve.
25
+ 2. Per-page: `grep -rF 'style={{' src/pages/` returns 0 hits (no inline styles). All imports resolve.
26
26
 
27
27
  ---
28
28
 
@@ -50,7 +50,7 @@ Prompt templates: see [TEMPLATES.md](./TEMPLATES.md).
50
50
  --color-primary-600: #0284c7;
51
51
 
52
52
  /* Typography */
53
- --font-base: 'Inter, system-ui, -apple-system, sans-serif';
53
+ --font-base: Inter, system-ui, -apple-system, sans-serif;
54
54
  --text-sm: 0.875rem;
55
55
  --text-base: 1rem;
56
56
 
@@ -11,16 +11,13 @@ description: "Enforces React-specific patterns: functional components with hooks
11
11
  - Export the props type as `ComponentNameProps`; PascalCase component names.
12
12
  - Styling: CSS Modules (`.module.scss`), Sass variables/mixins pulled from the shared libraries, CSS custom properties for theming.
13
13
  - `strict` stays enabled in `tsconfig.json`; no `as` casts.
14
- - Tests: React Testing Library on Jest, mocking external deps and API calls.
14
+ - Tests: React Testing Library on the runner bound to the **testing** capability slot, mocking external deps and API calls.
15
15
 
16
16
  ## Verification
17
17
 
18
- ```bash
19
- pnpm lint
20
- pnpm typecheck # use `pnpm tsc --noEmit` if the alias is absent
21
- pnpm test # single test: pnpm test -- -t <name>
22
- pnpm build
23
- ```
18
+ Lint, typecheck, test, and build must all exit zero. Resolve the exact commands
19
+ via the **codebase-tool** slot; `.opencastle/project.instructions.md` records the
20
+ project's package manager and script names.
24
21
 
25
22
  ## Security
26
23
 
@@ -32,4 +32,4 @@ Cron routes: require `authorization: Bearer ${process.env.CRON_SECRET}`, else re
32
32
 
33
33
  Zod schema validation on every Server Action and route handler before any DB operation; React Hook Form client-side.
34
34
 
35
- Cross-reference: [api-patterns/SKILL.md](../api-patterns/SKILL.md#architecture) for Server Action patterns; [session-checkpoints/SKILL.md](../session-checkpoints/SKILL.md) for checkpointing security-sensitive work.
35
+ Cross-reference: the **api-patterns** skill for Server Action patterns; the **session-checkpoints** skill for checkpointing security-sensitive work.
@@ -33,7 +33,7 @@
33
33
  |----------|---------|-----------|----------|-----------|
34
34
  | slack | C0AHAQFJ7C1 | 1772393542.345149 | Run migration on production? | 2026-03-01 14:30 |
35
35
 
36
- Remove row once answered (VS Code chat reply also counts as resolved).
36
+ Remove row once answered (a reply in chat counts as resolved).
37
37
 
38
38
  ## Decisions & Blockers
39
39
 
@@ -15,7 +15,7 @@ description: "Saves, restores session state including task progress, file change
15
15
  | Session end | Any session with incomplete work |
16
16
  | Context running low | Checkpoint immediately |
17
17
 
18
- Phase boundaries that warrant a checkpoint: see [decomposition](../../skills/decomposition/SKILL.md).
18
+ Phase boundaries that warrant a checkpoint: load the **decomposition** skill.
19
19
 
20
20
  ## Creating a Checkpoint
21
21
 
@@ -28,7 +28,7 @@ Phase boundaries that warrant a checkpoint: see [decomposition](../../skills/dec
28
28
  1. Read `.opencastle/SESSION-CHECKPOINT.md`
29
29
  2. Run `git status`, `git branch` — confirm you are on correct branch
30
30
  3. Check In Progress tasks — if stale (>1 session old), verify files match expected state
31
- 4. Check Pending Approvals — remove rows for questions answered via VS Code chat
31
+ 4. Check Pending Approvals — remove rows for questions the user has since answered in chat
32
32
  5. Read tracker issues for tasks marked In Progress or Todo
33
33
  6. Follow Resume Instructions section in checkpoint
34
34
  7. Update checkpoint progress after each completed task
@@ -15,7 +15,7 @@ description: "Provides model routing rules, validates delegation prerequisites,
15
15
  6. **Handle** output per Status Handling table
16
16
  7. **Log** via **observability-logging** skill
17
17
 
18
- For specialist agent registry, model assignments, see [agent-registry.md](../../.opencastle/agents/agent-registry.md).
18
+ For specialist agent registry, model assignments, see `.opencastle/agents/agent-registry.md`.
19
19
 
20
20
  ## Cost-Aware Model Routing
21
21
 
@@ -57,7 +57,7 @@ For specialist agent registry, model assignments, see [agent-registry.md](../../
57
57
  | 6+ subtasks, unfamiliar | Full deepen — parallel Researcher sub-agents |
58
58
 
59
59
  **Quick deepen:** Fire one Researcher for exact file paths + line ranges, patterns to follow (file:line examples), relevant lessons from `LESSONS-LEARNED.md`, risks/blockers per subtask, dependencies verified against exact imports.
60
- **Full deepen:** Split by domain into parallel Researchers. See [agent-registry.md](../../.opencastle/agents/agent-registry.md) for scope examples.
60
+ **Full deepen:** Split by domain into parallel Researchers. See `.opencastle/agents/agent-registry.md` for scope examples.
61
61
 
62
62
  Deepen is done when no field is still a guess — "some component" → exact path + line range, "follow existing style" → specific file:line.
63
63
 
@@ -30,7 +30,7 @@ Extended checklists and options for validation gates.
30
30
 
31
31
  ```json
32
32
  {
33
- "tool": "browser-testing/capture_screenshot",
33
+ "tool": "browser-testing/take_screenshot",
34
34
  "url": "http://localhost:3000/page",
35
35
  "viewports": ["mobile", "tablet", "desktop"],
36
36
  "wait_selector": ".content-loaded",