agentpacks 0.2.0 → 0.4.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 (166) hide show
  1. package/README.md +721 -0
  2. package/dist/api.d.ts +2 -0
  3. package/dist/api.js +929 -409
  4. package/dist/cli/export-cmd.js +281 -149
  5. package/dist/cli/generate.js +740 -247
  6. package/dist/cli/import-cmd.js +57 -85
  7. package/dist/cli/info.d.ts +4 -0
  8. package/dist/cli/info.js +232 -0
  9. package/dist/cli/init.js +8 -36
  10. package/dist/cli/install.js +414 -129
  11. package/dist/cli/login.d.ts +9 -0
  12. package/dist/cli/login.js +202 -0
  13. package/dist/cli/models-explain.d.ts +16 -0
  14. package/dist/cli/models-explain.js +1205 -0
  15. package/dist/cli/pack/create.js +4 -32
  16. package/dist/cli/pack/enable.js +1 -29
  17. package/dist/cli/pack/list.js +266 -134
  18. package/dist/cli/pack/validate.js +274 -127
  19. package/dist/cli/publish.d.ts +8 -0
  20. package/dist/cli/publish.js +672 -0
  21. package/dist/cli/search.d.ts +12 -0
  22. package/dist/cli/search.js +210 -0
  23. package/dist/core/config.d.ts +2 -1
  24. package/dist/core/config.js +74 -117
  25. package/dist/core/dependency-resolver.js +4 -28
  26. package/dist/core/feature-merger.d.ts +7 -0
  27. package/dist/core/feature-merger.js +289 -29
  28. package/dist/core/index.js +283 -140
  29. package/dist/core/lockfile.js +0 -28
  30. package/dist/core/metarepo.js +74 -116
  31. package/dist/core/pack-loader.d.ts +2 -0
  32. package/dist/core/pack-loader.js +266 -133
  33. package/dist/core/profile-resolver.d.ts +75 -0
  34. package/dist/core/profile-resolver.js +111 -0
  35. package/dist/exporters/cursor-plugin.js +4 -32
  36. package/dist/exporters/index.js +4 -32
  37. package/dist/features/agents.d.ts +5 -0
  38. package/dist/features/agents.js +2 -30
  39. package/dist/features/commands.js +2 -30
  40. package/dist/features/hooks.js +2 -30
  41. package/dist/features/ignore.js +0 -28
  42. package/dist/features/index.d.ts +1 -0
  43. package/dist/features/index.js +176 -31
  44. package/dist/features/mcp.js +2 -30
  45. package/dist/features/models.d.ts +167 -0
  46. package/dist/features/models.js +293 -0
  47. package/dist/features/plugins.js +2 -30
  48. package/dist/features/rules.js +2 -30
  49. package/dist/features/skills.js +2 -30
  50. package/dist/importers/claude-code.js +10 -38
  51. package/dist/importers/cursor.js +15 -43
  52. package/dist/importers/opencode.js +16 -44
  53. package/dist/importers/rulesync.js +22 -50
  54. package/dist/index.js +1710 -538
  55. package/dist/node/api.js +929 -409
  56. package/dist/node/cli/export-cmd.js +281 -149
  57. package/dist/node/cli/generate.js +740 -247
  58. package/dist/node/cli/import-cmd.js +57 -85
  59. package/dist/node/cli/info.js +232 -0
  60. package/dist/node/cli/init.js +8 -36
  61. package/dist/node/cli/install.js +414 -129
  62. package/dist/node/cli/login.js +202 -0
  63. package/dist/node/cli/models-explain.js +1205 -0
  64. package/dist/node/cli/pack/create.js +4 -32
  65. package/dist/node/cli/pack/enable.js +1 -29
  66. package/dist/node/cli/pack/list.js +266 -134
  67. package/dist/node/cli/pack/validate.js +274 -127
  68. package/dist/node/cli/publish.js +672 -0
  69. package/dist/node/cli/search.js +210 -0
  70. package/dist/node/core/config.js +74 -117
  71. package/dist/node/core/dependency-resolver.js +4 -28
  72. package/dist/node/core/feature-merger.js +289 -29
  73. package/dist/node/core/index.js +283 -140
  74. package/dist/node/core/lockfile.js +0 -28
  75. package/dist/node/core/metarepo.js +74 -116
  76. package/dist/node/core/pack-loader.js +266 -133
  77. package/dist/node/core/profile-resolver.js +111 -0
  78. package/dist/node/exporters/cursor-plugin.js +4 -32
  79. package/dist/node/exporters/index.js +4 -32
  80. package/dist/node/features/agents.js +2 -30
  81. package/dist/node/features/commands.js +2 -30
  82. package/dist/node/features/hooks.js +2 -30
  83. package/dist/node/features/ignore.js +0 -28
  84. package/dist/node/features/index.js +176 -31
  85. package/dist/node/features/mcp.js +2 -30
  86. package/dist/node/features/models.js +293 -0
  87. package/dist/node/features/plugins.js +2 -30
  88. package/dist/node/features/rules.js +2 -30
  89. package/dist/node/features/skills.js +2 -30
  90. package/dist/node/importers/claude-code.js +10 -38
  91. package/dist/node/importers/cursor.js +15 -43
  92. package/dist/node/importers/opencode.js +16 -44
  93. package/dist/node/importers/rulesync.js +22 -50
  94. package/dist/node/index.js +1710 -538
  95. package/dist/node/sources/git-ref.js +7 -30
  96. package/dist/node/sources/git.js +7 -30
  97. package/dist/node/sources/index.js +337 -39
  98. package/dist/node/sources/local.js +0 -28
  99. package/dist/node/sources/npm-ref.js +0 -28
  100. package/dist/node/sources/npm.js +10 -37
  101. package/dist/node/sources/registry-ref.js +37 -0
  102. package/dist/node/sources/registry.js +355 -0
  103. package/dist/node/targets/additional-targets.js +196 -37
  104. package/dist/node/targets/agents-md.js +5 -33
  105. package/dist/node/targets/base-target.js +0 -28
  106. package/dist/node/targets/claude-code.js +211 -41
  107. package/dist/node/targets/codex-cli.js +7 -35
  108. package/dist/node/targets/copilot.js +202 -41
  109. package/dist/node/targets/cursor.js +188 -40
  110. package/dist/node/targets/gemini-cli.js +10 -38
  111. package/dist/node/targets/generic-md-target.js +196 -37
  112. package/dist/node/targets/index.js +414 -106
  113. package/dist/node/targets/opencode.js +171 -51
  114. package/dist/node/targets/registry.js +414 -106
  115. package/dist/node/utils/credentials.js +38 -0
  116. package/dist/node/utils/diff.js +22 -34
  117. package/dist/node/utils/filesystem.js +2 -30
  118. package/dist/node/utils/frontmatter.js +0 -28
  119. package/dist/node/utils/global.js +3 -31
  120. package/dist/node/utils/markdown.js +0 -28
  121. package/dist/node/utils/model-allowlist.js +110 -0
  122. package/dist/node/utils/model-guidance.js +78 -0
  123. package/dist/node/utils/registry-client.js +142 -0
  124. package/dist/node/utils/tarball.js +49 -0
  125. package/dist/sources/git-ref.js +7 -30
  126. package/dist/sources/git.d.ts +2 -2
  127. package/dist/sources/git.js +7 -30
  128. package/dist/sources/index.d.ts +2 -0
  129. package/dist/sources/index.js +337 -39
  130. package/dist/sources/local.js +0 -28
  131. package/dist/sources/npm-ref.js +0 -28
  132. package/dist/sources/npm.js +10 -37
  133. package/dist/sources/registry-ref.d.ts +30 -0
  134. package/dist/sources/registry-ref.js +37 -0
  135. package/dist/sources/registry.d.ts +18 -0
  136. package/dist/sources/registry.js +355 -0
  137. package/dist/targets/additional-targets.js +196 -37
  138. package/dist/targets/agents-md.js +5 -33
  139. package/dist/targets/base-target.d.ts +2 -0
  140. package/dist/targets/base-target.js +0 -28
  141. package/dist/targets/claude-code.js +211 -41
  142. package/dist/targets/codex-cli.js +7 -35
  143. package/dist/targets/copilot.js +202 -41
  144. package/dist/targets/cursor.js +188 -40
  145. package/dist/targets/gemini-cli.js +10 -38
  146. package/dist/targets/generic-md-target.js +196 -37
  147. package/dist/targets/index.js +414 -106
  148. package/dist/targets/opencode.js +171 -51
  149. package/dist/targets/registry.js +414 -106
  150. package/dist/utils/credentials.d.ts +19 -0
  151. package/dist/utils/credentials.js +38 -0
  152. package/dist/utils/diff.js +22 -34
  153. package/dist/utils/filesystem.js +2 -30
  154. package/dist/utils/frontmatter.js +0 -28
  155. package/dist/utils/global.js +3 -31
  156. package/dist/utils/markdown.js +0 -28
  157. package/dist/utils/model-allowlist.d.ts +39 -0
  158. package/dist/utils/model-allowlist.js +110 -0
  159. package/dist/utils/model-guidance.d.ts +6 -0
  160. package/dist/utils/model-guidance.js +78 -0
  161. package/dist/utils/registry-client.d.ts +141 -0
  162. package/dist/utils/registry-client.js +142 -0
  163. package/dist/utils/tarball.d.ts +13 -0
  164. package/dist/utils/tarball.js +49 -0
  165. package/package.json +171 -5
  166. package/templates/pack/models.json +38 -0
package/README.md ADDED
@@ -0,0 +1,721 @@
1
+ # agentpacks
2
+
3
+ [![npm version](https://img.shields.io/npm/v/agentpacks.svg)](https://www.npmjs.com/package/agentpacks)
4
+ [![npm downloads](https://img.shields.io/npm/dm/agentpacks.svg)](https://www.npmjs.com/package/agentpacks)
5
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
6
+ [![Tests](https://img.shields.io/badge/tests-378%20passing-brightgreen.svg)](https://github.com/lssm-tech/contractspec/tree/main/packages/tools/agentpacks)
7
+
8
+ **Composable AI agent configuration manager.**
9
+
10
+ Write your rules, commands, skills, hooks, models, and MCP configs once — in a pack — and sync them automatically to OpenCode, Cursor, Claude Code, Codex CLI, Gemini CLI, GitHub Copilot, and 13 more tools. Discover and share packs via the **agentpacks registry**.
11
+
12
+ ---
13
+
14
+ ## Why agentpacks?
15
+
16
+ AI coding tools are proliferating fast. Every tool has its own config format:
17
+
18
+ - Cursor wants `.cursor/rules/*.mdc`
19
+ - Claude Code wants `CLAUDE.md` and `.claude/rules/*.md`
20
+ - OpenCode wants `.opencode/agent/*.md`, `.opencode/skill/*.md`, `opencode.json`
21
+ - Codex wants `.codex/memories/*.md`
22
+ - And so on for 20+ tools…
23
+
24
+ **Maintaining all of these by hand means:**
25
+
26
+ - Rules drift between tools — your Cursor context differs from your Claude context
27
+ - Adding a new rule means editing 5+ files in 5+ formats
28
+ - Onboarding a new tool means starting from scratch
29
+
30
+ **agentpacks solves this with a pack-based architecture:**
31
+
32
+ 1. Write your rules/commands/agents/skills once, in plain Markdown with simple frontmatter
33
+ 2. Group them into a _pack_ (a folder with a `pack.json` manifest)
34
+ 3. Run `agentpacks generate` — all 20 supported tools get their configs, properly formatted
35
+
36
+ ### vs rulesync
37
+
38
+ [rulesync](https://github.com/dyoshikawa/rulesync) is great inspiration but uses a flat file model. agentpacks goes further:
39
+
40
+ | | agentpacks | rulesync |
41
+ | -------------------- | --------------------------------------- | ------------- |
42
+ | Architecture | Composable packs | Flat files |
43
+ | Pack distribution | npm, git, local, **registry** | Local only |
44
+ | **Pack registry** | Search, publish, install via CLI | — |
45
+ | **Model configs** | Per-tool model/profile management | Not supported |
46
+ | OpenCode plugins | Per-pack `.ts` plugin files | Not supported |
47
+ | Cursor plugin export | Native plugin format | Not supported |
48
+ | Import from tools | Cursor, Claude Code, OpenCode, rulesync | — |
49
+ | Dependency resolver | Topological sort + conflict detection | — |
50
+ | Monorepo / metarepo | Built-in baseDirs | — |
51
+
52
+ ---
53
+
54
+ ## Quick Start
55
+
56
+ ```bash
57
+ # Install globally
58
+ npm install -g agentpacks
59
+ # or
60
+ bun add -g agentpacks
61
+
62
+ # Initialize in your project
63
+ cd my-project
64
+ agentpacks init
65
+
66
+ # Generate configs for all your AI tools
67
+ agentpacks generate
68
+ ```
69
+
70
+ After `init`, you'll have:
71
+
72
+ ```
73
+ my-project/
74
+ ├── agentpacks.jsonc # workspace config
75
+ └── packs/
76
+ └── default/
77
+ ├── pack.json # pack manifest
78
+ └── rules/
79
+ └── overview.md # starter rule
80
+ ```
81
+
82
+ After `generate`, every supported tool gets its config — no manual formatting needed.
83
+
84
+ ### Migrating from rulesync
85
+
86
+ Already using rulesync? Import your existing setup in one command:
87
+
88
+ ```bash
89
+ agentpacks import --from rulesync
90
+ ```
91
+
92
+ This reads your `.rulesync/` directory and `rulesync.jsonc`, and creates an equivalent agentpacks pack + workspace config.
93
+
94
+ ---
95
+
96
+ ## Supported Tools
97
+
98
+ ### Core targets — full feature support
99
+
100
+ | Target | ID | Rules | Commands | Agents | Skills | Hooks | Plugins | MCP | Ignore |
101
+ | -------------- | ------------ | :---: | :------: | :----: | :----: | :---: | :-----: | :-: | :----: |
102
+ | OpenCode | `opencode` | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
103
+ | Cursor | `cursor` | ✓ | ✓ | ✓ | ✓ | ✓ | | ✓ | ✓ |
104
+ | Claude Code | `claudecode` | ✓ | ✓ | ✓ | ✓ | ✓ | | ✓ | ✓ |
105
+ | Codex CLI | `codexcli` | ✓ | | | ✓ | ✓ | | ✓ | |
106
+ | Gemini CLI | `geminicli` | ✓ | ✓ | | ✓ | ✓ | | ✓ | ✓ |
107
+ | GitHub Copilot | `copilot` | ✓ | ✓ | ✓ | ✓ | | | ✓ | ✓ |
108
+ | AGENTS.md | `agentsmd` | ✓ | | | | | | | |
109
+
110
+ ### Additional targets — rules, MCP, and more
111
+
112
+ | Target | ID | Rules | Commands | MCP | Ignore |
113
+ | ------------- | -------------- | :---: | :------: | :-: | :----: |
114
+ | Cline | `cline` | ✓ | ✓ | ✓ | ✓ |
115
+ | Kilo Code | `kilo` | ✓ | ✓ | ✓ | ✓ |
116
+ | Roo Code | `roo` | ✓ | ✓ | ✓ | ✓ |
117
+ | Qwen Code | `qwencode` | ✓ | | ✓ | ✓ |
118
+ | Windsurf | `windsurf` | ✓ | | ✓ | ✓ |
119
+ | Kiro | `kiro` | ✓ | | ✓ | |
120
+ | Augment Code | `augmentcode` | ✓ | | ✓ | |
121
+ | Replit Agent | `replit` | ✓ | | ✓ | |
122
+ | Zed | `zed` | ✓ | | ✓ | |
123
+ | Junie | `junie` | ✓ | | ✓ | |
124
+ | Factory Droid | `factorydroid` | ✓ | | ✓ | |
125
+ | AntiGravity | `antigravity` | ✓ | | ✓ | |
126
+ | Warp | `warp` | ✓ | | | |
127
+
128
+ ---
129
+
130
+ ## Features
131
+
132
+ agentpacks supports 9 feature types inside a pack:
133
+
134
+ | Feature | Description | Example files |
135
+ | ------------ | ---------------------------------------------------- | ------------------------------------------- |
136
+ | **rules** | Project/coding guidelines injected as context | `rules/security.md`, `rules/style.md` |
137
+ | **commands** | Slash commands (e.g. `/lint`, `/review`) | `commands/lint.md`, `commands/deploy.md` |
138
+ | **agents** | Named sub-agents with specific personas | `agents/reviewer.md`, `agents/architect.md` |
139
+ | **skills** | Step-by-step skill guides (with structured SKILL.md) | `skills/migrate/SKILL.md` |
140
+ | **hooks** | Shell commands triggered by agent events | `hooks.json` |
141
+ | **plugins** | Raw TypeScript plugin files (OpenCode) | `plugins/my-plugin.ts` |
142
+ | **mcp** | MCP server definitions | `mcp.json` |
143
+ | **models** | Model preferences, profiles, and per-agent overrides | `models.json` |
144
+ | **ignore** | Patterns the agent should ignore | `ignore` |
145
+
146
+ ---
147
+
148
+ ## CLI Reference
149
+
150
+ ### `agentpacks init`
151
+
152
+ Initialize agentpacks in the current project. Creates `agentpacks.jsonc` and a starter pack under `packs/default/`.
153
+
154
+ ```bash
155
+ agentpacks init
156
+ ```
157
+
158
+ ---
159
+
160
+ ### `agentpacks generate`
161
+
162
+ Generate tool configs from all active packs.
163
+
164
+ ```bash
165
+ agentpacks generate [options]
166
+
167
+ Options:
168
+ -t, --targets <targets> Comma-separated target IDs, or * for all (default: from config)
169
+ -f, --features <features> Comma-separated feature IDs, or * for all (default: from config)
170
+ --model-profile <profile> Activate a model profile (e.g. quality, budget, fast)
171
+ --dry-run Preview changes without writing files
172
+ --diff Show a diff of what would change
173
+ -v, --verbose Enable verbose output
174
+ ```
175
+
176
+ ```bash
177
+ # Generate for all configured targets
178
+ agentpacks generate
179
+
180
+ # Generate only for Cursor and Claude Code
181
+ agentpacks generate --targets cursor,claudecode
182
+
183
+ # Preview changes without writing
184
+ agentpacks generate --dry-run --diff
185
+
186
+ # Generate with the "budget" model profile active
187
+ agentpacks generate --model-profile budget
188
+ ```
189
+
190
+ ---
191
+
192
+ ### `agentpacks install`
193
+
194
+ Install remote packs (npm packages, git repos, or registry packs) into the local pack cache.
195
+
196
+ ```bash
197
+ agentpacks install [options]
198
+
199
+ Options:
200
+ --update Re-resolve all refs, ignoring the lockfile
201
+ --frozen Fail if the lockfile is missing or incomplete (useful in CI)
202
+ -v, --verbose
203
+ ```
204
+
205
+ ```bash
206
+ # Install all remote packs listed in agentpacks.jsonc
207
+ agentpacks install
208
+
209
+ # Update all remote packs to latest
210
+ agentpacks install --update
211
+
212
+ # CI: fail fast if lockfile is out of date
213
+ agentpacks install --frozen
214
+ ```
215
+
216
+ ---
217
+
218
+ ### `agentpacks import`
219
+
220
+ Import from an existing tool configuration into a new pack.
221
+
222
+ ```bash
223
+ agentpacks import --from <source> [options]
224
+
225
+ Sources: rulesync | cursor | claudecode | opencode
226
+
227
+ Options:
228
+ --from <source> Source format to import from (required)
229
+ -o, --output <dir> Output directory for the generated pack
230
+ ```
231
+
232
+ ```bash
233
+ # Import from rulesync (.rulesync/ + rulesync.jsonc)
234
+ agentpacks import --from rulesync
235
+
236
+ # Import from existing Cursor rules
237
+ agentpacks import --from cursor --output ./packs/from-cursor
238
+ ```
239
+
240
+ ---
241
+
242
+ ### `agentpacks export`
243
+
244
+ Export a pack to a target-native format (e.g. a Cursor plugin).
245
+
246
+ ```bash
247
+ agentpacks export --format <format> [options]
248
+
249
+ Formats: cursor-plugin
250
+
251
+ Options:
252
+ --format <format> Export format (required)
253
+ -o, --output <dir> Output directory
254
+ --pack <name> Export a specific pack only
255
+ -v, --verbose
256
+ ```
257
+
258
+ ```bash
259
+ # Export all packs as a single Cursor plugin
260
+ agentpacks export --format cursor-plugin --output ./cursor-plugin-dist
261
+ ```
262
+
263
+ ---
264
+
265
+ ### `agentpacks pack create <name>`
266
+
267
+ Scaffold a new pack with the correct directory structure.
268
+
269
+ ```bash
270
+ agentpacks pack create my-pack
271
+ ```
272
+
273
+ Creates:
274
+
275
+ ```
276
+ packs/my-pack/
277
+ ├── pack.json
278
+ └── rules/
279
+ └── overview.md
280
+ ```
281
+
282
+ ---
283
+
284
+ ### `agentpacks pack list`
285
+
286
+ List all configured packs and their enabled/disabled status.
287
+
288
+ ```bash
289
+ agentpacks pack list
290
+ ```
291
+
292
+ ---
293
+
294
+ ### `agentpacks pack validate`
295
+
296
+ Validate pack manifests and feature files for schema errors.
297
+
298
+ ```bash
299
+ agentpacks pack validate
300
+ ```
301
+
302
+ ---
303
+
304
+ ### `agentpacks pack enable <name>` / `agentpacks pack disable <name>`
305
+
306
+ Enable or disable a pack without removing it from `agentpacks.jsonc`.
307
+
308
+ ```bash
309
+ agentpacks pack disable my-pack # adds to "disabled" array
310
+ agentpacks pack enable my-pack # removes from "disabled" array
311
+ ```
312
+
313
+ ---
314
+
315
+ ### `agentpacks search <query>`
316
+
317
+ Search the pack registry for packs matching a query.
318
+
319
+ ```bash
320
+ agentpacks search typescript
321
+
322
+ # Filter by target
323
+ agentpacks search react --target cursor
324
+
325
+ # Sort by downloads
326
+ agentpacks search monorepo --sort downloads
327
+ ```
328
+
329
+ ---
330
+
331
+ ### `agentpacks info <pack>`
332
+
333
+ Show detailed information about a registry pack.
334
+
335
+ ```bash
336
+ agentpacks info typescript-best-practices
337
+ ```
338
+
339
+ ---
340
+
341
+ ### `agentpacks publish`
342
+
343
+ Publish the current pack to the registry. Requires authentication.
344
+
345
+ ```bash
346
+ agentpacks login # store your registry token
347
+ agentpacks publish # validate, bundle, and upload
348
+ ```
349
+
350
+ The publish command validates the pack, scans for secrets, creates a tarball, and uploads it. Publish will be blocked if the pack contains potential secrets (API keys, tokens, etc.) in `models.json` or other config files.
351
+
352
+ ---
353
+
354
+ ### `agentpacks login`
355
+
356
+ Authenticate with the pack registry.
357
+
358
+ ```bash
359
+ agentpacks login
360
+ ```
361
+
362
+ Stores your token in `~/.config/agentpacks/credentials.json`.
363
+
364
+ ---
365
+
366
+ ## Model Configuration
367
+
368
+ agentpacks can manage AI model preferences across all your tools through the `models` feature. Define model assignments, named profiles, and provider options in a single `models.json` — agentpacks generates the right config for each tool.
369
+
370
+ ### models.json
371
+
372
+ Place `models.json` at the root of a pack:
373
+
374
+ ```json
375
+ {
376
+ "default": "anthropic/claude-sonnet-4-20250514",
377
+ "small": "anthropic/claude-haiku-3-5",
378
+ "agents": {
379
+ "code-reviewer": { "model": "anthropic/claude-opus-4-20250514" },
380
+ "quick-fixer": { "model": "anthropic/claude-haiku-3-5" }
381
+ },
382
+ "profiles": {
383
+ "quality": {
384
+ "default": "anthropic/claude-opus-4-20250514",
385
+ "small": "anthropic/claude-sonnet-4-20250514"
386
+ },
387
+ "budget": {
388
+ "default": "anthropic/claude-haiku-3-5",
389
+ "small": "anthropic/claude-haiku-3-5"
390
+ },
391
+ "fast": {
392
+ "default": "anthropic/claude-haiku-3-5"
393
+ }
394
+ },
395
+ "providers": {
396
+ "anthropic": {
397
+ "models": {
398
+ "claude-opus-4-20250514": {
399
+ "options": { "budgetTokens": 10000, "reasoningEffort": "high" }
400
+ }
401
+ }
402
+ }
403
+ }
404
+ }
405
+ ```
406
+
407
+ ### Activating a profile
408
+
409
+ Set `modelProfile` in your workspace config:
410
+
411
+ ```jsonc
412
+ {
413
+ "modelProfile": "quality",
414
+ }
415
+ ```
416
+
417
+ Or override at generate time:
418
+
419
+ ```bash
420
+ agentpacks generate --model-profile budget
421
+ ```
422
+
423
+ ### Per-tool output
424
+
425
+ | Tool | What agentpacks generates |
426
+ | --------------- | ----------------------------------------------------------------------------------------- |
427
+ | **OpenCode** | `model`, `small_model`, `provider.*.models.*.options`, `agent.*.model` in `opencode.json` |
428
+ | **Cursor** | `.cursor/rules/model-config.mdc` — an always-applied guidance rule |
429
+ | **Claude Code** | Model guidance in `CLAUDE.md`, `<!-- model: ... -->` hints in agent files |
430
+ | **Copilot** | Model guidance section in `.github/copilot-instructions.md` |
431
+ | **Others** | Model guidance in their root rule file |
432
+
433
+ ### Security
434
+
435
+ `models.json` must **never** contain credentials. agentpacks scans for API keys, tokens, secrets, and private key markers during `pack validate` and `publish`. Publish is blocked if secrets are detected.
436
+
437
+ ---
438
+
439
+ ## Configuration
440
+
441
+ ### Workspace config — `agentpacks.jsonc`
442
+
443
+ Created at your project root by `agentpacks init`.
444
+
445
+ ```jsonc
446
+ {
447
+ "$schema": "https://unpkg.com/agentpacks/schema.json",
448
+
449
+ // Packs to load — local, npm, git, or registry
450
+ "packs": [
451
+ "./packs/default",
452
+ "agentpacks-typescript-rules", // npm package
453
+ "github:myorg/agent-packs#main/python", // git ref
454
+ "registry:react-patterns", // registry pack
455
+ ],
456
+
457
+ // Temporarily disable a pack without removing it
458
+ "disabled": [],
459
+
460
+ // Which AI tools to generate configs for (* = all 20)
461
+ "targets": [
462
+ "opencode",
463
+ "cursor",
464
+ "claudecode",
465
+ "geminicli",
466
+ "codexcli",
467
+ "copilot",
468
+ ],
469
+
470
+ // Which feature types to generate (* = all 9)
471
+ "features": ["*"],
472
+
473
+ // Active model profile (from models.json profiles)
474
+ "modelProfile": "quality",
475
+
476
+ // Repository mode: "repo" | "monorepo" | "metarepo"
477
+ "mode": "repo",
478
+
479
+ // Base directories to generate into (monorepo mode)
480
+ "baseDirs": ["."],
481
+
482
+ // Generate user-global configs (XDG-aware, applies to all projects)
483
+ "global": false,
484
+
485
+ // Delete existing generated files before regenerating
486
+ "delete": true,
487
+ }
488
+ ```
489
+
490
+ ### Pack manifest — `pack.json`
491
+
492
+ Lives at the root of each pack directory.
493
+
494
+ ```json
495
+ {
496
+ "name": "my-pack",
497
+ "version": "1.0.0",
498
+ "description": "My custom agent rules and commands",
499
+ "author": "Your Name",
500
+ "tags": ["typescript", "testing"],
501
+ "dependencies": ["base-pack"],
502
+ "conflicts": [],
503
+ "targets": ["*"],
504
+ "features": ["*"]
505
+ }
506
+ ```
507
+
508
+ ---
509
+
510
+ ## Authoring a Pack
511
+
512
+ A pack is a directory with a `pack.json` and any combination of feature subdirectories:
513
+
514
+ ```
515
+ my-pack/
516
+ ├── pack.json
517
+ ├── rules/
518
+ │ ├── overview.md # root: true → included in AGENTS.md / CLAUDE.md
519
+ │ └── security.md # root: false → detail rule
520
+ ├── commands/
521
+ │ └── review.md
522
+ ├── agents/
523
+ │ └── architect.md
524
+ ├── skills/
525
+ │ └── migrate/
526
+ │ └── SKILL.md
527
+ ├── hooks.json
528
+ ├── mcp.json
529
+ ├── models.json
530
+ └── ignore
531
+ ```
532
+
533
+ ### Rule frontmatter
534
+
535
+ ```markdown
536
+ ---
537
+ root: true # true = root context (AGENTS.md, CLAUDE.md); false = detail rule
538
+ targets: ['*'] # which tools this rule applies to
539
+ description: 'Overview' # shown in Cursor rules UI
540
+ globs: ['src/**/*.ts'] # (optional) file-pattern-scoped rule
541
+ ---
542
+
543
+ Your rule content here.
544
+ ```
545
+
546
+ ### Command frontmatter
547
+
548
+ ```markdown
549
+ ---
550
+ name: review # command name (becomes /review)
551
+ targets: ['*']
552
+ description: 'Run a code review'
553
+ ---
554
+
555
+ Review the selected code for correctness, style, and potential bugs.
556
+ ```
557
+
558
+ ### MCP config — `mcp.json`
559
+
560
+ ```json
561
+ {
562
+ "mcpServers": {
563
+ "my-server": {
564
+ "command": "npx",
565
+ "args": ["-y", "my-mcp-server"],
566
+ "env": { "API_KEY": "$MY_API_KEY" }
567
+ },
568
+ "remote-server": {
569
+ "url": "https://mcp.example.com/sse",
570
+ "headers": { "Authorization": "Bearer $TOKEN" }
571
+ }
572
+ }
573
+ }
574
+ ```
575
+
576
+ ### Hooks — `hooks.json`
577
+
578
+ ```json
579
+ {
580
+ "hooks": {
581
+ "sessionStart": [{ "command": "echo 'Session started'" }],
582
+ "postToolUse": [
583
+ {
584
+ "command": "bun run lint",
585
+ "matcher": "write_file|edit_file"
586
+ }
587
+ ]
588
+ }
589
+ }
590
+ ```
591
+
592
+ Supported hook events: `sessionStart`, `preToolUse`, `postToolUuse`, `afterFileEdit`, `afterShellExecution`, `stop`
593
+
594
+ ---
595
+
596
+ ## Monorepo Support
597
+
598
+ For monorepo setups, set `mode: "monorepo"` and list your sub-packages in `baseDirs`:
599
+
600
+ ```jsonc
601
+ {
602
+ "mode": "monorepo",
603
+ "baseDirs": ["packages/api", "packages/web", "packages/shared"],
604
+ }
605
+ ```
606
+
607
+ `agentpacks generate` will write tool configs into each listed base directory.
608
+
609
+ For metarepo setups (a repo of repos), set `mode: "metarepo"` and agentpacks will discover sub-repos that contain their own `agentpacks.jsonc` and process them.
610
+
611
+ ---
612
+
613
+ ## Pack Distribution
614
+
615
+ Packs can be shared via four sources:
616
+
617
+ ### agentpacks registry
618
+
619
+ The official pack registry at [agentpacks.dev](https://agentpacks.dev) — search, publish, and install community packs.
620
+
621
+ ```bash
622
+ # Search for packs
623
+ agentpacks search typescript
624
+
625
+ # View pack details
626
+ agentpacks info typescript-best-practices
627
+
628
+ # Install from registry
629
+ agentpacks install
630
+ ```
631
+
632
+ ```jsonc
633
+ {
634
+ "packs": [
635
+ "registry:typescript-best-practices",
636
+ "registry:react-patterns@1.2.0", // pinned version
637
+ ],
638
+ }
639
+ ```
640
+
641
+ ### npm packages
642
+
643
+ ```bash
644
+ npm install my-agent-pack
645
+ ```
646
+
647
+ ```jsonc
648
+ { "packs": ["my-agent-pack"] }
649
+ ```
650
+
651
+ ### Git repos
652
+
653
+ ```jsonc
654
+ {
655
+ "packs": [
656
+ "github:myorg/agent-packs", // defaults to main branch
657
+ "github:myorg/agent-packs#v2.0.0", // specific tag
658
+ "github:myorg/agent-packs#main/python", // subdirectory
659
+ ],
660
+ }
661
+ ```
662
+
663
+ ### Local directories (monorepo / private)
664
+
665
+ ```jsonc
666
+ { "packs": ["./packs/default", "../shared/agent-packs"] }
667
+ ```
668
+
669
+ ---
670
+
671
+ ## Global Mode
672
+
673
+ Generate user-scope configs that apply to all projects on your machine (useful for personal preferences):
674
+
675
+ ```bash
676
+ agentpacks generate --global
677
+ ```
678
+
679
+ agentpacks uses XDG-aware paths:
680
+
681
+ - **macOS/Linux**: `~/.config/agentpacks/`
682
+ - **Windows**: `%APPDATA%\agentpacks\`
683
+
684
+ ---
685
+
686
+ ## About
687
+
688
+ ### ContractSpec
689
+
690
+ [ContractSpec](https://contractspec.io) is the deterministic, spec-first compiler that keeps AI-written software coherent, safe, and regenerable. As AI coding tools generate more and more code, ContractSpec provides the governance layer: canonical contracts, multi-surface consistency, and safe regeneration without lock-in.
691
+
692
+ > "You keep your app. We stabilize it, one module at a time. You own the code. It's standard tech. We're the compiler, not the prison."
693
+
694
+ ### LSSM
695
+
696
+ [LSSM](https://github.com/lssm-tech) is the team behind ContractSpec. We build tools for AI-native software development — infrastructure that makes AI-generated code safe, maintainable, and production-ready.
697
+
698
+ agentpacks is built by LSSM as an open-source part of the ContractSpec ecosystem, published independently on npm so any project can adopt it without adopting the full ContractSpec platform.
699
+
700
+ ---
701
+
702
+ ## Contributing
703
+
704
+ We welcome contributions of all kinds — bug reports, feature requests, documentation improvements, and code.
705
+
706
+ See [CONTRIBUTING.md](./CONTRIBUTING.md) for setup instructions, code style guidelines, and the pull request process.
707
+
708
+ **Quick links:**
709
+
710
+ - [Report a bug](https://github.com/lssm-tech/contractspec/issues/new?template=bug_report.md&labels=agentpacks)
711
+ - [Request a feature](https://github.com/lssm-tech/contractspec/issues/new?template=feature_request.md&labels=agentpacks)
712
+ - [Ask a question](https://github.com/lssm-tech/contractspec/discussions)
713
+ - [View the roadmap](https://github.com/lssm-tech/contractspec/issues?q=is%3Aissue+label%3Aagentpacks+label%3Aroadmap)
714
+
715
+ ---
716
+
717
+ ## License
718
+
719
+ MIT — see [LICENSE](../../LICENSE) for details.
720
+
721
+ Built with love by [LSSM](https://github.com/lssm-tech) — contributors of [ContractSpec](https://contractspec.io).