agentsmesh 0.21.0 → 0.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +244 -0
- package/README.md +71 -9
- package/dist/canonical.d.ts +2 -2
- package/dist/canonical.js +339 -46
- package/dist/canonical.js.map +1 -1
- package/dist/cli.js +276 -223
- package/dist/engine.d.ts +5 -2
- package/dist/engine.js +1350 -87
- package/dist/engine.js.map +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.js +2993 -439
- package/dist/index.js.map +1 -1
- package/dist/init-YKxF2zpQ.d.ts +494 -0
- package/dist/lessons.d.ts +106 -0
- package/dist/lessons.js +2764 -0
- package/dist/lessons.js.map +1 -0
- package/dist/{schema-CLmR2JOb.d.ts → schema-CzaoYJlG.d.ts} +9 -1
- package/dist/{target-descriptor-CkLWz3Xk.d.ts → target-descriptor-D6vLDI1w.d.ts} +62 -2
- package/dist/targets.d.ts +3 -3
- package/dist/targets.js +293 -32
- package/dist/targets.js.map +1 -1
- package/package.json +9 -2
- package/schemas/installs.json +12 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,249 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.23.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 6a2e415: feat(lessons)!: JSON graph store, universal CLI primitives, clean break from YAML+MD
|
|
8
|
+
|
|
9
|
+
**BREAKING.** The lessons subsystem is now a single normalized JSON graph at
|
|
10
|
+
`.agentsmesh/lessons/lessons.json`. The previous YAML-index + per-topic
|
|
11
|
+
Markdown + journal store is removed entirely. The legacy public API is
|
|
12
|
+
removed.
|
|
13
|
+
|
|
14
|
+
**Why a clean break:** dragging a deprecation window along would leave two
|
|
15
|
+
parallel surfaces (CLI + library) that have to stay in sync forever, and the
|
|
16
|
+
old recall ritual (read 400+ line YAML index + matching topic Markdown files)
|
|
17
|
+
encouraged agents to skip it. The new single-command primitives — `lessons
|
|
18
|
+
query` to recall, `lessons add` to capture — are hard to rationalize past and
|
|
19
|
+
return only matched rules (~100–500 tokens) instead of the whole index.
|
|
20
|
+
|
|
21
|
+
## What's new
|
|
22
|
+
|
|
23
|
+
**CLI** (`agentsmesh lessons …`):
|
|
24
|
+
- `query --file <p> --cmd <c> [--keyword <k>] [--format plain|md|json]` —
|
|
25
|
+
recall primitive. Returns only matched lesson rules; defaults to one rule
|
|
26
|
+
per line.
|
|
27
|
+
- `add "<rule>" --topic <id> --trigger-file <glob> [--trigger-cmd <regex>]
|
|
28
|
+
[--trigger-kw <text>] [--evidence <ref>] [--new-topic --topic-summary
|
|
29
|
+
"<text>"]` — capture primitive. Lock-serialized, atomic, idempotent on
|
|
30
|
+
repeat.
|
|
31
|
+
- `topics`, `show <topic>`, `deprecate <id> [--superseded-by <id>]`,
|
|
32
|
+
`journal`, `validate`, `import-md`.
|
|
33
|
+
|
|
34
|
+
**MCP tools.** `lessons_query` and `lessons_add` register with the embedded
|
|
35
|
+
MCP server. Same surface as the CLI primitives.
|
|
36
|
+
|
|
37
|
+
**Programmatic API** (`agentsmesh/lessons`):
|
|
38
|
+
- `loadLessonsGraph` / `tryLoadLessonsGraph` / `saveLessonsGraph` /
|
|
39
|
+
`serializeGraph` / `graphFilePath` — deterministic load/save.
|
|
40
|
+
- `queryLessons(graph, { file, command, keyword })` — recall.
|
|
41
|
+
- `addLesson(root, input, opts?)` — capture; throws `UnknownTopicError` when
|
|
42
|
+
the topic is missing without `allowNewTopic`.
|
|
43
|
+
- `validateLessonsGraph(graph)` →
|
|
44
|
+
`{ ok, findings: [{ level, code, message, … }] }`. Codes: `SCHEMA_INVALID`,
|
|
45
|
+
`DANGLING_TOPIC`, `DANGLING_TRIGGER`, `DANGLING_SUPERSEDER`,
|
|
46
|
+
`DUPLICATE_RULE`, `SUPERSEDED_WITHOUT_TARGET`, `ACTIVE_WITH_SUPERSEDER`,
|
|
47
|
+
`ORPHAN_TOPIC`, `ORPHAN_TRIGGER`.
|
|
48
|
+
- `importLegacyLessons(root, { migratedAt })` — one-shot upgrade migrator.
|
|
49
|
+
- `acquireLessonsLock(root)` — process lock; same primitive as
|
|
50
|
+
`.generate.lock` / `.install.lock`.
|
|
51
|
+
|
|
52
|
+
## Upgrade path
|
|
53
|
+
|
|
54
|
+
If you used the previous YAML+MD store, the first `agentsmesh lessons`
|
|
55
|
+
invocation auto-migrates: parses `index.yaml` + `topics/*.md` + `journal.md`,
|
|
56
|
+
writes `lessons.json`, and **deletes the legacy files** so the project lands
|
|
57
|
+
in a clean state. The migrator preserves provenance — every imported lesson
|
|
58
|
+
gets `evidence[0] = "legacy:.agentsmesh/lessons/topics/<topic>.md#rule-N"`
|
|
59
|
+
plus any inlined `(Evidence L<n>)` references parsed verbatim as `legacy:L<n>`.
|
|
60
|
+
|
|
61
|
+
Run `agentsmesh lessons import-md` explicitly if you prefer to migrate at a
|
|
62
|
+
specific point in time, e.g. inside a release-prep script.
|
|
63
|
+
|
|
64
|
+
## Removed (breaking)
|
|
65
|
+
- **Files removed.** `.agentsmesh/lessons/index.yaml`,
|
|
66
|
+
`.agentsmesh/lessons/journal.md`, `.agentsmesh/lessons/topics/`, plus the
|
|
67
|
+
separate distill tracker (`distill-ledger.yaml`, `distill-proposal.md`).
|
|
68
|
+
All are recreated under the new single-file graph by the migrator.
|
|
69
|
+
- **Public API removed.** `loadLessonsIndex`, `readTriggeredLessons`,
|
|
70
|
+
`appendLessonToJournal`, `formatLessonBullet`, `parseIndex`,
|
|
71
|
+
`LessonsIndexSchema`, `LessonsCluster`, `LessonsIndex`, `matchTriggers`,
|
|
72
|
+
`ToolEvent`, `parseBullets`, `ParsedBullet`, `hashBullet`, `loadLedger`,
|
|
73
|
+
`saveLedger`, `Ledger`, `scoreBullet`, `ScoredCluster`,
|
|
74
|
+
`LESSONS_JOURNAL_TEMPLATE`, `LESSONS_INDEX_TEMPLATE`, `AppendLessonResult`,
|
|
75
|
+
`LessonCaptureInput`, `TriggeredLesson`.
|
|
76
|
+
- **package.json scripts removed.** `distill`, `distill:apply`. The distill
|
|
77
|
+
flow is subsumed by direct `lessons add`.
|
|
78
|
+
|
|
79
|
+
## Compatibility
|
|
80
|
+
- The CLI surface is **additive** for the `lessons` subcommand tree — no
|
|
81
|
+
existing CLI command changes shape.
|
|
82
|
+
- `agentsmesh init --lessons` still scaffolds the subsystem; it now writes
|
|
83
|
+
an empty graph instead of empty YAML+MD shells.
|
|
84
|
+
- The procedural rule in `_root.md` is regenerated by `agentsmesh generate`
|
|
85
|
+
into every target's root file; agents call the same two shell commands in
|
|
86
|
+
every harness.
|
|
87
|
+
|
|
88
|
+
## Constraints
|
|
89
|
+
- The graph at `.agentsmesh/lessons/lessons.json` is the single source of
|
|
90
|
+
truth — never edit it by hand; go through the CLI or `addLesson`.
|
|
91
|
+
- Writers serialize through a process lock at
|
|
92
|
+
`.agentsmesh/lessons/.lessons.lock` — concurrent captures cannot lose data.
|
|
93
|
+
- Output is deterministic (alphabetical keys at every depth, trailing
|
|
94
|
+
newline) so diffs stay clean.
|
|
95
|
+
|
|
96
|
+
- 60dbbd9: feat(lessons): public-readiness hardening — discoverable flags, safer capture/recall, clearer errors
|
|
97
|
+
|
|
98
|
+
The lessons subsystem is polished for general use, closing the gaps a first-time
|
|
99
|
+
external user would hit. No breaking changes to the documented happy path.
|
|
100
|
+
|
|
101
|
+
**Added**
|
|
102
|
+
- `agentsmesh lessons query` now documents `--session`, `--no-dedup`, and `--ids`
|
|
103
|
+
in `--help` (they were parsed but invisible), and every `lessons` subcommand
|
|
104
|
+
**rejects unknown flags** with the correct usage instead of silently ignoring
|
|
105
|
+
them — a typoed `--trigger-flie` no longer drops a trigger from a capture.
|
|
106
|
+
- Running a `lessons` command from a subdirectory of a project now **warns**
|
|
107
|
+
(`query` finds no graph here; `add` flags that it is about to create a stray
|
|
108
|
+
`.agentsmesh`) instead of silently returning empty or writing to the wrong place.
|
|
109
|
+
- Running a `lessons` command in a project initialized **without** `--lessons` no
|
|
110
|
+
longer dead-ends silently: reads hint to run `agentsmesh init --lessons`, and
|
|
111
|
+
`lessons add` still captures but warns that recall isn't wired into your AI
|
|
112
|
+
tools until you activate the subsystem.
|
|
113
|
+
- A present-but-malformed `.agentsmesh/lessons/config.json` now surfaces a stderr
|
|
114
|
+
warning rather than silently reverting to defaults.
|
|
115
|
+
|
|
116
|
+
**Changed**
|
|
117
|
+
- Capture rejects a rule longer than 2000 characters (`OVERSIZED_RULE`), and the
|
|
118
|
+
recall hook truncates any over-long rule before injecting it into agent context,
|
|
119
|
+
so a graph from a cloned third-party repo cannot flood the context with one
|
|
120
|
+
giant rule. The lessons reference now documents this **trust model**.
|
|
121
|
+
- `agentsmesh lessons hook` bounds the stdin payload it reads, so a runaway pipe
|
|
122
|
+
cannot exhaust memory.
|
|
123
|
+
- `lessons` errors now surface verbatim in `--json` output (e.g.
|
|
124
|
+
`"Recall needs a predicate…"`) instead of a generic `Command 'lessons' failed`.
|
|
125
|
+
- `agentsmesh init --lessons` only prints "the graph starts empty" when it
|
|
126
|
+
actually created the graph on this run.
|
|
127
|
+
|
|
128
|
+
- 0091779: feat(lessons): two-tier delivery — trimmed always-on trigger + on-demand `lessons` skill
|
|
129
|
+
|
|
130
|
+
The lessons recall/capture contract now ships in two tiers, using agentsmesh's
|
|
131
|
+
native primitives (rules + skills) rather than a single oversized root paragraph:
|
|
132
|
+
- **Tier 1 — always-on trigger.** `LESSONS_PROCEDURAL_RULE` is trimmed to the
|
|
133
|
+
binding essentials (both commands, the BLOCKING framing, the recall scope
|
|
134
|
+
including read-only, the broad capture scope, the graph path, the MCP
|
|
135
|
+
fallback). It is still injected into `.agentsmesh/rules/_root.md` as a managed
|
|
136
|
+
block, so it reaches every target through canonical rule generation.
|
|
137
|
+
- **Tier 2 — on-demand manual.** `agentsmesh init --lessons` now also seeds
|
|
138
|
+
`.agentsmesh/skills/lessons/SKILL.md`, a `lessons` skill carrying the full
|
|
139
|
+
operating manual (complete command set, topic workflow, trigger-flag
|
|
140
|
+
mechanics, the exhaustive rejected-excuse enumeration). It generates to every
|
|
141
|
+
skill-capable target and can grow without bloating always-on context.
|
|
142
|
+
- **Graceful degradation.** Targets without skills still receive the Tier-1
|
|
143
|
+
trigger, so the binding contract stays universal.
|
|
144
|
+
|
|
145
|
+
The skill is **create-if-missing** — once present it is your canonical,
|
|
146
|
+
user-owned content and is never clobbered. Projects generated with the previous
|
|
147
|
+
single-tier block upgrade to the trimmed block exactly once on the next
|
|
148
|
+
`generate`/scaffold (legacy form retained for clean strip/upgrade).
|
|
149
|
+
|
|
150
|
+
### Patch Changes
|
|
151
|
+
|
|
152
|
+
- 3d59e52: fix: six correctness bugs surfaced by a full feature review
|
|
153
|
+
- **lessons recall on symlinked roots**: `normalizeRecallFile` now realpaths the
|
|
154
|
+
project root and an absolute `--file` before relativizing. The CLI derives the
|
|
155
|
+
root from the physical `process.cwd()` while harnesses pass logical paths
|
|
156
|
+
(macOS `/tmp` → `/private/tmp`), so on a symlinked checkout `relative()`
|
|
157
|
+
escaped the root and recall — including the PostToolUse recall hook — silently
|
|
158
|
+
matched zero lessons. Recall now resolves correctly.
|
|
159
|
+
- **MCP lessons tools error codes**: failures (unknown topic, predicate-less
|
|
160
|
+
query, unknown lesson id, capture-guardrail rejections) now return
|
|
161
|
+
`NOT_FOUND` / `VALIDATION_FAILED` with the domain code in `details`, instead of
|
|
162
|
+
mislabeling every failure as `IO_ERROR`.
|
|
163
|
+
- **`generate` scoped-settings feature gating**: disabling a feature (e.g. `mcp`)
|
|
164
|
+
no longer leaks it into the gemini / zed / amp / augment `settings.json`
|
|
165
|
+
sidecars — `emitScopedSettings` is now gated by the enabled-feature set, for
|
|
166
|
+
plugin descriptors as well as builtins.
|
|
167
|
+
- **`matrix --global` accuracy**: targets without `globalSupport` (cloud-only
|
|
168
|
+
Jules, Replit Agent) now report `none` in global scope instead of falsely
|
|
169
|
+
claiming project-level support that `generate --global` never produces.
|
|
170
|
+
- **`install --sync` consent**: elevated-artifact consent is now persisted
|
|
171
|
+
(`accepted_elevated`) and replayed, so a sync no longer silently strips
|
|
172
|
+
previously-consented hooks / permissions / mcp while `installs.yaml` and
|
|
173
|
+
`pack.yaml` still claim them.
|
|
174
|
+
- **`refresh` / `install --sync` branch pins**: a branch pin (`@main`) keeps
|
|
175
|
+
tracking the branch across refreshes instead of freezing to a SHA after the
|
|
176
|
+
first refresh and never advancing again.
|
|
177
|
+
|
|
178
|
+
- 6a5fc7e: fix(install): retry the git-source cache finalize on Windows transient locks
|
|
179
|
+
|
|
180
|
+
Fetching a git `extends:`/`install` source could intermittently fail on Windows
|
|
181
|
+
with `EPERM: operation not permitted, rename '<cache>.tmp' -> '<cache>'`. The
|
|
182
|
+
fetcher finalizes the cache by renaming the freshly-cloned staging directory
|
|
183
|
+
into place; on Windows the just-exited `git clone` handle (or an antivirus /
|
|
184
|
+
search-indexer scan) can still pin those files for a few milliseconds, so the
|
|
185
|
+
rename is rejected. The finalize rename now retries on the transient codes
|
|
186
|
+
Windows raises (`EPERM`/`EACCES`/`EBUSY`/`ENOTEMPTY`/`EEXIST`) with a short
|
|
187
|
+
backoff, so the lock clears instead of surfacing a spurious "fetch failed".
|
|
188
|
+
POSIX behavior is unchanged (a single rename).
|
|
189
|
+
|
|
190
|
+
## 0.22.0
|
|
191
|
+
|
|
192
|
+
### Minor Changes
|
|
193
|
+
|
|
194
|
+
- c2a13ad: Add `agentsmesh init --lessons` and a new `agentsmesh/lessons` public API for
|
|
195
|
+
the lessons recall + capture subsystem.
|
|
196
|
+
|
|
197
|
+
The subsystem keeps agents from repeating past mistakes via a procedural rule
|
|
198
|
+
that lives in every target's root file: before any edit or command, scan
|
|
199
|
+
`.agentsmesh/lessons/index.yaml` and read every matched
|
|
200
|
+
`.agentsmesh/lessons/topics/<topic>.md`; after any failure, append to
|
|
201
|
+
`.agentsmesh/lessons/journal.md`. The optional repo-local `pnpm distill` /
|
|
202
|
+
`pnpm distill:apply` scripts can help maintain AgentsMesh's own topic routing,
|
|
203
|
+
but the generated rule does not require package-manager-specific tooling.
|
|
204
|
+
|
|
205
|
+
**Using it:**
|
|
206
|
+
- **Fresh init:** `agentsmesh init --lessons` — creates the canonical scaffold
|
|
207
|
+
AND the lessons subsystem in one command.
|
|
208
|
+
- **Retroactive add (existing project):** the same `agentsmesh init --lessons`
|
|
209
|
+
— when `agentsmesh.yaml` already exists, init only scaffolds the lessons
|
|
210
|
+
artifacts and appends the procedural rule to `_root.md`. Idempotent.
|
|
211
|
+
- After either flow, run `agentsmesh generate` to project the procedural rule
|
|
212
|
+
to every target's root file.
|
|
213
|
+
|
|
214
|
+
**Public API** (importable from `agentsmesh/lessons`):
|
|
215
|
+
- `scaffoldLessons(projectRoot)` — idempotent scaffolder used internally by
|
|
216
|
+
`init --lessons`; reusable from custom tooling.
|
|
217
|
+
- `loadLessonsIndex(projectRoot)`, `readTriggeredLessons(projectRoot, event)`,
|
|
218
|
+
`appendLessonToJournal(projectRoot, input)`, and `formatLessonBullet(input)` —
|
|
219
|
+
one high-level, target-agnostic read/write layer for integrations that should
|
|
220
|
+
not hand-roll filesystem access.
|
|
221
|
+
- `lessonsPaths(projectRoot)`, `LESSONS_PROCEDURAL_RULE`,
|
|
222
|
+
`LESSONS_JOURNAL_TEMPLATE`, `LESSONS_INDEX_TEMPLATE` — paths and templates.
|
|
223
|
+
- `parseIndex`, `LessonsIndexSchema`, `matchTriggers`, `scoreBullet`,
|
|
224
|
+
`loadLedger`, `saveLedger`, `hashBullet`, `parseBullets` — building blocks
|
|
225
|
+
for downstream tooling (custom distillers, recall hooks, IDE plugins).
|
|
226
|
+
|
|
227
|
+
**Universal across every target.** The subsystem uses plain markdown files
|
|
228
|
+
read via standard file I/O — no `Skill` tool, no description-match, no
|
|
229
|
+
per-target projection. Works in Claude Code, Codex CLI, Cline, Roo Code,
|
|
230
|
+
Cursor, Gemini CLI, Aider, Goose, and every other supported harness.
|
|
231
|
+
|
|
232
|
+
**Linter integration:** `agentsmesh lint` now validates the lessons subsystem
|
|
233
|
+
when present — checks that `index.yaml` parses, topic files referenced in the
|
|
234
|
+
index exist, and the journal file is well-formed.
|
|
235
|
+
|
|
236
|
+
**Constraints:**
|
|
237
|
+
- `--lessons` is project-mode only. Combining with `--global` errors out.
|
|
238
|
+
- Removal: `rm -rf .agentsmesh/lessons/` and strip the `## Lessons` paragraph
|
|
239
|
+
from `.agentsmesh/rules/_root.md`.
|
|
240
|
+
|
|
241
|
+
### Patch Changes
|
|
242
|
+
|
|
243
|
+
- c75a424: Surface marketplace sub-pack install failures instead of swallowing them silently, and route skill-pack sub-packs through the correct install path.
|
|
244
|
+
- c75a424: Fix qwen-code global-mode rule embedding. Rules were silently dropped when generating in global mode; they are now embedded inline using the same pattern as other global-mode targets.
|
|
245
|
+
- c75a424: Restructure the generation contract paragraph to lead with an explicit **NEVER edit generated files** prohibition naming the generated paths (`.claude/`, `.cursor/`, `AGENTS.md`, etc.), followed by **All changes MUST go through `.agentsmesh` first**. Agents were initially understanding the contract but forgetting it over multi-step conversations — front-loading the prohibition makes it stickier. All legacy contract body versions (v1-v10) remain detected for safe in-place upgrade.
|
|
246
|
+
|
|
3
247
|
## 0.21.0
|
|
4
248
|
|
|
5
249
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -16,9 +16,11 @@
|
|
|
16
16
|
|
|
17
17
|
</div>
|
|
18
18
|
|
|
19
|
-
AI coding
|
|
19
|
+
Every AI coding assistant has its own configuration format — `CLAUDE.md`, `AGENTS.md`, `.cursor/rules/*.mdc`, `.github/copilot-instructions.md`, and more. Keeping the same rules, prompts, MCP servers, hooks, and permissions in sync across all of them by hand is tedious, and they drift apart fast.
|
|
20
20
|
|
|
21
|
-
**AgentsMesh** is an open-source CLI and TypeScript library
|
|
21
|
+
**AgentsMesh** fixes this. It is an open-source CLI and TypeScript library: write your rules, commands, agents, skills, MCP servers, hooks, ignore files, and permissions once in `.agentsmesh/`, run `agentsmesh generate`, and every tool gets its native config. `agentsmesh import` pulls existing tool configs back into the one source, and `agentsmesh check` catches drift in CI.
|
|
22
|
+
|
|
23
|
+
**And your agents learn from your repo.** With [lessons](#teach-your-agents-lessons), an agent saves a short rule every time something goes wrong — a failing test, a code review comment, a wrong assumption — and recalls it automatically before it touches the same files again. One shared memory, read and written by every AI tool you use.
|
|
22
24
|
|
|
23
25
|
> **Full documentation: [samplexbro.github.io/agentsmesh](https://samplexbro.github.io/agentsmesh)**
|
|
24
26
|
|
|
@@ -87,6 +89,8 @@ AGENTS.md
|
|
|
87
89
|
hooks.yaml
|
|
88
90
|
permissions.yaml
|
|
89
91
|
ignore
|
|
92
|
+
lessons/
|
|
93
|
+
lessons.json
|
|
90
94
|
```
|
|
91
95
|
|
|
92
96
|
```bash
|
|
@@ -111,10 +115,57 @@ agentsmesh check # CI-friendly drift gate against .agentsmesh/.lock
|
|
|
111
115
|
- **`generate`** — writes `CLAUDE.md`, `AGENTS.md`, `.cursor/`, `.github/copilot-instructions.md`, etc. from canonical sources.
|
|
112
116
|
- **`check`** — exits non-zero if generated files have drifted from `.agentsmesh/.lock`. Drop into CI.
|
|
113
117
|
|
|
118
|
+
Want your agents to learn from this repo too? Add the optional lessons memory:
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
agentsmesh init --lessons # adds a shared memory: recall before edits, capture after failures
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
See [Teach your agents: lessons](#teach-your-agents-lessons) just below for how it works.
|
|
125
|
+
|
|
114
126
|
If you installed via `npm install -D agentsmesh` (also `pnpm add -D` / `yarn add -D`), prefix each command with `npx`. The CLI ships as both `agentsmesh` and the shorter alias `amsh`.
|
|
115
127
|
|
|
116
128
|
---
|
|
117
129
|
|
|
130
|
+
## Teach your agents: lessons
|
|
131
|
+
|
|
132
|
+
Lessons give your AI coding agents a **memory of past mistakes**. An agent reads that memory *before* it touches anything, and writes to it *after* something goes wrong — so the same mistake doesn't happen twice, in any tool.
|
|
133
|
+
|
|
134
|
+
The memory is one git-tracked file: `.agentsmesh/lessons/lessons.json`. Every agent — Claude Code, Cursor, Codex CLI, Copilot, and the rest — reads and writes the *same* file through two commands:
|
|
135
|
+
|
|
136
|
+
- **Recall** — before editing a file or running a state-changing command, the agent asks `agentsmesh lessons query --file <path> --cmd <command>`, gets back the rules that match, and follows them.
|
|
137
|
+
- **Capture** — right after a failure (a red test, a lint error, a review comment, a wrong assumption), the agent saves the rule with `agentsmesh lessons add "<rule>" --topic <id> --trigger-file <glob>`.
|
|
138
|
+
|
|
139
|
+
A 30-second example:
|
|
140
|
+
|
|
141
|
+
```bash
|
|
142
|
+
# 1. One-time setup
|
|
143
|
+
agentsmesh init --lessons && agentsmesh generate
|
|
144
|
+
|
|
145
|
+
# 2. You hit a bug: a Windows path broke because of a backslash.
|
|
146
|
+
# Capture the lesson so it never bites again:
|
|
147
|
+
agentsmesh lessons add "Normalize CLI display paths to forward slashes" \
|
|
148
|
+
--topic windows-paths \
|
|
149
|
+
--new-topic --topic-summary "Cross-platform path handling" \
|
|
150
|
+
--trigger-file "src/cli/**/*.ts"
|
|
151
|
+
|
|
152
|
+
# 3. Later, before editing a CLI file, the agent recalls it automatically:
|
|
153
|
+
agentsmesh lessons query --file src/cli/foo.ts
|
|
154
|
+
# -> Normalize CLI display paths to forward slashes
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
**Works in every tool.** `init --lessons` wires the loop once. A small always-on rule lands in `.agentsmesh/rules/_root.md` — rules are native in every target, so every agent gets the recall/capture habit — and the full operating manual ships as a `lessons` skill on tools that support skills. Agents without shell access use the matching MCP tools (`lessons_query` / `lessons_add`).
|
|
158
|
+
|
|
159
|
+
**Team-shared and reviewable.** The graph is a normal git-tracked file: a lesson your agent learns today helps every teammate's agent tomorrow, and every change shows up in code review like any other diff.
|
|
160
|
+
|
|
161
|
+
**Trust model.** `lessons.json` is checked into the repo, so its rules are project content — trusted at the same level as the code and `CLAUDE.md`. Review a lesson graph from a cloned third-party repo as you would any other code you run. As a guardrail, recall truncates any single rule to 2000 characters before injecting it and capture rejects longer rules, so a malformed rule cannot flood the agent's context.
|
|
162
|
+
|
|
163
|
+
**Upgrading from the legacy store?** Run `agentsmesh lessons import-md` once to migrate `index.yaml` + `topics/*.md` + `journal.md` into the graph; the CLI deletes the legacy files after a successful migration.
|
|
164
|
+
|
|
165
|
+
Full walkthrough: [Teach your AI agents with lessons](https://samplexbro.github.io/agentsmesh/guides/lessons/) · every subcommand and flag: [`agentsmesh lessons` CLI reference](https://samplexbro.github.io/agentsmesh/cli/lessons/).
|
|
166
|
+
|
|
167
|
+
---
|
|
168
|
+
|
|
118
169
|
## Safe adoption in an existing repository
|
|
119
170
|
|
|
120
171
|
If your repo already has `.cursor/`, `.claude/`, `.github/copilot-instructions.md`, or other native files, you don't have to delete them. The recommended flow imports them into `.agentsmesh/` first, lets you preview the projection, and only then trusts `generate`.
|
|
@@ -132,7 +183,7 @@ What this gets you:
|
|
|
132
183
|
- `diff` shows the unified patch every output file would receive, so you can review before any write.
|
|
133
184
|
- `check` reads `.agentsmesh/.lock` and fails the build if the canonical sources and the generated files disagree.
|
|
134
185
|
|
|
135
|
-
`import --from` accepts any built-in target ID listed in the [Supported Tools matrix](#feature-
|
|
186
|
+
`import --from` accepts any built-in target ID listed in the [Supported Tools matrix](#supported-tools--feature-matrix). Plugin targets are valid too.
|
|
136
187
|
|
|
137
188
|
---
|
|
138
189
|
|
|
@@ -169,6 +220,7 @@ AgentsMesh generates native config for every major AI coding assistant — plus
|
|
|
169
220
|
## Why developers use AgentsMesh
|
|
170
221
|
|
|
171
222
|
- **Bidirectional sync** — `import` reads existing tool configs into `.agentsmesh/`; `generate` projects them back out. Round-trips are loss-free, so adopting AgentsMesh in an existing repo never throws away data.
|
|
223
|
+
- **Agents that learn** — the optional [lessons memory](#teach-your-agents-lessons) recalls past-mistake rules before each edit and captures new ones after each failure, shared across every tool and every teammate.
|
|
172
224
|
- **Automatic link rebasing** — references like `.agentsmesh/skills/foo/SKILL.md` are rewritten to target-relative paths in every generated artifact, so cross-file links stay valid from `.claude/`, `.cursor/`, `.github/`, `.codex/`, and the rest.
|
|
173
225
|
- **Managed embedding with round-trip metadata** — when a target has no native slot for a feature (e.g. commands in Codex CLI, agents in Cline), AgentsMesh embeds it with frontmatter that survives the next `import`. No silent data loss; the full feature-by-feature breakdown lives in the [supported tools matrix](https://samplexbro.github.io/agentsmesh/reference/supported-tools/).
|
|
174
226
|
- **Team-safe collaboration** — `agentsmesh check` is a CI drift gate against `.agentsmesh/.lock`, `agentsmesh diff` previews changes, `agentsmesh merge` rebuilds the lock after three-way Git conflicts, and `lock_features` + per-feature `strategy` prevent accidental overrides.
|
|
@@ -208,6 +260,7 @@ AgentsMesh canonicalizes all of these — rules, commands, agents, skills, MCP s
|
|
|
208
260
|
- `hooks.yaml` — pre/post tool hooks.
|
|
209
261
|
- `permissions.yaml` — allow/deny rules where the target supports them.
|
|
210
262
|
- `ignore` — paths the assistant should not read or modify.
|
|
263
|
+
- `lessons/` — optional recall/capture memory: a single JSON graph (`lessons.json`) of lessons + topics + triggers. Agents talk to it via `agentsmesh lessons query` / `agentsmesh lessons add` rather than hand-editing files.
|
|
211
264
|
|
|
212
265
|
Configuration:
|
|
213
266
|
|
|
@@ -222,7 +275,7 @@ Detailed contracts: [Canonical Config](https://samplexbro.github.io/agentsmesh/c
|
|
|
222
275
|
## CLI usage
|
|
223
276
|
|
|
224
277
|
```bash
|
|
225
|
-
agentsmesh init [--global] [--yes]
|
|
278
|
+
agentsmesh init [--global | --lessons] [--yes] # --lessons is project-mode only (rejected with --global)
|
|
226
279
|
agentsmesh generate [--global] [--targets <csv>] [--check] [--dry-run] [--force] [--refresh-cache]
|
|
227
280
|
agentsmesh import --from <target> [--global]
|
|
228
281
|
agentsmesh convert --from <target> --to <target> [--global] [--dry-run]
|
|
@@ -239,10 +292,17 @@ agentsmesh installs list [--global]
|
|
|
239
292
|
agentsmesh refresh [<name>[,<name>...]] [--dry-run] [--force] [--json] [--global]
|
|
240
293
|
agentsmesh plugin add|list|remove|info [--version <v>] [--id <id>]
|
|
241
294
|
agentsmesh target scaffold <id> [--name <displayName>] [--force]
|
|
295
|
+
agentsmesh lessons query [--file <p>] [--cmd <c>] [--keyword <k>] [--format plain|md|json] [--top <n>] [--max-tokens <n>] [--all] [--session <id>] [--no-dedup] [--ids]
|
|
296
|
+
agentsmesh lessons add "<rule>" --topic <id> --trigger-file <glob> [--trigger-cmd <regex>] [--trigger-kw <text>] [--evidence <ref>] [--rationale <text>] [--new-topic --topic-summary "<one line>"]
|
|
297
|
+
agentsmesh lessons topics | show <topic|id> | deprecate <id> | merge <loser> <keeper> | untrigger <lesson> <trigger> | strip-markers | journal | validate | stats | prune [--apply] | import-md
|
|
242
298
|
```
|
|
243
299
|
|
|
244
300
|
`agentsmesh --help` prints the same surface; `agentsmesh <cmd> --help` is also supported.
|
|
245
301
|
|
|
302
|
+
Lessons recall (`query`) is relevance-ranked and lean by default (top 10 results, ~400-token budget); capture (`add`) requires at least one trigger that can actually fire and rejects rules over 2000 characters. Every flag, warning, and maintenance subcommand is documented in the [`agentsmesh lessons` CLI reference](https://samplexbro.github.io/agentsmesh/cli/lessons/).
|
|
303
|
+
|
|
304
|
+
Per-project recall tuning lives in `.agentsmesh/lessons/config.json`, written by `init --lessons` with every field at its default: `{ "recallLimit": 10, "recallMaxTokens": 400, "autoPrune": false }`. Lower the caps to keep recall lean on a large graph; set `"autoPrune": true` to garbage-collect dead triggers and orphan topics automatically after each capture (safe and fully git-reversible). `--top`/`--max-tokens`/`--all` override the caps per call.
|
|
305
|
+
|
|
246
306
|
### Machine-readable output
|
|
247
307
|
|
|
248
308
|
All commands support `--json` for CI pipelines and scripting:
|
|
@@ -356,6 +416,7 @@ installs against their declared sources. They are orthogonal.
|
|
|
356
416
|
| `agentsmesh.local.yaml` | **gitignore** | Per-developer overrides. |
|
|
357
417
|
| `.agentsmesh/.lock.tmp` | **gitignore** | Transient. |
|
|
358
418
|
| `.agentsmeshcache` | **gitignore** | Remote-extends cache. |
|
|
419
|
+
| `.agentsmesh/lessons/recall-log.jsonl` | **gitignore** | Opt-in recall telemetry (`AGENTSMESH_LESSONS_TELEMETRY=1`) — a runtime artifact, not the canonical graph. Added by `init --lessons`. |
|
|
359
420
|
| Generated tool folders (`.claude/`, `.cursor/`, `.github/`, `.gemini/`, `CLAUDE.md`, `AGENTS.md`, etc.) | **commit** | AI tools read these at runtime. Committing means a fresh clone has working AI configs without a build step. `agentsmesh check` in CI catches drift between canonical and generated. |
|
|
360
421
|
|
|
361
422
|
Why generated configs stay committed: the same reason `package-lock.json` does. They're deterministic build output that downstream consumers (in this case, the AI tool itself) read directly. Gitignoring them breaks fresh-clone UX and makes `agentsmesh check` meaningless. PR reviewers also benefit from seeing the projected diff in the format Claude/Cursor/Copilot will actually consume.
|
|
@@ -381,9 +442,10 @@ Every config file ships with a generated JSON Schema, so VS Code, JetBrains, and
|
|
|
381
442
|
| Variable | Default | Description |
|
|
382
443
|
|---|---|---|
|
|
383
444
|
| `AGENTSMESH_GITHUB_TOKEN` | — | GitHub personal access token for private repo installs and `extends`. |
|
|
384
|
-
| `AGENTSMESH_CACHE` | `~/.
|
|
445
|
+
| `AGENTSMESH_CACHE` | `~/.agentsmesh/cache` | Override the remote-extends / tarball cache directory (the gitignored `.agentsmeshcache` in the project is a symlink to it). Must be an absolute path. |
|
|
385
446
|
| `AGENTSMESH_MAX_TARBALL_MB` | `500` | Maximum GitHub tarball size in MiB the install command will accept. Allowed range: `1`–`4096`. Increase this when installing from large monorepos. |
|
|
386
447
|
| `AGENTSMESH_STRICT_PLUGINS` | `0` | When set to `1`, a failed plugin descriptor import fails the build instead of warning-and-skip. Useful in CI where a missing plugin target is a regression. |
|
|
448
|
+
| `AGENTSMESH_ALLOW_LOCAL_GIT` | `0` | When set to `1`, enables `git+file://` sources in `extends` and `install`. Disabled by default because on shared hosts a world-writable repo could be planted by another user and combined with elevated-artifact emission for local privilege escalation. |
|
|
387
449
|
|
|
388
450
|
---
|
|
389
451
|
|
|
@@ -468,11 +530,11 @@ Every public symbol resolves to a real `.d.ts` under strict TypeScript. Full ref
|
|
|
468
530
|
<!-- agentsmesh:support-matrix:global -->
|
|
469
531
|
| Feature | Aider | Amazon Q Developer | Amp | Antigravity | Augment Code | Claude Code | Cline | Codex CLI | Continue | GitHub Copilot | Crush | Cursor | Deep Agents CLI | Factory Droid | Gemini CLI | Goose | Jules | Junie | Kilo Code | Kiro | OpenCode | Pi Agent | Qwen Code | Replit Agent | Roo Code | Rovo Dev | Trae | Warp | Windsurf | Zed |
|
|
470
532
|
|---|:-----------:|:-----------:|:-----------:|:-----------:|:-----------:|:-----------:|:-----------:|:-----------:|:-----------:|:-----------:|:-----------:|:-----------:|:-----------:|:-----------:|:-----------:|:-----------:|:-----------:|:-----------:|:-----------:|:-----------:|:-----------:|:-----------:|:-----------:|:-----------:|:-----------:|:-----------:|:-----------:|:-----------:|:-----------:|:-----------:|
|
|
471
|
-
| Rules | Native | Native | Native | Native | Native | Native | Native | Native | Native | Native | Native | Native | Native | Native | Native | Native |
|
|
472
|
-
| Additional Rules | Embedded | — | Embedded | Embedded | Native | Native | Native | Embedded | Native | Native | Embedded | Embedded | Embedded | Embedded | Embedded | Embedded |
|
|
533
|
+
| Rules | Native | Native | Native | Native | Native | Native | Native | Native | Native | Native | Native | Native | Native | Native | Native | Native | — | Native | Native | Native | Native | Native | Native | — | Native | Native | Native | — | Native | — |
|
|
534
|
+
| Additional Rules | Embedded | — | Embedded | Embedded | Native | Native | Native | Embedded | Native | Native | Embedded | Embedded | Embedded | Embedded | Embedded | Embedded | — | Embedded | Native | Native | Native | Embedded | Embedded | — | Native | Embedded | Native | — | Partial | — |
|
|
473
535
|
| Commands | — | — | — | Partial (workflows) | Native | Native | Native (workflows) | Embedded | Native | Native | — | Native | — | — | Native | — | — | Native | Native | — | Native | — | Native | — | Native | — | — | — | Native (workflows) | — |
|
|
474
536
|
| Agents | — | — | — | — | — | Native | Embedded | Native | — | Native | — | Native | — | Native | Native | — | — | Native | Native | Native | Native | — | Native | — | Partial | — | — | — | Embedded | — |
|
|
475
|
-
| Skills | Native | — | Native | Native | Native | Native | Native | Native | Native | Native | Native | Native | Native | Native | Native | Native | — | Native | Native | Native | Native | Native | Native |
|
|
537
|
+
| Skills | Native | — | Native | Native | Native | Native | Native | Native | Native | Native | Native | Native | Native | Native | Native | Native | — | Native | Native | Native | Native | Native | Native | — | Native | Native | Native | Native | Native | — |
|
|
476
538
|
| MCP Servers | — | Native | Native | Native | Native | Native | Native | Native | Native | — | Native | Native | Native | Native | Native | — | — | Native | Native | Native | Native | — | Native | — | Native | Native | Native | — | Partial | Native |
|
|
477
539
|
| Hooks | — | — | — | — | — | Native | Native | — | — | — | Native | Native | — | — | Partial | — | — | — | — | — | — | — | — | — | — | — | — | — | Native | — |
|
|
478
540
|
| Ignore | Native | — | — | — | — | Native | Native | — | — | — | — | Native | — | — | — | Native | — | — | Native | Native | — | — | — | — | Native | — | — | — | Native | — |
|
|
@@ -489,7 +551,7 @@ See the [full feature matrix docs](https://samplexbro.github.io/agentsmesh/refer
|
|
|
489
551
|
- **[Canonical Config](https://samplexbro.github.io/agentsmesh/canonical-config/)** — rules, commands, agents, skills, MCP, hooks, ignore, permissions
|
|
490
552
|
- **[CLI Reference](https://samplexbro.github.io/agentsmesh/cli/)** — `init`, `generate`, `import`, `convert`, `install`, `uninstall`, `installs`, `refresh`, `diff`, `lint`, `watch`, `check`, `merge`, `matrix`, `plugin`, `target`
|
|
491
553
|
- **[Configuration](https://samplexbro.github.io/agentsmesh/configuration/agentsmesh-yaml/)** — `agentsmesh.yaml`, local overrides, extends, collaboration, conversions
|
|
492
|
-
- **[Guides](https://samplexbro.github.io/agentsmesh/guides/existing-project/)** — adopting in existing projects · multi-tool teams · sharing config · CI drift detection · community packs · **building plugins**
|
|
554
|
+
- **[Guides](https://samplexbro.github.io/agentsmesh/guides/existing-project/)** — adopting in existing projects · **teaching agents with lessons** · multi-tool teams · sharing config · CI drift detection · community packs · **building plugins**
|
|
493
555
|
- **[Reference](https://samplexbro.github.io/agentsmesh/reference/generation-pipeline/)** — supported tools matrix · generation pipeline · managed embedding
|
|
494
556
|
|
|
495
557
|
---
|
package/dist/canonical.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { b as CanonicalFiles, V as ValidatedConfig } from './schema-
|
|
2
|
-
export { C as CanonicalAgent, a as CanonicalCommand, c as CanonicalRule, d as CanonicalSkill, H as HookEntry, e as Hooks, I as IgnorePatterns, M as McpConfig, f as McpServer, P as Permissions, S as SkillSupportingFile, g as StdioMcpServer, U as UrlMcpServer } from './schema-
|
|
1
|
+
import { b as CanonicalFiles, V as ValidatedConfig } from './schema-CzaoYJlG.js';
|
|
2
|
+
export { C as CanonicalAgent, a as CanonicalCommand, c as CanonicalRule, d as CanonicalSkill, H as HookEntry, e as Hooks, I as IgnorePatterns, M as McpConfig, f as McpServer, P as Permissions, S as SkillSupportingFile, g as StdioMcpServer, U as UrlMcpServer } from './schema-CzaoYJlG.js';
|
|
3
3
|
import 'zod';
|
|
4
4
|
|
|
5
5
|
interface UnrecognizedFormatsWarningOptions {
|