@zenera/cli 1.1.24 → 1.1.26

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 (199) hide show
  1. package/README.md +65 -0
  2. package/dist/ask.js +28 -5
  3. package/dist/banner.js +2 -2
  4. package/dist/batch.d.ts +6 -0
  5. package/dist/batch.js +76 -1
  6. package/dist/catalog.d.ts +31 -1
  7. package/dist/catalog.js +140 -7
  8. package/dist/commands/index.js +2 -0
  9. package/dist/commands/inspect.d.ts +52 -2
  10. package/dist/commands/inspect.js +220 -31
  11. package/dist/commands/memory.js +156 -32
  12. package/dist/commands/meta.js +333 -24
  13. package/dist/commands/models.js +97 -12
  14. package/dist/commands/open.js +4 -4
  15. package/dist/commands/run.js +38 -4
  16. package/dist/commands/sandbox.js +148 -16
  17. package/dist/commands/view.d.ts +8 -0
  18. package/dist/commands/view.js +114 -0
  19. package/dist/engine.d.ts +8 -1
  20. package/dist/engine.js +7 -0
  21. package/dist/eventlog.d.ts +64 -0
  22. package/dist/eventlog.js +170 -0
  23. package/dist/liveness.d.ts +7 -0
  24. package/dist/liveness.js +35 -3
  25. package/dist/main.js +0 -0
  26. package/dist/meta/editor.d.ts +9 -0
  27. package/dist/meta/editor.js +43 -0
  28. package/dist/meta/finetune/analyze-brief.d.ts +26 -0
  29. package/dist/meta/finetune/analyze-brief.js +131 -0
  30. package/dist/meta/finetune/apply-brief.d.ts +23 -0
  31. package/dist/meta/finetune/apply-brief.js +247 -0
  32. package/dist/meta/finetune/brief.d.ts +45 -0
  33. package/dist/meta/finetune/brief.js +158 -0
  34. package/dist/meta/finetune/children.d.ts +8 -0
  35. package/dist/meta/finetune/children.js +76 -0
  36. package/dist/meta/finetune/command.d.ts +30 -0
  37. package/dist/meta/finetune/command.js +516 -0
  38. package/dist/meta/finetune/cost.d.ts +46 -0
  39. package/dist/meta/finetune/cost.js +105 -0
  40. package/dist/meta/finetune/dataset/anchors.d.ts +41 -0
  41. package/dist/meta/finetune/dataset/anchors.js +239 -0
  42. package/dist/meta/finetune/dataset/changes.d.ts +36 -0
  43. package/dist/meta/finetune/dataset/changes.js +319 -0
  44. package/dist/meta/finetune/dataset/command.d.ts +17 -0
  45. package/dist/meta/finetune/dataset/command.js +1011 -0
  46. package/dist/meta/finetune/dataset/drift.d.ts +33 -0
  47. package/dist/meta/finetune/dataset/drift.js +71 -0
  48. package/dist/meta/finetune/dataset/export.d.ts +26 -0
  49. package/dist/meta/finetune/dataset/export.js +51 -0
  50. package/dist/meta/finetune/dataset/index.d.ts +2 -0
  51. package/dist/meta/finetune/dataset/index.js +2 -0
  52. package/dist/meta/finetune/dataset/sample.d.ts +50 -0
  53. package/dist/meta/finetune/dataset/sample.js +197 -0
  54. package/dist/meta/finetune/dataset/schema.d.ts +33 -0
  55. package/dist/meta/finetune/dataset/schema.js +216 -0
  56. package/dist/meta/finetune/dataset/store.d.ts +35 -0
  57. package/dist/meta/finetune/dataset/store.js +177 -0
  58. package/dist/meta/finetune/dataset/types.d.ts +127 -0
  59. package/dist/meta/finetune/dataset/types.js +39 -0
  60. package/dist/meta/finetune/failure.d.ts +15 -0
  61. package/dist/meta/finetune/failure.js +26 -0
  62. package/dist/meta/finetune/feedback.d.ts +57 -0
  63. package/dist/meta/finetune/feedback.js +104 -0
  64. package/dist/meta/finetune/guard.d.ts +29 -0
  65. package/dist/meta/finetune/guard.js +104 -0
  66. package/dist/meta/finetune/improvements.d.ts +98 -0
  67. package/dist/meta/finetune/improvements.js +501 -0
  68. package/dist/meta/finetune/index.d.ts +2 -0
  69. package/dist/meta/finetune/index.js +2 -0
  70. package/dist/meta/finetune/journal.d.ts +35 -0
  71. package/dist/meta/finetune/journal.js +135 -0
  72. package/dist/meta/finetune/live.d.ts +84 -0
  73. package/dist/meta/finetune/live.js +272 -0
  74. package/dist/meta/finetune/loop.d.ts +3 -0
  75. package/dist/meta/finetune/loop.js +163 -0
  76. package/dist/meta/finetune/memories.d.ts +47 -0
  77. package/dist/meta/finetune/memories.js +154 -0
  78. package/dist/meta/finetune/recheck.d.ts +58 -0
  79. package/dist/meta/finetune/recheck.js +311 -0
  80. package/dist/meta/finetune/report.d.ts +40 -0
  81. package/dist/meta/finetune/report.js +1397 -0
  82. package/dist/meta/finetune/retry.d.ts +24 -0
  83. package/dist/meta/finetune/retry.js +96 -0
  84. package/dist/meta/finetune/sampler.d.ts +18 -0
  85. package/dist/meta/finetune/sampler.js +47 -0
  86. package/dist/meta/finetune/system.d.ts +27 -0
  87. package/dist/meta/finetune/system.js +132 -0
  88. package/dist/meta/finetune/train.d.ts +43 -0
  89. package/dist/meta/finetune/train.js +425 -0
  90. package/dist/meta/finetune/tui.d.ts +16 -0
  91. package/dist/meta/finetune/tui.js +316 -0
  92. package/dist/meta/finetune/tuning.d.ts +193 -0
  93. package/dist/meta/finetune/tuning.js +308 -0
  94. package/dist/meta/finetune/usage.d.ts +66 -0
  95. package/dist/meta/finetune/usage.js +260 -0
  96. package/dist/meta/finetune/view.d.ts +9 -0
  97. package/dist/meta/finetune/view.js +27 -0
  98. package/dist/meta/host.d.ts +15 -0
  99. package/dist/meta/host.js +21 -0
  100. package/dist/meta/index.d.ts +11 -0
  101. package/dist/meta/index.js +11 -0
  102. package/dist/meta/launch.d.ts +81 -0
  103. package/dist/meta/launch.js +286 -0
  104. package/dist/meta/model.d.ts +44 -0
  105. package/dist/meta/model.js +119 -0
  106. package/dist/meta/prompts.d.ts +18 -0
  107. package/dist/meta/prompts.js +61 -0
  108. package/dist/meta/relay.d.ts +20 -0
  109. package/dist/meta/relay.js +123 -0
  110. package/dist/meta/tokens.d.ts +52 -0
  111. package/dist/meta/tokens.js +226 -0
  112. package/dist/meta/window.d.ts +61 -0
  113. package/dist/meta/window.js +198 -0
  114. package/dist/meta/wire.d.ts +42 -0
  115. package/dist/meta/wire.js +129 -0
  116. package/dist/meta.d.ts +71 -1
  117. package/dist/meta.js +303 -6
  118. package/dist/modelref.d.ts +16 -0
  119. package/dist/modelref.js +41 -0
  120. package/dist/narrate.js +5 -2
  121. package/dist/podman.d.ts +26 -0
  122. package/dist/podman.js +83 -3
  123. package/dist/projects.d.ts +0 -5
  124. package/dist/projects.js +2 -15
  125. package/dist/resources.d.ts +215 -0
  126. package/dist/resources.js +856 -0
  127. package/dist/sandbox.d.ts +2 -0
  128. package/dist/sandbox.js +10 -3
  129. package/dist/scaffold.d.ts +15 -7
  130. package/dist/scaffold.js +24 -67
  131. package/dist/session.js +4 -29
  132. package/dist/term.d.ts +2 -0
  133. package/dist/term.js +11 -2
  134. package/dist/trace.d.ts +5 -0
  135. package/dist/trace.js +107 -7
  136. package/dist/tui/app.js +19 -5
  137. package/dist/tui/links.d.ts +27 -0
  138. package/dist/tui/links.js +142 -0
  139. package/dist/tui/models.d.ts +35 -0
  140. package/dist/tui/models.js +447 -0
  141. package/dist/tui/sandbox.d.ts +10 -0
  142. package/dist/tui/sandbox.js +131 -0
  143. package/dist/tui/wrap.d.ts +5 -0
  144. package/dist/tui/wrap.js +12 -0
  145. package/dist/usage.d.ts +78 -0
  146. package/dist/usage.js +51 -0
  147. package/package.json +4 -2
  148. package/templates/editor/.github/copilot-instructions.md +60 -145
  149. package/templates/editor/.github/prompts/analyze.prompt.md +33 -0
  150. package/templates/editor/.github/prompts/dataset.prompt.md +108 -0
  151. package/templates/editor/.github/prompts/finetune-apply.prompt.md +270 -0
  152. package/templates/editor/.github/prompts/finetune.prompt.md +691 -198
  153. package/templates/editor/.github/prompts/new-agent.prompt.md +3 -1
  154. package/templates/editor/.github/prompts/new-skill.prompt.md +2 -0
  155. package/templates/editor/.github/prompts/project-review.prompt.md +5 -4
  156. package/templates/editor/.github/skills/zen-analyze-run/SKILL.md +588 -0
  157. package/templates/editor/.github/skills/zen-cli/SKILL.md +9 -1
  158. package/templates/editor/.github/skills/zen-cli/references/dataset.md +34 -0
  159. package/templates/editor/.github/skills/zen-cli/references/finetune.md +137 -0
  160. package/templates/editor/.github/skills/zen-cli/references/inspect.md +63 -11
  161. package/templates/editor/.github/skills/zen-cli/references/memory.md +33 -10
  162. package/templates/editor/.github/skills/zen-cli/references/meta.md +61 -0
  163. package/templates/editor/.github/skills/zen-cli/references/models.md +5 -1
  164. package/templates/editor/.github/skills/zen-cli/references/projects.md +4 -6
  165. package/templates/editor/.github/skills/zen-cli/references/rag.md +24 -6
  166. package/templates/editor/.github/skills/zen-cli/references/sandbox.md +35 -14
  167. package/templates/editor/.github/skills/zen-code-python/SKILL.md +123 -0
  168. package/templates/editor/.github/skills/zen-code-python/references/code_python.md +48 -0
  169. package/templates/editor/.github/skills/zen-dataset/SKILL.md +253 -0
  170. package/templates/editor/.github/skills/zen-finetune/SKILL.md +1492 -660
  171. package/templates/editor/.github/skills/zen-finetune/references/readme-template.md +268 -0
  172. package/templates/editor/.github/skills/zen-finetune/scripts/batch.mjs +390 -0
  173. package/templates/editor/.github/skills/zen-finetune/scripts/difficult.mjs +243 -0
  174. package/templates/editor/.github/skills/zen-finetune/scripts/memory.mjs +280 -0
  175. package/templates/editor/.github/skills/zen-finetune/scripts/next.mjs +398 -0
  176. package/templates/editor/.github/skills/zen-finetune/scripts/report.mjs +797 -0
  177. package/templates/editor/.github/skills/zen-finetune/scripts/select.mjs +354 -0
  178. package/templates/editor/.github/skills/zen-finetune/scripts/usage.mjs +722 -0
  179. package/templates/editor/.github/skills/zen-inspect/SKILL.md +74 -26
  180. package/templates/editor/.github/skills/zen-inspect-ask/SKILL.md +271 -0
  181. package/templates/editor/.github/skills/zen-instructions/SKILL.md +4 -12
  182. package/templates/editor/.github/skills/zen-memory/SKILL.md +82 -53
  183. package/templates/editor/.github/skills/zen-rag-docs/SKILL.md +20 -8
  184. package/templates/editor/.github/skills/zen-review/SKILL.md +8 -31
  185. package/templates/editor/.github/skills/zen-review/scripts/check-paths.sh +5 -5
  186. package/templates/editor/.github/skills/zen-review/scripts/review.sh +3 -12
  187. package/templates/editor/.github/skills/zen-sandbox/SKILL.md +9 -4
  188. package/templates/editor/.github/skills/zen-sandbox-capacity/SKILL.md +2 -2
  189. package/templates/editor/.github/skills/zen-spec-sync/SKILL.md +2 -4
  190. package/templates/editor/.github/skills/zen-topology/SKILL.md +283 -0
  191. package/templates/editor/.vscode/settings.json +1 -0
  192. package/templates/project/agents/files-instructions.md +29 -20
  193. package/templates/project/agents/fork-instructions.md +78 -28
  194. package/templates/project/agents/memory-instructions.md +222 -494
  195. package/templates/project/agents/tools-instructions.md +14 -4
  196. package/templates/project/gitignore +2 -0
  197. package/templates/editor/.github/skills/zen-finetune/scripts/collect.sh +0 -432
  198. package/templates/editor/.github/skills/zen-finetune/scripts/sample.sh +0 -199
  199. package/templates/editor/.github/skills/zen-memory/scripts/check-instructions.sh +0 -116
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: zen-memory
3
- description: How agent memory is organised and how to configure it in `agents.yaml` - the `memory:` block, per-agent `access`/`sees`/`writes`/`autoRecall`, the five `memory_*` tools, kinds and relations, how recall ranks and stitches a subgraph, when an agent should reach for `memory_grep` instead of `memory_search`, how to inspect a graph with `zen memory search`/`grep`/`export`, and how to design a memory strategy for a project. Includes the default usage rules every memory-enabled project must carry in `agents/memory-instructions.md` (references/memory-instructions.md), the script that says whether that copy is still current (scripts/check-instructions.sh), where a project's own customisations go instead (`agents/memory-policy-instructions.md`, under `requires: [memory]`), what to commit and what never to, how to keep a working file under `/memory` and re-run it later, and how to put memory in front of a `zen rag schema` or `zen rag docs` index so a search that already succeeded once is not paid for again.
3
+ description: Agent memory in Zenera projects - the `memory:` block and per-agent `access`/`sees`/`writes`/`autoRecall`, the five `memory_*` tools (when to use `memory_grep` instead of `memory_search`), kinds, relations and how recall ranks, inspecting a graph with `zen memory`, designing a memory strategy, `agents/memory-instructions.md` vs `agents/memory-policy-instructions.md`, remembering files under `/memory`, and putting memory in front of a `zen rag` index.
4
4
  ---
5
5
 
6
6
  # Memory
@@ -142,8 +142,8 @@ node. It is house rules under `requires: [memory]`, so it reaches exactly the
142
142
  agents that have the store and no others, and it gates its own advice on the
143
143
  tools the reader actually holds. The runtime adds the preference block and
144
144
  nothing else. Do not restate any of it in a prompt; state project-specific
145
- policy instead, and keep the copy byte-identical to the reference so
146
- `check-instructions.sh` stays meaningful.
145
+ policy instead, and leave the file exactly as `zen` wrote it - `zen check`
146
+ reports any byte that differs as `rules.stale`.
147
147
 
148
148
  ## How it is organised
149
149
 
@@ -556,38 +556,20 @@ gets whether it loads the skill or not.
556
556
 
557
557
  ## The house rules
558
558
 
559
- **Every project that enables memory carries `references/memory-instructions.md`
560
- in its own `agents/memory-instructions.md`**, as part of turning memory on. That
561
- file is how the agent is told to use the store: read and search it only through
562
- the tools, never through `/memory` itself, and what a node must carry to still be
563
- worth having.
559
+ **Every project that enables memory carries `agents/memory-instructions.md`**,
560
+ as shipped by `zen`. That file is how the agent is told to use the store: read
561
+ and search it only through the tools, never through `/memory` itself, and what a
562
+ node must carry to still be worth having.
564
563
 
565
564
  `zen init` writes it, because the projects it scaffolds have memory on from the
566
- first run. Two cases are left to check by hand: a project that turned memory on
567
- afterwards, and one whose copy has drifted from the reference or was deleted.
565
+ first run. `zen check` covers the two cases left over:
568
566
 
569
- Neither is checked by eye. The skill ships the check, and it is one command:
567
+ - `memory.uninstructed` - memory is on and the file is missing or empty.
568
+ - `rules.stale` - any byte differs from what this `zen` ships. The usual drift
569
+ is trailing whitespace inside a table, invisible on screen.
570
570
 
571
- ```sh
572
- .github/skills/zen-memory/scripts/check-instructions.sh # the verdict
573
- .github/skills/zen-memory/scripts/check-instructions.sh diff # every differing line
574
- .github/skills/zen-memory/scripts/check-instructions.sh fix # copy the reference over
575
- ```
576
-
577
- It says whether this project turns memory on at all, exits non-zero on a copy
578
- that is missing or stale, and prints the `cp` that repairs it. When the only
579
- difference is trailing whitespace it says so - that is the usual drift, it is
580
- invisible on screen, and it is the reason reading the two files side by side
581
- never caught it.
582
-
583
- It is a copy, not a transcription - this reference already sits in the project,
584
- because `zen init` and `zen open` write the whole `.github/` tree, and they write
585
- it from the same file the project's copy came from. What `fix` runs, from the
586
- project root, is exactly:
587
-
588
- ```sh
589
- cp .github/skills/zen-memory/references/memory-instructions.md agents/memory-instructions.md
590
- ```
571
+ `zen check --fix` repairs both, writing the file from the version of `zen` in
572
+ hand. Never write or patch it by hand.
591
573
 
592
574
  Everything the project keeps under `agents/` named `<topic>-instructions.md` is
593
575
  prepended to every agent, in filename order, so this belongs in its own document
@@ -598,19 +580,55 @@ memory and it leaves with it.
598
580
 
599
581
  | File | Is | Owned by |
600
582
  | -------------------------------------- | ------------------------------------------------------------------ | ----------- |
601
- | `agents/memory-instructions.md` | the DEFAULT rules - how the store works, and how any agent uses it | this skill |
583
+ | `agents/memory-instructions.md` | the DEFAULT rules - how the store works, and how any agent uses it | `zen` |
602
584
  | `agents/memory-policy-instructions.md` | this PROJECT's customisations on top of them | the project |
603
585
 
604
- **Keep the first a pure copy.** It is predefined: it describes this version of
605
- the runtime, not this project, and `check-instructions.sh` compares it byte for
606
- byte. Anything edited into it is lost the next time the reference changes.
586
+ ### Keep project policy additive
587
+
588
+ `agents/memory-policy-instructions.md` is not a second memory manual and is not
589
+ the default destination for every memory finding. A rule belongs there only
590
+ when it changes how **every memory-enabled agent in this project** uses memory
591
+ and the default rules do not already say it.
592
+
593
+ | The rule is about | Owner |
594
+ | ------------------------------------------------------------------- | ------------------------------------------------------- |
595
+ | How the memory tools and graph work in every Zenera project | the upstream default; never repeat it in project policy |
596
+ | A project-wide restriction or obligation for every memory agent | `agents/memory-policy-instructions.md` |
597
+ | One agent's job, finish condition, recall timing or commit behavior | that agent's prompt |
598
+ | One workflow, index, API or body of domain knowledge | the skill that teaches that workflow or knowledge |
599
+ | One observed case with no repeated pattern yet | the tuning findings, not an instruction |
600
+
601
+ Before adding or changing a project memory rule:
602
+
603
+ 1. Write the intended obligation in one sentence without naming a file.
604
+ 2. Choose its owner from the table above and name the agents that must receive
605
+ it. If that set is smaller than every memory-enabled agent, policy is the
606
+ wrong owner.
607
+ 3. Search the default memory rules, every project policy file, the affected
608
+ prompts and the affected skills for the obligation. Search distinctive
609
+ verbs and nouns plus obvious alternate wording; an exact-text search alone
610
+ does not find semantic duplicates.
611
+ 4. Record one disposition: `edit existing`, `move and delete`, `delete
612
+ contradiction`, or `add because absent`. An addition without this record is
613
+ not ready to apply.
614
+ 5. Make one source authoritative in the same change. Remove weaker copies and
615
+ rewrite a conflicting rule as one complete rule; never preserve the old rule
616
+ and append an exception beneath it.
617
+
618
+ The narrowest source that reliably reaches every intended agent owns the rule.
619
+ Several cases supporting one pattern do not make that pattern global; scope is
620
+ decided by who must obey it, not by how often it failed.
621
+
622
+ **Keep the first untouched.** It is predefined: it describes this version of
623
+ the runtime, not this project, and `zen check` compares it byte for byte.
624
+ Anything edited into it is lost the next time `zen check --fix` runs.
607
625
 
608
626
  Everything a project decides for itself goes in the second - audiences, what
609
627
  must never be written down, what an agent commits at the end of a job, which
610
628
  index a recalled route is checked against. Filename order puts it directly
611
629
  after the defaults, so it reads as the exceptions to them. Then keeping up with
612
- a changed reference is the same one command again, rather than a hand-patch
613
- around prose that has to be preserved.
630
+ a newer `zen` is `zen check --fix` again, rather than a hand-patch around prose
631
+ that has to be preserved.
614
632
 
615
633
  **It must open with the same frontmatter**, or it is prepended to every agent in
616
634
  the project, including the ones with no store to apply it to:
@@ -648,20 +666,24 @@ ranker, the same walk, the same block a model would have been given, scores and
648
666
  all. It is the only one that embeds, and the only one that can distinguish a
649
667
  memory that is missing from a memory that is merely ranked sixth.
650
668
 
651
- | Question | Command |
652
- | ---------------------------------------- | ------------------------------------ |
653
- | Is memory even on, and is it embedded? | `zen memory stats` |
654
- | What has this project learned? | `zen memory export --open` |
655
- | Is this host/flag/path in there at all? | `zen memory grep <pattern>` |
656
- | Everywhere a thing is mentioned | `zen memory grep <pattern> --all` |
657
- | What would an agent recall for this? | `zen memory search <query>` |
658
- | Why did it _not_ recall that? | `zen memory search <q> --audience a` |
659
- | What is in one private slice? | `zen memory ls --audience audit` |
660
- | What has been corrected? | `zen memory ls --stale` |
661
- | What files are being kept? | `zen memory ls --files` |
662
- | One node in full, with what it links to | `zen memory show <id>` |
663
- | Fold parallel warmup graphs into one | `zen memory merge <dir...>` |
664
- | That should never have been written down | `zen memory forget <id>` |
669
+ | Question | Command |
670
+ | ---------------------------------------- | ------------------------------------- |
671
+ | Is memory even on, and is it embedded? | `zen memory stats` |
672
+ | What has this project learned? | `zen memory export --open` |
673
+ | Is this host/flag/path in there at all? | `zen memory grep <pattern>` |
674
+ | Everywhere a thing is mentioned | `zen memory grep <pattern> --all` |
675
+ | What would an agent recall for this? | `zen memory search <query>` |
676
+ | Why did it _not_ recall that? | `zen memory search <q> --audience a` |
677
+ | What is in one private slice? | `zen memory ls --audience audit` |
678
+ | What has been corrected? | `zen memory ls --stale` |
679
+ | What files are being kept? | `zen memory ls --files` |
680
+ | One node in full, with what it links to | `zen memory show <id>` |
681
+ | What did a run add to its copy, or read? | `zen memory diff <base> --dir <copy>` |
682
+ | Fold parallel warmup graphs into one | `zen memory merge <dir...>` |
683
+ | That should never have been written down | `zen memory forget <id>` |
684
+
685
+ Never read a memory's `graph.json` or `manifest.json` with code: every question
686
+ above has a command, and `--json` on any of them is the stable shape.
665
687
 
666
688
  The directory is not fixed. `zen run --memory <dir>` sends one run's memory
667
689
  somewhere else - a scratch graph for a trial, one per branch, or a shared one
@@ -716,10 +738,17 @@ agents:
716
738
 
717
739
  ## Review checklist
718
740
 
719
- - [ ] `.github/skills/zen-memory/scripts/check-instructions.sh` exits zero, so
720
- `agents/memory-instructions.md` is the reference byte for byte - and
741
+ - [ ] `zen check` reports neither `memory.uninstructed` nor `rules.stale`, so
742
+ `agents/memory-instructions.md` is what `zen` ships byte for byte - and
721
743
  project policy lives in `agents/memory-policy-instructions.md`, opening
722
744
  with `requires: [memory]`.
745
+ - [ ] Every project memory-policy rule applies to every memory-enabled agent;
746
+ role-specific rules are in prompts and workflow-specific rules are in
747
+ skills.
748
+ - [ ] For every added or changed policy rule, the review records its one-sentence
749
+ obligation, owner, semantic searches, existing locations and disposition.
750
+ - [ ] No project policy rule restates a default memory rule, and no equivalent
751
+ or softer copy remains in another loaded prompt, skill or policy file.
723
752
  - [ ] `memory.embedding` is set, and was set before the graph had content.
724
753
  - [ ] Every agent that should learn has a `memory:` binding - the top-level
725
754
  block alone enables nothing.
@@ -387,6 +387,7 @@ outline and the copies on disk.
387
387
  zen rag docs list <files|sections|tables> [-d <dir>] [filters…]
388
388
  zen rag docs grep <pattern> [-d <dir>] [filters…]
389
389
  zen rag docs show <file> [--section <name>] [--lines <from-to>]
390
+ zen rag docs show <target>... [--max-lines <n>]
390
391
  zen rag docs stats
391
392
  ```
392
393
 
@@ -411,6 +412,7 @@ zen rag docs grep "Retry-After" # every matching line, and its sec
411
412
  zen rag docs grep "X-RateLimit-\w+" --regex --file "api/**"
412
413
  zen rag docs show api/routing.md --section "Rate limits"
413
414
  zen rag docs show api/routing.md --lines 40-80
415
+ zen rag docs show "api/routing.md:24-31" "api/errors.md#Retries" # several, one call
414
416
  zen rag docs stats
415
417
  ```
416
418
 
@@ -431,6 +433,14 @@ the whole point of it.
431
433
  line-number gutter (`--no-numbers` to drop it). It is the natural follow-up to
432
434
  every search: find the passage, then read what is actually around it.
433
435
 
436
+ **Read every passage you will cite in one `show`.** It takes any number of
437
+ targets written the way a citation is - `<document>:<a>-<b>`, `<document>:<a>`,
438
+ `<document>#<heading>`, or a bare name - and prints each under a header that is
439
+ itself a target, in the order given. Overlapping ranges print once; a missing
440
+ document or heading is reported in place while the rest still print. The
441
+ `--max-lines` budget (default 400) is shared fairly, and a cut block ends with
442
+ the target that continues it. One call per passage costs a whole turn each.
443
+
434
444
  `stats` says what is in an index and what built it - the documents, the counts,
435
445
  the embedding model. It is the fastest way to answer "is this index the one I
436
446
  think it is?".
@@ -443,6 +453,7 @@ think it is?".
443
453
  | _anything you would have run `grep` for_ | `grep` / `list` - never the shell |
444
454
  | "does `X-Request-Id` appear anywhere?" | `grep X-Request-Id` |
445
455
  | "what does the rate-limits section actually say?" | `show <file> --section "Rate limits"` |
456
+ | "read the four passages the search turned up" | `show <doc>:<a>-<b> <doc>:<a>-<b> ...` - once |
446
457
  | "which documents are even in here?" | `list files` |
447
458
  | "what is the shape of this manual?" | `list sections --depth 2` |
448
459
  | "where is the table of per-route limits?" | `list tables --file "api/**"` |
@@ -470,6 +481,7 @@ Add `-d <dir>` when the index is not the nearest one, or name it once with
470
481
  | `grep '^#' file.md` | `zen rag docs list sections --file file.md` |
471
482
  | `sed -n '40,80p' file.md` | `zen rag docs show file.md --lines 40-80` |
472
483
  | `cat file.md` (to find one section) | `zen rag docs show file.md --section "Rate limits"` |
484
+ | a `sed`/`show` per passage | `zen rag docs show a.md:40-80 b.md:12-30` |
473
485
  | `ls` the index directory | `zen rag docs stats` |
474
486
 
475
487
  ```sh
@@ -497,12 +509,12 @@ const index = await docs.DocsIndex.open(
497
509
  const project = await loadProject('./my-project', { tools: docs.docsTools(index) });
498
510
  ```
499
511
 
500
- | Tool | For |
501
- | ------------- | ------------------------------------------------------------ |
502
- | `search_docs` | the passages that match, quoted with their line numbers |
503
- | `list_docs` | the documents, their headings, or their tables - no search |
504
- | `grep_docs` | every matching line, counted in full - no search |
505
- | `read_docs` | a section or a line range, verbatim and with nothing omitted |
512
+ | Tool | For |
513
+ | ------------- | ------------------------------------------------------------------------------------------ |
514
+ | `search_docs` | the passages that match, quoted with their line numbers |
515
+ | `list_docs` | the documents, their headings, or their tables - no search |
516
+ | `grep_docs` | every matching line, counted in full - no search |
517
+ | `read_docs` | a section or a line range, verbatim and with nothing omitted; several at once with `reads` |
506
518
 
507
519
  Only `search_docs` ranks; the other three are exact, because a model told "no
508
520
  results" by a vector search has learned nothing - a ranking returns the top of a
@@ -602,8 +614,8 @@ reference and `guides/` for the task documentation.
602
614
  - Does X exist, how is it spelled, how many are there → `grep_docs`. It is
603
615
  complete; a search is not, and cannot prove absence.
604
616
  - Limits and defaults are in tables → add `kind: ["table_row"]`.
605
- - Then `read_docs` the lines around the hit before answering. Never answer from
606
- the excerpt alone.
617
+ - Then `read_docs` the lines around every hit before answering, all of them in
618
+ one call with `reads`. Never answer from the excerpt alone.
607
619
  - Never `grep`/`rg`/`cat` the tree - the tools above are local and exact.
608
620
 
609
621
  Worked: per-route rate limits are the table under "Rate limits" in
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: zen-review
3
- description: Checking a project before committing - the four mechanical checks `/project-review` makes before any judgement (`zen check`, the §2.5 path sweep, the memory house-rules copy, the spec-sync record), what each one owns, what their exit codes mean, which findings hand off to `zen-instructions`, and what deliberately has no check because no tool can make it. Load before running `/project-review`, before saying a project is ready, and whenever a review finding needs verifying rather than restating.
3
+ description: Checking a project before committing - the three mechanical checks `/project-review` makes before any judgement (`zen check`, the §2.5 path sweep, the spec-sync record), what each one owns, what their exit codes mean, which findings hand off to `zen-instructions`, and what deliberately has no check because no tool can make it. Load before running `/project-review`, before saying a project is ready, and whenever a review finding needs verifying rather than restating.
4
4
  ---
5
5
 
6
6
  # Reviewing a project
@@ -22,17 +22,16 @@ From the project root, or anywhere at all:
22
22
  .github/skills/zen-review/scripts/review.sh
23
23
  ```
24
24
 
25
- It runs four checks in the order a reviewer needs them and prints a summary:
25
+ It runs three checks in the order a reviewer needs them and prints a summary:
26
26
 
27
27
  | Step | Runs | Owns |
28
28
  | ----------- | ------------------------------------------ | -------------------------------------------- |
29
29
  | `zen check` | the CLI | everything decidable about the configuration |
30
30
  | `paths` | `zen-review/scripts/check-paths.sh` | paths a running agent cannot open - §2.5 |
31
- | `memory` | `zen-memory/scripts/check-instructions.sh` | the house-rules copy, byte for byte - §5.3 |
32
31
  | `spec-sync` | `zen-spec-sync/scripts/snapshot.sh status` | whether the record of the last pass is sound |
33
32
 
34
33
  Every step runs even when an earlier one fails, because a review that stops at
35
- the first problem is one somebody has to run four times. The exit code is `1` if
34
+ the first problem is one somebody has to run three times. The exit code is `1` if
36
35
  any step wants attention and `0` if none does. `review.sh fast` passes
37
36
  `--no-models --no-sandbox` to `zen check`, which is the right call while
38
37
  iterating and the wrong one before committing - a key that authenticates says
@@ -41,7 +40,7 @@ nothing about the model id it is spent on.
41
40
  Nothing below matters while `zen check` fails. Report what it said and fix that
42
41
  first.
43
42
 
44
- ## The two scripts this skill ships
43
+ ## The script this skill ships
45
44
 
46
45
  ### `check-paths.sh` - the §2.5 sweep
47
46
 
@@ -58,9 +57,10 @@ to open a file that is not there.
58
57
 
59
58
  It exits `1` whenever it prints a candidate, because the list is meant to be
60
59
  emptied or explained rather than skimmed. It strips urls before tokenising, skips
61
- a handful of English constructions that contain a slash, and leaves
62
- `agents/memory-instructions.md` out entirely - that file is worked examples by
63
- design, and `check-instructions.sh` is the check it actually needs.
60
+ a handful of English constructions that contain a slash, and leaves the four
61
+ copies `zen` ships (`agents/{files,fork,memory,tools}-instructions.md`) out
62
+ entirely - they are worked examples by design, and `zen check` keeps them
63
+ byte-identical (`rules.stale`).
64
64
 
65
65
  Everything it does print is either noise the script has not learned yet or a
66
66
  real finding. There is no third case. A candidate that is genuinely noise is a
@@ -69,29 +69,6 @@ copy sitting in this project.
69
69
 
70
70
  `raw` is the sweep with nothing filtered, for when you suspect the filter.
71
71
 
72
- ### `check-instructions.sh` - the memory house rules
73
-
74
- Lives in the `zen-memory` skill, because it is about memory and it is read at
75
- the moment that skill is:
76
-
77
- ```sh
78
- .github/skills/zen-memory/scripts/check-instructions.sh # the verdict
79
- .github/skills/zen-memory/scripts/check-instructions.sh diff # and every differing line
80
- .github/skills/zen-memory/scripts/check-instructions.sh fix # copy the reference over
81
- ```
82
-
83
- `agents/memory-instructions.md` must be a byte-identical copy of the `zen-memory`
84
- skill's `references/memory-instructions.md`, and the reference is rewritten by
85
- every `zen init` and `zen open`, so the copy goes stale without anyone touching
86
- it. It drifts by **trailing whitespace inside tables**, which is invisible on
87
- screen - this is the check no one should be asked to make by eye. When the
88
- difference is whitespace alone the script says so, because that is the usual
89
- cause and the least believable finding.
90
-
91
- `fix` is the one-line `cp` and nothing else. Project policy belongs in
92
- `agents/memory-policy-instructions.md`, which filename order puts directly after
93
- the copy - see the `zen-memory` skill.
94
-
95
72
  ## Findings that are not yours to fix in place
96
73
 
97
74
  `zen check` reports `rules.stale`, `files.uninstructed`, `memory.uninstructed`,
@@ -43,10 +43,10 @@ strip_urls() {
43
43
  # The three trees §2.5 names, prose only: a skill's own script is code the
44
44
  # sandbox runs, not text rendered into a prompt, and its paths are its own.
45
45
  #
46
- # `agents/memory-instructions.md` is left out on purpose. It is a copy of the
47
- # reference, full of worked examples, so it fails this sweep by design and
48
- # every run of it — and it has a check of its own that a sweep cannot make:
49
- # .github/skills/zen-memory/scripts/check-instructions.sh
46
+ # The four copies `zen` ships (files-, fork-, memory-, tools-instructions.md)
47
+ # are left out on purpose. They are full of worked examples, so they fail this
48
+ # sweep by design, and the project cannot edit them anyway: `zen check` reports
49
+ # any byte that differs as `rules.stale`.
50
50
  files() {
51
51
  {
52
52
  if [ -d agents/prompts ]; then find agents/prompts -type f -name '*.md'; fi
@@ -54,7 +54,7 @@ files() {
54
54
  for file in agents/*instructions.md; do
55
55
  if [ -f "$file" ]; then echo "$file"; fi
56
56
  done
57
- } | grep -v '^agents/memory-instructions\.md$' | sort -u
57
+ } | grep -Ev '^agents/(files|fork|memory|tools)-instructions\.md$' | sort -u
58
58
  }
59
59
 
60
60
  # Every token in those files, urls removed first, and a sentence's full stop
@@ -2,7 +2,7 @@
2
2
  #
3
3
  # Every check a review can make without judgement, in the order it makes them.
4
4
  #
5
- # review.sh zen check, then paths, memory, and the spec-sync record
5
+ # review.sh zen check, then paths and the spec-sync record
6
6
  # review.sh fast the same, with `zen check --no-models --no-sandbox`
7
7
  #
8
8
  # What it prints is findings. What it cannot see — whether an agent has one job,
@@ -10,7 +10,7 @@
10
10
  # the rest of /project-review, and the reason that prompt still exists.
11
11
  #
12
12
  # Every step runs even when an earlier one fails: a review that stops at the
13
- # first problem is one somebody has to run four times. The exit code is 1 if
13
+ # first problem is one somebody has to run three times. The exit code is 1 if
14
14
  # anything wants attention, 0 if nothing does.
15
15
  #
16
16
  # Run it from anywhere; it finds the project root from its own location.
@@ -58,7 +58,7 @@ if command -v zen >/dev/null 2>&1; then
58
58
  verdict 'zen check' "exit $rc — nothing below matters until this passes" 1
59
59
  fi
60
60
  else
61
- echo "zen is not on PATH — install it, or run the other three alone"
61
+ echo "zen is not on PATH — install it, or run the other two alone"
62
62
  verdict 'zen check' 'not run' 1
63
63
  fi
64
64
 
@@ -71,15 +71,6 @@ else
71
71
  verdict 'paths' 'candidates to explain or fix' 1
72
72
  fi
73
73
 
74
- step 'memory'
75
- "$SKILLS/zen-memory/scripts/check-instructions.sh"
76
- rc=$?
77
- if [ "$rc" -eq 0 ]; then
78
- verdict 'memory' 'ok' 0
79
- else
80
- verdict 'memory' 'the house rules are missing or stale' 1
81
- fi
82
-
83
74
  step 'spec-sync'
84
75
  if [ -f SPECIFICATION.md ]; then
85
76
  # `status` reports a tampered baseline rather than failing on one, so the
@@ -18,7 +18,7 @@ and no argv length to overflow.
18
18
 
19
19
  The container engine is **Podman** (rootless by default).
20
20
 
21
- For the CLI subcommands (`zen sandbox status`, `up`, `pull`, `clean`, `disk`)
21
+ For the CLI subcommands (`zen sandbox status`, `top`, `up`, `pull`, `clean`, `disk`)
22
22
  and command-line options, see the [zen-cli skill](../zen-cli/SKILL.md) and its
23
23
  dedicated reference document [sandbox.md](../zen-cli/references/sandbox.md).
24
24
 
@@ -195,7 +195,8 @@ an exit 124 that looks like a slow index.
195
195
  One container is rarely the problem. Before running several at once — a
196
196
  `zen run batch` with `--concurrency` above 1 — load **zen-sandbox-capacity** and
197
197
  run its `preflight_sandbox.sh`, which measures the VM, the container cap and the
198
- index and says whether the arithmetic fits.
198
+ index and says whether the arithmetic fits. A `zen-finetune` run is the
199
+ exception: it starts at `min(maxBatch + recheck, 16)` and halves on OOM instead.
199
200
 
200
201
  ---
201
202
 
@@ -259,9 +260,11 @@ Use the `zen sandbox` commands via terminal to inspect and manage container stat
259
260
 
260
261
  ```sh
261
262
  zen sandbox status # Check podman version, machine status, and active containers
263
+ zen sandbox top --once # Memory and cpu of the machine and every running container
262
264
  zen sandbox up # Start VM (macOS) and pull or build the required image
263
265
  zen sandbox pull # Re-pull base image or force build of sandbox/Dockerfile
264
- zen sandbox clean # Force remove all zn-* containers created by this project
266
+ zen sandbox clean # Force remove all zn-* containers created by this CLI
267
+ zen sandbox clean --idle # Only what no live run uses: stopped and orphaned ones
265
268
  zen sandbox disk # Inspect disk space consumed by images, containers, and volumes
266
269
  ```
267
270
 
@@ -273,4 +276,6 @@ zen sandbox disk # Inspect disk space consumed by images, containers,
273
276
  - **Permission Denied in `/workspace`:**
274
277
  - In `strict` mode without `user:`, rootless Podman uses `keep-id` to preserve host UID. If using custom `user:`, verify host directory permissions allow that UID.
275
278
  - **Disk Space Pressure:**
276
- - Run `zen sandbox clean` to prune stopped session containers.
279
+ - Run `zen sandbox clean --idle` to prune stopped and orphaned session containers.
280
+ - **`could not create container … exceeded num_locks`:**
281
+ - Every container holds one engine lock (2048 by default), stopped ones included. Run `zen sandbox clean --idle`.
@@ -240,14 +240,14 @@ do with the machine.
240
240
 
241
241
  ## A machine spec is part of a round
242
242
 
243
- Record it into the round directory, next to the findings:
243
+ Record it into the run directory, next to the findings:
244
244
 
245
245
  ```sh
246
246
  {
247
247
  echo "host $(($(sysctl -n hw.memsize) / 1073741824)) GiB"
248
248
  podman info --format json | jq -r '.host | "vm \(.memTotal / 1073741824 | floor) GiB · swap \(.swapTotal) · \(.cpus) cpus"'
249
249
  echo "batch --concurrency 8"
250
- } > .finetune/rounds/r5/machine.txt
250
+ } > finetune/runs/batch01-nomem-run1/machine.txt
251
251
  ```
252
252
 
253
253
  The consequence is not bookkeeping, it is validity: **token counts and
@@ -120,10 +120,8 @@ However small the diff:
120
120
  3. **§9 of the copilot instructions, worked as a checklist**, group by group.
121
121
  4. **The capability obligations in §0.1.** For every capability the project has
122
122
  turned on, load that capability's skill and re-check what it requires - in
123
- particular that `agents/memory-instructions.md` is still byte-identical to
124
- `.github/skills/zen-memory/references/memory-instructions.md`. `zen init` and
125
- `zen open` rewrite the reference, so this drifts without anybody editing the
126
- project.
123
+ particular that `zen check` reports no `rules.stale`: a newer `zen` ships
124
+ newer house rules, so they drift without anybody editing the project.
127
125
  5. **`zen-instructions` is loaded before any house rule is touched.** A pass
128
126
  whose scope reaches `agents/*instructions.md` - and input 4 puts it there
129
127
  whenever one of them moved - has to know that `tools-instructions.md`,