opencastle 0.25.0 → 0.26.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 (33) hide show
  1. package/dist/cli/bootstrap.d.ts +8 -0
  2. package/dist/cli/bootstrap.d.ts.map +1 -0
  3. package/dist/cli/bootstrap.js +358 -0
  4. package/dist/cli/bootstrap.js.map +1 -0
  5. package/dist/cli/bootstrap.test.d.ts +6 -0
  6. package/dist/cli/bootstrap.test.d.ts.map +1 -0
  7. package/dist/cli/bootstrap.test.js +196 -0
  8. package/dist/cli/bootstrap.test.js.map +1 -0
  9. package/dist/cli/init.d.ts.map +1 -1
  10. package/dist/cli/init.js +15 -9
  11. package/dist/cli/init.js.map +1 -1
  12. package/package.json +1 -1
  13. package/src/cli/bootstrap.test.ts +286 -0
  14. package/src/cli/bootstrap.ts +472 -0
  15. package/src/cli/init.ts +17 -12
  16. package/src/dashboard/node_modules/.vite/deps/_metadata.json +6 -6
  17. package/src/orchestrator/agents/team-lead.agent.md +4 -2
  18. package/src/orchestrator/customizations/README.md +3 -3
  19. package/src/orchestrator/customizations/agents/agent-registry.md +1 -1
  20. package/src/orchestrator/customizations/project/docs-structure.md +1 -1
  21. package/src/orchestrator/customizations/project/roadmap.md +1 -1
  22. package/src/orchestrator/customizations/project/tracker-config.md +1 -1
  23. package/src/orchestrator/customizations/project.instructions.md +2 -2
  24. package/src/orchestrator/customizations/stack/api-config.md +1 -1
  25. package/src/orchestrator/customizations/stack/cms-config.md +2 -2
  26. package/src/orchestrator/customizations/stack/data-pipeline-config.md +1 -1
  27. package/src/orchestrator/customizations/stack/database-config.md +2 -2
  28. package/src/orchestrator/customizations/stack/deployment-config.md +1 -1
  29. package/src/orchestrator/customizations/stack/notifications-config.md +1 -1
  30. package/src/orchestrator/customizations/stack/testing-config.md +1 -1
  31. package/src/orchestrator/instructions/general.instructions.md +2 -0
  32. package/src/orchestrator/prompts/bootstrap-customizations.prompt.md +127 -132
  33. package/src/orchestrator/skills/agent-hooks/SKILL.md +7 -2
@@ -1,7 +1,7 @@
1
1
  # Database Configuration
2
2
 
3
- <!-- Populated by the `bootstrap-customizations` prompt based on detected database.
4
- Rename this file to match your provider: supabase-config.md, prisma-config.md, drizzle-config.md, etc. -->
3
+ <!-- Populated by `opencastle init` based on detected database.
4
+ Renamed to match your provider: supabase-config.md, prisma-config.md, drizzle-config.md, etc. -->
5
5
 
6
6
  Project-specific database details referenced by the corresponding database skill (e.g., `supabase-database`).
7
7
 
@@ -1,6 +1,6 @@
1
1
  # Deployment Configuration
2
2
 
3
- <!-- Populated by the `bootstrap-customizations` prompt based on detected deployment config. -->
3
+ <!-- Populated by `opencastle init` based on detected deployment config. -->
4
4
 
5
5
  Project-specific deployment infrastructure referenced by the `deployment-infrastructure` skill.
6
6
 
@@ -1,6 +1,6 @@
1
1
  # Notifications Configuration
2
2
 
3
- <!-- Populated by the `bootstrap-customizations` prompt based on `.opencastle.json` → `stack.teamTools`. -->
3
+ <!-- Populated by `opencastle init` based on `.opencastle.json` → `stack.teamTools`. -->
4
4
 
5
5
  Project-specific messaging configuration referenced by the `slack-notifications` skill (or Teams equivalent).
6
6
 
@@ -1,6 +1,6 @@
1
1
  # Testing Configuration
2
2
 
3
- <!-- Populated by the `bootstrap-customizations` prompt based on detected test infrastructure. -->
3
+ <!-- Populated by `opencastle init` based on detected test infrastructure. -->
4
4
 
5
5
  Project-specific testing details referenced by the `browser-testing` skill.
6
6
 
@@ -139,6 +139,8 @@ These rules apply to ALL specialist agents automatically. **Do not duplicate the
139
139
  - [ ] **Delegations logged** — `events.ndjson` has a `delegation` record for each delegation (Team Lead only)
140
140
  - [ ] **Reviews logged** — `events.ndjson` has a `review` record for each fast review (if any)
141
141
  - [ ] **Panels logged** — `events.ndjson` has a `panel` record for each panel review (if any)
142
+ - [ ] **Agent expertise updated** — `AGENT-EXPERTISE.md` updated for each delegation (strong/weak areas + file familiarity) (Team Lead only)
143
+ - [ ] **Knowledge graph appended** — `KNOWLEDGE-GRAPH.md` has new rows for file relationships discovered (Team Lead only)
142
144
 
143
145
  Load the **observability-logging** skill for CLI commands, Base Output Contract, and detailed schemas.
144
146
 
@@ -1,13 +1,13 @@
1
1
  ---
2
- description: 'Bootstrap the .opencastle/ directory for a new project. Discovers project structure, tech stack, and configuration, then generates all customization files so skills have project-specific context to operate on.'
2
+ description: 'Deep-analyze the project to complete the .opencastle/ configuration with schema details, API routes, environment variables, and other information that requires reading actual config files. The programmatic bootstrap (run during opencastle init) has already populated the deterministic parts — do not redo that work.'
3
3
  agent: 'Team Lead (OpenCastle)'
4
4
  ---
5
5
 
6
6
  <!-- ⚠️ This file is managed by OpenCastle. Edits will be overwritten on update. Customize in the .opencastle/ directory instead. -->
7
7
 
8
- # Bootstrap Project Customizations
8
+ # Complete Project Customizations
9
9
 
10
- You are setting up the AI agent framework for a new project. Your job is to **discover** the project's structure, tech stack, and configuration, then **generate** the customization files that skills reference for project-specific context.
10
+ You are completing the AI agent framework setup for a new project. The programmatic bootstrap (run automatically during `opencastle init`) has already populated the `.opencastle/` configuration files with everything it could determine automatically. Your job is to **deep-analyze** the project reading actual config files, schemas, and source code — to **fill in the details** that require reading real file contents.
11
11
 
12
12
  ## Additional Context (optional)
13
13
 
@@ -21,9 +21,11 @@ The `.opencastle/` directory holds project-specific configuration that skills lo
21
21
 
22
22
  Without customizations, agents operate blind — they don't know the project's table schema, API routes, deployment target, or task board. This prompt fixes that.
23
23
 
24
- ## Pre-Existing Stack Info
24
+ ## Pre-Existing Setup
25
25
 
26
- Before starting discovery, check for **`.opencastle.json`** in the project root. If it exists, it contains a combined `repoInfo` field from `opencastle init` that merges two sources:
26
+ ### `.opencastle.json` Detection Data
27
+
28
+ The project root contains **`.opencastle.json`** with a `repoInfo` field populated by `opencastle init`. It merges two sources:
27
29
 
28
30
  1. **Auto-detected tooling** — the init command scanned config files, `package.json` dependencies, and directory structures
29
31
  2. **User-declared choices** — the user selected CMS, database, project management, and notifications via the interactive questionnaire
@@ -59,188 +61,182 @@ The result is a single unified view of the project's tech stack:
59
61
  ```
60
62
 
61
63
  **Use `repoInfo` to:**
62
- - Skip re-scanning for technologies already listed — go straight to reading their config files
63
- - Pre-fill the tech stack table in `project.instructions.md`
64
- - Know which `stack/` config files to create (e.g., if `repoInfo.databases` includes `"prisma"`, create `stack/prisma-config.md`; if `repoInfo.deployment` includes `"vercel"`, create `stack/deployment-config.md`)
65
- - Know which `project/` config files to create (e.g., if `repoInfo.pm` includes `"linear"`, create `project/linear-config.md`)
66
- - Identify `configFiles` to read for deep inspection (Phase 1.3)
64
+ - Know which technologies are presentskip re-scanning, go straight to reading their config files
65
+ - Identify `configFiles` to read for deep inspection
66
+ - Know which `project/` config files to create if they're missing (e.g., if `repoInfo.pm` includes `"linear"`, ensure `project/linear-config.md` exists)
67
67
 
68
- **`stack` vs `repoInfo`:** The `stack` field holds the raw user questionnaire answers (used internally for MCP server filtering and skill selection). The `repoInfo` field is the combined view you should use for discovery — it includes everything from `stack` plus all auto-detected tooling.
68
+ **`stack` vs `repoInfo`:** The `stack` field holds the raw user questionnaire answers (used internally for MCP server filtering and skill selection). The `repoInfo` field is the combined view you should use — it includes everything from `stack` plus all auto-detected tooling.
69
69
 
70
- **Still verify:** `repoInfo` detects presence, not configuration details. You still need to read the actual config files for schemas, IDs, routes, etc.
70
+ **Still inspect:** `repoInfo` detects presence, not configuration details. You still need to read the actual config files for schemas, IDs, routes, etc.
71
71
 
72
- The skill matrix (`.opencastle/agents/skill-matrix.json`) will already have the `cms` and `database` binding entries pre-filled based on this selection. The appropriate task management skill (`linear-task-management` for Linear, `jira-management` for Jira) and notifications skill (`slack-notifications` for Slack, `teams-notifications` for Teams) will already be installed. Verify they are correct and fill in any remaining empty bindings.
72
+ The skill matrix (`.opencastle/agents/skill-matrix.json`) will already have the `cms` and `database` binding entries pre-filled. The appropriate task management and notifications skills will already be installed. Verify they are correct and fill in any remaining empty bindings.
73
73
 
74
- ## Workflow
74
+ ### Pre-populated `.opencastle/` Files — What's Already Done
75
75
 
76
- ### Phase 1: Discovery
76
+ The programmatic bootstrap that runs during `opencastle init` has already created and partially filled these files. **Do not regenerate them from scratch — update them instead.**
77
77
 
78
- Explore the project systematically. Gather facts don't assume.
78
+ | File | What's already there | What's missing |
79
+ |------|---------------------|----------------|
80
+ | `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 |
81
+ | `stack/testing-config.md` | Test framework names and config file paths | Selector conventions, test suite inventory, coverage thresholds, responsive breakpoints |
82
+ | `stack/deployment-config.md` | Deployment platforms and config file paths | Env var names, cron jobs, security headers, caching strategy |
83
+ | `stack/<provider>-config.md` | Database provider name and config file paths (e.g., `supabase-config.md`) | Table/schema inventory, RLS policies, auth integration details |
84
+ | `stack/<provider>-config.md` | CMS provider name and config file paths (e.g., `sanity-config.md`) | Content model inventory, query patterns, project IDs |
85
+ | `README.md`, `LESSONS-LEARNED.md`, `AGENT-FAILURES.md`, `AGENT-PERFORMANCE.md` | Full template content | Nothing — these are complete, just verify |
86
+ | `logs/README.md`, `logs/events.ndjson` | Schema docs + empty log file | Nothing — these are complete |
79
87
 
80
- #### 1.1 Project Overview
88
+ **Files that DON'T exist yet** (because they can't be auto-populated and must be created by you):
89
+ - `stack/api-config.md` — requires reading actual route handlers and Server Actions
90
+ - `project/linear-config.md` (or other tracker) — requires reading docs or team IDs
91
+ - `project/docs-structure.md` — requires mapping the docs directory
92
+ - `stack/data-pipeline-config.md` — requires reading pipeline scripts
93
+ - `agents/agent-registry.md`, `agents/skill-matrix.json`, `agents/skill-matrix.md` — if `.github/agents/` and `.github/skills/` exist
81
94
 
82
- - **First**: Read `.opencastle.json` if it exists note `stack` choices and `repoInfo` detections
83
- - If `repoInfo` is present, use it as your starting inventory — skip re-scanning for the technologies it already lists
84
- - Read `README.md`, `package.json`, and any workspace config (`nx.json`, `turbo.json`, `pnpm-workspace.yaml`, `lerna.json`)
85
- - Identify: monorepo vs single app, package manager, language, framework(s)
86
- - List all apps and libraries with their purpose
87
- - Note ports, dev server commands, build commands
95
+ Any template file for a technology NOT detected (no DB, no CMS, etc.) has already been removed.
88
96
 
89
- #### 1.2 Tech Stack Inventory
97
+ ## Workflow
90
98
 
91
- For each technology detected, note its configuration:
99
+ ### Phase 1: Discovery
92
100
 
93
- | Area | What to look for |
94
- |------|-----------------|
95
- | **Framework** | Next.js (`next.config.*`), Nuxt, Remix, Astro, SvelteKit, Express, etc. |
96
- | **Database** | Supabase (`supabase/`), Prisma (`prisma/`), Drizzle, raw SQL, MongoDB |
97
- | **CMS** | Sanity (`sanity.config.*`), Contentful, Strapi, Payload |
98
- | **Auth** | Supabase Auth, NextAuth, Clerk, Auth0, custom JWT |
99
- | **Deployment** | Vercel (`vercel.json`), Netlify (`netlify.toml`), Docker, AWS, Railway |
100
- | **Testing** | Jest, Vitest, Playwright, Cypress, Testing Library |
101
- | **CI/CD** | GitHub Actions (`.github/workflows/`), GitLab CI, CircleCI |
102
- | **Task tracking** | Linear, Jira, GitHub Issues, Shortcut |
103
- | **Data pipeline** | Scrapers, ETL scripts, CLI tools, NDJSON processing |
104
- | **Styling** | Tailwind, CSS Modules, Sass, styled-components, Emotion |
101
+ The programmatic bootstrap has already detected the tech stack. **Skip re-scanning** — focus on reading actual file contents to extract details.
105
102
 
106
- #### 1.3 Deep Inspection
103
+ #### 1.1 Read Pre-populated Files
107
104
 
108
- For each detected technology, dig into the config:
105
+ - **First**: Read all existing `.opencastle/` files to understand what's already filled in
106
+ - Read `.opencastle/project.instructions.md` to see the current tech stack table and gaps
107
+ - Read each `stack/*.md` file — note any `<!-- TODO: verify -->` markers and empty table rows
108
+ - Read `.opencastle.json` for `repoInfo` and `configFiles` — use `configFiles` as your reading list
109
+ - Note what's missing (empty sections, placeholders, TODO markers)
109
110
 
110
- - **Database**: Read migration files, schema definitions, RLS policies, auth setup
111
- - **CMS**: Read schema files, document types, plugin config, query patterns
112
- - **API**: Find route handlers, Server Actions, middleware, external API integrations
113
- - **Deployment**: Read deploy config, environment variables, cron jobs, security headers
114
- - **Testing**: Find test config, test suites, test utilities, coverage setup
115
- - **Docs**: Map the project's documentation directory tree (if it exists)
111
+ #### 1.2 Deep Inspection
112
+
113
+ For each technology listed in the pre-populated files, read its actual config files to extract the details that couldn't be auto-detected:
114
+
115
+ - **Database**: Read migration files, schema definitions, RLS policies, auth setup — extract table names, column types, policy names
116
+ - **CMS**: Read schema files, document types, plugin config extract content model names, field definitions, project/space IDs
117
+ - **API**: Read route handlers, Server Actions, middleware — extract HTTP methods, endpoint paths, external API integrations
118
+ - **Deployment**: Read deploy config — extract env var names (never values), cron schedules, security header values, cache settings
119
+ - **Testing**: Read test config and test files — extract selector conventions, coverage thresholds, test suite structure, responsive breakpoints
120
+ - **Docs**: Map the documentation directory tree (if it exists)
116
121
  - **Task tracking**: Find team IDs, project IDs, workflow states (check Linear/Jira config or docs)
117
122
 
118
- ### Phase 2: Generate Customization Files
123
+ ### Phase 2: Complete Customization Files
119
124
 
120
- Create `.opencastle/` and generate files based on what you discovered. **Only create files for technologies actually present in the project.** Skip files that don't apply.
125
+ Update the existing `.opencastle/` files using the deep inspection data gathered in Phase 1. **Do not regenerate files that already exist** update them.
121
126
 
122
- Files are organized into subdirectories by domain:
127
+ Target file structure for reference:
123
128
 
124
129
  ```
125
130
  .opencastle/
126
- ├── README.md # Directory index
127
- ├── project.instructions.md # High-level project context
128
- ├── LESSONS-LEARNED.md # Knowledge base (retries, workarounds)
129
- ├── AGENT-FAILURES.md # Dead letter queue for failed delegations
130
- ├── AGENT-PERFORMANCE.md # Agent success tracking & log query recipes
131
- ├── agents/ # Agent framework config
131
+ ├── README.md # Already created — verify
132
+ ├── project.instructions.md # Already created — complete missing sections
133
+ ├── LESSONS-LEARNED.md # Already created verify
134
+ ├── AGENT-FAILURES.md # Already created verify
135
+ ├── AGENT-PERFORMANCE.md # Already created verify
136
+ ├── agents/ # Create if .github/agents/ and .github/skills/ exist
132
137
  │ ├── agent-registry.md
133
138
  │ ├── skill-matrix.json
134
139
  │ └── skill-matrix.md
135
- ├── stack/ # Tech stack config
136
- │ ├── api-config.md
137
- │ ├── deployment-config.md
138
- │ ├── testing-config.md
139
- │ ├── <database>-config.md # e.g. supabase-config.md, prisma-config.md
140
- │ ├── <cms>-config.md # e.g. sanity-config.md, contentful-config.md
141
- │ └── data-pipeline-config.md
142
- ├── project/ # Project management config
143
- │ ├── docs-structure.md
144
- │ └── <tracker>-config.md # e.g. linear-config.md, jira-config.md
145
- └── logs/ # Append-only NDJSON event log
140
+ ├── stack/ # Partial update existing, create missing
141
+ │ ├── api-config.md # Create — cannot be auto-populated
142
+ │ ├── deployment-config.md # Already created — complete missing sections
143
+ │ ├── testing-config.md # Already created — complete missing sections
144
+ │ ├── <database>-config.md # Already created — complete schema/RLS details
145
+ │ ├── <cms>-config.md # Already created — complete content model details
146
+ │ └── data-pipeline-config.md # Create if pipelines exist
147
+ ├── project/ # Create files that don't yet exist
148
+ │ ├── docs-structure.md # Create if docs directory exists
149
+ │ └── <tracker>-config.md # Create if task tracker configured
150
+ └── logs/ # Already created do not touch
146
151
  ├── README.md
147
152
  └── events.ndjson
148
153
  ```
149
154
 
150
- #### Root Files (always create)
151
-
152
- 1. **`README.md`** — Describe the customizations directory and list all files with their purpose, organized by subdirectory
153
-
154
- 2. **`project.instructions.md`** — High-level project context:
155
- - Project name and description
156
- - Apps and libraries with purpose
157
- - Tech stack summary table
158
- - Dev server ports and URLs
159
- - Package manager and key commands
160
- - Environment variable inventory (names only — never values)
155
+ #### Root Files Verify Existing
161
156
 
162
- 3. **`LESSONS-LEARNED.md`** — Empty knowledge base template for agent retries and workarounds. Agents append entries during sessions.
157
+ 1. **`README.md`** — Already exists. Verify it lists all generated files with accurate descriptions.
163
158
 
164
- 4. **`AGENT-FAILURES.md`** — Empty dead letter queue template for failed delegations.
159
+ 2. **`project.instructions.md`** — Already exists with tech stack table and key commands. **Complete**:
160
+ - Fill in dev server ports and URLs (if missing)
161
+ - Fill in app-by-app purpose descriptions
162
+ - Add environment variable inventory (names only — never values)
163
+ - Resolve any `<!-- TODO: verify -->` markers
165
164
 
166
- 5. **`AGENT-PERFORMANCE.md`** — Agent tracking template with log query recipes for the NDJSON files.
165
+ 3. **`LESSONS-LEARNED.md`**, **`AGENT-FAILURES.md`**, **`AGENT-PERFORMANCE.md`** — Already exist as templates. Verify they look correct no changes needed.
167
166
 
168
167
  #### `agents/` — Agent Framework Config (create if `.github/agents/` exists)
169
168
 
170
- 6. **`agents/agent-registry.md`** — If `.github/agents/` exists with agent definitions:
169
+ 4. **`agents/agent-registry.md`** — If `.github/agents/` exists with agent definitions:
171
170
  - List of agents with assigned model tiers
172
171
  - Scope descriptions
173
172
  - File partition examples
174
173
 
175
- 7. **`agents/skill-matrix.json`** — If `.github/skills/` exists with skill definitions:
174
+ 5. **`agents/skill-matrix.json`** — If `.github/skills/` exists with skill definitions:
176
175
  - Capability slot bindings and `directSkills` per agent role (in JSON format)
177
176
  - Which agents load which skills (slots for plugin skills, directSkills for process skills)
178
177
  - Note: `skill-matrix.md` is a companion documentation file — the JSON is the source of truth
179
178
 
180
- #### `stack/` — Tech Stack Config (create only for detected technologies)
179
+ #### `stack/` — Update Existing, Create Missing
181
180
 
182
- 8. **`stack/api-config.md`** — If the project has API routes or Server Actions:
181
+ 6. **`stack/api-config.md`** — **Create** (cannot be auto-populated). If the project has API routes or Server Actions:
183
182
  - Route handler inventory with HTTP methods
184
183
  - Server Actions inventory
185
184
  - External API integrations
186
185
  - Middleware chain
187
186
  - Authentication/authorization patterns
188
187
 
189
- 9. **`stack/deployment-config.md`** — If deployment config exists or `repoInfo.deployment` is non-empty:
190
- - Platform and architecture
191
- - Environment variables (names, not values)
192
- - Cron jobs / scheduled tasks
193
- - Security headers
194
- - Caching strategy
195
- - Key config files
196
-
197
- 10. **`stack/testing-config.md`** If test infrastructure exists:
198
- - Test framework and config
199
- - Test app/port for E2E
200
- - Selector conventions (`data-testid`, etc.)
201
- - Test suites inventory
202
- - Coverage requirements
203
- - Responsive breakpoints for UI testing
204
-
205
- 11. **Database config** in `stack/` (name after the provider, e.g., `stack/supabase-config.md`, `stack/prisma-config.md`):
206
- - Connection details (project ID, not credentials)
207
- - Schema / table inventory with column summaries
208
- - Role / permission system
209
- - Migration history and naming convention
210
- - Auth integration flow
211
- - Key files
212
-
213
- 12. **CMS config** in `stack/` (e.g., `stack/sanity-config.md`, `stack/contentful-config.md`):
214
- - Project/space IDs
215
- - Schema / content model inventory
216
- - Plugin configuration
217
- - Query patterns and examples
218
- - Key files
219
-
220
- 13. **`stack/data-pipeline-config.md`** — If ETL / scraping / data processing exists:
188
+ 7. **`stack/deployment-config.md`** — Already exists. **Complete**:
189
+ - Fill in environment variable names (never values)
190
+ - Add cron jobs / scheduled tasks details
191
+ - Add security headers
192
+ - Add caching strategy
193
+ - Resolve `<!-- TODO: verify -->` markers
194
+
195
+ 8. **`stack/testing-config.md`** — Already exists. **Complete**:
196
+ - Fill in test app/port for E2E
197
+ - Add selector conventions (`data-testid`, etc.)
198
+ - Add test suites inventory
199
+ - Add coverage thresholds
200
+ - Add responsive breakpoints for UI testing
201
+
202
+ 9. **Database config** (e.g., `stack/supabase-config.md`, `stack/prisma-config.md`) **Already exists**. **Complete**:
203
+ - Fill in connection details (project ID, not credentials)
204
+ - Add schema / table inventory with column summaries
205
+ - Add role / permission system details
206
+ - Add migration history and naming convention
207
+ - Add auth integration flow
208
+ - Resolve `<!-- TODO: verify -->` markers
209
+
210
+ 10. **CMS config** (e.g., `stack/sanity-config.md`, `stack/contentful-config.md`) — **Already exists**. **Complete**:
211
+ - Fill in project/space IDs
212
+ - Add schema / content model inventory
213
+ - Add plugin configuration
214
+ - Add query patterns and examples
215
+ - Resolve `<!-- TODO: verify -->` markers
216
+
217
+ 11. **`stack/data-pipeline-config.md`** **Create** if ETL / scraping / data processing exists:
221
218
  - Pipeline architecture
222
219
  - Data sources with status
223
220
  - CLI commands
224
221
  - Output format
225
222
  - Key files and directories
226
223
 
227
- #### `project/` — Project Management Config
224
+ #### `project/` — Project Management Config (create missing files)
228
225
 
229
- 14. **`project/docs-structure.md`** — If a documentation directory exists:
226
+ 12. **`project/docs-structure.md`** — **Create** if a documentation directory exists:
230
227
  - Full directory tree
231
228
  - Purpose of each document
232
229
  - Documentation conventions
233
230
 
234
- 15. **Task tracker config** in `project/` (e.g., `project/linear-config.md`, `project/jira-config.md`) — If task tracking config is documented:
231
+ 13. **Task tracker config** in `project/` (e.g., `project/linear-config.md`, `project/jira-config.md`) — **Create** if task tracking is configured:
235
232
  - Team / project IDs
236
233
  - Workflow state IDs
237
234
  - Label / category IDs
238
235
  - Board conventions
239
236
 
240
- #### `logs/` — Session Logs (always create)
237
+ #### `logs/` — Do Not Touch
241
238
 
242
- 16. **`logs/README.md`** Schema documentation for the unified NDJSON event log
243
- 17. **`logs/events.ndjson`** — Empty file for all structured event log entries (sessions, delegations, reviews, panels, disputes)
239
+ `logs/README.md` and `logs/events.ndjson` are already created by the programmatic bootstrap. Do not modify them.
244
240
 
245
241
  ### Phase 3: Cross-Reference Verification
246
242
 
@@ -252,25 +248,24 @@ After generating all files:
252
248
 
253
249
  ## Output Format
254
250
 
255
- For each file created, report:
251
+ For each file **created or updated**, report:
256
252
  - File path
257
- - Number of lines
258
- - Key sections included
253
+ - Whether it was created new or updated
254
+ - Key sections added or completed
259
255
 
260
- End with a summary of what was discovered, what was generated, and what (if anything) needs manual input (e.g., tracker team IDs that require API access to discover).
256
+ 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).
261
257
 
262
258
  After your summary, suggest next steps:
263
259
 
264
260
  ### Suggested Next Steps
265
261
 
266
- Now that your project is configured, here's what you can do:
262
+ Now that your `.opencastle/` configuration is complete, here's what you can do:
267
263
 
268
- 1. **Review the generated files** — Scan `.opencastle/` for any `<!-- TODO: verify -->` comments and fill in missing values (e.g., tracker team IDs, Supabase project IDs)
269
- 2. **Commit the customizations** — `git add .opencastle/ && git commit -m "chore: bootstrap OpenCastle customizations"`
270
- 3. **Implement a feature** — Use the **"Implement Feature"** prompt to have the Team Lead orchestrate a full feature build with task tracking, delegation, and verification
271
- 4. **Fix a bug** — Use the **"Bug Fix"** prompt for structured triage, root cause analysis, and fix with tracker tracking
272
- 5. **Brainstorm first** — Not sure how to approach something? Use the **"Brainstorm"** prompt to explore requirements and trade-offs before committing to a plan
273
- 6. **Generate a convoy spec** — Use the **"Generate Convoy"** prompt to create a `.convoy.yml` spec for autonomous convoy execution with `npx opencastle run` CLI command.
264
+ 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)
265
+ 2. **Implement a feature** — Use the **"Implement Feature"** prompt to have the Team Lead orchestrate a full feature build with task tracking, delegation, and verification
266
+ 3. **Fix a bug** — Use the **"Bug Fix"** prompt for structured triage, root cause analysis, and fix with tracker tracking
267
+ 4. **Brainstorm first** — Not sure how to approach something? Use the **"Brainstorm"** prompt to explore requirements and trade-offs before committing to a plan
268
+ 5. **Generate a convoy spec** — Use the **"Generate Convoy"** prompt to create a `.convoy.yml` spec for autonomous convoy execution with `npx opencastle run` CLI command.
274
269
 
275
270
  ## Guidelines
276
271
 
@@ -33,7 +33,8 @@ Session Lifecycle:
33
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
34
  4. **Check dead letter queue** — Scan `.opencastle/AGENT-FAILURES.md` for pending failures related to the current scope.
35
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. **Load domain skills** — Based on the task description, load the appropriate skills before writing code. Don't start coding without the relevant skill loaded.
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.
37
38
 
38
39
  ### Template for Delegation Prompts
39
40
 
@@ -99,7 +100,9 @@ Run the 5-point Pre-Delegation Checks from the Team Lead agent file: (1) Tracker
99
100
  3. **Check acceptance criteria** — Compare output against the tracker issue's acceptance criteria. Each criterion must be independently verified.
100
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.
101
102
  5. **Lessons captured** — If the agent retried anything, verify a lesson was added via the **self-improvement** skill.
102
- 6. **Update tracker** — Move the issue to Done (if passing) or add failure notes and re-delegate (if failing).
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).
103
106
 
104
107
  ### Quick Checklist
105
108
 
@@ -116,6 +119,8 @@ Post-Delegate:
116
119
  ☐ Discovered issues tracked (not ignored)
117
120
  ☐ Lessons captured (if retries occurred)
118
121
  ☐ Issue updated
122
+ ☐ Agent expertise updated (AGENT-EXPERTISE.md — strong/weak area + file familiarity)
123
+ ☐ Knowledge graph appended (KNOWLEDGE-GRAPH.md — file relationships)
119
124
  ```
120
125
 
121
126
  ---