@plainconceptsplatform/agent-harness 3.2.0 → 3.3.1

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 (141) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +454 -452
  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/update.js +121 -121
  8. package/cli/commands/wizard.js +134 -134
  9. package/cli/fragments/archive/az.md +97 -97
  10. package/cli/fragments/archive/gh.md +96 -96
  11. package/cli/fragments/archive/gl.md +96 -96
  12. package/cli/fragments/archive/none.md +75 -75
  13. package/cli/fragments/guardrails/codegraph.md +5 -5
  14. package/cli/fragments/guardrails/humanizer.md +4 -4
  15. package/cli/fragments/guardrails/memory.md +4 -4
  16. package/cli/fragments/guardrails/rtk.md +3 -3
  17. package/cli/fragments/guardrails/simple-english.md +4 -4
  18. package/cli/fragments/ops-backlog/az.md +28 -28
  19. package/cli/fragments/ops-backlog/gh.md +28 -28
  20. package/cli/fragments/ops-backlog/jira.md +28 -28
  21. package/cli/fragments/ops-review/az.md +62 -62
  22. package/cli/fragments/ops-review/gh.md +51 -51
  23. package/cli/fragments/ops-review/gl.md +55 -55
  24. package/cli/fragments/ops-ship/az.md +81 -81
  25. package/cli/fragments/ops-ship/gh.md +67 -67
  26. package/cli/fragments/ops-ship/gl.md +84 -84
  27. package/cli/index.js +116 -116
  28. package/cli/presets/agents-content.json +34 -34
  29. package/cli/presets/browser.json +10 -10
  30. package/cli/presets/clean.json +21 -21
  31. package/cli/presets/models.json +68 -68
  32. package/cli/presets/optimization.json +32 -32
  33. package/cli/presets/platforms.json +76 -76
  34. package/cli/presets/source.json +23 -23
  35. package/cli/steps/browser/index.js +48 -48
  36. package/cli/steps/clean/index.js +120 -120
  37. package/cli/steps/copy/agents.js +120 -120
  38. package/cli/steps/copy/commands.js +79 -79
  39. package/cli/steps/copy/fullstack-engineer.js +89 -89
  40. package/cli/steps/copy/index.js +88 -88
  41. package/cli/steps/copy/opencode-json.js +324 -324
  42. package/cli/steps/copy/skills.js +316 -307
  43. package/cli/steps/metadata/index.js +115 -115
  44. package/cli/steps/models/format.js +88 -88
  45. package/cli/steps/models/index.js +64 -64
  46. package/cli/steps/models/write.js +38 -38
  47. package/cli/steps/openspec/index.js +136 -136
  48. package/cli/steps/optimization/codegraph.js +141 -127
  49. package/cli/steps/optimization/detect.js +66 -66
  50. package/cli/steps/optimization/humanizer.js +17 -17
  51. package/cli/steps/optimization/index.js +158 -158
  52. package/cli/steps/optimization/memory.js +91 -88
  53. package/cli/steps/optimization/patch-guardrails.js +111 -111
  54. package/cli/steps/optimization/simple-english.js +17 -17
  55. package/cli/steps/optimization/skills-lock.js +30 -30
  56. package/cli/steps/platform/index.js +109 -109
  57. package/cli/steps/source/index.js +123 -123
  58. package/cli/utils/agent-color.js +111 -111
  59. package/cli/utils/copy.js +134 -134
  60. package/cli/utils/exec-spinner.js +47 -47
  61. package/cli/utils/exec.js +134 -134
  62. package/cli/utils/legacy-check.js +30 -30
  63. package/cli/utils/models-cache.js +58 -58
  64. package/cli/utils/models-pricing.js +42 -42
  65. package/cli/utils/paths.js +80 -80
  66. package/cli/utils/process.js +3 -3
  67. package/cli/utils/terminal.js +6 -6
  68. package/cli/utils/update-manifest.js +75 -75
  69. package/harness/.opencode/_gitignore +9 -9
  70. package/harness/.opencode/commands/init.md +5 -5
  71. package/harness/.opencode/commands/make-architecture.md +5 -5
  72. package/harness/.opencode/commands/make-design.md +5 -5
  73. package/harness/.opencode/commands/make-engineer.md +5 -5
  74. package/harness/.opencode/commands/make-guardrails.md +5 -5
  75. package/harness/.opencode/commands/make-user-model.md +5 -5
  76. package/harness/.opencode/commands/ops-backlog.md +10 -10
  77. package/harness/.opencode/commands/ops-review.md +8 -8
  78. package/harness/.opencode/commands/ops-ship.md +9 -9
  79. package/harness/.opencode/commands/plan-apply.md +9 -9
  80. package/harness/.opencode/commands/plan-archive.md +5 -5
  81. package/harness/.opencode/commands/plan-explore.md +9 -9
  82. package/harness/.opencode/commands/plan-goal.md +5 -5
  83. package/harness/.opencode/commands/plan-propose.md +9 -9
  84. package/harness/.opencode/commands/plan-quick.md +5 -5
  85. package/harness/.opencode/commands/plan-story.md +9 -9
  86. package/harness/.opencode/commands/repo-audit.md +5 -5
  87. package/harness/.opencode/commands/repo-help.md +5 -5
  88. package/harness/.opencode/commands/repo-initialize.md +5 -5
  89. package/harness/.opencode/commands/repo-onboard.md +5 -5
  90. package/harness/.opencode/commands/repo-verify.md +5 -5
  91. package/harness/.opencode/package.json +5 -5
  92. package/harness/.opencode/plugins/pc-subagent-monitor.js +184 -184
  93. package/harness/.opencode/plugins/pc-subagent-tiers.js +354 -354
  94. package/harness/.opencode/plugins/pc-system-reminders.js +386 -386
  95. package/harness/.opencode/scripts/check-diff.mjs +26 -7
  96. package/harness/.opencode/scripts/code-rules.mjs +288 -280
  97. package/harness/AGENTS.md +49 -49
  98. package/harness/ARCHITECTURE.md +13 -13
  99. package/harness/DESIGN.md +13 -13
  100. package/harness/opencode.jsonc +36 -36
  101. package/harness/openspec/config.yaml +20 -20
  102. package/harness/skills-lock.json +17 -17
  103. package/package.json +14 -12
  104. package/skills/README.md +18 -18
  105. package/skills/agent-harness-cli/SKILL.md +86 -86
  106. package/skills/browser-automation/SKILL.md +72 -72
  107. package/skills/pc-guardrails-project/SKILL.md +8 -8
  108. package/skills/pc-make-architecture/SKILL.md +32 -32
  109. package/skills/pc-make-architecture/structure-template.md +64 -64
  110. package/skills/pc-make-design/SKILL.md +45 -45
  111. package/skills/pc-make-engineer/SKILL.md +59 -59
  112. package/skills/pc-make-engineer/signal-mapping.md +53 -53
  113. package/skills/pc-make-engineer/template.md +36 -36
  114. package/skills/pc-make-guardrails/SKILL.md +44 -44
  115. package/skills/pc-make-guardrails/category-reference.md +112 -112
  116. package/skills/pc-make-merge-risk-assess/SKILL.md +70 -70
  117. package/skills/pc-make-merge-risk-assess/category-reference.md +114 -114
  118. package/skills/pc-make-user-model/SKILL.md +56 -56
  119. package/skills/pc-ops-ship/SKILL.md +22 -18
  120. package/skills/pc-plan-apply/SKILL.md +86 -86
  121. package/skills/pc-plan-apply/simple-mode.md +21 -21
  122. package/skills/pc-plan-archive/SKILL.md +66 -66
  123. package/skills/pc-plan-explore/SKILL.md +21 -21
  124. package/skills/pc-plan-goal/SKILL.md +91 -91
  125. package/skills/pc-plan-goal/branching.md +39 -39
  126. package/skills/pc-plan-goal/failure-policy.md +30 -30
  127. package/skills/pc-plan-goal/output-mode.md +10 -10
  128. package/skills/pc-plan-goal/output.md +71 -71
  129. package/skills/pc-plan-propose/SKILL.md +125 -125
  130. package/skills/pc-plan-propose/task-annotation.md +39 -39
  131. package/skills/pc-plan-quick/SKILL.md +46 -46
  132. package/skills/pc-plan-story/SKILL.md +93 -93
  133. package/skills/pc-repo-audit/SKILL.md +44 -44
  134. package/skills/pc-repo-help/SKILL.md +87 -87
  135. package/skills/pc-repo-initialize/SKILL.md +119 -119
  136. package/skills/pc-repo-onboard/SKILL.md +32 -32
  137. package/skills/pc-repo-verify/SKILL.md +150 -150
  138. package/skills/pc-userstory-az/SKILL.md +71 -71
  139. package/skills/pc-userstory-browser/SKILL.md +64 -64
  140. package/skills/pc-userstory-gh/SKILL.md +63 -63
  141. package/skills/pc-userstory-jira/SKILL.md +74 -74
package/README.md CHANGED
@@ -1,452 +1,454 @@
1
- <div align="center">
2
-
3
- <img src="https://raw.githubusercontent.com/PlainConceptsPlatform/agent-harness/refs/heads/main/docs/public/assets/logo.png" alt="agent-harness" width="160" />
4
-
5
- # 🧰 agent-harness
6
-
7
- **Installs the Plain Concepts Platform Harness into any codebase, and keeps it up to date. Wires [OpenCode](https://opencode.ai), [OpenSpec](https://github.com/fission-ai/openspec), [codegraph](https://github.com/colbymchenry/codegraph), and [agentmemory](https://github.com/rohitg00/agentmemory) into a multi-agent workflow that runs on native parallel subagents.**
8
-
9
- GitHub, Azure DevOps, Jira, GitLab, browser-based backlog, or combinations (for example, Jira backlog plus GitHub repository, or browser backlog plus GitLab repository).
10
-
11
- **[plainconceptsplatform.github.io/agent-harness](https://plainconceptsplatform.github.io/agent-harness)**
12
-
13
- [![npm version](https://img.shields.io/npm/v/@plainconceptsplatform/agent-harness?style=flat-square&color=black)](https://www.npmjs.com/package/@plainconceptsplatform/agent-harness) [![npm downloads](https://img.shields.io/npm/dm/@plainconceptsplatform/agent-harness?style=flat-square&color=black)](https://www.npmjs.com/package/@plainconceptsplatform/agent-harness) [![license](https://img.shields.io/npm/l/@plainconceptsplatform/agent-harness?style=flat-square&color=black)](./LICENSE) [![node](https://img.shields.io/node/v/@plainconceptsplatform/agent-harness?style=flat-square&color=black)](https://nodejs.org)
14
-
15
- </div>
16
-
17
- ## What is this?
18
-
19
- Most codebases have no `AGENTS.md`, no architecture documentation an agent can read, and no defined workflow for picking up a task. So agents improvise, and you get a different answer every run.
20
-
21
- **agent-harness** is the CLI that installs the **Plain Concepts Platform Harness** into a repository and keeps it up to date.
22
-
23
- The harness is ours. We build it, our projects run on it, and this CLI is how it gets into a codebase. 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`.
24
-
25
- Underneath, it wires OpenCode to OpenSpec for change management, native subagent waves for parallel work, codegraph for code intelligence, and agentmemory for context that survives between sessions.
26
-
27
- The CLI has three jobs:
28
-
29
- | Command | What it does |
30
- | --- | --- |
31
- | `npx @plainconceptsplatform/agent-harness` | Installs the harness. A wizard runs once and saves your answers to `.opencode/harness.json`. |
32
- | `npx @plainconceptsplatform/agent-harness update` | Reinstalls the harness from those saved answers, no questions asked. Keeps files you edited. |
33
- | `npx @plainconceptsplatform/agent-harness join` | Sets up a teammate's machine. Touches no committed file. |
34
-
35
- You run the first one once per repository, and the second whenever we ship a release.
36
-
37
- <div align="center">
38
- <img src="https://raw.githubusercontent.com/PlainConceptsPlatform/agent-harness/refs/heads/main/docs/public/assets/demo.gif" alt="agent-harness demo" width="700" />
39
- </div>
40
-
41
- ## Quick start
42
-
43
- ```bash
44
- npx @plainconceptsplatform/agent-harness@latest
45
- ```
46
-
47
- Requires **Node.js 18 or higher**.
48
-
49
- ### Run specific steps
50
-
51
- You can run individual setup or maintenance steps without running the full wizard:
52
-
53
- ```bash
54
- # Run one step directly
55
- npx @plainconceptsplatform/agent-harness clean
56
- npx @plainconceptsplatform/agent-harness platform
57
- npx @plainconceptsplatform/agent-harness copy
58
- npx @plainconceptsplatform/agent-harness openspec
59
- npx @plainconceptsplatform/agent-harness models
60
- npx @plainconceptsplatform/agent-harness optimization
61
- npx @plainconceptsplatform/agent-harness browser
62
- npx @plainconceptsplatform/agent-harness metadata
63
- npx @plainconceptsplatform/agent-harness join
64
-
65
- # Show CLI help and all commands
66
- npx @plainconceptsplatform/agent-harness --help
67
- npx @plainconceptsplatform/agent-harness -h
68
- ```
69
-
70
- When available, step commands reuse context from `.opencode/harness.json`.
71
-
72
- ### Keeping the harness current
73
-
74
- A new release of agent-harness ships new commands, skills and plugins. To pull them into a project that already has the harness:
75
-
76
- ```bash
77
- npx @plainconceptsplatform/agent-harness@latest update
78
- ```
79
-
80
- `update` re-runs every file patch from `.opencode/harness.json` and asks nothing. It keeps a hash of each file it manages in `.opencode/harness-managed.json`, so it leaves your hand edits alone and reports them as preserved. It also skips generated skills like `pc-guardrails-project`, whose contents came from a `/make-*` command rather than from us.
81
-
82
- Reach for individual steps when you want something narrower:
83
-
84
- - `clean` to reset old AI files
85
- - `copy` if templates or skills changed in a new agent-harness release
86
- - `optimization` to reconfigure RTK, quota, Simple English, codegraph, agentmemory, or humanizer, and the guardrails optimization markers
87
- - `metadata` last, to refresh `.opencode/harness.json`
88
- - `join` if you are new to a project that already has the harness and want the local tooling it expects
89
-
90
- > **Upgrading from `opencode-onboard` v1?** v2 renamed the config files and the skill prefix (`ob-` became `pc-`), and it does not migrate v1 projects. The CLI detects one and refuses to run rather than half-patching it. Re-onboard on a clean branch: remove `.opencode/` and `.agents/skills/ob-*`, then run the wizard again.
91
-
92
- > **Browser tooling changed in v2.4.** The `@different-ai/opencode-browser` plugin (and its Chrome extension) was replaced by [`agent-browser`](https://github.com/vercel-labs/agent-browser), wired in as an MCP server in `opencode.jsonc`. Running `update` strips the old plugin entry, adds the MCP block, and installs the new binary — no manual unloading of the extension is needed, though you can remove it from `chrome://extensions` yourself. Skills you wrote that call `browser_*` tools directly must switch to the `agent-browser` CLI or the `agent_browser_*` MCP tools. Backlog-browser users: agent-browser runs its own Chrome, so log in once per project using the `--session backlog --restore` flow described in `pc-userstory-browser`.
93
-
94
- ---
95
-
96
- ## Installing the harness
97
-
98
- The first run is a 10-step wizard. It keeps the current step visible, plus the last two completed steps, so progress is always clear.
99
-
100
- | Step | What happens |
101
- | --- | --- |
102
- | **1. Source scope** | Choose current repository or sibling source roots for code analysis |
103
- | **2. Clean AI files** | Detects existing `AGENTS.md`, `.cursorrules`, `CLAUDE.md`, `.agents/` and so on, then removes them. Preserves your `.agents/skills/` directory. |
104
- | **3. Choose platform** | Backlog (GitHub, Azure DevOps, Jira, browser-based, or None) plus repository (GitHub, Azure DevOps, GitLab, or None). Supports mixed platforms, for example browser backlog plus GitHub repository, or Jira backlog plus GitLab repository. |
105
- | **4. Check platform CLI** | Verifies `gh` (GitHub), or `az` plus `azure-devops` extension (Azure DevOps), or `acli` (Jira), or `glab` (GitLab). Skips CLI checks for browser-based or None platforms. |
106
- | **5. Copy scaffolding** | Copies agents, built-in skills, bootstrap documentation, writes source-roots metadata, applies AGENTS bootstrap patching, copies `skills-lock.json`, then runs `npx skills` |
107
- | **6. Initialize OpenSpec** | Runs `npx @fission-ai/openspec init` silently for structured change management |
108
- | **7. Choose models** | Fetches live model list from [models.dev](https://models.dev), lets you pick plan, build, and fast models with cost indicators and canonical pricing |
109
- | **8. Token optimization tools** | Optional and recommended. One checklist step for RTK check, opencode-quota setup, Simple English install, codegraph install, agentmemory install, humanizer install, and token-optimization rule injection into guardrails |
110
- | **9. Install browser tooling** | Installs `agent-browser` globally and downloads its Chrome for Testing binary |
111
- | **10. Write onboarding metadata** | Writes `.opencode/harness.json` with selected setup details |
112
-
113
- When it finishes, open OpenCode in your project and type:
114
-
115
- ```
116
- /repo-initialize
117
- ```
118
-
119
- OpenCode asks if this is a greenfield or brownfield project. For brownfield projects it generates `ARCHITECTURE.md` and `DESIGN.md` from your actual codebase, archives project history, then activates the full agent team. For greenfield projects it skips documentation generation and leaves placeholder files you can populate later with `/make-architecture` and `/make-design`.
120
-
121
- ---
122
-
123
- ## Commands
124
-
125
- Custom slash commands are installed into `.opencode/commands/` and are available directly in OpenCode.
126
-
127
- Commands that other commands (or agents) need to execute are thin wrappers around `pc-*` skills in `.agents/skills/`. The command handles user invocation and arguments, and the skill holds the procedure. OpenCode has no mechanism for a command to run another command, but any agent can load a skill mid-conversation, which is what makes pipelines like `/plan-goal` composable.
128
-
129
- | Command | Description |
130
- | ------- | ----------- |
131
- | `/repo-help` | Show all commands and when to use each one. Start here if you are unsure. |
132
- | `/repo-onboard` | Guided tour of the project and its agentic infrastructure. Explains agents, commands, skills, OpenSpec workflow, and configuration. Read-only. |
133
- | `/repo-audit` | Read-only audit of every configured source root against fullstack abilities and guardrails. Reports prioritized architecture, quality, dependency, lockfile, tooling, and CI findings. |
134
- | `/repo-initialize` | Initialize the project. Asks greenfield versus brownfield, then activates the agent team. |
135
- | `/plan-explore` | Think through an idea or investigate a problem before committing to a plan. |
136
- | `/plan-propose <url or idea>` | Parse a GitHub Issue, Azure DevOps, Jira, or browser URL, or a direct idea, into a structured plan (proposal, specs, tasks). Enriches each task with agent and model assignments. |
137
- | `/plan-quick <task>` | Quick plan for focused changes. Reads the codebase, creates a task checklist in the Todo pane, and stops. No OpenSpec, no proposals, no specs. |
138
- | `/plan-apply` | Implement tasks from the current plan. Detects format automatically: OpenSpec-annotated tasks run as parallel subagent waves; plain checkboxes run sequentially in-session. |
139
- | `/ops-ship` | Create a pull request for the current branch with screenshots if the user interface changed. |
140
- | `/ops-review` | Read and triage pull request review feedback. Reports what needs fixing. |
141
- | `/ops-backlog` | Create an issue in the backlog platform (GitHub, Azure DevOps, or Jira) from a description. |
142
- | `/plan-archive` | Archive a completed OpenSpec change. |
143
- | `/plan-goal <feature or URL>` | Autonomous, no-confirmation pipeline: branch off main, then explore, propose, apply, archive (one commit per phase). Default mode: merge to main and delete the feature branch. Add `branch` to keep the feature branch without merging or pushing. `push` pushes the branch; `pr` pushes and opens a PR. For loop-engineering. |
144
- | `/make-engineer` | Interactive persona-driven form to add a custom specialist engineer. Pick a persona, then confirm an inspected-and-recommended skill set (architecture/patterns like FSD or design patterns, framework, testing, infra) before it installs. |
145
- | `/make-architecture` | Generate or regenerate `ARCHITECTURE.md` from the codebase. |
146
- | `/make-design` | Generate or regenerate `DESIGN.md` from the design system. |
147
- | `/make-guardrails` | Generate a `pc-guardrails-project` skill from `ARCHITECTURE.md` and project config files. Extracts architecture boundaries, naming, code style, testing, and git workflow rules. Updates all `*-engineer.md` to load the skill. |
148
- | `/repo-verify` | Write the verification plan for the current branch's change: a journey through the new functionality as a fenced YAML block in `verification-plan.md`, stored with the change. The evidence workflow from `@plainconceptsplatform/workflows` replays it in headless Chromium when the pull request merges and archives one screenshot per waypoint in an `evidence/` folder beside the plan. Backend-only changes are traced through to the frontend when their contract is consumed there; a `not-applicable` stub is written when no UI surface is reachable. Does not run checks or take screenshots. Runs automatically in `/plan-goal`. |
149
- | `/make-user-model [user] <tier> <model>` | Set the model for a tier (`plan`, `build`, `fast`). Writes to `harness.json` (team) or `harness.user.json` (user override, gitignored) when `user` prefix is used. Restart to pick up changes: the `pc-subagent-tiers` plugin rebuilds tier agents at startup. Pass a model id or `current` for the active session model. |
150
-
151
- ---
152
-
153
- ## Agents and Skills
154
-
155
- agent-harness draws a hard line between two concepts:
156
-
157
- ### Agents, universal behaviors
158
-
159
- Agents define _how to work_. They are universal personas (same behavior across projects and stacks).
160
-
161
- Current baseline uses a generic execution model:
162
-
163
- ```
164
- build primary. Implements. Full write access. The default.
165
- plan primary. Same body as build, but cannot edit or spawn.
166
- fullstack-engineer subagent. The body build and plan share, and the fallback worker.
167
- *-engineer subagent. User-created specialists, spawned for parallel implementation.
168
- *-engineer.<tier> subagent. The same specialist pinned to a plan/build/fast model.
169
- ```
170
-
171
- `build` and `plan` are the only agents a human selects, and they are overrides of opencode's own two primaries rather than new names. The `pc-subagent-tiers` plugin regenerates both from `fullstack-engineer.md` on every startup, so they always carry the current abilities, each on its own tier model. `plan` differs from `build` in two frontmatter lines: `edit: deny` and `task: deny`; spawning is denied because a plan session that can call `task()` can have a build worker make the change for it. It keeps `bash` so planning can read git and openspec state, and `pc-system-reminders` holds that shell to inspection commands. Everything else is `mode: subagent` and reached through `task()`, never picked from the agent list. Project-specific specialization comes from user-created engineers via `/make-engineer`. During `/plan-apply` the lead inspects the engineers that actually exist in `.opencode/agents/` and spawns matching specialists. Prefer a specialist over `fullstack-engineer`; if none matches, create one.
172
-
173
- ### Skills, platform knowledge
174
-
175
- Skills define _what to know_. They provide project rules, platform behavior, and task-specific execution guidance. Agents auto-detect and load relevant skills; **you do not manually choose skills per prompt**.
176
-
177
- If you choose backlog platform `None`, no userstory skills are injected into the workflow. The project works from direct conversation, local repository context, and optional OpenSpec artifacts only. If you choose repository platform `None`, no pull request skills are injected.
178
-
179
- Current loading model:
180
-
181
- - `pc-guardrails-generic` is mandatory baseline for every agent (git, secrets, quality rules, plus the engineer workflow)
182
- - Baseline context rules and token-optimization guidance live in `AGENTS.md` (always in context), not in a skill
183
-
184
- Default `fullstack-engineer` abilities:
185
-
186
- ```
187
- ## Abilities
188
- - Guardrails: @pc-guardrails-generic, @pc-guardrails-project
189
- ```
190
-
191
- Users are expected to create additional skills and map them into abilities over time.
192
-
193
- Built-in skills (`pc-` prefix) shipped with agent-harness:
194
-
195
- | Skill | Purpose |
196
- | ----- | ------- |
197
- | `pc-guardrails-generic` | Foundation for user guardrails skills |
198
- | `pc-guardrails-project` | Project-specific guardrails, populated by `/make-guardrails` |
199
- | `pc-userstory-gh` | Parse a GitHub Issue URL into a structured work item |
200
- | `pc-userstory-az` | Parse an Azure DevOps work item URL |
201
- | `pc-userstory-jira` | Parse a Jira issue URL via `acli` CLI |
202
- | `pc-userstory-browser` | Parse work item from any URL via browser automation (Linear, Trello, and so on) |
203
- | `browser-automation` | Browser control via `agent-browser` (localhost and browser backlog exception) |
204
- | `pc-plan-explore` | Read-only exploration procedure behind `/plan-explore`; autonomous mode used by `/plan-goal` |
205
- | `pc-plan-propose` | Proposal + task-enrichment procedure behind `/plan-propose`; autonomous mode used by `/plan-goal` |
206
- | `pc-plan-apply` | Wave-implementation procedure behind `/plan-apply`; autonomous mode used by `/plan-goal` |
207
- | `pc-plan-archive` | Archive procedure behind `/plan-archive` (platform flow injected at onboarding); autonomous mode used by `/plan-goal` |
208
- | `pc-ops-ship` | PR-creation procedure behind `/ops-ship` (platform flow injected at onboarding); used by `/plan-goal` pr mode |
209
- | `pc-make-architecture` | ARCHITECTURE.md generation behind `/make-architecture`; used by `/repo-initialize` |
210
- | `pc-make-design` | DESIGN.md generation behind `/make-design`; used by `/repo-initialize` |
211
- | `pc-make-guardrails` | Guardrails generation behind `/make-guardrails`; used by `/repo-initialize` |
212
- | `pc-make-engineer` | Custom engineer creation behind `/make-engineer` |
213
- | `pc-make-user-model` | Tier model configuration behind `/make-user-model` |
214
- | `pc-plan-goal` | Autonomous full-lifecycle pipeline behind `/plan-goal` |
215
- | `pc-plan-quick` | Quick task checklist behind `/plan-quick` |
216
- | `pc-repo-audit` | Read-only health audit across configured source roots and fullstack abilities |
217
- | `pc-repo-verify` | Writes the verification plan (`verification-plan.md`): a journey as a fenced YAML block, replayed in headless Chromium by the evidence workflow when the pull request merges. Its `PC-PROJECT-ENVIRONMENT` slot records how the project starts and signs in. Used by `/repo-verify` and `/plan-goal` |
218
- | `pc-repo-initialize` | Project initialization behind `/repo-initialize` |
219
- | `pc-repo-onboard` | Guided project tour behind `/repo-onboard` |
220
- | `pc-repo-help` | The command reference displayed by `/repo-help`; used by `/repo-initialize` |
221
-
222
- Platform operations are injected during onboarding: pull request creation into the `pc-ops-ship` skill (loaded by `/ops-ship`, and by `/plan-goal` in `pr` mode), archive PR flow into the `pc-plan-archive` skill, and pull request review / issue creation directly into the `/ops-review` and `/ops-backlog` command files.
223
-
224
- Skills live in `.agents/skills/`. Any `SKILL.md` file in a subdirectory is automatically discoverable. Write your own and agents will pick them up.
225
-
226
- ### Models, plan / build / fast
227
-
228
- During onboarding you pick three models:
229
-
230
- | Role | Used by | Pick |
231
- | ---- | ------- | ---- |
232
- | **plan** | Main OpenCode session (the lead) | Something capable with strong reasoning |
233
- | **build** | Specialist engineers (default tier) | Something capable for implementation |
234
- | **fast** | Light helpers (fast tier) | Something fast and cheap |
235
-
236
- Models are fetched live from [models.dev](https://models.dev) (3000+ models, cached weekly). Cost tiers `[$]` `[$$]` `[$$$]` always reflect the canonical provider price, so `github-copilot/claude-opus-4.7` shows `[$$]` not `[$]`.
237
-
238
- ---
239
-
240
- ## The pipeline
241
-
242
- When you give the lead agent a work item URL, execution follows this pipeline. If backlog platform is `None`, skip the work item stage. If repository platform is `None`, skip the pull request stage:
243
-
244
- ```
245
- lead
246
- ↓
247
- parse work item via userstory skill
248
- ↓
249
- plan-propose
250
- proposal + specs + tasks
251
- ↓
252
- [confirm with user]
253
- ↓
254
- wave of subagents (*-engineer, per-tier model)
255
- each implements its assigned tasks → returns result → lead commits group
256
- ↓
257
- verify (tests, build, lint as needed)
258
- ↓
259
- lead (ship mode, if configured)
260
- commit → push → pull request → feedback loop
261
- ```
262
-
263
- 1. Load the platform userstory skill (installed as `pc-userstory`, from the variant matching your backlog platform)
264
- 2. Run `/plan-propose` to produce `proposal.md`, specs, and `tasks.md`
265
- 3. Confirm with user before implementation
266
- 4. Run `/plan-apply` to orchestrate implementation in waves
267
- 5. Each wave spawns engineers in parallel (custom `*-engineer` specialists, each carrying its own tier model), capped at `agents.maxConcurrent`
268
- 6. Each subagent receives its task IDs in its prompt, loads relevant abilities, implements, and returns; the lead commits each group
269
- 7. Verify with tests, build, and lint according to task scope
270
- 8. Ship or update pull request via lead flow
271
-
272
- For unattended Loop Task runs, keep a concrete shell verification task as the final exit-code gate. Inside `/plan-goal`, `/plan-apply` step 10 runs lint, typecheck, test, and build commands and is the checks gate; `/repo-verify` then writes `verification-plan.md` (the journey the evidence workflow replays in headless Chromium once the pull request merges). The final shell task independently proves the critical commands passed before commit or pull request actions.
273
-
274
- Agents run as native OpenCode subagents in parallel waves: no external plugin, no git worktrees. The lead's Todo pane is the live board, and the `pc-subagent-monitor` plugin mirrors state to `.opencode/harness-run.json`. Navigate into any running subagent with `ctrl+x ↓` then `←`/`→`.
275
-
276
- ---
277
-
278
- ## What gets installed
279
-
280
- ```
281
- your-project/
282
- ├── AGENTS.md ← bootstrap mode, replaced after first "/repo-initialize"
283
- ├── ARCHITECTURE.md ← prompt for agents to fill in from your codebase
284
- ├── DESIGN.md ← prompt for agents to fill in from your codebase
285
- ├── opencode.jsonc ← native OpenCode 2 config: agents, permissions, MCP servers
286
- ├── .opencode/
287
- │ ├── harness.json ← harness config: platform, models, maxConcurrentAgents
288
- │ ├── harness-managed.json ← hashes of every managed file, so "update" spares your edits
289
- │ ├── agents/ ← build.md + plan.md (generated primaries), fullstack-engineer,
290
- │ │ and user-created *-engineer files (all subagents)
291
- │ ├── plugins/
292
- │ │ ├── pc-subagent-monitor.js ← server plugin: subagent state → .opencode/harness-run.json, and the wave cap
293
- │ │ ├── pc-subagent-tiers.js ← server plugin: derives tier agents and the two primaries
294
- │ │ └── pc-system-reminders.js ← server plugin: gates work on the agent's abilities, denies the never-rules
295
- │ └── scripts/
296
- │ ├── check-diff.mjs ← the comments and tests gate on the current diff (see below)
297
- │ └── code-rules.mjs ← its rules, the same ones Project-Health scores a repository with
298
- └── .agents/
299
- └── skills/
300
- ├── pc-guardrails-generic/ ← foundation for user guardrails
301
- ├── pc-guardrails-project/ ← populated by /make-guardrails
302
- ├── pc-userstory/ ← the variant matching your backlog platform, renamed on install
303
- └── browser-automation/
304
- ```
305
-
306
- On OpenCode 2 the terminal client is configured globally (`~/.config/opencode/cli.json`), so the harness ships no project-local `tui.json`; the native session sidebar shows subagents without a sidecar panel.
307
-
308
- Platform skills ship as suffixed variants (`pc-userstory-gh`, `pc-userstory-az`, `pc-userstory-jira`, `pc-userstory-browser`) and the installer copies only the matching one, renamed to its generic name. Platform operations (ship, review, backlog) are injected directly into the `/ops-*` command files from `cli/fragments/ops-*/` during onboarding. Source-roots metadata lands in `.opencode/source-roots.json`. The always-shipped reminder plugin holds editing, shell and spawning until every ability under the agent's `## Abilities` is loaded, guardrails first, and re-arms after compaction. Token-optimization guidance is injected into `pc-guardrails-generic` marker blocks during onboarding.
309
-
310
- ---
311
-
312
- ## Comments and tests gate
313
-
314
- `node .opencode/scripts/check-diff.mjs [--base <ref>] [--json]` reads the diff against the merge base with `origin/HEAD` (committed, uncommitted and untracked) and exits 1 when it:
315
-
316
- - adds more comment lines than 10% of the code lines it adds (2 are always allowed);
317
- - adds a slop shape (banner, region, untracked TODO, a doc comment that repeats the name, commented-out code, an apology), a comment block of five lines or more, an incident story, or a doc comment on an internal symbol;
318
- - touches a file and leaves slop in it, or leaves it with more comments per code line than before;
319
- - grows the tests more than the code: test lines beyond the code lines added (40 always allowed), more than 40 cases per 1,000 code lines (3 always allowed), or any new skipped, focused, snapshot, assertion-less or mock-only test.
320
-
321
- `pc-plan-apply` runs it with the other checks, and the workflows run it before a bot pull request can merge. A project changes the limits in `.opencode/harness.json`:
322
-
323
- ```json
324
- "codeRules": { "commentRatio": 0.1, "commentAllowance": 2, "testRatio": 1, "testAllowance": 40, "casesPerKloc": 40, "caseAllowance": 3 }
325
- ```
326
-
327
- ## The bootstrap sequence
328
-
329
- The first time you type `init` in OpenCode after onboarding, the agent asks whether this is a **greenfield** or **brownfield** project:
330
-
331
- ### Brownfield (existing codebase)
332
-
333
- 1. Bootstrap-mode `AGENTS.md` triggers the initialization workflow
334
- 2. OpenCode archives existing project context into OpenSpec (`project-history`)
335
- 3. OpenCode runs `/make-architecture` to generate real `ARCHITECTURE.md` from your codebase
336
- 4. OpenCode runs `/make-design` to generate real `DESIGN.md` from your design system
337
- 5. OpenSpec `config.yaml` is populated with discovered tech stack and domain context
338
- 6. Bootstrap `AGENTS.md` is replaced with production guidance
339
- 7. Team workflows become fully active for normal implementation tasks
340
-
341
- ### Greenfield (new project, little or no existing code)
342
-
343
- 1. Bootstrap-mode `AGENTS.md` triggers the initialization workflow
344
- 2. OpenSpec `config.yaml` is populated with what is known (intended stack, domain)
345
- 3. Bootstrap `AGENTS.md` is replaced with production guidance
346
- 4. `ARCHITECTURE.md` and `DESIGN.md` are left as placeholder files
347
-
348
- Once your codebase has meaningful content, run:
349
- - `/make-architecture` to generate architecture documentation
350
- - `/make-design` to generate design system documentation
351
-
352
- Both commands are safe to rerun at any time as the project evolves.
353
-
354
- ---
355
-
356
- ## Token Budget Controls
357
-
358
- Long unattended agent sessions can consume significant tokens. Set these controls up **before** first use:
359
-
360
- 1. **Set provider-side limits first**: monthly soft-limit plus hard usage cap in your provider dashboard:
361
- - OpenAI: [platform.openai.com/account/limits](https://platform.openai.com/account/limits)
362
- - Anthropic: [console.anthropic.com](https://console.anthropic.com)
363
- - Google AI Studio: [aistudio.google.com/app/usage](https://aistudio.google.com/app/usage)
364
-
365
- 2. **Route models by task type**: use a fast and cheap model (for example `haiku`, `gpt-4o-mini`) for orchestration and status loops; reserve expensive models (for example `sonnet`, `opus`, `gpt-4o`) for implementation tasks only.
366
-
367
- 3. **Monitor provider dashboards**: check usage at your provider's dashboard before and during `/plan-apply` sessions.
368
-
369
- 4. **Confirm before large runs**: the onboarded `/plan-apply` workflow will ask for your confirmation before spawning agents for Medium (4 to 7 tasks) or High (8 or more tasks) scope sessions.
370
-
371
- ---
372
-
373
- ## Prerequisites
374
-
375
- | Requirement | Notes |
376
- | ----------- | ----- |
377
- | **Node.js 18 or higher** | Required |
378
- | **[OpenCode](https://opencode.ai)** | The agent runtime |
379
- | **[gh CLI](https://cli.github.com)** | GitHub platform, must be authenticated |
380
- | **[az CLI](https://learn.microsoft.com/en-us/cli/azure/install-azure-cli)** plus azure-devops extension | Azure DevOps platform |
381
- | **[acli](https://developer.atlassian.com/cloud/acli/guides/install-acli/)** | Jira (Atlassian) backlog platform, must be authenticated |
382
- | **[glab](https://gitlab.com/gitlab-org/cli/#installation)** | GitLab repository platform, must be authenticated |
383
-
384
- ---
385
-
386
- ## Development
387
-
388
- The repository splits along one line: **`harness/` is the product, `cli/` is the machinery that installs it.**
389
-
390
- ```
391
- harness/ what lands in your repository, copied verbatim
392
- cli/ the installer: commands, wizard steps, presets, fragments
393
- skills/ skills about this CLI, for agents that operate it
394
- docs/ the documentation site
395
- ```
396
-
397
- Browse `harness/` to see what the Plain Concepts Platform Harness actually is, without reading a line of installer code.
398
-
399
- Inside `cli/`, the layout follows the ten wizard steps: one directory per step under `cli/steps/`, each owning its prompts and its file writes, with `cli/commands/` holding the top-level entry points (`wizard`, `update`, `join`, `migrate`, `single`).
400
-
401
- Data the CLI reads lives in two places, split by kind:
402
-
403
- **`cli/presets/`** holds JSON that shapes the wizard's questions and defaults:
404
-
405
- - `source.json` controls source-scope prompt options
406
- - `platforms.json` controls platform labels, CLI checks, and backlog-only flags
407
- - `clean.json` controls AI file detection and preservation
408
- - `models.json` controls model role prompts and agent assignments
409
- - `optimization.json` controls RTK, quota, Simple English, codegraph, agentmemory, and humanizer checklist defaults
410
- - `quota.json` controls opencode-quota defaults
411
- - `browser.json` controls the agent-browser installer (npm package + Chrome setup)
412
-
413
- **`cli/fragments/`** holds Markdown injected into the installed harness, one directory per marker family: `archive/`, `guardrails/`, `ops-backlog/`, `ops-review/`, `ops-ship/`. Each file is the platform-specific body that replaces a `<!-- PC-PLATFORM-*-START -->` block.
414
-
415
- Every filename the harness writes into a project is declared once in `cli/utils/paths.js`. Change it there, and remember the OpenCode plugins under `harness/.opencode/plugins/` read those same names at runtime.
416
-
417
- `skills/` holds both the installable `pc-*` skills and the `agent-harness-cli` skill for agents operating this CLI. See [skills/README.md](./skills/README.md). All of them ship to npm and are discoverable by `npx skills`, so you can install individual skills into any project without the full harness:
418
-
419
- ```bash
420
- npx skills add PlainConceptsPlatform/agent-harness
421
- # or scope to a single skill:
422
- npx skills add PlainConceptsPlatform/agent-harness --skill pc-ops-ship
423
- ```
424
-
425
- ```bash
426
- git clone https://github.com/PlainConceptsPlatform/agent-harness.git
427
- cd agent-harness
428
- pnpm install
429
-
430
- # Run the CLI locally
431
- node cli/index.js
432
-
433
- # Run tests
434
- pnpm test
435
-
436
- # Run linting
437
- pnpm lint
438
-
439
- # Fix auto-fixable lint issues
440
- pnpm lint:fix
441
-
442
- # Watch mode
443
- pnpm test:watch
444
- ```
445
-
446
- Tests are written with [Vitest](https://vitest.dev). Linting uses ESLint flat config with Node ESM defaults and stricter correctness rules.
447
-
448
- ---
449
-
450
- ## License
451
-
452
- MIT © [Plain Concepts](https://github.com/PlainConceptsPlatform)
1
+ <div align="center">
2
+
3
+ <img src="https://raw.githubusercontent.com/PlainConceptsPlatform/agent-harness/refs/heads/main/docs/public/assets/logo.png" alt="agent-harness" width="160" />
4
+
5
+ # 🧰 agent-harness
6
+
7
+ **Installs the Plain Concepts Platform Harness into any codebase, and keeps it up to date. Wires [OpenCode](https://opencode.ai), [OpenSpec](https://github.com/fission-ai/openspec), [codegraph](https://github.com/colbymchenry/codegraph), and [agentmemory](https://github.com/rohitg00/agentmemory) into a multi-agent workflow that runs on native parallel subagents.**
8
+
9
+ GitHub, Azure DevOps, Jira, GitLab, browser-based backlog, or combinations (for example, Jira backlog plus GitHub repository, or browser backlog plus GitLab repository).
10
+
11
+ **[plainconceptsplatform.github.io/agent-harness](https://plainconceptsplatform.github.io/agent-harness)**
12
+
13
+ [![npm version](https://img.shields.io/npm/v/@plainconceptsplatform/agent-harness?style=flat-square&color=black)](https://www.npmjs.com/package/@plainconceptsplatform/agent-harness) [![npm downloads](https://img.shields.io/npm/dm/@plainconceptsplatform/agent-harness?style=flat-square&color=black)](https://www.npmjs.com/package/@plainconceptsplatform/agent-harness) [![license](https://img.shields.io/npm/l/@plainconceptsplatform/agent-harness?style=flat-square&color=black)](./LICENSE) [![node](https://img.shields.io/node/v/@plainconceptsplatform/agent-harness?style=flat-square&color=black)](https://nodejs.org)
14
+
15
+ </div>
16
+
17
+ ## What is this?
18
+
19
+ Most codebases have no `AGENTS.md`, no architecture documentation an agent can read, and no defined workflow for picking up a task. So agents improvise, and you get a different answer every run.
20
+
21
+ **agent-harness** is the CLI that installs the **Plain Concepts Platform Harness** into a repository and keeps it up to date.
22
+
23
+ The harness is ours. We build it, our projects run on it, and this CLI is how it gets into a codebase. 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`.
24
+
25
+ Underneath, it wires OpenCode to OpenSpec for change management, native subagent waves for parallel work, codegraph for code intelligence, and agentmemory for context that survives between sessions.
26
+
27
+ The CLI has three jobs:
28
+
29
+ | Command | What it does |
30
+ | --- | --- |
31
+ | `npx @plainconceptsplatform/agent-harness` | Installs the harness. A wizard runs once and saves your answers to `.opencode/harness.json`. |
32
+ | `npx @plainconceptsplatform/agent-harness update` | Reinstalls the harness from those saved answers, no questions asked. Keeps files you edited. |
33
+ | `npx @plainconceptsplatform/agent-harness join` | Sets up a teammate's machine. Touches no committed file. |
34
+
35
+ You run the first one once per repository, and the second whenever we ship a release.
36
+
37
+ <div align="center">
38
+ <img src="https://raw.githubusercontent.com/PlainConceptsPlatform/agent-harness/refs/heads/main/docs/public/assets/demo.gif" alt="agent-harness demo" width="700" />
39
+ </div>
40
+
41
+ ## Quick start
42
+
43
+ ```bash
44
+ npx @plainconceptsplatform/agent-harness@latest
45
+ ```
46
+
47
+ Requires **Node.js 18 or higher**.
48
+
49
+ ### Run specific steps
50
+
51
+ You can run individual setup or maintenance steps without running the full wizard:
52
+
53
+ ```bash
54
+ # Run one step directly
55
+ npx @plainconceptsplatform/agent-harness clean
56
+ npx @plainconceptsplatform/agent-harness platform
57
+ npx @plainconceptsplatform/agent-harness copy
58
+ npx @plainconceptsplatform/agent-harness openspec
59
+ npx @plainconceptsplatform/agent-harness models
60
+ npx @plainconceptsplatform/agent-harness optimization
61
+ npx @plainconceptsplatform/agent-harness browser
62
+ npx @plainconceptsplatform/agent-harness metadata
63
+ npx @plainconceptsplatform/agent-harness join
64
+
65
+ # Show CLI help and all commands
66
+ npx @plainconceptsplatform/agent-harness --help
67
+ npx @plainconceptsplatform/agent-harness -h
68
+ ```
69
+
70
+ When available, step commands reuse context from `.opencode/harness.json`.
71
+
72
+ ### Keeping the harness current
73
+
74
+ A new release of agent-harness ships new commands, skills and plugins. To pull them into a project that already has the harness:
75
+
76
+ ```bash
77
+ npx @plainconceptsplatform/agent-harness@latest update
78
+ ```
79
+
80
+ `update` re-runs every file patch from `.opencode/harness.json` and asks nothing. It keeps a hash of each file it manages in `.opencode/harness-managed.json`, so it leaves your hand edits alone and reports them as preserved. It also skips generated skills like `pc-guardrails-project`, whose contents came from a `/make-*` command rather than from us.
81
+
82
+ Reach for individual steps when you want something narrower:
83
+
84
+ - `clean` to reset old AI files
85
+ - `copy` if templates or skills changed in a new agent-harness release
86
+ - `optimization` to reconfigure RTK, quota, Simple English, codegraph, agentmemory, or humanizer, and the guardrails optimization markers
87
+ - `metadata` last, to refresh `.opencode/harness.json`
88
+ - `join` if you are new to a project that already has the harness and want the local tooling it expects
89
+
90
+ > **Upgrading from `opencode-onboard` v1?** v2 renamed the config files and the skill prefix (`ob-` became `pc-`), and it does not migrate v1 projects. The CLI detects one and refuses to run rather than half-patching it. Re-onboard on a clean branch: remove `.opencode/` and `.agents/skills/ob-*`, then run the wizard again.
91
+
92
+ > **Browser tooling changed in v2.4.** The `@different-ai/opencode-browser` plugin (and its Chrome extension) was replaced by [`agent-browser`](https://github.com/vercel-labs/agent-browser), wired in as an MCP server in `opencode.jsonc`. Running `update` strips the old plugin entry, adds the MCP block, and installs the new binary — no manual unloading of the extension is needed, though you can remove it from `chrome://extensions` yourself. Skills you wrote that call `browser_*` tools directly must switch to the `agent-browser` CLI or the `agent_browser_*` MCP tools. Backlog-browser users: agent-browser runs its own Chrome, so log in once per project using the `--session backlog --restore` flow described in `pc-userstory-browser`.
93
+
94
+ ---
95
+
96
+ ## Installing the harness
97
+
98
+ The first run is a 10-step wizard. It keeps the current step visible, plus the last two completed steps, so progress is always clear.
99
+
100
+ | Step | What happens |
101
+ | --- | --- |
102
+ | **1. Source scope** | Choose current repository or sibling source roots for code analysis |
103
+ | **2. Clean AI files** | Detects existing `AGENTS.md`, `.cursorrules`, `CLAUDE.md`, `.agents/` and so on, then removes them. Preserves your `.agents/skills/` directory. |
104
+ | **3. Choose platform** | Backlog (GitHub, Azure DevOps, Jira, browser-based, or None) plus repository (GitHub, Azure DevOps, GitLab, or None). Supports mixed platforms, for example browser backlog plus GitHub repository, or Jira backlog plus GitLab repository. |
105
+ | **4. Check platform CLI** | Verifies `gh` (GitHub), or `az` plus `azure-devops` extension (Azure DevOps), or `acli` (Jira), or `glab` (GitLab). Skips CLI checks for browser-based or None platforms. |
106
+ | **5. Copy scaffolding** | Copies agents, built-in skills, bootstrap documentation, writes source-roots metadata, applies AGENTS bootstrap patching, copies `skills-lock.json`, then runs `npx skills` |
107
+ | **6. Initialize OpenSpec** | Runs `npx @fission-ai/openspec init` silently for structured change management |
108
+ | **7. Choose models** | Fetches live model list from [models.dev](https://models.dev), lets you pick plan, build, and fast models with cost indicators and canonical pricing |
109
+ | **8. Token optimization tools** | Optional and recommended. One checklist step for RTK check, opencode-quota setup, Simple English install, codegraph install, agentmemory install, humanizer install, and token-optimization rule injection into guardrails |
110
+ | **9. Install browser tooling** | Installs `agent-browser` globally and downloads its Chrome for Testing binary |
111
+ | **10. Write onboarding metadata** | Writes `.opencode/harness.json` with selected setup details |
112
+
113
+ When it finishes, open OpenCode in your project and type:
114
+
115
+ ```
116
+ /repo-initialize
117
+ ```
118
+
119
+ OpenCode asks if this is a greenfield or brownfield project. For brownfield projects it generates `ARCHITECTURE.md` and `DESIGN.md` from your actual codebase, archives project history, then activates the full agent team. For greenfield projects it skips documentation generation and leaves placeholder files you can populate later with `/make-architecture` and `/make-design`.
120
+
121
+ ---
122
+
123
+ ## Commands
124
+
125
+ Custom slash commands are installed into `.opencode/commands/` and are available directly in OpenCode.
126
+
127
+ Commands that other commands (or agents) need to execute are thin wrappers around `pc-*` skills in `.agents/skills/`. The command handles user invocation and arguments, and the skill holds the procedure. OpenCode has no mechanism for a command to run another command, but any agent can load a skill mid-conversation, which is what makes pipelines like `/plan-goal` composable.
128
+
129
+ | Command | Description |
130
+ | ------- | ----------- |
131
+ | `/repo-help` | Show all commands and when to use each one. Start here if you are unsure. |
132
+ | `/repo-onboard` | Guided tour of the project and its agentic infrastructure. Explains agents, commands, skills, OpenSpec workflow, and configuration. Read-only. |
133
+ | `/repo-audit` | Read-only audit of every configured source root against fullstack abilities and guardrails. Reports prioritized architecture, quality, dependency, lockfile, tooling, and CI findings. |
134
+ | `/repo-initialize` | Initialize the project. Asks greenfield versus brownfield, then activates the agent team. |
135
+ | `/plan-explore` | Think through an idea or investigate a problem before committing to a plan. |
136
+ | `/plan-propose <url or idea>` | Parse a GitHub Issue, Azure DevOps, Jira, or browser URL, or a direct idea, into a structured plan (proposal, specs, tasks). Enriches each task with agent and model assignments. |
137
+ | `/plan-quick <task>` | Quick plan for focused changes. Reads the codebase, creates a task checklist in the Todo pane, and stops. No OpenSpec, no proposals, no specs. |
138
+ | `/plan-apply` | Implement tasks from the current plan. Detects format automatically: OpenSpec-annotated tasks run as parallel subagent waves; plain checkboxes run sequentially in-session. |
139
+ | `/ops-ship` | Create a pull request for the current branch with screenshots if the user interface changed. |
140
+ | `/ops-review` | Read and triage pull request review feedback. Reports what needs fixing. |
141
+ | `/ops-backlog` | Create an issue in the backlog platform (GitHub, Azure DevOps, or Jira) from a description. |
142
+ | `/plan-archive` | Archive a completed OpenSpec change. |
143
+ | `/plan-goal <feature or URL>` | Autonomous, no-confirmation pipeline: branch off main, then explore, propose, apply, archive (one commit per phase). Default mode: merge to main and delete the feature branch. Add `branch` to keep the feature branch without merging or pushing. `push` pushes the branch; `pr` pushes and opens a PR. For loop-engineering. |
144
+ | `/make-engineer` | Interactive persona-driven form to add a custom specialist engineer. Pick a persona, then confirm an inspected-and-recommended skill set (architecture/patterns like FSD or design patterns, framework, testing, infra) before it installs. |
145
+ | `/make-architecture` | Generate or regenerate `ARCHITECTURE.md` from the codebase. |
146
+ | `/make-design` | Generate or regenerate `DESIGN.md` from the design system. |
147
+ | `/make-guardrails` | Generate a `pc-guardrails-project` skill from `ARCHITECTURE.md` and project config files. Extracts architecture boundaries, naming, code style, testing, and git workflow rules. Updates all `*-engineer.md` to load the skill. |
148
+ | `/repo-verify` | Write the verification plan for the current branch's change: a journey through the new functionality as a fenced YAML block in `verification-plan.md`, stored with the change. The evidence workflow from `@plainconceptsplatform/workflows` replays it in headless Chromium when the pull request merges and archives one screenshot per waypoint in an `evidence/` folder beside the plan. Backend-only changes are traced through to the frontend when their contract is consumed there; a `not-applicable` stub is written when no UI surface is reachable. Does not run checks or take screenshots. Runs automatically in `/plan-goal`. |
149
+ | `/make-user-model [user] <tier> <model>` | Set the model for a tier (`plan`, `build`, `fast`). Writes to `harness.json` (team) or `harness.user.json` (user override, gitignored) when `user` prefix is used. Restart to pick up changes: the `pc-subagent-tiers` plugin rebuilds tier agents at startup. Pass a model id or `current` for the active session model. |
150
+
151
+ ---
152
+
153
+ ## Agents and Skills
154
+
155
+ agent-harness draws a hard line between two concepts:
156
+
157
+ ### Agents, universal behaviors
158
+
159
+ Agents define _how to work_. They are universal personas (same behavior across projects and stacks).
160
+
161
+ Current baseline uses a generic execution model:
162
+
163
+ ```
164
+ build primary. Implements. Full write access. The default.
165
+ plan primary. Same body as build, but cannot edit or spawn.
166
+ fullstack-engineer subagent. The body build and plan share, and the fallback worker.
167
+ *-engineer subagent. User-created specialists, spawned for parallel implementation.
168
+ *-engineer.<tier> subagent. The same specialist pinned to a plan/build/fast model.
169
+ ```
170
+
171
+ `build` and `plan` are the only agents a human selects, and they are overrides of opencode's own two primaries rather than new names. The `pc-subagent-tiers` plugin regenerates both from `fullstack-engineer.md` on every startup, so they always carry the current abilities, each on its own tier model. `plan` differs from `build` in two frontmatter lines: `edit: deny` and `task: deny`; spawning is denied because a plan session that can call `task()` can have a build worker make the change for it. It keeps `bash` so planning can read git and openspec state, and `pc-system-reminders` holds that shell to inspection commands. Everything else is `mode: subagent` and reached through `task()`, never picked from the agent list. Project-specific specialization comes from user-created engineers via `/make-engineer`. During `/plan-apply` the lead inspects the engineers that actually exist in `.opencode/agents/` and spawns matching specialists. Prefer a specialist over `fullstack-engineer`; if none matches, create one.
172
+
173
+ ### Skills, platform knowledge
174
+
175
+ Skills define _what to know_. They provide project rules, platform behavior, and task-specific execution guidance. Agents auto-detect and load relevant skills; **you do not manually choose skills per prompt**.
176
+
177
+ If you choose backlog platform `None`, no userstory skills are injected into the workflow. The project works from direct conversation, local repository context, and optional OpenSpec artifacts only. If you choose repository platform `None`, no pull request skills are injected.
178
+
179
+ Current loading model:
180
+
181
+ - `pc-guardrails-generic` is mandatory baseline for every agent (git, secrets, quality rules, plus the engineer workflow)
182
+ - Baseline context rules and token-optimization guidance live in `AGENTS.md` (always in context), not in a skill
183
+
184
+ Default `fullstack-engineer` abilities:
185
+
186
+ ```
187
+ ## Abilities
188
+ - Guardrails: @pc-guardrails-generic, @pc-guardrails-project
189
+ ```
190
+
191
+ Users are expected to create additional skills and map them into abilities over time.
192
+
193
+ Built-in skills (`pc-` prefix) shipped with agent-harness:
194
+
195
+ | Skill | Purpose |
196
+ | ----- | ------- |
197
+ | `pc-guardrails-generic` | Foundation for user guardrails skills |
198
+ | `pc-guardrails-project` | Project-specific guardrails, populated by `/make-guardrails` |
199
+ | `pc-userstory-gh` | Parse a GitHub Issue URL into a structured work item |
200
+ | `pc-userstory-az` | Parse an Azure DevOps work item URL |
201
+ | `pc-userstory-jira` | Parse a Jira issue URL via `acli` CLI |
202
+ | `pc-userstory-browser` | Parse work item from any URL via browser automation (Linear, Trello, and so on) |
203
+ | `browser-automation` | Browser control via `agent-browser` (localhost and browser backlog exception) |
204
+ | `pc-plan-explore` | Read-only exploration procedure behind `/plan-explore`; autonomous mode used by `/plan-goal` |
205
+ | `pc-plan-propose` | Proposal + task-enrichment procedure behind `/plan-propose`; autonomous mode used by `/plan-goal` |
206
+ | `pc-plan-apply` | Wave-implementation procedure behind `/plan-apply`; autonomous mode used by `/plan-goal` |
207
+ | `pc-plan-archive` | Archive procedure behind `/plan-archive` (platform flow injected at onboarding); autonomous mode used by `/plan-goal` |
208
+ | `pc-ops-ship` | PR-creation procedure behind `/ops-ship` (platform flow injected at onboarding); used by `/plan-goal` pr mode |
209
+ | `pc-make-architecture` | ARCHITECTURE.md generation behind `/make-architecture`; used by `/repo-initialize` |
210
+ | `pc-make-design` | DESIGN.md generation behind `/make-design`; used by `/repo-initialize` |
211
+ | `pc-make-guardrails` | Guardrails generation behind `/make-guardrails`; used by `/repo-initialize` |
212
+ | `pc-make-engineer` | Custom engineer creation behind `/make-engineer` |
213
+ | `pc-make-user-model` | Tier model configuration behind `/make-user-model` |
214
+ | `pc-plan-goal` | Autonomous full-lifecycle pipeline behind `/plan-goal` |
215
+ | `pc-plan-quick` | Quick task checklist behind `/plan-quick` |
216
+ | `pc-repo-audit` | Read-only health audit across configured source roots and fullstack abilities |
217
+ | `pc-repo-verify` | Writes the verification plan (`verification-plan.md`): a journey as a fenced YAML block, replayed in headless Chromium by the evidence workflow when the pull request merges. Its `PC-PROJECT-ENVIRONMENT` slot records how the project starts and signs in. Used by `/repo-verify` and `/plan-goal` |
218
+ | `pc-repo-initialize` | Project initialization behind `/repo-initialize` |
219
+ | `pc-repo-onboard` | Guided project tour behind `/repo-onboard` |
220
+ | `pc-repo-help` | The command reference displayed by `/repo-help`; used by `/repo-initialize` |
221
+
222
+ Platform operations are injected during onboarding: pull request creation into the `pc-ops-ship` skill (loaded by `/ops-ship`, and by `/plan-goal` in `pr` mode), archive PR flow into the `pc-plan-archive` skill, and pull request review / issue creation directly into the `/ops-review` and `/ops-backlog` command files.
223
+
224
+ Skills live in `.agents/skills/`. Any `SKILL.md` file in a subdirectory is automatically discoverable. Write your own and agents will pick them up.
225
+
226
+ ### Models, plan / build / fast
227
+
228
+ During onboarding you pick three models:
229
+
230
+ | Role | Used by | Pick |
231
+ | ---- | ------- | ---- |
232
+ | **plan** | Main OpenCode session (the lead) | Something capable with strong reasoning |
233
+ | **build** | Specialist engineers (default tier) | Something capable for implementation |
234
+ | **fast** | Light helpers (fast tier) | Something fast and cheap |
235
+
236
+ Models are fetched live from [models.dev](https://models.dev) (3000+ models, cached weekly). Cost tiers `[$]` `[$$]` `[$$$]` always reflect the canonical provider price, so `github-copilot/claude-opus-4.7` shows `[$$]` not `[$]`.
237
+
238
+ ---
239
+
240
+ ## The pipeline
241
+
242
+ When you give the lead agent a work item URL, execution follows this pipeline. If backlog platform is `None`, skip the work item stage. If repository platform is `None`, skip the pull request stage:
243
+
244
+ ```
245
+ lead
246
+ ↓
247
+ parse work item via userstory skill
248
+ ↓
249
+ plan-propose
250
+ proposal + specs + tasks
251
+ ↓
252
+ [confirm with user]
253
+ ↓
254
+ wave of subagents (*-engineer, per-tier model)
255
+ each implements its assigned tasks → returns result → lead commits group
256
+ ↓
257
+ verify (tests, build, lint as needed)
258
+ ↓
259
+ lead (ship mode, if configured)
260
+ commit → push → pull request → feedback loop
261
+ ```
262
+
263
+ 1. Load the platform userstory skill (installed as `pc-userstory`, from the variant matching your backlog platform)
264
+ 2. Run `/plan-propose` to produce `proposal.md`, specs, and `tasks.md`
265
+ 3. Confirm with user before implementation
266
+ 4. Run `/plan-apply` to orchestrate implementation in waves
267
+ 5. Each wave spawns engineers in parallel (custom `*-engineer` specialists, each carrying its own tier model), capped at `agents.maxConcurrent`
268
+ 6. Each subagent receives its task IDs in its prompt, loads relevant abilities, implements, and returns; the lead commits each group
269
+ 7. Verify with tests, build, and lint according to task scope
270
+ 8. Ship or update pull request via lead flow
271
+
272
+ For unattended Loop Task runs, keep a concrete shell verification task as the final exit-code gate. Inside `/plan-goal`, `/plan-apply` step 10 runs lint, typecheck, test, and build commands and is the checks gate; `/repo-verify` then writes `verification-plan.md` (the journey the evidence workflow replays in headless Chromium once the pull request merges). The final shell task independently proves the critical commands passed before commit or pull request actions.
273
+
274
+ Agents run as native OpenCode subagents in parallel waves: no external plugin, no git worktrees. The lead's Todo pane is the live board, and the `pc-subagent-monitor` plugin mirrors state to `.opencode/harness-run.json`. Navigate into any running subagent with `ctrl+x ↓` then `←`/`→`.
275
+
276
+ ---
277
+
278
+ ## What gets installed
279
+
280
+ ```
281
+ your-project/
282
+ ├── AGENTS.md ← bootstrap mode, replaced after first "/repo-initialize"
283
+ ├── ARCHITECTURE.md ← prompt for agents to fill in from your codebase
284
+ ├── DESIGN.md ← prompt for agents to fill in from your codebase
285
+ ├── opencode.jsonc ← native OpenCode 2 config: agents, permissions, MCP servers
286
+ ├── .opencode/
287
+ │ ├── harness.json ← harness config: platform, models, maxConcurrentAgents
288
+ │ ├── harness-managed.json ← hashes of every managed file, so "update" spares your edits
289
+ │ ├── agents/ ← build.md + plan.md (generated primaries), fullstack-engineer,
290
+ │ │ and user-created *-engineer files (all subagents)
291
+ │ ├── plugins/
292
+ │ │ ├── pc-subagent-monitor.js ← server plugin: subagent state → .opencode/harness-run.json, and the wave cap
293
+ │ │ ├── pc-subagent-tiers.js ← server plugin: derives tier agents and the two primaries
294
+ │ │ └── pc-system-reminders.js ← server plugin: gates work on the agent's abilities, denies the never-rules
295
+ │ └── scripts/
296
+ │ ├── check-diff.mjs ← the comments and tests gate on the current diff (see below)
297
+ │ └── code-rules.mjs ← its rules, the same ones Project-Health scores a repository with
298
+ └── .agents/
299
+ └── skills/
300
+ ├── pc-guardrails-generic/ ← foundation for user guardrails
301
+ ├── pc-guardrails-project/ ← populated by /make-guardrails
302
+ ├── pc-userstory/ ← the variant matching your backlog platform, renamed on install
303
+ └── browser-automation/
304
+ ```
305
+
306
+ On OpenCode 2 the terminal client is configured globally (`~/.config/opencode/cli.json`), so the harness ships no project-local `tui.json`; the native session sidebar shows subagents without a sidecar panel.
307
+
308
+ Platform skills ship as suffixed variants (`pc-userstory-gh`, `pc-userstory-az`, `pc-userstory-jira`, `pc-userstory-browser`) and the installer copies only the matching one, renamed to its generic name. Platform operations (ship, review, backlog) are injected directly into the `/ops-*` command files from `cli/fragments/ops-*/` during onboarding. Source-roots metadata lands in `.opencode/source-roots.json`. The always-shipped reminder plugin holds editing, shell and spawning until every ability under the agent's `## Abilities` is loaded, guardrails first, and re-arms after compaction. Token-optimization guidance is injected into `pc-guardrails-generic` marker blocks during onboarding.
309
+
310
+ ---
311
+
312
+ ## Comments and tests gate
313
+
314
+ `node .opencode/scripts/check-diff.mjs [--base <ref>] [--json]` reads the diff against the merge base with `origin/HEAD` (committed, uncommitted and untracked) and exits 1 when it:
315
+
316
+ - adds more comment lines than 10% of the code lines it adds (2 are always allowed);
317
+ - adds a slop shape (banner, region, untracked TODO, a doc comment that repeats the name, commented-out code, an apology), a comment block of five lines or more, an incident story, or a doc comment on an internal symbol;
318
+ - touches a file and leaves slop in it, or leaves it with more comments per code line than before;
319
+ - grows the tests more than the code: test lines beyond the code lines added (40 always allowed), more than 40 cases per 1,000 code lines (3 always allowed), or any new skipped, focused, snapshot, assertion-less or mock-only test.
320
+
321
+ A tool directive (`nosemgrep`, `biome-ignore`, `eslint-disable`, `@ts-expect-error`, coverage ignores) is not a comment and costs nothing. Code added to a file that has methods in the complexity baseline (`scripts/complexity-baseline.json`, keys `path::method`) counts twice toward the test budget: that gate fails a method whose coverage drops, so its new branches need tests.
322
+
323
+ `pc-plan-apply` runs it with the other checks, and the workflows run it before a bot pull request can merge. A project changes the limits in `.opencode/harness.json`:
324
+
325
+ ```json
326
+ "codeRules": { "commentRatio": 0.1, "commentAllowance": 2, "testRatio": 1, "testAllowance": 40, "casesPerKloc": 40, "caseAllowance": 3, "complexityBaseline": "scripts/complexity-baseline.json" }
327
+ ```
328
+
329
+ ## The bootstrap sequence
330
+
331
+ The first time you type `init` in OpenCode after onboarding, the agent asks whether this is a **greenfield** or **brownfield** project:
332
+
333
+ ### Brownfield (existing codebase)
334
+
335
+ 1. Bootstrap-mode `AGENTS.md` triggers the initialization workflow
336
+ 2. OpenCode archives existing project context into OpenSpec (`project-history`)
337
+ 3. OpenCode runs `/make-architecture` to generate real `ARCHITECTURE.md` from your codebase
338
+ 4. OpenCode runs `/make-design` to generate real `DESIGN.md` from your design system
339
+ 5. OpenSpec `config.yaml` is populated with discovered tech stack and domain context
340
+ 6. Bootstrap `AGENTS.md` is replaced with production guidance
341
+ 7. Team workflows become fully active for normal implementation tasks
342
+
343
+ ### Greenfield (new project, little or no existing code)
344
+
345
+ 1. Bootstrap-mode `AGENTS.md` triggers the initialization workflow
346
+ 2. OpenSpec `config.yaml` is populated with what is known (intended stack, domain)
347
+ 3. Bootstrap `AGENTS.md` is replaced with production guidance
348
+ 4. `ARCHITECTURE.md` and `DESIGN.md` are left as placeholder files
349
+
350
+ Once your codebase has meaningful content, run:
351
+ - `/make-architecture` to generate architecture documentation
352
+ - `/make-design` to generate design system documentation
353
+
354
+ Both commands are safe to rerun at any time as the project evolves.
355
+
356
+ ---
357
+
358
+ ## Token Budget Controls
359
+
360
+ Long unattended agent sessions can consume significant tokens. Set these controls up **before** first use:
361
+
362
+ 1. **Set provider-side limits first**: monthly soft-limit plus hard usage cap in your provider dashboard:
363
+ - OpenAI: [platform.openai.com/account/limits](https://platform.openai.com/account/limits)
364
+ - Anthropic: [console.anthropic.com](https://console.anthropic.com)
365
+ - Google AI Studio: [aistudio.google.com/app/usage](https://aistudio.google.com/app/usage)
366
+
367
+ 2. **Route models by task type**: use a fast and cheap model (for example `haiku`, `gpt-4o-mini`) for orchestration and status loops; reserve expensive models (for example `sonnet`, `opus`, `gpt-4o`) for implementation tasks only.
368
+
369
+ 3. **Monitor provider dashboards**: check usage at your provider's dashboard before and during `/plan-apply` sessions.
370
+
371
+ 4. **Confirm before large runs**: the onboarded `/plan-apply` workflow will ask for your confirmation before spawning agents for Medium (4 to 7 tasks) or High (8 or more tasks) scope sessions.
372
+
373
+ ---
374
+
375
+ ## Prerequisites
376
+
377
+ | Requirement | Notes |
378
+ | ----------- | ----- |
379
+ | **Node.js 18 or higher** | Required |
380
+ | **[OpenCode](https://opencode.ai)** | The agent runtime |
381
+ | **[gh CLI](https://cli.github.com)** | GitHub platform, must be authenticated |
382
+ | **[az CLI](https://learn.microsoft.com/en-us/cli/azure/install-azure-cli)** plus azure-devops extension | Azure DevOps platform |
383
+ | **[acli](https://developer.atlassian.com/cloud/acli/guides/install-acli/)** | Jira (Atlassian) backlog platform, must be authenticated |
384
+ | **[glab](https://gitlab.com/gitlab-org/cli/#installation)** | GitLab repository platform, must be authenticated |
385
+
386
+ ---
387
+
388
+ ## Development
389
+
390
+ The repository splits along one line: **`harness/` is the product, `cli/` is the machinery that installs it.**
391
+
392
+ ```
393
+ harness/ what lands in your repository, copied verbatim
394
+ cli/ the installer: commands, wizard steps, presets, fragments
395
+ skills/ skills about this CLI, for agents that operate it
396
+ docs/ the documentation site
397
+ ```
398
+
399
+ Browse `harness/` to see what the Plain Concepts Platform Harness actually is, without reading a line of installer code.
400
+
401
+ Inside `cli/`, the layout follows the ten wizard steps: one directory per step under `cli/steps/`, each owning its prompts and its file writes, with `cli/commands/` holding the top-level entry points (`wizard`, `update`, `join`, `migrate`, `single`).
402
+
403
+ Data the CLI reads lives in two places, split by kind:
404
+
405
+ **`cli/presets/`** holds JSON that shapes the wizard's questions and defaults:
406
+
407
+ - `source.json` controls source-scope prompt options
408
+ - `platforms.json` controls platform labels, CLI checks, and backlog-only flags
409
+ - `clean.json` controls AI file detection and preservation
410
+ - `models.json` controls model role prompts and agent assignments
411
+ - `optimization.json` controls RTK, quota, Simple English, codegraph, agentmemory, and humanizer checklist defaults
412
+ - `quota.json` controls opencode-quota defaults
413
+ - `browser.json` controls the agent-browser installer (npm package + Chrome setup)
414
+
415
+ **`cli/fragments/`** holds Markdown injected into the installed harness, one directory per marker family: `archive/`, `guardrails/`, `ops-backlog/`, `ops-review/`, `ops-ship/`. Each file is the platform-specific body that replaces a `<!-- PC-PLATFORM-*-START -->` block.
416
+
417
+ Every filename the harness writes into a project is declared once in `cli/utils/paths.js`. Change it there, and remember the OpenCode plugins under `harness/.opencode/plugins/` read those same names at runtime.
418
+
419
+ `skills/` holds both the installable `pc-*` skills and the `agent-harness-cli` skill for agents operating this CLI. See [skills/README.md](./skills/README.md). All of them ship to npm and are discoverable by `npx skills`, so you can install individual skills into any project without the full harness:
420
+
421
+ ```bash
422
+ npx skills add PlainConceptsPlatform/agent-harness
423
+ # or scope to a single skill:
424
+ npx skills add PlainConceptsPlatform/agent-harness --skill pc-ops-ship
425
+ ```
426
+
427
+ ```bash
428
+ git clone https://github.com/PlainConceptsPlatform/agent-harness.git
429
+ cd agent-harness
430
+ pnpm install
431
+
432
+ # Run the CLI locally
433
+ node cli/index.js
434
+
435
+ # Run tests
436
+ pnpm test
437
+
438
+ # Run linting
439
+ pnpm lint
440
+
441
+ # Fix auto-fixable lint issues
442
+ pnpm lint:fix
443
+
444
+ # Watch mode
445
+ pnpm test:watch
446
+ ```
447
+
448
+ Tests are written with [Vitest](https://vitest.dev). Linting uses ESLint flat config with Node ESM defaults and stricter correctness rules.
449
+
450
+ ---
451
+
452
+ ## License
453
+
454
+ MIT © [Plain Concepts](https://github.com/PlainConceptsPlatform)