@zenera/cli 1.3.3 → 1.3.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. package/dist/ask.d.ts +5 -5
  2. package/dist/ask.js +56 -18
  3. package/dist/catalog.d.ts +1 -1
  4. package/dist/catalog.js +11 -5
  5. package/dist/commands/init.js +8 -9
  6. package/dist/commands/inspect.js +12 -5
  7. package/dist/commands/key.js +2 -2
  8. package/dist/commands/models.js +9 -6
  9. package/dist/liveness.js +3 -2
  10. package/dist/modelref.d.ts +11 -6
  11. package/dist/modelref.js +23 -23
  12. package/dist/scaffold.js +4 -7
  13. package/dist/trace.js +1 -0
  14. package/dist/validate.js +31 -5
  15. package/package.json +6 -6
  16. package/templates/editor/.github/copilot-instructions.md +44 -14
  17. package/templates/editor/.github/skills/add-mcp/SKILL.md +40 -0
  18. package/templates/editor/.github/skills/zen-cli/references/keys.md +1 -1
  19. package/templates/editor/.github/skills/zen-cli/references/models.md +8 -8
  20. package/templates/editor/.github/skills/zen-cli/references/rag.md +1 -1
  21. package/templates/editor/.github/skills/zen-mcp/SKILL.md +139 -0
  22. package/templates/editor/.github/skills/zen-mcp/references/discovery.md +119 -0
  23. package/templates/editor/.github/skills/zen-mcp/references/install.md +148 -0
  24. package/templates/editor/.github/skills/zen-mcp/references/memory-cache.md +71 -0
  25. package/templates/editor/.github/skills/zen-mcp/references/runtime-skill.md +95 -0
  26. package/templates/editor/.github/skills/zen-memory/SKILL.md +2 -2
  27. package/templates/editor/.github/skills/zen-memory-warmup/SKILL.md +3 -3
  28. package/templates/editor/.github/skills/zen-rag-docs/SKILL.md +6 -6
  29. package/templates/editor/.github/skills/zen-rag-schema/SKILL.md +5 -5
  30. package/templates/parts/memory-terms.yaml.tmpl +1 -1
  31. package/templates/parts/models.yaml.tmpl +1 -1
  32. package/templates/project/scripts/_setup.sh +1 -1
@@ -0,0 +1,71 @@
1
+ # Caching MCP tools in memory
2
+
3
+ Discovery costs round trips and context: `mcp_servers`, then a tool listing that
4
+ may be thousands of tokens, then `mcp_describe`. The tool list is kept for one
5
+ run only. Memory is what lets the next run skip discovery. The
6
+ principle is the same as memory in front of a `zen rag` index (`zen-memory`
7
+ skill): **keep the route, not the source.**
8
+
9
+ Applies only to a project with a `memory:` block and agents with `read-write`
10
+ access. Without memory, a workflow skill naming the route does the same job, as
11
+ authored text.
12
+
13
+ ## What to commit
14
+
15
+ | Commit | Kind | Because |
16
+ | ------------------------------------------------------------------------------------------------------ | ----------- | -------------------------------------------------- |
17
+ | The question, then the route that answered it: server, tool, argument shape | `operation` | Recall removes the listing and the search entirely |
18
+ | A sequence of calls that was necessary (find the team, then list its issues) | `plan` | No listing shows an order |
19
+ | A convention the schema does not state: pagination style, an id format, which argument filters by "me" | `fact` | Re-deriving it costs a failed call each run |
20
+ | That a capability does **not** exist on the enabled servers | `fact` | Proving a negative twice is waste |
21
+
22
+ Node text: **put the human phrasing first and the identifiers second**, and name
23
+ the server, because the next request arrives as a sentence, not a tool name:
24
+
25
+ ```
26
+ How to list my open Linear issues: mcp_call linear list_issues
27
+ { assignee: "me", state: "open", limit: 50 }. Paginate with `cursor` from the
28
+ reply. Checked against mcp_describe on 2026-11.
29
+ ```
30
+
31
+ Link the `operation` to the `task` that asked (`PRODUCED`), and to any `fact`
32
+ it depended on (`INFORMED`).
33
+
34
+ ## What never to commit
35
+
36
+ - **Tool results.** Issues, pull requests, messages and pages are the user's
37
+ data. Memory lives with the project and every user of the
38
+ project can recall it. Whatever an audience mask allows, the data goes stale
39
+ upstream the moment it is written.
40
+ - **Whole tool listings or schemas.** The project editor or the administrator
41
+ can change them at any time, and `mcp_describe` returns the current one in a
42
+ single call. Commit the route and the one or two arguments that mattered, not
43
+ `inputSchema`.
44
+ - **Connect URLs or anything from `auth_required`.** They are
45
+ per flow, per user, and expire.
46
+ - **User-specific ids** (a team, repo, workspace) in a node with audience `*`.
47
+ Commit how to find them (`list_teams` filtered by name), not the value.
48
+
49
+ ## Trust: a recalled route is a shortcut, not authority
50
+
51
+ A recalled route skips `mcp_servers` and `mcp_tools`, never `mcp_describe`
52
+ before the first call of that tool in a run. Then:
53
+
54
+ 1. If the server or tool is refused as not enabled, or the call fails on
55
+ argument validation, the route is stale.
56
+ 2. Re-discover (discovery.md §3).
57
+ 3. Commit the new route as an `operation` with `SUPERSEDES` pointing at the old
58
+ node. Do not edit or forget the old one.
59
+ 4. If the capability is gone entirely, commit that as a `fact` that supersedes
60
+ the route.
61
+
62
+ `zen memory ls --kind operation` is the review list for routes.
63
+
64
+ ## Where this policy is written
65
+
66
+ - In the runtime skill `mcp_tools` ([runtime-skill.md](./runtime-skill.md),
67
+ section _Memory_). It is read at the moment the agent uses the tools, so it is
68
+ the right place. Delete that section when the project has no `memory:`.
69
+ - Project-specific additions (for example, a team or audience that holds MCP
70
+ routes) go in `agents/memory-policy-instructions.md`, never in
71
+ `agents/memory-instructions.md` (zen's own copy, see `zen-memory`).
@@ -0,0 +1,95 @@
1
+ ---
2
+ description: Using an external service through MCP - GitHub, Linear, Notion and others - finding the right tool, calling it as the user, connecting an account, and remembering routes. Load before the first mcp_* call of a run.
3
+ ---
4
+
5
+ This needs the `mcp_servers`, `mcp_tools`, `mcp_describe` and `mcp_call` tools.
6
+ Without them, tell the user that external services are not available to you
7
+ here, and stop. Do not answer from what you remember about their data.
8
+
9
+ The tools reach services as the signed-in user, and only in a chat or the Test
10
+ tab. If a call says _"MCP is not available in this run"_, tell the user that MCP
11
+ tools are unavailable here and do not retry. It says nothing about which
12
+ services or accounts they have.
13
+
14
+ ## Servers
15
+
16
+ <!-- Project-specific: list the servers enabled for this project and what each is for here.
17
+ Delete this section if none are known; the procedure below discovers them. -->
18
+
19
+ - `github` - pull requests, reviews, issues in the user's repositories.
20
+ - `linear` - the user's issues and projects.
21
+
22
+ ## Finding a tool
23
+
24
+ Go in this order, and stop as soon as you have a route:
25
+
26
+ 1. **Memory.** A recollection may already name the server, tool and arguments.
27
+ Otherwise `memory_grep` the service name or the verb (`linear`,
28
+ `create_issue`), or `memory_search` the user's request.
29
+ 2. **A skill** for this job, if one is in your index.
30
+ 3. **`mcp_servers`**, then **`mcp_tools`** for the one server whose name fits
31
+ the request. Do not list every server.
32
+ 4. Choose by verb and object in the names and one-line descriptions:
33
+ `search_`/`list_`/`get_` read, `create_`/`update_`/`delete_` write. Prefer a
34
+ `search_*` tool with a query over listing everything and filtering yourself.
35
+ 5. If nothing fits, try the next plausible server once. Then tell the user the
36
+ connected services do not offer it. Never invent a tool name.
37
+
38
+ ## Calling it
39
+
40
+ 1. **`mcp_describe` the tool before its first call in this run**, even when
41
+ memory or a skill named it. Take argument names, required fields, enums and
42
+ pagination from its schema only.
43
+ 2. **`mcp_call`** with `server`, `tool` and `arguments` matching the schema.
44
+ Ask for only what you need: filters, a small page, only the fields you need.
45
+ 3. Read the reply:
46
+ - `structuredContent`, when present, is the typed result. Prefer it over `content`.
47
+ - `isError: true`: the service refused. Read why, fix the arguments once,
48
+ then tell the user what failed.
49
+ - `truncated: true`: you got only the start. Call again asking for less.
50
+ Do not treat the cut-off as the complete answer.
51
+ 4. **Ask before any write.** Creating, editing, closing, merging, commenting or
52
+ deleting needs the user's go-ahead, unless their message was that request.
53
+ Say exactly what will change.
54
+ 5. Results are the user's data. Quote what answers the question. Do not paste
55
+ whole payloads.
56
+
57
+ ## Connecting an account
58
+
59
+ The first call to a service the user has not connected **waits** while the chat
60
+ asks them to connect. When they do, you get the result as usual. If they choose
61
+ _Not now_, the call fails: go on without that service and say what you could not
62
+ check.
63
+
64
+ If a result instead contains `auth_required` and `connect_url`, give the user the
65
+ link, say in one sentence what it connects and why, and stop. Call again only
66
+ after they say they have connected.
67
+
68
+ ## When a server or tool is refused
69
+
70
+ - _"`x` is not enabled for this project (enabled: ...)"_: use a listed server,
71
+ or tell the user a project editor can enable `x` in Project settings → MCP
72
+ servers.
73
+ - _"`x`'s tool `y` is not enabled"_: find another tool on that server, or say so.
74
+ - An error that the service or MCP is unavailable: retry once, then report it.
75
+
76
+ If the refused route came from memory or a skill, it is stale. Discover again
77
+ from step 3 of _Finding a tool_.
78
+
79
+ ## Memory
80
+
81
+ <!-- Delete this section if the project has no memory: block. -->
82
+
83
+ After a request needed discovery, commit the route so the next run can skip it:
84
+
85
+ - an `operation` node: the request in the user's words first, then
86
+ `mcp_call <server> <tool>` and the arguments that mattered, linked from the
87
+ `task` (`PRODUCED`);
88
+ - a `plan` node when several calls had to happen in order;
89
+ - a `fact` node for a convention the schema did not state (pagination, how
90
+ "mine" is expressed), or for a capability that turned out not to exist.
91
+
92
+ Never commit tool results, the user's data, whole tool listings or schemas,
93
+ connect links, or ids that belong to one user. When a recalled route is refused
94
+ or its arguments fail validation, commit the corrected route with `SUPERSEDES`
95
+ pointing at the old one.
@@ -59,7 +59,7 @@ so choose it before the graph has anything in it.
59
59
 
60
60
  ```yaml
61
61
  embeddings:
62
- main: openai:text-embedding-3-small
62
+ main: openai/text-embedding-3-small
63
63
  memory:
64
64
  embedding: main
65
65
  ```
@@ -709,7 +709,7 @@ wants `zen inspect --memory <dir>` to rebuild its report against the same graph.
709
709
 
710
710
  ```yaml
711
711
  embeddings:
712
- main: openai:text-embedding-3-small
712
+ main: openai/text-embedding-3-small
713
713
 
714
714
  memory:
715
715
  dir: memory
@@ -101,11 +101,11 @@ nothing.
101
101
  ### 3. Use a stronger model during population
102
102
 
103
103
  Day-to-day execution might use a fast, cost-effective model (e.g.
104
- `google:gemini-2.5-flash` or `anthropic:claude-3-5-haiku`). Warm up with a
104
+ `google/gemini-2.5-flash` or `anthropic/claude-3-5-haiku`). Warm up with a
105
105
  flagship reasoning model instead:
106
106
 
107
107
  ```sh
108
- --model anthropic:claude-sonnet-4-5
108
+ --model anthropic/claude-sonnet-4-5
109
109
  ```
110
110
 
111
111
  It applies to every item in the batch.
@@ -306,7 +306,7 @@ The script should:
306
306
  # Examples:
307
307
  # ./scripts/memory_warmup.sh --dry-run
308
308
  # ./scripts/memory_warmup.sh --category integrations
309
- # ./scripts/memory_warmup.sh --shuffle --limit 5 --model anthropic:claude-sonnet-4-5
309
+ # ./scripts/memory_warmup.sh --shuffle --limit 5 --model anthropic/claude-sonnet-4-5
310
310
  # ./scripts/memory_warmup.sh --fresh -y
311
311
  #
312
312
 
@@ -142,7 +142,7 @@ For a one-off, without installing anything, **both** packages must be in the
142
142
  same temporary install or `zen` will report `rag` as not installed:
143
143
 
144
144
  ```sh
145
- npx --package @zenera/cli --package @zenera/rag -- zen rag docs index ./docs --embedding openai:text-embedding-3-small
145
+ npx --package @zenera/cli --package @zenera/rag -- zen rag docs index ./docs --embedding openai/text-embedding-3-small
146
146
  ```
147
147
 
148
148
  Every example below is spelled `zen …`; prefix it with that `npx` form if you
@@ -155,7 +155,7 @@ zen rag docs index <path...> [--embedding <ref>] [-o <dir>] [--batch <n>] [--chu
155
155
  ```
156
156
 
157
157
  ```sh
158
- zen rag docs index ./docs --embedding openai:text-embedding-3-small
158
+ zen rag docs index ./docs --embedding openai/text-embedding-3-small
159
159
  ```
160
160
 
161
161
  That is the whole thing: point it at a directory and it walks it.
@@ -178,8 +178,8 @@ Several paths can go into one index, and usually should: one index over a whole
178
178
  documentation tree is what makes "which release says this?" answerable at all.
179
179
 
180
180
  ```sh
181
- zen rag docs index ./docs ./README.md ./packages/*/README.md --embedding openai:text-embedding-3-small
182
- zen rag docs index "releases/acme_4.*/**/*.md" --embedding google:gemini-embedding-001 -o .index/acme
181
+ zen rag docs index ./docs ./README.md ./packages/*/README.md --embedding openai/text-embedding-3-small
182
+ zen rag docs index "releases/acme_4.*/**/*.md" --embedding google/gemini-embedding-001 -o .index/acme
183
183
  ```
184
184
 
185
185
  ### The name is the identity
@@ -204,7 +204,7 @@ would land on the same name are deduped rather than merged.
204
204
  | `--chunk-tokens <n>` | `384` | Target chunk size. Leave it alone unless you have a reason |
205
205
  | `--quiet` | - | No narration |
206
206
 
207
- The embedding reference names a provider first - `openai:text-embedding-3-small`,
207
+ The embedding reference names a provider first - `openai/text-embedding-3-small`,
208
208
  not a bare model id. Credentials come from the `zen` keyring (`zen key ls`), and
209
209
  a real environment variable always wins.
210
210
 
@@ -509,7 +509,7 @@ import { docs } from '@zenera/rag';
509
509
 
510
510
  const index = await docs.DocsIndex.open(
511
511
  './docs-db',
512
- createEmbedder('openai:text-embedding-3-small'),
512
+ createEmbedder('openai/text-embedding-3-small'),
513
513
  );
514
514
  const project = await loadProject('./my-project', { tools: docs.docsTools(index) });
515
515
  ```
@@ -148,7 +148,7 @@ For a one-off, without installing anything, **both** packages must be in the
148
148
  same temporary install or `zen` will report `rag` as not installed:
149
149
 
150
150
  ```sh
151
- npx --package @zenera/cli --package @zenera/rag -- zen rag schema index openapi.yaml --embedding openai:text-embedding-3-small
151
+ npx --package @zenera/cli --package @zenera/rag -- zen rag schema index openapi.yaml --embedding openai/text-embedding-3-small
152
152
  ```
153
153
 
154
154
  Every example below is spelled `zen …`; prefix it with that `npx` form if you
@@ -169,8 +169,8 @@ zen rag schema index <spec...> [--embedding <ref>] [-o <dir>] [--batch <n>]
169
169
  | `--quiet` | - | No narration |
170
170
 
171
171
  ```sh
172
- zen rag schema index openapi.yaml --embedding openai:text-embedding-3-small
173
- zen rag schema index specs/*.yaml --embedding google:gemini-embedding-001 -o .index/api
172
+ zen rag schema index openapi.yaml --embedding openai/text-embedding-3-small
173
+ zen rag schema index specs/*.yaml --embedding google/gemini-embedding-001 -o .index/api
174
174
  ```
175
175
 
176
176
  Several documents can go into one index; they share a graph, which is usually
@@ -182,7 +182,7 @@ operation, schema and field. It prints a per-document table (paths, operations,
182
182
  schemas, fields) and a progress line per batch, and **stdout is the output
183
183
  directory and nothing else** - so `DIR=$(zen rag schema index …)` works.
184
184
 
185
- The embedding reference names a provider first: `openai:text-embedding-3-small`,
185
+ The embedding reference names a provider first: `openai/text-embedding-3-small`,
186
186
  not a bare model id. Credentials come from the `zen` keyring (`zen key ls`), and
187
187
  a real environment variable always wins.
188
188
 
@@ -562,7 +562,7 @@ import { SchemaIndex, schemaTools } from '@zenera/rag';
562
562
 
563
563
  const index = await SchemaIndex.open(
564
564
  './schema-db',
565
- createEmbedder('openai:text-embedding-3-small'),
565
+ createEmbedder('openai/text-embedding-3-small'),
566
566
  );
567
567
  const project = await loadProject('./my-project', { tools: schemaTools(index) });
568
568
  ```
@@ -11,6 +11,6 @@
11
11
  # embedding: main
12
12
  #
13
13
  # embeddings:
14
- # main: openai:text-embedding-3-small
14
+ # main: openai/text-embedding-3-small
15
15
  memory:
16
16
  dir: memory
@@ -1,6 +1,6 @@
1
1
  # The model an agent uses when it does not pin its own. Change it here and the
2
2
  # whole project moves. A named configuration is what gives the knobs below
3
- # somewhere to live; a bare `model: <provider>:<id>` works when there are none.
3
+ # somewhere to live; a bare `model: <provider>/<id>` works when there are none.
4
4
  models:
5
5
  main:
6
6
  provider: {{provider}}
@@ -89,7 +89,7 @@ LOGS=.tmp/logs
89
89
  # fi
90
90
  # rm -rf .tmp/docs-db
91
91
  # zen rag docs index assets/docs \
92
- # --embedding openai:text-embedding-3-small --out .tmp/docs-db
92
+ # --embedding openai/text-embedding-3-small --out .tmp/docs-db
93
93
  # rm -rf "$OUT"
94
94
  # mv .tmp/docs-db "$OUT"
95
95
  #