@plainconceptsplatform/agent-harness 3.4.1 → 3.6.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 (96) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +455 -454
  3. package/cli/commands/join.js +259 -259
  4. package/cli/commands/migrate.js +310 -310
  5. package/cli/commands/shared.js +27 -27
  6. package/cli/commands/single.js +79 -79
  7. package/cli/commands/wizard.js +134 -134
  8. package/cli/fragments/ops-backlog/az.md +28 -28
  9. package/cli/fragments/ops-backlog/gh.md +28 -28
  10. package/cli/fragments/ops-backlog/jira.md +28 -28
  11. package/cli/fragments/ops-review/az.md +62 -62
  12. package/cli/fragments/ops-review/gh.md +51 -51
  13. package/cli/fragments/ops-review/gl.md +55 -55
  14. package/cli/fragments/ops-ship/gh.md +67 -67
  15. package/cli/fragments/ops-ship/gl.md +84 -84
  16. package/cli/index.js +116 -116
  17. package/cli/presets/clean.json +21 -21
  18. package/cli/presets/models.json +68 -68
  19. package/cli/presets/optimization.json +32 -32
  20. package/cli/presets/platforms.json +76 -76
  21. package/cli/presets/source.json +23 -23
  22. package/cli/steps/clean/index.js +120 -120
  23. package/cli/steps/copy/agents.js +120 -120
  24. package/cli/steps/copy/fullstack-engineer.js +89 -89
  25. package/cli/steps/copy/opencode-json.js +324 -324
  26. package/cli/steps/copy/skills.js +316 -316
  27. package/cli/steps/models/format.js +88 -88
  28. package/cli/steps/models/index.js +64 -64
  29. package/cli/steps/openspec/index.js +136 -136
  30. package/cli/steps/optimization/codegraph.js +141 -141
  31. package/cli/steps/optimization/detect.js +66 -66
  32. package/cli/steps/optimization/humanizer.js +17 -17
  33. package/cli/steps/optimization/index.js +158 -158
  34. package/cli/steps/optimization/memory.js +91 -91
  35. package/cli/steps/optimization/patch-guardrails.js +111 -111
  36. package/cli/steps/optimization/simple-english.js +17 -17
  37. package/cli/steps/optimization/skills-lock.js +30 -30
  38. package/cli/steps/platform/index.js +109 -109
  39. package/cli/steps/source/index.js +123 -123
  40. package/cli/utils/agent-color.js +111 -111
  41. package/cli/utils/copy.js +134 -134
  42. package/cli/utils/exec-spinner.js +47 -47
  43. package/cli/utils/exec.js +134 -134
  44. package/cli/utils/legacy-check.js +30 -30
  45. package/cli/utils/models-cache.js +58 -58
  46. package/cli/utils/models-pricing.js +42 -42
  47. package/cli/utils/paths.js +81 -81
  48. package/cli/utils/process.js +3 -3
  49. package/cli/utils/terminal.js +6 -6
  50. package/cli/utils/update-manifest.js +75 -75
  51. package/harness/.opencode/_gitignore +10 -10
  52. package/harness/.opencode/commands/ops-backlog.md +10 -10
  53. package/harness/.opencode/commands/ops-review.md +10 -10
  54. package/harness/.opencode/commands/ops-ship.md +9 -9
  55. package/harness/.opencode/commands/plan-archive.md +7 -7
  56. package/harness/.opencode/commands/plan-explore.md +11 -11
  57. package/harness/.opencode/commands/plan-propose.md +11 -11
  58. package/harness/.opencode/commands/plan-quick.md +7 -7
  59. package/harness/.opencode/commands/plan-story.md +11 -11
  60. package/harness/.opencode/commands/repo-audit.md +7 -7
  61. package/harness/.opencode/commands/repo-help.md +5 -5
  62. package/harness/.opencode/package.json +5 -5
  63. package/harness/.opencode/plugins/pc-commit-coauthor.js +41 -0
  64. package/harness/.opencode/plugins/pc-subagent-monitor.js +184 -184
  65. package/harness/.opencode/plugins/pc-subagent-tiers.js +367 -367
  66. package/harness/.opencode/plugins/pc-system-reminders.js +386 -386
  67. package/harness/.opencode/scripts/check-diff.mjs +252 -244
  68. package/harness/.opencode/scripts/code-rules.mjs +288 -288
  69. package/harness/ARCHITECTURE.md +13 -13
  70. package/harness/DESIGN.md +13 -13
  71. package/harness/opencode.jsonc +36 -36
  72. package/harness/openspec/config.yaml +20 -20
  73. package/harness/skills-lock.json +17 -17
  74. package/package.json +14 -12
  75. package/skills/agent-harness-cli/SKILL.md +86 -86
  76. package/skills/pc-guardrails-generic/SKILL.md +53 -53
  77. package/skills/pc-guardrails-project/SKILL.md +8 -8
  78. package/skills/pc-make-architecture/structure-template.md +64 -64
  79. package/skills/pc-make-engineer/SKILL.md +59 -59
  80. package/skills/pc-make-engineer/template.md +36 -36
  81. package/skills/pc-make-guardrails/category-reference.md +112 -112
  82. package/skills/pc-make-merge-risk-assess/SKILL.md +70 -70
  83. package/skills/pc-make-merge-risk-assess/category-reference.md +114 -114
  84. package/skills/pc-ops-ship/SKILL.md +22 -22
  85. package/skills/pc-plan-apply/SKILL.md +88 -86
  86. package/skills/pc-plan-apply/simple-mode.md +21 -21
  87. package/skills/pc-plan-explore/SKILL.md +21 -21
  88. package/skills/pc-plan-goal/SKILL.md +91 -91
  89. package/skills/pc-plan-goal/failure-policy.md +30 -30
  90. package/skills/pc-plan-goal/output-mode.md +10 -10
  91. package/skills/pc-plan-propose/SKILL.md +125 -125
  92. package/skills/pc-plan-propose/task-annotation.md +39 -39
  93. package/skills/pc-plan-quick/SKILL.md +46 -46
  94. package/skills/pc-repo-audit/SKILL.md +44 -44
  95. package/skills/pc-repo-help/SKILL.md +87 -87
  96. package/skills/pc-repo-verify/SKILL.md +150 -150
@@ -1,59 +1,59 @@
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, `.opencode/agents/{persona}-engineer.md`, from the [template](template.md). The research behind it is for choosing the right skills, not for filling the file: expertise notes, architecture, conventions, file maps and workflow steps belong in skills.
8
-
9
- ## Rules
10
-
11
- - Never write the agent file before the user has confirmed the skill set and it is installed. An engineer whose abilities do not exist cannot work.
12
- - Never write `model:` or `color:`. `pc-subagent-tiers` injects both at startup, so a hand-picked colour is overwritten.
13
- - Never create `*.build.md`, `*.fast.md`, `*.plan.md`, `build.md` or `plan.md`. The plugin regenerates all of them every startup and anything written there is lost.
14
- - `mode: subagent`. Engineers are reached through the subagent tool, and a primary would clutter the two-entry list a human picks from.
15
- - The only `##` heading is `## Abilities`, and the identity paragraph is two or three sentences carrying no project knowledge.
16
- - Every `@skill` under `## Abilities` exists in `.agents/skills/` and in `skills-lock.json`. A name that is not installed is skipped rather than blocking the worker, so a typo costs the agent that ability in silence.
17
- - Project-local installs only: `npx skills add -y ...`, never `-g`.
18
- - At most five form questions, and only where more than one option was detected. A signal with one option is used without asking.
19
-
20
- ## Contracts
21
-
22
- Personas: `frontend`, `layout`, `backend`, `data`, `devops`, `security`, `mobile`, `api`, `qa`. A persona passed as an argument (`/make-engineer frontend`) or typed by the user is taken as given.
23
-
24
- Signals to detect: language, framework, data layer, testing, styling, architecture, i18n, CI/CD, cloud and IaC, monitoring, linting, dependency injection.
25
-
26
- Discovery needs `find-skills`, and has no fallback without it:
27
-
28
- ```bash
29
- npx skills add -y vercel-labs/skills@find-skills
30
- ```
31
-
32
- When `.opencode/agents/{persona}-engineer.md` already exists, ask before touching it:
33
-
34
- ```json
35
- {
36
- "questions": [
37
- {
38
- "header": "Overwrite engineer",
39
- "question": "An engineer named \"{persona}-engineer\" already exists. Overwrite or cancel?",
40
- "options": [
41
- { "label": "Overwrite", "description": "Rewrite the file from the template." },
42
- { "label": "Cancel", "description": "Stop. Do not modify the existing file." }
43
- ]
44
- }
45
- ]
46
- }
47
- ```
48
-
49
- `fullstack-engineer.md` is the body `pc-subagent-tiers` copies into `build.md` and `plan.md`, so every skill listed there reaches both primaries. Merge into it additively: add only skills it does not already list, put them in the category lines that already exist where they fit, and leave its frontmatter, identity paragraph and existing ability lines alone.
50
-
51
- ## Flow
52
-
53
- 1. **Persona.** Ask with the `question` tool unless it arrived as an argument. The answer decides what to detect, what to ask, and which skills to look for.
54
- 2. **Signals.** Read `.opencode/source-roots.json` (if it is missing or empty, ask which directories to scan), then `ARCHITECTURE.md`, `DESIGN.md`, and the manifests (`package.json`, `tsconfig.json`, `*.csproj`, `pyproject.toml`, `go.mod`, `Cargo.toml`). Detect what the persona needs and report the inventory.
55
- 3. **Form.** Present the detected options with the `question` tool, pre-selected and marked `(Recommended)`. For `frontend`, `backend`, `layout` and `api`, one question is architecture and patterns, whose options come from the [signal mapping](signal-mapping.md) tables.
56
- 4. **Skills.** A signal already covered by a skill in `.agents/skills/` or `skills-lock.json` needs no search. Map each remaining signal to a query through the [signal mapping](signal-mapping.md), present the candidates as one multi-select `question` grouped by category (name, one line, `owner/repo`, install count), install what the user confirms, and verify each one landed in both `.agents/skills/` and the lockfile.
57
- 5. **Write** the file from the [template](template.md).
58
- 6. **Merge** the new skills into `fullstack-engineer.md`.
59
- 7. **Report** the file created, the skills installed, the signals with no quality skill, whatever failed, and that opencode has to restart before `pc-subagent-tiers` picks the engineer up.
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, `.opencode/agents/{persona}-engineer.md`, from the [template](template.md). The research behind it is for choosing the right skills, not for filling the file: expertise notes, architecture, conventions, file maps and workflow steps belong in skills.
8
+
9
+ ## Rules
10
+
11
+ - Never write the agent file before the user has confirmed the skill set and it is installed. An engineer whose abilities do not exist cannot work.
12
+ - Never write `model:` or `color:`. `pc-subagent-tiers` injects both at startup, so a hand-picked colour is overwritten.
13
+ - Never create `*.build.md`, `*.fast.md`, `*.plan.md`, `build.md` or `plan.md`. The plugin regenerates all of them every startup and anything written there is lost.
14
+ - `mode: subagent`. Engineers are reached through the subagent tool, and a primary would clutter the two-entry list a human picks from.
15
+ - The only `##` heading is `## Abilities`, and the identity paragraph is two or three sentences carrying no project knowledge.
16
+ - Every `@skill` under `## Abilities` exists in `.agents/skills/` and in `skills-lock.json`. A name that is not installed is skipped rather than blocking the worker, so a typo costs the agent that ability in silence.
17
+ - Project-local installs only: `npx skills add -y ...`, never `-g`.
18
+ - At most five form questions, and only where more than one option was detected. A signal with one option is used without asking.
19
+
20
+ ## Contracts
21
+
22
+ Personas: `frontend`, `layout`, `backend`, `data`, `devops`, `security`, `mobile`, `api`, `qa`. A persona passed as an argument (`/make-engineer frontend`) or typed by the user is taken as given.
23
+
24
+ Signals to detect: language, framework, data layer, testing, styling, architecture, i18n, CI/CD, cloud and IaC, monitoring, linting, dependency injection.
25
+
26
+ Discovery needs `find-skills`, and has no fallback without it:
27
+
28
+ ```bash
29
+ npx skills add -y vercel-labs/skills@find-skills
30
+ ```
31
+
32
+ When `.opencode/agents/{persona}-engineer.md` already exists, ask before touching it:
33
+
34
+ ```json
35
+ {
36
+ "questions": [
37
+ {
38
+ "header": "Overwrite engineer",
39
+ "question": "An engineer named \"{persona}-engineer\" already exists. Overwrite or cancel?",
40
+ "options": [
41
+ { "label": "Overwrite", "description": "Rewrite the file from the template." },
42
+ { "label": "Cancel", "description": "Stop. Do not modify the existing file." }
43
+ ]
44
+ }
45
+ ]
46
+ }
47
+ ```
48
+
49
+ `fullstack-engineer.md` is the body `pc-subagent-tiers` copies into `build.md` and `plan.md`, so every skill listed there reaches both primaries. Merge into it additively: add only skills it does not already list, put them in the category lines that already exist where they fit, and leave its frontmatter, identity paragraph and existing ability lines alone.
50
+
51
+ ## Flow
52
+
53
+ 1. **Persona.** Ask with the `question` tool unless it arrived as an argument. The answer decides what to detect, what to ask, and which skills to look for.
54
+ 2. **Signals.** Read `.opencode/source-roots.json` (if it is missing or empty, ask which directories to scan), then `ARCHITECTURE.md`, `DESIGN.md`, and the manifests (`package.json`, `tsconfig.json`, `*.csproj`, `pyproject.toml`, `go.mod`, `Cargo.toml`). Detect what the persona needs and report the inventory.
55
+ 3. **Form.** Present the detected options with the `question` tool, pre-selected and marked `(Recommended)`. For `frontend`, `backend`, `layout` and `api`, one question is architecture and patterns, whose options come from the [signal mapping](signal-mapping.md) tables.
56
+ 4. **Skills.** A signal already covered by a skill in `.agents/skills/` or `skills-lock.json` needs no search. Map each remaining signal to a query through the [signal mapping](signal-mapping.md), present the candidates as one multi-select `question` grouped by category (name, one line, `owner/repo`, install count), install what the user confirms, and verify each one landed in both `.agents/skills/` and the lockfile.
57
+ 5. **Write** the file from the [template](template.md).
58
+ 6. **Merge** the new skills into `fullstack-engineer.md`.
59
+ 7. **Report** the file created, the skills installed, the signals with no quality skill, whatever failed, and that opencode has to restart before `pc-subagent-tiers` picks the engineer up.
@@ -1,36 +1,36 @@
1
- # Agent file template
2
-
3
- The whole file, with nothing else in it:
4
-
5
- ```markdown
6
- ---
7
- description: <one sentence naming the persona + top 3-5 detected technologies>
8
- mode: subagent
9
- ---
10
-
11
- <One paragraph: "You are a {persona} engineer specializing in {top technologies}. You own all work in {scope/files}." Keep it to 2-3 sentences max.>
12
-
13
- ## Abilities
14
- - Guardrails: @pc-guardrails-generic, @pc-guardrails-project
15
- - Development: <@installed-skill-1>, <@installed-skill-2>, ...
16
- - Testing: <@installed-skill-for-testing>, ...
17
- - Infrastructure: <@installed-skill-for-devops>, ...
18
- ```
19
-
20
- Replace every `<...>` placeholder with real values, and drop any category line with no skills in it (Guardrails always stays). Development is language, framework, UI and DI skills; Testing is test, lint and typecheck skills; Infrastructure is DevOps, CI/CD and cloud skills.
21
-
22
- ## Description quality bar
23
-
24
- `description:` is the matching key for `/plan-apply`: the lead compares a task's domain text against it to pick a specialist, so a vague one gets the wrong engineer spawned.
25
-
26
- Bad: `"A frontend engineer for React"`
27
-
28
- Good: `"Frontend engineer for Ink 7 + React 19 TUI, FSD architecture, Inversify DI, design tokens, and i18n"`
29
-
30
- Name the persona, list the three to five technologies actually detected, one sentence, no padding.
31
-
32
- ## Identity paragraph
33
-
34
- Two or three sentences: who the engineer is, and what files or layers it owns. A knowledge dump here is knowledge the lead cannot reuse and the engineer did not ask for.
35
-
36
- Good: `"You are a frontend engineer specializing in terminal UI development with Ink 7 + React 19. You own all work in the FSD layers: src/app/, src/widgets/, src/features/, src/entities/, and src/shared/."`
1
+ # Agent file template
2
+
3
+ The whole file, with nothing else in it:
4
+
5
+ ```markdown
6
+ ---
7
+ description: <one sentence naming the persona + top 3-5 detected technologies>
8
+ mode: subagent
9
+ ---
10
+
11
+ <One paragraph: "You are a {persona} engineer specializing in {top technologies}. You own all work in {scope/files}." Keep it to 2-3 sentences max.>
12
+
13
+ ## Abilities
14
+ - Guardrails: @pc-guardrails-generic, @pc-guardrails-project
15
+ - Development: <@installed-skill-1>, <@installed-skill-2>, ...
16
+ - Testing: <@installed-skill-for-testing>, ...
17
+ - Infrastructure: <@installed-skill-for-devops>, ...
18
+ ```
19
+
20
+ Replace every `<...>` placeholder with real values, and drop any category line with no skills in it (Guardrails always stays). Development is language, framework, UI and DI skills; Testing is test, lint and typecheck skills; Infrastructure is DevOps, CI/CD and cloud skills.
21
+
22
+ ## Description quality bar
23
+
24
+ `description:` is the matching key for `/plan-apply`: the lead compares a task's domain text against it to pick a specialist, so a vague one gets the wrong engineer spawned.
25
+
26
+ Bad: `"A frontend engineer for React"`
27
+
28
+ Good: `"Frontend engineer for Ink 7 + React 19 TUI, FSD architecture, Inversify DI, design tokens, and i18n"`
29
+
30
+ Name the persona, list the three to five technologies actually detected, one sentence, no padding.
31
+
32
+ ## Identity paragraph
33
+
34
+ Two or three sentences: who the engineer is, and what files or layers it owns. A knowledge dump here is knowledge the lead cannot reuse and the engineer did not ask for.
35
+
36
+ Good: `"You are a frontend engineer specializing in terminal UI development with Ink 7 + React 19. You own all work in the FSD layers: src/app/, src/widgets/, src/features/, src/entities/, and src/shared/."`
@@ -1,112 +1,112 @@
1
- # Guardrails category reference
2
-
3
- From the documents and code graph analysis, extract the rules an agent could break without noticing. Only include a category if you found real evidence for it.
4
-
5
- - Architecture constraints: layer boundaries, module dependencies, forbidden imports, directory ownership rules (e.g. "src/api/ must not import from src/ui/"). Verify actual import boundaries with the project-selected analysis tools.
6
- - File organization: the god-files and dumping-ground constants this project has already accumulated, named. The general principle is in `pc-guardrails-generic`; what belongs here is where this codebase keeps breaking it.
7
- - Naming conventions: file naming, component naming, API route conventions, branch naming
8
- - Code style: formatter config, lint rules, import ordering, max line length. Derive from actual config files.
9
- - Testing rules: test file locations, naming, coverage gates, what must be tested before merge
10
- - Build & deployment: build commands, env requirements, deployment targets, CI gates
11
- - Data & state: migration rules, schema change process, state management patterns
12
- - Security: auth boundaries, input validation requirements, secrets handling
13
- - Dependencies: package manager, lockfile rules, upgrade policy, forbidden packages
14
- - Git workflow: branch naming, commit message format, PR process (platform-specific from `harness.json`)
15
- - Domain-specific rules: anything in `openspec/config.yaml` context or `ARCHITECTURE.md` constraints/risks sections
16
-
17
- Each rule must be:
18
-
19
- - **Negative.** State the boundary and what breaks when it is crossed, not the behaviour you want: `Never import Microsoft.EntityFrameworkCore.* in Application; it is a layer violation and the build does not catch it`, not `Keep Application framework-free`. A prohibition removes an option; a preference competes with everything else the model knows about writing code, and loses.
20
- - **Concrete**: "Use `pnpm` not `npm`" not "Use the right package manager".
21
- - **Evidence-based**: derived from the files and code graph you analyzed. Never invent a rule the project does not state or demonstrate somewhere.
22
- - **Not enforced elsewhere.** Skip anything the formatter, linter, type checker, test suite, CI gate or a harness plugin already fails the build on. A rule restating `biome.json` is read on every load and changes nothing: the build was going to catch it. Write the rules that nothing but a careful reader would catch.
23
- - **Not already in `pc-guardrails-generic`.** That skill loads alongside this one, every request. Secrets, zero-comment default, scratch-file location, one-responsibility-per-file, minimal-test discipline, and the engineer workflow are its rules, not this file's.
24
-
25
- **At most 40 rules, across all categories.** Rank by what a violation costs and cut from the bottom; a category with nothing consequential in it gets no rules at all. This cap is the point of the exercise, not tidiness: compliance falls away as a rule file grows, so the 41st rule does not just cost its own tokens, it dilutes the 40 that matter. If more than 40 survive every bar above, the excess is a sign the project's constraints belong in a linter rule or a CI check instead.
26
-
27
- ## Contrastive example
28
-
29
- **Bad** (reference fact — cut):
30
- > - The SQL Server database name is `myapp`, lowercase.
31
-
32
- The agent reads the connection string in config. It costs tokens on every load and the agent cannot "break" it.
33
-
34
- **Good** (negative constraint with consequence — keep):
35
- > - Never add a cached column for a value that is derived from another entity; a later edit to the source leaves the cache stale, and nothing in the build catches it.
36
-
37
- The agent could break this without noticing, nothing mechanically enforces it, and the consequence is stated.
38
-
39
- ## Skill template
40
-
41
- Each section holds constraints an agent could break without noticing, not reference facts. "Naming Conventions" does not mean "list how files are named" — it means "name the conventions whose violation is silent and costly." "Build & Deployment" does not mean "list the build commands" — it means "name the build rules a developer could violate without CI catching it." If a section has only reference facts, omit it entirely.
42
-
43
- Write (or update) `.agents/skills/pc-guardrails-project/SKILL.md`:
44
-
45
- ```markdown
46
- ---
47
- name: pc-guardrails-project
48
- description: Project-specific rules and constraints extracted from ARCHITECTURE.md. Load this skill before implementing any change to understand boundaries, conventions, and constraints for this codebase.
49
- license: MIT
50
- ---
51
-
52
- # Project Guardrails
53
-
54
- > Auto-generated by `/make-guardrails`. Regenerate with the same command when architecture or conventions change.
55
-
56
- ## Architecture Constraints
57
- - <rule>
58
- - <rule>
59
-
60
- ## Naming Conventions
61
- - <rule>
62
-
63
- ## Code Style
64
- - <rule>
65
-
66
- ## Testing
67
- - <rule>
68
-
69
- ## Build & Deployment
70
- - <rule>
71
-
72
- ## Data & State
73
- - <rule>
74
-
75
- ## Security
76
- - <rule>
77
-
78
- ## Dependencies
79
- - <rule>
80
-
81
- ## Git Workflow
82
- - <rule>
83
-
84
- <!-- Last updated: <current ISO timestamp> -->
85
- ```
86
-
87
- Only include sections that have real rules. Omit empty sections.
88
-
89
- ## Self-check (before writing the file)
90
-
91
- Re-read the output you are about to write. Then:
92
-
93
- 1. **Count the rules** (every bullet under every section). If there are more than 40, cut from the bottom — rank by what a violation costs and remove the cheapest until you are at or under 40. A rule file past 40 dilutes the ones that matter.
94
-
95
- 2. **Scan for positive phrasing and reference facts.** Cut or rewrite any rule that:
96
- - States what something is named, rather than what must not be named that way and why.
97
- - Lists a port number, a database name, a package version, a SDK version, or a connection string. The agent discovers these by reading config.
98
- - Describes how something works (e.g. "auth uses a smart scheme that forwards to JWT or Cookies"), rather than what must not be done with it.
99
- - Restates a project's tech stack as a list ("Frontend: React 19, Next.js 15, TypeScript…"). That is reference material, not a constraint.
100
-
101
- 3. **Strip anything already enforced by tooling.** Remove a rule if any of these already fails the build on its violation:
102
- - Biome / ESLint / Prettier / Steiger / lint:fsd
103
- - NetArchTest / architecture test projects
104
- - Semgrep / Trivy / TruffleHog / SBOM checks
105
- - Coverage gates (`scripts/check-coverage.mjs`)
106
- - `.editorconfig`, `Directory.Build.props`, NuGet audit gates
107
- - CI workflow steps (`app-ci.yml`, `ci.yml`)
108
- - GitHub branch protection / required checks. If the build catches it, the rule costs tokens and adds nothing. The only exception is a rule whose enforcement is partial or non-obvious (e.g. architecture tests enforce layering but a developer could still import a namespace through reflection or a transitive dependency — that nuance is worth a rule).
109
-
110
- 4. **Strip anything already in `pc-guardrails-generic`.** That skill loads on every request alongside this one. Its rules are: secrets discipline, zero-comment default (WHY not WHAT, 10% ceiling, no auto-generated docstrings), scratch-file location, one-responsibility-per-file, minimal-test discipline (one regression test per bug, no framework/library tests, no integration/e2e/snapshot unless asked, no mock-assertion of third-party calls), and the engineer workflow. Do not restate any of them here.
111
-
112
- 5. **Re-count after cutting.** If you are still over 40, you are writing reference material, not constraints. Cut harder.
1
+ # Guardrails category reference
2
+
3
+ From the documents and code graph analysis, extract the rules an agent could break without noticing. Only include a category if you found real evidence for it.
4
+
5
+ - Architecture constraints: layer boundaries, module dependencies, forbidden imports, directory ownership rules (e.g. "src/api/ must not import from src/ui/"). Verify actual import boundaries with the project-selected analysis tools.
6
+ - File organization: the god-files and dumping-ground constants this project has already accumulated, named. The general principle is in `pc-guardrails-generic`; what belongs here is where this codebase keeps breaking it.
7
+ - Naming conventions: file naming, component naming, API route conventions, branch naming
8
+ - Code style: formatter config, lint rules, import ordering, max line length. Derive from actual config files.
9
+ - Testing rules: test file locations, naming, coverage gates, what must be tested before merge
10
+ - Build & deployment: build commands, env requirements, deployment targets, CI gates
11
+ - Data & state: migration rules, schema change process, state management patterns
12
+ - Security: auth boundaries, input validation requirements, secrets handling
13
+ - Dependencies: package manager, lockfile rules, upgrade policy, forbidden packages
14
+ - Git workflow: branch naming, commit message format, PR process (platform-specific from `harness.json`)
15
+ - Domain-specific rules: anything in `openspec/config.yaml` context or `ARCHITECTURE.md` constraints/risks sections
16
+
17
+ Each rule must be:
18
+
19
+ - **Negative.** State the boundary and what breaks when it is crossed, not the behaviour you want: `Never import Microsoft.EntityFrameworkCore.* in Application; it is a layer violation and the build does not catch it`, not `Keep Application framework-free`. A prohibition removes an option; a preference competes with everything else the model knows about writing code, and loses.
20
+ - **Concrete**: "Use `pnpm` not `npm`" not "Use the right package manager".
21
+ - **Evidence-based**: derived from the files and code graph you analyzed. Never invent a rule the project does not state or demonstrate somewhere.
22
+ - **Not enforced elsewhere.** Skip anything the formatter, linter, type checker, test suite, CI gate or a harness plugin already fails the build on. A rule restating `biome.json` is read on every load and changes nothing: the build was going to catch it. Write the rules that nothing but a careful reader would catch.
23
+ - **Not already in `pc-guardrails-generic`.** That skill loads alongside this one, every request. Secrets, zero-comment default, scratch-file location, one-responsibility-per-file, minimal-test discipline, and the engineer workflow are its rules, not this file's.
24
+
25
+ **At most 40 rules, across all categories.** Rank by what a violation costs and cut from the bottom; a category with nothing consequential in it gets no rules at all. This cap is the point of the exercise, not tidiness: compliance falls away as a rule file grows, so the 41st rule does not just cost its own tokens, it dilutes the 40 that matter. If more than 40 survive every bar above, the excess is a sign the project's constraints belong in a linter rule or a CI check instead.
26
+
27
+ ## Contrastive example
28
+
29
+ **Bad** (reference fact — cut):
30
+ > - The SQL Server database name is `myapp`, lowercase.
31
+
32
+ The agent reads the connection string in config. It costs tokens on every load and the agent cannot "break" it.
33
+
34
+ **Good** (negative constraint with consequence — keep):
35
+ > - Never add a cached column for a value that is derived from another entity; a later edit to the source leaves the cache stale, and nothing in the build catches it.
36
+
37
+ The agent could break this without noticing, nothing mechanically enforces it, and the consequence is stated.
38
+
39
+ ## Skill template
40
+
41
+ Each section holds constraints an agent could break without noticing, not reference facts. "Naming Conventions" does not mean "list how files are named" — it means "name the conventions whose violation is silent and costly." "Build & Deployment" does not mean "list the build commands" — it means "name the build rules a developer could violate without CI catching it." If a section has only reference facts, omit it entirely.
42
+
43
+ Write (or update) `.agents/skills/pc-guardrails-project/SKILL.md`:
44
+
45
+ ```markdown
46
+ ---
47
+ name: pc-guardrails-project
48
+ description: Project-specific rules and constraints extracted from ARCHITECTURE.md. Load this skill before implementing any change to understand boundaries, conventions, and constraints for this codebase.
49
+ license: MIT
50
+ ---
51
+
52
+ # Project Guardrails
53
+
54
+ > Auto-generated by `/make-guardrails`. Regenerate with the same command when architecture or conventions change.
55
+
56
+ ## Architecture Constraints
57
+ - <rule>
58
+ - <rule>
59
+
60
+ ## Naming Conventions
61
+ - <rule>
62
+
63
+ ## Code Style
64
+ - <rule>
65
+
66
+ ## Testing
67
+ - <rule>
68
+
69
+ ## Build & Deployment
70
+ - <rule>
71
+
72
+ ## Data & State
73
+ - <rule>
74
+
75
+ ## Security
76
+ - <rule>
77
+
78
+ ## Dependencies
79
+ - <rule>
80
+
81
+ ## Git Workflow
82
+ - <rule>
83
+
84
+ <!-- Last updated: <current ISO timestamp> -->
85
+ ```
86
+
87
+ Only include sections that have real rules. Omit empty sections.
88
+
89
+ ## Self-check (before writing the file)
90
+
91
+ Re-read the output you are about to write. Then:
92
+
93
+ 1. **Count the rules** (every bullet under every section). If there are more than 40, cut from the bottom — rank by what a violation costs and remove the cheapest until you are at or under 40. A rule file past 40 dilutes the ones that matter.
94
+
95
+ 2. **Scan for positive phrasing and reference facts.** Cut or rewrite any rule that:
96
+ - States what something is named, rather than what must not be named that way and why.
97
+ - Lists a port number, a database name, a package version, a SDK version, or a connection string. The agent discovers these by reading config.
98
+ - Describes how something works (e.g. "auth uses a smart scheme that forwards to JWT or Cookies"), rather than what must not be done with it.
99
+ - Restates a project's tech stack as a list ("Frontend: React 19, Next.js 15, TypeScript…"). That is reference material, not a constraint.
100
+
101
+ 3. **Strip anything already enforced by tooling.** Remove a rule if any of these already fails the build on its violation:
102
+ - Biome / ESLint / Prettier / Steiger / lint:fsd
103
+ - NetArchTest / architecture test projects
104
+ - Semgrep / Trivy / TruffleHog / SBOM checks
105
+ - Coverage gates (`scripts/check-coverage.mjs`)
106
+ - `.editorconfig`, `Directory.Build.props`, NuGet audit gates
107
+ - CI workflow steps (`app-ci.yml`, `ci.yml`)
108
+ - GitHub branch protection / required checks. If the build catches it, the rule costs tokens and adds nothing. The only exception is a rule whose enforcement is partial or non-obvious (e.g. architecture tests enforce layering but a developer could still import a namespace through reflection or a transitive dependency — that nuance is worth a rule).
109
+
110
+ 4. **Strip anything already in `pc-guardrails-generic`.** That skill loads on every request alongside this one. Its rules are: secrets discipline, zero-comment default (WHY not WHAT, 10% ceiling, no auto-generated docstrings), scratch-file location, one-responsibility-per-file, minimal-test discipline (one regression test per bug, no framework/library tests, no integration/e2e/snapshot unless asked, no mock-assertion of third-party calls), and the engineer workflow. Do not restate any of them here.
111
+
112
+ 5. **Re-count after cutting.** If you are still over 40, you are writing reference material, not constraints. Cut harder.
@@ -1,70 +1,70 @@
1
- ---
2
- name: pc-make-merge-risk-assess
3
- description: Generate or update the pc-merge-risk-assess skill from project guardrails and architecture. Produces a PR-level risk assessment that loop recipes can gate automerge on. Invoked by the /make-merge-risk-assess command and the repo-initialize flow.
4
- license: MIT
5
- ---
6
-
7
- # Make Merge Risk Assess
8
-
9
- Analyze `ARCHITECTURE.md`, the project guardrails skill, and other project files to generate or update an `pc-merge-risk-assess` skill: a checklist of risk indicators that an AI agent evaluates before auto-merging a pull request. When any indicator matches, the agent blocks automerge and leaves the PR for human review with an explanation.
10
-
11
- ## Steps
12
-
13
- 1. **Check current state**
14
-
15
- Read `.agents/skills/pc-merge-risk-assess/SKILL.md`. Determine which mode to use:
16
- - Does not exist: Generate mode. Create from scratch.
17
- - Exists and has a `<!-- Last updated:` footer: Update mode. Incrementally update.
18
- - Exists but no timestamp: proceed in Generate mode (full regeneration).
19
-
20
- 2a. **Generate mode: read source documents**
21
-
22
- Read ALL of the following that exist:
23
- - `.agents/skills/pc-guardrails-project/SKILL.md` (primary source — project-specific constraints)
24
- - `.agents/skills/pc-guardrails-generic/SKILL.md` (generic safety rules)
25
- - `ARCHITECTURE.md` (architecture boundaries, critical paths)
26
- - `AGENTS.md` (non-negotiable constraints, verification rules)
27
- - `.opencode/harness.json` (platform, concurrency)
28
- - CI/CD workflows: `.github/workflows/*`, `azure-pipelines.yml`: whatever exists
29
- - Loop recipes: `.loops/recipes/*-loop.yaml` (understand the automerge flow)
30
-
31
- Use file tools to discover risk-critical code paths: `grep` for calculation engines, audit appenders, auth middleware, schema migrations, permission checks, and other sensitive areas.
32
-
33
- 2b. **Update mode: incremental analysis**
34
-
35
- Extract the `<!-- Last updated: <ISO date> -->` timestamp from the existing skill file. Then:
36
- - Read `.agents/skills/pc-guardrails-project/SKILL.md` and check its `<!-- Last updated:` timestamp. If the guardrails haven't changed and ARCHITECTURE.md hasn't changed since the risk skill was last generated, report "Merge risk assessment up to date" and stop.
37
- - Run `git log --oneline --since="<date>" -- <relevant config and architecture files>` to find what changed.
38
- - If nothing changed: report "Merge risk assessment up to date" and stop.
39
- - Update only the affected risk categories. Preserve manually-added risk indicators in unchanged categories.
40
- - If changes are pervasive, fall back to Generate mode.
41
-
42
- 3. **Extract risk indicators**
43
-
44
- From the documents and code analysis, extract concrete, testable risk indicators. Follow the [category reference](category-reference.md) for the full list of categories, indicator quality standards, and the skill file template.
45
-
46
- Each risk indicator must identify a code path or change pattern that, when touched, makes a PR too dangerous to auto-merge. The indicator must be something an AI agent can detect by reading the PR diff.
47
-
48
- 4. **Write the skill**
49
-
50
- Write (or update) `.agents/skills/pc-merge-risk-assess/SKILL.md` using the template from the [category reference](category-reference.md). Only include sections that have real indicators. Omit empty sections.
51
-
52
- 5. **Update agents**
53
-
54
- For every `*-engineer.md` in `.opencode/agents/`, add `@pc-merge-risk-assess` to the Agent Workflow ability group (skip if already present). This ensures every engineer can evaluate risk before merge. Use this pattern:
55
- ```markdown
56
- ## Abilities
57
- - Guardrails: @pc-guardrails-generic, @pc-guardrails-project[, ...existing entries unchanged]
58
- ...
59
- - Development, Agent Workflow: @pc-merge-risk-assess[, ...existing entries unchanged]
60
- ```
61
-
62
- If no "Development, Agent Workflow" line exists, create it. Exclude tier variant files (`*-engineer.build.md`, `*-engineer.fast.md`, `*-engineer.plan.md`): they are generated copies; only update the base templates.
63
-
64
- 6. **Report**
65
-
66
- Tell the user:
67
- - Whether the skill was generated or updated (and which categories changed)
68
- - Number of risk indicators extracted per category
69
- - Number of agent files updated
70
- - Tip: "Rerun `/make-merge-risk-assess` any time the architecture or project guardrails change significantly."
1
+ ---
2
+ name: pc-make-merge-risk-assess
3
+ description: Generate or update the pc-merge-risk-assess skill from project guardrails and architecture. Produces a PR-level risk assessment that loop recipes can gate automerge on. Invoked by the /make-merge-risk-assess command and the repo-initialize flow.
4
+ license: MIT
5
+ ---
6
+
7
+ # Make Merge Risk Assess
8
+
9
+ Analyze `ARCHITECTURE.md`, the project guardrails skill, and other project files to generate or update an `pc-merge-risk-assess` skill: a checklist of risk indicators that an AI agent evaluates before auto-merging a pull request. When any indicator matches, the agent blocks automerge and leaves the PR for human review with an explanation.
10
+
11
+ ## Steps
12
+
13
+ 1. **Check current state**
14
+
15
+ Read `.agents/skills/pc-merge-risk-assess/SKILL.md`. Determine which mode to use:
16
+ - Does not exist: Generate mode. Create from scratch.
17
+ - Exists and has a `<!-- Last updated:` footer: Update mode. Incrementally update.
18
+ - Exists but no timestamp: proceed in Generate mode (full regeneration).
19
+
20
+ 2a. **Generate mode: read source documents**
21
+
22
+ Read ALL of the following that exist:
23
+ - `.agents/skills/pc-guardrails-project/SKILL.md` (primary source — project-specific constraints)
24
+ - `.agents/skills/pc-guardrails-generic/SKILL.md` (generic safety rules)
25
+ - `ARCHITECTURE.md` (architecture boundaries, critical paths)
26
+ - `AGENTS.md` (non-negotiable constraints, verification rules)
27
+ - `.opencode/harness.json` (platform, concurrency)
28
+ - CI/CD workflows: `.github/workflows/*`, `azure-pipelines.yml`: whatever exists
29
+ - Loop recipes: `.loops/recipes/*-loop.yaml` (understand the automerge flow)
30
+
31
+ Use file tools to discover risk-critical code paths: `grep` for calculation engines, audit appenders, auth middleware, schema migrations, permission checks, and other sensitive areas.
32
+
33
+ 2b. **Update mode: incremental analysis**
34
+
35
+ Extract the `<!-- Last updated: <ISO date> -->` timestamp from the existing skill file. Then:
36
+ - Read `.agents/skills/pc-guardrails-project/SKILL.md` and check its `<!-- Last updated:` timestamp. If the guardrails haven't changed and ARCHITECTURE.md hasn't changed since the risk skill was last generated, report "Merge risk assessment up to date" and stop.
37
+ - Run `git log --oneline --since="<date>" -- <relevant config and architecture files>` to find what changed.
38
+ - If nothing changed: report "Merge risk assessment up to date" and stop.
39
+ - Update only the affected risk categories. Preserve manually-added risk indicators in unchanged categories.
40
+ - If changes are pervasive, fall back to Generate mode.
41
+
42
+ 3. **Extract risk indicators**
43
+
44
+ From the documents and code analysis, extract concrete, testable risk indicators. Follow the [category reference](category-reference.md) for the full list of categories, indicator quality standards, and the skill file template.
45
+
46
+ Each risk indicator must identify a code path or change pattern that, when touched, makes a PR too dangerous to auto-merge. The indicator must be something an AI agent can detect by reading the PR diff.
47
+
48
+ 4. **Write the skill**
49
+
50
+ Write (or update) `.agents/skills/pc-merge-risk-assess/SKILL.md` using the template from the [category reference](category-reference.md). Only include sections that have real indicators. Omit empty sections.
51
+
52
+ 5. **Update agents**
53
+
54
+ For every `*-engineer.md` in `.opencode/agents/`, add `@pc-merge-risk-assess` to the Agent Workflow ability group (skip if already present). This ensures every engineer can evaluate risk before merge. Use this pattern:
55
+ ```markdown
56
+ ## Abilities
57
+ - Guardrails: @pc-guardrails-generic, @pc-guardrails-project[, ...existing entries unchanged]
58
+ ...
59
+ - Development, Agent Workflow: @pc-merge-risk-assess[, ...existing entries unchanged]
60
+ ```
61
+
62
+ If no "Development, Agent Workflow" line exists, create it. Exclude tier variant files (`*-engineer.build.md`, `*-engineer.fast.md`, `*-engineer.plan.md`): they are generated copies; only update the base templates.
63
+
64
+ 6. **Report**
65
+
66
+ Tell the user:
67
+ - Whether the skill was generated or updated (and which categories changed)
68
+ - Number of risk indicators extracted per category
69
+ - Number of agent files updated
70
+ - Tip: "Rerun `/make-merge-risk-assess` any time the architecture or project guardrails change significantly."