lazyopencode-core 0.0.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 (89) hide show
  1. package/ATTRIBUTION.md +38 -0
  2. package/LICENSE +21 -0
  3. package/README.md +357 -0
  4. package/dist/agents/councillor.d.ts +1 -0
  5. package/dist/agents/councillor.js +14 -0
  6. package/dist/agents/designer.d.ts +1 -0
  7. package/dist/agents/designer.js +31 -0
  8. package/dist/agents/explorer.d.ts +1 -0
  9. package/dist/agents/explorer.js +15 -0
  10. package/dist/agents/fixer.d.ts +1 -0
  11. package/dist/agents/fixer.js +23 -0
  12. package/dist/agents/index.d.ts +2 -0
  13. package/dist/agents/index.js +55 -0
  14. package/dist/agents/lazy.d.ts +1 -0
  15. package/dist/agents/lazy.js +3 -0
  16. package/dist/agents/librarian.d.ts +1 -0
  17. package/dist/agents/librarian.js +26 -0
  18. package/dist/agents/observer.d.ts +1 -0
  19. package/dist/agents/observer.js +20 -0
  20. package/dist/agents/oracle.d.ts +1 -0
  21. package/dist/agents/oracle.js +30 -0
  22. package/dist/council/council-manager.d.ts +42 -0
  23. package/dist/council/council-manager.js +223 -0
  24. package/dist/council/index.d.ts +2 -0
  25. package/dist/council/index.js +1 -0
  26. package/dist/hooks/apply-patch-rescue.d.ts +7 -0
  27. package/dist/hooks/apply-patch-rescue.js +150 -0
  28. package/dist/hooks/background-job-board.d.ts +92 -0
  29. package/dist/hooks/background-job-board.js +452 -0
  30. package/dist/hooks/chat-params.d.ts +16 -0
  31. package/dist/hooks/chat-params.js +30 -0
  32. package/dist/hooks/deepwork.d.ts +9 -0
  33. package/dist/hooks/deepwork.js +55 -0
  34. package/dist/hooks/error-recovery.d.ts +21 -0
  35. package/dist/hooks/error-recovery.js +216 -0
  36. package/dist/hooks/index.d.ts +3 -0
  37. package/dist/hooks/index.js +61 -0
  38. package/dist/hooks/lazy-command.d.ts +16 -0
  39. package/dist/hooks/lazy-command.js +178 -0
  40. package/dist/hooks/messages-transform.d.ts +40 -0
  41. package/dist/hooks/messages-transform.js +358 -0
  42. package/dist/hooks/permission-guard.d.ts +5 -0
  43. package/dist/hooks/permission-guard.js +38 -0
  44. package/dist/hooks/runtime.d.ts +169 -0
  45. package/dist/hooks/runtime.js +653 -0
  46. package/dist/hooks/session-events.d.ts +16 -0
  47. package/dist/hooks/session-events.js +65 -0
  48. package/dist/hooks/system-transform.d.ts +8 -0
  49. package/dist/hooks/system-transform.js +113 -0
  50. package/dist/hooks/task-session.d.ts +32 -0
  51. package/dist/hooks/task-session.js +177 -0
  52. package/dist/hooks/workflow-classifier.d.ts +17 -0
  53. package/dist/hooks/workflow-classifier.js +170 -0
  54. package/dist/index.d.ts +13 -0
  55. package/dist/index.js +85 -0
  56. package/dist/opencode-control-plane.d.ts +20 -0
  57. package/dist/opencode-control-plane.js +95 -0
  58. package/dist/ponytail.d.ts +1 -0
  59. package/dist/ponytail.js +33 -0
  60. package/dist/skills/index.d.ts +5 -0
  61. package/dist/skills/index.js +10 -0
  62. package/dist/skills/lazy/build/SKILL.md +62 -0
  63. package/dist/skills/lazy/debug/SKILL.md +17 -0
  64. package/dist/skills/lazy/grill/SKILL.md +54 -0
  65. package/dist/skills/lazy/plan/SKILL.md +52 -0
  66. package/dist/skills/lazy/review/SKILL.md +29 -0
  67. package/dist/skills/lazy/security/SKILL.md +29 -0
  68. package/dist/skills/lazy/simplify/SKILL.md +52 -0
  69. package/dist/skills/lazy/specify/SKILL.md +62 -0
  70. package/dist/skills/lazy/worktree/SKILL.md +66 -0
  71. package/dist/tools/cancel-task.d.ts +3 -0
  72. package/dist/tools/cancel-task.js +37 -0
  73. package/dist/tools/council.d.ts +6 -0
  74. package/dist/tools/council.js +41 -0
  75. package/dist/tools/index.d.ts +2 -0
  76. package/dist/tools/index.js +2 -0
  77. package/dist/v2.d.ts +1 -0
  78. package/dist/v2.js +42 -0
  79. package/docs/architecture.md +47 -0
  80. package/docs/council.md +200 -0
  81. package/docs/desktop-distribution.md +36 -0
  82. package/docs/opencode-integration.md +54 -0
  83. package/docs/positioning.md +44 -0
  84. package/docs/product-audit.md +187 -0
  85. package/docs/product-plan.md +56 -0
  86. package/docs/state-machine.md +35 -0
  87. package/docs/user-manual.md +439 -0
  88. package/docs/work-plan.md +190 -0
  89. package/package.json +44 -0
@@ -0,0 +1,439 @@
1
+ # LazyOpenCode User Manual
2
+
3
+ Version 0.0.1
4
+
5
+ ---
6
+
7
+ ## 1. Overview
8
+
9
+ LazyOpenCode is a **zero-config governed team runtime** for AI coding in OpenCode. It wraps AI sessions
10
+ with a governance layer: classify the task, gate risky work, track background agents,
11
+ and close with review.
12
+
13
+ One plugin install gives you:
14
+
15
+ - **8 agents** (1 primary + 7 subagents) with role-specific prompts
16
+ - **9 workflow skills** (`lazy/grill`, `lazy/specify`, `lazy/plan`, `lazy/build`, ...)
17
+ - **Council** multi-LLM parallel analysis
18
+ - **Ponytail philosophy** system injection (YAGNI, deletion-first, stdlib-first)
19
+ - **Job board** — track, reuse, and reconcile background subagents
20
+ - **Token control** — message pruning, image-to-file replacement, skill filtering
21
+ - **Permission guard** — ask before destructive commands
22
+ - **Optional council escalation** — high-risk, ambiguous, or debug-only by default
23
+
24
+ ---
25
+
26
+ ## 2. Quick Start
27
+
28
+ ### Install
29
+
30
+ Add to `opencode.json`:
31
+
32
+ ```json
33
+ {
34
+ "plugin": ["@lazyopencode/core"]
35
+ }
36
+ ```
37
+
38
+ No other configuration is required. Default mode is `governor`.
39
+ LazyOpenCode Desktop preinstalls this plugin line on first run.
40
+
41
+ ### First Session
42
+
43
+ After installing, start a session:
44
+
45
+ ```
46
+ > /lazy start add sorting to the user list
47
+ [Lazy scope: medium. Suggested next step: load lazy/specify.]
48
+ ```
49
+
50
+ The workflow gate classifies your request and suggests the next step. You can
51
+ override with `just do it` to skip gating.
52
+
53
+ ---
54
+
55
+ ## 3. Agents
56
+
57
+ | Agent | Mode | Role |
58
+ |-------|------|------|
59
+ | `lazy` | primary | Runtime coordinator — workflow governance |
60
+ | `lazy-explorer` | subagent | Fast codebase recon (glob, grep, AST) |
61
+ | `lazy-oracle` | subagent | Architecture, debugging, review, simplification |
62
+ | `lazy-librarian` | subagent | External docs, API references, web research |
63
+ | `lazy-fixer` | subagent | Bounded implementation, mechanical changes |
64
+ | `lazy-designer` | subagent | UI/UX design (temp 0.7) |
65
+ | `lazy-observer` | subagent | Image/screenshot analysis |
66
+ | `lazy-councillor` | subagent | Single-model judgment for council sessions |
67
+
68
+ The primary agent (`lazy`) is the entry point. It delegates to subagents as needed.
69
+
70
+ ### Agent Configuration
71
+
72
+ Each agent is registered by the plugin via the `config` hook. Override in
73
+ `opencode.json`:
74
+
75
+ ```json
76
+ {
77
+ "agent": {
78
+ "lazy-oracle": {
79
+ "temperature": 0.3
80
+ }
81
+ }
82
+ }
83
+ ```
84
+
85
+ ---
86
+
87
+ ## 4. Skills
88
+
89
+ Skills are Markdown files loaded by OpenCode. They provide workflow instructions
90
+ that the model follows step by step.
91
+
92
+ ### Built-in Skills
93
+
94
+ | Skill | Purpose | When to Load |
95
+ |-------|---------|-------------|
96
+ | `lazy/grill` | Interview to sharpen requirements | Ambiguous requests |
97
+ | `lazy/specify` | Turn discussion into PRD + tracking issue | After grilling |
98
+ | `lazy/plan` | Break PRD into tracer-bullet issues | After spec |
99
+ | `lazy/build` | Implement one issue, test-first, YAGNI-gated | After plan |
100
+ | `lazy/review` | Code review — find bugs, suggest deletions | After build |
101
+ | `lazy/debug` | Systematic diagnosis for hard bugs | Bug investigation |
102
+ | `lazy/simplify` | Find what to delete | Code cleanup |
103
+ | `lazy/worktree` | Git worktrees for isolation | Multi-branch work |
104
+ | `lazy/security` | OWASP audit with PoC | Security review |
105
+
106
+ ### Loading a Skill
107
+
108
+ In any session, ask the model to load one:
109
+
110
+ ```
111
+ load lazy/grill and grill me on the auth rewrite plan
112
+ ```
113
+
114
+ The model will read the SKILL.md and follow its instructions.
115
+
116
+ ---
117
+
118
+ ## 5. Commands
119
+
120
+ ### `/lazy start <task>`
121
+
122
+ Classifies and gates a task. The workflow classifier determines scope:
123
+
124
+ | Classification | Behavior |
125
+ |---------------|----------|
126
+ | `trivial` | Passes through directly |
127
+ | `medium` | Nudges toward workflow steps |
128
+ | `high_risk` | Blocks until scoped |
129
+ | `ambiguous` | Blocks until clarified |
130
+
131
+ ### `/lazy status`
132
+
133
+ Shows:
134
+ - Current mode
135
+ - Workflow stage
136
+ - Install health
137
+ - Active background jobs
138
+ - Reusable sessions
139
+ - Stale sessions
140
+ - Token control pruning stats
141
+ - Recent gate events
142
+
143
+ ### `/lazy mode <mode>`
144
+
145
+ Change governance mode:
146
+
147
+ | Mode | Behavior |
148
+ |------|----------|
149
+ | `off` | Track state only, no interference |
150
+ | `coach` | Nudge, never block |
151
+ | `governor` | Block high-risk + ambiguous, nudge medium (default) |
152
+ | `strict` | Block medium + high-risk + ambiguous |
153
+
154
+ ### `/lazy deepwork <task>`
155
+
156
+ Injects a focused, single-goal system prompt. Disables ponytail, delegation, job
157
+ board — one agent, one task.
158
+
159
+ ### Other Commands
160
+
161
+ - `/lazy reset` — Clear runtime state for current scope
162
+ - `/lazy explain` — Explain last gate decision
163
+ - `/lazy review` — Start review closure
164
+ - `/lazy simplify` — Start simplification pass
165
+ - `/lazy debug <msg>` — Start systematic debugging
166
+ - `/lazy close` — Produce close report and shutdown checklist
167
+
168
+ ---
169
+
170
+ ## 6. Council
171
+
172
+ See [council.md](council.md) for full documentation.
173
+
174
+ The council system runs multiple LLMs independently on the same question. The
175
+ `lazy-oracle` agent calls `council_session` when it needs diverse perspectives.
176
+ By default, council is guarded and only runs for high-risk, ambiguous, or debug
177
+ workflows.
178
+
179
+ Example config:
180
+
181
+ ```json
182
+ {
183
+ "lazyopencode": {
184
+ "council": {
185
+ "enabled": true,
186
+ "eligibility": "guarded",
187
+ "maxCouncillors": 3,
188
+ "presets": {
189
+ "code-review": {
190
+ "reasoner": { "model": "openai/o3" },
191
+ "critic": { "model": "anthropic/claude-opus-4" }
192
+ }
193
+ }
194
+ }
195
+ }
196
+ }
197
+ ```
198
+
199
+ ---
200
+
201
+ ## 7. Configuration Reference
202
+
203
+ Complete `opencode.json` structure:
204
+
205
+ ```jsonc
206
+ {
207
+ "plugin": ["@lazyopencode/core"],
208
+
209
+ "lazyopencode": {
210
+ // OpenCode SDK surface
211
+ "sdk": {
212
+ "mode": "v2",
213
+ "legacyHookAdapter": true
214
+ },
215
+ "takeover": "governed",
216
+
217
+ // Governance mode
218
+ "mode": "governor",
219
+
220
+ // Agent limits
221
+ "maxSessionsPerAgent": 2,
222
+ "maxActiveTaskDepth": 4,
223
+
224
+ // Context window
225
+ "maxMessages": 80,
226
+
227
+ // Destructive action guard
228
+ "permissionGuard": true,
229
+
230
+ // Persistence
231
+ "persistence": {},
232
+
233
+ // Workflow gate
234
+ "workflowGate": true,
235
+
236
+ // Ponytail philosophy
237
+ "ponytailMode": true,
238
+
239
+ // OpenCode control-plane collection
240
+ "opencode": {
241
+ "sessionStatus": true,
242
+ "vcsDiff": true,
243
+ "todos": true,
244
+ "permissions": true,
245
+ "worktreeIsolation": "risky-only",
246
+ "revertCheckpoints": true
247
+ },
248
+
249
+ // Close report collection
250
+ "closeReport": {
251
+ "autoCollect": true,
252
+ "maxItems": 5
253
+ },
254
+
255
+ // Commands
256
+ "commands": {
257
+ "lazy": true,
258
+ "deepworkAlias": true
259
+ },
260
+
261
+ // Council (optional)
262
+ "council": {
263
+ "enabled": true,
264
+ "eligibility": "guarded",
265
+ "default_preset": "code-review",
266
+ "timeout": 180000,
267
+ "execution_mode": "parallel",
268
+ "retries": 2,
269
+ "maxCouncillors": 3,
270
+ "presets": {
271
+ "code-review": {
272
+ "reasoner": { "model": "openai/o3", "prompt": "Find logic defects and edge cases." },
273
+ "critic": { "model": "anthropic/claude-opus-4" }
274
+ }
275
+ }
276
+ }
277
+ }
278
+ }
279
+ ```
280
+
281
+ ### Configuration Options
282
+
283
+ | Option | Default | Description |
284
+ |--------|---------|-------------|
285
+ | `sdk.mode` | `"v2"` | Use OpenCode v2 registration surface |
286
+ | `sdk.legacyHookAdapter` | `true` | Keep legacy hooks for governance behavior |
287
+ | `takeover` | `"governed"` | Governed takeover without provider/auth override |
288
+ | `mode` | `"governor"` | `"off"`, `"coach"`, `"governor"`, or `"strict"` |
289
+ | `maxSessionsPerAgent` | `2` | Concurrent sessions per subagent role |
290
+ | `maxActiveTaskDepth` | `4` | Max nested task depth before blocking |
291
+ | `maxMessages` | `80` | Sliding window message count for pruning |
292
+ | `permissionGuard` | `true` | Ask before destructive commands |
293
+ | `persistence` | `{}` | Persist state to disk (`false` to disable) |
294
+ | `workflowGate` | `true` | Enable/disable the workflow classifier gate |
295
+ | `ponytailMode` | `true` | Inject ponytail philosophy in system prompt |
296
+ | `opencode.worktreeIsolation` | `"risky-only"` | Suggest isolated workspaces for risky tasks |
297
+ | `opencode.vcsDiff` | `true` | Collect diff summary when available |
298
+ | `opencode.todos` | `true` | Collect todo summary when available |
299
+ | `opencode.permissions` | `true` | Include pending permission state in status |
300
+ | `closeReport.autoCollect` | `true` | Collect close evidence from tool results |
301
+ | `closeReport.maxItems` | `5` | Max remembered close evidence per section |
302
+ | `commands.lazy` | `true` | Enable `/lazy` commands |
303
+ | `commands.deepworkAlias` | `true` | Enable `/lazy deepwork` alias |
304
+ | `council.enabled` | `true` | Enable council escalation |
305
+ | `council.eligibility` | `"guarded"` | `"guarded"` or `"always"` council access |
306
+ | `council.presets` | `{}` | Council preset definitions |
307
+ | `council.timeout` | `180000` | Council timeout in ms |
308
+ | `council.execution_mode` | `"parallel"` | `"parallel"` or `"serial"` |
309
+ | `council.retries` | `2` | Failed councillor retry count |
310
+ | `council.maxCouncillors` | `3` | Hard cap on model calls per council run |
311
+
312
+ ---
313
+
314
+ ## 8. Token Control
315
+
316
+ ### Message Pruning
317
+
318
+ When a session exceeds `maxMessages` (default 80), older messages are dropped.
319
+ System messages and the most recent user+assistant turns are preserved.
320
+
321
+ ### Image Handling
322
+
323
+ Image attachments in user messages are:
324
+ 1. Written to `.opencode/lazy/images/<sessionID>/<hash>.png`
325
+ 2. Replaced with a text reference: `Image saved to <path>`
326
+ 3. Available for `@lazy-observer` to read
327
+
328
+ Images are cleaned up when the session is deleted or errors. Clear
329
+ `.opencode/lazy/images/` manually if OpenCode exits before lifecycle cleanup runs.
330
+
331
+ ### Job Board in Context
332
+
333
+ The job board status is injected into the last user message as a compact summary:
334
+ - Active jobs: `Jobs: 2r/0u` (2 running, 0 unresolved)
335
+ - Completed jobs
336
+ - Reusable session IDs
337
+
338
+ ## 8.1 Permission Guard
339
+
340
+ When `permissionGuard` is enabled, destructive commands stay at `ask` even if the
341
+ main workflow mode is `off`. Set `permissionGuard: false` only when another
342
+ policy layer owns destructive-action approval.
343
+
344
+ ---
345
+
346
+ ## 9. Workflow Gating
347
+
348
+ The workflow classifier (`workflow-classifier.ts`) uses rule-based pattern matching:
349
+
350
+ ### Classification Rules
351
+
352
+ | Level | Pattern Examples |
353
+ |-------|-----------------|
354
+ | `trivial` | Typo, rename, format, comment, log |
355
+ | `medium` | (>80 chars) or feature, refactor, migrate |
356
+ | `high_risk` | Delete, drop, rewrite, auth, payment, security |
357
+ | `ambiguous` | Optimize, improve, upgrade, fix all |
358
+
359
+ ### Gate Behavior
360
+
361
+ ```
362
+ trivial → pass through (no gate)
363
+ medium → nudge: "Suggested next step: load lazy/specify"
364
+ high_risk → block: "Need scope, success criteria, must-not-break list"
365
+ ambiguous → block: "Sharpen the task with lazy/grill"
366
+ ```
367
+
368
+ To override a gate, say `just do it`.
369
+
370
+ ---
371
+
372
+ ## 10. Troubleshooting
373
+
374
+ ### Plugin not loading
375
+
376
+ Check:
377
+ - Plugin name matches exactly: `"@lazyopencode/core"`
378
+ - Package is installed (`ls node_modules/@lazyopencode/core`)
379
+ - OpenCode version is compatible (requires SDK `^1.2.6`)
380
+
381
+ ### Skills not found
382
+
383
+ Run:
384
+ ```
385
+ /lazy status
386
+ ```
387
+
388
+ If skills are missing from the status output, check:
389
+ - `src/skills/lazy/` directory exists
390
+ - Path is correctly resolved (see `dist/skills/index.js` in installed package)
391
+
392
+ ### Council fails
393
+
394
+ Check configuration:
395
+ - Preset names match (`default_preset` must exist in `presets`)
396
+ - Model IDs are valid (`providerID/modelID` format)
397
+ - API keys for specified providers are configured in OpenCode
398
+
399
+ ### Workflow gate too aggressive
400
+
401
+ Lower the mode:
402
+ ```
403
+ /lazy mode coach
404
+ ```
405
+
406
+ This keeps state tracking but passes all gates.
407
+
408
+ ---
409
+
410
+ ## 11. Internal Architecture
411
+
412
+ For the module-level architecture, see [architecture.md](architecture.md).
413
+
414
+ Key modules:
415
+
416
+ | Module | Responsibility |
417
+ |--------|---------------|
418
+ | `src/index.ts` | Plugin entry, wires runtime + hooks + tools |
419
+ | `src/hooks/runtime.ts` | LazyRuntime: config, scope, persistence, state machine |
420
+ | `src/hooks/background-job-board.ts` | Job state machine (6 states, reuse, prompt injection) |
421
+ | `src/hooks/messages-transform.ts` | Pruning, image→file, job board, gate, skill filter |
422
+ | `src/hooks/system-transform.ts` | Ponytail + lazy system prompt injection |
423
+ | `src/hooks/workflow-classifier.ts` | Rule-based risk classification |
424
+ | `src/council/council-manager.ts` | Multi-LLM parallel analysis engine |
425
+ | `src/agents/` | 8 agent prompt definitions |
426
+ | `src/skills/lazy/` | 9 SKILL.md workflow files |
427
+
428
+ ---
429
+
430
+ ## 12. Limits and Known Issues
431
+
432
+ | Area | Limitation |
433
+ |------|-----------|
434
+ | Sessions | No cross-session state sharing |
435
+ | Image cleanup | `.opencode/lazy/images/<sessionID>` is cleaned on session delete/error; manual cleanup may be needed after hard exits |
436
+ | Council cost | N councillors = N model invocations; use selectively |
437
+ | Workflow gate | Rule-based classifier, may misclassify complex but safe tasks |
438
+ | Persistence | File-based, no encryption, no remote sync |
439
+ | Skill loading | Unicode characters in SKILL.md filenames may cause issues on Windows |
@@ -0,0 +1,190 @@
1
+ # Work Plan
2
+
3
+ ## Product Direction
4
+
5
+ LazyOpenCode should ship as an OpenCode-native governed team runtime.
6
+
7
+ The core package must be complete without requiring another OpenCode plugin:
8
+ primary agent, subagents, workflow gates, job tracking, budget visibility,
9
+ permission guard, close report, doctor, and workflow skills are all part of the
10
+ same product.
11
+
12
+ Desktop is a later distribution stage. It should package and visualize the core,
13
+ not recreate core rules.
14
+
15
+ ## Phase 0: 0.0.1 Release Lock
16
+
17
+ Goal: ship the current core as a clean, zero-config OpenCode plugin.
18
+
19
+ Tasks:
20
+
21
+ 1. Keep public positioning consistent:
22
+ - README uses governed team runtime.
23
+ - Docs avoid borrowed product metaphors.
24
+ - Desktop is clearly marked as later work.
25
+
26
+ 2. Lock package health:
27
+ - `npm run verify` passes.
28
+ - `npm pack --dry-run` includes docs, README, license, attribution, `dist`,
29
+ and `dist/skills/lazy`.
30
+ - No stale renamed agent files in `dist`.
31
+ - No JS test duplicates.
32
+
33
+ 3. Stabilize public surface:
34
+ - Keep agent names stable.
35
+ - Keep `/lazy` command namespace stable.
36
+ - Keep `LazyOpenCodePluginV1` named export for legacy hook loading.
37
+ - Keep default export on v2 registration surface.
38
+
39
+ Acceptance criteria:
40
+
41
+ - Fresh checkout can run `npm run verify` inside `packages/lazyopencode-core`.
42
+ - README first screen clearly explains team runtime + governance.
43
+ - `/lazy start`, `/lazy status`, `/lazy close`, and `/lazy doctor` are tested.
44
+
45
+ ## Phase 1: 0.0.2 Runtime Deepening
46
+
47
+ Goal: split the working runtime into deeper modules without changing user
48
+ behavior.
49
+
50
+ Tasks:
51
+
52
+ 1. Split `src/hooks/runtime.ts`:
53
+ - `runtime/config.ts`
54
+ - `runtime/persistence.ts`
55
+ - `runtime/workflow-trace.ts`
56
+ - `runtime/close-report.ts`
57
+ - `runtime/doctor.ts`
58
+ - `runtime/opencode-snapshot.ts`
59
+ - `runtime/status-format.ts`
60
+ - `runtime/index.ts`
61
+
62
+ 2. Split `messages-transform.ts`:
63
+ - pruning
64
+ - image redirect
65
+ - job-board prompt injection
66
+ - workflow gate injection
67
+ - skill filtering
68
+
69
+ 3. Add narrow tests:
70
+ - close report evidence dedupe
71
+ - doctor checks
72
+ - persistence roundtrip
73
+ - status formatting
74
+ - image path and cleanup path
75
+
76
+ 4. Make OpenCode plugin version baseline explicit:
77
+ - set package dependency to the tested baseline
78
+ - document minimum supported version
79
+ - keep v1 legacy adapter until equivalent v2 hooks exist
80
+
81
+ Acceptance criteria:
82
+
83
+ - No public behavior changes.
84
+ - `runtime/index.ts` exposes a small facade.
85
+ - Module-level tests cover the new internals.
86
+ - `npm run verify` remains green.
87
+
88
+ ## Phase 2: 0.0.3 Close Evidence And Worktree Policy
89
+
90
+ Goal: make close and risk isolation more useful without pretending to know
91
+ things that were not observed.
92
+
93
+ Tasks:
94
+
95
+ 1. Improve close evidence:
96
+ - record latest test commands
97
+ - record latest verify command
98
+ - summarize diff when OpenCode exposes it
99
+ - show manual overrides separately from auto-collected evidence
100
+ - mark missing evidence as `none recorded`
101
+
102
+ 2. Improve status:
103
+ - separate OpenCode snapshot freshness from persisted state
104
+ - show last snapshot time
105
+ - show control-plane capability degradation clearly
106
+
107
+ 3. Improve isolation policy:
108
+ - high-risk/ambiguous tasks produce explicit isolation advice
109
+ - if stable worktree/project-copy APIs exist, use them behind a guard
110
+ - otherwise stay advisory
111
+
112
+ Acceptance criteria:
113
+
114
+ - `/lazy close` remains truthful and does not invent changed files or tests.
115
+ - `/lazy status` makes stale snapshot state visible.
116
+ - Worktree automation is never attempted unless capability is detected.
117
+
118
+ ## Phase 3: 0.1.0 Desktop Distribution
119
+
120
+ Goal: create the Desktop distribution layer around the core plugin.
121
+
122
+ Tasks:
123
+
124
+ 1. Import or fork upstream OpenCode Desktop.
125
+ 2. Add first-run config merge:
126
+ - add `@lazyopencode/core` if absent
127
+ - add `lazyopencode` defaults only when not user-set
128
+ - preserve provider, auth, model, MCP, project, and session settings
129
+ 3. Add Lazy Health panel:
130
+ - plugin loaded
131
+ - v2 capabilities
132
+ - jobs
133
+ - pending permissions
134
+ - token budget
135
+ - close report
136
+ - doctor warnings
137
+ 4. Add attribution:
138
+ - clearly based on OpenCode
139
+ - clearly not official OpenCode
140
+ 5. Add Desktop verification:
141
+ - config merge tests
142
+ - health snapshot tests
143
+ - package/build smoke test
144
+
145
+ Acceptance criteria:
146
+
147
+ - Desktop starts with LazyOpenCode enabled by default.
148
+ - Existing user OpenCode config is preserved.
149
+ - Health panel reads core snapshots instead of duplicating governance logic.
150
+ - Core remains usable as a standalone npm plugin.
151
+
152
+ ## Phase 4: Presets And Profiles
153
+
154
+ Goal: make the governed runtime adaptable without turning it into a config maze.
155
+
156
+ Tasks:
157
+
158
+ 1. Team profiles:
159
+ - solo
160
+ - balanced
161
+ - review-heavy
162
+ - low-cost
163
+ - high-risk
164
+
165
+ 2. Model profiles:
166
+ - primary model
167
+ - fast explorer
168
+ - reviewer
169
+ - designer
170
+ - council preset
171
+
172
+ 3. Project profiles:
173
+ - library
174
+ - app
175
+ - infra
176
+ - security-sensitive
177
+
178
+ Acceptance criteria:
179
+
180
+ - Profiles are optional.
181
+ - Defaults stay zero-config.
182
+ - Profiles compose with user OpenCode config without overwriting provider/auth.
183
+
184
+ ## Current Priority
185
+
186
+ Do not start Desktop until `0.0.1` is locked and `0.0.2` runtime deepening is
187
+ planned clearly.
188
+
189
+ The next best engineering task is Phase 1: split `LazyRuntime` into deeper
190
+ modules while preserving behavior and tests.
package/package.json ADDED
@@ -0,0 +1,44 @@
1
+ {
2
+ "name": "lazyopencode-core",
3
+ "version": "0.0.1",
4
+ "description": "Governed team runtime for AI coding in OpenCode",
5
+ "type": "module",
6
+ "main": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "files": [
9
+ "dist",
10
+ "README.md",
11
+ "docs",
12
+ "ATTRIBUTION.md",
13
+ "LICENSE"
14
+ ],
15
+ "keywords": [
16
+ "opencode",
17
+ "opencode-plugin",
18
+ "ai",
19
+ "agents",
20
+ "workflow",
21
+ "ponytail",
22
+ "lazy"
23
+ ],
24
+ "license": "MIT",
25
+ "repository": {
26
+ "type": "git",
27
+ "url": "https://github.com/SisyphusZheng/lazyopencode"
28
+ },
29
+ "dependencies": {
30
+ "@opencode-ai/plugin": "^1.2.6"
31
+ },
32
+ "devDependencies": {
33
+ "@types/node": "^26.0.1",
34
+ "typescript": "^5.7.0"
35
+ },
36
+ "scripts": {
37
+ "build": "deno task build",
38
+ "check": "deno task check",
39
+ "test": "deno task test",
40
+ "verify": "deno task verify",
41
+ "fmt": "deno task fmt",
42
+ "lint": "deno task lint"
43
+ }
44
+ }