oh-my-opencode-serverlocal 0.1.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.
- package/LICENSE +21 -0
- package/README.ja-JP.md +775 -0
- package/README.ko-KR.md +796 -0
- package/README.md +792 -0
- package/README.zh-CN.md +765 -0
- package/dist/agents/council.d.ts +27 -0
- package/dist/agents/councillor.d.ts +2 -0
- package/dist/agents/designer.d.ts +2 -0
- package/dist/agents/explorer.d.ts +2 -0
- package/dist/agents/fixer.d.ts +2 -0
- package/dist/agents/index.d.ts +31 -0
- package/dist/agents/librarian.d.ts +2 -0
- package/dist/agents/observer.d.ts +2 -0
- package/dist/agents/oracle.d.ts +2 -0
- package/dist/agents/orchestrator.d.ts +28 -0
- package/dist/agents/permissions.d.ts +10 -0
- package/dist/cli/background-subagents.d.ts +13 -0
- package/dist/cli/companion.d.ts +4 -0
- package/dist/cli/config-io.d.ts +25 -0
- package/dist/cli/config-manager.d.ts +4 -0
- package/dist/cli/custom-skills-registry.d.ts +18 -0
- package/dist/cli/custom-skills.d.ts +13 -0
- package/dist/cli/doctor.d.ts +38 -0
- package/dist/cli/index.d.ts +3 -0
- package/dist/cli/index.js +3565 -0
- package/dist/cli/install.d.ts +7 -0
- package/dist/cli/model-key-normalization.d.ts +1 -0
- package/dist/cli/paths.d.ts +35 -0
- package/dist/cli/providers.d.ts +145 -0
- package/dist/cli/skills.d.ts +24 -0
- package/dist/cli/system.d.ts +6 -0
- package/dist/cli/types.d.ts +47 -0
- package/dist/companion/manager.d.ts +50 -0
- package/dist/companion/updater.d.ts +36 -0
- package/dist/config/agent-mcps.d.ts +11 -0
- package/dist/config/constants.d.ts +38 -0
- package/dist/config/council-schema.d.ts +137 -0
- package/dist/config/index.d.ts +5 -0
- package/dist/config/loader.d.ts +88 -0
- package/dist/config/runtime-preset.d.ts +11 -0
- package/dist/config/schema.d.ts +1107 -0
- package/dist/config/strip-orchestrator-model.d.ts +9 -0
- package/dist/config/utils.d.ts +18 -0
- package/dist/council/council-manager.d.ts +53 -0
- package/dist/council/index.d.ts +1 -0
- package/dist/hooks/apply-patch/codec.d.ts +7 -0
- package/dist/hooks/apply-patch/errors.d.ts +25 -0
- package/dist/hooks/apply-patch/execution-context.d.ts +27 -0
- package/dist/hooks/apply-patch/index.d.ts +15 -0
- package/dist/hooks/apply-patch/matching.d.ts +26 -0
- package/dist/hooks/apply-patch/operations.d.ts +3 -0
- package/dist/hooks/apply-patch/prepared-changes.d.ts +17 -0
- package/dist/hooks/apply-patch/resolution.d.ts +19 -0
- package/dist/hooks/apply-patch/rewrite.d.ts +7 -0
- package/dist/hooks/apply-patch/test-helpers.d.ts +6 -0
- package/dist/hooks/apply-patch/types.d.ts +80 -0
- package/dist/hooks/auto-update-checker/cache.d.ts +11 -0
- package/dist/hooks/auto-update-checker/checker.d.ts +38 -0
- package/dist/hooks/auto-update-checker/constants.d.ts +12 -0
- package/dist/hooks/auto-update-checker/index.d.ts +18 -0
- package/dist/hooks/auto-update-checker/skill-sync.d.ts +67 -0
- package/dist/hooks/auto-update-checker/types.d.ts +34 -0
- package/dist/hooks/chat-headers.d.ts +16 -0
- package/dist/hooks/command-hook-utils.d.ts +5 -0
- package/dist/hooks/deepwork/index.d.ts +13 -0
- package/dist/hooks/delegate-task-retry/hook.d.ts +8 -0
- package/dist/hooks/delegate-task-retry/patterns.d.ts +11 -0
- package/dist/hooks/filter-available-skills/index.d.ts +19 -0
- package/dist/hooks/foreground-fallback/index.d.ts +122 -0
- package/dist/hooks/image-hook.d.ts +8 -0
- package/dist/hooks/index.d.ts +16 -0
- package/dist/hooks/json-error-recovery/hook.d.ts +18 -0
- package/dist/hooks/loop-command/index.d.ts +13 -0
- package/dist/hooks/phase-reminder/index.d.ts +25 -0
- package/dist/hooks/post-file-tool-nudge/index.d.ts +23 -0
- package/dist/hooks/reflect/index.d.ts +13 -0
- package/dist/hooks/session-lifecycle.d.ts +10 -0
- package/dist/hooks/task-session-manager/index.d.ts +58 -0
- package/dist/hooks/task-session-manager/pending-call-tracker.d.ts +13 -0
- package/dist/hooks/task-session-manager/task-context-tracker.d.ts +14 -0
- package/dist/hooks/types.d.ts +26 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +39519 -0
- package/dist/interview/dashboard-manager.d.ts +21 -0
- package/dist/interview/dashboard.d.ts +67 -0
- package/dist/interview/document.d.ts +29 -0
- package/dist/interview/helpers.d.ts +10 -0
- package/dist/interview/index.d.ts +1 -0
- package/dist/interview/manager.d.ts +21 -0
- package/dist/interview/parser.d.ts +11 -0
- package/dist/interview/prompts.d.ts +7 -0
- package/dist/interview/server.d.ts +15 -0
- package/dist/interview/service.d.ts +45 -0
- package/dist/interview/session-server.d.ts +21 -0
- package/dist/interview/types.d.ts +111 -0
- package/dist/interview/ui.d.ts +11 -0
- package/dist/loop/loop-session.d.ts +64 -0
- package/dist/mcp/context7.d.ts +6 -0
- package/dist/mcp/grep-app.d.ts +6 -0
- package/dist/mcp/index.d.ts +8 -0
- package/dist/mcp/types.d.ts +12 -0
- package/dist/mcp/websearch.d.ts +9 -0
- package/dist/multiplexer/cmux/close-policy.d.ts +20 -0
- package/dist/multiplexer/cmux/index.d.ts +102 -0
- package/dist/multiplexer/cmux/session-lifecycle.d.ts +92 -0
- package/dist/multiplexer/cmux/session-state.d.ts +45 -0
- package/dist/multiplexer/factory.d.ts +17 -0
- package/dist/multiplexer/herdr/index.d.ts +35 -0
- package/dist/multiplexer/index.d.ts +12 -0
- package/dist/multiplexer/session-manager.d.ts +69 -0
- package/dist/multiplexer/shared.d.ts +31 -0
- package/dist/multiplexer/tmux/index.d.ts +26 -0
- package/dist/multiplexer/types.d.ts +57 -0
- package/dist/multiplexer/zellij/index.d.ts +47 -0
- package/dist/tools/acp-run.d.ts +3 -0
- package/dist/tools/ast-grep/cli.d.ts +15 -0
- package/dist/tools/ast-grep/constants.d.ts +25 -0
- package/dist/tools/ast-grep/downloader.d.ts +5 -0
- package/dist/tools/ast-grep/index.d.ts +10 -0
- package/dist/tools/ast-grep/tools.d.ts +3 -0
- package/dist/tools/ast-grep/types.d.ts +30 -0
- package/dist/tools/ast-grep/utils.d.ts +4 -0
- package/dist/tools/cancel-task.d.ts +16 -0
- package/dist/tools/council.d.ts +10 -0
- package/dist/tools/index.d.ts +7 -0
- package/dist/tools/preset-manager.d.ts +26 -0
- package/dist/tools/smartfetch/binary.d.ts +3 -0
- package/dist/tools/smartfetch/cache.d.ts +6 -0
- package/dist/tools/smartfetch/constants.d.ts +12 -0
- package/dist/tools/smartfetch/index.d.ts +3 -0
- package/dist/tools/smartfetch/network.d.ts +38 -0
- package/dist/tools/smartfetch/secondary-model.d.ts +35 -0
- package/dist/tools/smartfetch/tool.d.ts +3 -0
- package/dist/tools/smartfetch/types.d.ts +122 -0
- package/dist/tools/smartfetch/utils.d.ts +20 -0
- package/dist/tui-state.d.ts +18 -0
- package/dist/tui.d.ts +13 -0
- package/dist/tui.js +1112 -0
- package/dist/utils/agent-variant.d.ts +23 -0
- package/dist/utils/background-job-board.d.ts +113 -0
- package/dist/utils/background-job-coordinator.d.ts +72 -0
- package/dist/utils/background-job-store.d.ts +46 -0
- package/dist/utils/compat.d.ts +29 -0
- package/dist/utils/councillor-models.d.ts +20 -0
- package/dist/utils/env.d.ts +3 -0
- package/dist/utils/escape-html.d.ts +1 -0
- package/dist/utils/frontmatter.d.ts +6 -0
- package/dist/utils/guards.d.ts +4 -0
- package/dist/utils/index.d.ts +10 -0
- package/dist/utils/internal-initiator.d.ts +11 -0
- package/dist/utils/logger.d.ts +6 -0
- package/dist/utils/polling.d.ts +21 -0
- package/dist/utils/session.d.ts +75 -0
- package/dist/utils/subagent-depth.d.ts +35 -0
- package/dist/utils/system-collapse.d.ts +6 -0
- package/dist/utils/task.d.ts +20 -0
- package/dist/utils/zip-extractor.d.ts +1 -0
- package/package.json +108 -0
- package/src/companion/companion-manifest.json +12 -0
- package/src/skills/clonedeps/README.md +23 -0
- package/src/skills/clonedeps/SKILL.md +240 -0
- package/src/skills/clonedeps/codemap.md +32 -0
- package/src/skills/codemap/README.md +59 -0
- package/src/skills/codemap/SKILL.md +163 -0
- package/src/skills/codemap/codemap.md +36 -0
- package/src/skills/codemap/scripts/codemap.mjs +483 -0
- package/src/skills/codemap/scripts/codemap.test.ts +129 -0
- package/src/skills/codemap.md +78 -0
- package/src/skills/deepwork/SKILL.md +122 -0
- package/src/skills/loop-engineering/SKILL.md +30 -0
- package/src/skills/oh-my-opencode-slim/SKILL.md +326 -0
- package/src/skills/reflect/SKILL.md +326 -0
- package/src/skills/simplify/README.md +19 -0
- package/src/skills/simplify/SKILL.md +138 -0
- package/src/skills/simplify/codemap.md +36 -0
- package/src/skills/verification-planning/SKILL.md +102 -0
- package/src/skills/worktrees/SKILL.md +171 -0
|
@@ -0,0 +1,326 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: reflect
|
|
3
|
+
description: Review recent work, find repeated workflow patterns, and suggest reusable skills, agents, commands, config changes, or playbooks. Use when the user asks to learn from past sessions, improve recurring workflows, or identify what should be turned into reusable agent instructions.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Reflect
|
|
7
|
+
|
|
8
|
+
Reflect is an orchestrator-only workflow for learning from repeated work. It
|
|
9
|
+
looks back over recent sessions, project notes, and existing agent assets, then
|
|
10
|
+
recommends the smallest useful improvement: a skill, custom agent, command,
|
|
11
|
+
configuration change, prompt rule, documentation playbook, or no change.
|
|
12
|
+
|
|
13
|
+
The goal is to identify real repeated friction and suggest practical improvements with evidence.
|
|
14
|
+
|
|
15
|
+
## When to Use
|
|
16
|
+
|
|
17
|
+
Use Reflect when the user asks to:
|
|
18
|
+
|
|
19
|
+
- run `/reflect` or `/reflect <focus>`;
|
|
20
|
+
- run `/reflect --sessions` for session archaeology;
|
|
21
|
+
- learn from recent sessions or repeated workflows;
|
|
22
|
+
- find work they keep doing manually;
|
|
23
|
+
- improve their oh-my-opencode-slim setup based on actual usage using oh-my-opencode-slim skill;
|
|
24
|
+
- review whether a recurring process should become a reusable playbook;
|
|
25
|
+
- turn repeated workflow friction into a safer future default.
|
|
26
|
+
|
|
27
|
+
Do not use Reflect for ordinary implementation work, one-off debugging, broad
|
|
28
|
+
architecture review, or speculative agent creation without workflow evidence.
|
|
29
|
+
|
|
30
|
+
## Session Mode
|
|
31
|
+
|
|
32
|
+
When the user includes `--sessions` in their reflect command, shift to session
|
|
33
|
+
archaeology: analyze historical OpenCode sessions across all repos to find
|
|
34
|
+
repeated patterns, friction, and improvement opportunities.
|
|
35
|
+
|
|
36
|
+
### Session Discovery
|
|
37
|
+
|
|
38
|
+
1. **Load recent sessions** - Query the SQLite database directly:
|
|
39
|
+
```bash
|
|
40
|
+
bun -e "import Database from 'bun:sqlite'; const db = new Database('/home/mhenke/.local/share/opencode/opencode.db'); console.log(db.query('SELECT id, directory, title, agent, model, time_created, cost, tokens_input, tokens_output FROM session ORDER BY time_created DESC LIMIT 50').all())"
|
|
41
|
+
```
|
|
42
|
+
Adjust `LIMIT 50` to `--last N` if specified.
|
|
43
|
+
|
|
44
|
+
**Session table columns:** `id, directory, title, agent, model, time_created, cost, tokens_input, tokens_output`
|
|
45
|
+
|
|
46
|
+
2. **Load session messages** - For each session ID, query the message table:
|
|
47
|
+
```bash
|
|
48
|
+
bun -e "import Database from 'bun:sqlite'; const db = new Database('/home/mhenke/.local/share/opencode/opencode.db'); console.log(db.query('SELECT data FROM message WHERE session_id = ?').all('ses_14de9c68effegtZtlATm42wnz7'))"
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
**Message table columns:** `id, session_id, time_created, time_updated, data` (data is JSON with role, agent, model, summary, etc.)
|
|
52
|
+
|
|
53
|
+
### Per-Session Analysis
|
|
54
|
+
|
|
55
|
+
For each session, analyze and produce a structured summary:
|
|
56
|
+
|
|
57
|
+
```json
|
|
58
|
+
{
|
|
59
|
+
"session": "ses_14de9c68effegtZtlATm42wnz7",
|
|
60
|
+
"project": "/home/user/Projects/oh-my-opencode-slim",
|
|
61
|
+
"timestamp": "2026-06-10T15:08:45.427Z",
|
|
62
|
+
"goal": "Fix CI failure",
|
|
63
|
+
"success": true,
|
|
64
|
+
"frictions": [
|
|
65
|
+
"Repeated grep to find test file",
|
|
66
|
+
"Three failed test runs before passing"
|
|
67
|
+
],
|
|
68
|
+
"recommendations": [
|
|
69
|
+
"Create /test-ci command"
|
|
70
|
+
],
|
|
71
|
+
"duration_minutes": 18,
|
|
72
|
+
"models_used": ["opencode/mimo-v2.5-free"],
|
|
73
|
+
"agents_used": ["orchestrator", "fixer", "explorer"],
|
|
74
|
+
"tools_used": ["Read", "Edit", "Bash"],
|
|
75
|
+
"confidence": 0.85
|
|
76
|
+
}
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
**Confidence scoring:**
|
|
80
|
+
- 0.9-1.0: Clear success/failure, obvious patterns
|
|
81
|
+
- 0.7-0.9: Likely outcome, patterns inferred from tool usage
|
|
82
|
+
- 0.5-0.7: Uncertain outcome, limited evidence
|
|
83
|
+
- <0.5: Skip or mark as "needs more evidence"
|
|
84
|
+
|
|
85
|
+
### Storage and Caching
|
|
86
|
+
|
|
87
|
+
Store session summaries in `~/.config/opencode/oh-my-opencode-slim/reflections/sessions/`.
|
|
88
|
+
|
|
89
|
+
**Cache logic:**
|
|
90
|
+
1. Check if `<session-id>.json` exists in reflections directory
|
|
91
|
+
2. If yes, load it (saves tokens)
|
|
92
|
+
3. If no, analyze session and save summary
|
|
93
|
+
4. Aggregate across all summaries for final report
|
|
94
|
+
|
|
95
|
+
### Aggregation
|
|
96
|
+
|
|
97
|
+
After analyzing all sessions, aggregate findings:
|
|
98
|
+
|
|
99
|
+
1. **Group by theme** - sessions with similar frictions cluster together
|
|
100
|
+
2. **Count frequency** - "42/50 sessions had repeated grep before editing"
|
|
101
|
+
3. **Rank by impact** - prioritize recommendations that appear most often
|
|
102
|
+
4. **Filter noise** - skip one-off issues, focus on repeated patterns
|
|
103
|
+
5. **Cross-reference** - see if patterns correlate with specific models, agents, or repos
|
|
104
|
+
|
|
105
|
+
**Scope categories:**
|
|
106
|
+
- **Global** - applies to all repos (pattern seen in >50% of repos)
|
|
107
|
+
- **Cross-repo** - applies to specific repos where pattern appears
|
|
108
|
+
- **Project-specific** - only relevant to one repo
|
|
109
|
+
|
|
110
|
+
### Output Format
|
|
111
|
+
|
|
112
|
+
Return a compact report with scope and confidence:
|
|
113
|
+
|
|
114
|
+
```text
|
|
115
|
+
Session Reflection Report
|
|
116
|
+
Analyzing 50 most recent sessions across 8 repos.
|
|
117
|
+
|
|
118
|
+
Repos analyzed:
|
|
119
|
+
- <repo> (<N> sessions)
|
|
120
|
+
- ... (M more)
|
|
121
|
+
|
|
122
|
+
Findings
|
|
123
|
+
- <pattern>: N/50 sessions across M repos.
|
|
124
|
+
- Scope: global | cross-repo (<repos>) | project-specific (<repo>)
|
|
125
|
+
- Confidence: 0.95
|
|
126
|
+
- Impact: High | Medium | Low
|
|
127
|
+
|
|
128
|
+
Recommended changes
|
|
129
|
+
- <asset>: <purpose>
|
|
130
|
+
- Scope: global | cross-repo (<repos>) | project-specific (<repo>)
|
|
131
|
+
- Confidence: 0.97
|
|
132
|
+
- Estimated time saved: High | Medium | Low
|
|
133
|
+
|
|
134
|
+
Skipped
|
|
135
|
+
- <candidate>: why not worth packaging now.
|
|
136
|
+
- Scope: <reason>
|
|
137
|
+
- Confidence: <score>
|
|
138
|
+
|
|
139
|
+
Needs more evidence
|
|
140
|
+
- <candidate>: what would make it actionable.
|
|
141
|
+
- Current scope: <what we've seen>
|
|
142
|
+
- Required scope: <what would confirm>
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
### Error Handling
|
|
146
|
+
|
|
147
|
+
**Log file issues:**
|
|
148
|
+
- Log doesn't exist → "No OpenCode log found at <path>. Run OpenCode in at least one repo first."
|
|
149
|
+
- Log is empty → "OpenCode log is empty. No sessions to analyze."
|
|
150
|
+
|
|
151
|
+
**Session loading issues:**
|
|
152
|
+
- Session ID not loadable → Skip with warning: "Session <id> could not be loaded, skipping."
|
|
153
|
+
- Session has no messages → Skip: "Session <id> has no messages."
|
|
154
|
+
|
|
155
|
+
**Recovery pattern:**
|
|
156
|
+
- Log the failure
|
|
157
|
+
- Continue with remaining sessions
|
|
158
|
+
- Report failures at end: "3 sessions skipped due to load errors"
|
|
159
|
+
|
|
160
|
+
## Core Contract
|
|
161
|
+
|
|
162
|
+
Reflect must be conservative and evidence-driven.
|
|
163
|
+
|
|
164
|
+
Required behavior:
|
|
165
|
+
|
|
166
|
+
- inspect existing assets before suggesting new ones;
|
|
167
|
+
- prefer recent, repeated, user-visible friction over isolated incidents;
|
|
168
|
+
- recommend the smallest useful form;
|
|
169
|
+
- treat "create nothing" as a successful result when evidence is weak;
|
|
170
|
+
- ask before changing prompts, skills, commands, agents, MCP access, or config;
|
|
171
|
+
- avoid duplicating existing assets;
|
|
172
|
+
- explain restart requirements for OpenCode config, prompt, agent, skill, MCP, or
|
|
173
|
+
plugin changes.
|
|
174
|
+
|
|
175
|
+
## Evidence Sources
|
|
176
|
+
|
|
177
|
+
Use available evidence in this order:
|
|
178
|
+
|
|
179
|
+
1. Current conversation and explicit user instructions.
|
|
180
|
+
2. Project-local guidance and memories, such as `AGENTS.md`, `.opencode/`,
|
|
181
|
+
`.slim/`, notes, checkpoints, task progress files, and codemaps.
|
|
182
|
+
3. Existing skills, commands, agents, prompt overrides, MCP permissions, and
|
|
183
|
+
oh-my-opencode-slim configuration.
|
|
184
|
+
4. Recent OpenCode logs or session artifacts if they are available and safe to
|
|
185
|
+
inspect.
|
|
186
|
+
5. External docs only when a proposed workflow depends on a third-party tool or
|
|
187
|
+
library whose behavior needs confirmation.
|
|
188
|
+
|
|
189
|
+
Respect privacy and safety boundaries. Do not inspect unrelated personal files,
|
|
190
|
+
credentials, private messages, or external accounts unless the user explicitly
|
|
191
|
+
asks and the workflow requires it.
|
|
192
|
+
|
|
193
|
+
## Workflow
|
|
194
|
+
|
|
195
|
+
Reflect can be triggered directly:
|
|
196
|
+
|
|
197
|
+
```text
|
|
198
|
+
/reflect
|
|
199
|
+
/reflect release workflow and checks
|
|
200
|
+
/reflect --sessions
|
|
201
|
+
/reflect --sessions --last 100
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
With no arguments, review recent work broadly. With arguments, focus the review
|
|
205
|
+
on that workflow area while still checking whether existing assets already cover
|
|
206
|
+
it.
|
|
207
|
+
|
|
208
|
+
### 1. Inventory Existing Assets
|
|
209
|
+
|
|
210
|
+
Before proposing anything, identify what already exists:
|
|
211
|
+
|
|
212
|
+
- bundled and user-installed skills;
|
|
213
|
+
- custom agents and their `orchestratorPrompt` guidance;
|
|
214
|
+
- custom commands;
|
|
215
|
+
- prompt overrides and append files;
|
|
216
|
+
- active oh-my-opencode-slim preset, model routing, skills, and MCP permissions;
|
|
217
|
+
- project playbooks, docs, codemaps, and local workflow notes.
|
|
218
|
+
|
|
219
|
+
If an existing asset already covers the candidate, recommend extending or using
|
|
220
|
+
that asset instead of creating a near-duplicate.
|
|
221
|
+
|
|
222
|
+
### 2. Find Repeated Workflow Patterns
|
|
223
|
+
|
|
224
|
+
Look for repeated signals such as:
|
|
225
|
+
|
|
226
|
+
- the same command sequence appears across sessions;
|
|
227
|
+
- the user repeatedly asks for the same review, setup, release, or debugging
|
|
228
|
+
process;
|
|
229
|
+
- the same manual research or context-gathering steps keep recurring;
|
|
230
|
+
- the same specialist routing decision is repeatedly needed;
|
|
231
|
+
- the same project-specific rule is repeatedly re-explained;
|
|
232
|
+
- repeated failures happen because an agent lacks a stable instruction, tool, or
|
|
233
|
+
permission boundary.
|
|
234
|
+
|
|
235
|
+
Strong candidates usually have at least two occurrences, stable inputs, a clear
|
|
236
|
+
output, and a clear stopping condition.
|
|
237
|
+
|
|
238
|
+
### 3. Score Candidates
|
|
239
|
+
|
|
240
|
+
For each candidate, decide:
|
|
241
|
+
|
|
242
|
+
- **Frequency:** How often has it happened?
|
|
243
|
+
- **Cost:** Does it waste meaningful time, context, money, or attention?
|
|
244
|
+
- **Risk:** Does inconsistent execution cause bugs, regressions, bad decisions,
|
|
245
|
+
or unsafe changes?
|
|
246
|
+
- **Stability:** Are the inputs and desired output predictable?
|
|
247
|
+
- **Coverage:** Is there already an asset that handles it well?
|
|
248
|
+
|
|
249
|
+
Only recommend creating or changing assets when confidence is high.
|
|
250
|
+
|
|
251
|
+
### 4. Choose the Smallest Useful Form
|
|
252
|
+
|
|
253
|
+
Pick the least powerful form that solves the repeated problem:
|
|
254
|
+
|
|
255
|
+
- **Prompt/config rule:** a small behavior change to an existing agent.
|
|
256
|
+
- **Skill:** reusable workflow guidance for a task shape.
|
|
257
|
+
- **Command:** a repeatable manual trigger with stable inputs.
|
|
258
|
+
- **Custom agent:** a distinct specialist lane with clear delegation rules.
|
|
259
|
+
- **MCP/tool permission change:** a safe access adjustment for an existing agent.
|
|
260
|
+
- **Project playbook/doc:** human-readable process guidance when automation is too
|
|
261
|
+
heavy.
|
|
262
|
+
- **Skip:** weak, one-off, ambiguous, sensitive, or already-covered work.
|
|
263
|
+
|
|
264
|
+
Avoid creating custom agents when a prompt rule or skill is enough. Avoid skills
|
|
265
|
+
when a short project playbook is enough. Avoid config changes when the benefit is
|
|
266
|
+
unclear.
|
|
267
|
+
|
|
268
|
+
### 5. Propose Before Changing
|
|
269
|
+
|
|
270
|
+
Unless the user explicitly requested a specific edit, present a concise proposal
|
|
271
|
+
before writing files or changing config:
|
|
272
|
+
|
|
273
|
+
```text
|
|
274
|
+
Found 2 strong repeated workflows and 1 weak candidate.
|
|
275
|
+
|
|
276
|
+
Recommended:
|
|
277
|
+
- Add a small orchestrator prompt rule for <workflow> because <evidence>.
|
|
278
|
+
- Extend existing <skill> instead of creating a new one because <overlap>.
|
|
279
|
+
|
|
280
|
+
Skip:
|
|
281
|
+
- <candidate> because it only appeared once.
|
|
282
|
+
|
|
283
|
+
Proceed with the proposed edits?
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
When applying changes, preserve existing user settings and prefer narrow,
|
|
287
|
+
append-only edits.
|
|
288
|
+
|
|
289
|
+
## Output Format
|
|
290
|
+
|
|
291
|
+
Return a compact report:
|
|
292
|
+
|
|
293
|
+
```text
|
|
294
|
+
Findings
|
|
295
|
+
- <workflow>: evidence, frequency/confidence, recommended form.
|
|
296
|
+
|
|
297
|
+
Recommended changes
|
|
298
|
+
- <asset/config/doc>: one-line purpose and why this is the smallest useful form.
|
|
299
|
+
|
|
300
|
+
Skipped
|
|
301
|
+
- <candidate>: why not worth packaging now.
|
|
302
|
+
|
|
303
|
+
Needs more evidence
|
|
304
|
+
- <candidate>: what would make it actionable.
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
If nothing qualifies, say:
|
|
308
|
+
|
|
309
|
+
```text
|
|
310
|
+
No strong repeated workflow found. I would not add or change any reusable assets
|
|
311
|
+
yet.
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
## Guardrails
|
|
315
|
+
|
|
316
|
+
- Do not manufacture assets to justify the workflow.
|
|
317
|
+
- Do not create overlapping skills or agents.
|
|
318
|
+
- Do not silently change global config, prompts, or permissions.
|
|
319
|
+
- Do not add broad instructions that make agents more eager, expensive, or
|
|
320
|
+
invasive without a clear benefit.
|
|
321
|
+
- Do not overfit to a single session unless the user explicitly asks for that
|
|
322
|
+
exact reusable workflow.
|
|
323
|
+
- Do not use private or sensitive material as examples in generated assets.
|
|
324
|
+
- When config, prompt, agent, skill, MCP, or plugin files change, tell the user:
|
|
325
|
+
"This should apply on the next OpenCode run; restart OpenCode if you need it
|
|
326
|
+
immediately."
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Simplify Skill
|
|
2
|
+
|
|
3
|
+
Behavior-preserving code simplification and readability-focused refactoring.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
This bundled skill helps the `oracle` agent review and simplify code without
|
|
8
|
+
changing behavior. It focuses on readability, maintainability, and reducing
|
|
9
|
+
unnecessary complexity.
|
|
10
|
+
|
|
11
|
+
## Source
|
|
12
|
+
|
|
13
|
+
Adapted from Addy Osmani's
|
|
14
|
+
[`code-simplification` skill](https://github.com/addyosmani/agent-skills/blob/main/skills/code-simplification/SKILL.md).
|
|
15
|
+
|
|
16
|
+
## Installation
|
|
17
|
+
|
|
18
|
+
Bundled with `oh-my-opencode-slim` and installed automatically when bundled
|
|
19
|
+
skills are enabled via the installer.
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: simplify
|
|
3
|
+
description: Simplifies code for clarity without changing behavior. Use for readability, maintainability, and complexity reduction after behavior is understood.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Code Simplification
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
Simplify code by reducing complexity while preserving exact behavior. The goal is not fewer lines - it's code that is easier to read, understand, modify, and debug. Every simplification must pass a simple test: "Would a new team member understand this faster than the original?"
|
|
11
|
+
|
|
12
|
+
## When to Use
|
|
13
|
+
|
|
14
|
+
- After a feature is working and tests pass, but the implementation feels heavier than it needs to be
|
|
15
|
+
- During code review when readability or complexity issues are flagged
|
|
16
|
+
- When you encounter deeply nested logic, long functions, or unclear names
|
|
17
|
+
- When refactoring code written under time pressure
|
|
18
|
+
- When consolidating related logic scattered across files
|
|
19
|
+
- After merging changes that introduced duplication or inconsistency
|
|
20
|
+
|
|
21
|
+
**When NOT to use:**
|
|
22
|
+
|
|
23
|
+
- Code is already clean and readable - don't simplify for the sake of it
|
|
24
|
+
- You don't understand what the code does yet - comprehend before you simplify
|
|
25
|
+
- The code is performance-critical and the "simpler" version would be measurably slower
|
|
26
|
+
- You're about to rewrite the module entirely - simplifying throwaway code wastes effort
|
|
27
|
+
|
|
28
|
+
## The Five Principles
|
|
29
|
+
|
|
30
|
+
### 1. Preserve Behavior Exactly
|
|
31
|
+
|
|
32
|
+
Don't change what the code does - only how it expresses it. All inputs, outputs, side effects, error behavior, and edge cases must remain identical. If you're not sure a simplification preserves behavior, don't make it.
|
|
33
|
+
|
|
34
|
+
Before every change, ask:
|
|
35
|
+
|
|
36
|
+
- Does this produce the same output for every input?
|
|
37
|
+
- Does this maintain the same error behavior?
|
|
38
|
+
- Does this preserve the same side effects and ordering?
|
|
39
|
+
- Do all existing tests still pass without modification?
|
|
40
|
+
|
|
41
|
+
### 2. Follow Project Conventions
|
|
42
|
+
|
|
43
|
+
Simplification means making code more consistent with the codebase, not imposing external preferences.
|
|
44
|
+
|
|
45
|
+
Before simplifying:
|
|
46
|
+
|
|
47
|
+
1. Read `AGENTS.md` / project conventions
|
|
48
|
+
2. Study how neighboring code handles similar patterns
|
|
49
|
+
3. Match the project's style for imports, naming, function style, error handling, and type annotations
|
|
50
|
+
|
|
51
|
+
Simplification that breaks project consistency is not simplification - it's churn.
|
|
52
|
+
|
|
53
|
+
### 3. Prefer Clarity Over Cleverness
|
|
54
|
+
|
|
55
|
+
Explicit code is better than compact code when the compact version requires a mental pause to parse.
|
|
56
|
+
|
|
57
|
+
- Replace nested ternaries with readable control flow
|
|
58
|
+
- Replace dense inline transforms with named intermediate steps when they clarify intent
|
|
59
|
+
- Keep helpful names even if they cost a few extra lines
|
|
60
|
+
|
|
61
|
+
### 4. Maintain Balance
|
|
62
|
+
|
|
63
|
+
Watch for over-simplification:
|
|
64
|
+
|
|
65
|
+
- Don't inline away names that carry meaning
|
|
66
|
+
- Don't merge unrelated logic into one larger function
|
|
67
|
+
- Don't remove abstractions that serve testability or extensibility
|
|
68
|
+
- Don't optimize for line count over comprehension
|
|
69
|
+
|
|
70
|
+
### 5. Scope to What Changed
|
|
71
|
+
|
|
72
|
+
Default to simplifying recently modified code. Avoid unrelated drive-by refactors unless explicitly asked.
|
|
73
|
+
|
|
74
|
+
## Process
|
|
75
|
+
|
|
76
|
+
### Step 1: Understand Before Touching
|
|
77
|
+
|
|
78
|
+
Before changing or removing anything, understand why it exists.
|
|
79
|
+
|
|
80
|
+
Answer:
|
|
81
|
+
|
|
82
|
+
- What is this code's responsibility?
|
|
83
|
+
- What calls it? What does it call?
|
|
84
|
+
- What are the edge cases and error paths?
|
|
85
|
+
- Are there tests that define expected behavior?
|
|
86
|
+
- Why might it have been written this way?
|
|
87
|
+
|
|
88
|
+
If you can't answer these, read more context first.
|
|
89
|
+
|
|
90
|
+
### Step 2: Look for Simplification Opportunities
|
|
91
|
+
|
|
92
|
+
Signals:
|
|
93
|
+
|
|
94
|
+
- Deep nesting
|
|
95
|
+
- Long functions with mixed responsibilities
|
|
96
|
+
- Nested ternaries
|
|
97
|
+
- Boolean flag arguments
|
|
98
|
+
- Repeated conditionals
|
|
99
|
+
- Generic or misleading names
|
|
100
|
+
- Duplicated logic
|
|
101
|
+
- Dead code
|
|
102
|
+
- Wrappers or abstractions that add no value
|
|
103
|
+
|
|
104
|
+
### Step 3: Apply Changes Incrementally
|
|
105
|
+
|
|
106
|
+
Make one simplification at a time.
|
|
107
|
+
|
|
108
|
+
For each simplification:
|
|
109
|
+
|
|
110
|
+
1. Make the change
|
|
111
|
+
2. Run relevant tests
|
|
112
|
+
3. Keep it only if behavior is preserved
|
|
113
|
+
|
|
114
|
+
Separate refactoring from feature work whenever possible.
|
|
115
|
+
|
|
116
|
+
### Step 4: Verify the Result
|
|
117
|
+
|
|
118
|
+
After simplifying, confirm:
|
|
119
|
+
|
|
120
|
+
- The code is genuinely easier to understand
|
|
121
|
+
- The diff is clean and reviewable
|
|
122
|
+
- Project conventions still match
|
|
123
|
+
- No behavior, error handling, or side effects changed
|
|
124
|
+
|
|
125
|
+
## Guidance for This Repository
|
|
126
|
+
|
|
127
|
+
- Prefer straightforward TypeScript over clever compression
|
|
128
|
+
- Preserve existing runtime behavior, tests, and hooks
|
|
129
|
+
- Favor explicit names and smaller focused helpers when they improve readability
|
|
130
|
+
- Keep refactors tightly scoped to the task or review feedback
|
|
131
|
+
|
|
132
|
+
## Verification Checklist
|
|
133
|
+
|
|
134
|
+
- [ ] Existing tests pass without modification
|
|
135
|
+
- [ ] Build/typecheck/lint still pass
|
|
136
|
+
- [ ] No unrelated files were refactored
|
|
137
|
+
- [ ] No error handling was weakened or removed
|
|
138
|
+
- [ ] The result is simpler to review than the original
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# src/skills/simplify/
|
|
2
|
+
|
|
3
|
+
## Responsibility
|
|
4
|
+
|
|
5
|
+
- Provide a behavior-preserving refactoring skill contract that constrains code cleanup to clarity-focused,
|
|
6
|
+
low-risk changes.
|
|
7
|
+
- Define explicit quality gates (understand-before-edit, behavior parity, incremental simplification, rollback-friendly diffs)
|
|
8
|
+
for any simplification task.
|
|
9
|
+
- Ship only metadata; no local runtime state machine is kept in this directory.
|
|
10
|
+
|
|
11
|
+
## Design
|
|
12
|
+
|
|
13
|
+
- Contract layer: `SKILL.md` is the executable prompt specification with explicit phases:
|
|
14
|
+
- pre-change understanding
|
|
15
|
+
- simplification candidate selection
|
|
16
|
+
- incremental transformation and verification
|
|
17
|
+
- final review checklist.
|
|
18
|
+
- Documentation layer: `README.md` explains intent, source provenance, and plugin install behavior.
|
|
19
|
+
- Policy model is declarative (`description`, allowed usage, checklist) consumed by the OpenCode skill executor,
|
|
20
|
+
without helper scripts or plugin code dependencies.
|
|
21
|
+
|
|
22
|
+
## Flow
|
|
23
|
+
|
|
24
|
+
- Agent discovery resolves `src/skills/simplify` as a custom skill entrypoint, then reads `SKILL.md` at runtime.
|
|
25
|
+
- Runtime behavior is gated by `src/cli/custom-skills.ts` (`allowedAgents: ['oracle']`) and by skill permissions
|
|
26
|
+
computed in `getSkillPermissionsForAgent()`.
|
|
27
|
+
- In practice the workflow is read-only and context-driven: simplify instructions require understanding of callers,
|
|
28
|
+
edge cases, and tests before mutation, then apply local, scoped refactors with validation.
|
|
29
|
+
- Consumers (Fixer/Oracle/Reviewer tasks) rely on this contract as operational constraints, not as executable TypeScript.
|
|
30
|
+
|
|
31
|
+
## Integration
|
|
32
|
+
|
|
33
|
+
- Installed by plugin installer (`installCustomSkills`) using `src/cli/install.ts` via `installCustomSkill()`.
|
|
34
|
+
- Permission surface is enforced by hook layer in `src/hooks/filter-available-skills/index.ts` (`permissionRules`).
|
|
35
|
+
- Release integrity: `scripts/verify-release-artifact.ts` checks for `src/skills/simplify/SKILL.md` in package tarballs.
|
|
36
|
+
- Operationally paired with codemap/fixer flows in `src/index.ts` orchestrations for post-feature readability hardening.
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: verification-planning
|
|
3
|
+
description: Verification planning for non-trivial coding work. Use before implementing a feature, bug fix, refactor, cross-system change, or high-confidence behavior change that needs a credible project-specific evidence path.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Verification Planning
|
|
7
|
+
|
|
8
|
+
## Build an evidence path
|
|
9
|
+
|
|
10
|
+
Before changing a non-trivial system, build an **evidence path**: a
|
|
11
|
+
project-specific route from the claim being made to evidence that can establish,
|
|
12
|
+
limit, or refute it.
|
|
13
|
+
|
|
14
|
+
The purpose is not to select a familiar technique. The purpose is to decide how
|
|
15
|
+
this system can reveal the truth of this particular change.
|
|
16
|
+
|
|
17
|
+
## 1. Frame the claim
|
|
18
|
+
|
|
19
|
+
State the behavior that needs to become true and the conditions that could make
|
|
20
|
+
a confident conclusion wrong.
|
|
21
|
+
|
|
22
|
+
Consider what must change, what must remain true, where the behavior crosses a
|
|
23
|
+
boundary, and which failure would matter most.
|
|
24
|
+
|
|
25
|
+
**Complete when:** the claim, its meaningful uncertainty, and its important
|
|
26
|
+
failure modes are concrete enough to investigate.
|
|
27
|
+
|
|
28
|
+
## 2. Design the evidence path
|
|
29
|
+
|
|
30
|
+
Derive possible evidence paths from the system itself: its controllable inputs,
|
|
31
|
+
observable effects, state transitions, invariants, boundaries, artifacts, and
|
|
32
|
+
ability to repeat or reverse a scenario.
|
|
33
|
+
|
|
34
|
+
Generate alternatives before choosing. Prefer the path that produces a
|
|
35
|
+
trustworthy conclusion with proportionate cost, safety, and effort.
|
|
36
|
+
|
|
37
|
+
**Complete when:** there is a preferred path, its limitations are understood,
|
|
38
|
+
and a weaker or stronger alternative is available if circumstances change.
|
|
39
|
+
|
|
40
|
+
## 3. Create a verification affordance when needed
|
|
41
|
+
|
|
42
|
+
When the existing system leaves the decisive truth too indirect or ambiguous,
|
|
43
|
+
extend the evidence path with a **verification affordance**: the smallest
|
|
44
|
+
capability that makes the relevant state controllable, observable, repeatable,
|
|
45
|
+
and diagnosable for an agent.
|
|
46
|
+
|
|
47
|
+
Ask what capability would let an agent establish the claim directly, repeat the
|
|
48
|
+
scenario from a known state, and explain a failure without inference. Prefer an
|
|
49
|
+
affordance that strengthens directness, determinism, agent-legibility,
|
|
50
|
+
isolation, resetability, or future reuse.
|
|
51
|
+
|
|
52
|
+
Treat the affordance as part of the evidence path, not an automatic product
|
|
53
|
+
feature. Decide deliberately whether it is temporary or durable before building
|
|
54
|
+
it.
|
|
55
|
+
|
|
56
|
+
**Complete when:** the chosen path can establish the claim directly enough for
|
|
57
|
+
its stakes, and any needed affordance has a defined lifecycle.
|
|
58
|
+
|
|
59
|
+
## 4. Research when the path is unknown
|
|
60
|
+
|
|
61
|
+
When the right evidence path depends on an unfamiliar dependency, framework,
|
|
62
|
+
external service, or rapidly changing capability, ask `@librarian` for focused
|
|
63
|
+
research before committing to an approach.
|
|
64
|
+
|
|
65
|
+
Ask for official or project-specific facilities, constraints, and trade-offs
|
|
66
|
+
that affect this exact verification problem. Use existing project evidence
|
|
67
|
+
directly when it already resolves the choice.
|
|
68
|
+
|
|
69
|
+
**Complete when:** the chosen path rests on known capabilities and real
|
|
70
|
+
constraints rather than assumption.
|
|
71
|
+
|
|
72
|
+
## 5. Make the path runnable
|
|
73
|
+
|
|
74
|
+
Prepare only the support needed to follow the evidence path reliably. Keep the
|
|
75
|
+
support narrow, repeatable, and safe to inspect.
|
|
76
|
+
|
|
77
|
+
Decide whether that support has recurring value or exists only to resolve the
|
|
78
|
+
current uncertainty. Retain durable value deliberately; remove temporary
|
|
79
|
+
support once it has served its purpose.
|
|
80
|
+
|
|
81
|
+
Ask before introducing dependencies, persistent diagnostic surfaces, or
|
|
82
|
+
structural changes whose sole purpose is evidence gathering.
|
|
83
|
+
|
|
84
|
+
**Complete when:** the path can be followed without guessing about setup,
|
|
85
|
+
state, or interpretation.
|
|
86
|
+
|
|
87
|
+
## 6. Close the evidence path
|
|
88
|
+
|
|
89
|
+
After implementation, follow the planned path and interpret the resulting
|
|
90
|
+
evidence against the original claim.
|
|
91
|
+
|
|
92
|
+
Report whether the claim was established, limited, or refuted; distinguish
|
|
93
|
+
known facts from remaining uncertainty.
|
|
94
|
+
|
|
95
|
+
**Complete when:** a future reader can see what supports the conclusion and
|
|
96
|
+
what remains outside its reach.
|
|
97
|
+
|
|
98
|
+
## Scope
|
|
99
|
+
|
|
100
|
+
Use this skill proportionately. Small mechanical changes can follow ordinary
|
|
101
|
+
project checks directly. For larger multi-phase work, let this skill establish
|
|
102
|
+
the evidence path that later work follows.
|