agentsmesh 0.2.3 → 0.2.5

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/README.md CHANGED
@@ -8,215 +8,997 @@
8
8
  [![Node.js](https://img.shields.io/node/v/agentsmesh.svg)](https://nodejs.org/)
9
9
  [![npm downloads](https://img.shields.io/npm/dm/agentsmesh.svg)](https://www.npmjs.com/package/agentsmesh)
10
10
 
11
- AgentsMesh gives you one canonical AI config in `.agentsmesh/` and syncs it to the tools your team actually uses: Claude Code, Cursor, Copilot, Continue, Junie, Gemini CLI, Cline, Codex CLI, and Windsurf.
11
+ **One config. Nine AI coding tools. Zero drift.**
12
+
13
+ AgentsMesh maintains a single canonical configuration in `.agentsmesh/` and syncs it bidirectionally to Claude Code, Cursor, Copilot, Continue, Junie, Gemini CLI, Cline, Codex CLI, and Windsurf. Rules, commands, agents, skills, MCP servers, hooks, ignore patterns, and permissions -- all from one source of truth.
14
+
15
+ ---
16
+
17
+ **Table of Contents**
18
+
19
+ - [Why AgentsMesh](#why-agentsmesh)
20
+ - [Installation](#installation)
21
+ - [Quick Start](#quick-start)
22
+ - [Supported Tools](#supported-tools)
23
+ - [Canonical Configuration](#canonical-configuration)
24
+ - [Rules](#rules)
25
+ - [Commands](#commands)
26
+ - [Agents](#agents)
27
+ - [Skills](#skills)
28
+ - [MCP Servers](#mcp-servers)
29
+ - [Permissions](#permissions)
30
+ - [Hooks](#hooks)
31
+ - [Ignore Patterns](#ignore-patterns)
32
+ - [CLI Reference](#cli-reference)
33
+ - [Global Flags](#global-flags)
34
+ - [init](#init)
35
+ - [generate](#generate)
36
+ - [import](#import)
37
+ - [install](#install)
38
+ - [diff](#diff)
39
+ - [lint](#lint)
40
+ - [watch](#watch)
41
+ - [check](#check)
42
+ - [merge](#merge)
43
+ - [matrix](#matrix)
44
+ - [Configuration](#configuration)
45
+ - [agentsmesh.yaml](#agentsmeshyaml)
46
+ - [Local Overrides](#local-overrides)
47
+ - [Extends](#extends)
48
+ - [Collaboration Settings](#collaboration-settings)
49
+ - [Conversions](#conversions)
50
+ - [Workflows](#workflows)
51
+ - [Adopting AgentsMesh in an Existing Project](#adopting-agentsmesh-in-an-existing-project)
52
+ - [Supporting Multiple Tools on a Team](#supporting-multiple-tools-on-a-team)
53
+ - [Sharing Config Across Repositories](#sharing-config-across-repositories)
54
+ - [CI Drift Detection](#ci-drift-detection)
55
+ - [Installing Community Packs](#installing-community-packs)
56
+ - [Local Development Overrides](#local-development-overrides)
57
+ - [How Generation Works](#how-generation-works)
58
+ - [Roadmap](#roadmap)
59
+ - [Contributing](#contributing)
60
+ - [License](#license)
61
+
62
+ ---
63
+
64
+ ## Why AgentsMesh
65
+
66
+ If your team uses more than one AI coding tool -- or even if you just use one today and might switch tomorrow -- you already know the pain. Each tool has its own config format, its own directory structure, its own way of defining rules, commands, and MCP servers. Change a rule in `.cursor/rules/`, forget to update `.claude/rules/`, and your agents start behaving differently depending on who is editing. Scale that across a team where half the developers use Cursor and the other half use Claude Code, and config drift becomes a real problem.
67
+
68
+ AgentsMesh solves this by giving you a single canonical directory (`.agentsmesh/`) that holds all your AI tool configuration. When you run `agentsmesh generate`, it produces the correct output for every tool your team uses. When someone on the team already has tool-specific config, `agentsmesh import` brings it into the canonical format. The round-trip is lossless: what goes in comes back out, including internal file references, supporting skill files, and embedded metadata.
69
+
70
+ **What sets AgentsMesh apart from manual management:**
71
+
72
+ - **One source of truth** -- edit `.agentsmesh/`, generate everywhere. No more copy-pasting rules between tool directories.
73
+ - **Bidirectional sync** -- import existing configs into canonical form and generate back out. No data loss, no manual reformatting.
74
+ - **Team-safe collaboration** -- lock files track generated state, `check` catches drift in CI, `merge` resolves conflicts after `git merge`.
75
+ - **Lossless feature projection** -- when a tool lacks native support for a feature (e.g., Codex CLI has no commands), AgentsMesh projects it as an embedded skill with enough metadata to round-trip on re-import.
76
+ - **Real operational tooling** -- `diff`, `lint`, `watch`, `check`, `merge`, and `matrix` are first-class commands, not afterthoughts. Most config tools stop at "generate and hope for the best."
77
+
78
+ ---
79
+
80
+ ## Installation
81
+
82
+ Requires **Node.js 20** or later.
12
83
 
13
- The point is simple: keep one source of truth for rules, commands, agents, skills, MCP, hooks, ignore patterns, and permissions, then generate the right format for each tool without hand-editing nine different config layouts.
84
+ ```bash
85
+ # npm
86
+ npm install -D agentsmesh
14
87
 
15
- ## Why it is useful
88
+ # pnpm
89
+ pnpm add -D agentsmesh
16
90
 
17
- - One canonical config instead of tool-by-tool drift
18
- - Import existing configs before you standardize anything
19
- - Generate back out to multiple tools from the same source
20
- - Keep team changes safe with lock files, drift checks, and merge recovery
21
- - See support clearly with a built-in compatibility matrix
22
- - Share base configs across repos with `extends`
23
- - Keep personal preferences local with `agentsmesh.local.yaml`
24
- - Preserve links and supporting files when content moves between targets
91
+ # yarn
92
+ yarn add -D agentsmesh
25
93
 
26
- ## What ships today
94
+ # or run directly
95
+ npx agentsmesh --help
96
+ ```
27
97
 
28
- AgentsMesh already covers the pieces most teams care about in practice:
98
+ The CLI is available as both `agentsmesh` and `amsh`.
29
99
 
30
- - Rules, commands, agents, skills, MCP servers, hooks, ignore patterns, and permissions
31
- - Bidirectional import/generate flow across 9 supported targets
32
- - `diff`, `lint`, `watch`, `check`, `merge`, and `matrix` commands
33
- - Local overrides with `agentsmesh.local.yaml`
34
- - Remote and local `extends` support
35
- - Lock file based collaboration for generated state
36
- - Link rebasing so internal file references still make sense after generation
37
- - Target-specific conversions where native support does not exist
100
+ ---
38
101
 
39
- The strongest parts of the library right now are the operational pieces competitors usually skip: permissions syncing, lock file handling, diffing, linting, watch mode, local overrides, link rebasing, and the compatibility matrix.
102
+ ## Quick Start
40
103
 
41
- ## Supported tools
104
+ ### New project
42
105
 
43
- | Tool | Current support |
44
- | --- | --- |
45
- | Claude Code | Native rules, commands, agents, skills, MCP, hooks, ignore, permissions |
46
- | Cursor | Native rules, commands, agents, skills, MCP, hooks, ignore; partial permissions |
47
- | Copilot | Native rules, commands, agents, skills; partial hooks |
48
- | Continue | Native rules and MCP; commands via embedded invokable prompt rules; skills via embedded skill directories |
49
- | Junie | Partial rules via a single project guidelines file; embedded skills; native MCP and ignore |
50
- | Gemini CLI | Native rules, commands, skills, MCP, ignore; partial hooks; agents via projected skills |
51
- | Cline | Native rules, workflows-from-commands, skills, MCP, ignore; agents via projected skills |
52
- | Codex CLI | Native rules, skills, MCP; commands and agents via projected skills |
53
- | Windsurf | Native rules, workflows-from-commands, skills, ignore; agents via projected skills |
106
+ ```bash
107
+ # Scaffold the canonical config directory
108
+ agentsmesh init
109
+
110
+ # Edit your root rule
111
+ # vi .agentsmesh/rules/_root.md
54
112
 
55
- Embedded support is deliberate, not a hacky one-way export. For example, Codex commands are round-tripped through reserved skills, and projected agent-skills keep enough metadata for `import --from ...` to restore canonical agents instead of flattening them into plain skills.
113
+ # Generate configs for all enabled targets
114
+ agentsmesh generate
115
+ ```
56
116
 
57
- ## Install
117
+ ### Existing project with tool configs already in place
58
118
 
59
119
  ```bash
60
- pnpm add -D agentsmesh
61
- # or
62
- npm install -D agentsmesh
120
+ # Import your existing Cursor config (or any supported tool)
121
+ agentsmesh import --from cursor
122
+
123
+ # Generate output for all configured targets
124
+ agentsmesh generate
63
125
  ```
64
126
 
65
- Requires Node.js 20+. The CLI is available as `agentsmesh` and `agbr`.
127
+ That's it. Your `.agentsmesh/` directory is now the single source of truth, and the generated files for each tool stay in sync with it.
66
128
 
67
- ## Quick start
129
+ ---
68
130
 
69
- ```bash
70
- # create the canonical scaffold
71
- agentsmesh init
131
+ ## Supported Tools
72
132
 
73
- # sync .agentsmesh/ to the configured targets
74
- agentsmesh generate
133
+ AgentsMesh supports 9 AI coding tools with varying levels of feature support per tool. "Native" means the feature maps directly to the tool's own config format. "Embedded" means AgentsMesh projects the feature into a compatible format (e.g., converting commands to invokable skills) with enough metadata for lossless round-trip. "Partial" means limited support.
134
+
135
+ | Feature | Claude Code | Cursor | Copilot | Gemini CLI | Cline | Codex CLI | Windsurf | Continue | Junie |
136
+ |---------------|:-----------:|:-------:|:-------:|:----------:|:-------:|:---------:|:--------:|:--------:|:--------:|
137
+ | Rules | Native | Native | Native | Native | Native | Native | Native | Native | Native |
138
+ | Commands | Native | Native | Native | Native | Native | Embedded | Native | Embedded | Embedded |
139
+ | Agents | Native | Native | Native | Native | Embedded| Native | Embedded | -- | Embedded |
140
+ | Skills | Native | Native | Native | Native | Native | Native | Native | Embedded | Embedded |
141
+ | MCP Servers | Native | Native | -- | Native | Native | Native | Partial | Native | Native |
142
+ | Hooks | Native | Native | Partial | Partial | -- | -- | Native | -- | -- |
143
+ | Ignore | Native | Native | -- | Native | Native | -- | Native | -- | Native |
144
+ | Permissions | Native | Partial | -- | Partial | -- | -- | -- | -- | -- |
145
+
146
+ Embedded support is deliberate, not a workaround. Projected features carry enough metadata that `agentsmesh import` can restore them to their original canonical form, not flatten them into plain text.
147
+
148
+ ---
149
+
150
+ ## Canonical Configuration
151
+
152
+ The `.agentsmesh/` directory is the single source of truth. Everything below is a reference for the canonical file formats.
153
+
154
+ ```
155
+ .agentsmesh/
156
+ rules/
157
+ _root.md # Root rule (always applied, required)
158
+ *.md # Additional rules (scoped by target or glob)
159
+ commands/
160
+ *.md # Slash-command-style prompts
161
+ agents/
162
+ *.md # Subagent definitions
163
+ skills/
164
+ {name}/
165
+ SKILL.md # Skill definition
166
+ *.* # Supporting files (templates, references, etc.)
167
+ mcp.json # MCP server definitions
168
+ permissions.yaml # Allow/deny tool permission lists
169
+ hooks.yaml # Lifecycle hooks
170
+ ignore # gitignore-style exclusion patterns
171
+ installs.yaml # Record of installed packs
172
+ .lock # Generated state checksums (managed by CLI)
173
+ agentsmesh.yaml # Project configuration
174
+ agentsmesh.local.yaml # Local overrides (gitignored)
175
+ ```
176
+
177
+ ### Rules
178
+
179
+ Rules are markdown files with optional YAML frontmatter. The root rule (`_root.md`) is required and always applied. Additional rules can be scoped to specific targets or file patterns.
180
+
181
+ ```markdown
182
+ ---
183
+ root: true
184
+ ---
185
+
186
+ # Project Guidelines
187
+
188
+ - Write tests before implementation.
189
+ - Max 200 lines per file.
190
+ - Use TypeScript strict mode.
191
+ ```
192
+
193
+ Scoped rule example:
194
+
195
+ ```markdown
196
+ ---
197
+ description: Frontend conventions
198
+ targets: [cursor, claude-code]
199
+ globs: [src/components/**/*.tsx]
200
+ ---
201
+
202
+ Use functional components with hooks. No class components.
203
+ Prefer Tailwind utility classes over custom CSS.
204
+ ```
205
+
206
+ **Frontmatter fields:**
207
+
208
+ | Field | Type | Description |
209
+ |---------------------------|------------|--------------------------------------------------------------------|
210
+ | `root` | `boolean` | Always-applied rule. Required for `_root.md`. |
211
+ | `description` | `string` | Human-readable rule name. |
212
+ | `targets` | `string[]` | Limit rule to specific tools. Empty = all targets. |
213
+ | `globs` | `string[]` | File patterns this rule applies to (tool-dependent). |
214
+ | `trigger` | `string` | Activation mode hint for Windsurf: `always_on`, `model_decision`, `glob`, `manual`. |
215
+ | `codexEmit` | `string` | Codex CLI instruction type: `advisory` or `execution`. |
216
+ | `codexInstructionVariant` | `string` | Codex nested instruction format: `default` or `override`. |
217
+
218
+ ### Commands
219
+
220
+ Commands are reusable prompts that map to slash commands in tools that support them (Claude Code, Cursor, Copilot, Gemini CLI). For tools without native command support, they are projected as invokable skills.
221
+
222
+ ```markdown
223
+ ---
224
+ description: Create a conventional commit from current changes
225
+ allowed-tools:
226
+ - Read
227
+ - Bash(git status)
228
+ - Bash(git diff)
229
+ - Bash(git add)
230
+ - Bash(git commit)
231
+ ---
232
+
233
+ Review the current git changes. Analyze what was modified and why.
234
+ Draft a conventional commit message (feat/fix/refactor/test/docs scope).
235
+ Stage the relevant files and commit.
236
+ ```
237
+
238
+ **Frontmatter fields:**
239
+
240
+ | Field | Type | Description |
241
+ |-----------------|------------|----------------------------------------------------|
242
+ | `description` | `string` | Short description shown in command menus. |
243
+ | `allowed-tools` | `string[]` | Tools the command is allowed to use when invoked. |
244
+
245
+ ### Agents
246
+
247
+ Agents define custom subagents with their own tools, model, permissions, hooks, and skills.
248
+
249
+ ```markdown
250
+ ---
251
+ name: code-reviewer
252
+ description: Reviews code changes for quality and security issues
253
+ tools:
254
+ - Read
255
+ - Grep
256
+ - Glob
257
+ - Bash(git diff)
258
+ - Bash(git log)
259
+ model: sonnet
260
+ permissionMode: ask
261
+ maxTurns: 10
262
+ mcpServers:
263
+ - github
264
+ hooks:
265
+ PreToolUse:
266
+ - matcher: "Edit|Write"
267
+ type: command
268
+ command: "eslint --fix $FILE"
269
+ skills:
270
+ - security-review
271
+ memory: .context/review-history.md
272
+ ---
273
+
274
+ You are a senior code reviewer. Focus on logic correctness, performance,
275
+ security vulnerabilities, and adherence to project conventions.
276
+
277
+ Flag issues by severity. Suggest concrete fixes, not vague recommendations.
278
+ ```
279
+
280
+ **Frontmatter fields:**
281
+
282
+ | Field | Type | Description |
283
+ |-------------------|------------|-----------------------------------------------------------------|
284
+ | `name` | `string` | Agent identifier. |
285
+ | `description` | `string` | Short description. |
286
+ | `tools` | `string[]` | Allowed tools (Read, Grep, Bash, etc.). |
287
+ | `disallowedTools` | `string[]` | Explicitly denied tools. |
288
+ | `model` | `string` | Model hint: `sonnet`, `opus`, `haiku`. |
289
+ | `permissionMode` | `string` | How permissions are handled: `ask`, `default`, `none`. |
290
+ | `maxTurns` | `number` | Maximum conversation turns. |
291
+ | `mcpServers` | `string[]` | MCP servers available to this agent. |
292
+ | `hooks` | `object` | Agent-level lifecycle hooks (same format as `hooks.yaml`). |
293
+ | `skills` | `string[]` | Skills available to this agent. |
294
+ | `memory` | `string` | Path to external memory file. |
295
+
296
+ ### Skills
297
+
298
+ Skills are directories containing a `SKILL.md` definition and any supporting files (templates, reference docs, examples). Supporting files are preserved across generation and import.
299
+
300
+ ```
301
+ .agentsmesh/skills/
302
+ api-generator/
303
+ SKILL.md
304
+ template.hbs
305
+ examples/
306
+ user-api.ts
307
+ ```
308
+
309
+ ```markdown
310
+ ---
311
+ description: Generate REST API endpoints from OpenAPI specs
312
+ ---
313
+
314
+ Given an OpenAPI specification file, generate TypeScript route handlers
315
+ with request validation, error handling, and response typing.
316
+
317
+ Reference template: [template.hbs](./template.hbs)
318
+ See example: [user-api.ts](./examples/user-api.ts)
319
+ ```
320
+
321
+ ### MCP Servers
322
+
323
+ MCP server definitions use a JSON format compatible with the Model Context Protocol.
324
+
325
+ ```json
326
+ {
327
+ "mcpServers": {
328
+ "github": {
329
+ "type": "stdio",
330
+ "command": "npx",
331
+ "args": ["-y", "@modelcontextprotocol/server-github"],
332
+ "env": {
333
+ "GITHUB_TOKEN": "$GITHUB_TOKEN"
334
+ }
335
+ },
336
+ "internal-api": {
337
+ "type": "url",
338
+ "url": "http://localhost:3100/mcp",
339
+ "headers": {
340
+ "Authorization": "Bearer $API_TOKEN"
341
+ }
342
+ }
343
+ }
344
+ }
75
345
  ```
76
346
 
77
- If the repo already has tool-specific config, import it first:
347
+ Supports both `stdio` (local process) and `url` (HTTP endpoint) server types. Environment variables use `$VAR` syntax and are resolved at runtime by each tool.
348
+
349
+ ### Permissions
350
+
351
+ Allow/deny lists for tool operations. Mainly consumed by Claude Code (native) and Cursor/Gemini CLI (partial).
352
+
353
+ ```yaml
354
+ allow:
355
+ - Read
356
+ - Grep
357
+ - Glob
358
+ - Bash(pnpm test:*)
359
+ - Bash(pnpm build:*)
360
+ - Bash(git add:*)
361
+ - Bash(git commit:*)
362
+ deny:
363
+ - WebFetch
364
+ - Bash(curl:*)
365
+ - Bash(rm -rf:*)
366
+ - Read(.env)
367
+ ```
368
+
369
+ Patterns support wildcards. `Bash(pnpm test:*)` allows any `pnpm test:` subcommand.
370
+
371
+ ### Hooks
372
+
373
+ Lifecycle hooks that trigger before/after tool use, on notifications, on user prompts, and on subagent lifecycle events.
374
+
375
+ ```yaml
376
+ PreToolUse:
377
+ - matcher: "Edit|Write"
378
+ type: command
379
+ command: "eslint --fix $FILE"
380
+ timeout: 30
381
+
382
+ PostToolUse:
383
+ - matcher: "Bash"
384
+ type: prompt
385
+ prompt: "Review the command output for security concerns."
386
+
387
+ Notification:
388
+ - matcher: "*"
389
+ type: command
390
+ command: "./scripts/log-notification.sh"
391
+
392
+ UserPromptSubmit:
393
+ - matcher: "*"
394
+ type: command
395
+ command: "./scripts/prompt-guard.sh"
396
+ ```
397
+
398
+ **Hook types:** `PreToolUse`, `PostToolUse`, `Notification`, `UserPromptSubmit`, `SubagentStart`, `SubagentStop`
399
+
400
+ **Entry fields:**
401
+
402
+ | Field | Type | Description |
403
+ |-----------|----------|------------------------------------------------------|
404
+ | `matcher` | `string` | Regex pattern for which tool/event triggers the hook. |
405
+ | `type` | `string` | `command` (run a shell command) or `prompt` (inject a prompt). |
406
+ | `command` | `string` | Shell command to execute (when `type: command`). |
407
+ | `prompt` | `string` | Prompt text to inject (when `type: prompt`). |
408
+ | `timeout` | `number` | Timeout in seconds (optional). |
409
+
410
+ ### Ignore Patterns
411
+
412
+ A gitignore-style file listing patterns that AI tools should not index or read.
413
+
414
+ ```
415
+ node_modules
416
+ dist
417
+ .env
418
+ .env.*
419
+ *.log
420
+ .DS_Store
421
+ coverage
422
+ ```
423
+
424
+ ---
425
+
426
+ ## CLI Reference
427
+
428
+ ### Global Flags
429
+
430
+ | Flag | Description |
431
+ |-------------|---------------------------------------|
432
+ | `--help` | Show help output and exit. |
433
+ | `--version` | Print CLI version and exit. |
434
+ | `--verbose` | Show full error stack traces on failure. |
435
+
436
+ ### init
437
+
438
+ Create the canonical scaffold: `agentsmesh.yaml`, `agentsmesh.local.yaml`, `.agentsmesh/` directory with a starter `_root.md` rule, and update `.gitignore`.
78
439
 
79
440
  ```bash
80
- agentsmesh import --from cursor
81
- agentsmesh generate
441
+ agentsmesh init [flags]
82
442
  ```
83
443
 
84
- ## Canonical layout
444
+ | Flag | Description |
445
+ |---------|---------------------------------------------------------|
446
+ | `--yes` | Auto-import any detected tool configs without prompting. |
85
447
 
86
- ```text
87
- .agentsmesh/
88
- rules/_root.md
89
- rules/*.md
90
- commands/*.md
91
- agents/*.md
92
- skills/{name}/SKILL.md
93
- mcp.json
94
- permissions.yaml
95
- hooks.yaml
96
- ignore
97
- agentsmesh.yaml
98
- agentsmesh.local.yaml
99
- ```
100
-
101
- What each part does:
102
-
103
- - `rules/`: shared instructions, including the required root rule, target scoping, globs, and optional trigger modes
104
- - `commands/`: reusable slash-command style prompts
105
- - `agents/`: custom subagents with tools, model, hooks, MCP, skills, and memory
106
- - `skills/`: skills plus supporting files
107
- - `mcp.json`: MCP server definitions
108
- - `permissions.yaml`: allow/deny lists
109
- - `hooks.yaml`: lifecycle hooks
110
- - `ignore`: shared ignore patterns
111
- - `agentsmesh.local.yaml`: local-only overrides that should not be committed
112
-
113
- ## CLI commands
114
-
115
- Global flags:
116
-
117
- - `--help`
118
- - `--version`
119
- - `--verbose`
120
-
121
- | Command | What it does | Supported flags |
122
- | --- | --- | --- |
123
- | `init` | Create `agentsmesh.yaml`, `.agentsmesh/`, `agentsmesh.local.yaml`, and update `.gitignore` | `--yes` |
124
- | `generate` | Generate target files from `.agentsmesh/` | `--targets`, `--dry-run`, `--check`, `--force`, `--refresh-cache`, `--no-cache` |
125
- | `import` | Import an existing tool config into `.agentsmesh/` | `--from` |
126
- | `install` | Install resources from a local/remote source and materialize them as packs or extends | `--sync`, `--dry-run`, `--force`, `--path`, `--target`, `--as`, `--name`, `--extends` |
127
- | `diff` | Show what the next `generate` would change without writing files | `--targets` |
128
- | `lint` | Validate canonical files against target constraints | `--targets` |
129
- | `watch` | Watch canonical files and regenerate on change | `--targets` |
130
- | `check` | Verify the canonical state still matches the lock file | none |
131
- | `merge` | Resolve `.agentsmesh/.lock` merge conflicts | none |
132
- | `matrix` | Show feature support for the current config | `--targets`, `--verbose` |
133
- | `help` | Show command help | n/a (also via global `--help`) |
134
- | `version` | Show CLI/library version | n/a (also via global `--version`) |
135
-
136
- Examples:
448
+ During init, AgentsMesh scans the project for existing AI tool configurations (`.claude/`, `.cursor/`, `.cline/`, `.junie/`, `.continue/`, `.gemini/`, `.codex/`, `.windsurf/`, `.github/copilot-instructions.md`). If found, it offers to import them into the canonical directory.
137
449
 
138
450
  ```bash
451
+ # Interactive mode (prompts for each detected config)
452
+ agentsmesh init
453
+
454
+ # Auto-import everything detected
139
455
  agentsmesh init --yes
140
- agentsmesh generate --targets cursor,claude-code
456
+ ```
457
+
458
+ ### generate
459
+
460
+ Generate target-specific config files from the canonical `.agentsmesh/` directory.
461
+
462
+ ```bash
463
+ agentsmesh generate [flags]
464
+ ```
465
+
466
+ | Flag | Description |
467
+ |--------------------|------------------------------------------------------------|
468
+ | `--targets <csv>` | Comma-separated list of target IDs to generate for. |
469
+ | `--dry-run` | Preview changes without writing any files. |
470
+ | `--check` | Verify sync status only. Exit code 1 if out of sync. |
471
+ | `--force` | Bypass collaboration lock violations. |
472
+ | `--refresh-cache` | Re-fetch remote extends sources before generating. |
473
+ | `--no-cache` | Alias for `--refresh-cache`. |
474
+
475
+ ```bash
476
+ # Generate for all configured targets
477
+ agentsmesh generate
478
+
479
+ # Generate for specific targets only
480
+ agentsmesh generate --targets claude-code,cursor
481
+
482
+ # Preview what would change
141
483
  agentsmesh generate --dry-run
484
+
485
+ # CI check: fail if generated files are out of date
142
486
  agentsmesh generate --check
487
+
488
+ # Force through locked feature protections
489
+ agentsmesh generate --force
490
+
491
+ # Refresh remote extends cache
143
492
  agentsmesh generate --refresh-cache
493
+ ```
494
+
495
+ ### import
496
+
497
+ Import an existing tool's config into the canonical `.agentsmesh/` directory.
498
+
499
+ ```bash
500
+ agentsmesh import --from <target>
501
+ ```
502
+
503
+ | Flag | Description |
504
+ |------------------|---------------------------------------------------------|
505
+ | `--from <target>`| Source tool ID to import from (required). |
506
+
507
+ Valid targets: `claude-code`, `cursor`, `copilot`, `continue`, `junie`, `gemini-cli`, `cline`, `codex-cli`, `windsurf`
508
+
509
+ ```bash
510
+ # Import existing Claude Code configuration
511
+ agentsmesh import --from claude-code
512
+
513
+ # Import Cursor rules and settings
514
+ agentsmesh import --from cursor
515
+
516
+ # Import from any supported tool
517
+ agentsmesh import --from copilot
518
+ agentsmesh import --from gemini-cli
519
+ agentsmesh import --from cline
144
520
  agentsmesh import --from codex-cli
145
- agentsmesh install github:org/repo@main --path skills --as skills
521
+ agentsmesh import --from windsurf
522
+ agentsmesh import --from continue
523
+ agentsmesh import --from junie
524
+ ```
525
+
526
+ The import process maps tool-specific config to the canonical format:
527
+ - `.claude/rules/*.md` becomes `.agentsmesh/rules/*.md`
528
+ - `.claude/settings.json` permissions become `.agentsmesh/permissions.yaml`
529
+ - `.cursor/rules/*.mdc` gets converted to standard markdown
530
+ - Skills, agents, commands, MCP, hooks, and ignore patterns are all mapped to their canonical equivalents
531
+
532
+ Internal file references (links between skills, supporting file paths) are rewritten from tool-specific paths to canonical paths, so cross-references stay valid.
533
+
534
+ ### install
535
+
536
+ Install rules, commands, agents, or skills from a remote or local source.
537
+
538
+ ```bash
539
+ agentsmesh install <source> [flags]
540
+ ```
541
+
542
+ | Flag | Description |
543
+ |------------------|-------------------------------------------------------------------|
544
+ | `<source>` | GitHub/GitLab URL, git URL, SSH, or local path. |
545
+ | `--path <dir>` | Subdirectory within the source repo to install from. |
546
+ | `--target <id>` | Hint for native format auto-discovery (e.g., `claude-code`). |
547
+ | `--as <kind>` | Manual mode: install as `rules`, `commands`, `agents`, or `skills`. |
548
+ | `--name <id>` | Override the generated install entry name. |
549
+ | `--extends` | Record as an extends entry instead of a materialized pack. |
550
+ | `--sync` | Reinstall missing packs from `.agentsmesh/installs.yaml`. |
551
+ | `--dry-run` | Preview what would be installed without writing. |
552
+ | `--force` | Non-interactive mode: include all resources, skip prompts. |
553
+
554
+ **Source formats:**
555
+
556
+ | Format | Example |
557
+ |--------------------------------------------------|------------------------------------------|
558
+ | GitHub shorthand | `github:org/repo@v1.0.0` |
559
+ | GitLab shorthand | `gitlab:group/repo@main` |
560
+ | Git SSH | `git+ssh://git@github.com/org/repo#main`|
561
+ | Local path | `local:../shared-config` |
562
+
563
+ ```bash
564
+ # Auto-discover and install from a GitHub repo
565
+ agentsmesh install github:org/shared-rules@v2.0.0
566
+
567
+ # Install specific skills from a subdirectory
568
+ agentsmesh install github:org/repo --path skills --as skills
569
+
570
+ # Cherry-pick specific items
571
+ agentsmesh install github:org/repo --as agents --name team-agents
572
+
573
+ # Record as extends (linked, not materialized)
574
+ agentsmesh install github:org/base-config --extends
575
+
576
+ # Reinstall missing packs after a fresh clone
577
+ agentsmesh install --sync
578
+
579
+ # Preview before committing
580
+ agentsmesh install github:org/repo --dry-run
581
+ ```
582
+
583
+ Installed packs are written to `.agentsmesh/packs/` and tracked in `.agentsmesh/installs.yaml`. They merge with your canonical config during generation.
584
+
585
+ ### diff
586
+
587
+ Show a unified diff of what the next `generate` would change, without writing anything.
588
+
589
+ ```bash
590
+ agentsmesh diff [flags]
591
+ ```
592
+
593
+ | Flag | Description |
594
+ |-----------------|------------------------------------------------------|
595
+ | `--targets <csv>` | Limit diff output to specific target IDs. |
596
+
597
+ ```bash
598
+ # See all pending changes
599
+ agentsmesh diff
600
+
601
+ # See changes for Windsurf only
146
602
  agentsmesh diff --targets windsurf
603
+ ```
604
+
605
+ ### lint
606
+
607
+ Validate canonical files against target-specific constraints. Each target has its own linting rules -- for example, Cursor requires `.mdc` format compliance, Claude Code validates `settings.json` schema, and all targets check for valid frontmatter.
608
+
609
+ ```bash
610
+ agentsmesh lint [flags]
611
+ ```
612
+
613
+ | Flag | Description |
614
+ |-----------------|--------------------------------------------------|
615
+ | `--targets <csv>` | Limit linting to specific target IDs. |
616
+
617
+ ```bash
618
+ # Lint for all configured targets
147
619
  agentsmesh lint
620
+
621
+ # Lint for Cursor constraints only
622
+ agentsmesh lint --targets cursor
623
+ ```
624
+
625
+ ### watch
626
+
627
+ Watch the `.agentsmesh/` directory for changes and automatically regenerate on save. Uses a 300ms debounce to batch rapid edits. The watch loop ignores its own lock file writes to prevent infinite regeneration cycles.
628
+
629
+ ```bash
630
+ agentsmesh watch [flags]
631
+ ```
632
+
633
+ | Flag | Description |
634
+ |-----------------|--------------------------------------------------|
635
+ | `--targets <csv>` | Limit regeneration to specific target IDs. |
636
+
637
+ ```bash
638
+ # Watch and regenerate for all targets
148
639
  agentsmesh watch
640
+
641
+ # Watch and regenerate for Claude Code only
642
+ agentsmesh watch --targets claude-code
643
+ ```
644
+
645
+ ### check
646
+
647
+ Verify that the canonical files still match the lock file (`.agentsmesh/.lock`). Designed for CI pipelines -- exits with code 1 if generated files have drifted.
648
+
649
+ ```bash
149
650
  agentsmesh check
651
+ ```
652
+
653
+ No flags. Returns exit code 0 if everything is in sync, 1 if drift is detected.
654
+
655
+ ### merge
656
+
657
+ Resolve `.agentsmesh/.lock` merge conflicts after a `git merge`. Rebuilds the lock file from the current canonical state.
658
+
659
+ ```bash
150
660
  agentsmesh merge
661
+ ```
662
+
663
+ No flags. Run this after `git merge` when the lock file has conflicts.
664
+
665
+ ### matrix
666
+
667
+ Display the feature-target compatibility matrix for your current configuration.
668
+
669
+ ```bash
670
+ agentsmesh matrix [flags]
671
+ ```
672
+
673
+ | Flag | Description |
674
+ |-----------------|-------------------------------------------------------|
675
+ | `--targets <csv>` | Limit matrix columns to specific target IDs. |
676
+ | `--verbose` | Show detailed feature notes alongside the matrix. |
677
+
678
+ ```bash
679
+ # Show full matrix
680
+ agentsmesh matrix
681
+
682
+ # Show matrix for specific targets
683
+ agentsmesh matrix --targets claude-code,cursor,copilot
684
+
685
+ # Show matrix with detailed notes
151
686
  agentsmesh matrix --verbose
152
- agentsmesh --help
153
- agentsmesh --version
154
687
  ```
155
688
 
156
- ## Features worth knowing about
689
+ ---
690
+
691
+ ## Configuration
692
+
693
+ ### agentsmesh.yaml
694
+
695
+ The main project configuration file. Created by `agentsmesh init`.
696
+
697
+ ```yaml
698
+ version: 1
699
+
700
+ # Which tools to generate config for
701
+ targets:
702
+ - claude-code
703
+ - cursor
704
+ - copilot
705
+ - gemini-cli
706
+ - cline
707
+ - codex-cli
708
+ - windsurf
709
+ - continue
710
+ - junie
711
+
712
+ # Which features to sync (all enabled by default)
713
+ features:
714
+ - rules
715
+ - commands
716
+ - agents
717
+ - skills
718
+ - mcp
719
+ - hooks
720
+ - ignore
721
+ - permissions
722
+
723
+ # Inherit shared config from other sources
724
+ extends:
725
+ - name: company-standards
726
+ source: github:my-org/ai-config@v1.0.0
727
+ features: [rules, commands, permissions]
728
+
729
+ # Team collaboration settings
730
+ collaboration:
731
+ strategy: merge
732
+ lock_features:
733
+ - mcp
734
+ - permissions
735
+ ```
736
+
737
+ **Top-level fields:**
738
+
739
+ | Field | Type | Description |
740
+ |-----------------|------------|--------------------------------------------------------------|
741
+ | `version` | `number` | Config version. Currently `1`. |
742
+ | `targets` | `string[]` | Tool IDs to generate config for. |
743
+ | `features` | `string[]` | Features to sync. Omit to enable all. |
744
+ | `extends` | `array` | Shared config sources to inherit from. |
745
+ | `overrides` | `object` | Per-target overrides (keyed by target ID). |
746
+ | `collaboration` | `object` | Team collaboration and lock settings. |
747
+ | `conversions` | `object` | Control feature projection behavior per target. |
157
748
 
158
- - `extends` can pull shared config from a local folder, GitHub release, GitLab repo, or generic git remote
159
- - `agentsmesh.local.yaml` lets one developer narrow targets or disable conversions without changing the shared project config
160
- - Conversion controls let you turn off projected command-to-skill or agent-to-skill mappings per target
161
- - `watch` ignores its own lock-file writes, so generation does not loop on itself
162
- - `check` and `merge` are built for team workflows, not just solo local use
749
+ ### Local Overrides
163
750
 
164
- Example `extends` config:
751
+ `agentsmesh.local.yaml` is gitignored and allows individual developers to customize their setup without affecting the shared config.
752
+
753
+ ```yaml
754
+ # Only generate for the tools I use
755
+ targets:
756
+ - claude-code
757
+
758
+ # Skip features I don't need locally
759
+ features:
760
+ - rules
761
+ - commands
762
+ - skills
763
+ - mcp
764
+ ```
765
+
766
+ Local overrides narrow the scope -- they cannot add targets or features that the project config does not define.
767
+
768
+ ### Extends
769
+
770
+ Pull shared configuration from remote repositories, other local projects, or Git URLs.
165
771
 
166
772
  ```yaml
167
773
  extends:
168
- - source: ../shared-ai-config
774
+ # GitHub release
775
+ - name: company-rules
776
+ source: github:my-org/ai-config@v1.0.0
169
777
  features: [rules, commands]
170
- - source: github:my-org/ai-config@v1.0.0
778
+
779
+ # GitLab repo
780
+ - name: platform-config
781
+ source: gitlab:infra/ai-standards@v2.3.1
171
782
  features: [rules, permissions]
172
- - source: gitlab:team/platform/ai-config@v2.3.1
783
+
784
+ # Git SSH
785
+ - name: private-rules
786
+ source: git+ssh://git@github.com/org/config.git#main
173
787
  features: [rules]
174
- - source: git+ssh://git@git.example.com/platform/ai-config.git#main
788
+
789
+ # Local directory (monorepo shared config)
790
+ - name: shared-local
791
+ source: ../shared-ai-config
792
+ features: [rules, commands, mcp]
793
+ ```
794
+
795
+ **Extends entry fields:**
796
+
797
+ | Field | Type | Description |
798
+ |------------|------------|---------------------------------------------------------------|
799
+ | `name` | `string` | Identifier for this extends entry. |
800
+ | `source` | `string` | Source URL or path. |
801
+ | `version` | `string` | Version tag (for remote sources). |
802
+ | `target` | `string` | Hint for native format auto-discovery. |
803
+ | `features` | `string[]` | Which features to inherit from this source. |
804
+ | `path` | `string` | Subdirectory within the source. |
805
+ | `pick` | `object` | Cherry-pick specific resources (e.g., `rules: [style, perf]`).|
806
+
807
+ Remote sources are cached in `~/.agentsmesh/cache/`. Use `--refresh-cache` on `generate` to force a re-fetch.
808
+
809
+ ### Collaboration Settings
810
+
811
+ Control how teams work with generated config files.
812
+
813
+ ```yaml
814
+ collaboration:
815
+ strategy: merge # merge | lock | last-wins
816
+ lock_features:
817
+ - mcp
818
+ - permissions
819
+ ```
820
+
821
+ | Strategy | Behavior |
822
+ |-------------|------------------------------------------------------------------------|
823
+ | `merge` | Standard 3-way merge of the lock file. Use `agentsmesh merge` to resolve conflicts. |
824
+ | `lock` | Locked features cannot be regenerated without `--force`. Useful for sensitive config like MCP servers and permissions. |
825
+ | `last-wins` | Always overwrite the lock with the latest state. |
826
+
827
+ ### Conversions
828
+
829
+ Control how features are projected when a target lacks native support.
830
+
831
+ ```yaml
832
+ conversions:
833
+ # Convert commands to skills for tools that don't have native command support
834
+ commands_to_skills:
835
+ codex-cli: true
836
+
837
+ # Convert agents to skills for tools that don't have native agent support
838
+ agents_to_skills:
839
+ cline: true
840
+ windsurf: true
841
+ codex-cli: true
842
+ gemini-cli: true
843
+ ```
844
+
845
+ Set a conversion to `false` to disable projection for that target. The feature will simply be skipped instead of being embedded as a skill.
846
+
847
+ ---
848
+
849
+ ## Workflows
850
+
851
+ ### Adopting AgentsMesh in an Existing Project
852
+
853
+ If the project already has AI tool configs scattered across `.claude/`, `.cursor/`, `.cline/`, and so on:
854
+
855
+ ```bash
856
+ # 1. Initialize the canonical directory
857
+ agentsmesh init
858
+
859
+ # 2. Import existing configs (one at a time or use --yes during init)
860
+ agentsmesh import --from claude-code
861
+ agentsmesh import --from cursor
862
+
863
+ # 3. Review the canonical files
864
+ ls .agentsmesh/rules/
865
+ ls .agentsmesh/commands/
866
+ cat .agentsmesh/permissions.yaml
867
+
868
+ # 4. Generate fresh output for all targets
869
+ agentsmesh generate
870
+
871
+ # 5. Verify nothing unexpected changed
872
+ agentsmesh diff
873
+ ```
874
+
875
+ After this, `.agentsmesh/` is the source of truth. Edit canonical files, run `generate`, and commit both the canonical sources and the generated output.
876
+
877
+ ### Supporting Multiple Tools on a Team
878
+
879
+ When half the team uses Cursor and the other half uses Claude Code:
880
+
881
+ ```yaml
882
+ # agentsmesh.yaml
883
+ version: 1
884
+ targets:
885
+ - claude-code
886
+ - cursor
887
+ features:
888
+ - rules
889
+ - commands
890
+ - agents
891
+ - skills
892
+ - mcp
893
+ - hooks
894
+ - permissions
895
+ - ignore
896
+ ```
897
+
898
+ Everyone edits `.agentsmesh/`. Run `agentsmesh generate` after changes. Both `.claude/` and `.cursor/` directories stay in sync. The lock file tracks the generated state so PR reviews can catch drift.
899
+
900
+ ### Sharing Config Across Repositories
901
+
902
+ Create a shared repo with canonical rules, then reference it with extends:
903
+
904
+ ```yaml
905
+ # In each project's agentsmesh.yaml
906
+ extends:
907
+ - name: org-standards
908
+ source: github:my-org/ai-standards@v1.2.0
175
909
  features: [rules, commands, permissions]
176
910
  ```
177
911
 
178
- ## Roadmap
912
+ When the shared repo publishes a new release, bump the version tag and run `agentsmesh generate --refresh-cache`.
179
913
 
180
- This section is planned work, not current functionality.
914
+ ### CI Drift Detection
181
915
 
182
- ### Tier 1
916
+ Add a check step to your CI pipeline:
183
917
 
184
- - Global mode for user-level config outside a single repo
185
- - Programmatic API for `generate`, `lint`, and `diff`
186
- - More targets: Roo Code, Kilo Code, Goose, Kiro, OpenCode, Factory Droid, Google Antigravity
187
- - Homebrew distribution and a single binary build
188
- - `--json` output on command results
189
- - Dedicated `.gitignore` command
190
- - MCP server so agents can inspect and manage their own config
918
+ ```yaml
919
+ # .github/workflows/ci.yml
920
+ - name: Verify AI config sync
921
+ run: npx agentsmesh check
922
+ ```
191
923
 
192
- ### Tier 2
924
+ `agentsmesh check` exits with code 1 if generated files have drifted from the lock file. This catches cases where someone edited `.agentsmesh/` but forgot to regenerate, or edited a generated file directly.
193
925
 
194
- - `.gitattributes` auto-generation for generated files
195
- - `convert` for direct tool-to-tool conversion
196
- - Ephemeral generation mode (`--stdout`, temp output)
197
- - Plugin system for custom targets
198
- - JSON Schema for `agentsmesh.yaml`
926
+ ### Installing Community Packs
199
927
 
200
- ### Tier 3
928
+ Install shared skills, rules, or agents from public repositories:
201
929
 
202
- - Community registry for shared rule sets and configs
203
- - `migrate --from <tool>` for zero-friction imports from other AI config tools
204
- - IDE extension for VS Code and JetBrains
930
+ ```bash
931
+ # Install skills from a public repo
932
+ agentsmesh install github:community/ai-skills@v1.0.0
205
933
 
206
- ## Development commands
934
+ # Install specific skills from a subdirectory
935
+ agentsmesh install github:my-org/toolbox --path skills --as skills
936
+
937
+ # After a fresh clone, reinstall recorded packs
938
+ agentsmesh install --sync
939
+ ```
940
+
941
+ Installed packs live in `.agentsmesh/packs/` and are tracked in `.agentsmesh/installs.yaml`. They merge into the canonical config during generation.
942
+
943
+ ### Local Development Overrides
944
+
945
+ Each developer can create `agentsmesh.local.yaml` (gitignored) to customize their local setup:
946
+
947
+ ```yaml
948
+ # I only use Claude Code, don't generate Cursor/Copilot files locally
949
+ targets:
950
+ - claude-code
951
+
952
+ # I don't need hooks locally
953
+ features:
954
+ - rules
955
+ - commands
956
+ - agents
957
+ - skills
958
+ - mcp
959
+ - permissions
960
+ ```
961
+
962
+ This narrows the scope without affecting the shared `agentsmesh.yaml` that the rest of the team uses.
963
+
964
+ ---
965
+
966
+ ## How Generation Works
967
+
968
+ The generation pipeline follows this sequence:
969
+
970
+ 1. **Load config** -- parse `agentsmesh.yaml`, merge local overrides, validate schema.
971
+ 2. **Load canonical sources** -- read all files from `.agentsmesh/`, resolve extends (fetch from cache or remote), load installed packs, merge everything.
972
+ 3. **Generate per target** -- for each enabled target, call target-specific generators for rules, commands, agents, skills, MCP, hooks, ignore, and permissions. Each generator produces `{path, content}` pairs in the target's native format.
973
+ 4. **Rewrite references** -- internal `.agentsmesh/` file paths are rewritten to target-relative paths (e.g., `.agentsmesh/skills/api-gen/template.hbs` becomes `.claude/skills/api-gen/template.hbs`).
974
+ 5. **Resolve collisions** -- detect overlapping output paths across features, prefer native over embedded, remove duplicates.
975
+ 6. **Write output** -- create target directories, write all files, update the lock file with checksums.
976
+ 7. **Clean stale files** -- remove previously generated files that are no longer in the output set.
977
+
978
+ On import, the pipeline runs in reverse: tool-specific paths are mapped back to canonical paths, references are restored, and metadata is preserved for round-trip fidelity.
979
+
980
+ ---
981
+
982
+ ## Roadmap
983
+
984
+ See [ROADMAP.md](ROADMAP.md) for planned features and release timeline.
985
+
986
+ ---
987
+
988
+ ## Contributing
989
+
990
+ Contributions are welcome. Keep changes small, test them, and prefer editing canonical `.agentsmesh/` sources over generated files.
207
991
 
208
992
  ```bash
993
+ pnpm install
209
994
  pnpm build
210
995
  pnpm test
211
- pnpm test:watch
212
- pnpm test:coverage
213
- pnpm test:e2e
214
996
  pnpm lint
215
997
  pnpm typecheck
216
- pnpm format
217
- pnpm format:check
218
998
  ```
219
999
 
220
- ## Contributing
1000
+ ---
1001
+
1002
+ ## License
221
1003
 
222
- Keep changes small, verify them, and prefer updating the canonical `.agentsmesh/` source over editing generated target files by hand.
1004
+ [MIT](LICENSE)