@plainconceptsplatform/agent-harness 2.4.1 → 2.5.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 (81) hide show
  1. package/README.md +435 -437
  2. package/cli/fragments/archive/az.md +97 -95
  3. package/cli/fragments/archive/gh.md +96 -94
  4. package/cli/fragments/archive/gl.md +96 -94
  5. package/cli/fragments/archive/none.md +75 -73
  6. package/cli/fragments/guardrails/codegraph.md +5 -7
  7. package/cli/fragments/guardrails/humanizer.md +4 -4
  8. package/cli/fragments/guardrails/memory.md +4 -4
  9. package/cli/fragments/guardrails/rtk.md +3 -3
  10. package/cli/fragments/guardrails/simple-english.md +4 -4
  11. package/cli/fragments/ops-backlog/az.md +1 -1
  12. package/cli/fragments/ops-backlog/gh.md +1 -1
  13. package/cli/fragments/ops-backlog/jira.md +1 -1
  14. package/cli/fragments/ops-evidence/az.md +44 -41
  15. package/cli/fragments/ops-evidence/gh.md +54 -53
  16. package/cli/fragments/ops-evidence/jira.md +42 -38
  17. package/cli/fragments/ops-review/az.md +1 -1
  18. package/cli/fragments/ops-review/gh.md +1 -1
  19. package/cli/fragments/ops-review/gl.md +1 -1
  20. package/cli/fragments/ops-ship/az.md +81 -80
  21. package/cli/fragments/ops-ship/gh.md +68 -68
  22. package/cli/fragments/ops-ship/gl.md +85 -85
  23. package/cli/presets/agents-content.json +34 -53
  24. package/cli/steps/copy/agents.js +18 -17
  25. package/cli/steps/copy/opencode-json.js +5 -1
  26. package/cli/steps/copy/skills.js +98 -5
  27. package/cli/steps/optimization/patch-guardrails.js +5 -3
  28. package/cli/utils/copy.js +8 -3
  29. package/cli/utils/update-manifest.js +28 -2
  30. package/harness/.agents/skills/pc-guardrails-generic/SKILL.md +47 -68
  31. package/harness/.agents/skills/pc-make-architecture/SKILL.md +31 -51
  32. package/harness/.agents/skills/pc-make-design/SKILL.md +45 -68
  33. package/harness/.agents/skills/pc-make-engineer/SKILL.md +59 -219
  34. package/harness/.agents/skills/pc-make-engineer/signal-mapping.md +53 -68
  35. package/harness/.agents/skills/pc-make-engineer/template.md +42 -80
  36. package/harness/.agents/skills/pc-make-evidence-scaffold/SKILL.md +18 -18
  37. package/harness/.agents/skills/pc-make-evidence-scaffold/evidence-contract.md +29 -29
  38. package/harness/.agents/skills/pc-make-guardrails/SKILL.md +43 -74
  39. package/harness/.agents/skills/pc-make-guardrails/category-reference.md +10 -5
  40. package/harness/.agents/skills/pc-make-merge-risk-assess/category-reference.md +26 -7
  41. package/harness/.agents/skills/pc-make-user-model/SKILL.md +56 -66
  42. package/harness/.agents/skills/pc-ops-evidence/SKILL.md +133 -127
  43. package/harness/.agents/skills/pc-plan-apply/SKILL.md +14 -5
  44. package/harness/.agents/skills/pc-plan-apply/simple-mode.md +21 -21
  45. package/harness/.agents/skills/pc-plan-archive/SKILL.md +66 -66
  46. package/harness/.agents/skills/pc-plan-explore/SKILL.md +19 -2
  47. package/harness/.agents/skills/pc-plan-goal/SKILL.md +7 -5
  48. package/harness/.agents/skills/pc-plan-goal/output-mode.md +1 -0
  49. package/harness/.agents/skills/pc-plan-goal/output.md +71 -65
  50. package/harness/.agents/skills/pc-plan-propose/SKILL.md +1 -1
  51. package/harness/.agents/skills/pc-plan-quick/SKILL.md +46 -62
  52. package/harness/.agents/skills/pc-plan-story/SKILL.md +48 -149
  53. package/harness/.agents/skills/pc-repo-help/SKILL.md +89 -91
  54. package/harness/.agents/skills/pc-repo-initialize/SKILL.md +112 -130
  55. package/harness/.agents/skills/pc-repo-onboard/SKILL.md +32 -87
  56. package/harness/.agents/skills/pc-repo-verify/SKILL.md +2 -0
  57. package/harness/.agents/skills/pc-userstory-az/SKILL.md +71 -157
  58. package/harness/.agents/skills/pc-userstory-browser/SKILL.md +50 -122
  59. package/harness/.agents/skills/pc-userstory-gh/SKILL.md +63 -120
  60. package/harness/.agents/skills/pc-userstory-jira/SKILL.md +74 -131
  61. package/harness/.opencode/commands/init.md +5 -5
  62. package/harness/.opencode/commands/make-architecture.md +5 -5
  63. package/harness/.opencode/commands/make-design.md +5 -5
  64. package/harness/.opencode/commands/make-engineer.md +5 -5
  65. package/harness/.opencode/commands/make-evidence-scaffold.md +5 -5
  66. package/harness/.opencode/commands/make-guardrails.md +5 -5
  67. package/harness/.opencode/commands/make-user-model.md +5 -5
  68. package/harness/.opencode/commands/plan-apply.md +9 -9
  69. package/harness/.opencode/commands/plan-goal.md +5 -5
  70. package/harness/.opencode/commands/plan-quick.md +5 -5
  71. package/harness/.opencode/commands/plan-story.md +9 -9
  72. package/harness/.opencode/commands/repo-audit.md +5 -5
  73. package/harness/.opencode/commands/repo-initialize.md +5 -5
  74. package/harness/.opencode/commands/repo-onboard.md +5 -5
  75. package/harness/.opencode/commands/repo-verify.md +5 -5
  76. package/harness/.opencode/plugins/pc-subagent-monitor.js +82 -2
  77. package/harness/.opencode/plugins/pc-subagent-tiers.js +9 -6
  78. package/harness/.opencode/plugins/pc-system-reminders.js +312 -3
  79. package/harness/AGENTS.md +49 -71
  80. package/harness/opencode.jsonc +1 -1
  81. package/package.json +1 -1
@@ -1,29 +1,29 @@
1
- # Evidence contract
2
-
3
- Evidence captured by `/plan-goal` lives at `openspec/changes/archive/<dated>-<id>/evidence/`. A standalone pre-archive capture may use `openspec/changes/<id>/evidence/`, but archive moves it into the archived change before publication. That folder contains only:
4
- - ordered capture images (`01-{label}.png/webp`, ...) and/or `flow.gif`
5
- - `evidence.json`: the manifest, schema below.
6
-
7
- ## version 1 schema
8
-
9
- ```jsonc
10
- {
11
- "version": 1,
12
- "changeId": "...",
13
- "required": true,
14
- "status": "passed", // passed | skipped | failed | blocked
15
- "assets": [ { "type": "screenshot", "path": "openspec/changes/archive/<dated>-<id>/evidence/01-final.png", "caption": "...", "bytes": 0, "format": "png" } ],
16
- "reason": "...", // skipped | blocked
17
- "failedStep": "...", // failed
18
- "prMarkdown": "## Evidence ..."
19
- }
20
- ```
21
-
22
- ## Statuses
23
-
24
- - `passed`: evidence required and produced.
25
- - `skipped`: evidence not required (see decision rule). Exit success.
26
- - `blocked`: required but could not run (no harness, app won't start, budget exceeded). Not a skip. Surface it.
27
- - `failed`: a project harness ran and its assertions failed. Surface it.
28
-
29
- `blocked` (required but unrunnable) is never treated as a skip.
1
+ # Evidence contract
2
+
3
+ Evidence captured by `/ops-evidence` lives at `openspec/changes/archive/<dated>-<id>/evidence/`. A standalone pre-archive capture may use `openspec/changes/<id>/evidence/`, but archive moves it into the archived change before publication. That folder contains only:
4
+ - ordered capture images (`01-{label}.png/webp`, ...) and/or `flow.gif`
5
+ - `evidence.json`: the manifest, schema below.
6
+
7
+ ## version 1 schema
8
+
9
+ ```jsonc
10
+ {
11
+ "version": 1,
12
+ "changeId": "...",
13
+ "required": true,
14
+ "status": "passed", // passed | skipped | failed | blocked
15
+ "assets": [ { "type": "screenshot", "path": "openspec/changes/archive/<dated>-<id>/evidence/01-final.png", "caption": "...", "bytes": 0, "format": "png" } ],
16
+ "reason": "...", // skipped | blocked
17
+ "failedStep": "...", // failed
18
+ "prMarkdown": "## Evidence ..."
19
+ }
20
+ ```
21
+
22
+ ## Statuses
23
+
24
+ - `passed`: evidence required and produced.
25
+ - `skipped`: evidence not required (see decision rule). Exit success.
26
+ - `blocked`: required but could not run (no harness, app won't start, budget exceeded). Not a skip. Surface it.
27
+ - `failed`: a project harness ran and its assertions failed. Surface it.
28
+
29
+ `blocked` (required but unrunnable) is never treated as a skip.
@@ -1,74 +1,43 @@
1
- ---
2
- name: pc-make-guardrails
3
- description: Generate or update the pc-guardrails-project skill from ARCHITECTURE.md and relevant project files, then wire it into every engineer agent. Invoked by the /make-guardrails command and the repo-initialize flow.
4
- license: MIT
5
- ---
6
-
7
- # Make Guardrails
8
-
9
- Analyze `ARCHITECTURE.md` and other project files to generate or update a `pc-guardrails-project` skill: a set of rules and constraints extracted from the project's own documentation that agents must follow.
10
-
11
- ## Steps
12
-
13
- 1. **Check current state**
14
-
15
- Read `.agents/skills/pc-guardrails-project/SKILL.md`. Determine which mode to use:
16
- - Does not exist: Generate mode. Create from scratch.
17
- - Exists and has a `<!-- Last updated:` footer: Update mode. Incrementally update.
18
- - Exists but no timestamp: proceed in Generate mode (full regeneration).
19
-
20
- 2a. **Generate mode: read source documents**
21
-
22
- Read ALL of the following that exist:
23
- - `ARCHITECTURE.md` (primary source)
24
- - `DESIGN.md` (design system, component conventions)
25
- - `AGENTS.md` (existing agent instructions, optimizations)
26
- - `README.md` (setup, conventions)
27
- - `CONTRIBUTING.md` (if present)
28
- - `.opencode/harness.json` (platform, models, concurrency)
29
- - `openspec/config.yaml` (if present: domain context and rules)
30
- - Root config files: `package.json`, `tsconfig.json`, `biome.json`, `.eslintrc*`, `Cargo.toml`, `go.mod`, `pyproject.toml`, `pom.xml`: whatever exists
31
- - CI/CD workflows: `.github/workflows/*`, `azure-pipelines.yml`: whatever exists
32
-
33
- Use file tools to discover constraints: `read` the documents above, `grep` for lint/formatter config rules.
34
-
35
- 2b. **Update mode: incremental analysis**
36
-
37
- Extract the `<!-- Last updated: <ISO date> -->` timestamp from the existing skill file. Then:
38
- - Read `ARCHITECTURE.md` and check its `<!-- Last updated:` timestamp. If ARCHITECTURE.md hasn't changed since the guardrails were last generated, report "Guardrails up to date" and stop.
39
- - Run `git log --oneline --since="<date>" -- <config files, lint configs, CI workflows>` to find what convention/config files changed.
40
- - If nothing changed: report "Guardrails up to date" and stop.
41
- - Update only the affected rule categories. Preserve manually-added rules in unchanged categories.
42
- - If changes are pervasive (new architecture, new framework, new platform), fall back to Generate mode.
43
-
44
- 3. **Extract guardrails**
45
-
46
- From the documents and code graph analysis, extract concrete, actionable rules. Follow the [category reference](category-reference.md) for the full list of categories, rule quality standards, and the skill file template.
47
-
48
- 4. **Write the skill**
49
-
50
- Write (or update) `.agents/skills/pc-guardrails-project/SKILL.md` using the template from the [category reference](category-reference.md). Only include sections that have real rules. Omit empty sections.
51
-
52
- 5. **Update agents**
53
-
54
- For every `*-engineer.md` in `.opencode/agents/`, add `@pc-guardrails-project` to the Guardrails ability line (skip if already present). Keep the line's existing entries exactly as they are: only insert `@pc-guardrails-project` after `@pc-guardrails-generic`, using this pattern:
55
- ```markdown
56
- ## Abilities
57
- - Guardrails: @pc-guardrails-generic, @pc-guardrails-project[, ...existing entries unchanged]
58
- ```
59
-
60
- Exclude tier variant files (`*-engineer.build.md`, `*-engineer.fast.md`, `*-engineer.plan.md`): they are generated copies; only update the base templates.
61
-
62
- 6. **Store summary in configured persistent context**
63
-
64
- `write_note` MCP tool with title `guardrails-summary` containing:
65
- - The ISO timestamp of this run
66
- - Number of rules per category
67
-
68
- 7. **Report**
69
-
70
- Tell the user:
71
- - Whether the skill was generated or updated (and which categories changed)
72
- - Number of rules extracted per category
73
- - Number of agent files updated
74
- - Tip: "Rerun `/make-guardrails` any time the architecture or conventions change significantly."
1
+ ---
2
+ name: pc-make-guardrails
3
+ description: Generate or update the pc-guardrails-project skill from ARCHITECTURE.md and relevant project files, then wire it into every engineer agent. Invoked by the /make-guardrails command and the repo-initialize flow.
4
+ license: MIT
5
+ ---
6
+
7
+ # Make Guardrails
8
+
9
+ Turn this project's own documentation into `.agents/skills/pc-guardrails-project/SKILL.md`: the rules and constraints its agents work under, per the [category reference](category-reference.md).
10
+
11
+ ## Rules
12
+
13
+ - Never regenerate over a file that carries a `<!-- Last updated:` footer. `pc-guardrails-project` is the one skill a team is expected to hand-edit, and a full rewrite silently drops that work. Read the file first and pick the mode.
14
+ - Never invent a rule the project does not state somewhere. A guardrail that came from nowhere is one nobody agreed to, and it will be followed anyway.
15
+ - Never write an empty category. Omit it.
16
+ - Never touch a tier variant (`*-engineer.build.md`, `*-engineer.fast.md`, `*-engineer.plan.md`): they are regenerated from the base templates every startup.
17
+
18
+ ## Sources
19
+
20
+ `ARCHITECTURE.md` is the primary one. Then whatever else exists: `DESIGN.md`, `AGENTS.md`, `README.md`, `CONTRIBUTING.md`, `.opencode/harness.json`, `openspec/config.yaml`, the root manifests (`package.json`, `tsconfig.json`, `biome.json`, `.eslintrc*`, `Cargo.toml`, `go.mod`, `pyproject.toml`, `pom.xml`), and the CI definitions (`.github/workflows/*`, `azure-pipelines.yml`). Lint and formatter config is where the conventions are actually enforced, so it outranks any document that describes them.
21
+
22
+ ## Modes
23
+
24
+ | The existing skill file | Mode |
25
+ |---|---|
26
+ | Missing | Generate |
27
+ | Has a `<!-- Last updated:` footer | Update |
28
+ | Exists with no footer | Generate |
29
+
30
+ **Update.** If `ARCHITECTURE.md` has not changed since the footer date, say "Guardrails up to date" and stop. Otherwise `git log --oneline --since="<footer date>" -- <config, lint config, CI workflows>`, update only the affected categories, and leave the rest, including hand-written rules, as they stand. A new architecture, framework or platform is a Generate.
31
+
32
+ ## Wiring
33
+
34
+ Every `*-engineer.md` in `.opencode/agents/` gets `@pc-guardrails-project` on its Guardrails line, right after `@pc-guardrails-generic`, with its existing entries untouched:
35
+
36
+ ```markdown
37
+ ## Abilities
38
+ - Guardrails: @pc-guardrails-generic, @pc-guardrails-project[, ...existing entries unchanged]
39
+ ```
40
+
41
+ ## Report
42
+
43
+ Whether the skill was generated or updated and which categories changed, the rule count per category, how many agent files were wired, and that `/make-guardrails` can be re-run whenever the conventions move.
@@ -1,9 +1,9 @@
1
1
  # Guardrails category reference
2
2
 
3
- From the documents and code graph analysis, extract concrete, actionable rules in these categories. Only include a category if you found real evidence for it.
3
+ From the documents and code graph analysis, extract the rules an agent could break without noticing. Only include a category if you found real evidence for it.
4
4
 
5
5
  - Architecture constraints: layer boundaries, module dependencies, forbidden imports, directory ownership rules (e.g. "src/api/ must not import from src/ui/"). Verify actual import boundaries with the project-selected analysis tools.
6
- - File organization: avoid god-files and dumping-ground constants. Each file should have one clear responsibility. Split by domain or feature instead (e.g. `user-constants.ts`, `order-types.ts`, `auth-config.ts`). A file that imports from 5+ unrelated modules is a sign it should be split.
6
+ - File organization: the god-files and dumping-ground constants this project has already accumulated, named. The general principle is in `pc-guardrails-generic`; what belongs here is where this codebase keeps breaking it.
7
7
  - Naming conventions: file naming, component naming, API route conventions, branch naming
8
8
  - Code style: formatter config, lint rules, import ordering, max line length. Derive from actual config files.
9
9
  - Testing rules: test file locations, naming, coverage gates, what must be tested before merge
@@ -15,9 +15,14 @@ From the documents and code graph analysis, extract concrete, actionable rules i
15
15
  - Domain-specific rules: anything in `openspec/config.yaml` context or `ARCHITECTURE.md` constraints/risks sections
16
16
 
17
17
  Each rule must be:
18
- - Concrete: "Use `pnpm` not `npm`" not "Use the right package manager"
19
- - Evidence-based: derive from the files/code graph you analyzed, do not invent rules
20
- - Actionable: an agent can check it before acting
18
+
19
+ - **Negative.** State the boundary and what breaks when it is crossed, not the behaviour you want: `Never import Microsoft.EntityFrameworkCore.* in Application; it is a layer violation and the build does not catch it`, not `Keep Application framework-free`. A prohibition removes an option; a preference competes with everything else the model knows about writing code, and loses.
20
+ - **Concrete**: "Use `pnpm` not `npm`" not "Use the right package manager".
21
+ - **Evidence-based**: derived from the files and code graph you analyzed. Never invent a rule the project does not state or demonstrate somewhere.
22
+ - **Not enforced elsewhere.** Skip anything the formatter, linter, type checker, test suite, CI gate or a harness plugin already fails the build on. A rule restating `biome.json` is read on every load and changes nothing: the build was going to catch it. Write the rules that nothing but a careful reader would catch.
23
+ - **Not already in `pc-guardrails-generic`.** That skill loads alongside this one, every request. Secrets, comment discipline, scratch-file location and one-responsibility-per-file are its rules, not this file's.
24
+
25
+ **At most 40 rules, across all categories.** Rank by what a violation costs and cut from the bottom; a category with nothing consequential in it gets no rules at all. This cap is the point of the exercise, not tidiness: compliance falls away as a rule file grows, so the 41st rule does not just cost its own tokens, it dilutes the 40 that matter. If more than 40 survive every bar above, the excess is a sign the project's constraints belong in a linter rule or a CI check instead.
21
26
 
22
27
  ## Skill template
23
28
 
@@ -2,22 +2,41 @@
2
2
 
3
3
  From the project guardrails, architecture, and code analysis, extract concrete, testable risk indicators in these categories. Only include a category if you found real evidence for it.
4
4
 
5
- - **Calculation integrity**: changes to pricing, quoting, or calculation engines; modifications to formula inputs, salary tables, assumptions, or margin waterfalls. Any file under a calculation or quoting namespace is a risk indicator.
5
+ - **Calculation integrity**: changes to whatever this project computes and cannot get wrong — an engine, its formula inputs, its reference tables, its assumptions. Any file under that namespace is an indicator. See the worked example below for the shape.
6
6
  - **Audit & compliance**: modifications to audit appenders, audit log storage, hash-chaining, or tamper-evident mechanisms. Any change that could affect regulatory traceability.
7
7
  - **Authentication & authorization**: changes to auth middleware, permission checks, role definitions, token issuance, or session management. Changes to `.RequirePermission()` calls or permission seed data.
8
8
  - **Data schema & migration**: EF Core entity changes, new migrations, column type changes, constraint additions/removals, or seed data modifications. Schema changes are always risky because they affect production data.
9
- - **Reference data versioning**: changes to effective-dated configuration, salary bands, assumptions, or any "magic number" that affects calculations. Changes to versioning or snapshot logic.
9
+ - **Reference data versioning**: changes to effective-dated configuration, rate or band tables, assumptions, or any constant an output depends on. Changes to versioning or snapshot logic.
10
10
  - **Cross-boundary violations**: imports that break the layering direction (e.g. Domain referencing Application, Application referencing ASP.NET), cross-context data access bypassing ports.
11
11
  - **Security surface**: new endpoints without authorization, input validation removal, secrets exposure, dependency version downgrades, or changes to security scanning configuration.
12
- - **Financial correctness**: any change that could produce incorrect monetary values, incorrect tax calculations, incorrect currency handling, or rounding changes. Money is `decimal` — changes to precision or conversion logic are risk indicators.
12
+ - **Financial correctness**: where the project handles money, any change that could produce a wrong amount — tax, currency, precision, rounding, or the type money is stored in.
13
13
  - **State machine transitions**: modifications to entity lifecycle transitions (e.g. quote status flow, approval gates, sign-off logic). Breaking a state machine can leave data in unrecoverable states.
14
14
  - **Integration contracts**: changes to external API contracts, webhook payloads, or CRM integration ports. Breaking integrations can cascade to downstream systems.
15
15
 
16
16
  Each indicator must be:
17
- - **Concrete**: "Changes to `QuoteCalculator.Calculate`" not "Changes to important calculations"
18
- - **Evidence-based**: derive from the project guardrails, architecture, and actual code paths
19
- - **Detectable**: an AI agent can find it by reading the PR diff (file paths, class names, method names, import changes)
20
- - **Exclusive**: do not duplicate indicators across categories — each belongs in its primary category
17
+
18
+ - **Concrete**: name the type, method or path — "Changes to `OrderTotal.Calculate`" not "Changes to important calculations".
19
+ - **Evidence-based**: derived from the project guardrails, the architecture, and actual code paths.
20
+ - **Detectable**: findable by reading the PR diff alone — file paths, class names, method names, import changes.
21
+ - **Exclusive**: each indicator belongs to one category. Never repeat it in a second.
22
+ - **Not enforced elsewhere.** Skip anything CI already fails the build on. An indicator that duplicates a required check adds a human review the pipeline did not need.
23
+
24
+ **At most 40 indicators, across all categories.** Rank by what a missed regression costs and cut from the bottom. A file this size is read on every merge decision, and past roughly this many, compliance drops regardless of how good each line is — so an indicator that will not change a verdict is worse than absent.
25
+
26
+ ## Worked example
27
+
28
+ One project's calculation-integrity indicator, for shape only. Replace it with
29
+ this repository's own: edits between the `PC-PROJECT-EXAMPLE` markers are
30
+ carried over when the harness updates, and anything outside them is replaced by
31
+ the shipped version.
32
+
33
+ <!-- PC-PROJECT-EXAMPLE-START -->
34
+ ```markdown
35
+ ### Calculation Integrity
36
+ - Any change under `src/pricing/engine/` — `RateEngine.Compute` is static and deterministic, and every change to it needs a golden vector in `PricingParityTests`. A wrong number here is invisible in review and correct-looking in production.
37
+ - Any change to a rate table, band, or assumption constant, including its effective dates. The engine reads them by date, so an edit silently rewrites past outputs.
38
+ ```
39
+ <!-- PC-PROJECT-EXAMPLE-END -->
21
40
 
22
41
  ## Skill template
23
42
 
@@ -1,66 +1,56 @@
1
- ---
2
- name: pc-make-user-model
3
- description: Set the model for a tier (plan, build, or fast). Team-wide or user-local override. Invoked by the /make-user-model command.
4
- license: MIT
5
- ---
6
- Set the concrete model for one tier. Writes to `models` in either the team config (shared, git-tracked) or a user-local override (gitignored).
7
-
8
- Usage:
9
-
10
- ```
11
- /make-user-model <tier> <model>
12
- /make-user-model user <tier> <model>
13
- ```
14
-
15
- - `user`: optional prefix. If present, writes to `.opencode/harness.user.json` (gitignored, overrides team config for this machine only). If absent, writes to `.opencode/harness.json` (shared with the team).
16
- - `<tier>`: one of `plan`, `build`, `fast`.
17
- - `<model>`: a fully-qualified model id (e.g. `opencode/big-pickle`) OR the keyword `current` to use the model active in this session.
18
-
19
- Arguments: `$ARGUMENTS`
20
-
21
- Steps
22
-
23
- 1. Parse `$ARGUMENTS`** by whitespace.
24
- - If first token is `user`: `isUser = true`, `<tier>` = second token, `<model>` = third token.
25
- - Otherwise: `isUser = false`, `<tier>` = first token, `<model>` = second token.
26
- - If `$ARGUMENTS` is empty: read both `.opencode/harness.json` and `.opencode/harness.user.json` and show the current `models` from each (team first, user override second), then show the usage above. Change nothing.
27
- - If `<tier>` is not exactly one of `plan` / `build` / `fast`, or `<model>` is missing: print the usage and stop. Change nothing.
28
-
29
- 2. **Resolve `<model>`:**
30
- - If it is the literal `current`: use the model id visible in the opencode status line for this session. Use only the model id shown there, not a guessed value.
31
- - Otherwise use the value verbatim. It must look like `provider/model-id`. If it contains no `/`, warn that it looks malformed and call the `question` tool to confirm before writing:
32
-
33
- ```json
34
- {
35
- "questions": [
36
- {
37
- "header": "Malformed model id",
38
- "question": "\"<model>\" doesn't look like a valid model id (expected provider/model-id). Write it anyway?",
39
- "options": [
40
- { "label": "yes", "description": "Write the value as-is to the config file." },
41
- { "label": "no", "description": "Cancel. Do not write anything." }
42
- ]
43
- }
44
- ]
45
- }
46
- ```
47
-
48
- Only proceed to write if the user answers `yes`.
49
-
50
- 3. Determine target file.
51
- - `isUser = false` -> `.opencode/harness.json` (team). If it does not exist, stop and tell the user onboarding has not generated it yet.
52
- - `isUser = true` -> `.opencode/harness.user.json` (user override). If it does not exist, create it with `{ "models": {} }`.
53
-
54
- 4. Update the config. Read the target file, set `models.<tier>` to the resolved model id (create `models` if absent). Do not touch any other field. Preserve the existing 2-space JSON formatting, then write the file back.
55
-
56
- 5. Confirm:
57
-
58
- ```
59
- <team|user> config updated
60
- <tier> model -> <resolved-id>
61
- file: <path written>
62
- ```
63
-
64
- Restart opencode for the change to take effect. The `pc-subagent-tiers` plugin reads the model configs at startup and injects tier-suffixed agent variants (`<engineer>.<tier>`) into the live config. After restart, `/plan-apply` will spawn agents on the new model.
65
-
66
- This command edits `harness.json` (team) or `harness.user.json` (user) only. It never modifies agent files, `opencode.json`, or `tasks.md`. Tier variants are generated in-memory by the `pc-subagent-tiers` plugin at startup: no file re-stamping needed.
1
+ ---
2
+ name: pc-make-user-model
3
+ description: Set the model for a tier (plan, build, or fast). Team-wide or user-local override. Invoked by the /make-user-model command.
4
+ license: MIT
5
+ ---
6
+
7
+ Point one tier at one model, in the team config or in a machine-local override.
8
+
9
+ ## Rules
10
+
11
+ - Only `models.<tier>` in `.opencode/harness.json` or `.opencode/harness.user.json` changes. Agent files, `opencode.jsonc` and `tasks.md` are not this command's business, and tier variants are rebuilt from these configs at startup anyway.
12
+ - Never guess the id behind `current`: read it from the status line. A guessed id writes a model that does not exist into the team's config.
13
+ - Never write anything when the arguments do not parse. Print the usage and stop.
14
+ - Preserve the file's other fields and its 2-space formatting.
15
+
16
+ ## Contract
17
+
18
+ ```
19
+ /make-user-model <tier> <model>
20
+ /make-user-model user <tier> <model>
21
+ ```
22
+
23
+ `user` writes `.opencode/harness.user.json`, which is gitignored and wins on this machine only; without it the target is `.opencode/harness.json`, which is shared. `<tier>` is exactly `plan`, `build` or `fast`. `<model>` is a fully-qualified id (`opencode/big-pickle`) or `current` for the model this session is running.
24
+
25
+ No arguments means show the `models` block from both files, team first, then the usage. Change nothing.
26
+
27
+ A team config that does not exist yet is a stop: onboarding has not run. A missing user config is created as `{ "models": {} }`.
28
+
29
+ An id with no `/` in it is malformed; confirm before writing it:
30
+
31
+ ```json
32
+ {
33
+ "questions": [
34
+ {
35
+ "header": "Malformed model id",
36
+ "question": "\"<model>\" doesn't look like a valid model id (expected provider/model-id). Write it anyway?",
37
+ "options": [
38
+ { "label": "yes", "description": "Write the value as-is to the config file." },
39
+ { "label": "no", "description": "Cancel. Do not write anything." }
40
+ ]
41
+ }
42
+ ]
43
+ }
44
+ ```
45
+
46
+ ## Report
47
+
48
+ ```
49
+ <team|user> config updated
50
+ <tier> model -> <resolved-id>
51
+ file: <path written>
52
+ ```
53
+
54
+ The change lands on the next opencode start, when `pc-subagent-tiers` reads the configs and rebuilds the tier variants.
55
+
56
+ Arguments: `$ARGUMENTS`