@plainconceptsplatform/agent-harness 3.1.1 → 3.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.
Files changed (87) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +24 -4
  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/models/format.js +88 -88
  27. package/cli/steps/models/index.js +64 -64
  28. package/cli/steps/openspec/index.js +136 -136
  29. package/cli/steps/optimization/codegraph.js +141 -127
  30. package/cli/steps/optimization/detect.js +66 -66
  31. package/cli/steps/optimization/humanizer.js +17 -17
  32. package/cli/steps/optimization/index.js +158 -158
  33. package/cli/steps/optimization/memory.js +91 -88
  34. package/cli/steps/optimization/patch-guardrails.js +111 -111
  35. package/cli/steps/optimization/simple-english.js +17 -17
  36. package/cli/steps/optimization/skills-lock.js +30 -30
  37. package/cli/steps/platform/index.js +109 -109
  38. package/cli/steps/source/index.js +123 -123
  39. package/cli/utils/agent-color.js +111 -111
  40. package/cli/utils/copy.js +134 -131
  41. package/cli/utils/exec-spinner.js +47 -47
  42. package/cli/utils/exec.js +134 -134
  43. package/cli/utils/legacy-check.js +30 -30
  44. package/cli/utils/models-cache.js +58 -58
  45. package/cli/utils/models-pricing.js +42 -42
  46. package/cli/utils/process.js +3 -3
  47. package/cli/utils/terminal.js +6 -6
  48. package/cli/utils/update-manifest.js +75 -75
  49. package/harness/.opencode/commands/ops-backlog.md +10 -10
  50. package/harness/.opencode/commands/ops-review.md +8 -8
  51. package/harness/.opencode/commands/ops-ship.md +9 -9
  52. package/harness/.opencode/commands/plan-archive.md +5 -5
  53. package/harness/.opencode/commands/plan-explore.md +9 -9
  54. package/harness/.opencode/commands/plan-propose.md +9 -9
  55. package/harness/.opencode/commands/repo-help.md +5 -5
  56. package/harness/.opencode/package.json +5 -5
  57. package/harness/.opencode/plugins/pc-subagent-monitor.js +184 -184
  58. package/harness/.opencode/plugins/pc-subagent-tiers.js +354 -354
  59. package/harness/.opencode/plugins/pc-system-reminders.js +386 -386
  60. package/harness/.opencode/scripts/check-diff.mjs +244 -0
  61. package/harness/.opencode/scripts/code-rules.mjs +288 -0
  62. package/harness/ARCHITECTURE.md +13 -13
  63. package/harness/DESIGN.md +13 -13
  64. package/harness/opencode.jsonc +36 -36
  65. package/harness/openspec/config.yaml +20 -20
  66. package/harness/skills-lock.json +17 -17
  67. package/package.json +14 -12
  68. package/skills/agent-harness-cli/SKILL.md +86 -86
  69. package/skills/pc-guardrails-generic/SKILL.md +2 -1
  70. package/skills/pc-guardrails-project/SKILL.md +8 -8
  71. package/skills/pc-make-architecture/structure-template.md +64 -64
  72. package/skills/pc-make-engineer/SKILL.md +59 -59
  73. package/skills/pc-make-engineer/template.md +36 -36
  74. package/skills/pc-make-guardrails/category-reference.md +112 -112
  75. package/skills/pc-make-merge-risk-assess/SKILL.md +70 -70
  76. package/skills/pc-make-merge-risk-assess/category-reference.md +114 -114
  77. package/skills/pc-ops-ship/SKILL.md +22 -18
  78. package/skills/pc-plan-apply/SKILL.md +86 -86
  79. package/skills/pc-plan-apply/simple-mode.md +1 -1
  80. package/skills/pc-plan-explore/SKILL.md +21 -21
  81. package/skills/pc-plan-goal/SKILL.md +91 -91
  82. package/skills/pc-plan-goal/failure-policy.md +30 -30
  83. package/skills/pc-plan-goal/output-mode.md +10 -10
  84. package/skills/pc-plan-propose/SKILL.md +125 -125
  85. package/skills/pc-plan-propose/task-annotation.md +39 -39
  86. package/skills/pc-plan-quick/SKILL.md +1 -1
  87. package/skills/pc-repo-audit/SKILL.md +44 -44
@@ -1,20 +1,20 @@
1
- schema: spec-driven
2
-
3
- # Project context (optional)
4
- # This is shown to AI when creating artifacts.
5
- # Add your tech stack, conventions, style guides, domain knowledge, etc.
6
- # Example:
7
- # context: |
8
- # Tech stack: TypeScript, React, Node.js
9
- # We use conventional commits
10
- # Domain: e-commerce platform
11
-
12
- # Per-artifact rules (optional)
13
- # Add custom rules for specific artifacts.
14
- # Example:
15
- # rules:
16
- # proposal:
17
- # - Keep proposals under 500 words
18
- # - Always include a "Non-goals" section
19
- # tasks:
20
- # - Break tasks into chunks of max 2 hours
1
+ schema: spec-driven
2
+
3
+ # Project context (optional)
4
+ # This is shown to AI when creating artifacts.
5
+ # Add your tech stack, conventions, style guides, domain knowledge, etc.
6
+ # Example:
7
+ # context: |
8
+ # Tech stack: TypeScript, React, Node.js
9
+ # We use conventional commits
10
+ # Domain: e-commerce platform
11
+
12
+ # Per-artifact rules (optional)
13
+ # Add custom rules for specific artifacts.
14
+ # Example:
15
+ # rules:
16
+ # proposal:
17
+ # - Keep proposals under 500 words
18
+ # - Always include a "Non-goals" section
19
+ # tasks:
20
+ # - Break tasks into chunks of max 2 hours
@@ -1,17 +1,17 @@
1
- {
2
- "version": 1,
3
- "skills": {
4
- "find-skills": {
5
- "source": "vercel-labs/skills",
6
- "sourceType": "github",
7
- "skillPath": "skills/find-skills/SKILL.md",
8
- "computedHash": "781bd6d3f9b19f8c9af6b53d8d0e4876d0183841b565db34ca7092ffa412d111"
9
- },
10
- "user-story": {
11
- "source": "deanpeters/product-manager-skills",
12
- "sourceType": "github",
13
- "skillPath": "skills/user-story/SKILL.md",
14
- "computedHash": "user-story-placeholder"
15
- }
16
- }
17
- }
1
+ {
2
+ "version": 1,
3
+ "skills": {
4
+ "find-skills": {
5
+ "source": "vercel-labs/skills",
6
+ "sourceType": "github",
7
+ "skillPath": "skills/find-skills/SKILL.md",
8
+ "computedHash": "781bd6d3f9b19f8c9af6b53d8d0e4876d0183841b565db34ca7092ffa412d111"
9
+ },
10
+ "user-story": {
11
+ "source": "deanpeters/product-manager-skills",
12
+ "sourceType": "github",
13
+ "skillPath": "skills/user-story/SKILL.md",
14
+ "computedHash": "user-story-placeholder"
15
+ }
16
+ }
17
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plainconceptsplatform/agent-harness",
3
- "version": "3.1.1",
3
+ "version": "3.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",
@@ -42,6 +42,7 @@
42
42
  "engines": {
43
43
  "node": ">=18"
44
44
  },
45
+ "packageManager": "pnpm@11.10.0",
45
46
  "dependencies": {
46
47
  "@inquirer/prompts": "^7.0.0",
47
48
  "chalk": "^5.0.0",
@@ -50,16 +51,6 @@
50
51
  "jsonc-parser": "^3.3.1",
51
52
  "ora": "^8.0.0"
52
53
  },
53
- "devDependencies": {
54
- "@eslint/js": "^9.0.0",
55
- "eslint": "^9.0.0",
56
- "globals": "^15.0.0",
57
- "markdownlint-cli2": "0.23.2",
58
- "vitest": "^4.1.5"
59
- },
60
- "vitest": {
61
- "environment": "node"
62
- },
63
54
  "scripts": {
64
55
  "lint": "eslint .",
65
56
  "lint:fix": "eslint . --fix",
@@ -67,7 +58,18 @@
67
58
  "lint:md:fix": "markdownlint-cli2 --fix \"**/*.md\"",
68
59
  "test": "vitest run",
69
60
  "test:watch": "vitest",
61
+ "prepublishOnly": "npm run lint && npm run lint:md && npm run test",
70
62
  "release:dry": "pnpm publish --dry-run --no-git-checks --access public",
71
63
  "release": "pnpm publish --no-git-checks --access public"
64
+ },
65
+ "devDependencies": {
66
+ "@eslint/js": "^9.0.0",
67
+ "eslint": "^9.0.0",
68
+ "globals": "^15.0.0",
69
+ "markdownlint-cli2": "0.23.2",
70
+ "vitest": "^4.1.5"
71
+ },
72
+ "vitest": {
73
+ "environment": "node"
72
74
  }
73
- }
75
+ }
@@ -1,86 +1,86 @@
1
- ---
2
- name: agent-harness-cli
3
- description: Drive the agent-harness CLI - install the Plain Concepts Platform Harness into a repository, bring an existing one up to date, set up a teammate's machine, or rerun a single step. Load when asked to install, update, or repair the Platform Harness, when a repo needs AI/agent scaffolding set up, or when a command like `npx @plainconceptsplatform/agent-harness` fails and needs diagnosing.
4
- license: MIT
5
- ---
6
-
7
- # agent-harness CLI
8
-
9
- `agent-harness` installs the **Plain Concepts Platform Harness** into a repository and keeps it up to date. The harness is Plain Concepts' own, and it is the set of files agents work from: slash commands, `pc-*` skills (the `pc-` is Plain Concepts), an agent team, OpenCode plugins, an OpenSpec workspace, and generated `ARCHITECTURE.md` and `DESIGN.md`.
10
-
11
- Everything runs against the **current working directory**. `cd` into the target repository first; there is no `--path` flag.
12
-
13
- ## Pick the right verb
14
-
15
- Read the repo before running anything. `.opencode/harness.json` is the marker for "harness already installed".
16
-
17
- | Situation | Command |
18
- | --- | --- |
19
- | No `.opencode/harness.json` | `npx @plainconceptsplatform/agent-harness@latest` (the install wizard) |
20
- | Harness present, want the latest release's files | `npx @plainconceptsplatform/agent-harness@latest update` |
21
- | Harness present, new machine or new teammate | `npx @plainconceptsplatform/agent-harness join` |
22
- | One specific thing needs redoing | a single step command, see below |
23
-
24
- Requires Node.js 18+.
25
-
26
- ## The install wizard is interactive
27
-
28
- The wizard asks about source scope, backlog and repository platform, three models, and optional token-optimization tools. **Do not run it in a non-interactive shell.** It will hang or abort. If you cannot present prompts to a human, say so and hand the command to the user rather than trying to drive it.
29
-
30
- Everything else (`update`, and the single-step commands other than `platform`, `models`, `optimization`) runs without prompts.
31
-
32
- ## Single-step commands
33
-
34
- Run one step without the full wizard. Each reuses context from `.opencode/harness.json` when it needs to.
35
-
36
- ```
37
- clean Remove pre-existing AI files (AGENTS.md, .cursorrules, CLAUDE.md, ...)
38
- platform Choose backlog + repository platform
39
- copy Copy agents, skills, commands, docs into the repo
40
- openspec Initialize the OpenSpec workspace
41
- models Choose plan / build / fast models
42
- optimization Configure RTK, quota, Simple English, codegraph, agentmemory, humanizer
43
- browser Install agent-browser (npm package + its Chrome for Testing)
44
- metadata Rewrite .opencode/harness.json
45
- ```
46
-
47
- `metadata` last if you ran several, because it refreshes the config the others read.
48
-
49
- ## What lands in the repo
50
-
51
- ```
52
- .opencode/
53
- harness.json harness config: platform, models, agents.maxConcurrent
54
- harness-managed.json hash per managed file, so update spares your edits
55
- harness.user.json per-developer model override (gitignored)
56
- harness-run.json live subagent wave state (gitignored)
57
- commands/ slash commands
58
- plugins/ pc-subagent-monitor, pc-subagent-tiers, pc-system-reminders
59
- agents/ fullstack-engineer + user-created *-engineer files
60
- .agents/skills/ pc-* skills
61
- AGENTS.md ARCHITECTURE.md DESIGN.md
62
- ```
63
-
64
- After a fresh install, the next move is `/repo-initialize` inside OpenCode. That is what generates real `ARCHITECTURE.md` and `DESIGN.md` and activates the agent team. Installing the harness alone does not do it.
65
-
66
- ## `update` is edit-safe
67
-
68
- `update` compares each managed file against the hash recorded in `.opencode/harness-managed.json`. Files you changed by hand are left alone and reported as preserved. Generated skills (`pc-guardrails-project`, `pc-merge-risk-assess`) are never overwritten once populated. So `update` is safe to run repeatedly, and a second consecutive run should report no changes.
69
-
70
- ## Diagnosing failures
71
-
72
- **"This project was set up by opencode-onboard v1".** The repo has v1 state files or `ob-*` skills. v2 renamed both and does not migrate. Re-onboard on a clean branch; do not try to rename the files by hand, because the marker comments inside the installed skills changed too.
73
-
74
- **"No config found. Run the wizard first."** `update` or a step needs `.opencode/harness.json` and it is absent. Run the wizard.
75
-
76
- **A platform step reports nothing and changes nothing.** Platform content is injected into `<!-- PC-PLATFORM-*-START/END -->` marker pairs. If a marker pair is missing from the target file, injection is skipped silently. Check the markers exist before concluding the step worked.
77
-
78
- **Skills missing after install.** Skill installation ends with `npx skills experimental_install --yes`, run once at the end of the optimization step. If it failed, rerun it directly in the repo.
79
-
80
- **Platform CLI warnings.** The harness expects `gh` (GitHub), `az` + azure-devops extension (Azure DevOps), `acli` (Jira), `glab` (GitLab), each authenticated. These are warnings, not fatal; the harness installs, but the matching `/ops-*` flows will not work until the CLI is present.
81
-
82
- ## Rules
83
-
84
- - Never edit `.opencode/harness.json` by hand to change models. Use `/make-user-model <tier> <model>` inside OpenCode, or the `models` step.
85
- - Never commit `harness.user.json` or `harness-run.json`. Both belong in `.opencode/.gitignore`, which `join` verifies.
86
- - `clean` deletes files. Confirm with the user before running it on a repo that already has AI configuration worth keeping.
1
+ ---
2
+ name: agent-harness-cli
3
+ description: Drive the agent-harness CLI - install the Plain Concepts Platform Harness into a repository, bring an existing one up to date, set up a teammate's machine, or rerun a single step. Load when asked to install, update, or repair the Platform Harness, when a repo needs AI/agent scaffolding set up, or when a command like `npx @plainconceptsplatform/agent-harness` fails and needs diagnosing.
4
+ license: MIT
5
+ ---
6
+
7
+ # agent-harness CLI
8
+
9
+ `agent-harness` installs the **Plain Concepts Platform Harness** into a repository and keeps it up to date. The harness is Plain Concepts' own, and it is the set of files agents work from: slash commands, `pc-*` skills (the `pc-` is Plain Concepts), an agent team, OpenCode plugins, an OpenSpec workspace, and generated `ARCHITECTURE.md` and `DESIGN.md`.
10
+
11
+ Everything runs against the **current working directory**. `cd` into the target repository first; there is no `--path` flag.
12
+
13
+ ## Pick the right verb
14
+
15
+ Read the repo before running anything. `.opencode/harness.json` is the marker for "harness already installed".
16
+
17
+ | Situation | Command |
18
+ | --- | --- |
19
+ | No `.opencode/harness.json` | `npx @plainconceptsplatform/agent-harness@latest` (the install wizard) |
20
+ | Harness present, want the latest release's files | `npx @plainconceptsplatform/agent-harness@latest update` |
21
+ | Harness present, new machine or new teammate | `npx @plainconceptsplatform/agent-harness join` |
22
+ | One specific thing needs redoing | a single step command, see below |
23
+
24
+ Requires Node.js 18+.
25
+
26
+ ## The install wizard is interactive
27
+
28
+ The wizard asks about source scope, backlog and repository platform, three models, and optional token-optimization tools. **Do not run it in a non-interactive shell.** It will hang or abort. If you cannot present prompts to a human, say so and hand the command to the user rather than trying to drive it.
29
+
30
+ Everything else (`update`, and the single-step commands other than `platform`, `models`, `optimization`) runs without prompts.
31
+
32
+ ## Single-step commands
33
+
34
+ Run one step without the full wizard. Each reuses context from `.opencode/harness.json` when it needs to.
35
+
36
+ ```
37
+ clean Remove pre-existing AI files (AGENTS.md, .cursorrules, CLAUDE.md, ...)
38
+ platform Choose backlog + repository platform
39
+ copy Copy agents, skills, commands, docs into the repo
40
+ openspec Initialize the OpenSpec workspace
41
+ models Choose plan / build / fast models
42
+ optimization Configure RTK, quota, Simple English, codegraph, agentmemory, humanizer
43
+ browser Install agent-browser (npm package + its Chrome for Testing)
44
+ metadata Rewrite .opencode/harness.json
45
+ ```
46
+
47
+ `metadata` last if you ran several, because it refreshes the config the others read.
48
+
49
+ ## What lands in the repo
50
+
51
+ ```
52
+ .opencode/
53
+ harness.json harness config: platform, models, agents.maxConcurrent
54
+ harness-managed.json hash per managed file, so update spares your edits
55
+ harness.user.json per-developer model override (gitignored)
56
+ harness-run.json live subagent wave state (gitignored)
57
+ commands/ slash commands
58
+ plugins/ pc-subagent-monitor, pc-subagent-tiers, pc-system-reminders
59
+ agents/ fullstack-engineer + user-created *-engineer files
60
+ .agents/skills/ pc-* skills
61
+ AGENTS.md ARCHITECTURE.md DESIGN.md
62
+ ```
63
+
64
+ After a fresh install, the next move is `/repo-initialize` inside OpenCode. That is what generates real `ARCHITECTURE.md` and `DESIGN.md` and activates the agent team. Installing the harness alone does not do it.
65
+
66
+ ## `update` is edit-safe
67
+
68
+ `update` compares each managed file against the hash recorded in `.opencode/harness-managed.json`. Files you changed by hand are left alone and reported as preserved. Generated skills (`pc-guardrails-project`, `pc-merge-risk-assess`) are never overwritten once populated. So `update` is safe to run repeatedly, and a second consecutive run should report no changes.
69
+
70
+ ## Diagnosing failures
71
+
72
+ **"This project was set up by opencode-onboard v1".** The repo has v1 state files or `ob-*` skills. v2 renamed both and does not migrate. Re-onboard on a clean branch; do not try to rename the files by hand, because the marker comments inside the installed skills changed too.
73
+
74
+ **"No config found. Run the wizard first."** `update` or a step needs `.opencode/harness.json` and it is absent. Run the wizard.
75
+
76
+ **A platform step reports nothing and changes nothing.** Platform content is injected into `<!-- PC-PLATFORM-*-START/END -->` marker pairs. If a marker pair is missing from the target file, injection is skipped silently. Check the markers exist before concluding the step worked.
77
+
78
+ **Skills missing after install.** Skill installation ends with `npx skills experimental_install --yes`, run once at the end of the optimization step. If it failed, rerun it directly in the repo.
79
+
80
+ **Platform CLI warnings.** The harness expects `gh` (GitHub), `az` + azure-devops extension (Azure DevOps), `acli` (Jira), `glab` (GitLab), each authenticated. These are warnings, not fatal; the harness installs, but the matching `/ops-*` flows will not work until the CLI is present.
81
+
82
+ ## Rules
83
+
84
+ - Never edit `.opencode/harness.json` by hand to change models. Use `/make-user-model <tier> <model>` inside OpenCode, or the `models` step.
85
+ - Never commit `harness.user.json` or `harness-run.json`. Both belong in `.opencode/.gitignore`, which `join` verifies.
86
+ - `clean` deletes files. Confirm with the user before running it on a repo that already has AI configuration worth keeping.
@@ -15,7 +15,7 @@ The marker sections below name the optimization skills this project selected. Lo
15
15
 
16
16
  ## Code
17
17
 
18
- - The default is zero comments. Add one only where the code is genuinely non-obvious. Past 10% comment-to-code ratio, refactor for clarity. Never add comments that restate the code, label variables, TODOs without a linked issue, commented-out code, separator banners, or auto-generated docstrings/JSDoc/XML docs unless explicitly asked.
18
+ - Zero comments by default. Write one only for what the code cannot show and we do not control: a vendor bug, an external contract, a legal rule. Leave every file you touch with no comment slop, old or new.
19
19
  - Never add a file that collects unrelated things — `constants.js`, `types.ts`, `utils.ts`. One responsibility per file, split by domain. A file importing from many unrelated modules is already the symptom.
20
20
 
21
21
  ## Temporary files
@@ -28,6 +28,7 @@ The marker sections below name the optimization skills this project selected. Lo
28
28
  - Never write more tests than the change requires. A bug fix gets one regression test. A new function gets tests for its public contract, not every internal branch. Never aim for a coverage number.
29
29
  - Never test framework or library internals. Test your code's contract, not that EF Core saves a tracked entity.
30
30
  - Never generate integration, e2e, or snapshot tests unless explicitly asked. Mock nothing you do not own — use a fake that records state. Never add a test that duplicates a type-check or linter rule.
31
+ - `node .opencode/scripts/check-diff.mjs` enforces the comment and test rules on the diff and must exit 0.
31
32
 
32
33
  <!-- PC-GUARDRAILS-RTK-START -->
33
34
  <!-- PC-GUARDRAILS-RTK-END -->
@@ -1,8 +1,8 @@
1
- ---
2
- name: pc-guardrails-project
3
- description: Project-specific guardrails extracted from ARCHITECTURE.md and project config files. Populated by /make-guardrails. Load this skill before implementing any change to understand boundaries, conventions, and constraints for this codebase.
4
- license: MIT
5
- ---
6
-
7
- <!-- This skill is a placeholder until /make-guardrails is run. -->
8
- <!-- /make-guardrails will populate this file with project-specific rules. -->
1
+ ---
2
+ name: pc-guardrails-project
3
+ description: Project-specific guardrails extracted from ARCHITECTURE.md and project config files. Populated by /make-guardrails. Load this skill before implementing any change to understand boundaries, conventions, and constraints for this codebase.
4
+ license: MIT
5
+ ---
6
+
7
+ <!-- This skill is a placeholder until /make-guardrails is run. -->
8
+ <!-- /make-guardrails will populate this file with project-specific rules. -->
@@ -1,64 +1,64 @@
1
- # ARCHITECTURE.md structure template
2
-
3
- Write (or update) `ARCHITECTURE.md` following this structure. Only include sections relevant to the project; omit sections with no evidence.
4
-
5
- - Architecture Overview: what the system is, what problem it solves, major architectural style
6
- - 1. Project Structure: annotated directory tree with purpose of each major directory
7
- - 2. High-Level System Diagram: Mermaid diagram of actors, services, data stores, external systems
8
- - 3. Core Components: each major component: name, responsibility, key files, technologies, inputs/outputs
9
- - 3.1 Frontend / User Interface (if present)
10
- - 3.2 Backend / Server / API (if present)
11
- - 3.3 Shared Libraries / Common Code (if present)
12
- - 3.4 CLI / Scripts / Automation (if present)
13
- - 4. Data Flow: request lifecycle, key user journeys, sequence diagram for main runtime flow
14
- - 5. Data Stores: all persistent storage: type, purpose, schemas, migration approach
15
- - 6. External Integrations / APIs: each integration: method, config location, auth, failure behavior
16
- - 7. Key Technologies: full stack summary with architectural relevance of each
17
- - 8. Deployment & Infrastructure: build artifacts, env config, containerization, CI/CD, hosting
18
- - 9. Security Architecture: auth, authz, secrets, input validation, trust boundaries
19
- - 10. Monitoring & Observability: logging, metrics, tracing, error reporting
20
- - 11. Performance & Scalability: caching, batching, concurrency, known bottlenecks
21
- - 12. Development Workflow: local setup, install/dev/test/build/lint commands
22
- - 13. Testing Strategy: test frameworks, locations, coverage gates, gaps
23
- - 14. Architectural Decisions & Rationale: key choices with evidence and tradeoffs
24
- - 15. Constraints, Risks, and Technical Debt: tight coupling, TODOs, operational risks
25
- - 16. Future Considerations: documented roadmap + reasonable recommendations (labeled as such)
26
- - 17. Project Identification: name, language, type, runtime, date of review, maintainer
27
- - 18. Glossary / Acronyms: project-specific terms an agent or new developer needs to know
28
-
29
- Append at the very end of the file:
30
- ```
31
- <!-- Last updated: <current ISO timestamp> -->
32
- ```
33
-
34
- Rules:
35
- - Be specific and concrete: include actual directories, files, modules, commands.
36
- - Mark anything undiscoverable as "Not evident from the repository".
37
- - Use Mermaid diagrams where helpful.
38
- - Write as if this document will be committed and maintained over time.
39
-
40
- ## Writing rules
41
-
42
- These rules govern the voice and shape of every section. The ARCHITECTURE.md is the primary artifact an agent reads to understand the system's invariants — it must teach constraints, not just inventory structure. These are enforced by re-reading each section after generation (see the self-check in the skill).
43
-
44
- 1. **Every section must answer "what breaks if this is violated," not just "what exists."** A section that only describes structure without stating the constraint it protects and the consequence of crossing it is reference material, not architecture. "The system has four modules" is structure; "Modules must not cross-reference each other in Domain or Application, and flow goes through port interfaces or domain events" is a constraint.
45
-
46
- 2. **Architectural decisions must carry their rationale and what they superseded.** A decision table row that says "Adopt X" is a fact; "Adopt X because Y, supersedes decision Z which assumed W" is a constraint that teaches an agent why a change would be wrong. If a decision was reached after rejecting an alternative, name the alternative and why it was rejected.
47
-
48
- 3. **State boundaries as prohibitions with consequences.** "Layering is enforced: Api → Application → Domain" is a constraint. "Api → Application → Domain" alone is a dependency list. "Only the Composition namespace in Api reaches Infrastructure" is a constraint; "Api depends on Infrastructure" is a fact. Prefer the constraint form: name the boundary, state who must not cross it, and what breaks when it is crossed.
49
-
50
- 4. **Include what was tried and rejected, not just what was chosen.** The most valuable architecture decisions are the ones where an alternative was tested and found wanting. A section that says "dynamic sessions were rejected because they accept no volumes, cost more at scale, and are blocked by policy" teaches an agent more than "the engine runs as a container app."
51
-
52
- 5. **Narrative over inventory.** Describe how the system behaves, what holds it together, and where the seams are. A reader who understands the constraints can infer the structure; a reader who only sees the structure cannot infer the constraints.
53
-
54
- ## Self-check (before writing the file)
55
-
56
- Re-read every section you are about to write. Then:
57
-
58
- 1. **Identify inventory-only sections.** If a section describes what exists without stating what breaks when its constraints are violated, rewrite it as constraint-embedded prose or cut it.
59
-
60
- 2. **Check decision rows.** Every row in the decisions table must carry its rationale. If a decision has no "why," it is a fact, not a decision — cut it or find the rationale.
61
-
62
- 3. **Scan for bare dependency lists.** "Api depends on Application depends on Domain" is a fact. Rewrite it as: name the boundary, state who must not cross it, and what breaks when it is crossed.
63
-
64
- 4. **Verify rejected alternatives are present where they matter.** If a significant architectural choice was made, the rejected alternative and the reason for rejection should be in the document. An agent that does not know what was rejected will propose it again.
1
+ # ARCHITECTURE.md structure template
2
+
3
+ Write (or update) `ARCHITECTURE.md` following this structure. Only include sections relevant to the project; omit sections with no evidence.
4
+
5
+ - Architecture Overview: what the system is, what problem it solves, major architectural style
6
+ - 1. Project Structure: annotated directory tree with purpose of each major directory
7
+ - 2. High-Level System Diagram: Mermaid diagram of actors, services, data stores, external systems
8
+ - 3. Core Components: each major component: name, responsibility, key files, technologies, inputs/outputs
9
+ - 3.1 Frontend / User Interface (if present)
10
+ - 3.2 Backend / Server / API (if present)
11
+ - 3.3 Shared Libraries / Common Code (if present)
12
+ - 3.4 CLI / Scripts / Automation (if present)
13
+ - 4. Data Flow: request lifecycle, key user journeys, sequence diagram for main runtime flow
14
+ - 5. Data Stores: all persistent storage: type, purpose, schemas, migration approach
15
+ - 6. External Integrations / APIs: each integration: method, config location, auth, failure behavior
16
+ - 7. Key Technologies: full stack summary with architectural relevance of each
17
+ - 8. Deployment & Infrastructure: build artifacts, env config, containerization, CI/CD, hosting
18
+ - 9. Security Architecture: auth, authz, secrets, input validation, trust boundaries
19
+ - 10. Monitoring & Observability: logging, metrics, tracing, error reporting
20
+ - 11. Performance & Scalability: caching, batching, concurrency, known bottlenecks
21
+ - 12. Development Workflow: local setup, install/dev/test/build/lint commands
22
+ - 13. Testing Strategy: test frameworks, locations, coverage gates, gaps
23
+ - 14. Architectural Decisions & Rationale: key choices with evidence and tradeoffs
24
+ - 15. Constraints, Risks, and Technical Debt: tight coupling, TODOs, operational risks
25
+ - 16. Future Considerations: documented roadmap + reasonable recommendations (labeled as such)
26
+ - 17. Project Identification: name, language, type, runtime, date of review, maintainer
27
+ - 18. Glossary / Acronyms: project-specific terms an agent or new developer needs to know
28
+
29
+ Append at the very end of the file:
30
+ ```
31
+ <!-- Last updated: <current ISO timestamp> -->
32
+ ```
33
+
34
+ Rules:
35
+ - Be specific and concrete: include actual directories, files, modules, commands.
36
+ - Mark anything undiscoverable as "Not evident from the repository".
37
+ - Use Mermaid diagrams where helpful.
38
+ - Write as if this document will be committed and maintained over time.
39
+
40
+ ## Writing rules
41
+
42
+ These rules govern the voice and shape of every section. The ARCHITECTURE.md is the primary artifact an agent reads to understand the system's invariants — it must teach constraints, not just inventory structure. These are enforced by re-reading each section after generation (see the self-check in the skill).
43
+
44
+ 1. **Every section must answer "what breaks if this is violated," not just "what exists."** A section that only describes structure without stating the constraint it protects and the consequence of crossing it is reference material, not architecture. "The system has four modules" is structure; "Modules must not cross-reference each other in Domain or Application, and flow goes through port interfaces or domain events" is a constraint.
45
+
46
+ 2. **Architectural decisions must carry their rationale and what they superseded.** A decision table row that says "Adopt X" is a fact; "Adopt X because Y, supersedes decision Z which assumed W" is a constraint that teaches an agent why a change would be wrong. If a decision was reached after rejecting an alternative, name the alternative and why it was rejected.
47
+
48
+ 3. **State boundaries as prohibitions with consequences.** "Layering is enforced: Api → Application → Domain" is a constraint. "Api → Application → Domain" alone is a dependency list. "Only the Composition namespace in Api reaches Infrastructure" is a constraint; "Api depends on Infrastructure" is a fact. Prefer the constraint form: name the boundary, state who must not cross it, and what breaks when it is crossed.
49
+
50
+ 4. **Include what was tried and rejected, not just what was chosen.** The most valuable architecture decisions are the ones where an alternative was tested and found wanting. A section that says "dynamic sessions were rejected because they accept no volumes, cost more at scale, and are blocked by policy" teaches an agent more than "the engine runs as a container app."
51
+
52
+ 5. **Narrative over inventory.** Describe how the system behaves, what holds it together, and where the seams are. A reader who understands the constraints can infer the structure; a reader who only sees the structure cannot infer the constraints.
53
+
54
+ ## Self-check (before writing the file)
55
+
56
+ Re-read every section you are about to write. Then:
57
+
58
+ 1. **Identify inventory-only sections.** If a section describes what exists without stating what breaks when its constraints are violated, rewrite it as constraint-embedded prose or cut it.
59
+
60
+ 2. **Check decision rows.** Every row in the decisions table must carry its rationale. If a decision has no "why," it is a fact, not a decision — cut it or find the rationale.
61
+
62
+ 3. **Scan for bare dependency lists.** "Api depends on Application depends on Domain" is a fact. Rewrite it as: name the boundary, state who must not cross it, and what breaks when it is crossed.
63
+
64
+ 4. **Verify rejected alternatives are present where they matter.** If a significant architectural choice was made, the rejected alternative and the reason for rejection should be in the document. An agent that does not know what was rejected will propose it again.
@@ -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.