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.
Files changed (177) hide show
  1. package/LICENSE +21 -0
  2. package/README.ja-JP.md +775 -0
  3. package/README.ko-KR.md +796 -0
  4. package/README.md +792 -0
  5. package/README.zh-CN.md +765 -0
  6. package/dist/agents/council.d.ts +27 -0
  7. package/dist/agents/councillor.d.ts +2 -0
  8. package/dist/agents/designer.d.ts +2 -0
  9. package/dist/agents/explorer.d.ts +2 -0
  10. package/dist/agents/fixer.d.ts +2 -0
  11. package/dist/agents/index.d.ts +31 -0
  12. package/dist/agents/librarian.d.ts +2 -0
  13. package/dist/agents/observer.d.ts +2 -0
  14. package/dist/agents/oracle.d.ts +2 -0
  15. package/dist/agents/orchestrator.d.ts +28 -0
  16. package/dist/agents/permissions.d.ts +10 -0
  17. package/dist/cli/background-subagents.d.ts +13 -0
  18. package/dist/cli/companion.d.ts +4 -0
  19. package/dist/cli/config-io.d.ts +25 -0
  20. package/dist/cli/config-manager.d.ts +4 -0
  21. package/dist/cli/custom-skills-registry.d.ts +18 -0
  22. package/dist/cli/custom-skills.d.ts +13 -0
  23. package/dist/cli/doctor.d.ts +38 -0
  24. package/dist/cli/index.d.ts +3 -0
  25. package/dist/cli/index.js +3565 -0
  26. package/dist/cli/install.d.ts +7 -0
  27. package/dist/cli/model-key-normalization.d.ts +1 -0
  28. package/dist/cli/paths.d.ts +35 -0
  29. package/dist/cli/providers.d.ts +145 -0
  30. package/dist/cli/skills.d.ts +24 -0
  31. package/dist/cli/system.d.ts +6 -0
  32. package/dist/cli/types.d.ts +47 -0
  33. package/dist/companion/manager.d.ts +50 -0
  34. package/dist/companion/updater.d.ts +36 -0
  35. package/dist/config/agent-mcps.d.ts +11 -0
  36. package/dist/config/constants.d.ts +38 -0
  37. package/dist/config/council-schema.d.ts +137 -0
  38. package/dist/config/index.d.ts +5 -0
  39. package/dist/config/loader.d.ts +88 -0
  40. package/dist/config/runtime-preset.d.ts +11 -0
  41. package/dist/config/schema.d.ts +1107 -0
  42. package/dist/config/strip-orchestrator-model.d.ts +9 -0
  43. package/dist/config/utils.d.ts +18 -0
  44. package/dist/council/council-manager.d.ts +53 -0
  45. package/dist/council/index.d.ts +1 -0
  46. package/dist/hooks/apply-patch/codec.d.ts +7 -0
  47. package/dist/hooks/apply-patch/errors.d.ts +25 -0
  48. package/dist/hooks/apply-patch/execution-context.d.ts +27 -0
  49. package/dist/hooks/apply-patch/index.d.ts +15 -0
  50. package/dist/hooks/apply-patch/matching.d.ts +26 -0
  51. package/dist/hooks/apply-patch/operations.d.ts +3 -0
  52. package/dist/hooks/apply-patch/prepared-changes.d.ts +17 -0
  53. package/dist/hooks/apply-patch/resolution.d.ts +19 -0
  54. package/dist/hooks/apply-patch/rewrite.d.ts +7 -0
  55. package/dist/hooks/apply-patch/test-helpers.d.ts +6 -0
  56. package/dist/hooks/apply-patch/types.d.ts +80 -0
  57. package/dist/hooks/auto-update-checker/cache.d.ts +11 -0
  58. package/dist/hooks/auto-update-checker/checker.d.ts +38 -0
  59. package/dist/hooks/auto-update-checker/constants.d.ts +12 -0
  60. package/dist/hooks/auto-update-checker/index.d.ts +18 -0
  61. package/dist/hooks/auto-update-checker/skill-sync.d.ts +67 -0
  62. package/dist/hooks/auto-update-checker/types.d.ts +34 -0
  63. package/dist/hooks/chat-headers.d.ts +16 -0
  64. package/dist/hooks/command-hook-utils.d.ts +5 -0
  65. package/dist/hooks/deepwork/index.d.ts +13 -0
  66. package/dist/hooks/delegate-task-retry/hook.d.ts +8 -0
  67. package/dist/hooks/delegate-task-retry/patterns.d.ts +11 -0
  68. package/dist/hooks/filter-available-skills/index.d.ts +19 -0
  69. package/dist/hooks/foreground-fallback/index.d.ts +122 -0
  70. package/dist/hooks/image-hook.d.ts +8 -0
  71. package/dist/hooks/index.d.ts +16 -0
  72. package/dist/hooks/json-error-recovery/hook.d.ts +18 -0
  73. package/dist/hooks/loop-command/index.d.ts +13 -0
  74. package/dist/hooks/phase-reminder/index.d.ts +25 -0
  75. package/dist/hooks/post-file-tool-nudge/index.d.ts +23 -0
  76. package/dist/hooks/reflect/index.d.ts +13 -0
  77. package/dist/hooks/session-lifecycle.d.ts +10 -0
  78. package/dist/hooks/task-session-manager/index.d.ts +58 -0
  79. package/dist/hooks/task-session-manager/pending-call-tracker.d.ts +13 -0
  80. package/dist/hooks/task-session-manager/task-context-tracker.d.ts +14 -0
  81. package/dist/hooks/types.d.ts +26 -0
  82. package/dist/index.d.ts +5 -0
  83. package/dist/index.js +39519 -0
  84. package/dist/interview/dashboard-manager.d.ts +21 -0
  85. package/dist/interview/dashboard.d.ts +67 -0
  86. package/dist/interview/document.d.ts +29 -0
  87. package/dist/interview/helpers.d.ts +10 -0
  88. package/dist/interview/index.d.ts +1 -0
  89. package/dist/interview/manager.d.ts +21 -0
  90. package/dist/interview/parser.d.ts +11 -0
  91. package/dist/interview/prompts.d.ts +7 -0
  92. package/dist/interview/server.d.ts +15 -0
  93. package/dist/interview/service.d.ts +45 -0
  94. package/dist/interview/session-server.d.ts +21 -0
  95. package/dist/interview/types.d.ts +111 -0
  96. package/dist/interview/ui.d.ts +11 -0
  97. package/dist/loop/loop-session.d.ts +64 -0
  98. package/dist/mcp/context7.d.ts +6 -0
  99. package/dist/mcp/grep-app.d.ts +6 -0
  100. package/dist/mcp/index.d.ts +8 -0
  101. package/dist/mcp/types.d.ts +12 -0
  102. package/dist/mcp/websearch.d.ts +9 -0
  103. package/dist/multiplexer/cmux/close-policy.d.ts +20 -0
  104. package/dist/multiplexer/cmux/index.d.ts +102 -0
  105. package/dist/multiplexer/cmux/session-lifecycle.d.ts +92 -0
  106. package/dist/multiplexer/cmux/session-state.d.ts +45 -0
  107. package/dist/multiplexer/factory.d.ts +17 -0
  108. package/dist/multiplexer/herdr/index.d.ts +35 -0
  109. package/dist/multiplexer/index.d.ts +12 -0
  110. package/dist/multiplexer/session-manager.d.ts +69 -0
  111. package/dist/multiplexer/shared.d.ts +31 -0
  112. package/dist/multiplexer/tmux/index.d.ts +26 -0
  113. package/dist/multiplexer/types.d.ts +57 -0
  114. package/dist/multiplexer/zellij/index.d.ts +47 -0
  115. package/dist/tools/acp-run.d.ts +3 -0
  116. package/dist/tools/ast-grep/cli.d.ts +15 -0
  117. package/dist/tools/ast-grep/constants.d.ts +25 -0
  118. package/dist/tools/ast-grep/downloader.d.ts +5 -0
  119. package/dist/tools/ast-grep/index.d.ts +10 -0
  120. package/dist/tools/ast-grep/tools.d.ts +3 -0
  121. package/dist/tools/ast-grep/types.d.ts +30 -0
  122. package/dist/tools/ast-grep/utils.d.ts +4 -0
  123. package/dist/tools/cancel-task.d.ts +16 -0
  124. package/dist/tools/council.d.ts +10 -0
  125. package/dist/tools/index.d.ts +7 -0
  126. package/dist/tools/preset-manager.d.ts +26 -0
  127. package/dist/tools/smartfetch/binary.d.ts +3 -0
  128. package/dist/tools/smartfetch/cache.d.ts +6 -0
  129. package/dist/tools/smartfetch/constants.d.ts +12 -0
  130. package/dist/tools/smartfetch/index.d.ts +3 -0
  131. package/dist/tools/smartfetch/network.d.ts +38 -0
  132. package/dist/tools/smartfetch/secondary-model.d.ts +35 -0
  133. package/dist/tools/smartfetch/tool.d.ts +3 -0
  134. package/dist/tools/smartfetch/types.d.ts +122 -0
  135. package/dist/tools/smartfetch/utils.d.ts +20 -0
  136. package/dist/tui-state.d.ts +18 -0
  137. package/dist/tui.d.ts +13 -0
  138. package/dist/tui.js +1112 -0
  139. package/dist/utils/agent-variant.d.ts +23 -0
  140. package/dist/utils/background-job-board.d.ts +113 -0
  141. package/dist/utils/background-job-coordinator.d.ts +72 -0
  142. package/dist/utils/background-job-store.d.ts +46 -0
  143. package/dist/utils/compat.d.ts +29 -0
  144. package/dist/utils/councillor-models.d.ts +20 -0
  145. package/dist/utils/env.d.ts +3 -0
  146. package/dist/utils/escape-html.d.ts +1 -0
  147. package/dist/utils/frontmatter.d.ts +6 -0
  148. package/dist/utils/guards.d.ts +4 -0
  149. package/dist/utils/index.d.ts +10 -0
  150. package/dist/utils/internal-initiator.d.ts +11 -0
  151. package/dist/utils/logger.d.ts +6 -0
  152. package/dist/utils/polling.d.ts +21 -0
  153. package/dist/utils/session.d.ts +75 -0
  154. package/dist/utils/subagent-depth.d.ts +35 -0
  155. package/dist/utils/system-collapse.d.ts +6 -0
  156. package/dist/utils/task.d.ts +20 -0
  157. package/dist/utils/zip-extractor.d.ts +1 -0
  158. package/package.json +108 -0
  159. package/src/companion/companion-manifest.json +12 -0
  160. package/src/skills/clonedeps/README.md +23 -0
  161. package/src/skills/clonedeps/SKILL.md +240 -0
  162. package/src/skills/clonedeps/codemap.md +32 -0
  163. package/src/skills/codemap/README.md +59 -0
  164. package/src/skills/codemap/SKILL.md +163 -0
  165. package/src/skills/codemap/codemap.md +36 -0
  166. package/src/skills/codemap/scripts/codemap.mjs +483 -0
  167. package/src/skills/codemap/scripts/codemap.test.ts +129 -0
  168. package/src/skills/codemap.md +78 -0
  169. package/src/skills/deepwork/SKILL.md +122 -0
  170. package/src/skills/loop-engineering/SKILL.md +30 -0
  171. package/src/skills/oh-my-opencode-slim/SKILL.md +326 -0
  172. package/src/skills/reflect/SKILL.md +326 -0
  173. package/src/skills/simplify/README.md +19 -0
  174. package/src/skills/simplify/SKILL.md +138 -0
  175. package/src/skills/simplify/codemap.md +36 -0
  176. package/src/skills/verification-planning/SKILL.md +102 -0
  177. package/src/skills/worktrees/SKILL.md +171 -0
@@ -0,0 +1,23 @@
1
+ # clonedeps
2
+
3
+ `clonedeps` is a bundled OpenCode workflow skill for cloning a small set of
4
+ important dependency source repositories into a local ignored workspace so agents
5
+ can read library internals.
6
+
7
+ It is orchestrator-owned. The orchestrator delegates source discovery and URL/ref
8
+ resolution to `@librarian`, asks for approval, then performs the git and
9
+ filesystem operations directly.
10
+
11
+ There is intentionally no helper script. Dependency discovery, ref validation,
12
+ and cloning are repo-specific enough that the orchestrator/librarian workflow is
13
+ safer than a brittle cross-ecosystem script.
14
+
15
+ Cloned repositories live under `.slim/clonedeps/repos/<safe-repo-name>/`, one
16
+ folder per source repository, and are ignored by git. `.slim/clonedeps.json` is
17
+ intentionally trackable project
18
+ metadata. After cloning, the orchestrator should add or update a concise
19
+ `## Cloned Dependency Source` section in root `AGENTS.md` that lists each
20
+ read-only cloned repo path directly with a one-sentence purpose.
21
+
22
+ If `.slim/clonedeps.json` already exists, read it first and reuse those clones
23
+ before asking `@librarian` for new recommendations.
@@ -0,0 +1,240 @@
1
+ ---
2
+ name: clonedeps
3
+ description: Clone important project dependency source code into an ignored local workspace so OpenCode can inspect library internals. Use when the user asks to clone dependencies, inspect dependency/source internals, understand SDK/framework behavior from source, debug library implementation details, or make core dependency repos locally readable. Do not use for ordinary API/docs questions where @librarian is enough.
4
+ ---
5
+
6
+ # Clonedeps Skill
7
+
8
+ You help users make a small set of important dependency source repositories
9
+ locally readable to OpenCode.
10
+
11
+ This is a workflow skill, not a command wrapper. Do not use a helper script for
12
+ dependency detection, ref validation, cloning, status, or cleanup. The
13
+ orchestrator and `@librarian` do the repo-specific thinking; the orchestrator
14
+ performs the approved filesystem/git operations directly.
15
+
16
+ ## Workflow
17
+
18
+ ### Step 1: Check Existing State
19
+
20
+ First check whether `.slim/clonedeps.json` exists.
21
+
22
+ If it exists:
23
+
24
+ 1. Read it before asking librarian for a new plan.
25
+ 2. Check whether each listed `path` exists under `.slim/clonedeps/repos/`.
26
+ 3. Reuse existing cloned repos when they already satisfy the user's task.
27
+ 4. Only ask librarian for new recommendations if the existing manifest is
28
+ missing, stale, or insufficient for the current task.
29
+
30
+ Do not rescan/re-plan from scratch when the manifest already has useful entries.
31
+
32
+ ### Step 2: Ask Librarian for the Clone Plan
33
+
34
+ Delegate dependency discovery and source resolution to `@librarian`.
35
+
36
+ Use this prompt:
37
+
38
+ ```md
39
+ Understand this project first, then recommend remote source repos that would
40
+ help a developer work on it.
41
+
42
+ Read enough of the current repo to understand:
43
+ - what the project does
44
+ - its main architecture
45
+ - the important integration points
46
+ - what external systems or libraries it depends on in practice
47
+
48
+ Think like a developer trying to debug or extend this project.
49
+
50
+ Which remote repositories, if cloned locally, would actually help understand the
51
+ codebase or solve likely implementation/debugging tasks?
52
+
53
+ Do not make a dependency dump. Most dependencies are not worth cloning.
54
+ Recommend a repo only when its source code would be more useful than docs or the
55
+ current repo alone.
56
+
57
+ For each recommendation, include:
58
+ - repo name
59
+ - repo URL
60
+ - suggested ref/tag/commit if known
61
+ - why cloning this source would help
62
+ - when it would be useful
63
+ - caveats
64
+
65
+ Also include:
66
+ - current-repo files/folders to inspect first
67
+ - repos/dependencies you considered but would not clone
68
+
69
+ Keep it small. Prefer 0–3 strong recommendations over 5 weak ones. If nothing
70
+ clearly needs cloning, say so.
71
+ ```
72
+
73
+ Librarian should return a small plan with:
74
+
75
+ - dependency name;
76
+ - current version/range if discoverable;
77
+ - official source repository URL;
78
+ - tag/commit/ref to check out;
79
+ - package subdirectory if the source is a monorepo;
80
+ - reason local source helps;
81
+ - caveats such as huge repo, missing tag, or uncertain version mapping.
82
+
83
+ Prefer at most 3-5 core dependencies. Include user-mentioned dependencies and
84
+ central frameworks, SDKs, ORMs, runtime/plugin APIs, or build/runtime tools. Do
85
+ not clone tiny utilities, transitive dependencies, or dev-only tools unless they
86
+ are directly relevant to the active task.
87
+
88
+ ### Step 3: Verify and Confirm the Plan
89
+
90
+ The orchestrator owns final approval. Before cloning:
91
+
92
+ 1. Verify refs manually where possible with `git ls-remote`.
93
+ 2. Prefer pinned tags or commit SHAs. If no exact tag exists, ask librarian to
94
+ find the correct module-specific tag/commit or explain the fallback.
95
+ 3. Only use HTTPS GitHub/GitLab-style repository URLs by default. Reject
96
+ `file://`, SSH URLs, local paths, URLs with embedded credentials, and private
97
+ or auth-required repositories unless the user explicitly approves that case.
98
+ 4. Present the plan to the user with dependency, repo URL, ref, reason, and
99
+ caveats.
100
+ 5. Ask for confirmation before network cloning unless the user explicitly asked
101
+ to clone immediately.
102
+
103
+ ### Step 4: Update Ignore Files
104
+
105
+ Before cloning artifacts or cleaning cloned dependencies, inspect existing
106
+ `.gitignore` and `.ignore`. Update the managed block in place when present;
107
+ otherwise append it. Add only the missing exact lines below, never duplicate
108
+ entries or modify unrelated rules. These blocks keep cloned artifacts git-local
109
+ while the `.ignore` allowlist keeps them readable to OpenCode.
110
+
111
+ `.gitignore`:
112
+
113
+ ```gitignore
114
+ # BEGIN oh-my-opencode-slim clonedeps
115
+ .slim/clonedeps/repos/
116
+ # END oh-my-opencode-slim clonedeps
117
+ ```
118
+
119
+ `.ignore`:
120
+
121
+ ```ignore
122
+ # BEGIN oh-my-opencode-slim clonedeps
123
+ !.slim/
124
+ !.slim/clonedeps.json
125
+ !.slim/clonedeps/
126
+ !.slim/clonedeps/repos/
127
+ !.slim/clonedeps/repos/**
128
+ .slim/clonedeps/repos/**/.git/
129
+ .slim/clonedeps/repos/**/.git/**
130
+ # END oh-my-opencode-slim clonedeps
131
+ ```
132
+
133
+ ### Step 5: Clone Sources Manually
134
+
135
+ Create one folder per source repository under:
136
+
137
+ ```text
138
+ .slim/clonedeps/repos/<safe-repo-name>/
139
+ ```
140
+
141
+ Derive the safe name from the repository owner/name, not from the package name.
142
+ For example, `https://github.com/opencode-ai/opencode.git` becomes
143
+ `opencode-ai__opencode`. Replace `/` with `__`, strip common `.git` suffixes,
144
+ and replace other unsafe path characters with `_`.
145
+
146
+ If multiple packages come from the same monorepo, clone the repository once and
147
+ point each manifest entry at the same repo path with different `packagePath`
148
+ values as needed. Do not create ecosystem folders, per-package clone folders, or
149
+ per-version folders. If two different source repositories normalize to the same
150
+ safe name, disambiguate manually and record the chosen path in
151
+ `.slim/clonedeps.json`.
152
+
153
+ Clone/fetch with normal git commands. For an existing clone, first verify that
154
+ `git remote get-url origin` matches the approved repo URL. If it does not match,
155
+ stop and ask whether to clean/reclone.
156
+
157
+ Safe manual git pattern:
158
+
159
+ 1. `git ls-remote <repoUrl> <ref>` to verify the ref where practical.
160
+ 2. Clone without submodules/recursive behavior.
161
+ 3. Prefer shallow fetch/clone where practical.
162
+ 4. Clone into a temporary directory under `.slim/clonedeps/repos/`, then move it
163
+ into the final safe-name path after checkout succeeds.
164
+ 5. Remove failed temporary clones.
165
+
166
+ Do not run dependency install/build/test scripts from cloned repositories.
167
+
168
+ ### Step 6: Write Local State
169
+
170
+ Write `.slim/clonedeps.json` so future agents know what exists:
171
+
172
+ ```json
173
+ {
174
+ "version": "1.0.0",
175
+ "updatedAt": "2026-05-12T00:00:00.000Z",
176
+ "dependencies": [
177
+ {
178
+ "name": "@opencode-ai/plugin",
179
+ "resolvedVersion": "1.3.17",
180
+ "repoUrl": "https://github.com/opencode-ai/opencode.git",
181
+ "ref": "v1.3.17",
182
+ "path": ".slim/clonedeps/repos/opencode-ai__opencode",
183
+ "packagePath": "packages/plugin",
184
+ "reason": "Plugin API source used by the project"
185
+ },
186
+ {
187
+ "name": "@opencode-ai/sdk",
188
+ "resolvedVersion": "1.3.17",
189
+ "repoUrl": "https://github.com/opencode-ai/opencode.git",
190
+ "ref": "v1.3.17",
191
+ "path": ".slim/clonedeps/repos/opencode-ai__opencode",
192
+ "packagePath": "packages/sdk/js",
193
+ "reason": "Core SDK source used to inspect runtime behavior"
194
+ }
195
+ ]
196
+ }
197
+ ```
198
+
199
+ If a clone fails after earlier clones succeeded, still write state for the
200
+ successful clones so future inspection is not misleading.
201
+
202
+ Do not add `.slim/clonedeps.json` to `.gitignore`. It is small, reviewable
203
+ project metadata that can be committed. Only the cloned repository contents
204
+ under `.slim/clonedeps/repos/` should be ignored.
205
+
206
+ ### Step 7: Register Dependency Source in AGENTS.md
207
+
208
+ After successful cloning, update the repository root `AGENTS.md` so future
209
+ agents know why the dependency source exists and where to look.
210
+
211
+ If `AGENTS.md` already has a `## Cloned Dependency Source` section, update that
212
+ section. Otherwise append this section:
213
+
214
+ Use this format and list the actual repos directly. Keep each item to one short
215
+ sentence so future agents do not need an extra read just to know what is there:
216
+
217
+ ```markdown
218
+ ## Cloned Dependency Source
219
+
220
+ Read-only dependency source repositories are available under
221
+ `.slim/clonedeps/repos/` for inspection. Do not edit these clones.
222
+
223
+ - `.slim/clonedeps/repos/<safe-name>/` - `<repo>` at `<ref>`; <one sentence on
224
+ why this source is useful>.
225
+ - `.slim/clonedeps/repos/<safe-name-2>/` - `<repo>` at `<ref>`; <one sentence on
226
+ why this source is useful>.
227
+ ```
228
+
229
+ Also keep `.slim/clonedeps.json` updated as the structured manifest, but do not
230
+ make agents read it for the basic repo list.
231
+
232
+ ## Cleanup
233
+
234
+ When the user asks to clean cloned dependencies, remove:
235
+
236
+ - `.slim/clonedeps/repos/`
237
+ - the managed clonedeps marker blocks from `.gitignore` and `.ignore`
238
+
239
+ Ask before removing `.slim/clonedeps.json` or the `AGENTS.md` section because
240
+ they may be intentional project metadata.
@@ -0,0 +1,32 @@
1
+ # src/skills/clonedeps/
2
+
3
+ ## Responsibility
4
+ Manages the cloning and management of read-only dependency source repositories into `.slim/clonedeps/repos/` for offline inspection. This skill provides a workflow (not a command wrapper) that guides the orchestrator and `@librarian` through cloning dependency sources so agents can inspect library internals without requiring network access.
5
+
6
+ ## Design
7
+ - **Workflow skill, not a command wrapper**: No helper scripts or TypeScript utility functions. The orchestrator owns the decision-making; `@librarian` recommends sources; the orchestrator performs filesystem/git operations directly.
8
+ - **Read-only clones**: Dependencies are cloned into `.slim/clonedeps/repos/` and should not be modified.
9
+ - **Cache strategy**: Existing clones are reused when they satisfy the task. Only fetch when the manifest entry is missing or stale.
10
+ - **Agent-driven**: No runtime TS helpers (no `getClonedDepPath` utility). Agents resolve paths from `.slim/clonedeps.json` if needed.
11
+ - **Configuration**: Uses `.slim/clonedeps.json` in the project root to define which repositories are cloned and their checked-out refs.
12
+
13
+ ## Flow
14
+ 1. **Check existing state**: Read `.slim/clonedeps.json` (if it exists). Check whether each listed `path` exists under `.slim/clonedeps/repos/`.
15
+ 2. **Ask librarian for plan**: Delegate dependency discovery and source resolution to `@librarian`, who returns a small plan (dependency name, repo URL, ref, package subdirectory, reason).
16
+ 3. **Verify and confirm**: Orchestrator verifies refs with `git ls-remote`, avoids unsafe URLs, presents plan to user, and gets approval before cloning.
17
+ 4. **Clone sources**: Orchestrator runs git commands directly. Creates one folder per source under `.slim/clonedeps/repos/<safe-repo-name>/`. Prefers shallow clones, pinned tags, HTTPS URLs.
18
+ 5. **Write local state**: Writes `.slim/clonedeps.json` with structured manifest (version, updatedAt, dependencies array).
19
+ 6. **Update ignore files**: Adds idempotent marker blocks to `.gitignore` and `.ignore`.
20
+ 7. **Register in AGENTS.md**: Appends a `## Cloned Dependency Source` section so future agents know what exists.
21
+
22
+ ## Integration
23
+ - **Consumed by**: Agents that need to inspect dependency internals (e.g., `@librarian`, `@explorer`) via the registered paths in AGENTS.md.
24
+ - **Depends on**: Git CLI (for `git clone`, `git ls-remote`), `.slim/clonedeps.json` manifest.
25
+ - **Outputs**: Local filesystem paths under `.slim/clonedeps/repos/` for agent inspection.
26
+
27
+ ## Notes
28
+ - Cloned repositories are read-only and should not be edited.
29
+ - The cache directory (`.slim/clonedeps/repos/`) is in the **project directory**, not the user's home directory.
30
+ - This skill is for development and debugging; it does not affect runtime behavior.
31
+ - `.slim/clonedeps.json` is small structured metadata that can be committed.
32
+ - Only `.slim/clonedeps/repos/` is gitignored.
@@ -0,0 +1,59 @@
1
+ # Codemap Skill
2
+
3
+ Repository understanding and hierarchical codemap generation.
4
+
5
+ ## Overview
6
+
7
+ Codemap helps orchestrators map and understand codebases by:
8
+
9
+ 1. Selecting relevant code/config files using LLM judgment
10
+ 2. Creating `.slim/codemap.json` for change tracking
11
+ 3. Generating empty `codemap.md` templates for fixers to fill in
12
+
13
+ Legacy `.slim/cartography.json` state is migrated to `.slim/codemap.json` automatically.
14
+
15
+ ## Commands
16
+
17
+ ```bash
18
+ # Initialize mapping
19
+ node codemap.mjs init --root /repo --include "src/**/*.ts" --exclude "node_modules/**"
20
+
21
+ # Check what changed
22
+ node codemap.mjs changes --root /repo
23
+
24
+ # Update hashes
25
+ node codemap.mjs update --root /repo
26
+ ```
27
+
28
+ ## Outputs
29
+
30
+ ### .slim/codemap.json
31
+
32
+ ```json
33
+ {
34
+ "metadata": {
35
+ "version": "1.0.0",
36
+ "last_run": "2026-01-25T19:00:00Z",
37
+ "include_patterns": ["src/**/*.ts"],
38
+ "exclude_patterns": ["node_modules/**"]
39
+ },
40
+ "file_hashes": {
41
+ "src/index.ts": "abc123..."
42
+ },
43
+ "folder_hashes": {
44
+ "src": "def456..."
45
+ }
46
+ }
47
+ ```
48
+
49
+ ### codemap.md (per folder)
50
+
51
+ Empty templates created in each folder for fixers to fill with:
52
+ - Responsibility
53
+ - Design patterns
54
+ - Data/control flow
55
+ - Integration points
56
+
57
+ ## Installation
58
+
59
+ Installed automatically via oh-my-opencode-slim installer when custom skills are enabled.
@@ -0,0 +1,163 @@
1
+ ---
2
+ name: codemap
3
+ description: Generate comprehensive hierarchical codemaps for UNFAMILIAR repositories. Expensive operation - only use when explicitly asked for codebase documentation or initial repository mapping
4
+ ---
5
+
6
+ # Codemap Skill
7
+
8
+ You help users understand and map repositories by creating hierarchical codemaps.
9
+
10
+ ## When to Use
11
+
12
+ - User asks to understand/map a repository
13
+ - User wants codebase documentation
14
+ - Starting work on an unfamiliar codebase
15
+
16
+ ## Workflow
17
+
18
+ ### Step 1: Check for Existing State
19
+
20
+ **First, check if `.slim/codemap.json` exists in the repo root.**
21
+
22
+ If it does not exist, check for legacy state at `.slim/cartography.json`.
23
+
24
+ If legacy state exists: move `.slim/cartography.json` to `.slim/codemap.json`, then continue with change detection.
25
+
26
+ If `.slim/codemap.json` exists: Skip to Step 3 (Detect Changes) - no need to re-initialize.
27
+
28
+ If neither file exists: Continue to Step 2 (Initialize).
29
+
30
+ ### Step 2: Initialize (Only if no state exists)
31
+
32
+ 1. **Analyze the repository structure** - List files, understand directories
33
+ 2. **Infer patterns** for **core code/config files ONLY** to include:
34
+ - **Include**: `src/**/*.ts`, `package.json`, etc.
35
+ - **Exclude (MANDATORY)**: Do NOT include tests, documentation, or translations.
36
+ - Tests: `**/*.test.ts`, `**/*.spec.ts`, `tests/**`, `__tests__/**`
37
+ - Docs: `docs/**`, `*.md` (except root `README.md` if needed), `LICENSE`
38
+ - Build/Deps: `node_modules/**`, `dist/**`, `build/**`, `*.min.js`
39
+ - Respect `.gitignore` automatically
40
+ 3. **Run codemap.mjs init**:
41
+
42
+ ```bash
43
+ node ~/.config/opencode/skills/codemap/scripts/codemap.mjs init \
44
+ --root ./ \
45
+ --include "src/**/*.ts" \
46
+ --exclude "**/*.test.ts" --exclude "dist/**" --exclude "node_modules/**"
47
+ ```
48
+
49
+ This creates:
50
+ - `.slim/codemap.json` - File and folder hashes for change detection
51
+ - Empty `codemap.md` files in all relevant subdirectories
52
+
53
+ 4. **Delegate codemap writing to Fixer agents** - Spawn one fixer per folder to read code and create or update its specific `codemap.md` file.
54
+
55
+ ### Step 3: Detect Changes (If state already exists)
56
+
57
+ 1. **Run codemap.mjs changes** to see what changed:
58
+
59
+ ```bash
60
+ node ~/.config/opencode/skills/codemap/scripts/codemap.mjs changes \
61
+ --root ./
62
+ ```
63
+
64
+ 2. **Review the output** - It shows:
65
+ - Added files
66
+ - Removed files
67
+ - Modified files
68
+ - Affected folders
69
+
70
+ 3. **Only update affected codemaps** - Spawn one fixer per affected folder to update its `codemap.md`.
71
+ 4. **Run update** to save new state:
72
+
73
+ ```bash
74
+ node ~/.config/opencode/skills/codemap/scripts/codemap.mjs update \
75
+ --root ./
76
+ ```
77
+
78
+ ### Step 4: Finalize Repository Atlas (Root Codemap)
79
+
80
+ Once all specific directories are mapped, the Orchestrator must create or update the root `codemap.md`. This file serves as the **Master Entry Point** for any agent or human entering the repository.
81
+
82
+ 1. **Map Root Assets**: Document the root-level files (e.g., `package.json`, `index.ts`, `plugin.json`) and the project's overall purpose.
83
+ 2. **Aggregate Sub-Maps**: Create a "Repository Directory Map" section. For every folder that has a `codemap.md`, extract its **Responsibility** summary and include it in a table or list in the root map.
84
+ 3. **Cross-Reference**: Ensure that the root map contains the absolute or relative paths to the sub-maps so agents can jump directly to the relevant details.
85
+
86
+ ### Step 5: Register Codemap in AGENTS.md
87
+
88
+ **OpenCode auto-loads `AGENTS.md` into agent context on every session.** To ensure agents automatically discover and use the codemap, update (or create) `AGENTS.md` at the repo root:
89
+
90
+ 1. If `AGENTS.md` already exists and already contains a `## Repository Map` section, **skip this step** - the reference is already set up.
91
+ 2. If `AGENTS.md` exists but has no `## Repository Map` section, **append** the section below.
92
+ 3. If `AGENTS.md` doesn't exist, **create** it with the section below.
93
+
94
+ ```markdown
95
+ ## Repository Map
96
+
97
+ A full codemap is available at `codemap.md` in the project root.
98
+
99
+ Before working on any task, read `codemap.md` to understand:
100
+ - Project architecture and entry points
101
+ - Directory responsibilities and design patterns
102
+ - Data flow and integration points between modules
103
+
104
+ For deep work on a specific folder, also read that folder's `codemap.md`.
105
+ ```
106
+
107
+ This is idempotent - repeated codemap runs will detect the existing section and skip. No duplication.
108
+
109
+ ## Codemap Content
110
+
111
+ Fixers are responsible for writing `codemap.md` files during this workflow. Use precise technical terminology to document the implementation:
112
+
113
+ - **Responsibility** - Define the specific role of this directory using standard software engineering terms (e.g., "Service Layer", "Data Access Object", "Middleware").
114
+ - **Design Patterns** - Identify and name specific patterns used (e.g., "Observer", "Singleton", "Factory", "Strategy"). Detail the abstractions and interfaces.
115
+ - **Data & Control Flow** - Explicitly trace how data enters and leaves the module. Mention specific function call sequences and state transitions.
116
+ - **Integration Points** - List dependencies and consumer modules. Use technical names for hooks, events, or API endpoints.
117
+
118
+ Example codemap:
119
+
120
+ ```markdown
121
+ # src/agents/
122
+
123
+ ## Responsibility
124
+ Defines agent personalities and manages their configuration lifecycle.
125
+
126
+ ## Design
127
+ Each agent is a prompt + permission set. Config system uses:
128
+ - Default prompts (orchestrator.ts, explorer.ts, etc.)
129
+ - User overrides from ~/.config/opencode/oh-my-opencode-slim.json
130
+ - Permission wildcards for skill/MCP access control
131
+
132
+ ## Flow
133
+ 1. Plugin loads → calls getAgentConfigs()
134
+ 2. Reads user config preset
135
+ 3. Merges defaults with overrides
136
+ 4. Applies permission rules (wildcard expansion)
137
+ 5. Returns agent configs to OpenCode
138
+
139
+ ## Integration
140
+ - Consumed by: Main plugin (src/index.ts)
141
+ - Depends on: Config loader, skills registry
142
+ ```
143
+
144
+ Example **Root Codemap (Atlas)**:
145
+
146
+ ```markdown
147
+ # Repository Atlas: oh-my-opencode-slim
148
+
149
+ ## Project Responsibility
150
+ A high-performance, low-latency agent orchestration plugin for OpenCode, focusing on specialized sub-agent delegation and multiplexer-assisted child sessions.
151
+
152
+ ## System Entry Points
153
+ - `src/index.ts`: Plugin initialization and OpenCode integration.
154
+ - `package.json`: Dependency manifest and build scripts.
155
+ - `oh-my-opencode-slim.json`: User configuration schema.
156
+
157
+ ## Directory Map (Aggregated)
158
+ | Directory | Responsibility Summary | Detailed Map |
159
+ |-----------|------------------------|--------------|
160
+ | `src/agents/` | Defines agent personalities (Orchestrator, Explorer) and manages model routing. | [View Map](src/agents/codemap.md) |
161
+ | `src/features/` | Core logic for tmux integration and session state. | [View Map](src/features/codemap.md) |
162
+ | `src/config/` | Implements the configuration loading pipeline and environment variable injection. | [View Map](src/config/codemap.md) |
163
+ ```
@@ -0,0 +1,36 @@
1
+ # src/skills/codemap/
2
+
3
+ ## Responsibility
4
+
5
+ - Provide a command-style skill package that standardizes repository mapping workflows for unfamiliar codebases.
6
+ - Define the task contract used by Orchestrator/fixer agents via `SKILL.md` and operational guidance via `README.md`.
7
+ - Generate and evolve change-aware codemap state artifacts (`.slim/codemap.json`) and scaffold placeholders (`codemap.md`).
8
+
9
+ ## Design
10
+
11
+ - Contract layer: `SKILL.md` (machine prompt contract) + `README.md` (human-facing operation notes).
12
+ - Execution layer: `scripts/codemap.mjs` exports deterministic helper functions:
13
+ - `parseArgs(argv)`
14
+ - `cmdInit`, `cmdChanges`, `cmdUpdate`
15
+ - `selectFiles`, `computeFileHash`, `computeFolderHash`, `createEmptyCodemap`
16
+ - `loadState`, `saveState`, `migrateLegacyState`
17
+ - Persistence model: JSON state at `.slim/codemap.json` with `metadata`, `file_hashes`, and `folder_hashes`.
18
+ - Testing layer: `scripts/codemap.test.ts` validates pattern matching, hash determinism, and migration behavior.
19
+ - The script intentionally avoids network and mutates only filesystem-local state and codemap templates.
20
+
21
+ ## Flow
22
+
23
+ - Entry point `main(argv)` parses command and arguments (`init|changes|update`, `--root`, `--include`, `--exclude`, `--exception`) and dispatches via strict branches.
24
+ - `cmdInit()` computes include/exclude candidate sets using `selectFiles()` and writes:
25
+ 1) `.slim/codemap.json` via `saveState()`
26
+ 2) one `codemap.md` per discovered folder via `createEmptyCodemap()`.
27
+ - `cmdChanges()` reloads state (`loadState()` + `migrateLegacyState()`), recomputes current hashes, emits added/removed/modified diffs and affected folder list, and exits non-zero if state is absent.
28
+ - `cmdUpdate()` recomputes full state from existing metadata and persists it, used after targeted fixers finish updates.
29
+ - `codemap` skill invocation path in SKILL workflow is explicit: Step 1 checks `.slim/codemap.json` or `.slim/cartography.json`, then Step 2/3 selects init or incremental path.
30
+
31
+ ## Integration
32
+
33
+ - Installed under OpenCode through `src/cli/custom-skills.ts` as `name: 'codemap'`, `sourcePath: 'src/skills/codemap'`.
34
+ - `src/cli/install.ts` copies this directory into the user skill directory; OpenCode executes `scripts/codemap.mjs` from that context.
35
+ - `src/hooks/filter-available-skills/index.ts` applies agent-level skill gating via names from `getSkillPermissionsForAgent()`.
36
+ - `scripts/verify-release-artifact.ts` includes codemap skill metadata and runtime checks as required packaged files.