@zenera/cli 1.1.25 → 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 (96) hide show
  1. package/README.md +13 -1
  2. package/dist/catalog.d.ts +20 -0
  3. package/dist/catalog.js +60 -0
  4. package/dist/commands/index.js +2 -0
  5. package/dist/commands/inspect.d.ts +5 -1
  6. package/dist/commands/inspect.js +54 -14
  7. package/dist/commands/memory.js +28 -3
  8. package/dist/commands/meta.js +24 -5
  9. package/dist/commands/models.js +2 -1
  10. package/dist/commands/sandbox.js +73 -3
  11. package/dist/commands/view.d.ts +8 -0
  12. package/dist/commands/view.js +114 -0
  13. package/dist/engine.d.ts +3 -1
  14. package/dist/engine.js +6 -0
  15. package/dist/eventlog.d.ts +5 -0
  16. package/dist/eventlog.js +25 -1
  17. package/dist/liveness.js +20 -2
  18. package/dist/main.js +0 -0
  19. package/dist/meta/editor.d.ts +1 -1
  20. package/dist/meta/editor.js +4 -21
  21. package/dist/meta/finetune/analyze-brief.d.ts +26 -0
  22. package/dist/meta/finetune/analyze-brief.js +131 -0
  23. package/dist/meta/finetune/apply-brief.d.ts +23 -0
  24. package/dist/meta/finetune/apply-brief.js +247 -0
  25. package/dist/meta/finetune/brief.d.ts +45 -0
  26. package/dist/meta/finetune/brief.js +158 -0
  27. package/dist/meta/finetune/command.d.ts +1 -1
  28. package/dist/meta/finetune/command.js +224 -46
  29. package/dist/meta/finetune/cost.d.ts +46 -0
  30. package/dist/meta/finetune/cost.js +105 -0
  31. package/dist/meta/finetune/dataset/types.d.ts +3 -1
  32. package/dist/meta/finetune/feedback.d.ts +14 -2
  33. package/dist/meta/finetune/feedback.js +22 -3
  34. package/dist/meta/finetune/guard.d.ts +29 -0
  35. package/dist/meta/finetune/guard.js +104 -0
  36. package/dist/meta/finetune/improvements.d.ts +50 -3
  37. package/dist/meta/finetune/improvements.js +290 -33
  38. package/dist/meta/finetune/live.d.ts +17 -7
  39. package/dist/meta/finetune/live.js +56 -10
  40. package/dist/meta/finetune/loop.js +59 -10
  41. package/dist/meta/finetune/recheck.d.ts +58 -0
  42. package/dist/meta/finetune/recheck.js +311 -0
  43. package/dist/meta/finetune/report.d.ts +9 -2
  44. package/dist/meta/finetune/report.js +551 -438
  45. package/dist/meta/finetune/sampler.js +8 -2
  46. package/dist/meta/finetune/train.d.ts +6 -2
  47. package/dist/meta/finetune/train.js +55 -21
  48. package/dist/meta/finetune/tui.d.ts +3 -3
  49. package/dist/meta/finetune/tui.js +37 -12
  50. package/dist/meta/finetune/tuning.d.ts +27 -1
  51. package/dist/meta/finetune/tuning.js +21 -2
  52. package/dist/meta/finetune/usage.d.ts +4 -0
  53. package/dist/meta/finetune/usage.js +35 -0
  54. package/dist/meta/finetune/view.d.ts +9 -0
  55. package/dist/meta/finetune/view.js +27 -0
  56. package/dist/meta/host.d.ts +2 -1
  57. package/dist/meta/host.js +2 -1
  58. package/dist/meta.d.ts +291 -0
  59. package/dist/meta.js +981 -0
  60. package/dist/resources.d.ts +215 -0
  61. package/dist/resources.js +856 -0
  62. package/dist/scaffold.d.ts +3 -4
  63. package/dist/scaffold.js +21 -9
  64. package/dist/trace.d.ts +5 -0
  65. package/dist/trace.js +54 -5
  66. package/dist/tui/app.js +19 -5
  67. package/dist/tui/links.d.ts +27 -0
  68. package/dist/tui/links.js +142 -0
  69. package/dist/tui/models.d.ts +3 -1
  70. package/dist/tui/models.js +65 -7
  71. package/dist/tui/sandbox.d.ts +10 -0
  72. package/dist/tui/sandbox.js +131 -0
  73. package/package.json +3 -2
  74. package/templates/editor/.github/copilot-instructions.md +29 -43
  75. package/templates/editor/.github/prompts/analyze.prompt.md +3 -1
  76. package/templates/editor/.github/prompts/finetune-apply.prompt.md +221 -42
  77. package/templates/editor/.github/prompts/project-review.prompt.md +1 -1
  78. package/templates/editor/.github/skills/zen-analyze-run/SKILL.md +162 -57
  79. package/templates/editor/.github/skills/zen-cli/references/finetune.md +74 -14
  80. package/templates/editor/.github/skills/zen-cli/references/inspect.md +16 -2
  81. package/templates/editor/.github/skills/zen-cli/references/projects.md +4 -6
  82. package/templates/editor/.github/skills/zen-cli/references/sandbox.md +25 -13
  83. package/templates/editor/.github/skills/zen-finetune/SKILL.md +74 -33
  84. package/templates/editor/.github/skills/zen-inspect/SKILL.md +14 -1
  85. package/templates/editor/.github/skills/zen-inspect-ask/SKILL.md +4 -3
  86. package/templates/editor/.github/skills/zen-instructions/SKILL.md +4 -12
  87. package/templates/editor/.github/skills/zen-memory/SKILL.md +64 -39
  88. package/templates/editor/.github/skills/zen-review/SKILL.md +6 -31
  89. package/templates/editor/.github/skills/zen-review/scripts/check-paths.sh +1 -2
  90. package/templates/editor/.github/skills/zen-review/scripts/review.sh +3 -12
  91. package/templates/editor/.github/skills/zen-sandbox/SKILL.md +2 -1
  92. package/templates/editor/.github/skills/zen-spec-sync/SKILL.md +2 -4
  93. package/templates/project/agents/fork-instructions.md +78 -28
  94. package/templates/project/agents/memory-instructions.md +222 -493
  95. package/templates/project/agents/tools-instructions.md +7 -0
  96. package/templates/editor/.github/skills/zen-memory/scripts/check-instructions.sh +0 -116
@@ -45,34 +45,31 @@ Every `fork` call takes an array under `branches`, even for a single branch:
45
45
  Never pass branch fields (`name`, `instructions`, `agent`) at the top level of
46
46
  the tool call.
47
47
 
48
- Do not fork a sequence. Branches run at once and can exchange nothing, so a step
49
- that needs the step before it has to stay in this conversation.
50
-
51
48
  ## When the assignment is yours
52
49
 
53
50
  These rules reach a branch as well as the agent that forked it, and a branch
54
- arrives in the middle of someone else's sentence. Your assignment comes to you
55
- as the result of a `fork` call, because that is how the runtime delivers it —
56
- and that is indistinguishable, in a transcript, from a fork you made yourself
57
- coming back with an answer.
51
+ arrives in the middle of someone else's sentence. Under `inherit` or `compact`
52
+ your assignment comes to you as the result of a `fork` call, because that is how
53
+ the runtime delivers it — and that is indistinguishable, in a transcript, from a
54
+ fork you made yourself coming back with an answer.
58
55
 
59
56
  It is not one. When a message begins "You are branch ... of the fork above", you
60
- are that branch and that text is your assignment:
57
+ are that branch and that text is your assignment. Under `none` there is no such
58
+ message, only the instructions as the first message of the conversation; when
59
+ they say you are a branch, the same holds:
61
60
 
62
61
  - **Nothing has run yet.** There is no result in it and nothing to verify. The
63
62
  fork it names is above in the conversation you were forked out of, which is
64
63
  not the one you are in — yours begins with that message.
65
- - **Do the work yourself.** Never fork a branch to carry out the assignment you
66
- were handed: that branch is you one level down holding the same instructions,
64
+ - **Do the work yourself.** Never fork one branch holding your whole
65
+ assignment: that branch is you one level down holding the same instructions,
67
66
  it will read them the same way, and each level spends a whole system prompt to
68
67
  arrive back where it started. At the depth cap the tool is withdrawn and the
69
- work comes back undone.
68
+ work comes back undone. If the assignment names two or more independent
69
+ deliverables, fork one branch for each, or do them all yourself.
70
70
  - **Do not go looking for proof it was already done.** An empty workspace is
71
71
  what an unstarted job looks like, not a sign that something failed upstream.
72
72
 
73
- Fork from inside a branch only for work that is genuinely divisible further and
74
- that you were not handed already divided.
75
-
76
73
  ## When it is worth it
77
74
 
78
75
  One question decides it: **could this be finished by someone who cannot ask you
@@ -82,7 +79,7 @@ no, the work stays here.
82
79
  | The work in front of you | What it is |
83
80
  | -------------------------------------------------------------------------------------------- | -------------------------------------------------------- |
84
81
  | The same question asked of twenty things — files, endpoints, regions, candidate fixes | A fan-out: one branch each, merged by you |
85
- | One task whose parts need different skills and none of them the others | A fan-out too: each branch on the agent that fits |
82
+ | One task whose parts need different skills and no part needs another's result to start | A fan-out too: each branch on the agent that fits |
86
83
  | A job another agent is plainly better at | Delegation: one branch, on that agent |
87
84
  | Long and noisy with a short verdict — a build loop, a bisect, a survey that may find nothing | Delegation: you get the verdict, not the noise |
88
85
  | Find the config, then change it, then test it | Not a fork. Each step needs the one before it |
@@ -92,6 +89,36 @@ no, the work stays here.
92
89
  | The assignment you were handed, whole | Not a fork. It is yours — see above |
93
90
  | Two jobs that would write the same file | Not a fork until they write different files — see below |
94
91
 
92
+ Do not fork a sequence. Branches run at once and can exchange nothing, so a step
93
+ that needs the step before it has to stay in this conversation. A step depends
94
+ on another only when it cannot be _written_ without that result. When that
95
+ result can only be one of a few values known in advance, it is not a
96
+ dependency: fork the step now for all of them, have it return its result keyed
97
+ by value, and keep the one that applies after the join.
98
+
99
+ Before a one-branch `fork`, list what the request asks you to hand back. If two
100
+ or more of those items are independent — none needs another's result, and each
101
+ takes more than one call — give each its own branch in the same call.
102
+
103
+ ## Hand-off or fork
104
+
105
+ Both reach another agent; they differ in who holds the conversation afterwards.
106
+
107
+ | | `transfer_to_<agent>` | `fork` |
108
+ | ----------------- | --------------------------------------------------------------------- | -------------------------------------------------- |
109
+ | Control | moves to the other agent and stays there; it answers every later turn | comes back to you at the join |
110
+ | What it sees | this whole conversation, every tool result included | what `context` gives it, plus your instructions |
111
+ | What you get back | nothing; you are done | its final message |
112
+ | Parallel | no, one agent at a time | yes, one branch per part |
113
+ | Cost | the whole transcript on every call it makes from now on; no merge | each branch's own context, plus your turn to merge |
114
+
115
+ Hand off when the rest of the conversation belongs to the other agent: the
116
+ user's next question will be in its domain too, and you have nothing to add to
117
+ its answer. Fork when you need the result back — to combine it with other parts,
118
+ check it, or keep the conversation yourself. A request with two or more
119
+ independent deliverables is a fork, even when one agent could do all of them: a
120
+ hand-off cannot fan out and cannot come back.
121
+
95
122
  ## Fanning out
96
123
 
97
124
  Branches run at the same time, so a fan-out costs about as long as its slowest
@@ -139,30 +166,54 @@ whatever that branch needs, because a sibling's finding will never reach it.
139
166
  ## Choosing `context`
140
167
 
141
168
  `context` decides what each branch starts from. It is one setting for the whole
142
- call, chosen per call:
169
+ call, chosen per call; leave it out and you get `inherit`, the most expensive:
143
170
 
144
171
  - `inherit` — everything said here so far. For work that only makes sense
145
172
  against the case as it stands: reviewing what has just been written here,
146
173
  continuing an investigation whose earlier findings are the thing being built
147
174
  on.
148
- - `compact` — the same, without the tool traffic: what was decided, not how it
149
- was found out. The usual choice for a wide fan-out, where branches need the
150
- case and the plan but not the fifty reads that produced them.
175
+ - `compact` — the same, without tool calls, tool results or memory recalls:
176
+ what was decided, not how it was found out. The usual choice for a wide
177
+ fan-out, where branches need the case and the plan but not the fifty reads
178
+ that produced them.
151
179
  - `none` — nothing but its own instructions. The cheapest, and the honest one
152
180
  when the assignment is self-contained: a lookup, one file summarised, a
153
181
  command run elsewhere. Everything the branch needs must then be written out in
154
182
  the instructions, paths included.
155
183
 
156
- When two modes seem possible, write the missing facts into the instructions and
157
- take the cheaper one. Instructions are exact; an inherited transcript is only
158
- approximately about the branch's job.
184
+ | What the branch starts with | `inherit` | `compact` | `none` |
185
+ | -------------------------------------------------- | ------------------------------------ | --------- | ------------------------------------------- |
186
+ | Its own agent's system prompt and tools | yes | yes | yes |
187
+ | The user's request and the messages here | yes | yes | no |
188
+ | Tool calls, tool results, memory recalls | yes | no | no |
189
+ | Results of earlier forks | yes | yes | no |
190
+ | Skills loaded here | only if it runs on your agent | the same | no |
191
+ | Your whole `fork` call, siblings' instructions too | yes | yes | no |
192
+ | A fresh memory recall on its instructions | no | no | if its agent recalls automatically |
193
+ | How its assignment arrives | "You are branch ...", siblings named | the same | your instructions alone, as a plain message |
194
+
195
+ A `none` branch is never told it is a branch. Its instructions must say so, what
196
+ to return, and that only its final message comes back.
197
+
198
+ When two modes seem possible, or branches would each want a different one, write
199
+ the missing facts into the instructions and take the cheaper one. Instructions
200
+ are exact; an inherited transcript is only approximately about the branch's job.
201
+
202
+ Under `inherit` or `compact` a branch sees the user's whole request and will
203
+ take all of it as its own. When it gets only part, its instructions must name
204
+ the parts it does not own.
159
205
 
160
206
  ## What comes back, and what stays
161
207
 
162
- Only the answer comes back, and it is prose. Everything else a branch does is
163
- real and outlasts it: branches share this workspace with you and with each
164
- other, so a file one of them writes is a file you can read after the join, and
165
- anything committed to memory is there for every later run.
208
+ Everything a branch does besides its answer is real and outlasts it: branches
209
+ share this workspace with you and with each other, so a file one of them writes
210
+ is a file you can read after the join, and anything committed to memory is there
211
+ for every later run.
212
+
213
+ The join is one result for your `fork` call: a `### name (status)` block per
214
+ branch, in the order you declared them, each holding that branch's last message
215
+ or, if it failed, its error. Anything a branch said before its last message is
216
+ not in it.
166
217
 
167
218
  So decide, for each branch, which of the two carries its result:
168
219
 
@@ -187,8 +238,7 @@ builds, two branches reformatting the same tree.
187
238
 
188
239
  ## When a branch comes back wrong
189
240
 
190
- Each branch reports under its own name, with its status, and a failed one says
191
- why. What the final answer is remains your decision, not the join's.
241
+ What the final answer is remains your decision, not the join's.
192
242
 
193
243
  A branch rarely fails at random; the usual cause is an assignment missing
194
244
  something it could not ask for. Re-running the same instructions gets the same