@plainconceptsplatform/agent-harness 2.2.0 → 2.3.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.
- package/package.json +1 -1
- package/src/commands/migrate.js +17 -1
- package/src/commands/update.js +13 -1
- package/src/content/.agents/skills/pc-make-engineer/SKILL.md +219 -219
- package/src/content/.agents/skills/pc-make-engineer/template.md +80 -81
- package/src/content/.opencode/plugins/pc-subagent-tiers.js +337 -281
- package/src/content/opencode.jsonc +41 -39
- package/src/steps/copy/agents.js +119 -118
- package/src/steps/copy/commands.js +95 -91
- package/src/steps/copy/fullstack-engineer.js +88 -85
- package/src/steps/copy/opencode-json.js +161 -147
- package/src/steps/metadata/index.js +4 -0
- package/src/steps/optimization/detect.js +66 -0
- package/src/steps/optimization/patch-guardrails.js +109 -108
- package/src/utils/agent-color.js +83 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plainconceptsplatform/agent-harness",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.0",
|
|
4
4
|
"description": "Installs the Plain Concepts Platform Harness into any codebase, and keeps it up to date. Wires OpenCode, OpenSpec, codegraph, and agentmemory into a multi-agent workflow that runs on native parallel subagents.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"opencode",
|
package/src/commands/migrate.js
CHANGED
|
@@ -235,7 +235,11 @@ export async function runMigrate({ cwd = process.cwd(), force = false, dryRun =
|
|
|
235
235
|
// 4. Rewrite identifiers everywhere that survives, so preserved skills and
|
|
236
236
|
// custom agents stop pointing at names that no longer exist.
|
|
237
237
|
let rewritten = 0
|
|
238
|
-
|
|
238
|
+
// .github/workflows is included because GitHub Agentic Workflow definitions
|
|
239
|
+
// call the skills by name (skill("pc-repo-audit")), so a stale ob- name there
|
|
240
|
+
// fails at run time in CI rather than locally. Their compiled .lock.yml files
|
|
241
|
+
// embed the same prompt text, so recompile with `gh aw compile` afterwards.
|
|
242
|
+
for (const dir of [skillsDir, opencodeDir, path.join(cwd, 'openspec'), path.join(cwd, '.github', 'workflows')]) {
|
|
239
243
|
if (!await fse.pathExists(dir)) continue
|
|
240
244
|
for (const file of await collectTextFiles(dir)) {
|
|
241
245
|
const before = await fse.readFile(file, 'utf-8')
|
|
@@ -281,6 +285,18 @@ export async function runMigrate({ cwd = process.cwd(), force = false, dryRun =
|
|
|
281
285
|
console.log(chalk.bold('Next: run update to install the current harness.'))
|
|
282
286
|
console.log(chalk.dim(' npx @plainconceptsplatform/agent-harness@latest update'))
|
|
283
287
|
|
|
288
|
+
// The .md definitions were rewritten above, but the compiled .lock.yml files
|
|
289
|
+
// embed the same prompt text and are what CI actually runs.
|
|
290
|
+
if (await fse.pathExists(path.join(cwd, '.github', 'workflows'))) {
|
|
291
|
+
const locks = (await fse.readdir(path.join(cwd, '.github', 'workflows')).catch(() => []))
|
|
292
|
+
.filter(f => f.endsWith('.lock.yml'))
|
|
293
|
+
if (locks.length > 0) {
|
|
294
|
+
console.log()
|
|
295
|
+
console.log(chalk.bold(`Then recompile ${locks.length} agentic workflow(s), whose .lock.yml still holds the old skill names:`))
|
|
296
|
+
console.log(chalk.dim(' gh aw compile'))
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
|
|
284
300
|
return { migrated: true, plan, rewritten, demoted }
|
|
285
301
|
}
|
|
286
302
|
|
package/src/commands/update.js
CHANGED
|
@@ -7,7 +7,9 @@ import { readHarnessConfig } from './shared.js'
|
|
|
7
7
|
import { copyContentStep } from '../steps/copy/index.js'
|
|
8
8
|
import { writeModelsToConfigs } from '../steps/models/write.js'
|
|
9
9
|
import { patchGuardrails } from '../steps/optimization/patch-guardrails.js'
|
|
10
|
+
import { reconcileTools } from '../steps/optimization/detect.js'
|
|
10
11
|
import { writeHarnessConfig } from '../steps/metadata/index.js'
|
|
12
|
+
import { info } from '../utils/exec.js'
|
|
11
13
|
import { exit } from '../utils/process.js'
|
|
12
14
|
|
|
13
15
|
const SIMPLE_ENGLISH_ENTRY = {
|
|
@@ -58,7 +60,17 @@ export async function runUpdate() {
|
|
|
58
60
|
await writeModelsToConfigs({ buildModel: saved.models.build })
|
|
59
61
|
}
|
|
60
62
|
|
|
61
|
-
|
|
63
|
+
// Reconcile against what is actually installed before patching guardrails.
|
|
64
|
+
// The saved flags drift: a project can be running the codegraph and
|
|
65
|
+
// agentmemory MCP servers with harness.json still recording them as false,
|
|
66
|
+
// and patchGuardrails would then empty those marker sections and strip the
|
|
67
|
+
// guidance for tools the project genuinely uses.
|
|
68
|
+
const tools = reconcileTools(saved.tools ?? {})
|
|
69
|
+
const gained = Object.keys(tools).filter(k => tools[k] && !saved.tools?.[k])
|
|
70
|
+
if (gained.length > 0) {
|
|
71
|
+
info(`Detected installed tools missing from harness.json: ${gained.join(', ')}`)
|
|
72
|
+
}
|
|
73
|
+
|
|
62
74
|
await migrateCavemanSkill(tools)
|
|
63
75
|
await patchGuardrails({
|
|
64
76
|
rtk: !!tools.rtk,
|
|
@@ -1,219 +1,219 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: pc-make-engineer
|
|
3
|
-
description: Create a custom engineer agent via persona-driven interactive design. Invoked by the /make-engineer command.
|
|
4
|
-
license: MIT
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
Create one file only: `.opencode/agents/{persona}-engineer.md`. The `pc-subagent-tiers` plugin creates tier variants (`.build.md`, `.fast.md`, `.plan.md`) at startup, so you never write those. It also generates `build.md` and `plan.md`, the only two primary agents: never create or edit those either.
|
|
8
|
-
|
|
9
|
-
Fidelity to the [template](template.md) is the whole job. The file contains frontmatter plus one identity paragraph plus the `## Abilities` section. No other `##` headings. No expertise notes, architecture details, conventions, file maps, or workflow steps. Those belong in skills. Always set `mode: subagent`. Engineers are reached through `task()`, never picked by a human, so a primary engineer would only clutter the agent picker. Never write `model:`. Only reference skills installed in the project's `.agents/skills/` directory.
|
|
10
|
-
|
|
11
|
-
Skills first: you must complete Step 4 (present the form, discover skills for every detected signal and architecture, let the user confirm the set, then install 5-10 skills) before writing any file.
|
|
12
|
-
|
|
13
|
-
## Step 1: Ask persona (always, closed choice)
|
|
14
|
-
|
|
15
|
-
Ask the user this question using the `question` tool:
|
|
16
|
-
|
|
17
|
-
> **"What type of engineer are you creating?"**
|
|
18
|
-
>
|
|
19
|
-
> - Frontend: UI components, pages, mobile, styling, browser
|
|
20
|
-
> - Layout Designer: Design systems, CSS architecture, Storybook, a11y
|
|
21
|
-
> - Backend: APIs, databases, auth, services
|
|
22
|
-
> - Data: Data pipelines, ETL, analytics, ML models, data quality
|
|
23
|
-
> - DevOps: CI/CD, infra, Docker, deploy
|
|
24
|
-
> - Security: Auth, secrets, vulnerability scanning, hardening
|
|
25
|
-
> - Mobile: React Native, Flutter, native iOS/Android
|
|
26
|
-
> - API / Integration: REST/GraphQL APIs, webhooks, third-party integrations
|
|
27
|
-
> - QA: Test automation, E2E, regression, performance testing
|
|
28
|
-
|
|
29
|
-
The chosen persona determines everything: what to detect, what questions to ask, what skills to suggest.
|
|
30
|
-
|
|
31
|
-
If the user passes the persona as an argument (e.g. `/make-engineer frontend`) or selects "Type your own answer", accept any single-word persona name and skip to Step 2.
|
|
32
|
-
|
|
33
|
-
## Step 2: Detect signals from source roots
|
|
34
|
-
|
|
35
|
-
Check `source-roots.json` first. Read `.opencode/source-roots.json`. If it doesn't exist or has empty roots, ask the user which directories to scan using the `question` tool with the project's top-level directories as options.
|
|
36
|
-
|
|
37
|
-
Also read `ARCHITECTURE.md` and `DESIGN.md` for context on the tech stack.
|
|
38
|
-
|
|
39
|
-
Scan for persona-relevant signals only. Look in manifest files (`package.json`, `tsconfig.json`, `*.csproj`, `pyproject.toml`, `requirements.txt`, `go.mod`, `Cargo.toml`, etc.) and project structure:
|
|
40
|
-
|
|
41
|
-
- Language: primary language(s) and version(s)
|
|
42
|
-
- Framework: web, backend, or mobile framework
|
|
43
|
-
- Data layer: ORM, database client, cache client
|
|
44
|
-
- Testing: test framework, test config files, test directories
|
|
45
|
-
- Styling: CSS framework, CSS-in-JS, design tokens
|
|
46
|
-
- Architecture: FSD, monolith, microservices, feature dirs
|
|
47
|
-
- i18n: internationalization libs
|
|
48
|
-
- CI/CD: workflow definition files
|
|
49
|
-
- Cloud / IaC: cloud provider config, infrastructure-as-code files
|
|
50
|
-
- Monitoring: observability/monitoring config or deps
|
|
51
|
-
- Linting: linter, formatter, and their config files
|
|
52
|
-
- Dependency Injection: DI/IoC containers, hook frameworks
|
|
53
|
-
|
|
54
|
-
Report what was detected as a signal inventory. This list drives Step 4 deterministically:
|
|
55
|
-
|
|
56
|
-
```
|
|
57
|
-
Signal inventory:
|
|
58
|
-
<signal-type>: <signal-value> (<source>)
|
|
59
|
-
<signal-type>: <signal-value> (<source>)
|
|
60
|
-
...
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
## Step 3: Persona-specific form (recommend and confirm)
|
|
64
|
-
|
|
65
|
-
Present a short form using the `question` tool. Each question is a closed choice or yes-no. Every option that matches a detected signal from Step 2 must be marked (Recommended) and pre-selected. The user just confirms or overrides.
|
|
66
|
-
|
|
67
|
-
Ask 2-5 questions total:
|
|
68
|
-
|
|
69
|
-
1. Architecture / patterns (always ask for `frontend`, `backend`, `layout`, `api` personas; optional otherwise). Use `multiple: true`. Pre-select the architecture detected in Step 2 and mark it (Recommended); offer common alternatives so the user can opt in even when the codebase does not signal one yet. Options map to the known sources in the [signal mapping](signal-mapping.md) reference:
|
|
70
|
-
- Feature-Sliced Design (FSD)
|
|
71
|
-
- Design patterns: singleton, observer, factory, hooks, HOC, compound, render-props, provider
|
|
72
|
-
- Rendering patterns: SSR, RSC, streaming, static, islands, progressive hydration
|
|
73
|
-
- Performance patterns: bundle splitting, tree-shaking, dynamic import, route-based
|
|
74
|
-
- Microservices
|
|
75
|
-
- Monolith / layered
|
|
76
|
-
2. Up to 4 more questions, only where Step 2 detected multiple options or where the user's choice genuinely matters (e.g. which test runner, which styling approach, which cloud). Skip anything with a single detected option and just use it silently.
|
|
77
|
-
|
|
78
|
-
Rules:
|
|
79
|
-
- Options matching a detected signal are (Recommended) and pre-selected.
|
|
80
|
-
- Never ask about things where only one option was detected.
|
|
81
|
-
- Keep the whole form to 5 questions max.
|
|
82
|
-
- The user's selections here (plus Step 2 signals) become the recommended skill set that Step 4 resolves, confirms, and installs.
|
|
83
|
-
|
|
84
|
-
## Step 4: Skill discovery, confirmation, and install
|
|
85
|
-
|
|
86
|
-
Complete this step fully before writing anything in Step 5. The agent file is worthless without real skills. The flow is: discover candidates, confirm with the user, install the confirmed set, verify.
|
|
87
|
-
|
|
88
|
-
### 4a. Pre-check already-installed skills
|
|
89
|
-
|
|
90
|
-
Before searching, build a map of what's already available:
|
|
91
|
-
|
|
92
|
-
1. List every directory in `.agents/skills/`
|
|
93
|
-
2. Read `skills-lock.json` for npx-installed skills
|
|
94
|
-
3. For each detected signal from Step 2, check if an already-installed skill covers it
|
|
95
|
-
4. Mark covered signals as already-satisfied
|
|
96
|
-
|
|
97
|
-
Report:
|
|
98
|
-
|
|
99
|
-
```
|
|
100
|
-
Already installed:
|
|
101
|
-
<skill-name> covers <signal>
|
|
102
|
-
...
|
|
103
|
-
Signals still needing skills:
|
|
104
|
-
- <signal-type>: <signal-value>
|
|
105
|
-
...
|
|
106
|
-
```
|
|
107
|
-
|
|
108
|
-
### 4b. Ensure `find-skills` is available
|
|
109
|
-
|
|
110
|
-
Check if `.agents/skills/find-skills/SKILL.md` exists. If not, install it:
|
|
111
|
-
|
|
112
|
-
```bash
|
|
113
|
-
npx skills add -y vercel-labs/skills@find-skills
|
|
114
|
-
```
|
|
115
|
-
|
|
116
|
-
If it can't be installed, stop and tell the user: "find-skills is required for skill discovery. Install it manually with `npx skills add -y vercel-labs/skills@find-skills` and re-run."
|
|
117
|
-
|
|
118
|
-
### 4c. Search and resolve
|
|
119
|
-
|
|
120
|
-
For each uncovered signal, run `npx skills find` with the query and resolve architecture/patterns via the known direct sources. Follow the [signal mapping](signal-mapping.md) reference for the full table of queries, known direct sources, quality filter, recommended set assembly, and post-install verification.
|
|
121
|
-
|
|
122
|
-
### 4d. Confirm the skill set (the form)
|
|
123
|
-
|
|
124
|
-
Present the recommended set to the user as a multi-select form using the `question` tool with `multiple: true`, and pre-select every recommended skill. This is the confirmation gate.
|
|
125
|
-
|
|
126
|
-
- Group the options by category: Architecture, Development, Testing, Infrastructure.
|
|
127
|
-
- For each skill show: name, one-line description, source (`owner/repo`), and install count (or "curated source" for known direct source entries).
|
|
128
|
-
- Every recommended skill is checked by default; the user unchecks anything unwanted.
|
|
129
|
-
- Include a short note that they can request additional skills by name.
|
|
130
|
-
- Nothing installs until the user submits this form.
|
|
131
|
-
|
|
132
|
-
The submitted selection is the confirmed set. Install only the confirmed set in the next step.
|
|
133
|
-
|
|
134
|
-
### 4e. Install the confirmed set
|
|
135
|
-
|
|
136
|
-
Install each confirmed skill (project-local). Always pass `-y` to skip the skills CLI's own prompt. Use the syntax that matches the source:
|
|
137
|
-
|
|
138
|
-
```bash
|
|
139
|
-
# skills.sh index entries (from npx skills find):
|
|
140
|
-
npx skills add -y <owner/repo@skill-name>
|
|
141
|
-
|
|
142
|
-
# known direct sources (Step 4c):
|
|
143
|
-
npx skills add -y feature-sliced/skills
|
|
144
|
-
npx skills add -y PatternsDev/skills --skill <skill-name>
|
|
145
|
-
```
|
|
146
|
-
|
|
147
|
-
Project-local only. Do not use the `-g` flag.
|
|
148
|
-
|
|
149
|
-
Then run the [post-install verification](signal-mapping.md) procedure for each installed skill.
|
|
150
|
-
|
|
151
|
-
## Step 5: Fill the template
|
|
152
|
-
|
|
153
|
-
Before creating the file, check if `.opencode/agents/{persona}-engineer.md` already exists. If it does, call the `question` tool:
|
|
154
|
-
|
|
155
|
-
```json
|
|
156
|
-
{
|
|
157
|
-
"questions": [
|
|
158
|
-
{
|
|
159
|
-
"header": "Overwrite engineer",
|
|
160
|
-
"question": "An engineer named \"{persona}-engineer\" already exists. Overwrite or cancel?",
|
|
161
|
-
"options": [
|
|
162
|
-
{ "label": "Overwrite", "description": "Proceed, preserving the existing color frontmatter value unless a new one is chosen." },
|
|
163
|
-
{ "label": "Cancel", "description": "Stop. Do not modify the existing file." }
|
|
164
|
-
]
|
|
165
|
-
}
|
|
166
|
-
]
|
|
167
|
-
}
|
|
168
|
-
```
|
|
169
|
-
|
|
170
|
-
- If `Overwrite`: proceed, but preserve the existing `color:` frontmatter value unless the user chose a new one.
|
|
171
|
-
- If `Cancel`: stop.
|
|
172
|
-
|
|
173
|
-
Fill the [template](template.md). All the research from Steps 2-4 (signal detection, project analysis, tech stack knowledge) was for selecting the right skills. The agent file itself is just the template. Do not write project knowledge, architecture notes, coding conventions, file maps, testing patterns, or workflow instructions into the file. Those belong in skills and guardrails.
|
|
174
|
-
|
|
175
|
-
Follow the [template](template.md) reference for the full structure, description quality bar, identity paragraph rules, category rules, and structural validation checklist.
|
|
176
|
-
|
|
177
|
-
## Step 6: Validate the file
|
|
178
|
-
|
|
179
|
-
After writing the agent file, run both checks from the [template](template.md) reference:
|
|
180
|
-
|
|
181
|
-
1. Structural validation: verify frontmatter, no `model:` field, `## Abilities` is the only `##` heading, one identity paragraph, abilities categorized, one file only.
|
|
182
|
-
2. Skill reference validation: verify every `@skill-name` in `## Abilities` exists in `.agents/skills/` and in `skills-lock.json`.
|
|
183
|
-
|
|
184
|
-
If either check fails, fix the file and re-validate.
|
|
185
|
-
|
|
186
|
-
## Step 7: Update fullstack-engineer.md abilities
|
|
187
|
-
|
|
188
|
-
`fullstack-engineer.md` is `mode: subagent`, but it is also the body that `pc-subagent-tiers` copies into `build.md` and `plan.md` on every startup. So every skill listed here reaches both primary agents, which is why it accumulates all of them: it plans and delegates rather than doing parallel implementation itself.
|
|
189
|
-
|
|
190
|
-
After creating the persona engineer and validating its references, additively merge new skills into fullstack:
|
|
191
|
-
|
|
192
|
-
1. Read `.agents/skills/` directory to list all installed skills.
|
|
193
|
-
2. Read `skills-lock.json` for npx-installed skills.
|
|
194
|
-
3. Read the current `fullstack-engineer.md`.
|
|
195
|
-
4. Parse its existing `## Abilities` section to find which skills are already listed.
|
|
196
|
-
5. Append-only: add only skills that are not already in the file (dedup by skill name).
|
|
197
|
-
6. Preserve the frontmatter (mode, color, permissions, model if stamped), the identity paragraph, and all existing ability lines.
|
|
198
|
-
7. Remove any old startup directive line. The `pc-system-reminders` plugin loads abilities for every session.
|
|
199
|
-
8. Write the file back.
|
|
200
|
-
|
|
201
|
-
Merge new skills into existing categories. If a new skill belongs to "Development" and that line already exists, append to it. If a new category is needed, add it. Do not overwrite the Abilities section.
|
|
202
|
-
|
|
203
|
-
## Step 8: Update AGENTS.md
|
|
204
|
-
|
|
205
|
-
Add the new agent to the agents table in AGENTS.md (if a table exists) or note it:
|
|
206
|
-
```
|
|
207
|
-
| `{persona}-engineer` | .opencode/agents/{persona}-engineer.md | <short role description> |
|
|
208
|
-
```
|
|
209
|
-
|
|
210
|
-
## Step 9: Show summary
|
|
211
|
-
|
|
212
|
-
Report:
|
|
213
|
-
- Engineer file created at `.opencode/agents/{persona}-engineer.md`
|
|
214
|
-
- Skills installed from skills.sh (list each with source and install count)
|
|
215
|
-
- Signals with no quality skill found on skills.sh (list each)
|
|
216
|
-
- Skills that failed validation or install (list each with reason)
|
|
217
|
-
- `fullstack-engineer.md` updated (additive, list new skills added)
|
|
218
|
-
- How to use: "This agent will be spawned by the lead during `/plan-apply` for tasks matching its specialty."
|
|
219
|
-
- "Restart opencode for the `pc-subagent-tiers` plugin to pick up the new engineer and rebuild `build.md` and `plan.md` from the updated fullstack abilities."
|
|
1
|
+
---
|
|
2
|
+
name: pc-make-engineer
|
|
3
|
+
description: Create a custom engineer agent via persona-driven interactive design. Invoked by the /make-engineer command.
|
|
4
|
+
license: MIT
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
Create one file only: `.opencode/agents/{persona}-engineer.md`. The `pc-subagent-tiers` plugin creates tier variants (`.build.md`, `.fast.md`, `.plan.md`) at startup, so you never write those. It also generates `build.md` and `plan.md`, the only two primary agents: never create or edit those either.
|
|
8
|
+
|
|
9
|
+
Fidelity to the [template](template.md) is the whole job. The file contains frontmatter plus one identity paragraph plus the `## Abilities` section. No other `##` headings. No expertise notes, architecture details, conventions, file maps, or workflow steps. Those belong in skills. Always set `mode: subagent`. Engineers are reached through `task()`, never picked by a human, so a primary engineer would only clutter the agent picker. Never write `model:` and never write `color:`. The `pc-subagent-tiers` plugin derives a colour from the agent name at startup, which is why the same persona looks the same in every project; `primary` and `warning` belong to the build and plan agents. Only reference skills installed in the project's `.agents/skills/` directory.
|
|
10
|
+
|
|
11
|
+
Skills first: you must complete Step 4 (present the form, discover skills for every detected signal and architecture, let the user confirm the set, then install 5-10 skills) before writing any file.
|
|
12
|
+
|
|
13
|
+
## Step 1: Ask persona (always, closed choice)
|
|
14
|
+
|
|
15
|
+
Ask the user this question using the `question` tool:
|
|
16
|
+
|
|
17
|
+
> **"What type of engineer are you creating?"**
|
|
18
|
+
>
|
|
19
|
+
> - Frontend: UI components, pages, mobile, styling, browser
|
|
20
|
+
> - Layout Designer: Design systems, CSS architecture, Storybook, a11y
|
|
21
|
+
> - Backend: APIs, databases, auth, services
|
|
22
|
+
> - Data: Data pipelines, ETL, analytics, ML models, data quality
|
|
23
|
+
> - DevOps: CI/CD, infra, Docker, deploy
|
|
24
|
+
> - Security: Auth, secrets, vulnerability scanning, hardening
|
|
25
|
+
> - Mobile: React Native, Flutter, native iOS/Android
|
|
26
|
+
> - API / Integration: REST/GraphQL APIs, webhooks, third-party integrations
|
|
27
|
+
> - QA: Test automation, E2E, regression, performance testing
|
|
28
|
+
|
|
29
|
+
The chosen persona determines everything: what to detect, what questions to ask, what skills to suggest.
|
|
30
|
+
|
|
31
|
+
If the user passes the persona as an argument (e.g. `/make-engineer frontend`) or selects "Type your own answer", accept any single-word persona name and skip to Step 2.
|
|
32
|
+
|
|
33
|
+
## Step 2: Detect signals from source roots
|
|
34
|
+
|
|
35
|
+
Check `source-roots.json` first. Read `.opencode/source-roots.json`. If it doesn't exist or has empty roots, ask the user which directories to scan using the `question` tool with the project's top-level directories as options.
|
|
36
|
+
|
|
37
|
+
Also read `ARCHITECTURE.md` and `DESIGN.md` for context on the tech stack.
|
|
38
|
+
|
|
39
|
+
Scan for persona-relevant signals only. Look in manifest files (`package.json`, `tsconfig.json`, `*.csproj`, `pyproject.toml`, `requirements.txt`, `go.mod`, `Cargo.toml`, etc.) and project structure:
|
|
40
|
+
|
|
41
|
+
- Language: primary language(s) and version(s)
|
|
42
|
+
- Framework: web, backend, or mobile framework
|
|
43
|
+
- Data layer: ORM, database client, cache client
|
|
44
|
+
- Testing: test framework, test config files, test directories
|
|
45
|
+
- Styling: CSS framework, CSS-in-JS, design tokens
|
|
46
|
+
- Architecture: FSD, monolith, microservices, feature dirs
|
|
47
|
+
- i18n: internationalization libs
|
|
48
|
+
- CI/CD: workflow definition files
|
|
49
|
+
- Cloud / IaC: cloud provider config, infrastructure-as-code files
|
|
50
|
+
- Monitoring: observability/monitoring config or deps
|
|
51
|
+
- Linting: linter, formatter, and their config files
|
|
52
|
+
- Dependency Injection: DI/IoC containers, hook frameworks
|
|
53
|
+
|
|
54
|
+
Report what was detected as a signal inventory. This list drives Step 4 deterministically:
|
|
55
|
+
|
|
56
|
+
```
|
|
57
|
+
Signal inventory:
|
|
58
|
+
<signal-type>: <signal-value> (<source>)
|
|
59
|
+
<signal-type>: <signal-value> (<source>)
|
|
60
|
+
...
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Step 3: Persona-specific form (recommend and confirm)
|
|
64
|
+
|
|
65
|
+
Present a short form using the `question` tool. Each question is a closed choice or yes-no. Every option that matches a detected signal from Step 2 must be marked (Recommended) and pre-selected. The user just confirms or overrides.
|
|
66
|
+
|
|
67
|
+
Ask 2-5 questions total:
|
|
68
|
+
|
|
69
|
+
1. Architecture / patterns (always ask for `frontend`, `backend`, `layout`, `api` personas; optional otherwise). Use `multiple: true`. Pre-select the architecture detected in Step 2 and mark it (Recommended); offer common alternatives so the user can opt in even when the codebase does not signal one yet. Options map to the known sources in the [signal mapping](signal-mapping.md) reference:
|
|
70
|
+
- Feature-Sliced Design (FSD)
|
|
71
|
+
- Design patterns: singleton, observer, factory, hooks, HOC, compound, render-props, provider
|
|
72
|
+
- Rendering patterns: SSR, RSC, streaming, static, islands, progressive hydration
|
|
73
|
+
- Performance patterns: bundle splitting, tree-shaking, dynamic import, route-based
|
|
74
|
+
- Microservices
|
|
75
|
+
- Monolith / layered
|
|
76
|
+
2. Up to 4 more questions, only where Step 2 detected multiple options or where the user's choice genuinely matters (e.g. which test runner, which styling approach, which cloud). Skip anything with a single detected option and just use it silently.
|
|
77
|
+
|
|
78
|
+
Rules:
|
|
79
|
+
- Options matching a detected signal are (Recommended) and pre-selected.
|
|
80
|
+
- Never ask about things where only one option was detected.
|
|
81
|
+
- Keep the whole form to 5 questions max.
|
|
82
|
+
- The user's selections here (plus Step 2 signals) become the recommended skill set that Step 4 resolves, confirms, and installs.
|
|
83
|
+
|
|
84
|
+
## Step 4: Skill discovery, confirmation, and install
|
|
85
|
+
|
|
86
|
+
Complete this step fully before writing anything in Step 5. The agent file is worthless without real skills. The flow is: discover candidates, confirm with the user, install the confirmed set, verify.
|
|
87
|
+
|
|
88
|
+
### 4a. Pre-check already-installed skills
|
|
89
|
+
|
|
90
|
+
Before searching, build a map of what's already available:
|
|
91
|
+
|
|
92
|
+
1. List every directory in `.agents/skills/`
|
|
93
|
+
2. Read `skills-lock.json` for npx-installed skills
|
|
94
|
+
3. For each detected signal from Step 2, check if an already-installed skill covers it
|
|
95
|
+
4. Mark covered signals as already-satisfied
|
|
96
|
+
|
|
97
|
+
Report:
|
|
98
|
+
|
|
99
|
+
```
|
|
100
|
+
Already installed:
|
|
101
|
+
<skill-name> covers <signal>
|
|
102
|
+
...
|
|
103
|
+
Signals still needing skills:
|
|
104
|
+
- <signal-type>: <signal-value>
|
|
105
|
+
...
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### 4b. Ensure `find-skills` is available
|
|
109
|
+
|
|
110
|
+
Check if `.agents/skills/find-skills/SKILL.md` exists. If not, install it:
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
npx skills add -y vercel-labs/skills@find-skills
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
If it can't be installed, stop and tell the user: "find-skills is required for skill discovery. Install it manually with `npx skills add -y vercel-labs/skills@find-skills` and re-run."
|
|
117
|
+
|
|
118
|
+
### 4c. Search and resolve
|
|
119
|
+
|
|
120
|
+
For each uncovered signal, run `npx skills find` with the query and resolve architecture/patterns via the known direct sources. Follow the [signal mapping](signal-mapping.md) reference for the full table of queries, known direct sources, quality filter, recommended set assembly, and post-install verification.
|
|
121
|
+
|
|
122
|
+
### 4d. Confirm the skill set (the form)
|
|
123
|
+
|
|
124
|
+
Present the recommended set to the user as a multi-select form using the `question` tool with `multiple: true`, and pre-select every recommended skill. This is the confirmation gate.
|
|
125
|
+
|
|
126
|
+
- Group the options by category: Architecture, Development, Testing, Infrastructure.
|
|
127
|
+
- For each skill show: name, one-line description, source (`owner/repo`), and install count (or "curated source" for known direct source entries).
|
|
128
|
+
- Every recommended skill is checked by default; the user unchecks anything unwanted.
|
|
129
|
+
- Include a short note that they can request additional skills by name.
|
|
130
|
+
- Nothing installs until the user submits this form.
|
|
131
|
+
|
|
132
|
+
The submitted selection is the confirmed set. Install only the confirmed set in the next step.
|
|
133
|
+
|
|
134
|
+
### 4e. Install the confirmed set
|
|
135
|
+
|
|
136
|
+
Install each confirmed skill (project-local). Always pass `-y` to skip the skills CLI's own prompt. Use the syntax that matches the source:
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
# skills.sh index entries (from npx skills find):
|
|
140
|
+
npx skills add -y <owner/repo@skill-name>
|
|
141
|
+
|
|
142
|
+
# known direct sources (Step 4c):
|
|
143
|
+
npx skills add -y feature-sliced/skills
|
|
144
|
+
npx skills add -y PatternsDev/skills --skill <skill-name>
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
Project-local only. Do not use the `-g` flag.
|
|
148
|
+
|
|
149
|
+
Then run the [post-install verification](signal-mapping.md) procedure for each installed skill.
|
|
150
|
+
|
|
151
|
+
## Step 5: Fill the template
|
|
152
|
+
|
|
153
|
+
Before creating the file, check if `.opencode/agents/{persona}-engineer.md` already exists. If it does, call the `question` tool:
|
|
154
|
+
|
|
155
|
+
```json
|
|
156
|
+
{
|
|
157
|
+
"questions": [
|
|
158
|
+
{
|
|
159
|
+
"header": "Overwrite engineer",
|
|
160
|
+
"question": "An engineer named \"{persona}-engineer\" already exists. Overwrite or cancel?",
|
|
161
|
+
"options": [
|
|
162
|
+
{ "label": "Overwrite", "description": "Proceed, preserving the existing color frontmatter value unless a new one is chosen." },
|
|
163
|
+
{ "label": "Cancel", "description": "Stop. Do not modify the existing file." }
|
|
164
|
+
]
|
|
165
|
+
}
|
|
166
|
+
]
|
|
167
|
+
}
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
- If `Overwrite`: proceed, but preserve the existing `color:` frontmatter value unless the user chose a new one.
|
|
171
|
+
- If `Cancel`: stop.
|
|
172
|
+
|
|
173
|
+
Fill the [template](template.md). All the research from Steps 2-4 (signal detection, project analysis, tech stack knowledge) was for selecting the right skills. The agent file itself is just the template. Do not write project knowledge, architecture notes, coding conventions, file maps, testing patterns, or workflow instructions into the file. Those belong in skills and guardrails.
|
|
174
|
+
|
|
175
|
+
Follow the [template](template.md) reference for the full structure, description quality bar, identity paragraph rules, category rules, and structural validation checklist.
|
|
176
|
+
|
|
177
|
+
## Step 6: Validate the file
|
|
178
|
+
|
|
179
|
+
After writing the agent file, run both checks from the [template](template.md) reference:
|
|
180
|
+
|
|
181
|
+
1. Structural validation: verify frontmatter, no `model:` field, `## Abilities` is the only `##` heading, one identity paragraph, abilities categorized, one file only.
|
|
182
|
+
2. Skill reference validation: verify every `@skill-name` in `## Abilities` exists in `.agents/skills/` and in `skills-lock.json`.
|
|
183
|
+
|
|
184
|
+
If either check fails, fix the file and re-validate.
|
|
185
|
+
|
|
186
|
+
## Step 7: Update fullstack-engineer.md abilities
|
|
187
|
+
|
|
188
|
+
`fullstack-engineer.md` is `mode: subagent`, but it is also the body that `pc-subagent-tiers` copies into `build.md` and `plan.md` on every startup. So every skill listed here reaches both primary agents, which is why it accumulates all of them: it plans and delegates rather than doing parallel implementation itself.
|
|
189
|
+
|
|
190
|
+
After creating the persona engineer and validating its references, additively merge new skills into fullstack:
|
|
191
|
+
|
|
192
|
+
1. Read `.agents/skills/` directory to list all installed skills.
|
|
193
|
+
2. Read `skills-lock.json` for npx-installed skills.
|
|
194
|
+
3. Read the current `fullstack-engineer.md`.
|
|
195
|
+
4. Parse its existing `## Abilities` section to find which skills are already listed.
|
|
196
|
+
5. Append-only: add only skills that are not already in the file (dedup by skill name).
|
|
197
|
+
6. Preserve the frontmatter (mode, color, permissions, model if stamped), the identity paragraph, and all existing ability lines.
|
|
198
|
+
7. Remove any old startup directive line. The `pc-system-reminders` plugin loads abilities for every session.
|
|
199
|
+
8. Write the file back.
|
|
200
|
+
|
|
201
|
+
Merge new skills into existing categories. If a new skill belongs to "Development" and that line already exists, append to it. If a new category is needed, add it. Do not overwrite the Abilities section.
|
|
202
|
+
|
|
203
|
+
## Step 8: Update AGENTS.md
|
|
204
|
+
|
|
205
|
+
Add the new agent to the agents table in AGENTS.md (if a table exists) or note it:
|
|
206
|
+
```
|
|
207
|
+
| `{persona}-engineer` | .opencode/agents/{persona}-engineer.md | <short role description> |
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
## Step 9: Show summary
|
|
211
|
+
|
|
212
|
+
Report:
|
|
213
|
+
- Engineer file created at `.opencode/agents/{persona}-engineer.md`
|
|
214
|
+
- Skills installed from skills.sh (list each with source and install count)
|
|
215
|
+
- Signals with no quality skill found on skills.sh (list each)
|
|
216
|
+
- Skills that failed validation or install (list each with reason)
|
|
217
|
+
- `fullstack-engineer.md` updated (additive, list new skills added)
|
|
218
|
+
- How to use: "This agent will be spawned by the lead during `/plan-apply` for tasks matching its specialty."
|
|
219
|
+
- "Restart opencode for the `pc-subagent-tiers` plugin to pick up the new engineer and rebuild `build.md` and `plan.md` from the updated fullstack abilities."
|