opencastle 1.4.3 → 1.5.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 (78) hide show
  1. package/dist/cli/bootstrap-on-init.test.js +5 -5
  2. package/dist/cli/bootstrap-on-init.test.js.map +1 -1
  3. package/dist/cli/bootstrap.d.ts +17 -0
  4. package/dist/cli/bootstrap.d.ts.map +1 -1
  5. package/dist/cli/bootstrap.js +284 -312
  6. package/dist/cli/bootstrap.js.map +1 -1
  7. package/dist/cli/bootstrap.test.js +22 -16
  8. package/dist/cli/bootstrap.test.js.map +1 -1
  9. package/dist/cli/convoy/engine.d.ts.map +1 -1
  10. package/dist/cli/convoy/engine.js +8 -2
  11. package/dist/cli/convoy/engine.js.map +1 -1
  12. package/dist/cli/detect.d.ts +4 -0
  13. package/dist/cli/detect.d.ts.map +1 -1
  14. package/dist/cli/detect.js +1 -1
  15. package/dist/cli/detect.js.map +1 -1
  16. package/dist/cli/doctor.js +4 -4
  17. package/dist/cli/doctor.js.map +1 -1
  18. package/dist/cli/init.test.js +4 -5
  19. package/dist/cli/init.test.js.map +1 -1
  20. package/dist/cli/log.d.ts +2 -2
  21. package/dist/cli/log.d.ts.map +1 -1
  22. package/dist/cli/log.js +1 -1
  23. package/dist/cli/log.js.map +1 -1
  24. package/dist/cli/log.test.js +1 -1
  25. package/dist/cli/log.test.js.map +1 -1
  26. package/dist/cli/managed-paths.d.ts +1 -1
  27. package/dist/cli/managed-paths.d.ts.map +1 -1
  28. package/dist/cli/managed-paths.js +0 -1
  29. package/dist/cli/managed-paths.js.map +1 -1
  30. package/dist/cli/project-facts.d.ts +103 -0
  31. package/dist/cli/project-facts.d.ts.map +1 -0
  32. package/dist/cli/project-facts.js +577 -0
  33. package/dist/cli/project-facts.js.map +1 -0
  34. package/dist/cli/project-facts.test.d.ts +2 -0
  35. package/dist/cli/project-facts.test.d.ts.map +1 -0
  36. package/dist/cli/project-facts.test.js +209 -0
  37. package/dist/cli/project-facts.test.js.map +1 -0
  38. package/dist/cli/stack-config.js +1 -1
  39. package/dist/cli/stack-config.js.map +1 -1
  40. package/package.json +1 -1
  41. package/src/cli/bootstrap-on-init.test.ts +5 -5
  42. package/src/cli/bootstrap.test.ts +22 -16
  43. package/src/cli/bootstrap.ts +361 -373
  44. package/src/cli/convoy/engine.ts +9 -2
  45. package/src/cli/detect.ts +1 -1
  46. package/src/cli/doctor.ts +4 -4
  47. package/src/cli/init.test.ts +4 -5
  48. package/src/cli/log.test.ts +1 -1
  49. package/src/cli/log.ts +2 -2
  50. package/src/cli/managed-paths.ts +0 -1
  51. package/src/cli/project-facts.test.ts +228 -0
  52. package/src/cli/project-facts.ts +647 -0
  53. package/src/cli/stack-config.ts +1 -1
  54. package/src/orchestrator/agent-workflows/data-pipeline.md +2 -2
  55. package/src/orchestrator/agent-workflows/feature-implementation.md +1 -1
  56. package/src/orchestrator/agent-workflows/schema-changes.md +1 -1
  57. package/src/orchestrator/agents/team-lead.agent.md +1 -1
  58. package/src/orchestrator/customizations/README.md +27 -84
  59. package/src/orchestrator/prompts/bootstrap-customizations.prompt.md +38 -238
  60. package/src/orchestrator/prompts/brainstorm.prompt.md +1 -1
  61. package/src/orchestrator/prompts/implement-feature.prompt.md +6 -6
  62. package/src/orchestrator/skills/agent-memory/KNOWLEDGE-GRAPH.md +1 -1
  63. package/src/orchestrator/skills/agent-memory/SKILL.md +7 -16
  64. package/src/orchestrator/skills/documentation-standards/SKILL.md +1 -1
  65. package/src/orchestrator/skills/observability-logging/SKILL.md +1 -1
  66. package/src/orchestrator/skills/panel-majority-vote/REFERENCE.md +1 -1
  67. package/src/orchestrator/skills/team-lead-reference/SKILL.md +2 -2
  68. package/src/orchestrator/customizations/AGENT-EXPERTISE.md +0 -325
  69. package/src/orchestrator/customizations/AGENT-FAILURES.md +0 -69
  70. package/src/orchestrator/customizations/AGENT-PERFORMANCE.md +0 -55
  71. package/src/orchestrator/customizations/DISPUTES.md +0 -162
  72. package/src/orchestrator/customizations/KNOWLEDGE-GRAPH.md +0 -10
  73. package/src/orchestrator/customizations/agents/skill-matrix.md +0 -111
  74. package/src/orchestrator/customizations/logs/events.ndjson +0 -0
  75. package/src/orchestrator/customizations/project/decisions.md +0 -31
  76. package/src/orchestrator/customizations/project/docs-structure.md +0 -34
  77. package/src/orchestrator/customizations/project/roadmap.md +0 -24
  78. /package/src/orchestrator/{customizations/logs/README.md → skills/observability-logging/LOG-SCHEMA.md} +0 -0
@@ -4,7 +4,7 @@
4
4
 
5
5
  Standard execution plan for crawling, processing, and importing data.
6
6
 
7
- > **Project config:** For project-specific paths, data schema, CLI commands, and processing rules, see `data-pipeline-config.md`. For data model docs, see `docs-structure.md`.
7
+ > **Project config:** For project-specific paths, data schema, CLI commands, and processing rules, see `data-pipeline-config.md`. For data model docs, see Key Documentation in `.opencastle/project.instructions.md`.
8
8
 
9
9
  ## Phases
10
10
 
@@ -34,7 +34,7 @@ The Team Lead creates the branch before any delegation and delivers it as the De
34
34
 
35
35
  1. Analyze the target data source (website, API, file)
36
36
  2. Identify data fields available and their mapping to the place schema
37
- 3. Check the data model documentation (see `docs-structure.md`) for required fields
37
+ 3. Check the data model documentation (Key Documentation in `.opencastle/project.instructions.md`) for required fields
38
38
  4. Estimate record count
39
39
  5. Check for existing scraper patterns (see **data-engineering** skill)
40
40
  6. Create tracker issue with data source details
@@ -212,7 +212,7 @@ If there are no open questions, explicitly state: "No open questions — plan is
212
212
  - Final responsive sweep at all breakpoints (if UI changes)
213
213
  7. Move all issues to Done
214
214
  8. Update session checkpoint → delete checkpoint
215
- 9. Update `.opencastle/project/roadmap.md`
215
+ 9. Update `.opencastle/project/roadmap.md`, when the project keeps one
216
216
 
217
217
  ### Exit Criteria
218
218
 
@@ -33,7 +33,7 @@ The Team Lead creates the branch before any delegation and delivers it as the De
33
33
  ### Steps
34
34
 
35
35
  1. Read current CMS schema to understand existing types
36
- 2. Check the data model documentation (see `docs-structure.md`) for field documentation
36
+ 2. Check the data model documentation (Key Documentation in `.opencastle/project.instructions.md`) for field documentation
37
37
  3. Check the query library (see CMS customization) for queries that will be affected
38
38
  4. Verify schema changes don't conflict with existing content in the CMS
39
39
  5. Document field mapping (new vs existing fields)
@@ -87,7 +87,7 @@ Developer | UI/UX Expert | Content Engineer | Data Engineer | Testing Expert | S
87
87
 
88
88
  **Step 5 — Deliver:** Follow the workflow template's Delivery phase. Verify all Done → build/lint/test → commit feature branch → `GH_PAGER=cat gh pr create` — do NOT merge → link PR → clean checkpoint → call **Reviewer**.
89
89
 
90
- **On Resume:** Read `SESSION-CHECKPOINT.md`. Check `AGENT-FAILURES.md`, `DISPUTES.md`. List In Progress / Todo → continue.
90
+ **On Resume:** Read `SESSION-CHECKPOINT.md`. Check `.opencastle/AGENT-FAILURES.md` and `.opencastle/DISPUTES.md` when they exist. List In Progress / Todo → continue.
91
91
 
92
92
  ## Observability
93
93
 
@@ -1,47 +1,33 @@
1
1
  # .opencastle/
2
2
 
3
- This directory is yours. It holds the project context the shipped skills read,
4
- the team's own instructions, skills, agents, prompts and workflows, and the team
5
- config. `opencastle sync` compiles it, together with OpenCastle's own content and
3
+ This directory is yours. It holds what the assistants need to know about this
4
+ project, the team's own instructions, skills, agents, prompts and workflows, and
5
+ the team config. `opencastle sync` compiles it, with OpenCastle's own content and
6
6
  any baseline the team extends, into the config every assistant reads.
7
7
 
8
8
  To change what the assistants are told, edit here — not the generated files.
9
- `opencastle sync --check` fails when someone edits a generated file in place or
10
- adds one by hand to a generated directory.
9
+ `opencastle sync --check` fails when someone edits a generated file in place.
11
10
 
12
- ## Why this exists
11
+ ## What is here
13
12
 
14
- Skills and instructions contain generic methodology (how to write migrations,
15
- how to test in a browser, how to run a panel review). This directory holds the
16
- concrete values those skills operate on — project IDs, table schemas, team
17
- UUIDs, endpoint inventories, and similar configuration that changes per project.
13
+ | Path | What it is |
14
+ |------|------------|
15
+ | `project.instructions.md` | The project: stack, structure, commands, routes, environment, and which skill covers which part. `init` wrote it from the code; correct it and add what the code cannot say |
16
+ | `stack/*.md` | Details the stack's skills read: the API's endpoints, the database's models and migrations, how tests and browser checks run, how it deploys |
17
+ | `KNOWN-ISSUES.md` | Problems and accepted risks found while working, checked before starting a task |
18
+ | `LESSONS-LEARNED.md` | Index of `lessons/`, one file per lesson, written by `opencastle lesson`. Rewritten by `sync`; never edit it by hand |
19
+ | `agents/agent-registry.md` | Which agent is for what, and on which tier |
20
+ | `agents/skill-matrix.json` | Which skills each agent loads, per capability slot |
21
+ | `config.json` | Team config, when you add one: `extends`, `exclude`, `mcpServers`, `policy`. Schema: <https://www.opencastle.dev/schema/config.json> |
22
+ | `lock.json`, `manifest.json` | What is installed and what every assistant is given. Written by `sync`; commit both |
18
23
 
19
- Skills reference these files by root-relative path, like
20
- `.opencastle/stack/api-config.md`, so agents load project context when they load
21
- a skill.
24
+ Created when there is something to put in them: `AGENT-FAILURES.md` and
25
+ `DISPUTES.md` (a delegation that failed for good, and a disagreement for a
26
+ person to decide), `project/decisions.md` and `project/roadmap.md`, and the
27
+ agent-memory files. `logs/`, the convoy database and worktrees are local and
28
+ gitignored.
22
29
 
23
- ## Contents
24
-
25
- | File | Purpose |
26
- |------|---------|
27
- | `README.md` | This file |
28
- | `config.json` | Team config, when you add one: `extends` (baselines), `exclude`, `mcpServers`, `policy`. Schema: <https://www.opencastle.dev/schema/config.json> |
29
- | `project.instructions.md` | High-level project context — apps, libraries, tech stack, ports, URLs |
30
- | `LESSONS-LEARNED.md` | Index of the lessons in `lessons/` — read before every session. Rewritten by `opencastle sync`; never edited by hand |
31
- | `lessons/` | One file per lesson: retries, workarounds and gotchas, written by `opencastle lesson` |
32
- | `KNOWN-ISSUES.md` | Tracked issues, limitations, and accepted risks discovered during sessions |
33
- | `DISPUTES.md` | Disagreements automated review could not settle, packaged for a person to decide |
34
- | `AGENT-FAILURES.md` | Dead letter queue for failed agent delegations |
35
- | `AGENT-PERFORMANCE.md` | Agent success tracking, log query recipes, performance metrics |
36
- | `AGENT-EXPERTISE.md` | Structured tracking of agent strengths/weaknesses across sessions |
37
- | `KNOWLEDGE-GRAPH.md` | Append-only relationship log for file dependencies, patterns, decisions |
38
- | `lock.json` | What every assistant is given. Written by every `sync`; commit it |
39
- | `manifest.json` | What is installed, and for which assistants. Written by `init` and `sync` |
40
-
41
- `sync` rewrites `LESSONS-LEARNED.md`, `lock.json` and `manifest.json`. It keeps
42
- your edits to everything else here.
43
-
44
- ### The team's own sources
30
+ ## The team's own sources
45
31
 
46
32
  `opencastle sync` compiles these into every assistant, in each one's own
47
33
  format. One with the same name as an item OpenCastle or a baseline ships
@@ -55,53 +41,10 @@ replaces it; `exclude` in `config.json` drops one.
55
41
  | `prompts/*.md` | A prompt — `/oc:<name>` in Claude Code and Copilot Chat |
56
42
  | `workflows/*.md` | A workflow template |
57
43
 
58
- ### `agents/` — Agent framework config
59
-
60
- Beside any agents of your own:
61
-
62
- | File | Purpose |
63
- |------|---------|
64
- | `agent-registry.md` | Specialist agents with model tier assignments and scope examples |
65
- | `skill-matrix.json` | Maps capability slots to concrete skill names per agent role (machine-readable) |
66
- | `skill-matrix.md` | Documentation companion explaining the skill matrix concept |
67
-
68
- ### `stack/` — Tech stack config
69
-
70
- Notes on the stack that the skills read. `opencastle init` writes the ones for
71
- what it detected, such as `testing-config.md`, or `supabase-config.md` when the
72
- project uses Supabase.
73
-
74
- ### `project/` — Project management config
75
-
76
- | File | Purpose |
77
- |------|---------|
78
- | `docs-structure.md` | Project documentation directory tree and practices |
79
- | `roadmap.md` | Project roadmap with planned features and their status |
80
- | `decisions.md` | Architecture Decision Records (ADRs) for the project |
81
- | `tracker-config.md` | Task tracker settings, when a tracker is set up |
82
-
83
- ### `logs/` — Append-only NDJSON session logs
84
-
85
- Structured logs agents append with `opencastle log` during sessions,
86
- delegations, reviews, panels and disputes. Gitignored, like the other run
87
- artefacts here.
88
-
89
- | File | Purpose |
90
- |------|---------|
91
- | `README.md` | The record schema |
92
- | `events.ndjson` | Every record, one JSON object per line |
93
-
94
- ## When to update
95
-
96
- Update these files when the project changes — new tables, new API routes, new
97
- apps, new tracker labels, etc. The skills themselves should rarely need editing;
98
- changing a project ID or adding a table column is a customization change, not a
99
- skill change.
100
-
101
- ## Bootstrap
44
+ ## Keeping it current
102
45
 
103
- `opencastle init` fills in what it can detect: frameworks, databases, CMS,
104
- deployment config and task tracking. On an existing codebase, run the
105
- `bootstrap-customizations` prompt next (`/oc:bootstrap-customizations` in
106
- Claude Code or Copilot Chat; in other assistants, ask for it by name) to fill
107
- in the rest from the code.
46
+ Update these files when the project changes — a new table, route, app or
47
+ environment. A file's "Still to describe" list is what `init` could not read
48
+ from the code; `/oc:bootstrap-customizations` (in Claude Code or Copilot Chat;
49
+ elsewhere, ask for the bootstrap-customizations prompt by name) has an agent fill
50
+ it in.
@@ -1,5 +1,5 @@
1
1
  ---
2
- description: 'Deep-analyze project to complete .opencastle/ configuration with schema details, API routes, environment variables, other info requiring reading actual config files. Programmatic bootstrap (run during opencastle init) already populated deterministic parts — do not redo that work.'
2
+ description: 'Completes the .opencastle/ project files on an existing codebase: checks what opencastle init read from the code, and fills in the "Still to describe" list at the end of each file by reading the code.'
3
3
  agent: 'Team Lead (OpenCastle)'
4
4
  ---
5
5
 
@@ -7,7 +7,7 @@ agent: 'Team Lead (OpenCastle)'
7
7
 
8
8
  # Complete Project Customizations
9
9
 
10
- Complete AI agent framework setup for a new project. Programmatic bootstrap (run automatically during `opencastle init`) already populated `.opencastle/` configuration files with everything it could determine automatically. Your job: **deep-analyze** project — reading actual config files, schemas, source code — to **fill in details** requiring reading real file contents.
10
+ `opencastle init` has already written `.opencastle/` from the repository: the stack with versions, the project structure, commands, routes and API endpoints, models and migrations, environment variable names, test setup, and which skill covers which part. What it could not read from the code, each file lists at its end under **Still to describe**. Your job is that list, and checking the rest.
11
11
 
12
12
  ## Additional Context (optional)
13
13
 
@@ -15,258 +15,58 @@ Complete AI agent framework setup for a new project. Programmatic bootstrap (run
15
15
 
16
16
  ---
17
17
 
18
- ## Background
18
+ ## What the skills read
19
19
 
20
- The `.opencastle/` directory holds project-specific configuration that skills load at runtime. Skills contain generic methodology (how to write migrations, how to test, how to deploy); customizations hold concrete values (which database, which endpoints, which project IDs).
20
+ | File | Holds | Read by |
21
+ |------|-------|---------|
22
+ | `.opencastle/project.instructions.md` | Stack, structure, commands, routes, environment, domain → skill map | Every agent, before planning |
23
+ | `.opencastle/stack/api-config.md` | Endpoints, server actions, middleware, external APIs | `api-patterns` |
24
+ | `.opencastle/stack/<database>-config.md` | Models, migrations, access rules | The database's skill |
25
+ | `.opencastle/stack/<cms>-config.md` | IDs, document types, queries | The CMS's skill |
26
+ | `.opencastle/stack/testing-config.md` | Test frameworks, files, browser checks, breakpoints | `testing-workflow`, `browser-testing` |
27
+ | `.opencastle/stack/deployment-config.md` | Platform, config, CI, environments | `deployment-infrastructure` and the platform's skill |
28
+ | `.opencastle/project/<tracker>-config.md` | Team and project IDs, workflow states, labels | The tracker's skill |
29
+ | `.opencastle/agents/agent-registry.md` | Which agent is for what; Deepen-Plan scopes | `team-lead-reference` |
21
30
 
22
- Without customizations, agents operate blind — they don't know project's table schema, API routes, deployment target, task board. This prompt fixes that.
23
-
24
- ## Pre-Existing Setup
25
-
26
- ### `.opencastle/manifest.json` — Detection Data
27
-
28
- `opencastle init` writes **`.opencastle/manifest.json`**. Two of its fields matter here:
29
-
30
- 1. **`repoInfo`** — what init detected by scanning config files, `package.json` dependencies, and directory structures
31
- 2. **`stack`** — the integrations installed: the ones init detected and the user confirmed, picked with `opencastle init --customize`, or added later with `opencastle add <pack>`
32
-
33
- Example:
34
-
35
- ```json
36
- {
37
- "stack": {
38
- "ides": ["vscode"],
39
- "techTools": ["nextjs", "supabase", "vitest", "chrome-devtools"],
40
- "teamTools": ["linear", "slack"]
41
- },
42
- "repoInfo": {
43
- "packageManager": "pnpm",
44
- "language": "typescript",
45
- "frameworks": ["next"],
46
- "databases": ["supabase"],
47
- "deployment": ["vercel"],
48
- "testing": ["vitest", "chrome-devtools"],
49
- "styling": ["tailwind"],
50
- "mcpConfig": true,
51
- "configFiles": ["package.json", "tsconfig.json", "vercel.json", "vitest.config.ts"]
52
- }
53
- }
54
- ```
55
-
56
- **Use `repoInfo` to:**
57
- - Know which technologies are present — skip re-scanning, go straight to reading their config files
58
- - Identify `configFiles` to read for deep inspection
59
-
60
- **Use `stack` to:** know which integrations are installed. If `stack.teamTools` or `repoInfo.pm` names a tracker (`linear`, `jira`, `trello`), ensure `project/<tracker>-config.md` exists — init creates it only for a tracker it knew about at the time; one added later with `opencastle add` has none yet.
61
-
62
- **Still inspect:** `repoInfo` detects presence, not configuration details. You still need to read the actual config files for schemas, IDs, routes, etc.
63
-
64
- Skill matrix (`.opencastle/agents/skill-matrix.json`) already has `cms`, `database` binding entries pre-filled. Appropriate task management, notifications skills already installed. Verify correctness; fill in remaining empty bindings.
65
-
66
- ### Pre-populated `.opencastle/` Files — What's Already Done
67
-
68
- Programmatic bootstrap running during `opencastle init` already created, partially filled these files. **Do not regenerate from scratch — update them instead.**
69
-
70
- | File | What's already there | What's missing |
71
- |------|---------------------|----------------|
72
- | `project.instructions.md` | Tech stack table, project name/description, key commands (`build`, `test`, `lint`), monorepo workspace listing | Dev server ports, env var inventory, app-by-app purpose descriptions |
73
- | `stack/testing-config.md` | Test framework names and config file paths | Selector conventions, test suite inventory, coverage thresholds, responsive breakpoints |
74
- | `stack/deployment-config.md` | Deployment platforms and config file paths | Env var names, cron jobs, security headers, caching strategy |
75
- | `stack/<provider>-config.md` | Database provider name and config file paths (e.g., `supabase-config.md`) | Table/schema inventory, RLS policies, auth integration details |
76
- | `stack/<provider>-config.md` | CMS provider name and config file paths (e.g., `sanity-config.md`) | Content model inventory, query patterns, project IDs |
77
- | `stack/api-config.md` | Framework name and empty endpoint tables (only when init detected a framework) | Route handler and Server Action inventory |
78
- | `project/<tracker>-config.md` | Template (only when init knew about the tracker) | Team IDs, workflow states, labels |
79
- | `project/docs-structure.md` | The `.opencastle/` documentation files | The project's own docs directory |
80
- | `agents/agent-registry.md`, `agents/skill-matrix.json`, `agents/skill-matrix.md` | Agent tiers and skill bindings for the installed integrations | Nothing in most projects — verify bindings |
81
- | `README.md`, `LESSONS-LEARNED.md`, `AGENT-FAILURES.md`, `AGENT-PERFORMANCE.md` | Full template content | Nothing — these are complete, just verify |
82
- | `logs/README.md`, `logs/events.ndjson` | Schema docs + empty log file | Nothing — these are complete |
83
-
84
- **Files that may not exist yet** (create them only if the project needs them):
85
- - `stack/api-config.md` — if the project has API routes or Server Actions but init detected no framework
86
- - `project/<tracker>-config.md` — if a tracker is in use but has no config file (see `stack` above)
87
- - `stack/data-pipeline-config.md` — init never creates it; requires reading pipeline scripts
88
-
89
- Any template file for technology NOT detected (no DB, no CMS, etc.) already removed.
31
+ `.opencastle/manifest.json` records what init detected (`repoInfo`) and the integrations installed (`stack`); `npx opencastle explain` lists the skills compiled for this project.
90
32
 
91
33
  ## Workflow
92
34
 
93
- ### Phase 1: Discovery
94
-
95
- Programmatic bootstrap already detected tech stack. **Skip re-scanning** — focus on reading actual file contents to extract details.
96
-
97
- #### 1.1 Read Pre-populated Files
98
-
99
- - **First**: Read all existing `.opencastle/` files to understand what's already filled in
100
- - Read `.opencastle/project.instructions.md` to see current tech stack table, gaps
101
- - Read each `stack/*.md` file — note any `<!-- TODO: verify -->` markers and empty table rows
102
- - Read `.opencastle/manifest.json` for `repoInfo` and `configFiles` — use `configFiles` as your reading list
103
- - Note what's missing (empty sections, placeholders, TODO markers)
104
-
105
- #### 1.2 Deep Inspection
106
-
107
- For each technology in pre-populated files, read its actual config files to extract details that couldn't be auto-detected:
108
-
109
- - **Database**: Read migration files, schema definitions, RLS policies, auth setup — extract table names, column types, policy names
110
- - **CMS**: Read schema files, document types, plugin config — extract content model names, field definitions, project/space IDs
111
- - **API**: Read route handlers, Server Actions, middleware — extract HTTP methods, endpoint paths, external API integrations
112
- - **Deployment**: Read deploy config — extract env var names (never values), cron schedules, security header values, cache settings
113
- - **Testing**: Read test config and test files — extract selector conventions, coverage thresholds, test suite structure, responsive breakpoints
114
- - **Docs**: Map the documentation directory tree (if it exists)
115
- - **Task tracking**: Find team IDs, project IDs, workflow states (check Linear/Jira config or docs)
116
-
117
- ### Phase 2: Complete Customization Files
118
-
119
- Update existing `.opencastle/` files using deep inspection data from Phase 1. **Do not regenerate files that already exist** — update them.
120
-
121
- Target file structure for reference:
122
-
123
- ```
124
- .opencastle/
125
- ├── README.md # Already created — verify
126
- ├── project.instructions.md # Already created — complete missing sections
127
- ├── LESSONS-LEARNED.md # Already created — verify
128
- ├── AGENT-FAILURES.md # Already created — verify
129
- ├── AGENT-PERFORMANCE.md # Already created — verify
130
- ├── agents/ # Already created — verify
131
- │ ├── agent-registry.md
132
- │ ├── skill-matrix.json
133
- │ └── skill-matrix.md
134
- ├── stack/ # Partial — update existing, create missing
135
- │ ├── api-config.md # Complete, or create if the project has API routes and it is missing
136
- │ ├── deployment-config.md # Already created — complete missing sections
137
- │ ├── testing-config.md # Already created — complete missing sections
138
- │ ├── <database>-config.md # Already created — complete schema/RLS details
139
- │ ├── <cms>-config.md # Already created — complete content model details
140
- │ └── data-pipeline-config.md # Create if pipelines exist
141
- ├── project/ # Partial — update existing, create missing
142
- │ ├── docs-structure.md # Already created — add the docs directory if one exists
143
- │ └── <tracker>-config.md # Complete, or create if a tracker is in use and it is missing
144
- └── logs/ # Already created — do not touch
145
- ├── README.md
146
- └── events.ndjson
147
- ```
148
-
149
- #### Root Files — Verify Existing
150
-
151
- 1. **`README.md`** — Already exists. Verify it lists all generated files with accurate descriptions.
152
-
153
- 2. **`project.instructions.md`** — Already exists with tech stack table and key commands. **Complete**:
154
- - Fill in dev server ports and URLs (if missing)
155
- - Fill in app-by-app purpose descriptions
156
- - Add environment variable inventory (names only — never values)
157
- - Resolve any `<!-- TODO: verify -->` markers
158
-
159
- 3. **`LESSONS-LEARNED.md`**, **`AGENT-FAILURES.md`**, **`AGENT-PERFORMANCE.md`** — Already exist as templates. Verify they look correct — no changes needed.
160
-
161
- #### `agents/` — Agent Framework Config (already created — verify)
162
-
163
- `npx opencastle explain` lists the agents and skills compiled for this project, and where each assistant reads them.
164
-
165
- 4. **`agents/agent-registry.md`** — Already lists the agents with their tiers. **Complete**:
166
- - Scope descriptions for this project
167
- - File partition examples using this project's real paths
168
-
169
- 5. **`agents/skill-matrix.json`** — Already holds capability slot bindings and `directSkills` per agent. **Verify**:
170
- - Slot bindings point at skills that exist (`npx opencastle doctor` reports unresolved slots)
171
- - Which agents load which skills (slots for integration skills, `directSkills` for process skills)
172
- - Note: `skill-matrix.md` is companion documentation file — JSON is source of truth
173
-
174
- #### `stack/` — Update Existing, Create Missing
175
-
176
- 6. **`stack/api-config.md`** — **Complete** it, or **create** it if the project has API routes or Server Actions and init did not:
177
- - Route handler inventory with HTTP methods
178
- - Server Actions inventory
179
- - External API integrations
180
- - Middleware chain
181
- - Authentication/authorization patterns
182
-
183
- 7. **`stack/deployment-config.md`** — Already exists. **Complete**:
184
- - Fill in environment variable names (never values)
185
- - Add cron jobs / scheduled tasks details
186
- - Add security headers
187
- - Add caching strategy
188
- - Resolve `<!-- TODO: verify -->` markers
189
-
190
- 8. **`stack/testing-config.md`** — Already exists. **Complete**:
191
- - Fill in test app/port for E2E
192
- - Add selector conventions (`data-testid`, etc.)
193
- - Add test suites inventory
194
- - Add coverage thresholds
195
- - Add responsive breakpoints for UI testing
196
-
197
- 9. **Database config** (e.g., `stack/supabase-config.md`, `stack/prisma-config.md`) — **Already exists**. **Complete**:
198
- - Fill in connection details (project ID, not credentials)
199
- - Add schema / table inventory with column summaries
200
- - Add role / permission system details
201
- - Add migration history and naming convention
202
- - Add auth integration flow
203
- - Resolve `<!-- TODO: verify -->` markers
204
-
205
- 10. **CMS config** (e.g., `stack/sanity-config.md`, `stack/contentful-config.md`) — **Already exists**. **Complete**:
206
- - Fill in project/space IDs
207
- - Add schema / content model inventory
208
- - Add plugin configuration
209
- - Add query patterns and examples
210
- - Resolve `<!-- TODO: verify -->` markers
211
-
212
- 11. **`stack/data-pipeline-config.md`** — **Create** if ETL / scraping / data processing exists:
213
- - Pipeline architecture
214
- - Data sources with status
215
- - CLI commands
216
- - Output format
217
- - Key files and directories
218
-
219
- #### `project/` — Project Management Config (create missing files)
220
-
221
- 12. **`project/docs-structure.md`** — Already exists. **Complete** if the project has its own documentation directory:
222
- - Full directory tree
223
- - Purpose of each document
224
- - Documentation conventions
225
-
226
- 13. **Task tracker config** in `project/` (e.g., `project/linear-config.md`, `project/jira-config.md`) — **Complete** it, or **create** it if task tracking is in use and it is missing:
227
- - Team / project IDs
228
- - Workflow state IDs
229
- - Label / category IDs
230
- - Board conventions
35
+ ### 1. Read what is there
231
36
 
232
- #### `logs/` — Do Not Touch
37
+ Read every file above that exists. Note each "Still to describe" item, and anything that looks wrong.
233
38
 
234
- `logs/README.md` and `logs/events.ndjson` are already created by the programmatic bootstrap. Do not modify them.
39
+ ### 2. Check the facts
235
40
 
236
- ### Phase 3: Cross-Reference Verification
41
+ init reads files; it does not run the project. Fix what it got wrong — a directory purpose guessed from its name, a dev port that a config overrides, a route that is not one. Keep everything that is right as it is.
237
42
 
238
- After generating all files:
43
+ ### 3. Fill in the lists
239
44
 
240
- 1. **Check skill references** — For each skill `npx opencastle explain` lists, verify it references the correct customization file (or note if a reference needs to be added)
241
- 2. **Check for gaps** — Is there project-specific knowledge that doesn't fit any file? Create an appropriate new file
242
- 3. **Check for staleness** — Does the generated content match the current state of the code? Flag anything uncertain with `<!-- TODO: verify -->`
45
+ For each "Still to describe" item, read the code that answers it and write the answer into the file as a section of its own, then remove the item. When a list is empty, remove its heading too. Typical sources:
243
46
 
244
- ## Output Format
47
+ - **Architecture** — entry points, how the apps and packages depend on each other, what calls which external service.
48
+ - **Endpoint auth and limits** — middleware, the auth helpers each route handler calls, rate-limit config.
49
+ - **Models and access** — the schema's relations, row-level security policies, role checks in the code.
50
+ - **Selectors and test data** — existing tests, `data-testid` usage, fixtures and seed scripts.
51
+ - **Environments and releases** — deploy config, CI workflows, the README.
245
52
 
246
- For each file **created or updated**, report:
247
- - File path
248
- - Whether it was created new or updated
249
- - Key sections added or completed
53
+ Where only a person can know the answer — a production URL, a team ID behind an API — leave the item and say so in your summary.
250
54
 
251
- End with a summary of what deep inspection revealed, what was completed/created, and what (if anything) still needs manual input (e.g., tracker team IDs that require API access to discover).
55
+ ### 4. Add what is missing
252
56
 
253
- After your summary, suggest next steps:
57
+ - A tracker in use with no `project/<tracker>-config.md`: create it.
58
+ - An ETL, scraping or import pipeline: create `stack/data-pipeline-config.md` — sources, commands, output format, key files.
59
+ - In `agents/agent-registry.md`, keep the Deepen-Plan scopes to directories that exist.
254
60
 
255
- ### Suggested Next Steps
61
+ ## Rules
256
62
 
257
- Now that your `.opencastle/` configuration is complete, here's what you can do:
63
+ - **Discover, don't assume.** Read the files; a Next.js app does not imply Supabase.
64
+ - **Names, never values.** Environment variable names only; never read `.env`.
65
+ - **Specific.** Real table names, endpoint paths and file paths — no placeholders, no empty tables.
66
+ - **Short.** These files are read before planning; write what an agent needs to act, not a tour of the code.
258
67
 
259
- 1. **Review remaining TODOs** — Scan `.opencastle/` for any remaining `<!-- TODO: verify -->` comments and fill in missing values (e.g., tracker team IDs that require API access)
260
- 2. **Implement a feature** — Use the **"Implement Feature"** prompt (`/oc:implement-feature` in Claude Code and Copilot) to have the Team Lead orchestrate a full feature build with task tracking, delegation, and verification
261
- 3. **Fix a bug** — Use the **"Bug Fix"** prompt (`/oc:bug-fix`) for structured triage, root cause analysis, and fix with tracker tracking
262
- 4. **Brainstorm first** — Not sure how to approach something? Use the **"Brainstorm"** prompt (`/oc:brainstorm`) to explore requirements and trade-offs before committing to a plan
263
- 5. **Plan a larger change with the convoy engine (experimental)** — `npx opencastle convoy "<task>"` writes a PRD and a convoy spec to `.opencastle/convoys/<name>.convoy.yml`, then asks before running it
68
+ ## Output
264
69
 
265
- ## Guidelines
70
+ For each file you changed: its path and what you added or corrected. Then what is still open and needs a person.
266
71
 
267
- - **Discover, don't assume.** Read actual config files. Don't guess that the project uses Supabase because it's a Next.js app.
268
- - **Skip what doesn't exist.** If there's no CMS, don't create a CMS config file.
269
- - **Names, not secrets.** Document environment variable names (`SUPABASE_URL`) but never values.
270
- - **Be specific.** Write actual table names, actual endpoint paths, actual file paths — not placeholders.
271
- - **Flag uncertainty.** If you can't determine something from the code, add a `<!-- TODO: verify -->` comment rather than guessing.
272
- - **Keep files focused.** Each file covers one domain. Don't put database schema in the deployment config.
72
+ Then suggest next steps: `/oc:implement-feature` (or ask for the implement-feature prompt) for a feature, `/oc:bug-fix` for a bug, `/oc:brainstorm` to explore first, and `npx opencastle convoy "<task>"` (experimental) to plan larger work as tasks that run in parallel.
@@ -35,7 +35,7 @@ Before exploring solutions, ensure problem is well-understood:
35
35
  Research before proposing. Gather data, don't guess:
36
36
 
37
37
  1. **Search existing code** — is there already a partial implementation, similar pattern, or relevant utility?
38
- 2. **Check documentation** — read `.opencastle/project.instructions.md`, `.opencastle/project/decisions.md`, `.opencastle/KNOWN-ISSUES.md` for constraints
38
+ 2. **Check documentation** — read `.opencastle/project.instructions.md`, `.opencastle/KNOWN-ISSUES.md` and, when the project keeps one, `.opencastle/project/decisions.md` for constraints
39
39
  3. **Check lessons learned** — read `.opencastle/LESSONS-LEARNED.md` for pitfalls in this area
40
40
  4. **Identify affected layers** — which apps, libs, data stores, third-party services are involved?
41
41
  5. **Research unknown topics** — if the request involves a real-world person, place, organization, or topic you don't have confident knowledge about, **search the internet** using any available web search or fetch tools (e.g. `fetch_webpage`, web search MCP, or similar) to gather accurate facts. Never fabricate content about real-world subjects.
@@ -7,7 +7,7 @@ agent: 'Team Lead (OpenCastle)'
7
7
 
8
8
  # Implement Roadmap Task
9
9
 
10
- You are the Team Lead. Implement the roadmap task described below following this strict workflow. Task comes from `.opencastle/project/roadmap.md`.
10
+ You are the Team Lead. Implement the task described below following this strict workflow. It may be an item of `.opencastle/project/roadmap.md`, when the project keeps one.
11
11
 
12
12
  ## Task
13
13
 
@@ -21,9 +21,9 @@ You are the Team Lead. Implement the roadmap task described below following this
21
21
 
22
22
  ### 1. Research & Context Gathering
23
23
 
24
- 1. **Read the roadmap** — Confirm scope, status, and acceptance criteria in `.opencastle/project/roadmap.md`
24
+ 1. **Read the roadmap** — Confirm scope, status, and acceptance criteria in `.opencastle/project/roadmap.md`, if there is one; otherwise from the task as given
25
25
  2. **Check blockers** — Read `.opencastle/KNOWN-ISSUES.md` and `.opencastle/LESSONS-LEARNED.md` for pitfalls and workarounds
26
- 3. **Read architecture docs** — Check `.opencastle/project.instructions.md` and `.opencastle/project/decisions.md` for constraints
26
+ 3. **Read architecture docs** — Check `.opencastle/project.instructions.md` and, when it exists, `.opencastle/project/decisions.md` for constraints
27
27
  4. **Search existing code** — Find related files, components, queries, and tests; check for reusable implementations before creating anything new
28
28
 
29
29
  ### 2. Task Board Setup (BLOCKING — must complete before Step 3)
@@ -88,9 +88,9 @@ Follow the **Delivery Checklist** in the **git-workflow** skill — commit, push
88
88
 
89
89
  ### 6. Documentation & Traceability
90
90
 
91
- 1. **Update roadmap** — Mark completed items with ✅ and date; include tracker issue IDs next to each scope item (e.g., `[PREFIX-6](<url>) — Description ✅ Done`)
91
+ 1. **Update roadmap** (when the project keeps one) — Mark completed items with ✅ and date; include tracker issue IDs next to each scope item (e.g., `[PREFIX-6](<url>) — Description ✅ Done`)
92
92
  2. **Update known issues** — Add new limitations to `.opencastle/KNOWN-ISSUES.md`
93
- 3. **Update architecture docs** — Add ADRs for architectural decisions to `.opencastle/project/decisions.md`
93
+ 3. **Update architecture docs** — Add ADRs for architectural decisions to `.opencastle/project/decisions.md`, creating it with the first one
94
94
  4. **Link tracker issues** — Reference roadmap section, partition files, and related issues in each description
95
95
  5. **Close issues properly** — Move to Done only after independent verification passes all gates
96
96
 
@@ -105,6 +105,6 @@ Roadmap task is complete when:
105
105
  - [ ] Visual consistency maintained across all affected pages, apps
106
106
  - [ ] Documentation updated (roadmap, known issues, decisions)
107
107
  - [ ] Panel review passed for any high-stakes changes
108
- - [ ] Roadmap item marked complete in `.opencastle/project/roadmap.md`
108
+ - [ ] Roadmap item marked complete in `.opencastle/project/roadmap.md`, if the task came from it
109
109
  - [ ] Delivery Checklist completed (see the **git-workflow** skill) — branch pushed, PR opened (not merged), tracker linked
110
110
  - [ ] Lessons learned captured if any retries occurred
@@ -2,7 +2,7 @@
2
2
 
3
3
  # Knowledge Graph Reference
4
4
 
5
- File dependency graph and cross-agent relationships stored in `.opencastle/KNOWLEDGE-GRAPH.md`.
5
+ File dependency graph and cross-agent relationships stored in `.opencastle/KNOWLEDGE-GRAPH.md`, which the first entry creates: a `# Knowledge Graph` heading and a `| Source | Relationship | Target | Added | Context |` table.
6
6
 
7
7
  ## Entity Types
8
8
 
@@ -7,9 +7,9 @@ description: "Creates, queries agent expertise profiles in AGENT-EXPERTISE.md; i
7
7
 
8
8
  ## Expertise File
9
9
 
10
- **Location:** `.opencastle/AGENT-EXPERTISE.md` — one section per agent with Strong Areas, Weak Areas, File Familiarity tables.
10
+ **Location:** `.opencastle/AGENT-EXPERTISE.md`, created on the first update. One `## <Agent>` section per agent that has worked here, each with `### Strong Areas`, `### Weak Areas` and `### File Familiarity`; add the file, then the section, when they are missing.
11
11
 
12
- Entry format: `Area | Evidence | Last Updated` — e.g. `Server Components | Built TAS-42 | 2026-03-15`. File familiarity: `- src/lib/search/ — 3 tasks`.
12
+ Entry format: `| Area | Evidence | Last Updated |` — e.g. `| Server Components | Built TAS-42 | 2026-03-15 |`. File familiarity: `- src/lib/search/ — 3 tasks`.
13
13
 
14
14
  ## Update Triggers
15
15
 
@@ -23,32 +23,23 @@ Entry format: `Area | Evidence | Last Updated` — e.g. `Server Components | Bui
23
23
 
24
24
  ## Retrieval & Delegation
25
25
 
26
- Query before delegating; include concise context block in prompt:
26
+ Query before delegating — there is nothing to read until the file exists — and include a concise context block in the prompt:
27
27
 
28
28
  ```sh
29
- grep -A5 "## Developer" .opencastle/AGENT-EXPERTISE.md
29
+ grep -A12 "^## Developer" .opencastle/AGENT-EXPERTISE.md 2>/dev/null
30
30
  ```
31
31
 
32
32
  Example prompt block: `Agent Context: Strong — Server Components (3 tasks); Weak — Component styling (2 retries); Familiar — src/lib/search/ (2 tasks)`
33
33
 
34
- **Update after task completion:**
34
+ **After task completion,** edit the agent's section with your file-editing tool: add the row under the right table, or raise the task count on the familiarity line. Appending with `>>` puts the row at the end of the file, under whichever agent's section happens to be last.
35
35
 
36
- ```bash
37
- # Append a Strong Area entry
38
- printf '| %s | %s | %s |\n' "Server Components" "Built TAS-42" "$(date +%Y-%m-%d)" >> .opencastle/AGENT-EXPERTISE.md
39
-
40
- # Increment file familiarity
41
- awk '/src\/lib\/search\// { if (match($0, /[0-9]+/)) { n = substr($0, RSTART, RLENGTH) + 1; sub(/[0-9]+[[:space:]]*tasks?/, n " tasks") } found=1 } {print} END { if(!found) print "- `src/lib/search/` — 1 task" }' \
42
- .opencastle/AGENT-EXPERTISE.md > tmp && mv tmp .opencastle/AGENT-EXPERTISE.md
43
- ```
44
-
45
- After each task also append file relationships to `.opencastle/KNOWLEDGE-GRAPH.md`. On DLQ failure, the Weak Area entry must carry the failure ID and a link to its logs.
36
+ After each task also add file relationships to `.opencastle/KNOWLEDGE-GRAPH.md`, created the same way. On DLQ failure, the Weak Area entry must carry the failure ID and a link to its logs.
46
37
 
47
38
  ## Validation Checkpoints
48
39
 
49
40
  - Before delegating: chosen agent has a Strong area matching the task and no conflicting Weak entry.
50
41
  - After completion: expertise file has the new entry, timestamped today.
51
- - After pruning: `rg "— [0-9]+ tasks" .opencastle/AGENT-EXPERTISE.md` shows no stale paths.
42
+ - After pruning: every path on a familiarity line still exists.
52
43
 
53
44
  ## Pruning
54
45
 
@@ -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: `.opencastle/project/docs-structure.md`. Writing guidelines, formatting rules, anti-patterns: `WRITING-GUIDE.md`, beside this file.
8
+ The project's own documents: Key Documentation in `.opencastle/project.instructions.md`. Writing guidelines, formatting rules, anti-patterns: `WRITING-GUIDE.md`, beside this file.
9
9
 
10
10
  ## Templates
11
11
 
@@ -11,7 +11,7 @@ description: "Logs sessions, tracks activity, records delegation decisions, and
11
11
  |------|------------|-----|------|
12
12
  | `events.ndjson` | `session`, `delegation`, `review`, `panel`, `dispute` | All agents / Team Lead / Panel runner | After each applicable event |
13
13
 
14
- See `.opencastle/logs/README.md` for full schema.
14
+ Full schema: [LOG-SCHEMA.md](./LOG-SCHEMA.md), beside this file; `opencastle log --help` lists the fields too.
15
15
 
16
16
  Use `opencastle log` CLI. One record per task; never batch-log retrospectively.
17
17