@glrs-dev/harness-plugin-opencode 0.2.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 (128) hide show
  1. package/CHANGELOG.md +720 -0
  2. package/LICENSE +21 -0
  3. package/README.md +353 -0
  4. package/SECURITY.md +89 -0
  5. package/dist/agents/prompts/agents-md-writer.md +89 -0
  6. package/dist/agents/prompts/architecture-advisor.md +46 -0
  7. package/dist/agents/prompts/build.md +93 -0
  8. package/dist/agents/prompts/code-searcher.md +54 -0
  9. package/dist/agents/prompts/docs-maintainer.md +128 -0
  10. package/dist/agents/prompts/gap-analyzer.md +44 -0
  11. package/dist/agents/prompts/lib-reader.md +39 -0
  12. package/dist/agents/prompts/pilot-builder.md +107 -0
  13. package/dist/agents/prompts/pilot-planner.md +153 -0
  14. package/dist/agents/prompts/plan-reviewer.md +49 -0
  15. package/dist/agents/prompts/plan.md +144 -0
  16. package/dist/agents/prompts/prime.md +374 -0
  17. package/dist/agents/prompts/qa-reviewer.md +68 -0
  18. package/dist/agents/prompts/qa-thorough.md +63 -0
  19. package/dist/agents/prompts/research.md +138 -0
  20. package/dist/agents/shared/index.ts +26 -0
  21. package/dist/agents/shared/workflow-mechanics.md +32 -0
  22. package/dist/bin/memory-mcp-launcher.sh +145 -0
  23. package/dist/bin/plan-check.sh +255 -0
  24. package/dist/chunk-VJUETC6A.js +205 -0
  25. package/dist/chunk-VVMP6QWS.js +731 -0
  26. package/dist/chunk-XCZ3NOXR.js +703 -0
  27. package/dist/cli.d.ts +1 -0
  28. package/dist/cli.js +5096 -0
  29. package/dist/commands/prompts/autopilot.md +96 -0
  30. package/dist/commands/prompts/costs.md +94 -0
  31. package/dist/commands/prompts/fresh.md +382 -0
  32. package/dist/commands/prompts/init-deep.md +196 -0
  33. package/dist/commands/prompts/research.md +27 -0
  34. package/dist/commands/prompts/review.md +96 -0
  35. package/dist/commands/prompts/ship.md +104 -0
  36. package/dist/index.d.ts +21 -0
  37. package/dist/index.js +2092 -0
  38. package/dist/install-4EYR56OR.js +9 -0
  39. package/dist/skills/agent-estimation/SKILL.md +159 -0
  40. package/dist/skills/paths.ts +18 -0
  41. package/dist/skills/pilot-planning/SKILL.md +49 -0
  42. package/dist/skills/pilot-planning/rules/dag-shape.md +47 -0
  43. package/dist/skills/pilot-planning/rules/decomposition.md +36 -0
  44. package/dist/skills/pilot-planning/rules/first-principles.md +29 -0
  45. package/dist/skills/pilot-planning/rules/milestones.md +57 -0
  46. package/dist/skills/pilot-planning/rules/self-review.md +46 -0
  47. package/dist/skills/pilot-planning/rules/task-context.md +47 -0
  48. package/dist/skills/pilot-planning/rules/touches-scope.md +47 -0
  49. package/dist/skills/pilot-planning/rules/verify-design.md +53 -0
  50. package/dist/skills/research/SKILL.md +350 -0
  51. package/dist/skills/research-auto/SKILL.md +283 -0
  52. package/dist/skills/research-local/SKILL.md +268 -0
  53. package/dist/skills/research-web/SKILL.md +119 -0
  54. package/dist/skills/review-plan/SKILL.md +32 -0
  55. package/dist/skills/vercel-composition-patterns/AGENTS.md +946 -0
  56. package/dist/skills/vercel-composition-patterns/README.md +60 -0
  57. package/dist/skills/vercel-composition-patterns/SKILL.md +89 -0
  58. package/dist/skills/vercel-composition-patterns/rules/architecture-avoid-boolean-props.md +100 -0
  59. package/dist/skills/vercel-composition-patterns/rules/architecture-compound-components.md +112 -0
  60. package/dist/skills/vercel-composition-patterns/rules/patterns-children-over-render-props.md +87 -0
  61. package/dist/skills/vercel-composition-patterns/rules/patterns-explicit-variants.md +100 -0
  62. package/dist/skills/vercel-composition-patterns/rules/react19-no-forwardref.md +42 -0
  63. package/dist/skills/vercel-composition-patterns/rules/state-context-interface.md +191 -0
  64. package/dist/skills/vercel-composition-patterns/rules/state-decouple-implementation.md +113 -0
  65. package/dist/skills/vercel-composition-patterns/rules/state-lift-state.md +125 -0
  66. package/dist/skills/vercel-react-best-practices/AGENTS.md +2975 -0
  67. package/dist/skills/vercel-react-best-practices/README.md +123 -0
  68. package/dist/skills/vercel-react-best-practices/SKILL.md +137 -0
  69. package/dist/skills/vercel-react-best-practices/rules/advanced-event-handler-refs.md +55 -0
  70. package/dist/skills/vercel-react-best-practices/rules/advanced-init-once.md +42 -0
  71. package/dist/skills/vercel-react-best-practices/rules/advanced-use-latest.md +39 -0
  72. package/dist/skills/vercel-react-best-practices/rules/async-api-routes.md +38 -0
  73. package/dist/skills/vercel-react-best-practices/rules/async-defer-await.md +80 -0
  74. package/dist/skills/vercel-react-best-practices/rules/async-dependencies.md +51 -0
  75. package/dist/skills/vercel-react-best-practices/rules/async-parallel.md +28 -0
  76. package/dist/skills/vercel-react-best-practices/rules/async-suspense-boundaries.md +99 -0
  77. package/dist/skills/vercel-react-best-practices/rules/bundle-barrel-imports.md +59 -0
  78. package/dist/skills/vercel-react-best-practices/rules/bundle-conditional.md +31 -0
  79. package/dist/skills/vercel-react-best-practices/rules/bundle-defer-third-party.md +49 -0
  80. package/dist/skills/vercel-react-best-practices/rules/bundle-dynamic-imports.md +35 -0
  81. package/dist/skills/vercel-react-best-practices/rules/bundle-preload.md +50 -0
  82. package/dist/skills/vercel-react-best-practices/rules/client-event-listeners.md +74 -0
  83. package/dist/skills/vercel-react-best-practices/rules/client-localstorage-schema.md +71 -0
  84. package/dist/skills/vercel-react-best-practices/rules/client-passive-event-listeners.md +48 -0
  85. package/dist/skills/vercel-react-best-practices/rules/client-swr-dedup.md +56 -0
  86. package/dist/skills/vercel-react-best-practices/rules/js-batch-dom-css.md +107 -0
  87. package/dist/skills/vercel-react-best-practices/rules/js-cache-function-results.md +80 -0
  88. package/dist/skills/vercel-react-best-practices/rules/js-cache-property-access.md +28 -0
  89. package/dist/skills/vercel-react-best-practices/rules/js-cache-storage.md +70 -0
  90. package/dist/skills/vercel-react-best-practices/rules/js-combine-iterations.md +32 -0
  91. package/dist/skills/vercel-react-best-practices/rules/js-early-exit.md +50 -0
  92. package/dist/skills/vercel-react-best-practices/rules/js-hoist-regexp.md +45 -0
  93. package/dist/skills/vercel-react-best-practices/rules/js-index-maps.md +37 -0
  94. package/dist/skills/vercel-react-best-practices/rules/js-length-check-first.md +49 -0
  95. package/dist/skills/vercel-react-best-practices/rules/js-min-max-loop.md +82 -0
  96. package/dist/skills/vercel-react-best-practices/rules/js-set-map-lookups.md +24 -0
  97. package/dist/skills/vercel-react-best-practices/rules/js-tosorted-immutable.md +57 -0
  98. package/dist/skills/vercel-react-best-practices/rules/rendering-activity.md +26 -0
  99. package/dist/skills/vercel-react-best-practices/rules/rendering-animate-svg-wrapper.md +47 -0
  100. package/dist/skills/vercel-react-best-practices/rules/rendering-conditional-render.md +40 -0
  101. package/dist/skills/vercel-react-best-practices/rules/rendering-content-visibility.md +38 -0
  102. package/dist/skills/vercel-react-best-practices/rules/rendering-hoist-jsx.md +46 -0
  103. package/dist/skills/vercel-react-best-practices/rules/rendering-hydration-no-flicker.md +82 -0
  104. package/dist/skills/vercel-react-best-practices/rules/rendering-hydration-suppress-warning.md +30 -0
  105. package/dist/skills/vercel-react-best-practices/rules/rendering-svg-precision.md +28 -0
  106. package/dist/skills/vercel-react-best-practices/rules/rendering-usetransition-loading.md +75 -0
  107. package/dist/skills/vercel-react-best-practices/rules/rerender-defer-reads.md +39 -0
  108. package/dist/skills/vercel-react-best-practices/rules/rerender-dependencies.md +45 -0
  109. package/dist/skills/vercel-react-best-practices/rules/rerender-derived-state-no-effect.md +40 -0
  110. package/dist/skills/vercel-react-best-practices/rules/rerender-derived-state.md +29 -0
  111. package/dist/skills/vercel-react-best-practices/rules/rerender-functional-setstate.md +74 -0
  112. package/dist/skills/vercel-react-best-practices/rules/rerender-lazy-state-init.md +58 -0
  113. package/dist/skills/vercel-react-best-practices/rules/rerender-memo-with-default-value.md +38 -0
  114. package/dist/skills/vercel-react-best-practices/rules/rerender-memo.md +44 -0
  115. package/dist/skills/vercel-react-best-practices/rules/rerender-move-effect-to-event.md +45 -0
  116. package/dist/skills/vercel-react-best-practices/rules/rerender-simple-expression-in-memo.md +35 -0
  117. package/dist/skills/vercel-react-best-practices/rules/rerender-transitions.md +40 -0
  118. package/dist/skills/vercel-react-best-practices/rules/rerender-use-ref-transient-values.md +73 -0
  119. package/dist/skills/vercel-react-best-practices/rules/server-after-nonblocking.md +73 -0
  120. package/dist/skills/vercel-react-best-practices/rules/server-auth-actions.md +96 -0
  121. package/dist/skills/vercel-react-best-practices/rules/server-cache-lru.md +41 -0
  122. package/dist/skills/vercel-react-best-practices/rules/server-cache-react.md +76 -0
  123. package/dist/skills/vercel-react-best-practices/rules/server-dedup-props.md +65 -0
  124. package/dist/skills/vercel-react-best-practices/rules/server-hoist-static-io.md +142 -0
  125. package/dist/skills/vercel-react-best-practices/rules/server-parallel-fetching.md +83 -0
  126. package/dist/skills/vercel-react-best-practices/rules/server-serialization.md +38 -0
  127. package/dist/skills/web-design-guidelines/SKILL.md +39 -0
  128. package/package.json +70 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Austin Hess
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,353 @@
1
+ # @glrs-dev/harness-plugin-opencode
2
+
3
+ Opinionated agent harness for [OpenCode](https://opencode.ai). Agents, tools, slash commands, and an unattended pilot mode — one package.
4
+
5
+ ## Quick start
6
+
7
+ ### CLI (recommended)
8
+
9
+ ```bash
10
+ bun add -g @glrs-dev/harness-plugin-opencode
11
+ glrs-oc install-plugin
12
+ opencode
13
+ ```
14
+
15
+ Gives you the full CLI (`glrs-oc`) plus all [plugin features](#what-the-plugin-provides) inside OpenCode.
16
+
17
+ ### Plugin only
18
+
19
+ ```bash
20
+ bunx @glrs-dev/harness-plugin-opencode install
21
+ opencode
22
+ ```
23
+
24
+ No global install. All [plugin features](#what-the-plugin-provides) load automatically. You won't have the `glrs-oc` CLI, but pilot commands will offer to install the plugin if you add the CLI later.
25
+
26
+ ### Verifying the published tarball
27
+
28
+ This package publishes with [npm provenance](https://docs.npmjs.com/generating-provenance-statements) via GitHub Actions OIDC. After installing, verify the provenance chain:
29
+
30
+ ```bash
31
+ npm audit signatures
32
+ ```
33
+
34
+ This confirms the tarball on npm was built from this repo's `release.yml` workflow on the canonical main branch — a malicious publish with a stolen npm token would fail this check.
35
+
36
+ ## The Glorious workflow
37
+
38
+ ### Interactive (plugin)
39
+
40
+ Open OpenCode in any repo. The `prime` agent handles everything end-to-end.
41
+
42
+ **Start a task from a ticket:**
43
+ ```
44
+ /fresh ENG-1234
45
+ ```
46
+ Wipes the worktree, creates a branch from the ticket ref, and begins the five-phase workflow: understand → plan → execute → verify → handoff.
47
+
48
+ **Start a task from a description:**
49
+ ```
50
+ /fresh add rate limiting to the upload endpoint
51
+ ```
52
+
53
+ **Go hands-off after the plan looks good:**
54
+ ```
55
+ /autopilot ENG-1234
56
+ ```
57
+ Runs the full workflow unattended. Stops when all acceptance criteria are checked off. You review, then `/ship`.
58
+
59
+ **Ship when done:**
60
+ ```
61
+ /ship ~/.glorious/opencode/repo/plans/feat-rate-limit.md
62
+ ```
63
+ Squashes commits, pushes, opens a PR with the plan as the body.
64
+
65
+ **Review a PR:**
66
+ ```
67
+ /review 87
68
+ ```
69
+ Read-only adversarial review. Fetches the diff, runs typecheck/lint, delegates to `@qa-reviewer`, outputs a structured verdict.
70
+
71
+ **Deep codebase research:**
72
+ ```
73
+ /research how does authentication work in this codebase?
74
+ ```
75
+ Spawns parallel subagents, synthesizes findings with exact file:line references.
76
+
77
+ ### Unattended (pilot CLI)
78
+
79
+ For larger work that decomposes into a multi-task DAG. Each task runs in an isolated git worktree with its own verify commands.
80
+
81
+ ```bash
82
+ # Plan interactively — spawns OpenCode TUI with the pilot-planner agent
83
+ glrs-oc pilot plan "Refactor the billing module into separate services"
84
+
85
+ # Validate the plan (schema, DAG, glob conflicts)
86
+ glrs-oc pilot validate
87
+
88
+ # Execute — fully unattended, isolated worktrees, topological order
89
+ glrs-oc pilot build
90
+
91
+ # Check progress
92
+ glrs-oc pilot status
93
+ ```
94
+
95
+ See [Pilot mode](#pilot-mode) for the full command reference.
96
+
97
+ ---
98
+
99
+ ## What the plugin provides
100
+
101
+ 14 agents, 7 slash commands, 5 tools, 5 MCPs, 5 skill bundles, 4 sub-plugins. Details below.
102
+
103
+ ### Agents
104
+
105
+ | Agent | Tier | Role |
106
+ |-------|------|------|
107
+ | `prime` | deep | Five-phase end-to-end workflow (default agent) |
108
+ | `plan` | deep | Interactive planner with gap analysis and adversarial review |
109
+ | `build` | mid | Plan executor |
110
+ | `qa-reviewer` | mid | Fast adversarial code review |
111
+ | `qa-thorough` | deep | Full-suite adversarial review |
112
+ | `plan-reviewer` | deep | Adversarial plan review |
113
+ | `gap-analyzer` | deep | Identifies gaps in plans |
114
+ | `architecture-advisor` | deep | Architecture guidance |
115
+ | `code-searcher` | fast | Codebase search specialist |
116
+ | `docs-maintainer` | mid | Documentation updates |
117
+ | `lib-reader` | mid | Library/dependency reader |
118
+ | `agents-md-writer` | mid | AGENTS.md generation |
119
+ | `pilot-builder` | mid | Unattended task executor (pilot subsystem) |
120
+ | `pilot-planner` | deep | Decomposes work into pilot.yaml DAGs |
121
+
122
+ Tiers: **deep** = opus-class, **mid** = sonnet-class, **fast** = haiku-class. Override with [`harness.models`](#model-overrides).
123
+
124
+ ### Slash commands
125
+
126
+ | Command | What it does |
127
+ |---------|-------------|
128
+ | `/fresh <ref>` | Wipe worktree, branch from ticket or description, start PRIME |
129
+ | `/autopilot <ref>` | Hands-off PRIME run; stops when acceptance criteria pass |
130
+ | `/ship <plan>` | Squash, push, open PR |
131
+ | `/review <target>` | Read-only adversarial review (PR#, SHA, branch, or file) |
132
+ | `/research <topic>` | Parallel codebase exploration with file:line citations |
133
+ | `/init-deep` | Generate hierarchical AGENTS.md files |
134
+ | `/costs` | Show running LLM spend totals |
135
+
136
+ ### Tools
137
+
138
+ `ast_grep` · `tsc_check` · `eslint_check` · `todo_scan` · `comment_check`
139
+
140
+ ### MCP servers
141
+
142
+ | Server | Status | Backend |
143
+ |--------|--------|---------|
144
+ | `serena` | enabled | AST code intelligence via `uvx` |
145
+ | `memory` | enabled | Per-repo JSON memory |
146
+ | `git` | enabled | Structured blame/log via `uvx` |
147
+ | `playwright` | disabled | Browser automation — enable in opencode.json |
148
+ | `linear` | disabled | Linear issue tracker — enable in opencode.json |
149
+
150
+ ### Sub-plugins
151
+
152
+ - **autopilot** — idle-nudge loop driver (only activates via `/autopilot`)
153
+ - **notify** — OS notifications when the agent asks a question
154
+ - **cost-tracker** — LLM spend by provider/model at `~/.glorious/opencode/costs.json`
155
+ - **pilot-plugin** — runtime invariant enforcement for pilot agents
156
+
157
+ ### Skills
158
+
159
+ `review-plan` · `web-design-guidelines` · `vercel-react-best-practices` · `vercel-composition-patterns` · `pilot-planning`
160
+
161
+ ---
162
+
163
+ ## Pilot mode
164
+
165
+ Runs a `pilot.yaml` task DAG fully unattended. Tasks have dependencies, touch-globs (file ownership), and verify commands. The worker executes them in topological order, each in an isolated git worktree.
166
+
167
+ **Prerequisites:** `git` >= 2.5, `opencode` on PATH. Plugin must be installed (auto-prompted if missing).
168
+
169
+ ### Commands
170
+
171
+ | Command | Description |
172
+ |---------|-------------|
173
+ | `glrs-oc pilot plan [input]` | Spawn OpenCode TUI with `pilot-planner`. Input: Linear ID, GitHub URL, or text. |
174
+ | `glrs-oc pilot validate [path]` | Schema + DAG + glob validation. Defaults to newest plan. |
175
+ | `glrs-oc pilot build` | Execute the plan. `--plan <path>`, `--dry-run`, `--filter <id>`. |
176
+ | `glrs-oc pilot status` | Task statuses for the current run. `--run <id>`, `--json`. |
177
+ | `glrs-oc pilot resume` | Continue a partial run. Skips succeeded tasks. |
178
+ | `glrs-oc pilot retry <task>` | Reset one task to pending. `--run-now` to re-execute immediately. |
179
+ | `glrs-oc pilot logs <task>` | Events and verify output for a task. |
180
+ | `glrs-oc pilot worktrees list\|prune` | Manage pilot's git worktrees. |
181
+ | `glrs-oc pilot cost` | Per-task and total LLM cost. `--json`. |
182
+ | `glrs-oc pilot plan-dir` | Print the plans directory path. |
183
+
184
+ ### State storage
185
+
186
+ ```
187
+ ~/.glorious/opencode/<repo>/pilot/
188
+ plans/ # YAML plans
189
+ runs/<runId>/
190
+ state.db # SQLite (runs, tasks, events)
191
+ workers/00.jsonl # structured logs
192
+ worktrees/<runId>/00/ # isolated git worktree
193
+ ```
194
+
195
+ Repo identity derived from `git rev-parse --git-common-dir` — worktrees of the same repo share state. Override with `$GLORIOUS_PILOT_DIR`.
196
+
197
+ > **v0.1:** single worker only. `--workers >1` clamps to 1. Parallel scheduling deferred to v0.3+.
198
+
199
+ ---
200
+
201
+ ## Configuration
202
+
203
+ ### Model overrides
204
+
205
+ Override all agents in a tier, or target specific agents, via `harness.models` in `opencode.json`:
206
+
207
+ ```json
208
+ {
209
+ "harness": {
210
+ "models": {
211
+ "deep": ["bedrock/claude-opus-4"],
212
+ "mid": ["bedrock/claude-sonnet-4"],
213
+ "fast": ["bedrock/claude-haiku-4"],
214
+ "prime": ["my-custom-model"]
215
+ }
216
+ }
217
+ }
218
+ ```
219
+
220
+ **Precedence:** per-agent `harness.models.X` > tier `harness.models.deep` > plugin default. Direct `agent.<name>.model` in opencode.json wins over all.
221
+
222
+ ### Agent/command/MCP overrides
223
+
224
+ Your opencode.json values win. Example:
225
+
226
+ ```json
227
+ {
228
+ "agent": {
229
+ "prime": { "model": "anthropic/claude-sonnet-4-6" }
230
+ }
231
+ }
232
+ ```
233
+
234
+ ### Enabling optional MCPs
235
+
236
+ ```json
237
+ {
238
+ "mcp": {
239
+ "playwright": { "enabled": true },
240
+ "linear": { "enabled": true }
241
+ }
242
+ }
243
+ ```
244
+
245
+ ---
246
+
247
+ ## CLI reference
248
+
249
+ | Command | Description |
250
+ |---------|-------------|
251
+ | `glrs-oc install-plugin [--pin] [--dry-run]` | Register plugin in opencode.json |
252
+ | `glrs-oc uninstall [--dry-run]` | Remove plugin from opencode.json |
253
+ | `glrs-oc doctor` | Check installation health |
254
+ | `glrs-oc pilot <verb>` | [Pilot mode](#pilot-mode) |
255
+ | `glrs-oc plan-dir` | Print repo-shared plan directory |
256
+ | `glrs-oc plan-check <path>` | Validate legacy markdown plan files |
257
+
258
+ `install` is an alias for `install-plugin`.
259
+
260
+ ---
261
+
262
+ ## Maintenance
263
+
264
+ **Update:**
265
+ ```bash
266
+ bun update -g @glrs-dev/harness-plugin-opencode
267
+ ```
268
+
269
+ **Pin version:** `glrs-oc install-plugin --pin`
270
+
271
+ **Rollback:** `npm deprecate @glrs-dev/harness-plugin-opencode@<broken> "<reason>"` — then ship a patch.
272
+
273
+ **Uninstall:**
274
+ ```bash
275
+ glrs-oc uninstall # remove from opencode.json
276
+ bun remove -g @glrs-dev/harness-plugin-opencode # remove CLI
277
+ ```
278
+
279
+ ## Prerequisites
280
+
281
+ - [OpenCode](https://opencode.ai)
282
+ - `bun`
283
+ - `uvx` for serena + git MCPs (`brew install uv`)
284
+ - `node`/`npx` for memory MCP
285
+ - `git` >= 2.5 for pilot worktrees
286
+
287
+ ## Security & threat boundaries
288
+
289
+ Report vulnerabilities privately per [`SECURITY.md`](./SECURITY.md) — do NOT open a public issue. Expected response: acknowledge within 72h, fix-or-disclose decision within 30 days.
290
+
291
+ ### What this plugin can do on your machine
292
+
293
+ This is a plugin with broad local-machine access. Install it deliberately:
294
+
295
+ - **Reads and writes files** under your home directory (`~/.config/opencode/opencode.json`, `~/.cache/harness-opencode/*`, `~/.config/harness-opencode/install-id`, `~/.glorious/opencode/<repo>/pilot/*`).
296
+ - **Runs local subprocesses** during normal operation: `git`, `gh`, `npm`/`bun`, `ast-grep`, `tsc`, `opencode`, and project-specific verify commands from any `pilot.yaml` you author.
297
+ - **Makes outbound HTTPS calls** (all opt-out-able):
298
+ - `registry.npmjs.org` — daily version check. Opt out: `HARNESS_OPENCODE_UPDATE_CHECK=0`.
299
+ - `catwalk.charm.land` — model catalog during interactive install only. Response is schema-validated before it reaches your `opencode.json`.
300
+ - `us.aptabase.com` — anonymous telemetry. Opt out: `HARNESS_OPENCODE_TELEMETRY=0`, `DO_NOT_TRACK=1`, or `CI=true`.
301
+ - **Configures MCP servers** in your OpenCode config that, on first use, download third-party code via `uvx` (Serena, `mcp-server-git`) or `npx` (`@playwright/mcp`, `@modelcontextprotocol/server-memory`). These MCPs run in their own subprocesses. Review them before enabling ones that ship disabled by default (`playwright`, `linear`).
302
+
303
+ ### What is NOT a sandbox
304
+
305
+ The agent-bash **deny-list** in `src/agents/index.ts` (`rm -rf /*`, `chmod *`, `sudo *`, force-push variants, etc.) is a safety rail for common mistakes, not a sandbox. An agent can still:
306
+
307
+ - Read any file the user can read (including `~/.ssh/id_*`, `~/.aws/credentials`, etc.).
308
+ - Pipe arbitrary code to a shell (e.g., `curl <url> | sh`).
309
+ - Modify shell startup files (`.zshrc`, `.bashrc`) or your PATH.
310
+ - Run `npx <malicious-package>` and similar network-fetched executables.
311
+
312
+ If a prompt (your own, or an injected one from a web page, issue comment, or MCP response) tells the agent to do something malicious, the deny-list will not block many of the paths. Treat the agent like a junior dev with unrestricted shell access — be careful what you paste into the prompt, and do not run this plugin on machines with credentials you cannot afford to rotate.
313
+
314
+ A future release may sandbox the bash surface (filesystem allow-list, egress filter). Until then, the boundary is documented, not enforced.
315
+
316
+ ### What this plugin does NOT do
317
+
318
+ - It does NOT ship any postinstall scripts. `bun add @glrs-dev/harness-plugin-opencode` mutates only `node_modules/`. All filesystem changes to your config happen in the explicit `glrs-oc install` / `bunx @glrs-dev/harness-plugin-opencode install` step.
319
+ - It does NOT write to `~/.config/opencode/agents/`, `~/.config/opencode/commands/`, `~/.config/opencode/skills/`, or `~/.config/opencode/tools/`. Agents, commands, and skills live in `node_modules` (read-only by design). The only config write is `~/.config/opencode/opencode.json` during `install`.
320
+ - It does NOT exfiltrate code, prompts, file paths, error messages, usernames, project names, or git remotes via telemetry. See the allow-list in `src/telemetry.ts`.
321
+
322
+ ## Privacy & Telemetry
323
+
324
+ **Update check.** Daily version check against `registry.npmjs.org`. Opt out: `HARNESS_OPENCODE_UPDATE_CHECK=0`.
325
+
326
+ **Catwalk model catalog.** During interactive `install` only, fetches the provider list from `catwalk.charm.land/v2/providers`. The response is schema-validated (see `src/cli/catwalk.ts`) before any value reaches your `opencode.json`. If validation fails, the installer falls back to built-in presets.
327
+
328
+ **Telemetry.** `@glrs-dev/harness-plugin-opencode` collects anonymous usage data via [Aptabase](https://aptabase.com) to help improve reliability. The data is opt-out, contains no personal information, and has no stable user identifier — Aptabase tracks anonymous sessions only.
329
+
330
+ **What gets sent:** package version, OS, Node version, which tools were invoked (hashline, serena, memory, custom tools), tool durations, file extensions of edited files (e.g. `.ts`), edit success/failure outcomes, and hashline mismatch rates.
331
+
332
+ **What never gets sent:** file paths, file contents, code, prompts, model outputs, error messages, project names, git remotes, usernames, or anything that could identify a user or codebase.
333
+
334
+ To disable, set any of these in your shell:
335
+
336
+ ```bash
337
+ export HARNESS_OPENCODE_TELEMETRY=0
338
+ export DO_NOT_TRACK=1 # standard cross-tool opt-out
339
+ ```
340
+
341
+ Telemetry is also automatically disabled when `CI=true`.
342
+
343
+ ## Migrating from clone+symlink install
344
+
345
+ See [docs/migration-from-clone-install.md](docs/migration-from-clone-install.md).
346
+
347
+ ## Contributing
348
+
349
+ Read [`AGENTS.md`](./AGENTS.md) and [`CONTRIBUTING.md`](./CONTRIBUTING.md). All user-visible PRs need a changeset (`bunx changeset`).
350
+
351
+ ## License
352
+
353
+ MIT
package/SECURITY.md ADDED
@@ -0,0 +1,89 @@
1
+ # Security Policy
2
+
3
+ Thank you for helping keep `@glrs-dev/harness-plugin-opencode` and the people who use it safe. This document describes how to report a vulnerability, what versions we fix, and what is in scope.
4
+
5
+ ## Supported versions
6
+
7
+ We publish fixes for the **latest minor** during the 0.x cadence. Older minors do not receive backports.
8
+
9
+ | Version | Supported |
10
+ | ------- | --------- |
11
+ | 0.x (latest minor) | ✅ |
12
+ | 0.x (older minors) | ❌ |
13
+
14
+ Once 1.0 ships, this table will track supported major lines instead.
15
+
16
+ ## Reporting a vulnerability
17
+
18
+ **Please do not open a public GitHub issue for security bugs.**
19
+
20
+ Use one of these private channels:
21
+
22
+ 1. **Preferred — GitHub private vulnerability reporting:** go to the [Security tab](https://github.com/iceglober/glrs/security/advisories/new) and open a new advisory. This gives us a private thread with tracking, severity fields, and a path to issue a CVE if applicable.
23
+ 2. **Fallback — email:** `austin@glorious.dev`. Use PGP if you have a key; otherwise plain email is fine. Include the word `SECURITY` in the subject.
24
+
25
+ Please include:
26
+
27
+ - A description of the issue and why it matters (threat, impact).
28
+ - Steps to reproduce, ideally a minimal repro or a failing test.
29
+ - Affected version(s). Check with `npm view @glrs-dev/harness-plugin-opencode version` if unsure.
30
+ - Your disclosure timeline preference, if you have one.
31
+
32
+ ## Our response SLA
33
+
34
+ These are honest numbers for a small maintainer footprint. We will keep them:
35
+
36
+ - **Acknowledge your report:** within **72 hours**.
37
+ - **Triage (confirmed / not a vuln / needs more info):** within **7 days**.
38
+ - **Fix-or-disclose decision + timeline:** within **30 days** of acknowledgement.
39
+
40
+ If a vulnerability is confirmed and fixed, we will publish a GitHub security advisory and an `npm deprecate` notice for affected versions.
41
+
42
+ ## Scope
43
+
44
+ **In scope:**
45
+
46
+ - The published npm tarball (`@glrs-dev/harness-plugin-opencode`).
47
+ - CLI subcommands (`glrs-oc`, `harness-opencode`): `install`, `uninstall`, `doctor`, `plan-dir`, `plan-check`, `pilot`.
48
+ - Plugin hooks registered via the OpenCode plugin API (`config`, `tool.execute.before/after`, `session.idle`, etc.).
49
+ - The MCP config writer (`src/cli/install.ts`, `src/mcp/index.ts`) and the `opencode.json` merge logic (`src/cli/merge-config.ts`).
50
+ - Outbound network calls the plugin makes on its own:
51
+ - `https://registry.npmjs.org/` — daily update check (opt-out: `HARNESS_OPENCODE_UPDATE_CHECK=0`).
52
+ - `https://catwalk.charm.land/` — model catalog fetch during interactive install.
53
+ - `https://us.aptabase.com/` — anonymous telemetry (opt-out: `HARNESS_OPENCODE_TELEMETRY=0`, `DO_NOT_TRACK=1`, or `CI=true`).
54
+
55
+ **Out of scope (will not be treated as vulnerabilities in this package):**
56
+
57
+ - User-authored `pilot.yaml` files: the pilot verify-runner executes user-supplied shell commands by design. Malicious `pilot.yaml` contents are the user's responsibility to review.
58
+ - **Third-party MCP upstreams** the plugin configures (Serena, mcp-server-git, `@playwright/mcp`, `@modelcontextprotocol/server-memory`, Linear MCP): these run in the user's MCP shell and are outside this package's boundary. Report issues to their respective maintainers.
59
+ - **Agent bash permission patterns** (`CORE_DESTRUCTIVE_BASH_DENIES` in `src/agents/index.ts`): the deny-list is a safety rail for common mistakes, not a sandbox. An agent (or prompt injection that reaches one) can exfiltrate files, call network endpoints, or mutate the shell via constructs the deny-list does not match (shell expansion, piping to curl, etc.). This is a documented property of the threat model; see `docs/THREAT_MODEL.md` (when published) or the README's Threat boundaries section.
60
+ - Decisions made by the underlying LLM. If a model follows a malicious instruction, that's a model/prompt issue, not a plugin issue. Defense-in-depth against prompt injection is welcome via the private reporting channel but will typically be triaged as a feature request.
61
+ - Vulnerabilities in Node.js, Bun, npm, git, `uvx`, `npx`, or other tools the plugin invokes via `execFile`/subprocess. Report to their maintainers; we will update our pinned/required versions if a fix affects us.
62
+
63
+ ## Safe harbor
64
+
65
+ We will not pursue legal action against security researchers who:
66
+
67
+ - Make a good-faith effort to avoid privacy violations, data destruction, and service interruption.
68
+ - Report through the private channels above and give us reasonable time to fix before disclosing publicly.
69
+ - Do not exploit the issue beyond what's necessary to demonstrate it.
70
+ - Do not access, modify, or exfiltrate data that is not clearly theirs.
71
+
72
+ If you are unsure whether your planned research falls within this safe harbor, ask first at the private channels above.
73
+
74
+ ## Coordinated disclosure & credit
75
+
76
+ Unless you opt out, we will credit you by name (or chosen handle) in:
77
+
78
+ - The GitHub security advisory for the fix.
79
+ - The `CHANGELOG.md` entry.
80
+
81
+ ## Out-of-tree security concerns
82
+
83
+ Use GitHub issues (public) for:
84
+
85
+ - Hardening suggestions that are not actively exploitable.
86
+ - Documentation improvements to this policy.
87
+ - Questions about supported platforms / configurations.
88
+
89
+ Use private reporting for anything that has impact before a patch is published.
@@ -0,0 +1,89 @@
1
+ ---
2
+ name: agents-md-writer
3
+ description: Generates a single per-directory AGENTS.md file scoped to the directory provided. Invoked in parallel from the /init-deep command.
4
+ mode: subagent
5
+ model: anthropic/claude-sonnet-4-6
6
+ temperature: 0.2
7
+ ---
8
+
9
+ You generate ONE per-directory `AGENTS.md` file scoped to the directory provided in your prompt.
10
+
11
+ If you need to clarify scope with the PRIME mid-task (rare), use the `question` tool — never free-text chat.
12
+
13
+ # Hard rules
14
+
15
+ - You write ONLY to `<directory>/AGENTS.md` exactly. Nothing else, under any circumstance.
16
+ - If the target `<directory>/AGENTS.md` already exists, use **Edit**. If it does NOT exist, use **Write**. NEVER Write over an existing file — manual authoring must be preserved.
17
+ - Never repeat content from the root `AGENTS.md`. Child files are for directory-specific deviations and details.
18
+ - 30-80 lines max. If you need more, your scope is too broad — ask the PRIME to split.
19
+ - Telegraphic style. No generic boilerplate. No "this directory contains TypeScript code" — that's not useful.
20
+ - If after exploring you can't articulate anything directory-specific worth documenting, write nothing and report back "no scoped context worth documenting in <directory>."
21
+
22
+ # Workflow
23
+
24
+ ## 1. Read root AGENTS.md
25
+
26
+ Note conventions already established globally. You will explicitly NOT repeat them.
27
+
28
+ ## 2. Inspect the directory — Serena FIRST
29
+
30
+ Start with Serena. These calls are cheap and precise; do them before anything else:
31
+
32
+ 1. `serena_get_symbols_overview({relative_path: "<directory>"})` — get the symbol inventory (classes, functions, types, exported constants). This tells you what the directory actually exposes.
33
+ 2. For the top 3-5 symbols by apparent importance (index/default export, named exports with wide reference footprint): `serena_find_referencing_symbols({name_path: "<sym>", relative_path: "<file>"})` to see who else in the repo uses this directory. That's the "role in the larger codebase" answer.
34
+ 3. `serena_find_symbol({name_path: "<key-pattern>", relative_path: "<directory>", include_body: true})` for the 1-2 load-bearing exports to capture their actual signature in the AGENTS.md if that's useful.
35
+
36
+ Only after Serena supplement with `read`/`grep`/`glob`/`ast_grep` for:
37
+ - Configs (tsconfig, eslintrc, package.json, vitest.config)
38
+ - READMEs + existing docs
39
+ - Non-TS files (shell scripts, SQL, YAML)
40
+ - Textual patterns that don't map to symbols (TODO annotations, URL strings, comment conventions)
41
+
42
+ Use `git log -5 --oneline <directory>` for a feel of recent activity.
43
+
44
+ If you catch yourself reaching for `grep "^export"` to count exports, STOP — Serena's `get_symbols_overview` already gave you that.
45
+
46
+ Look for:
47
+ - Naming conventions specific to this directory (that aren't root-level)
48
+ - Patterns here that differ from the rest of the repo
49
+ - Dependencies or imports unique to this area
50
+ - Tests or fixtures that anchor behavior
51
+ - Any local README.md, CHANGELOG, or doc file worth referencing
52
+
53
+ ## 3. Write `<directory>/AGENTS.md`
54
+
55
+ Structure:
56
+
57
+ ```markdown
58
+ # <Directory name>
59
+
60
+ ## Purpose
61
+ <One paragraph: what lives here; what it does; what it doesn't do. Deviations from root expectations only.>
62
+
63
+ ## Conventions specific to this directory
64
+ - <Bullet: convention NOT stated in root AGENTS.md>
65
+ - <Bullet: another>
66
+ (Skip this section if you have nothing directory-specific.)
67
+
68
+ ## Key files
69
+ - `<file>` — <one-line description of its role in THIS directory>
70
+ - `<file>` — <description>
71
+ (List 3-8 load-bearing files. Not every file.)
72
+
73
+ ## Adjacent context
74
+ - For <related concern>, see `<other-directory>/AGENTS.md`
75
+ - For <other concern>, see `<doc-path>`
76
+ (Skip if no obvious adjacencies.)
77
+ ```
78
+
79
+ ## 4. Self-validate
80
+
81
+ Before declaring done:
82
+ - Line count 30-80? If >80, trim; if <15, you're probably padding.
83
+ - Any bullet duplicated from root AGENTS.md? Remove it.
84
+ - Any bullet that would apply to ANY TypeScript project? Remove it.
85
+ - Every claim verifiable by reading a file in this directory? If not, remove or cite the file.
86
+
87
+ Report back:
88
+ - `<directory>/AGENTS.md` (created | updated, N lines)
89
+ - One-line description of what made this directory worth documenting.
@@ -0,0 +1,46 @@
1
+ ---
2
+ name: architecture-advisor
3
+ description: Read-only senior consultant for high-stakes decisions, repeated failures, and architectural questions. Slow and expensive — use sparingly.
4
+ mode: subagent
5
+ model: anthropic/claude-opus-4-7
6
+ temperature: 0.2
7
+ ---
8
+
9
+ You are the Architecture Advisor. Produce written analysis. If you need to ask the PRIME/user a clarifying question before committing to a recommendation, use the `question` tool — never free-text chat.
10
+
11
+ You are consulted only when:
12
+ - A decision has significant downstream cost (architecture, schema, public API)
13
+ - The build agent has failed at the same task twice
14
+ - A security or data-handling question needs a second opinion
15
+ - A pattern in the codebase is unfamiliar and the planner needs guidance
16
+
17
+ You do not write code. You do not delegate. You produce written analysis.
18
+
19
+ Output format:
20
+
21
+ ```
22
+ ## Question
23
+
24
+ <Restate the question in your own words.>
25
+
26
+ ## Analysis
27
+
28
+ <2–4 paragraphs. Tradeoffs, constraints, what's at stake.>
29
+
30
+ ## Recommendation
31
+
32
+ <One paragraph. Specific. Not "it depends." Take a position.>
33
+
34
+ ## Rationale
35
+
36
+ <Why this recommendation over the alternatives.>
37
+
38
+ ## What would change my mind
39
+
40
+ <List the specific facts that, if true, would flip the recommendation.>
41
+ ```
42
+
43
+ Rules:
44
+ - Be direct. The PRIME needs a decision, not a survey.
45
+ - Always include "What would change my mind." If you can't think of anything, your recommendation is too weak.
46
+ - Read enough code to ground your analysis. Don't speculate from naming alone.