@zenera/cli 1.3.4 → 1.3.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (23) hide show
  1. package/dist/scaffold.js +12 -1
  2. package/dist/validate.js +76 -4
  3. package/package.json +6 -6
  4. package/templates/editor/.github/copilot-instructions.md +18 -8
  5. package/templates/editor/.github/skills/add-mcp/SKILL.md +22 -19
  6. package/templates/editor/.github/skills/finetune/SKILL.md +2 -1
  7. package/templates/editor/.github/skills/zen-analyze-run/SKILL.md +4 -2
  8. package/templates/editor/.github/skills/zen-cli/references/projects.md +2 -0
  9. package/templates/editor/.github/skills/zen-finetune/SKILL.md +2 -1
  10. package/templates/editor/.github/skills/zen-finetune-apply/SKILL.md +3 -2
  11. package/templates/editor/.github/skills/zen-inspect-ask/SKILL.md +2 -1
  12. package/templates/editor/.github/skills/zen-instructions/SKILL.md +50 -37
  13. package/templates/editor/.github/skills/zen-mcp/SKILL.md +47 -44
  14. package/templates/editor/.github/skills/zen-mcp/references/discovery.md +3 -2
  15. package/templates/editor/.github/skills/zen-mcp/references/install.md +43 -32
  16. package/templates/editor/.github/skills/zen-mcp/references/memory-cache.md +6 -4
  17. package/templates/editor/.github/skills/zen-review/SKILL.md +5 -3
  18. package/templates/editor/.github/skills/zen-review/scripts/check-paths.sh +3 -2
  19. package/templates/editor/.github/skills/zen-spec-sync/SKILL.md +2 -1
  20. package/templates/editor/.github/skills/zen-spec-sync/scripts/snapshot.sh +1 -1
  21. package/templates/project/agents/mcp-instructions.md +66 -0
  22. package/templates/project/agents/mcp-memory-instructions.md +28 -0
  23. package/templates/editor/.github/skills/zen-mcp/references/runtime-skill.md +0 -95
package/dist/scaffold.js CHANGED
@@ -48,6 +48,10 @@ const MEMORY_RULES = join('agents', 'memory-instructions.md');
48
48
  const TOOL_RULES = join('agents', 'tools-instructions.md');
49
49
  /** How forking behaves: the same again, reaching only agents that declare `fork:`. */
50
50
  const FORK_RULES = join('agents', 'fork-instructions.md');
51
+ /** How the `mcp` tools are used: reaching only agents granted that group. */
52
+ const MCP_RULES = join('agents', 'mcp-instructions.md');
53
+ /** What an MCP agent with a store commits about its calls: routes, never results. */
54
+ const MCP_MEMORY_RULES = join('agents', 'mcp-memory-instructions.md');
51
55
  /**
52
56
  * The project files that are ours rather than the project's.
53
57
  *
@@ -60,7 +64,14 @@ const FORK_RULES = join('agents', 'fork-instructions.md');
60
64
  * place: project policy on any of those subjects goes in a topic file of its
61
65
  * own beside them.
62
66
  */
63
- export const SHARED_RULES = [FILE_RULES, FORK_RULES, MEMORY_RULES, TOOL_RULES];
67
+ export const SHARED_RULES = [
68
+ FILE_RULES,
69
+ FORK_RULES,
70
+ MCP_RULES,
71
+ MCP_MEMORY_RULES,
72
+ MEMORY_RULES,
73
+ TOOL_RULES,
74
+ ];
64
75
  /**
65
76
  * This `zen`'s own version, which the scaffold pins the sandbox's tools to.
66
77
  * The publishable packages move in lockstep, so one number covers them all.
package/dist/validate.js CHANGED
@@ -19,8 +19,14 @@ const FILE_RULES = 'agents/files-instructions.md';
19
19
  const MEMORY_RULES = 'agents/memory-instructions.md';
20
20
  /** The only place forking is explained to a model; the same holds. */
21
21
  const FORK_RULES = 'agents/fork-instructions.md';
22
+ /** How a run finds and calls an external service through the `mcp` tools. */
23
+ const MCP_RULES = 'agents/mcp-instructions.md';
24
+ /** What an MCP agent with a memory store may commit about those calls. */
25
+ const MCP_MEMORY_RULES = 'agents/mcp-memory-instructions.md';
26
+ /** The tool group Zenera's MCP plugin registers. */
27
+ const MCP_GROUP = 'mcp';
22
28
  /** The conditioned documents `zen` ships, which land whether or not they apply. */
23
- const OURS = new Set([FILE_RULES, MEMORY_RULES, FORK_RULES]);
29
+ const OURS = new Set([FILE_RULES, MEMORY_RULES, FORK_RULES, MCP_RULES, MCP_MEMORY_RULES]);
24
30
  const PROMPTS_DIR = 'agents/prompts';
25
31
  const SKILLS_DIR = 'agents/skills';
26
32
  const SKILL_FILE = 'SKILL.md';
@@ -102,6 +108,42 @@ const CAPABILITIES = {
102
108
  workspace: (spec) => hasFileTools(spec),
103
109
  'workspace-write': (spec) => hasFileWriteTools(spec),
104
110
  };
111
+ /** `tools:<group>`, the open-ended capability. Mirrors the loader's. */
112
+ const TOOLS_CAPABILITY = 'tools:';
113
+ function grantsGroup(selectors, group) {
114
+ let whole = false;
115
+ const named = new Set();
116
+ for (const raw of selectors ?? []) {
117
+ const drop = raw.startsWith('-');
118
+ const selector = (drop ? raw.slice(1) : raw).trim();
119
+ if (selector === '*' || selector === `${group}:*`) {
120
+ whole = !drop;
121
+ named.clear();
122
+ continue;
123
+ }
124
+ const colon = selector.lastIndexOf(':');
125
+ const name = colon >= 0 ? selector.slice(colon + 1) : selector;
126
+ const inGroup = colon >= 0 ? selector.slice(0, colon) === group : name.startsWith(`${group}_`);
127
+ if (!inGroup) {
128
+ continue;
129
+ }
130
+ if (drop) {
131
+ named.delete(name);
132
+ }
133
+ else {
134
+ named.add(name);
135
+ }
136
+ }
137
+ return whole || named.size > 0;
138
+ }
139
+ function capability(cap) {
140
+ if (cap.startsWith(TOOLS_CAPABILITY)) {
141
+ const group = cap.slice(TOOLS_CAPABILITY.length);
142
+ return group ? (spec) => grantsGroup(spec.tools, group) : undefined;
143
+ }
144
+ return Object.hasOwn(CAPABILITIES, cap) ? CAPABILITIES[cap] : undefined;
145
+ }
146
+ const KNOWN_CAPABILITIES = [...Object.keys(CAPABILITIES), `${TOOLS_CAPABILITY}<group>`].join(', ');
105
147
  /**
106
148
  * Mirrors `readHouseRules` in the loader, in the same order:
107
149
  * `agents/instructions.md`, then every `agents/<topic>-instructions.md` by
@@ -137,7 +179,7 @@ function houseRules(root) {
137
179
  */
138
180
  function rulesFor(rules, spec) {
139
181
  return rules
140
- .filter((r) => r.requires.every((cap) => CAPABILITIES[cap]?.(spec) ?? true))
182
+ .filter((r) => r.requires.every((cap) => capability(cap)?.(spec) ?? true))
141
183
  .map((r) => r.rel);
142
184
  }
143
185
  export async function validateProject(opts) {
@@ -275,14 +317,14 @@ export async function validateProject(opts) {
275
317
  });
276
318
  }
277
319
  for (const cap of requires) {
278
- if (!(cap in CAPABILITIES)) {
320
+ if (!capability(cap)) {
279
321
  add({
280
322
  severity: 'error',
281
323
  code: 'rules.requires.unknown',
282
324
  where: rel,
283
325
  message: `\`requires: ${cap}\` names no capability, so the loader refuses the ` +
284
326
  'project',
285
- fix: `use one of: ${Object.keys(CAPABILITIES).join(', ')}`,
327
+ fix: `use one of: ${KNOWN_CAPABILITIES}`,
286
328
  });
287
329
  }
288
330
  }
@@ -360,6 +402,36 @@ export async function validateProject(opts) {
360
402
  });
361
403
  }
362
404
  }
405
+ // The same again for the MCP tools. They come from a plugin, so nothing in
406
+ // `zen` explains them otherwise, and their schemas say nothing about the
407
+ // connect pause, the result limit, or where they refuse to work.
408
+ const mcpAgents = config.agents.filter((a) => grantsGroup(a.tools, MCP_GROUP));
409
+ if (mcpAgents.length) {
410
+ const path = join(root, MCP_RULES);
411
+ if (!existsSync(path) || empty(path)) {
412
+ add({
413
+ severity: 'error',
414
+ code: 'mcp.uninstructed',
415
+ where: MCP_RULES,
416
+ message: 'an agent has the mcp tools, but nothing tells it how to find, describe ' +
417
+ 'and call a service tool, or what to do when the user must connect',
418
+ fix: 'zen check --fix, which writes the current rules back',
419
+ });
420
+ }
421
+ }
422
+ if (mcpAgents.some((a) => a.memory)) {
423
+ const path = join(root, MCP_MEMORY_RULES);
424
+ if (!existsSync(path) || empty(path)) {
425
+ add({
426
+ severity: 'error',
427
+ code: 'mcp-memory.uninstructed',
428
+ where: MCP_MEMORY_RULES,
429
+ message: 'an agent has both the mcp tools and memory, but nothing tells it to ' +
430
+ 'commit tool routes and never the results, which are the user’s data',
431
+ fix: 'zen check --fix, which writes the current rules back',
432
+ });
433
+ }
434
+ }
363
435
  // Present is not the same as current. These files are copies of ours
364
436
  // and nobody is meant to be maintaining them, so bytes that differ are an
365
437
  // older `zen`'s — prose about a runtime that has since moved, which reads
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zenera/cli",
3
- "version": "1.3.4",
3
+ "version": "1.3.5",
4
4
  "description": "Command-line front end for @zenera/neo: agentic projects you can run, share and commit.",
5
5
  "keywords": [
6
6
  "agents",
@@ -56,11 +56,11 @@
56
56
  "@google/genai": "^2.30.0",
57
57
  "@inkjs/ui": "^2.0.0",
58
58
  "@openrouter/sdk": "^1.4.25",
59
- "@zenera/engine": "^1.3.4",
60
- "@zenera/neo": "^1.3.4",
61
- "@zenera/sandbox": "^1.3.4",
62
- "@zenera/server": "^1.3.4",
63
- "@zenera/view": "^1.3.4",
59
+ "@zenera/engine": "^1.3.5",
60
+ "@zenera/neo": "^1.3.5",
61
+ "@zenera/sandbox": "^1.3.5",
62
+ "@zenera/server": "^1.3.5",
63
+ "@zenera/view": "^1.3.5",
64
64
  "google-auth-library": "^10.0.0",
65
65
  "ink": "^7.1.1",
66
66
  "openai": "^6.0.0",
@@ -60,10 +60,10 @@ change.
60
60
 
61
61
  **Load `zen-instructions` before writing, editing, reviewing or deleting any
62
62
  `agents/*instructions.md`.** They are the house rules, prepended to every
63
- agent's prompt, and four of them are `zen`'s own copies rather than the
63
+ agent's prompt, and six of them are `zen`'s own copies rather than the
64
64
  project's: an edit made inside one is lost at the next `zen check --fix`, `zen
65
65
  init` or `zen open`, with no diff to show for it. The skill is what says which
66
- four those are, where a project's own rules on the same subjects go instead,
66
+ six those are, where a project's own rules on the same subjects go instead,
67
67
  how `requires:` conditions a document, and what filename order decides. None of
68
68
  that is visible in the file being edited.
69
69
  Replacing generated copies with `zen check --fix` is maintenance, not manual
@@ -247,6 +247,8 @@ my-project/
247
247
  │ ├── instructions.md house rules, prepended to every agent
248
248
  │ ├── files-instructions.md and more - how files are handled
249
249
  │ ├── fork-instructions.md more of them - any `<topic>-instructions.md`
250
+ │ ├── mcp-instructions.md and more - how external services are called
251
+ │ ├── mcp-memory-instructions.md and more - what of them memory keeps
250
252
  │ ├── memory-instructions.md and more - how the graph is used
251
253
  │ ├── tools-instructions.md and more - how tools are called
252
254
  │ ├── prompts/
@@ -662,9 +664,10 @@ follow. So:
662
664
  Target 20-60 lines each. If one exceeds ~100, split the stable half out into a
663
665
  preloaded skill.
664
666
 
665
- Four of these documents are **`zen`'s, not the project's** -
666
- `tools-instructions.md`, `files-instructions.md`, `memory-instructions.md` and
667
- `fork-instructions.md`. They are replaced by `zen check --fix`, and a copy that
667
+ Six of these documents are **`zen`'s, not the project's** -
668
+ `tools-instructions.md`, `files-instructions.md`, `memory-instructions.md`,
669
+ `fork-instructions.md`, `mcp-instructions.md` and `mcp-memory-instructions.md`.
670
+ They are replaced by `zen check --fix`, and a copy that
668
671
  differs is reported as `rules.stale`. This project's own rules on any of those
669
672
  subjects go in a topic file beside them - `agents/files-policy-instructions.md`,
670
673
  `agents/memory-policy-instructions.md` and the like, carrying the same
@@ -854,8 +857,14 @@ that refuse to run until that skill is active.
854
857
 
855
858
  A project running in Zenera also has `mcp:*` - external services such as GitHub
856
859
  or Linear, called as the signed-in user. Those tools work only in the app's
857
- chats and Test tab, and they need a runtime skill installed in `agents/skills`.
858
- Load `zen-mcp` before granting or reviewing them.
860
+ chats and Test tab. How to use them reaches the agent through zen's house rules
861
+ `agents/mcp-instructions.md`, which `requires: [tools:mcp]` delivers to every
862
+ agent granted the group. Load `zen-mcp` before granting or reviewing them.
863
+
864
+ A request to "add GitHub MCP", "connect Linear" or the like is about **this
865
+ project's agents**: grant them `mcp:*` (`/add-mcp`, or `zen-mcp`). It never
866
+ means editing `.vscode/mcp.json` - that gives the editor tools, not the
867
+ project, and a project declares no servers or credentials.
859
868
 
860
869
  ### 3.6 The file tools (`files:*`, alias `workspace:*`)
861
870
 
@@ -1959,7 +1968,8 @@ Before finishing any change here:
1959
1968
  of every agent it reaches - `requires:` if it is about one of them
1960
1969
  - [ ] If any agent has file tools, `agents/files-instructions.md` is present - §3.6
1961
1970
  - [ ] If any agent has `fork:`, `agents/fork-instructions.md` is present - zen-topology §8
1962
- - [ ] No `rules.stale`: the four files that are `zen`'s rather than yours say
1971
+ - [ ] If any agent has `mcp:*`, `agents/mcp-instructions.md` is present - zen-mcp
1972
+ - [ ] No `rules.stale`: the six files that are `zen`'s rather than yours say
1963
1973
  what this version of the runtime does, and `zen check --fix` replaces them
1964
1974
  - [ ] Any change to an `agents/*instructions.md` was made with the
1965
1975
  `zen-instructions` skill loaded, and nothing of this project's was written
@@ -5,12 +5,14 @@ argument-hint: '[which services, and what the agents should do with them]'
5
5
  disable-model-invocation: true
6
6
  ---
7
7
 
8
- Add MCP to this project: grant the `mcp:*` tools, install the runtime skill that
9
- teaches agents to use them, and add a skill for each recurring job.
8
+ Add MCP to this project: grant the `mcp:*` tools, say which services are used
9
+ here, and add a skill for each recurring job. How to use the tools needs no
10
+ work: zen's house rules `agents/mcp-instructions.md` (and, with memory,
11
+ `agents/mcp-memory-instructions.md`) reach every agent granted the group.
10
12
 
11
- Load the `zen-mcp` skill first. It holds the rules and the files this command
12
- copies. If the project has a `memory:` block, also load `zen-memory`. If any
13
- agent will hand MCP data to code it runs, also load `zen-code-python`.
13
+ Load the `zen-mcp` skill first. It holds the rules this command follows. Also
14
+ load `zen-instructions` before writing the policy file in step 3. If any agent
15
+ will hand MCP data to code it runs, also load `zen-code-python`.
14
16
 
15
17
  1. **Ask** which servers are enabled for this project in Project settings → MCP
16
18
  servers, whether any is limited to some tools, and what jobs the agents
@@ -19,22 +21,23 @@ agent will hand MCP data to code it runs, also load `zen-code-python`.
19
21
  `tools:` in `agents.yaml` with a short comment saying which services they use,
20
22
  and `-mcp_call` for any that must only look
21
23
  (`zen-mcp` → `references/install.md` §2).
22
- 3. **Install the runtime skill.** Copy
23
- `.github/skills/zen-mcp/references/runtime-skill.md` to
24
- `agents/skills/mcp_tools/SKILL.md`. Fill in its _Servers_ section with the
25
- confirmed servers, or delete the section. Delete its _Memory_ section if
26
- there is no `memory:` block. Remove the `<!-- ... -->` editor notes.
27
- 4. **Bind it.** For each agent from step 2, add `mcp_tools` to `skills.allow`
28
- if the agent has an allow list, and to `preload` if MCP is its main job.
29
- 5. **Add a workflow skill** under `agents/skills/<job>/SKILL.md` for each
24
+ 3. **Name the servers.** If I confirmed any, write
25
+ `agents/mcp-policy-instructions.md` with `requires: [tools:mcp]` and one line
26
+ per server on what it is for here (`references/install.md` §3). Skip it if
27
+ none were confirmed. Never edit `agents/mcp-instructions.md` or
28
+ `agents/mcp-memory-instructions.md`.
29
+ 4. **Add a workflow skill** under `agents/skills/<job>/SKILL.md` for each
30
30
  recurring job from step 1: prerequisite first, then server, tool, argument
31
31
  shape, what to ask before writing, and what to do when the route is refused
32
- (`references/install.md` §4). Bind each one like `mcp_tools`.
33
- 6. **Add a prompt line** to each agent from step 2 saying when to reach for the
34
- services and to load `mcp_tools` first, unless it is preloaded.
35
- 7. Run `zen check`. If it reports `unknown tool "mcp:*"`, this is not a Zenera
32
+ (`references/install.md` §4). Bind each one in `skills.allow` of the agents
33
+ from step 2 if they have an allow list.
34
+ 5. **Add a prompt line** to each agent from step 2 saying when to reach for the
35
+ services.
36
+ 6. Run `zen check`. If it reports `mcp.uninstructed` or
37
+ `mcp-memory.uninstructed`, run `zen check --fix`, which writes the house
38
+ rules back. If it reports `unknown tool "mcp:*"`, this is not a Zenera
36
39
  environment. Say so instead of removing the grant.
37
- 8. Tell me to try it in the Test tab: the first request per service shows a
40
+ 7. Tell me to try it in the Test tab: the first request per service shows a
38
41
  connect card. A terminal `zen run` cannot call MCP.
39
42
 
40
- Report the agents changed, the skills added, and what `zen check` said.
43
+ Report the agents changed, the files and skills added, and what `zen check` said.
@@ -562,7 +562,8 @@ standing rule to `agents/instructions.md`, a rule about one capability to a new
562
562
 
563
563
  You may edit prompts, skills, house rules and new policy files. You may not edit
564
564
  `agents/memory-instructions.md`, `agents/fork-instructions.md`,
565
- `agents/tools-instructions.md` or `agents/files-instructions.md` - `zen check
565
+ `agents/tools-instructions.md`, `agents/files-instructions.md`,
566
+ `agents/mcp-instructions.md` or `agents/mcp-memory-instructions.md` - `zen check
566
567
  --fix` overwrites them. You may not change a rubric to make a run pass. Do not
567
568
  change `agents.yaml`: a finding that needs it is structural - record it as an
568
569
  open problem and carry on.
@@ -642,8 +642,10 @@ When nothing warrants a change, write `No instruction changes needed.`
642
642
  In a tuning loop, keep the actionable list identical to §7 `improvements`.
643
643
  Smaller cost observations below §7's threshold stay in section 3, not here.
644
644
 
645
- `agents/fork-instructions.md`, `agents/memory-instructions.md` and
646
- `agents/tools-instructions.md` are zen's own copies, and so is every built-in
645
+ `agents/fork-instructions.md`, `agents/memory-instructions.md`,
646
+ `agents/tools-instructions.md`, `agents/files-instructions.md`,
647
+ `agents/mcp-instructions.md` and `agents/mcp-memory-instructions.md` are zen's
648
+ own copies, and so is every built-in
647
649
  tool description. Never propose editing them; propose the project's policy
648
650
  file or prompt, or say the change belongs upstream in zen.
649
651
 
@@ -23,6 +23,8 @@ agents.yaml the configuration
23
23
  agents/instructions.md house rules, prepended to every agent
24
24
  agents/files-instructions.md more of them, for agents that work with files
25
25
  agents/fork-instructions.md more of them, for agents that can fork
26
+ agents/mcp-instructions.md more of them, for agents granted the mcp tools
27
+ agents/mcp-memory-instructions.md the same, for those that also have memory
26
28
  agents/memory-instructions.md more of them, for agents with the memory store
27
29
  agents/tools-instructions.md more of them, about how tools are called
28
30
  agents/prompts/default.md the default agent's prompt
@@ -1328,7 +1328,8 @@ assembled prefix in order. The remaining copies must either have different
1328
1328
  audiences or be deleted.
1329
1329
 
1330
1330
  Never edit `agents/memory-instructions.md`, `agents/fork-instructions.md`,
1331
- `agents/tools-instructions.md` or `agents/files-instructions.md`. They are copies
1331
+ `agents/tools-instructions.md`, `agents/files-instructions.md`,
1332
+ `agents/mcp-instructions.md` or `agents/mcp-memory-instructions.md`. They are copies
1332
1333
  of the runtime templates; `zen check --fix` replaces them wholesale. If a finding
1333
1334
  genuinely belongs in one — true of every Zenera project, not just this one —
1334
1335
  change the master upstream in the CLI templates, and note it in the run.
@@ -164,8 +164,9 @@ the skill is how you find out whether it is.
164
164
  (create a policy file only when step 3 proved the rule absent and every
165
165
  agent with that capability must obey it).
166
166
  11. **Never edit** `agents.yaml`, `agents/memory-instructions.md`,
167
- `agents/tools-instructions.md`, `agents/fork-instructions.md` or
168
- `agents/files-instructions.md`, nor anything outside `agents/`.
167
+ `agents/tools-instructions.md`, `agents/fork-instructions.md`,
168
+ `agents/files-instructions.md`, `agents/mcp-instructions.md` or
169
+ `agents/mcp-memory-instructions.md`, nor anything outside `agents/`.
169
170
  12. **Tidy up every file you touched** - the whole file, not only your lines.
170
171
  For each obligation in it, search the files the same agents read, and pick
171
172
  one move:
@@ -258,7 +258,8 @@ only a finding once the sentence is confirmed.
258
258
  once in a skill with a softer tail. Grep the whole request for a distinctive
259
259
  phrase of it, then grep the project's `agents/` tree for the file to edit.
260
260
  3. **Check it is the project's file.** `fork-instructions.md`,
261
- `memory-instructions.md`, `tools-instructions.md` are zen's own copies; load
261
+ `memory-instructions.md`, `tools-instructions.md`, `files-instructions.md`,
262
+ `mcp-instructions.md`, `mcp-memory-instructions.md` are zen's own copies; load
262
263
  **zen-instructions** before changing where that rule lives.
263
264
  4. **Second opinion only when justified.** A thin answer or `no instruction -
264
265
  my own default` does not itself justify more replay. In a whole-run audit,
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: zen-instructions
3
- description: The house rules - `agents/instructions.md` and every `agents/<topic>-instructions.md` prepended to every agent's system prompt. How the set is discovered and ordered, the `requires:` frontmatter and its closed vocabulary (`files`, `files-write`, `fork`, `memory`, `memory-write`, `memory-forget`), which four documents are `zen`'s own and are replaced by `zen check --fix`, how a project writes its own customisable topic prompts beside them (`files-policy-instructions.md`, `memory-policy-instructions.md`, `fork-<topic>-instructions.md`, `tools-<topic>-instructions.md`) without losing the copy, what belongs in a house rule as against an agent prompt or a skill, and every `zen check` finding these files can produce. Load before creating, editing, reviewing or deleting any `agents/*instructions.md`, before adding a capability whose rules arrive as one, and whenever `rules.stale`, `rules.unreached`, `files.uninstructed`, `memory.uninstructed` or `fork.uninstructed` is reported.
3
+ description: The house rules - `agents/instructions.md` and every `agents/<topic>-instructions.md` prepended to every agent's system prompt. How the set is discovered and ordered, the `requires:` frontmatter and its closed vocabulary (`files`, `files-write`, `fork`, `memory`, `memory-write`, `memory-forget`, `tools:<group>`), which six documents are `zen`'s own and are replaced by `zen check --fix`, how a project writes its own customisable topic prompts beside them (`memory-policy-instructions.md`, `mcp-policy-instructions.md`, any `<topic>-policy-instructions.md`) without losing the copy, what belongs in a house rule as against an agent prompt or a skill, and every `zen check` finding these files can produce. Load before creating, editing, reviewing or deleting any `agents/*instructions.md`, before adding a capability whose rules arrive as one, and whenever `rules.stale`, `rules.unreached` or any `*.uninstructed` finding (`files`, `memory`, `fork`, `mcp`, `mcp-memory`) is reported.
4
4
  user-invocable: false
5
5
  ---
6
6
 
@@ -69,9 +69,15 @@ condition and the prose it guards are one edit.
69
69
  | `memory` | it declares `memory:` in any form |
70
70
  | `memory-write` | its memory `access` is `read-write` or `full` |
71
71
  | `memory-forget` | its memory `access` is `full` |
72
+ | `tools:<group>` | its `tools:` grants any tool of that group (`tools:mcp`) |
72
73
 
73
74
  Legacy aliases `workspace` and `workspace-write` match `files` and `files-write`.
74
75
 
76
+ `tools:<group>` is read from `agents.yaml` alone, like the rest: `<group>:*`,
77
+ `<group>:<name>` and `*` grant the group, `-<group>:*` takes it back, and a bare
78
+ name counts when it starts `<group>_` (`mcp_call`). Withholding some of a
79
+ group's tools by name (`-mcp_call`) still leaves the group granted.
80
+
75
81
  The vocabulary is **closed**. A name outside it is a load error
76
82
  (`rules.requires.unknown`), not a rule that silently never fires. A list means
77
83
  _all of it_ has to hold. There is no `not`: a rule for agents _without_ a
@@ -85,24 +91,28 @@ confused by.
85
91
 
86
92
  ## Two owners, in the same directory
87
93
 
88
- | File | Whose | `requires:` | Is |
89
- | --------------------------------------- | --------- | ----------- | --------------------------------------------------------- |
90
- | `agents/instructions.md` | project's | - | identity, shared model of the system, global constraints |
91
- | `agents/tools-instructions.md` | **ours** | - | how tools are called: narrate, batch the independent ones |
92
- | `agents/files-instructions.md` | **ours** | `files` | how files are read, searched and patched; safety, mounts |
93
- | `agents/memory-instructions.md` | **ours** | `memory` | how the graph is reached, what to commit, how to correct |
94
- | `agents/fork-instructions.md` | **ours** | `fork` | what a branch is, what returns, when it is worth it |
95
- | `agents/tools-<topic>-instructions.md` | project's | yours | **this project's** tool policy |
96
- | `agents/files-<topic>-instructions.md` | project's | `files` | **this project's** file policy |
97
- | `agents/memory-<topic>-instructions.md` | project's | `memory` | **this project's** memory policy |
98
- | `agents/fork-<topic>-instructions.md` | project's | `fork` | **this project's** forking policy |
99
-
100
- The four marked **ours** describe _this version of `zen`_ - how the memory
94
+ | File | Whose | `requires:` | Is |
95
+ | --------------------------------------- | --------- | --------------------- | --------------------------------------------------------- |
96
+ | `agents/instructions.md` | project's | - | identity, shared model of the system, global constraints |
97
+ | `agents/tools-instructions.md` | **ours** | - | how tools are called: narrate, batch the independent ones |
98
+ | `agents/files-instructions.md` | **ours** | `files` | how files are read, searched and patched; safety, mounts |
99
+ | `agents/memory-instructions.md` | **ours** | `memory` | how the graph is reached, what to commit, how to correct |
100
+ | `agents/fork-instructions.md` | **ours** | `fork` | what a branch is, what returns, when it is worth it |
101
+ | `agents/mcp-instructions.md` | **ours** | `tools:mcp` | finding, describing and calling a service; connect pause |
102
+ | `agents/mcp-memory-instructions.md` | **ours** | `tools:mcp`, `memory` | commit MCP routes, never results |
103
+ | `agents/tools-<topic>-instructions.md` | project's | yours | **this project's** tool policy |
104
+ | `agents/files-<topic>-instructions.md` | project's | `files` | **this project's** file policy |
105
+ | `agents/memory-<topic>-instructions.md` | project's | `memory` | **this project's** memory policy |
106
+ | `agents/fork-<topic>-instructions.md` | project's | `fork` | **this project's** forking policy |
107
+ | `agents/mcp-<topic>-instructions.md` | project's | `tools:mcp` | **this project's** services: which servers, for what |
108
+
109
+ The six marked **ours** describe _this version of `zen`_ - how the memory
101
110
  graph works, how its tools are called, what survives a join, how files are safely
102
- handled. They land under `agents/` only because that is where a document has to
103
- be to reach a prompt. They are not the project's to maintain:
111
+ handled, how Zenera's MCP tools behave. They land under `agents/` only because
112
+ that is where a document has to be to reach a prompt. They are not the project's
113
+ to maintain:
104
114
 
105
- - `zen check --fix` **replaces all four** with the bytes this `zen` ships.
115
+ - `zen check --fix` **replaces all six** with the bytes this `zen` ships.
106
116
  - A copy that differs - edited in place, or scaffolded by an older `zen` - is
107
117
  reported as `rules.stale`, because prose about a runtime that has since moved
108
118
  reads exactly as authoritative as the version that is true.
@@ -119,12 +129,13 @@ inside. Anything this project decides for itself on a subject one of ours
119
129
  covers - which audience holds what, what must never be written down, how wide a
120
130
  fan-out may go, which tools are off limits here - is its own document:
121
131
 
122
- | Instead of editing | Write |
123
- | ------------------------ | -------------------------------------- |
124
- | `files-instructions.md` | `agents/files-policy-instructions.md` |
125
- | `memory-instructions.md` | `agents/memory-policy-instructions.md` |
126
- | `fork-instructions.md` | `agents/fork-policy-instructions.md` |
127
- | `tools-instructions.md` | `agents/tools-policy-instructions.md` |
132
+ | Instead of editing | Write |
133
+ | ------------------------ | ------------------------------------------------------------- |
134
+ | `files-instructions.md` | `agents/files-policy-instructions.md` |
135
+ | `memory-instructions.md` | `agents/memory-policy-instructions.md` |
136
+ | `fork-instructions.md` | `agents/fork-policy-instructions.md` |
137
+ | `tools-instructions.md` | `agents/tools-policy-instructions.md` |
138
+ | `mcp-instructions.md` | `agents/mcp-policy-instructions.md` (`requires: [tools:mcp]`) |
128
139
 
129
140
  `<topic>` is yours; `policy` is the convention and needs no explaining. Then a
130
141
  `zen check --fix`, a `zen init` or a `zen open` refreshes our copy and takes
@@ -191,20 +202,22 @@ It reads `agents/*instructions.md` and exits `1` on any candidate.
191
202
 
192
203
  ## What `zen check` reports
193
204
 
194
- | Finding | Severity | Means |
195
- | ------------------------ | -------- | ---------------------------------------------------------------- |
196
- | `rules.requires.unknown` | error | `requires:` names no capability - the loader refuses the project |
197
- | `files.uninstructed` | error | an agent has file tools and `files-instructions.md` is absent |
198
- | `memory.uninstructed` | error | memory is on and `memory-instructions.md` is missing or empty |
199
- | `fork.uninstructed` | error | an agent can fork and `fork-instructions.md` is missing or empty |
200
- | `rules.stale` | warning | one of ours is not the copy this `zen` ships |
201
- | `house-rules.empty` | warning | a document contributes nothing but a prompt section |
202
- | `rules.unreached` | note | a document of **yours** whose `requires:` no agent satisfies |
203
- | `house-rules.missing` | note | no house rules at all, which is allowed |
204
-
205
- `zen check --fix` answers the first five between them: it rewrites all four of
206
- ours and the whole `.github/` tree, then validates, so the report and its exit
207
- code describe the repaired project.
205
+ | Finding | Severity | Means |
206
+ | ------------------------- | -------- | ------------------------------------------------------------------------ |
207
+ | `rules.requires.unknown` | error | `requires:` names no capability - the loader refuses the project |
208
+ | `files.uninstructed` | error | an agent has file tools and `files-instructions.md` is absent |
209
+ | `memory.uninstructed` | error | memory is on and `memory-instructions.md` is missing or empty |
210
+ | `fork.uninstructed` | error | an agent can fork and `fork-instructions.md` is missing or empty |
211
+ | `mcp.uninstructed` | error | an agent has `mcp` tools and `mcp-instructions.md` is absent |
212
+ | `mcp-memory.uninstructed` | error | an agent has `mcp` tools and memory, `mcp-memory-instructions.md` absent |
213
+ | `rules.stale` | warning | one of ours is not the copy this `zen` ships |
214
+ | `house-rules.empty` | warning | a document contributes nothing but a prompt section |
215
+ | `rules.unreached` | note | a document of **yours** whose `requires:` no agent satisfies |
216
+ | `house-rules.missing` | note | no house rules at all, which is allowed |
217
+
218
+ `zen check --fix` answers every `*.uninstructed` and `rules.stale` between them:
219
+ it rewrites all six of ours and the whole `.github/` tree, then validates, so the
220
+ report and its exit code describe the repaired project.
208
221
 
209
222
  Two silences to know about. **There is no `tools.uninstructed`** - that document
210
223
  is unconditional and its absence is not reported, so a project that deleted it
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: zen-mcp
3
- description: 'MCP servers (GitHub, Linear, Notion, ...) in a Zenera project - the `mcp:*` tool group (`mcp_servers`, `mcp_tools`, `mcp_describe`, `mcp_call`) that Zenera provides, where those tools work and where they only refuse, how to grant them in `agents.yaml`, how to install the runtime `mcp_tools` skill and per-workflow skills into `agents/skills`, how an agent discovers, searches and calls a tool, the connect-your-account pause, result limits, and caching tool routes in memory. Load before adding, reviewing or debugging `mcp:*` or any `mcp_*` tool in a project, or a skill or prompt that tells an agent to use an external service through MCP.'
3
+ description: 'MCP servers (GitHub, Linear, Notion, ...) in a Zenera project - the `mcp:*` tool group (`mcp_servers`, `mcp_tools`, `mcp_describe`, `mcp_call`) that Zenera provides, where those tools work and where they only refuse, how to grant them in `agents.yaml`, the house rules `agents/mcp-instructions.md` and `agents/mcp-memory-instructions.md` that reach every agent granted the group, per-workflow skills in `agents/skills`, how an agent discovers, searches and calls a tool, the connect-your-account pause, result limits, and caching tool routes in memory. Load before adding, reviewing or debugging `mcp:*` or any `mcp_*` tool in a project, or a skill or prompt that tells an agent to use an external service through MCP, and whenever `mcp.uninstructed` or `mcp-memory.uninstructed` is reported.'
4
4
  user-invocable: false
5
5
  ---
6
6
 
@@ -25,7 +25,10 @@ Detail on each reply, the errors and the limits is in
25
25
 
26
26
  - **The tools are Zenera's, not the project's.** Every project running in
27
27
  Zenera has them. Nothing goes in `agents.yaml` except the grant, and nothing
28
- goes in `.env`.
28
+ goes in `.env`. How to use them reaches the agent as zen's own house rules,
29
+ `agents/mcp-instructions.md` (and `agents/mcp-memory-instructions.md` with
30
+ memory), which every scaffold carries and which `requires: [tools:mcp]`
31
+ delivers only to agents granted the group.
29
32
  - **Which servers exist** is up to the Zenera administrator. **Which of them this
30
33
  project may use**, and optionally which of their tools, is set by a project
31
34
  editor in the app under _Project settings → MCP servers_. You cannot see or
@@ -60,51 +63,51 @@ Consequences you must design for:
60
63
  fail with `unknown tool "mcp:*"`. That is the environment, not the project:
61
64
  do not remove the grant. Check the project in Zenera instead.
62
65
 
63
- ## 3. Obligations `zen check` does not report
66
+ ## 3. What a project with `mcp:*` needs
64
67
 
65
- A project that grants `mcp:*` is not finished until all of these hold:
68
+ `zen check` reports the house rules missing (`mcp.uninstructed`,
69
+ `mcp-memory.uninstructed`) or edited (`rules.stale`). It does not report the
70
+ rest of this list.
66
71
 
67
72
  1. **Grant the group only to the agents that act on external services.** Use
68
73
  `tools: [mcp:*, ...]`. Grant the group, not a hand-picked subset, because the
69
74
  four tools are one procedure and an agent missing `mcp_describe` guesses
70
75
  arguments. A router or a summariser does not get it.
71
- 2. **Install the runtime skill.** Copy
72
- [references/runtime-skill.md](./references/runtime-skill.md) to
73
- `agents/skills/mcp_tools/SKILL.md` unchanged in substance. It is the only
74
- thing that teaches a running agent the discover → describe → call order,
75
- how to search, how to handle the connect pause and truncation, and the memory
76
- rules. Bind it to every agent holding `mcp:*`: add it to `skills.allow`, and
77
- to `preload` when MCP is that agent's main job. How to do this:
78
- [references/install.md](./references/install.md).
76
+ 2. **Keep zen's house rules.** `agents/mcp-instructions.md` is the only thing
77
+ that teaches a running agent the discover → describe → call order, how to
78
+ choose a tool, the connect pause and truncation; with memory,
79
+ `agents/mcp-memory-instructions.md` adds the memory rules. Both are zen's
80
+ copies: never edit them, and restore them with `zen check --fix`. They need
81
+ no binding: the grant is what delivers them.
79
82
  3. **One project skill per recurring workflow** that names the server, the tool
80
83
  route and the argument shape, for example `agents/skills/linear_triage/`.
81
84
  Name only servers the user has confirmed are enabled, and tell the agent to
82
85
  fall back to discovery when the named tool is refused. See
83
86
  [references/install.md §4](./references/install.md#4-workflow-skills).
84
87
  4. **A prompt line saying when to reach for it.** For example: _"For anything
85
- about the user's issues, pull requests or tickets, use the MCP tools - load
86
- `mcp_tools` first."_ A grant the prompt never mentions is used at the
87
- model's discretion.
88
- 5. **Memory policy for MCP**, if the project has `memory:`: cache routes, never
89
- results. See [references/memory-cache.md](./references/memory-cache.md). It
90
- goes in the `mcp_tools` skill (already there) and, for project-specific
91
- policy, `agents/memory-policy-instructions.md`.
88
+ about the user's issues, pull requests or tickets, use the MCP tools."_ A
89
+ grant the prompt never mentions is used at the model's discretion.
90
+ 5. **Project policy beside, not inside.** Which servers this project uses and
91
+ what each is for goes in `agents/mcp-policy-instructions.md` with
92
+ `requires: [tools:mcp]`; project-specific memory policy goes in
93
+ `agents/memory-policy-instructions.md`. See
94
+ [references/memory-cache.md](./references/memory-cache.md).
92
95
  6. **No `mcp_*` in a skill's frontmatter `tools:`.** An agent-level grant of the
93
96
  same name wins and is never gated, so the line does nothing except mislead
94
97
  the next reader. Gate by binding the skill, not the tool.
95
98
  7. **No credentials or connect URLs anywhere in the project.** Zenera gives each
96
99
  run its access. A connect URL belongs to one user's sign-in and expires.
97
100
 
98
- There is no `requires: [mcp]` for house rules. The vocabulary is closed (see
99
- `zen-instructions`), so MCP guidance lives in the skill, not in
100
- `agents/*instructions.md`.
101
+ A project scaffolded before these files existed has neither: `zen check --fix`
102
+ writes both. A project that installed the older `agents/skills/mcp_tools` skill
103
+ can delete it and its `allow`/`preload` entries once the house rules are there,
104
+ since the two say the same thing twice.
101
105
 
102
106
  ## 4. Review checklist
103
107
 
104
- - [ ] Every agent with `mcp:*` has `mcp_tools` reachable: in `allow`, or the
105
- catalog is unrestricted. If MCP is its main job, the skill is also in `preload`.
106
- - [ ] `agents/skills/mcp_tools/SKILL.md` exists and still has the discovery,
107
- search, connect and memory sections from the runtime template.
108
+ - [ ] `agents/mcp-instructions.md` is present and not `rules.stale`; with
109
+ memory, so is `agents/mcp-memory-instructions.md`.
110
+ - [ ] No leftover `agents/skills/mcp_tools/` duplicating them.
108
111
  - [ ] Workflow skills name servers the user confirmed. Each says what to do when
109
112
  the server or tool is refused, and none hard-codes an id that belongs to
110
113
  one user (a team, repo or workspace of theirs).
@@ -116,24 +119,24 @@ There is no `requires: [mcp]` for house rules. The vocabulary is closed (see
116
119
 
117
120
  ## 5. When it goes wrong
118
121
 
119
- | Symptom | Cause and fix |
120
- | --------------------------------------------------------- | ------------------------------------------------------------------------------------------------------ |
121
- | `unknown tool "mcp:*"` at load | Not a Zenera environment - §2. Not a project error |
122
- | Every call: _"MCP is not available in this run"_ | A terminal, batch or job run. Use the chat or Test tab |
123
- | `<server> is not enabled for this project (enabled: ...)` | Enable it in Project settings → MCP servers, or change the skill to a listed server |
124
- | `<server>'s tool <tool> is not enabled for this project` | The editor restricted that server's tools. Enable the tool or route around it |
125
- | Agent guesses arguments, call fails validation | It skipped `mcp_describe`. Check the runtime skill is loaded, or preload it |
126
- | Result ends with `truncated: true` and a `note` | Over 60,000 characters. Ask for less: filters, fields, smaller pages - discovery.md §5 |
127
- | Run sits waiting after a call | The user has not connected the service. The card is in the chat; nothing to fix in the project |
128
- | Agent pastes a link and stops | Older host without pause support: `auth_required` + `connect_url`. Correct behaviour |
129
- | Agent re-lists every server's tools every turn | The runtime skill's search procedure is missing, or memory routes are not committed |
130
- | Agent acts on a recalled route that no longer exists | Memory was trusted over the server. The skill must say to re-describe on any refusal - memory-cache.md |
122
+ | Symptom | Cause and fix |
123
+ | --------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- |
124
+ | `unknown tool "mcp:*"` at load | Not a Zenera environment - §2. Not a project error |
125
+ | Every call: _"MCP is not available in this run"_ | A terminal, batch or job run. Use the chat or Test tab |
126
+ | `<server> is not enabled for this project (enabled: ...)` | Enable it in Project settings → MCP servers, or change the skill to a listed server |
127
+ | `<server>'s tool <tool> is not enabled for this project` | The editor restricted that server's tools. Enable the tool or route around it |
128
+ | `mcp.uninstructed` / `mcp-memory.uninstructed` | A house rules file is missing or empty. `zen check --fix` |
129
+ | Agent guesses arguments, call fails validation | It skipped `mcp_describe`. Check `agents/mcp-instructions.md` is in its prompt (`zen check` lists it) |
130
+ | Result ends with `truncated: true` and a `note` | Over 60,000 characters. Ask for less: filters, fields, smaller pages - discovery.md §5 |
131
+ | Run sits waiting after a call | The user has not connected the service. The card is in the chat; nothing to fix in the project |
132
+ | Agent pastes a link and stops | Older host without pause support: `auth_required` + `connect_url`. Correct behaviour |
133
+ | Agent re-lists every server's tools every turn | No workflow skill for the job, or with memory, routes are not being committed |
134
+ | Agent acts on a recalled route that no longer exists | Memory was trusted over the server. The house rules say to re-describe on any refusal - memory-cache.md |
131
135
 
132
136
  ## References
133
137
 
134
- | File | Read when |
135
- | ------------------------------------------------------------ | -------------------------------------------------------------------------------- |
136
- | [references/install.md](./references/install.md) | Adding MCP to a project: `tools:`, skill install and binding, workflow skills |
137
- | [references/discovery.md](./references/discovery.md) | How a run finds servers and tools, searches, calls, and reads replies and errors |
138
- | [references/memory-cache.md](./references/memory-cache.md) | The project has `memory:`, or an agent re-discovers the same tools every run |
139
- | [references/runtime-skill.md](./references/runtime-skill.md) | The text to copy to `agents/skills/mcp_tools/SKILL.md` |
138
+ | File | Read when |
139
+ | ---------------------------------------------------------- | -------------------------------------------------------------------------------- |
140
+ | [references/install.md](./references/install.md) | Adding MCP to a project: `tools:`, house rules, policy file, workflow skills |
141
+ | [references/discovery.md](./references/discovery.md) | How a run finds servers and tools, searches, calls, and reads replies and errors |
142
+ | [references/memory-cache.md](./references/memory-cache.md) | The project has `memory:`, or an agent re-discovers the same tools every run |
@@ -1,8 +1,9 @@
1
1
  # How a run finds and calls MCP tools
2
2
 
3
3
  This file describes what a running agent sees, so you can write skills and
4
- prompts that match it. The agent-facing version of the procedure is
5
- [runtime-skill.md](./runtime-skill.md).
4
+ prompts that match it. The agent-facing version of the procedure is zen's house
5
+ rules file `agents/mcp-instructions.md`, which reaches every agent granted
6
+ `mcp:*`.
6
7
 
7
8
  Every call is checked against the project's server selection and made as the
8
9
  signed-in user. Nothing about this is configurable from the project.
@@ -1,6 +1,6 @@
1
1
  # Installing MCP in a target project
2
2
 
3
- Four edits, in this order, followed by `zen check` and a Test-tab run. Every path
3
+ Edits in this order, followed by `zen check` and a Test-tab run. Every path
4
4
  is relative to the project root, the directory with `agents.yaml`.
5
5
 
6
6
  ## 1. Find out what is enabled
@@ -13,8 +13,8 @@ Ask the user:
13
13
  - whether any server is limited to some of its tools,
14
14
  - which jobs the agents should do with them.
15
15
 
16
- If they do not know, install only the generic skill (step 3). It discovers
17
- servers at run time, so the project works whatever is enabled later.
16
+ If they do not know, grant the tools and stop at step 3: the house rules
17
+ discover servers at run time, so the project works whatever is enabled later.
18
18
 
19
19
  ## 2. Grant the tools in `agents.yaml`
20
20
 
@@ -25,8 +25,7 @@ agents:
25
25
  - name: assistant
26
26
  tools: [files:*, mcp:*] # mcp: GitHub and Linear as the signed-in user
27
27
  skills:
28
- allow: [mcp_tools, linear_triage, house_style]
29
- preload: [mcp_tools] # MCP is this agent's main job
28
+ allow: [linear_triage, house_style]
30
29
  ```
31
30
 
32
31
  - **Grant `mcp:*`, not single tools.** `mcp_servers`, `mcp_tools`,
@@ -38,35 +37,37 @@ agents:
38
37
  anything upstream.
39
38
  - **Handoffs.** A router that only routes does not get `mcp:*`. Hand off to the
40
39
  agent that has it, and say so in that agent's `description:`.
41
- - **`skills:`**. If the agent has an `allow:` list, `mcp_tools` must be in it.
42
- A `preload` entry must also be in `allow`. Leave `preload` out when the agent
43
- only sometimes reaches an external service: the index line costs one line,
44
- and preloading costs the whole skill on every call.
45
40
 
46
- ## 3. Install the runtime skill
41
+ ## 3. The house rules
47
42
 
48
- Copy the template into the project's catalog. The folder name is the skill name:
43
+ Nothing to copy. The grant is what delivers them: `agents/mcp-instructions.md`
44
+ (`requires: [tools:mcp]`) reaches every agent granted the group, and
45
+ `agents/mcp-memory-instructions.md` (`requires: [tools:mcp, memory]`) those that
46
+ also have memory. Both are zen's copies, scaffolded into every project.
49
47
 
50
- ```sh
51
- mkdir -p agents/skills/mcp_tools
52
- cp .github/skills/zen-mcp/references/runtime-skill.md agents/skills/mcp_tools/SKILL.md
53
- ```
48
+ - If either is missing - a project scaffolded by an older `zen` - run
49
+ `zen check --fix`. `zen check` reports it as `mcp.uninstructed` or
50
+ `mcp-memory.uninstructed`.
51
+ - Never edit them. Project-specific text goes in a file beside them,
52
+ `agents/mcp-policy-instructions.md`:
53
+
54
+ ```markdown
55
+ ---
56
+ requires: [tools:mcp]
57
+ ---
58
+
59
+ # Services in this project
54
60
 
55
- Then edit **only** what is project-specific in the copy:
61
+ - `github` - pull requests, reviews and issues in the user's repositories.
62
+ - `linear` - the user's issues and projects.
63
+ ```
56
64
 
57
- - The **Servers** section: list the servers the user confirmed, with one line on
58
- what each is for here. Leave the section out if none were confirmed, so the
59
- agent discovers them.
60
- - The **Memory** section: delete it if the project has no `memory:` block,
61
- since an agent without the memory tools cannot follow it. Keep it otherwise.
62
- - Remove the two `<!-- ... -->` editor notes.
63
- - Nothing else. The discovery order, search procedure and connect handling
64
- describe how the platform behaves, not this project.
65
+ List only servers the user confirmed. Leave the file out if none were: the
66
+ agent discovers them. Copy the `requires:` line - without it the file reaches
67
+ every agent.
65
68
 
66
- Why copy and not reference: `.github/` is the editor's tree, and a running agent
67
- cannot read it. `zen init` and `zen open` also rewrite `.github/`, so the copy in
68
- `agents/skills/` is the one the project owns. To pick up a newer template later,
69
- compare the two files and merge by hand.
69
+ - A project that still has the older `agents/skills/mcp_tools/` skill: delete
70
+ it and its `allow`/`preload` entries. The house rules replace it.
70
71
 
71
72
  ### Skills from somewhere else
72
73
 
@@ -76,7 +77,7 @@ MCP skills in one directory and use them in several projects:
76
77
  ```yaml
77
78
  skills:
78
79
  - agents/skills
79
- - ../shared/mcp-skills # mcp_tools, github_review, linear_triage
80
+ - ../shared/mcp-skills # github_review, linear_triage
80
81
  ```
81
82
 
82
83
  With several directories the catalog is mounted at `/skills/<folder>` per
@@ -98,7 +99,7 @@ agents/skills/linear_triage/SKILL.md
98
99
  description: Triage the user's open Linear issues - list, group by state and priority, propose next steps.
99
100
  ---
100
101
 
101
- Needs `mcp:*` and the `mcp_tools` skill. Without them, say MCP is not
102
+ Needs the `mcp_*` tools. Without them, say MCP is not
102
103
  available here and stop.
103
104
 
104
105
  1. `mcp_call` server `linear`, tool `list_issues`, arguments
@@ -118,7 +119,7 @@ user confirmed, and leave argument details to `mcp_describe` when unsure.
118
119
 
119
120
  Rules for these skills:
120
121
 
121
- - **State the prerequisite first** (`mcp:*`, `mcp_tools`) and what to do without
122
+ - **State the prerequisite first** (the `mcp_*` tools) and what to do without
122
123
  it. The catalog is readable by every agent, including ones not granted the
123
124
  skill.
124
125
  - **Name the tool and argument shape, but still describe once per run.** Tools
@@ -129,9 +130,18 @@ Rules for these skills:
129
130
  - **No user-specific ids.** A team id, repo or workspace belongs to one user.
130
131
  The skill tells the agent how to find it (`list_teams`, or memory), not the
131
132
  value itself.
133
+ - **Do not restate the house rules.** Discovery, the connect pause and
134
+ truncation are already in every MCP agent's prompt.
132
135
  - **Bind it** in `skills.allow` of the agents that hold `mcp:*`.
133
136
 
134
- ## 5. Check
137
+ ## 5. A prompt line
138
+
139
+ In `agents/prompts/<name>.md` of each agent from step 2, one line saying when to
140
+ reach for the services - for example _"For anything about the user's issues,
141
+ pull requests or tickets, use the MCP tools."_ A grant the prompt never
142
+ mentions is used at the model's discretion.
143
+
144
+ ## 6. Check
135
145
 
136
146
  ```sh
137
147
  zen check
@@ -139,6 +149,7 @@ zen check
139
149
 
140
150
  - `unknown tool "mcp:*"` means this is not a Zenera environment. Keep the grant
141
151
  and check the project in Zenera.
152
+ - `mcp.uninstructed` or `mcp-memory.uninstructed`: run `zen check --fix`.
142
153
  - `skills.allow` / `preload` naming something absent means the folder name and
143
154
  the binding differ.
144
155
 
@@ -63,9 +63,11 @@ before the first call of that tool in a run. Then:
63
63
 
64
64
  ## Where this policy is written
65
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:`.
66
+ - In `agents/mcp-memory-instructions.md`, zen's own house rules file. It has
67
+ `requires: [tools:mcp, memory]`, so it reaches exactly the agents that have
68
+ both, and nothing has to be deleted in a project without `memory:`. Never edit
69
+ it: `zen check --fix` replaces it.
69
70
  - Project-specific additions (for example, a team or audience that holds MCP
70
71
  routes) go in `agents/memory-policy-instructions.md`, never in
71
- `agents/memory-instructions.md` (zen's own copy, see `zen-memory`).
72
+ `agents/memory-instructions.md` or `agents/mcp-memory-instructions.md` (zen's
73
+ own copies, see `zen-instructions`).
@@ -232,10 +232,12 @@ copy sitting in this project.
232
232
  ## 9. Findings that are not yours to fix in place
233
233
 
234
234
  `zen check` reports `rules.stale`, `files.uninstructed`, `memory.uninstructed`,
235
- `fork.uninstructed`, `rules.requires.unknown` or `rules.unreached` against a
235
+ `fork.uninstructed`, `mcp.uninstructed`, `mcp-memory.uninstructed`,
236
+ `rules.requires.unknown` or `rules.unreached` against a
236
237
  file under `agents/`, and the obvious repair - open it and edit it - is wrong for
237
- four of those files. `tools-instructions.md`, `files-instructions.md`,
238
- `memory-instructions.md` and `fork-instructions.md` are `zen`'s copies:
238
+ six of those files. `tools-instructions.md`, `files-instructions.md`,
239
+ `memory-instructions.md`, `fork-instructions.md`, `mcp-instructions.md` and
240
+ `mcp-memory-instructions.md` are `zen`'s copies:
239
241
  `zen check --fix` replaces them, so an edit made inside one is gone at the next
240
242
  fix, `init` or `open`.
241
243
 
@@ -47,7 +47,8 @@ strip_urls() {
47
47
  # The three trees §2.5 names, prose only: a skill's own script is code the
48
48
  # sandbox runs, not text rendered into a prompt, and its paths are its own.
49
49
  #
50
- # The four copies `zen` ships (files-, fork-, memory-, tools-instructions.md)
50
+ # The six copies `zen` ships (files-, fork-, mcp-, mcp-memory-, memory-,
51
+ # tools-instructions.md)
51
52
  # are left out on purpose. They are full of worked examples, so they fail this
52
53
  # sweep by design, and the project cannot edit them anyway: `zen check` reports
53
54
  # any byte that differs as `rules.stale`.
@@ -58,7 +59,7 @@ files() {
58
59
  for file in agents/*instructions.md; do
59
60
  if [ -f "$file" ]; then echo "$file"; fi
60
61
  done
61
- } | grep -Ev '^agents/(files|fork|memory|tools)-instructions\.md$' | sort -u
62
+ } | grep -Ev '^agents/(files|fork|mcp|mcp-memory|memory|tools)-instructions\.md$' | sort -u
62
63
  }
63
64
 
64
65
  # Every token in those files, urls removed first, and a sentence's full stop
@@ -333,7 +333,8 @@ Outside the two narrow tiers:
333
333
  5. **`zen-instructions` is loaded before editing a project-owned house rule.** A pass
334
334
  whose scope reaches `agents/*instructions.md` - and input 4 puts it there
335
335
  whenever a project-owned one moved - has to know that `tools-instructions.md`,
336
- `files-instructions.md`, `memory-instructions.md` and `fork-instructions.md`
336
+ `files-instructions.md`, `memory-instructions.md`, `fork-instructions.md`,
337
+ `mcp-instructions.md` and `mcp-memory-instructions.md`
337
338
  are `zen`'s and are replaced by `zen check --fix`. A pass that writes a
338
339
  requirement into one of them has implemented nothing: the next `open` reverts
339
340
  it, the history entry claims it, and the baseline records it as applied.
@@ -76,7 +76,7 @@ differs() {
76
76
 
77
77
  owned() {
78
78
  case "$1" in
79
- agents/files-instructions.md|agents/fork-instructions.md|agents/memory-instructions.md|agents/tools-instructions.md) return 0 ;;
79
+ agents/files-instructions.md|agents/fork-instructions.md|agents/mcp-instructions.md|agents/mcp-memory-instructions.md|agents/memory-instructions.md|agents/tools-instructions.md) return 0 ;;
80
80
  *) return 1 ;;
81
81
  esac
82
82
  }
@@ -0,0 +1,66 @@
1
+ ---
2
+ requires: [tools:mcp]
3
+ ---
4
+
5
+ # External services (MCP)
6
+
7
+ These rules are for agents that have the `mcp_servers`, `mcp_tools`,
8
+ `mcp_describe` and `mcp_call` tools. Without them, tell the user that external
9
+ services are not available to you here, and do not answer from what you
10
+ remember about their data.
11
+
12
+ The tools reach services such as GitHub or Linear as the signed-in user, and
13
+ only in a chat or the Test tab. If a call says _"MCP is not available in this
14
+ run"_, tell the user MCP tools are unavailable here and do not retry. It says
15
+ nothing about which services or accounts they have.
16
+
17
+ ## Finding a tool
18
+
19
+ Stop as soon as you have a route:
20
+
21
+ 1. A route you already know: a skill for this job, or one you recall.
22
+ 2. `mcp_servers`, then `mcp_tools` for the one server whose name fits the
23
+ request. Do not list every server.
24
+ 3. Choose by verb and object: `search_`/`list_`/`get_` read,
25
+ `create_`/`update_`/`delete_` write. Prefer a `search_*` tool with a query
26
+ over listing everything and filtering yourself.
27
+ 4. If nothing fits, try the next plausible server once, then tell the user the
28
+ connected services do not offer it. Never invent a tool name.
29
+
30
+ ## Calling it
31
+
32
+ 1. `mcp_describe` the tool before its first call in this run, even when a skill
33
+ or memory named it. Take argument names, required fields, enums and
34
+ pagination from its schema only.
35
+ 2. `mcp_call` with `server`, `tool` and `arguments` matching that schema. Ask for
36
+ only what you need: filters, a small page, only the fields you need.
37
+ 3. Read the reply. Prefer `structuredContent` over `content`. On `isError: true`,
38
+ fix the arguments once, then tell the user what failed. On `truncated: true`
39
+ you have only the start: call again asking for less, and never treat the
40
+ cut-off as the whole answer.
41
+ 4. Ask before any write - creating, editing, closing, merging, commenting or
42
+ deleting - unless the user's message was that request. Say exactly what will
43
+ change.
44
+ 5. Results are the user's data. Quote what answers the question; do not paste
45
+ whole payloads.
46
+
47
+ ## Connecting an account
48
+
49
+ The first call to a service the user has not connected waits while the chat
50
+ asks them to connect. When they do, you get the result as usual. If they choose
51
+ _Not now_, the call fails: go on without that service and say what you could
52
+ not check.
53
+
54
+ If a result instead contains `auth_required` and `connect_url`, give the user
55
+ the link, say in one sentence what it connects, and stop. Call again only after
56
+ they say they have connected.
57
+
58
+ ## When a server or tool is refused
59
+
60
+ - _"`x` is not enabled for this project"_: use a listed server, or tell the user
61
+ a project editor can enable `x` in Project settings → MCP servers.
62
+ - _"`x`'s tool `y` is not enabled"_: use another tool on that server, or say so.
63
+ - The service or MCP is unavailable: retry once, then report it.
64
+
65
+ A refused route that came from a skill or memory is stale. Discover again from
66
+ `mcp_servers`.
@@ -0,0 +1,28 @@
1
+ ---
2
+ requires: [tools:mcp, memory]
3
+ ---
4
+
5
+ # External services and memory
6
+
7
+ These rules are for agents that have both the `mcp_*` tools and a memory store.
8
+
9
+ Before discovering a tool, look for a route you have already found:
10
+ `memory_grep` the service name or the verb (`linear`, `create_issue`), or
11
+ `memory_search` the user's request.
12
+
13
+ After a request needed discovery, and your memory access lets you write,
14
+ commit the route so the next run can skip it:
15
+
16
+ - an `operation` node: the request in the user's words first, then
17
+ `mcp_call <server> <tool>` and the arguments that mattered, linked from the
18
+ `task` (`PRODUCED`);
19
+ - a `plan` node when several calls had to happen in order;
20
+ - a `fact` node for a convention the schema did not state (pagination, how
21
+ "mine" is expressed), or for a capability that turned out not to exist.
22
+
23
+ Never commit tool results, the user's data, whole tool listings or schemas,
24
+ connect links, or ids that belong to one user.
25
+
26
+ A recalled route is a hint, not the truth: still `mcp_describe` before the first
27
+ call. When it is refused or its arguments fail validation, commit the corrected
28
+ route with `SUPERSEDES` pointing at the old one.
@@ -1,95 +0,0 @@
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.