agent-trellis 0.6.3 → 0.8.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/README.md +97 -38
- package/dist/adapters/claude-code.js +3 -2
- package/dist/adapters/codex.js +3 -2
- package/dist/adapters/jsonMcp.d.ts +3 -1
- package/dist/adapters/jsonMcp.js +18 -4
- package/dist/adapters/kimi-code.d.ts +21 -0
- package/dist/adapters/kimi-code.js +107 -0
- package/dist/adapters/kiro.js +3 -2
- package/dist/adapters/mcpPlan.d.ts +26 -2
- package/dist/adapters/mcpPlan.js +135 -15
- package/dist/adapters/pi.js +22 -3
- package/dist/adapters/symlinkPlan.d.ts +7 -0
- package/dist/adapters/symlinkPlan.js +16 -7
- package/dist/cli.js +129 -20
- package/dist/commands/doctor.d.ts +7 -2
- package/dist/commands/doctor.js +38 -2
- package/dist/commands/init.d.ts +4 -2
- package/dist/commands/init.js +26 -13
- package/dist/commands/kimi.d.ts +16 -0
- package/dist/commands/kimi.js +64 -0
- package/dist/commands/manage.d.ts +39 -0
- package/dist/commands/manage.js +126 -0
- package/dist/commands/mcp.d.ts +22 -1
- package/dist/commands/mcp.js +65 -2
- package/dist/commands/mcpGateway.d.ts +6 -0
- package/dist/commands/mcpGateway.js +34 -14
- package/dist/commands/mcpImport.d.ts +27 -0
- package/dist/commands/mcpImport.js +336 -0
- package/dist/commands/memory.d.ts +5 -3
- package/dist/commands/memory.js +12 -8
- package/dist/commands/migrate.d.ts +37 -7
- package/dist/commands/migrate.js +253 -27
- package/dist/commands/onboard.d.ts +74 -2
- package/dist/commands/onboard.js +463 -72
- package/dist/commands/onboardVerdict.js +20 -7
- package/dist/commands/rollback.js +4 -1
- package/dist/commands/secretsAudit.d.ts +21 -12
- package/dist/commands/secretsAudit.js +39 -10
- package/dist/commands/skill.d.ts +17 -0
- package/dist/commands/skill.js +47 -2
- package/dist/commands/sync.js +2 -0
- package/dist/core/canonical.d.ts +58 -4
- package/dist/core/canonical.js +183 -11
- package/dist/core/capabilitySelection.d.ts +45 -0
- package/dist/core/capabilitySelection.js +124 -0
- package/dist/core/types.d.ts +25 -2
- package/dist/core/types.js +7 -0
- package/dist/lib/backup.d.ts +2 -0
- package/dist/lib/backup.js +4 -0
- package/dist/lib/builtinSkills.d.ts +2 -0
- package/dist/lib/builtinSkills.js +4 -0
- package/dist/lib/cliMetadata.d.ts +1 -0
- package/dist/lib/cliMetadata.js +14 -0
- package/dist/lib/gatewayBackend.d.ts +28 -0
- package/dist/lib/gatewayBackend.js +72 -1
- package/dist/lib/installAgent.d.ts +7 -5
- package/dist/lib/installAgent.js +4 -3
- package/dist/lib/mcpConnect.js +5 -1
- package/dist/lib/mcpMigrateRead.d.ts +1 -0
- package/dist/lib/mcpMigrateRead.js +3 -0
- package/dist/lib/mcpRuntime.d.ts +46 -0
- package/dist/lib/mcpRuntime.js +185 -0
- package/dist/lib/mcpStatusProvider.d.ts +10 -0
- package/dist/lib/mcpStatusProvider.js +25 -0
- package/dist/lib/mcpToolRegistry.d.ts +18 -0
- package/dist/lib/mcpToolRegistry.js +107 -14
- package/dist/lib/memoryGraph.d.ts +1 -1
- package/dist/lib/memoryGraph.js +9 -3
- package/dist/lib/memoryProvider.d.ts +58 -0
- package/dist/lib/memoryProvider.js +175 -0
- package/dist/lib/memoryStatus.d.ts +17 -0
- package/dist/lib/memoryStatus.js +88 -0
- package/dist/lib/nativeMemory.d.ts +19 -0
- package/dist/lib/nativeMemory.js +129 -0
- package/dist/lib/runtimeControlProvider.d.ts +16 -0
- package/dist/lib/runtimeControlProvider.js +168 -0
- package/dist/lib/secretEnv.d.ts +17 -0
- package/dist/lib/secretEnv.js +31 -1
- package/dist/lib/skillProvider.d.ts +13 -0
- package/dist/lib/skillProvider.js +210 -0
- package/dist/lib/taskProvider.d.ts +7 -0
- package/dist/lib/taskProvider.js +43 -0
- package/dist/lib/taskStore.d.ts +46 -0
- package/dist/lib/taskStore.js +156 -0
- package/dist/lib/terminalPicker.d.ts +23 -28
- package/dist/lib/terminalPicker.js +54 -164
- package/dist/pi-bridge/bundle.js +493 -51
- package/dist/pi-bridge/index.js +42 -21
- package/dist/pi-bridge/schemaTranslate.d.ts +4 -8
- package/dist/pi-bridge/schemaTranslate.js +4 -8
- package/dist/probes/kimi-code.d.ts +12 -0
- package/dist/probes/kimi-code.js +55 -0
- package/dist/sdk.d.ts +1 -1
- package/docs/architecture.md +224 -26
- package/docs/assets/agent-trellis-architecture-horizontal.svg +80 -0
- package/docs/assets/agent-trellis-architecture-vertical.svg +82 -0
- package/docs/assets/trellis-mark.svg +12 -0
- package/docs/getting-started.md +403 -35
- package/docs/overview.md +131 -0
- package/docs/overview.zh-CN.md +100 -0
- package/docs/research.md +59 -0
- package/docs/roadmap.md +10 -5
- package/package.json +5 -3
- package/schema/builtin-skills/trellis-runtime/SKILL.md +117 -0
- package/schema/capability-selection.example.yaml +23 -0
- package/schema/scope.example.yaml +1 -1
- package/schema/servers.example.yaml +15 -1
package/docs/getting-started.md
CHANGED
|
@@ -15,8 +15,8 @@ npm install -g agent-trellis
|
|
|
15
15
|
$ trellis onboard
|
|
16
16
|
```
|
|
17
17
|
|
|
18
|
-
Runs `init`, detects which of Claude Code/Codex/Kiro/pi are on this machine,
|
|
19
|
-
then resolves two interactive choices and two flag-only ones before running
|
|
18
|
+
Runs `init`, detects which of Claude Code/Codex/Kiro/pi/Kimi Code are on this machine,
|
|
19
|
+
then resolves two styled interactive choices and two flag-only ones before running
|
|
20
20
|
`migrate`, `sync`, `mcp sync`, `memory sync`, `secrets audit`, and a final
|
|
21
21
|
health scan — the whole onboarding path, no follow-up commands to type by
|
|
22
22
|
hand, and no need to run `trellis doctor` separately to know whether it
|
|
@@ -39,27 +39,43 @@ that.
|
|
|
39
39
|
prompt entirely. Which *categories* to bring in from that source
|
|
40
40
|
(skills, instructions, mcp) is its own checkbox, shown only when the
|
|
41
41
|
source has real content in two or more of them — with just one, that
|
|
42
|
-
one is migrated unprompted.
|
|
42
|
+
one is migrated unprompted. On a real terminal this uses a colored
|
|
43
|
+
selector; it shows aggregate counts, not every skill name.
|
|
43
44
|
2. **Managed set** — zero or more agents to actually write to. Always an
|
|
44
45
|
explicit choice: pass `--manage <ids>` (comma-separated, e.g. `--manage
|
|
45
46
|
pi,codex`) or `--manage none`, or answer the interactive checkbox prompt
|
|
46
|
-
(Space to toggle, Enter to confirm — same numbered
|
|
47
|
+
(arrow keys to move, Space to toggle, Enter to confirm — same numbered
|
|
48
|
+
fallback as above when a raw TTY is unavailable).
|
|
47
49
|
**The source is not included by default** — migrating from Claude Code
|
|
48
50
|
doesn't mean Trellis starts managing Claude Code too, unless you say so.
|
|
49
51
|
Selecting an agent that isn't installed yet is itself the authorization to
|
|
50
52
|
install it (one confirmation, then a real `npm install -g <package>`);
|
|
51
53
|
Kiro has no CLI package and is refused with its download URL instead.
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
54
|
+
Onboarding is intentionally additive: an agent already managed remains
|
|
55
|
+
managed if a later onboarding run omits it. Use the explicit `trellis
|
|
56
|
+
manage` lifecycle commands below when you intend to detach one.
|
|
57
|
+
3. **MCP mode** — direct, gateway, or hub. In the interactive route picker,
|
|
58
|
+
**Gateway is recommended for local Trellis hosting**: Trellis runs the
|
|
59
|
+
local MCP entry and manages upstream connections for the Agent session;
|
|
60
|
+
no extra service is needed. Choose **Direct** when each Agent should
|
|
61
|
+
connect to MCP servers independently. Choose **Hub only when an external
|
|
62
|
+
MCP Hub is already running**: each Agent connects to one external HTTP
|
|
63
|
+
endpoint, and the Hub owns the upstream server list. Trellis does not
|
|
64
|
+
deploy the Hub. The non-interactive mode is flag-only: pass
|
|
65
|
+
`--mcp-mode direct|hub|gateway` to change it (`--hub-url <url>` is required
|
|
66
|
+
with `hub`; `--gateway-agents <ids>` is optional with `gateway`, omitted
|
|
67
|
+
meaning every managed agent). Omitting `--mcp-mode`
|
|
56
68
|
entirely leaves whatever's already configured untouched — on a fresh
|
|
57
69
|
machine that's direct, on one you've already switched that's whatever
|
|
58
70
|
you last set — so a plain `trellis onboard` re-run never resets it. This
|
|
59
71
|
is the only supported way to turn gateway or hub mode on or off; there's
|
|
60
72
|
no reason to hand-edit `~/.trellis/mcp/servers.yaml`'s `hub`/`gateway`
|
|
61
73
|
keys directly.
|
|
62
|
-
4. **
|
|
74
|
+
4. **Existing memory migration** — independent from the shared backend. Pass
|
|
75
|
+
`--memory-migrate on` to import supported native Markdown memory, or
|
|
76
|
+
`--memory-migrate off` to skip it. Unsupported Kimi/pi session stores are
|
|
77
|
+
reported and left untouched.
|
|
78
|
+
5. **The shared memory server** — off by default. Pass `--memory on` to add
|
|
63
79
|
the default `@modelcontextprotocol/server-memory` definition (refused if
|
|
64
80
|
a host on this machine already injects a connector named `memory` — see
|
|
65
81
|
[`trellis memory sync`](#trellis-memory-sync) below) or
|
|
@@ -134,6 +150,14 @@ a re-plan against canonical can. If a write somehow didn't hold (a
|
|
|
134
150
|
filesystem permission problem, a race), it surfaces in the verdict as its
|
|
135
151
|
own `blocked` item, separate from whatever the write's own stage reported.
|
|
136
152
|
|
|
153
|
+
Onboarding treats a mode change as a route transition, not a reset: canonical
|
|
154
|
+
Skills, MCP definitions, memories, and secrets policy stay in place. When an
|
|
155
|
+
interactive run changes mode, it shows the current mode, target mode, and
|
|
156
|
+
affected managed Agents before asking for confirmation. A blocking failure in
|
|
157
|
+
the transaction automatically restores canonical and native files together;
|
|
158
|
+
the backup remains available in `~/.trellis/backups/` for inspection or a
|
|
159
|
+
later explicit rollback.
|
|
160
|
+
|
|
137
161
|
**The health scan is `trellis doctor` itself**, run at the end against
|
|
138
162
|
every agent (not just the ones this run manages) — so a genuinely new
|
|
139
163
|
problem this run happened to create or reveal shows up without a separate
|
|
@@ -151,6 +175,23 @@ happens. It never appears on stdout, so `trellis onboard > report.txt`
|
|
|
151
175
|
still captures exactly the report and verdict, nothing else; it's silent
|
|
152
176
|
entirely under `--json` or when stdout isn't a real terminal.
|
|
153
177
|
|
|
178
|
+
Interactive choices use a compact colored prompt UI with clear success,
|
|
179
|
+
warning, and blocking states. The prompt UI is written to stderr, while the
|
|
180
|
+
report and JSON output stay on stdout.
|
|
181
|
+
|
|
182
|
+
For repeatable item-level selection, pass a YAML/JSON file:
|
|
183
|
+
|
|
184
|
+
```
|
|
185
|
+
$ trellis onboard --agent kiro --manage codex \
|
|
186
|
+
--selection ./schema/capability-selection.example.yaml
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
The file can select individual `skills`, `mcp_servers`, and `memories`, plus
|
|
190
|
+
per-agent `mcp_routes` with `direct`, `gateway`, or `hub` mode. It can also
|
|
191
|
+
set `runtime_delivery` per agent to `native`, `mcp`, or `both`; omitted agents
|
|
192
|
+
remain native. Existing
|
|
193
|
+
`--mcp-mode` and category flags remain valid shortcuts.
|
|
194
|
+
|
|
154
195
|
Add `--dry-run` to preview the entire chain — init/migrate/sync/mcp
|
|
155
196
|
sync/memory sync, including what would be written to
|
|
156
197
|
`~/.trellis/managed.yaml` and to `servers.yaml`'s mode/memory keys — with
|
|
@@ -174,9 +215,117 @@ The rest of this page is the same flow broken into its individual steps —
|
|
|
174
215
|
useful if you want more control over any one part, or just want to
|
|
175
216
|
understand what `onboard` did.
|
|
176
217
|
|
|
218
|
+
## `trellis manage` — change the write boundary explicitly
|
|
219
|
+
|
|
220
|
+
The managed set is Trellis's hard outer authorization boundary. Use the
|
|
221
|
+
standalone lifecycle command when you need to inspect, replace, extend, or
|
|
222
|
+
narrow it without running migration or sync:
|
|
223
|
+
|
|
224
|
+
```
|
|
225
|
+
trellis manage list
|
|
226
|
+
trellis manage set claude-code,pi --dry-run
|
|
227
|
+
trellis manage set claude-code,pi
|
|
228
|
+
trellis manage add codex
|
|
229
|
+
trellis manage remove kiro
|
|
230
|
+
trellis manage set none
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
`set` is exact; `add` unions; `remove` subtracts. Every real change to
|
|
234
|
+
`managed.yaml` is recorded under `~/.trellis/backups/` and can be reversed by
|
|
235
|
+
`trellis rollback`. A dry run or no-op creates no backup.
|
|
236
|
+
|
|
237
|
+
Detaching only prevents future Trellis writes. It never deletes or rewrites
|
|
238
|
+
the detached agent's existing skills, instructions, MCP entries, extensions,
|
|
239
|
+
or login state. Cleanup, if desired, is a separate explicit decision.
|
|
240
|
+
|
|
241
|
+
This differs deliberately from `onboard --manage`: onboarding remains
|
|
242
|
+
additive so an omitted checkbox cannot silently revoke management.
|
|
243
|
+
|
|
244
|
+
## Kimi Code Runtime-first
|
|
245
|
+
|
|
246
|
+
Kimi Code is supported as `kimi-code`. For Runtime-first delivery, configure
|
|
247
|
+
the capability selection with `runtime_delivery: { kimi-code: mcp }`, then
|
|
248
|
+
sync MCP and launch Kimi through Trellis:
|
|
249
|
+
|
|
250
|
+
```
|
|
251
|
+
trellis manage add kimi-code --dry-run
|
|
252
|
+
trellis mcp sync --dry-run
|
|
253
|
+
trellis kimi -p "search the Trellis skills for the onboarding workflow"
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
Runtime-only Kimi receives one `trellis` entry in
|
|
257
|
+
`~/.kimi-code/mcp.json`. `trellis kimi` passes an empty `--skills-dir` for
|
|
258
|
+
that mode, so Kimi does not also discover the shared `~/.agents/skills`
|
|
259
|
+
directory. The canonical SkillProvider and RuntimeMemoryProvider remain the
|
|
260
|
+
source of Skill/Memory content, while selected upstream MCP servers are
|
|
261
|
+
mounted through the same Runtime/Gateway edge.
|
|
262
|
+
|
|
263
|
+
Kimi's `deferred` MCP field is enabled on the owned Runtime entry to reduce
|
|
264
|
+
initial tool-list context when Kimi's experimental tool-select capability is
|
|
265
|
+
enabled. Runtime correctness does not depend on that optimization. Native
|
|
266
|
+
Kimi delivery remains available with `native` or `both`; those modes do not
|
|
267
|
+
use the empty Skill-root launcher.
|
|
268
|
+
|
|
269
|
+
## Trellis Runtime Skill
|
|
270
|
+
|
|
271
|
+
`trellis-runtime` is the built-in operating guide that Trellis installs into
|
|
272
|
+
the canonical source. It deliberately has two phases:
|
|
273
|
+
|
|
274
|
+
### Phase 1: before takeover
|
|
275
|
+
|
|
276
|
+
Use it as a checklist for the operator-assisted migration flow:
|
|
277
|
+
|
|
278
|
+
1. Run `trellis doctor` and `trellis onboard --dry-run` to inspect the current
|
|
279
|
+
machine without changing Agent files.
|
|
280
|
+
2. Choose one migration source with `--agent` and an explicit managed boundary
|
|
281
|
+
with `--manage`. Migrating from an Agent does not automatically authorize
|
|
282
|
+
Trellis to write back to that Agent.
|
|
283
|
+
3. Review the selected Skills, MCP servers, Memory, per-Agent routes, and
|
|
284
|
+
delivery mode. Use `--selection` when the choice must be repeatable.
|
|
285
|
+
4. Apply only after reviewing the dry-run. `onboard` performs migration,
|
|
286
|
+
native/runtime sync, Memory sync, secrets audit, and health verification in
|
|
287
|
+
one transaction.
|
|
288
|
+
5. Resolve OAuth interactively with `trellis mcp auth <server>`. Never place a
|
|
289
|
+
token in this Skill, `servers.yaml`, tests, or demonstration configuration.
|
|
290
|
+
6. If the verdict blocks, follow its remediation. Do not delete an unknown
|
|
291
|
+
file or bypass ownership protection; every real write has a backup and can
|
|
292
|
+
be inspected with `trellis rollback --list`.
|
|
293
|
+
|
|
294
|
+
### Phase 2: after takeover
|
|
295
|
+
|
|
296
|
+
The Agent consumes the same Skill regardless of its native adapter:
|
|
297
|
+
|
|
298
|
+
| Delivery | How the Skill is consumed |
|
|
299
|
+
| --- | --- |
|
|
300
|
+
| `native` | A Trellis-owned symlink points the Agent's native Skill root at the canonical Skill. |
|
|
301
|
+
| `mcp` | `SkillProvider` exposes the canonical Skill through the `trellis` Runtime; Kimi is launched with `trellis kimi` so its native Skill root does not duplicate the Runtime. |
|
|
302
|
+
| `both` | Native discovery and the Runtime are both available when a deliberate compatibility transition requires it. |
|
|
303
|
+
|
|
304
|
+
Once the Agent is running, start with the current Runtime status, then use
|
|
305
|
+
progressive disclosure:
|
|
306
|
+
|
|
307
|
+
1. `runtime_status` — Agent identity, delivery mode, provider readiness, and
|
|
308
|
+
counts.
|
|
309
|
+
2. `skills_search` → `skills_read` — locate and read only the Skill needed for
|
|
310
|
+
the current task.
|
|
311
|
+
3. `memory_search` → `memory_read` — consume shared canonical Memory.
|
|
312
|
+
4. `instructions_read` — inspect canonical global instructions when context is
|
|
313
|
+
needed.
|
|
314
|
+
5. `mcp_status` — diagnose missing, unauthorized, or unavailable MCP servers
|
|
315
|
+
and show the user the supported remediation.
|
|
316
|
+
6. `agents_list` and `tasks_list`/`tasks_read` — inspect the managed boundary
|
|
317
|
+
and handoff work. Mutating tasks requires explicit confirmation.
|
|
318
|
+
|
|
319
|
+
These are Trellis's portable names. A client may add a namespace such as
|
|
320
|
+
`mcp__trellis__skills_search`; never hardcode that client-generated prefix in a
|
|
321
|
+
Skill. The Runtime's built-in Skill and Memory providers are read-only. Shared
|
|
322
|
+
Memory writes come from the configured Memory MCP backend, and importing graph
|
|
323
|
+
content back into canonical Markdown remains an explicit
|
|
324
|
+
`trellis memory extract` operation.
|
|
325
|
+
|
|
177
326
|
## Two starting points
|
|
178
327
|
|
|
179
|
-
**You already use one or more of Claude Code, Codex, Kiro, or
|
|
328
|
+
**You already use one or more of Claude Code, Codex, Kiro, pi, or Kimi Code** and have
|
|
180
329
|
real skills/instructions in them today. Go to
|
|
181
330
|
[Migrating from an existing agent](#migrating-from-an-existing-agent).
|
|
182
331
|
|
|
@@ -204,7 +353,7 @@ Creates `~/.trellis/` with:
|
|
|
204
353
|
`~/.trellis/` that already exists just fills in whatever's still missing —
|
|
205
354
|
safe to run again any time, including after you've hand-edited things.
|
|
206
355
|
|
|
207
|
-
It then prints which of the
|
|
356
|
+
It then prints which of the five supported agents it found on this machine.
|
|
208
357
|
For each one **not** found, it prints that agent's real install command or
|
|
209
358
|
download link — `trellis init` never runs an installer itself; a global
|
|
210
359
|
package install or an IDE download is your call to make, not a silent side
|
|
@@ -225,7 +374,7 @@ migrate --from claude-code
|
|
|
225
374
|
[conflict] instructions — canonical agents.md already has different real content — resolve by hand
|
|
226
375
|
```
|
|
227
376
|
|
|
228
|
-
`--from` accepts `claude-code`, `codex`, `kiro`, or `
|
|
377
|
+
`--from` accepts `claude-code`, `codex`, `kiro`, `pi`, or `kimi-code`. Run it once per
|
|
229
378
|
agent you actually use — it's independent per agent, order doesn't matter.
|
|
230
379
|
|
|
231
380
|
Add `--dry-run` to see the plan without writing anything:
|
|
@@ -234,7 +383,7 @@ Add `--dry-run` to see the plan without writing anything:
|
|
|
234
383
|
$ trellis migrate --from codex --dry-run
|
|
235
384
|
```
|
|
236
385
|
|
|
237
|
-
Add `--only skills`, `--only instructions`, or `--only
|
|
386
|
+
Add `--only skills`, `--only instructions`, `--only mcp`, or `--only memory` to migrate
|
|
238
387
|
just one category — useful when you only want part of it brought in
|
|
239
388
|
right now. Omit it to migrate all three, exactly as above:
|
|
240
389
|
|
|
@@ -251,7 +400,7 @@ $ trellis migrate --from codex --only instructions
|
|
|
251
400
|
| `conflict` | Canonical already has *different* real content — **left untouched**, resolve by hand. |
|
|
252
401
|
| `skip-symlink` | That agent's own copy is itself a symlink (already shared in from elsewhere) — nothing of that agent's own to import. |
|
|
253
402
|
| `skip-case-broken` | Found as `skill.md` instead of `SKILL.md` — fix the case on the source agent first. |
|
|
254
|
-
| `skip-unsupported` |
|
|
403
|
+
| `skip-unsupported` | The source capability can't be safely represented (including native memory without a supported adapter); nothing was written for it. |
|
|
255
404
|
|
|
256
405
|
Migrate never overwrites a genuine conflict, and never scopes a migrated
|
|
257
406
|
skill (or MCP server) to just the source agent — once in canonical, it's
|
|
@@ -259,6 +408,31 @@ visible to every agent by default (see `sync`, below). If migrate reports
|
|
|
259
408
|
a `conflict`, open the two files/entries it names and decide by hand
|
|
260
409
|
which content should actually be canonical, then re-run.
|
|
261
410
|
|
|
411
|
+
Memory migration is deliberately separate from enabling the shared Memory
|
|
412
|
+
MCP:
|
|
413
|
+
|
|
414
|
+
```text
|
|
415
|
+
trellis onboard --memory-migrate on --memory off
|
|
416
|
+
```
|
|
417
|
+
|
|
418
|
+
The initial native-memory adapter supports Claude Code's exact current-
|
|
419
|
+
workspace Markdown memory directory. Kimi Code and pi session logs are
|
|
420
|
+
reported as unsupported and are not inspected. Imported files receive
|
|
421
|
+
deterministic names and provenance headers under `~/.trellis/memories/`; a
|
|
422
|
+
conflict is left untouched and the onboarding transaction can roll back the
|
|
423
|
+
import.
|
|
424
|
+
|
|
425
|
+
Codex is also supported when its documented local Memory directory contains
|
|
426
|
+
Markdown files:
|
|
427
|
+
|
|
428
|
+
```text
|
|
429
|
+
trellis migrate --from codex --only memory --dry-run
|
|
430
|
+
```
|
|
431
|
+
|
|
432
|
+
Trellis resolves `CODEX_HOME` when set, otherwise `~/.codex`, and reads only
|
|
433
|
+
the Memory directory. `AGENTS.md`, `session_index.jsonl`, sessions,
|
|
434
|
+
credentials, and plugin state are never treated as memory.
|
|
435
|
+
|
|
262
436
|
**MCP servers** (claude-code, kiro, codex — not pi, which has no static
|
|
263
437
|
MCP config to read at all) migrate the same way, into
|
|
264
438
|
`~/.trellis/mcp/servers.yaml`:
|
|
@@ -288,6 +462,81 @@ Two known fidelity limits, named rather than silently worked around:
|
|
|
288
462
|
server was hand-authored with some other shape, it migrates whatever
|
|
289
463
|
is actually there, same as any other field.
|
|
290
464
|
|
|
465
|
+
**A real credential value found in a source agent's config is extracted,
|
|
466
|
+
not just refused.** If a source agent stores a real credential as a
|
|
467
|
+
literal (not a `${VAR}` reference) under a server's `staticEnv`-shaped
|
|
468
|
+
field — the exact real case this project hit: kiro's own `mcp-router`
|
|
469
|
+
entry had its token hardcoded — `migrate` moves the real value to
|
|
470
|
+
`~/.trellis/mcp/servers.local.env` (a sibling of `servers.yaml`,
|
|
471
|
+
automatically `.gitignore`d — never something you need to protect by
|
|
472
|
+
hand), references it from canonical as `${THE_NAME}` instead of the
|
|
473
|
+
literal, and adds the name to `secrets.policy.yaml`'s `allowed_vars`. If
|
|
474
|
+
`secrets.policy.yaml` already has its own `env_file` configured, the
|
|
475
|
+
value goes there instead, respecting your existing setup rather than
|
|
476
|
+
creating a second file.
|
|
477
|
+
|
|
478
|
+
```
|
|
479
|
+
$ trellis migrate --from kiro --only mcp
|
|
480
|
+
migrate --from kiro
|
|
481
|
+
[extract-secret] mcp server "mcp-router" — will extract "MCPR_TOKEN" to
|
|
482
|
+
~/.trellis/mcp/servers.local.env as "TRELLIS_MCP_ROUTER_MCPR_TOKEN",
|
|
483
|
+
referencing it from servers.yaml instead of holding the literal value
|
|
484
|
+
```
|
|
485
|
+
|
|
486
|
+
The name it's extracted under is `TRELLIS_<SERVER>_<KEY>`, never the
|
|
487
|
+
bare source key alone — a project-wide prefix rules out colliding with
|
|
488
|
+
anything already in your own environment, and the server-name segment
|
|
489
|
+
rules out two Trellis-managed servers colliding with each other over
|
|
490
|
+
the same key. A server extracted before this naming scheme existed
|
|
491
|
+
keeps working under its original name — recognized by the value it
|
|
492
|
+
resolves to, not by re-deriving today's name and expecting an exact
|
|
493
|
+
match, so it's never silently re-extracted under a second name.
|
|
494
|
+
|
|
495
|
+
**The source agent's own file is never touched** — kiro's real
|
|
496
|
+
`~/.kiro/settings/mcp.json` keeps its literal value exactly as it was,
|
|
497
|
+
forever; `trellis secrets audit` will keep flagging that file on every
|
|
498
|
+
future run, which is correct and expected — cleaning it up by hand is
|
|
499
|
+
your call, not something this command does for you.
|
|
500
|
+
|
|
501
|
+
**A credential found anywhere *other* than `staticEnv`** (a server's
|
|
502
|
+
`command`, `url`, `args`, or `headers`) **is accepted as ordinary
|
|
503
|
+
literal config, not refused and not extracted.** Neither a natural
|
|
504
|
+
variable name (staticEnv's own dict key provides one; these fields
|
|
505
|
+
don't) nor a proven `${VAR}` resolution mechanism exists for these
|
|
506
|
+
fields across every consumer (pi-bridge, claude-code, codex, kiro) —
|
|
507
|
+
faking a reference would produce a config that looks safe but silently
|
|
508
|
+
fails to connect for at least some of them, worse than the literal it
|
|
509
|
+
replaced. `trellis secrets audit` also scans canonical's own
|
|
510
|
+
`mcp/servers.yaml` for this case (`agent: "canonical"` in its findings),
|
|
511
|
+
so accepting the literal is never silent either.
|
|
512
|
+
|
|
513
|
+
**The `${VAR}` reference `mcp sync` writes into an agent's native config
|
|
514
|
+
only works once that name is actually in the environment that agent's
|
|
515
|
+
own process reads from** — extraction alone doesn't get you there, it
|
|
516
|
+
just gets the real value out of canonical. So `migrate` also ensures
|
|
517
|
+
your shell rc (`~/.zshrc`/`~/.bash_profile`/`~/.profile`, picked from
|
|
518
|
+
`$SHELL`) sources `servers.local.env`, appending one generic,
|
|
519
|
+
idempotent block — never a literal secret line:
|
|
520
|
+
|
|
521
|
+
```
|
|
522
|
+
# >>> trellis mcp secrets >>>
|
|
523
|
+
if [ -f "~/.trellis/mcp/servers.local.env" ]; then
|
|
524
|
+
set -a
|
|
525
|
+
source "~/.trellis/mcp/servers.local.env"
|
|
526
|
+
set +a
|
|
527
|
+
fi
|
|
528
|
+
# <<< trellis mcp secrets <<<
|
|
529
|
+
```
|
|
530
|
+
|
|
531
|
+
Adding another secret later only ever means editing
|
|
532
|
+
`servers.local.env` — the rc file never needs a second edit. This runs
|
|
533
|
+
on every real `migrate` invocation whenever `secrets.policy.yaml` has an
|
|
534
|
+
`env_file`, not just the run that performed the extraction, so a machine
|
|
535
|
+
that already extracted a secret before this existed gets wired the next
|
|
536
|
+
time `migrate` runs at all. A new shell (or restarting the agent
|
|
537
|
+
process) is what actually picks up the newly-exported variable — this
|
|
538
|
+
only ensures the rc file is ready to hand it over.
|
|
539
|
+
|
|
291
540
|
## Starting from nothing
|
|
292
541
|
|
|
293
542
|
Skip migrate. Edit `~/.trellis/agents.md` and add skills under
|
|
@@ -327,6 +576,16 @@ then auto-removes the now-stale symlink on every agent that had it (skills
|
|
|
327
576
|
carry their own ownership marker — the symlink itself — so this
|
|
328
577
|
propagates automatically, unlike MCP servers below).
|
|
329
578
|
|
|
579
|
+
The package-owned Runtime Skill is refreshed explicitly with:
|
|
580
|
+
|
|
581
|
+
```
|
|
582
|
+
trellis skill update-builtin --dry-run
|
|
583
|
+
trellis skill update-builtin
|
|
584
|
+
```
|
|
585
|
+
|
|
586
|
+
The update is backed up and updates the canonical file in place; native Agent
|
|
587
|
+
symlinks and Runtime providers then consume the same refreshed content.
|
|
588
|
+
|
|
330
589
|
```
|
|
331
590
|
$ trellis mcp list
|
|
332
591
|
tanka (http) — codex, pi
|
|
@@ -342,16 +601,46 @@ removed MCP server "local-server" from canonical source.
|
|
|
342
601
|
|
|
343
602
|
`mcp add` takes `--transport stdio|http|sse`; stdio requires `--command`
|
|
344
603
|
(plus optional `--args a,b`, `--env NAME,...`, `--static-env k=v,...`),
|
|
345
|
-
http/sse require `--url` (plus optional `--headers k=v,...`, values
|
|
604
|
+
http/sse require `--url` (plus optional `--auth oauth`, `--headers k=v,...`, values
|
|
346
605
|
expected as `${VAR}` references, never literal secrets). Both accept
|
|
347
606
|
`--agents id,...` (scope) and `--enabled true|false`. Same no-overwrite
|
|
348
607
|
conflict posture as `skill add` — there is no `--force`.
|
|
349
608
|
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
609
|
+
For a standard JSON export with a top-level `mcpServers` object, use the
|
|
610
|
+
credential-aware importer instead of repeating `mcp add` by hand:
|
|
611
|
+
|
|
612
|
+
```
|
|
613
|
+
trellis mcp import ~/Desktop/mcp-servers.json --dry-run
|
|
614
|
+
trellis mcp import ~/Desktop/mcp-servers.json
|
|
615
|
+
```
|
|
616
|
+
|
|
617
|
+
The source file is read-only. The importer de-duplicates semantically
|
|
618
|
+
identical servers, preserves existing canonical definitions, reports same-name
|
|
619
|
+
conflicts, and skips unavailable absolute paths. A recognized `mcp-remote`
|
|
620
|
+
Basic Authorization export is converted to native HTTP MCP; other credentials
|
|
621
|
+
embedded in command arguments, URLs, or headers are rejected. Credential-like values in an exported
|
|
622
|
+
`env` map are moved to the ignored local file
|
|
623
|
+
`~/.trellis/mcp/servers.local.env`; canonical stores only a prefixed variable
|
|
624
|
+
reference through `env_aliases`:
|
|
625
|
+
|
|
626
|
+
```yaml
|
|
627
|
+
env_aliases:
|
|
628
|
+
SUPABASE_ACCESS_TOKEN: TRELLIS_SUPABASE_DB_SUPABASE_ACCESS_TOKEN
|
|
629
|
+
```
|
|
630
|
+
|
|
631
|
+
The actual value is never printed in the plan, JSON report, canonical YAML, or
|
|
632
|
+
shell arguments. Re-importing is idempotent; an existing local secret with a
|
|
633
|
+
different value is a conflict and is never overwritten. OAuth sessions are not
|
|
634
|
+
imported — authorize the resulting remote MCP explicitly with
|
|
635
|
+
`trellis mcp auth <name>`.
|
|
636
|
+
|
|
637
|
+
Use `trellis mcp set <name> --auth oauth` to keep a known OAuth MCP direct
|
|
638
|
+
when its Agent uses gateway mode; use `--auth none` to clear the marker.
|
|
639
|
+
Trellis does not infer OAuth from a URL or an authentication failure.
|
|
640
|
+
|
|
641
|
+
`mcp remove` changes canonical state only. The next `trellis mcp sync` removes
|
|
642
|
+
the old native entry when the ownership ledger proves Trellis still owns it;
|
|
643
|
+
hand-edited native entries are preserved and reported as conflicts.
|
|
355
644
|
|
|
356
645
|
`mcp list` never resolves or prints a secret value: `env` names are shown
|
|
357
646
|
as bare names (the actual value is never read from your shell), and
|
|
@@ -410,10 +699,9 @@ known-host-injected collision avoidance, hub mode, and gateway mode
|
|
|
410
699
|
$ trellis mcp sync
|
|
411
700
|
```
|
|
412
701
|
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
each agent in the meantime.
|
|
702
|
+
`mcp sync` also removes an entry deleted from canonical when the ownership
|
|
703
|
+
ledger proves the current native definition is exactly what Trellis last
|
|
704
|
+
wrote. Hand-edited entries are left untouched and reported as conflicts.
|
|
417
705
|
|
|
418
706
|
Every native-config file this rewrites in place is snapshotted first,
|
|
419
707
|
automatically — see
|
|
@@ -472,8 +760,14 @@ agent spawns it like any other stdio MCP server; it connects out to your
|
|
|
472
760
|
servers, and exits when the session ends. There is nothing to start,
|
|
473
761
|
stop, or monitor.
|
|
474
762
|
|
|
475
|
-
|
|
476
|
-
`
|
|
763
|
+
Long unambiguous upstream tools stay compact. Generic short names such as
|
|
764
|
+
`search` receive source context even when unique; if both GitHub and GitLab
|
|
765
|
+
expose `search`, they become `github__search` and `gitlab__search`. A tool that
|
|
766
|
+
already contains its source prefix is not repeated. Agent-facing names are
|
|
767
|
+
normalized to `[A-Za-z0-9_-]` and
|
|
768
|
+
bounded to 64 characters; long names receive a deterministic hash suffix.
|
|
769
|
+
Extremely rare normalized-name collisions receive a deterministic suffix
|
|
770
|
+
rather than being dropped, while calls still route to the original MCP name.
|
|
477
771
|
|
|
478
772
|
Add `agents: [claude-code, codex]` under `gateway:` to narrow it, leaving
|
|
479
773
|
the rest in direct mode. Gateway mode and `hub` are independent; both can
|
|
@@ -482,12 +776,14 @@ be set, and gateway wins for any agent it covers.
|
|
|
482
776
|
Two things stop being problems in gateway mode. Codex can normally only
|
|
483
777
|
express a single `Authorization: Bearer ${VAR}` header, so a server
|
|
484
778
|
needing more than one was refused for Codex — in gateway mode Codex never
|
|
485
|
-
sees any server's headers, so it just works.
|
|
486
|
-
|
|
779
|
+
sees any ordinary server's headers, so it just works. OAuth-marked servers
|
|
780
|
+
stay direct while ordinary remote servers remain shared through the gateway.
|
|
487
781
|
|
|
488
782
|
### `trellis mcp auth <server-name>`
|
|
489
783
|
|
|
490
|
-
For a remote (`http`/`sse`) server
|
|
784
|
+
For a remote (`http`/`sse`) server marked `auth: oauth`, native Agents should
|
|
785
|
+
use their own login command. Pi's direct bridge path can be authorized once
|
|
786
|
+
through Trellis:
|
|
491
787
|
|
|
492
788
|
```
|
|
493
789
|
$ trellis mcp auth notion-remote
|
|
@@ -499,15 +795,22 @@ This opens your browser, completes the flow, and stores the result 0600
|
|
|
499
795
|
under `~/.trellis/mcp/oauth/` — never in `servers.yaml`, so canonical
|
|
500
796
|
stays safe to read, diff, and commit.
|
|
501
797
|
|
|
502
|
-
Run it once per server
|
|
503
|
-
|
|
504
|
-
because it is spawned by an agent
|
|
798
|
+
Run it once per server when Pi's direct bridge owns the OAuth connection.
|
|
799
|
+
After that the bridge refreshes the token silently whenever it expires; it
|
|
800
|
+
never opens a browser and never prompts, because it is spawned by an agent
|
|
801
|
+
with no terminal attached. Re-running
|
|
505
802
|
this command when the stored token is still valid does nothing (`--force`
|
|
506
803
|
overrides); when it has expired but is renewable, it refreshes without a
|
|
507
804
|
browser.
|
|
508
805
|
|
|
509
|
-
If a server has no stored credential, the
|
|
510
|
-
and keeps serving every other — it does not fail to start.
|
|
806
|
+
If a Pi direct OAuth server has no stored credential, the bridge skips that
|
|
807
|
+
one server and keeps serving every other — it does not fail to start. Native
|
|
808
|
+
Agents report the same direct entry as requiring their own authorization.
|
|
809
|
+
|
|
810
|
+
An Agent can call the read-only `trellis.mcp.status` Runtime tool to explain
|
|
811
|
+
this partial state to the user. It reports unavailable or authorization-
|
|
812
|
+
required servers and gives the next safe action, such as `trellis mcp auth
|
|
813
|
+
figma`, without exposing tokens or opening a browser from the Agent process.
|
|
511
814
|
|
|
512
815
|
This command only applies to `http`/`sse` servers. stdio servers get
|
|
513
816
|
their credentials from `env`/`env_aliases` as described above; running
|
|
@@ -515,6 +818,17 @@ their credentials from `env`/`env_aliases` as described above; running
|
|
|
515
818
|
|
|
516
819
|
## `trellis memory sync`
|
|
517
820
|
|
|
821
|
+
Canonical memories can also be consumed directly through the Trellis MCP
|
|
822
|
+
Runtime when an agent's runtime delivery is `mcp` or `both`. Runtime exposes
|
|
823
|
+
read-only `trellis.memory.search` and `trellis.memory.read` tools plus
|
|
824
|
+
`trellis://memories/<name>.md` resources. Results are filtered through the
|
|
825
|
+
memory's `scope.yaml` entry and the managed-agent boundary on every request.
|
|
826
|
+
|
|
827
|
+
This Runtime path reads `~/.trellis/memories/*.md` directly. It does not need
|
|
828
|
+
the separate `memory` MCP server below, and it does not expose write/delete
|
|
829
|
+
tools. `memory sync` remains the bridge from canonical Markdown into the
|
|
830
|
+
mutable shared graph used by `@modelcontextprotocol/server-memory`.
|
|
831
|
+
|
|
518
832
|
Ingests `~/.trellis/memories/*.md` into the actual on-disk file
|
|
519
833
|
`@modelcontextprotocol/server-memory` reads at its own startup — closing
|
|
520
834
|
the gap between "memory entries exist in canonical" and "the running
|
|
@@ -576,6 +890,24 @@ entities' names would slug to the same filename. Not wired into
|
|
|
576
890
|
deliberate, occasional action you run, the same posture `migrate` already
|
|
577
891
|
has.
|
|
578
892
|
|
|
893
|
+
For a shared Kimi Code + pi setup, enable the backend through onboarding
|
|
894
|
+
instead of editing either Agent's config by hand:
|
|
895
|
+
|
|
896
|
+
```text
|
|
897
|
+
trellis onboard --memory on --mcp-mode gateway --manage pi,kimi-code
|
|
898
|
+
```
|
|
899
|
+
|
|
900
|
+
This writes one canonical `memory` server, syncs the Gateway route to both
|
|
901
|
+
Agents, and runs `memory sync` in the same transaction. Runtime status reports
|
|
902
|
+
`backendConfigured`, `graphReady`, `canonicalCount`, write authority, and the
|
|
903
|
+
managed Agents receiving the shared route. It distinguishes an unconfigured
|
|
904
|
+
backend from an empty but writable graph.
|
|
905
|
+
|
|
906
|
+
Agent-created graph content is external Memory context. It is not imported
|
|
907
|
+
back into canonical automatically; run `trellis memory extract` explicitly
|
|
908
|
+
when you want durable, reviewable Markdown. Native/private Agent memory
|
|
909
|
+
stores are not scraped or guessed.
|
|
910
|
+
|
|
579
911
|
**Note:** this is unrelated to any project-level "auto memory" feature an
|
|
580
912
|
agent may have of its own (e.g. Claude Code's own per-project memory
|
|
581
913
|
files) — those are a different, agent-specific mechanism entirely, not
|
|
@@ -607,7 +939,7 @@ periodically regardless.
|
|
|
607
939
|
$ trellis doctor
|
|
608
940
|
```
|
|
609
941
|
|
|
610
|
-
Read-only. Scans all
|
|
942
|
+
Read-only. Scans all five agents' current state and reports drift —
|
|
611
943
|
mismatched skill content across agents, wrong-case skill files, and (with
|
|
612
944
|
`--probe-mcp`) whether each configured MCP server actually handshakes.
|
|
613
945
|
Safe to run any time; nothing here writes anything.
|
|
@@ -616,6 +948,42 @@ Safe to run any time; nothing here writes anything.
|
|
|
616
948
|
stdio MCP server (some reaching real external services) — not something a
|
|
617
949
|
"just check my config" command should do by default.
|
|
618
950
|
|
|
951
|
+
## 在 Linux sandbox 中验证真实 agent
|
|
952
|
+
|
|
953
|
+
Trellis 提供一个独立的 agent image,用于安装真实的 Codex、Claude Code、
|
|
954
|
+
Kiro CLI 和 pi,而不是只使用 fake CLI。它使用 `runtime-home` 作为只读
|
|
955
|
+
fixture,并把内容复制到容器内的隔离 `$HOME`;不会挂载宿主机的 agent
|
|
956
|
+
目录或登录态:
|
|
957
|
+
|
|
958
|
+
```
|
|
959
|
+
scripts/agent-sandbox.sh
|
|
960
|
+
```
|
|
961
|
+
|
|
962
|
+
未登录时,Codex 和 Claude Code 可以验证自己是否识别 Trellis 写入的
|
|
963
|
+
`trellis` MCP entry;Kiro CLI 会在 `mcp list` 前要求登录,这
|
|
964
|
+
是 Kiro 的真实授权边界。
|
|
965
|
+
|
|
966
|
+
如需实际授权,使用单独的 Docker volume 保存 sandbox 登录态:
|
|
967
|
+
|
|
968
|
+
```
|
|
969
|
+
scripts/agent-sandbox.sh --login codex
|
|
970
|
+
scripts/agent-sandbox.sh --login claude
|
|
971
|
+
scripts/agent-sandbox.sh --login kiro
|
|
972
|
+
```
|
|
973
|
+
|
|
974
|
+
登录过程在终端中显示设备授权或浏览器流程。登录完成后,可以检查:
|
|
975
|
+
|
|
976
|
+
```
|
|
977
|
+
scripts/agent-sandbox.sh --status codex
|
|
978
|
+
scripts/agent-sandbox.sh --status claude
|
|
979
|
+
scripts/agent-sandbox.sh --status kiro
|
|
980
|
+
```
|
|
981
|
+
|
|
982
|
+
默认 volume 名称为 `trellis-agent-auth-home`,可通过
|
|
983
|
+
`TRELLIS_AGENT_AUTH_VOLUME` 覆盖。它只保存在 OrbStack/Docker 中,不进
|
|
984
|
+
Git,也不会自动读取或删除宿主机凭据。清理时请明确执行
|
|
985
|
+
`docker volume rm <volume-name>`。
|
|
986
|
+
|
|
619
987
|
## `trellis rollback` — undoing a `sync`/`mcp sync`/`onboard` run
|
|
620
988
|
|
|
621
989
|
Every real write those three commands perform is recorded, before it
|