opencode-agenthub 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 (61) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +373 -0
  3. package/dist/composer/bootstrap.js +493 -0
  4. package/dist/composer/builtin-assets.js +139 -0
  5. package/dist/composer/capabilities.js +20 -0
  6. package/dist/composer/compose.js +824 -0
  7. package/dist/composer/defaults.js +10 -0
  8. package/dist/composer/home-transfer.js +288 -0
  9. package/dist/composer/install-home.js +5 -0
  10. package/dist/composer/library/README.md +93 -0
  11. package/dist/composer/library/bundles/auto.json +18 -0
  12. package/dist/composer/library/bundles/build.json +17 -0
  13. package/dist/composer/library/bundles/hr-adapter.json +26 -0
  14. package/dist/composer/library/bundles/hr-cto.json +24 -0
  15. package/dist/composer/library/bundles/hr-evaluator.json +26 -0
  16. package/dist/composer/library/bundles/hr-planner.json +26 -0
  17. package/dist/composer/library/bundles/hr-sourcer.json +24 -0
  18. package/dist/composer/library/bundles/hr-verifier.json +26 -0
  19. package/dist/composer/library/bundles/hr.json +35 -0
  20. package/dist/composer/library/bundles/plan.json +19 -0
  21. package/dist/composer/library/instructions/hr-boundaries.md +38 -0
  22. package/dist/composer/library/instructions/hr-protocol.md +102 -0
  23. package/dist/composer/library/profiles/auto.json +9 -0
  24. package/dist/composer/library/profiles/hr.json +9 -0
  25. package/dist/composer/library/souls/auto.md +29 -0
  26. package/dist/composer/library/souls/build.md +21 -0
  27. package/dist/composer/library/souls/hr-adapter.md +64 -0
  28. package/dist/composer/library/souls/hr-cto.md +57 -0
  29. package/dist/composer/library/souls/hr-evaluator.md +64 -0
  30. package/dist/composer/library/souls/hr-planner.md +48 -0
  31. package/dist/composer/library/souls/hr-sourcer.md +70 -0
  32. package/dist/composer/library/souls/hr-verifier.md +62 -0
  33. package/dist/composer/library/souls/hr.md +186 -0
  34. package/dist/composer/library/souls/plan.md +23 -0
  35. package/dist/composer/library/workflow/auto-mode.json +139 -0
  36. package/dist/composer/model-utils.js +39 -0
  37. package/dist/composer/opencode-profile.js +2299 -0
  38. package/dist/composer/package-manager.js +75 -0
  39. package/dist/composer/package-version.js +20 -0
  40. package/dist/composer/platform.js +48 -0
  41. package/dist/composer/query.js +133 -0
  42. package/dist/composer/settings.js +400 -0
  43. package/dist/plugins/opencode-agenthub.js +310 -0
  44. package/dist/plugins/opencode-question.js +223 -0
  45. package/dist/plugins/plan-guidance.js +263 -0
  46. package/dist/plugins/runtime-config.js +57 -0
  47. package/dist/skills/agenthub-doctor/SKILL.md +238 -0
  48. package/dist/skills/agenthub-doctor/diagnose.js +213 -0
  49. package/dist/skills/agenthub-doctor/fix.js +293 -0
  50. package/dist/skills/agenthub-doctor/index.js +30 -0
  51. package/dist/skills/agenthub-doctor/interactive.js +756 -0
  52. package/dist/skills/hr-assembly/SKILL.md +121 -0
  53. package/dist/skills/hr-final-check/SKILL.md +98 -0
  54. package/dist/skills/hr-review/SKILL.md +100 -0
  55. package/dist/skills/hr-staffing/SKILL.md +85 -0
  56. package/dist/skills/hr-support/bin/sync_sources.py +560 -0
  57. package/dist/skills/hr-support/bin/validate_staged_package.py +290 -0
  58. package/dist/skills/hr-support/bin/vendor_stage_mcps.py +234 -0
  59. package/dist/skills/hr-support/bin/vendor_stage_skills.py +104 -0
  60. package/dist/types.js +11 -0
  61. package/package.json +54 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 tarquinen
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,373 @@
1
+ # opencode-agenthub
2
+
3
+ > **Alpha.** Requires Node >= 18.0.0. macOS and Linux are primary targets. Windows users should use WSL 2 for the best experience; native Windows remains best-effort in alpha.
4
+
5
+ `opencode-agenthub` is a lightweight framework and CLI for organizing your AI agents, skills, prompts, and workspace runtime setup into one consistent structure.
6
+
7
+ The npm package name is `opencode-agenthub`. The CLI command is `agenthub`. `opencode-agenthub` also works as a compatibility alias.
8
+
9
+ ---
10
+
11
+ ## Do you have this problem?
12
+
13
+ If any of these sound familiar, Agent Hub is for you:
14
+
15
+ - your agents, prompts, and skills are scattered across random folders
16
+ - every project needs slightly different AI behavior, but managing that by hand is messy
17
+ - you want a clean default `plan / build / auto` setup instead of rebuilding it each time
18
+
19
+ Or maybe this sounds more like you:
20
+
21
+ - you want to build your own agents, but you do not want to keep adjusting your global config or global plugins every time
22
+ - you want to build your own agents, but you do not know how to turn strong public GitHub repos into something reusable in your own setup
23
+ - you want HR help to assemble reusable agent teams from strong public GitHub agent / skill repos without polluting your normal setup
24
+
25
+ If yes, Agent Hub gives you a clear structure for building your own agent and skill library, along with an HR system that helps you assemble one.
26
+
27
+ ---
28
+
29
+ ## What it gives you
30
+
31
+ - one clean home for your reusable agent assets
32
+ - one simple built-in coding setup: `auto / plan / build`
33
+ - one per-workspace runtime, so each repo stays isolated
34
+ - one separate HR Office when you want to source or stage external assets
35
+
36
+ ---
37
+
38
+ ## Install
39
+
40
+ ```bash
41
+ npm install -g opencode-agenthub
42
+ ```
43
+
44
+ Then verify:
45
+
46
+ ```bash
47
+ agenthub --version
48
+ agenthub --help
49
+ ```
50
+
51
+ ## Requirements
52
+
53
+ - Node >= 18.0.0 on `PATH`
54
+ - [opencode](https://opencode.ai) on `PATH`
55
+ - Python 3 on `PATH` for HR inventory sync and staged-package helper scripts
56
+ - Bun (for tests/development only)
57
+
58
+ ### Platform support
59
+
60
+ | Platform | Status |
61
+ |---|---|
62
+ | macOS | Supported |
63
+ | Linux | Supported |
64
+ | Windows via WSL 2 | Supported and recommended |
65
+ | Native Windows | Best-effort alpha support |
66
+
67
+ For Windows users, install and run Agent Hub inside [WSL 2](https://learn.microsoft.com/en-us/windows/wsl/install). This matches OpenCode's recommended Windows setup and preserves expected POSIX behavior for bash launchers, Python helpers, symlinked skills, and shell tooling.
68
+
69
+ Native Windows is still best-effort in alpha. Agent Hub now emits a startup notice on native Windows, generates `run.cmd` alongside `run.sh`, and avoids a few common platform pitfalls, but HR and shell-centric workflows are still most reliable under WSL 2.
70
+
71
+ ---
72
+
73
+ ## Quick start
74
+
75
+ For most users, this is the whole onboarding flow:
76
+
77
+ ### 1. Create your home
78
+
79
+ ```bash
80
+ agenthub setup auto
81
+ ```
82
+
83
+ This creates your Agent Hub home and installs the built-in `auto / plan / build` setup.
84
+
85
+ ### 2. Confirm or change your default provider/model
86
+
87
+ `setup auto` imports your native opencode provider/model basics from:
88
+
89
+ - `~/.config/opencode/opencode.json`
90
+ - or `OPENCODE_AGENTHUB_NATIVE_CONFIG` if you set it
91
+
92
+ That is the first place to set your default AI provider.
93
+
94
+ After setup, Agent Hub also keeps the imported values in:
95
+
96
+ ```text
97
+ ~/.config/opencode-agenthub/settings.json
98
+ ```
99
+
100
+ ### 3. Start working in a repo
101
+
102
+ ```bash
103
+ agenthub start
104
+ ```
105
+
106
+ This composes your workspace runtime and launches your default team.
107
+
108
+ ### 4. (Optional) Call HR to assemble a customized team
109
+
110
+ ```bash
111
+ agenthub hr
112
+ ```
113
+
114
+ See details in the `HR Office` section.
115
+
116
+ ---
117
+
118
+ ## Agenthub setup flow
119
+
120
+ `agenthub setup auto` creates your Personal Home with built-in coding assets. `agenthub start` reads from it and composes a Workspace Runtime for the current repo.
121
+
122
+ ```mermaid
123
+ graph LR
124
+ A["agenthub setup auto"] -->|creates| H["Personal Home<br/>~/.config/opencode-agenthub/"]
125
+ H -->|reads| S["agenthub start"]
126
+ S -->|composes| W["Workspace Runtime"]
127
+ W --> R["work in this repo"]
128
+ ```
129
+
130
+ > **One-time:** `agenthub setup auto` - **Per-repo:** `agenthub start`
131
+
132
+ ## HR flow
133
+
134
+ `agenthub hr` uses a separate HR Office - first launch syncs the default source repos plus the canonical model catalog into a local inventory, then HR walks through five reviewable stages: Requirements -> Staffing Plan -> Candidate Review -> Architecture Review -> Staging & Confirmation.
135
+
136
+ ```mermaid
137
+ graph LR
138
+ SRC["Configured Repos"] -->|source| HR["agenthub hr"]
139
+ HR -->|opens| O["HR Office"]
140
+ O -->|stage| S["Candidate Teams"]
141
+ S -->|test| T["agenthub hr <profile><br/>current repo"]
142
+ S -->|approve| P["agenthub promote <package-id>"]
143
+ P -->|imports into| HOME["Personal Home<br/>~/.config/opencode-agenthub/"]
144
+ ```
145
+
146
+ > **Isolated:** HR Office never touches your Personal Home until you explicitly run `agenthub promote <package-id>`.
147
+
148
+ ---
149
+
150
+ ## Everyday start commands
151
+
152
+ ```bash
153
+ agenthub start
154
+ agenthub start last
155
+ agenthub start <profile>
156
+ agenthub start set <profile>
157
+ ```
158
+
159
+ | Command | Effect |
160
+ |---|---|
161
+ | `agenthub start` | Start your current default team in this workspace |
162
+ | `agenthub start last` | Reuse the last profile used in this workspace |
163
+ | `agenthub start <profile>` | Start a specific profile in this workspace |
164
+ | `agenthub start set <profile>` | Save a new personal default profile |
165
+
166
+ If you want structure only and no built-in coding team yet:
167
+
168
+ ```bash
169
+ agenthub setup minimal
170
+ ```
171
+
172
+ ---
173
+
174
+ ## Asset model
175
+
176
+ Most users only need to remember two ideas:
177
+
178
+ - **bundle (agent)** = soul + agent config + optional skills / MCP / policy
179
+ - **profile** = bundles + plugins + launch defaults
180
+
181
+ ### Main concepts
182
+
183
+ | Concept | What it is | Why it exists |
184
+ |---|---|---|
185
+ | **Soul** | The base prompt / behavior for an agent | Defines how an agent thinks and speaks |
186
+ | **Skill** | A reusable capability folder | Adds a specialized job or workflow |
187
+ | **Bundle (agent)** | A reusable worker definition | Connects a soul to model / permissions / skills / tools |
188
+ | **Profile** | A launchable team for one workspace | Chooses which bundles and plugins become active |
189
+
190
+ ### Everyday runtime parts
191
+
192
+ | Part | What it does | Default location |
193
+ |---|---|---|
194
+ | **Personal Home** | Your reusable main library of souls, skills, bundles, profiles, and settings | `~/.config/opencode-agenthub/` |
195
+ | **Workspace Runtime** | The active composed runtime for one project | `<workspace>/.opencode-agenthub/current/` |
196
+
197
+ If you used `setup auto`, you already have a ready-to-run default profile.
198
+
199
+ ---
200
+
201
+ ## Common commands
202
+
203
+ | Command | Effect |
204
+ |---|---|
205
+ | `agenthub new soul reviewer` | Create a new soul scaffold |
206
+ | `agenthub new skill repo-audit` | Create a new skill scaffold |
207
+ | `agenthub new bundle reviewer` | Create a new bundle scaffold |
208
+ | `agenthub new profile my-team` | Create a new profile scaffold |
209
+ | `agenthub list` | List installed assets |
210
+ | `agenthub backup --output ./my-team-backup` | Back up your Personal Home |
211
+ | `agenthub restore --source ./my-team-backup` | Restore your Personal Home from a backup |
212
+
213
+ ---
214
+
215
+ ## Storage layout
216
+
217
+ ### Personal Home
218
+
219
+ Default location:
220
+
221
+ ```text
222
+ ~/.config/opencode-agenthub/
223
+ ```
224
+
225
+ Created up front:
226
+
227
+ ```text
228
+ souls/
229
+ skills/
230
+ bundles/
231
+ profiles/
232
+ settings.json
233
+ ```
234
+
235
+ Created only when you actually use them:
236
+
237
+ ```text
238
+ instructions/
239
+ mcp/
240
+ mcp-servers/
241
+ ```
242
+
243
+ ### Workspace Runtime
244
+
245
+ Default location:
246
+
247
+ ```text
248
+ <workspace>/.opencode-agenthub/current/
249
+ ```
250
+
251
+ Workspace-specific memory lives in:
252
+
253
+ ```text
254
+ <workspace>/.opencode-agenthub.user.json
255
+ ```
256
+
257
+ That file stores things like:
258
+
259
+ - last-used `start` profile in this workspace
260
+ - last-used `hr` test profile in this workspace
261
+ - `.envrc` preference state
262
+
263
+ ---
264
+
265
+ ## How plain `opencode` fits in
266
+
267
+ When you start a profile in a workspace, Agent Hub can offer to generate `.envrc` so plain `opencode` works there without retyping `agenthub` every time.
268
+
269
+ That means:
270
+
271
+ - use `agenthub start ...` when you want to switch your normal workspace runtime
272
+ - use `agenthub hr <profile>` when you want to test an HR profile in a workspace
273
+ - then use plain `opencode` for day-to-day work inside that folder
274
+
275
+ ---
276
+
277
+ ## HR Office
278
+
279
+ Use `agenthub hr` when you want a separate place to source, test, adapt, or stage external agents or skills.
280
+
281
+ Default location:
282
+
283
+ ```text
284
+ ~/.config/opencode-agenthub-hr/
285
+ ```
286
+
287
+ Override with `OPENCODE_AGENTHUB_HR_HOME`.
288
+
289
+ ### HR commands
290
+
291
+ | Command | Effect |
292
+ |---|---|
293
+ | `agenthub hr` | Open or bootstrap the isolated HR Office |
294
+ | `agenthub hr <profile>` | Test an HR-home or staged HR profile in the current workspace before promote |
295
+ | `agenthub hr last` | Reuse the last HR profile tested in this workspace |
296
+ | `agenthub promote <package-id>` | Import an approved staged HR package into your Personal Home |
297
+
298
+ Typical staged-team flow:
299
+
300
+ 1. HR builds a package under `~/.config/opencode-agenthub-hr/staging/<package-id>/`
301
+ 2. Test it in your repo with `agenthub hr <profile>`
302
+ 3. Promote it with `agenthub promote <package-id>` once satisfied
303
+
304
+ ### HR runtime details
305
+
306
+ - HR syncs GitHub worker sources and a model catalog into `~/.config/opencode-agenthub-hr/inventory/`
307
+ - HR validates staged `provider/model` ids against that synced catalog instead of inventing names
308
+ - If a staged team should hide default opencode agents like `general`, `explore`, `plan`, and `build`, HR stages the profile with `nativeAgentPolicy: "team-only"`
309
+ - If approved during HR handoff, `agenthub promote <package-id>` can also make the promoted profile your new default bare `agenthub start` profile
310
+ - Model variants are stored separately as `model` + `variant`, not as one combined string
311
+
312
+ ### Example prompts
313
+
314
+ - `I want an agent that can build and verify TypeScript CLIs. Use strong public references, shortlist candidates, and stage a package for me.`
315
+ - `I want a frontend architect agent for Next.js and a11y review. Please source references, compare them, and propose a team.`
316
+
317
+ ### Default HR sources
318
+
319
+ HR Office bootstraps with these default GitHub sources:
320
+
321
+ - `garrytan/gstack`
322
+ - `anthropics/skills`
323
+ - `msitarzewski/agency-agents`
324
+ - `obra/superpowers`
325
+
326
+ It also bootstraps a default model catalog source:
327
+
328
+ - `https://models.dev/api.json`
329
+
330
+ Edit `~/.config/opencode-agenthub-hr/hr-config.json` to change either source set.
331
+
332
+ The synced model inventory is written under:
333
+
334
+ ```text
335
+ ~/.config/opencode-agenthub-hr/inventory/models/
336
+ ```
337
+
338
+ This gives HR an exact local list of valid `provider/model` ids during architecture review and adaptation.
339
+
340
+ Two good repos to add yourself if they match your needs:
341
+
342
+ - `K-Dense-AI/claude-scientific-skills` - strong scientific and research-oriented skills, but more niche than the default set
343
+ - `affaan-m/everything-claude-code` - broad practical Claude Code workflow pack if you want a larger, more opinionated source library
344
+
345
+ ---
346
+
347
+ ## Advanced settings
348
+
349
+ Most users do not need these on day one.
350
+
351
+ - **Instruction** — shared extra guidance you can attach to bundles
352
+ - **MCP entry** — external tool server configuration that a bundle can mount
353
+
354
+ ## Upgrade
355
+
356
+ Use this only when you install a newer package version and want to refresh built-in managed files in an existing home.
357
+
358
+ ```bash
359
+ # preview built-in file changes
360
+ agenthub upgrade
361
+
362
+ # overwrite managed built-in files
363
+ agenthub upgrade --force
364
+ ```
365
+
366
+ ---
367
+
368
+ ## Development
369
+
370
+ ```bash
371
+ bun run test:smoke
372
+ npm run build
373
+ ```