@zenera/cli 1.1.22 → 1.1.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +72 -2
- package/dist/archive.d.ts +139 -0
- package/dist/archive.js +376 -0
- package/dist/ask.d.ts +51 -0
- package/dist/ask.js +143 -0
- package/dist/batch.d.ts +77 -0
- package/dist/batch.js +338 -0
- package/dist/command.d.ts +6 -0
- package/dist/commands/export.d.ts +3 -0
- package/dist/commands/export.js +255 -0
- package/dist/commands/import.d.ts +3 -0
- package/dist/commands/import.js +173 -0
- package/dist/commands/index.d.ts +5 -1
- package/dist/commands/index.js +13 -1
- package/dist/commands/inspect.d.ts +11 -0
- package/dist/commands/inspect.js +388 -89
- package/dist/commands/list.js +128 -19
- package/dist/commands/memory.js +453 -16
- package/dist/commands/models.js +14 -2
- package/dist/commands/run.js +139 -34
- package/dist/commands/sandbox.js +72 -1
- package/dist/engine.d.ts +19 -0
- package/dist/engine.js +60 -8
- package/dist/liveness.js +6 -3
- package/dist/main.js +5 -2
- package/dist/podman.d.ts +16 -0
- package/dist/podman.js +115 -2
- package/dist/progress.d.ts +33 -0
- package/dist/progress.js +402 -0
- package/dist/request.d.ts +45 -0
- package/dist/request.js +300 -0
- package/dist/sandbox.js +10 -0
- package/dist/scaffold.d.ts +8 -0
- package/dist/scaffold.js +4 -1
- package/dist/session.d.ts +26 -1
- package/dist/session.js +42 -3
- package/dist/term.d.ts +3 -0
- package/dist/term.js +17 -1
- package/dist/trace.d.ts +84 -0
- package/dist/trace.js +686 -0
- package/dist/validate.js +93 -4
- package/package.json +12 -6
- package/templates/editor/.github/copilot-instructions.md +11 -6
- package/templates/editor/.github/prompts/finetune.prompt.md +251 -0
- package/templates/editor/.github/prompts/spec-sync-project.prompt.md +25 -2
- package/templates/editor/.github/skills/zen-cli/SKILL.md +14 -3
- package/templates/editor/.github/skills/zen-cli/references/check.md +13 -5
- package/templates/editor/.github/skills/zen-cli/references/export.md +107 -0
- package/templates/editor/.github/skills/zen-cli/references/inspect.md +262 -21
- package/templates/editor/.github/skills/zen-cli/references/memory.md +123 -15
- package/templates/editor/.github/skills/zen-cli/references/models.md +1 -1
- package/templates/editor/.github/skills/zen-cli/references/projects.md +12 -5
- package/templates/editor/.github/skills/zen-cli/references/rag.md +6 -0
- package/templates/editor/.github/skills/zen-cli/references/run.md +201 -4
- package/templates/editor/.github/skills/zen-finetune/SKILL.md +1000 -0
- package/templates/editor/.github/skills/zen-finetune/scripts/collect.sh +432 -0
- package/templates/editor/.github/skills/zen-finetune/scripts/sample.sh +199 -0
- package/templates/editor/.github/skills/zen-inspect/SKILL.md +396 -0
- package/templates/editor/.github/skills/zen-memory/SKILL.md +74 -28
- package/templates/editor/.github/skills/zen-memory-warmup/SKILL.md +370 -408
- package/templates/editor/.github/skills/zen-sandbox/SKILL.md +19 -0
- package/templates/editor/.github/skills/zen-sandbox-capacity/SKILL.md +334 -0
- package/templates/editor/.github/skills/zen-sandbox-capacity/references/loadtest.md +181 -0
- package/templates/editor/.github/skills/zen-sandbox-capacity/scripts/preflight_sandbox.sh +457 -0
- package/templates/editor/.github/skills/zen-spec-sync/SKILL.md +6 -5
- package/templates/editor/.vscode/agents.schema.json +1 -1
- package/templates/editor/.vscode/settings.json +1 -0
- package/templates/project/SPECIFICATION.md.tmpl +2 -0
- package/templates/project/agents/files-instructions.md +13 -0
- package/templates/project/agents/fork-instructions.md +27 -0
- package/templates/project/agents/memory-instructions.md +80 -7
- package/templates/project/gitignore +3 -0
- package/templates/project/scripts/_setup.sh +49 -7
|
@@ -7,7 +7,8 @@ requires: [memory]
|
|
|
7
7
|
This project has a memory: a graph of what earlier runs worked out, kept with
|
|
8
8
|
the project rather than with the session, and shared with every other agent that
|
|
9
9
|
can see it. It is reached **only** through the `memory_*` tools - `memory_search`
|
|
10
|
-
to find, `memory_load` to
|
|
10
|
+
to find by meaning, `memory_grep` to find an exact string, `memory_load` to
|
|
11
|
+
read.
|
|
11
12
|
|
|
12
13
|
Not every agent may write to it. Read what follows against the tools you
|
|
13
14
|
actually have: if `memory_commit` is not among them, everything under
|
|
@@ -99,8 +100,9 @@ its own source.
|
|
|
99
100
|
## Reading it
|
|
100
101
|
|
|
101
102
|
`memory_search` hands back an outline of a subgraph with each node's text cut to
|
|
102
|
-
160 characters. `
|
|
103
|
-
|
|
103
|
+
160 characters. `memory_grep` hands back the nodes containing an exact string,
|
|
104
|
+
with the lines it matched on. `memory_load` is what reads a node whole, by id -
|
|
105
|
+
load anything you are going to rely on.
|
|
104
106
|
|
|
105
107
|
### The shape of a recollection
|
|
106
108
|
|
|
@@ -133,13 +135,18 @@ at that path through `memory_load`, never by looking around in the directory.
|
|
|
133
135
|
`vectors.json` and `manifest.json` - its internal format. Do not open, list,
|
|
134
136
|
grep, `cat` or `find` them, and do not point a shell command at that directory:
|
|
135
137
|
|
|
136
|
-
- it is ranked by **meaning**, so substring matching misses the hits;
|
|
137
138
|
- `graph.json` is every node ever committed, as one line;
|
|
138
139
|
- a raw read bypasses the audience mask and serves **superseded** nodes -
|
|
139
140
|
corrections that were withdrawn - as if they were current;
|
|
140
141
|
- it records no use, so the ranking that decides what gets recalled next decays;
|
|
141
142
|
- another run may be writing, and the manifest is written last.
|
|
142
143
|
|
|
144
|
+
**`memory_grep` is that search, done properly.** It reads every node exactly -
|
|
145
|
+
the text, the metadata and the bytes of remembered files - and hands back the
|
|
146
|
+
matching lines with the node they belong to. It applies the mask, it leaves out
|
|
147
|
+
what has been superseded unless you ask for it, and it names any file it could
|
|
148
|
+
not read, so a file that went unsearched never passes for one with no match.
|
|
149
|
+
|
|
143
150
|
A memory is a record, not an authority - but checking one is not the same as
|
|
144
151
|
redoing it. Every node names where its content came from, so confirm the
|
|
145
152
|
recollection there: the named lines still say what the node says, the route
|
|
@@ -148,6 +155,31 @@ that check fails, when the source is one that changes under you, or when being
|
|
|
148
155
|
wrong is expensive. A check that costs what the original investigation cost is
|
|
149
156
|
not a check - it is the investigation again, and the memory bought nothing.
|
|
150
157
|
|
|
158
|
+
### None of it appears in an answer
|
|
159
|
+
|
|
160
|
+
The store is your apparatus, not your subject. An answer says what was found and
|
|
161
|
+
where it can be checked - the sources, the commands, the files the work left
|
|
162
|
+
behind. It never says that a recollection was what put you on to them.
|
|
163
|
+
|
|
164
|
+
Never write `/memory`, a node id, or the words "memory", "recalled" or
|
|
165
|
+
"remembered" into an answer. Read your text before you send it: if it holds
|
|
166
|
+
`/memory` or a node id, cut the sentence around it and say what was done
|
|
167
|
+
instead. "Loaded the script from memory (`/memory/01J….py`) and ran it" is
|
|
168
|
+
"ran `<path>`" with your working left in by mistake.
|
|
169
|
+
|
|
170
|
+
Two reasons, and both hold even where the reader would find it interesting. A
|
|
171
|
+
node id names nothing the reader can open, so it reads as a citation and cannot
|
|
172
|
+
be followed; and it stops being true the moment the node is superseded, while
|
|
173
|
+
the source it was drawn from does not. Cite the source, never the memory of it.
|
|
174
|
+
|
|
175
|
+
This binds on a branch's answer exactly as it binds on the final one. A branch
|
|
176
|
+
rejoins as a single result that the agent above writes its own answer from, so
|
|
177
|
+
an id that survives the join is an id in the reply.
|
|
178
|
+
|
|
179
|
+
The one exception is a question about the store itself - what is known about
|
|
180
|
+
something, whether it was seen before, what to forget. Then it is the subject,
|
|
181
|
+
and ids are what the reader needs.
|
|
182
|
+
|
|
151
183
|
## Searching it
|
|
152
184
|
|
|
153
185
|
Search **before** paying for anything: an investigation, an index query, a
|
|
@@ -177,8 +209,32 @@ would use - node texts are written to be found that way. Narrow with `kinds`,
|
|
|
177
209
|
`newer_than`, `limit`, `max_hops` and `max_nodes` when a recollection comes back
|
|
178
210
|
broad rather than wrong.
|
|
179
211
|
|
|
212
|
+
### Which of the two
|
|
213
|
+
|
|
214
|
+
`memory_search` ranks, so it returns what is closest and stops. That makes it
|
|
215
|
+
right for a question and wrong for a fact about the store itself: when nothing
|
|
216
|
+
comes back, you cannot tell whether the memory is empty on the subject or
|
|
217
|
+
merely worded differently.
|
|
218
|
+
|
|
219
|
+
`memory_grep` is exact and complete. Reach for it when the thing you are looking
|
|
220
|
+
for is a **string** rather than a subject, and when the answer has to be all of
|
|
221
|
+
them:
|
|
222
|
+
|
|
223
|
+
| Looking for | Use |
|
|
224
|
+
| --------------------------------------------------------------- | --------------- |
|
|
225
|
+
| what was learned about a subject, however it was phrased | `memory_search` |
|
|
226
|
+
| a name, path, id, host, flag or command, spelled exactly | `memory_grep` |
|
|
227
|
+
| whether something was already written down at all | `memory_grep` |
|
|
228
|
+
| everywhere a thing is mentioned, before changing or retiring it | `memory_grep` |
|
|
229
|
+
| a starting point, when you do not yet know the vocabulary | `memory_search` |
|
|
230
|
+
|
|
231
|
+
Either way, ids from one are ids for the other: grep a name, then `memory_load`
|
|
232
|
+
what it turned up.
|
|
233
|
+
|
|
180
234
|
Recalling nothing is not proof of anything: work it out normally, then commit
|
|
181
|
-
the result so the next run does not repeat it.
|
|
235
|
+
the result so the next run does not repeat it. A `memory_grep` that found
|
|
236
|
+
nothing is stronger - it means the string is not there - but it says nothing
|
|
237
|
+
about the subject under another name.
|
|
182
238
|
|
|
183
239
|
## Updating it
|
|
184
240
|
|
|
@@ -199,6 +255,12 @@ five paths.
|
|
|
199
255
|
| The passage itself, when its source cannot change under you | A passage quoted out of something that can |
|
|
200
256
|
| A proven absence - looked here and here, it is not there | Anything not actually verified |
|
|
201
257
|
|
|
258
|
+
A restatement is not merely wasted space. Recall seeds on text alone, so a run
|
|
259
|
+
that commits its own request as a task, a plan and a result has committed three
|
|
260
|
+
near-copies of one sentence - and on the next similar question those three take
|
|
261
|
+
the seed slots between them. Everything actually learned then ranks below them
|
|
262
|
+
and is never reached.
|
|
263
|
+
|
|
202
264
|
A search over a schema or a documentation index costs a round trip and comes
|
|
203
265
|
back ranked, so it is the thing most worth not paying for twice. Commit what it
|
|
204
266
|
**resolved to** - the operation and its shape, or the document, heading and line
|
|
@@ -270,6 +332,17 @@ already in memory says is folded into it, and its existing id comes back under
|
|
|
270
332
|
your ref - so the links you asked for still land, on the memory that was already
|
|
271
333
|
there.
|
|
272
334
|
|
|
335
|
+
**Grep for an entity before minting a node for it.** An endpoint, a command, a
|
|
336
|
+
host, a tool, a file - anything that recurs across runs is one node the rest of
|
|
337
|
+
the graph hangs off, and folding by similarity will not catch a second copy
|
|
338
|
+
worded differently. `memory_grep` the exact string first, and attach your edges
|
|
339
|
+
to what comes back.
|
|
340
|
+
|
|
341
|
+
A duplicated hub is worse than a missing one. It splits the graph into islands:
|
|
342
|
+
the question reaches one copy, the artifact that answers it hangs off another,
|
|
343
|
+
and the walk out from a seed cannot cross between them - so a memory that is
|
|
344
|
+
present returns nothing, and nothing in the recollection says it happened.
|
|
345
|
+
|
|
273
346
|
**Say where the content came from.** This is what lets an incomplete
|
|
274
347
|
recollection be continued instead of believed:
|
|
275
348
|
|
|
@@ -305,8 +378,8 @@ whole of what you know is one line long.
|
|
|
305
378
|
**The file must exist in the workspace first.** `memory_commit` copies an
|
|
306
379
|
existing file from the workspace; it is not an upload channel and does not
|
|
307
380
|
write file contents from raw arguments. Write the file to the workspace first
|
|
308
|
-
(using `write_file`, `apply_patch`, or a command saving under
|
|
309
|
-
then pass its workspace path (e.g. `"file": "report.py"` or
|
|
381
|
+
(using `write_file`, `apply_patch`, `copy_file`, or a command saving under
|
|
382
|
+
`/workspace`), then pass its workspace path (e.g. `"file": "report.py"` or
|
|
310
383
|
`"file": "/workspace/report.py"`).
|
|
311
384
|
|
|
312
385
|
| Which files to commit | What belongs in them |
|
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
# None of it is source.
|
|
3
3
|
sessions/
|
|
4
4
|
|
|
5
|
+
# The same, one level up: a batch's workspaces, memory copies and answers.
|
|
6
|
+
batches/
|
|
7
|
+
|
|
5
8
|
# Memory is worth keeping: `graph.json`, `files/` and the vectors are what the
|
|
6
9
|
# agents learned. The vectors are binary, but nothing rebuilds them from the
|
|
7
10
|
# graph, so a clone without them recalls by term overlap until every node is
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
#
|
|
5
5
|
# scripts/_setup.sh do whatever is not done yet
|
|
6
6
|
# scripts/_setup.sh --force do all of it again
|
|
7
|
+
# scripts/_setup.sh --check say what is not done, and do none of it
|
|
7
8
|
#
|
|
8
9
|
# Anything that has to be in place before a run — an index built, a document
|
|
9
10
|
# fetched, a file generated — is a script in this directory rather than a
|
|
@@ -17,6 +18,11 @@
|
|
|
17
18
|
# - takes no arguments, and reads $FORCE to know whether to redo finished work
|
|
18
19
|
# - exits 0 when it did the work, 3 when there was nothing to do, non-zero
|
|
19
20
|
# when it failed
|
|
21
|
+
# - under $CHECK, does none of the work: it runs the same "already done" test,
|
|
22
|
+
# exits 3 when the answer is yes, and otherwise says what is missing and
|
|
23
|
+
# exits 4. A check must not assume an earlier step has run — a missing
|
|
24
|
+
# prerequisite is a 4 of its own, not a hard failure, or one unbuilt thing
|
|
25
|
+
# hides the rest of the list
|
|
20
26
|
# - writes under .tmp/ and moves the result into place, so an interrupted run
|
|
21
27
|
# never leaves half an artefact behind
|
|
22
28
|
#
|
|
@@ -27,6 +33,10 @@
|
|
|
27
33
|
# first search fails for a reason nobody connects to setup. Ask the tool instead
|
|
28
34
|
# of guessing at files — `zen rag docs ready` answers exactly that question.
|
|
29
35
|
#
|
|
36
|
+
# That test is the whole of `--check`, which is why this is one script and not
|
|
37
|
+
# two: the steps already know what "done" means, and a second script asking the
|
|
38
|
+
# same question would be a second answer to keep in step with this one.
|
|
39
|
+
#
|
|
30
40
|
# Running this twice has to be safe, and the second run is what proves it: every
|
|
31
41
|
# step should report `skipped`.
|
|
32
42
|
|
|
@@ -34,10 +44,17 @@ set -eu
|
|
|
34
44
|
cd "$(dirname "$0")/.."
|
|
35
45
|
|
|
36
46
|
FORCE=0
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
47
|
+
CHECK=0
|
|
48
|
+
case "${1:-}" in
|
|
49
|
+
'') ;;
|
|
50
|
+
--force) FORCE=1 ;;
|
|
51
|
+
--check) CHECK=1 ;;
|
|
52
|
+
*)
|
|
53
|
+
echo "usage: scripts/_setup.sh [--force|--check]" >&2
|
|
54
|
+
exit 2
|
|
55
|
+
;;
|
|
56
|
+
esac
|
|
57
|
+
export FORCE CHECK
|
|
41
58
|
|
|
42
59
|
LOGS=.tmp/logs
|
|
43
60
|
|
|
@@ -58,6 +75,12 @@ LOGS=.tmp/logs
|
|
|
58
75
|
# echo "$OUT is already built"
|
|
59
76
|
# exit 3
|
|
60
77
|
# fi
|
|
78
|
+
# if [ "${CHECK:-0}" = 1 ]; then
|
|
79
|
+
# # Without --quiet it names what is missing and the command that fixes
|
|
80
|
+
# # it; `|| true` because not-ready is the exit code we came for.
|
|
81
|
+
# zen rag docs ready --dir "$OUT" || true
|
|
82
|
+
# exit 4
|
|
83
|
+
# fi
|
|
61
84
|
# # Committed index, git-ignored vectors: re-embed from the copies the index
|
|
62
85
|
# # already holds rather than indexing the documents over again.
|
|
63
86
|
# if [ "${FORCE:-0}" = 0 ] && [ -f "$OUT/manifest.json" ]; then
|
|
@@ -80,9 +103,16 @@ fi
|
|
|
80
103
|
mkdir -p "$LOGS"
|
|
81
104
|
summary=""
|
|
82
105
|
failed=0
|
|
106
|
+
pending=0
|
|
83
107
|
|
|
84
108
|
for name in $STEPS; do
|
|
85
|
-
log
|
|
109
|
+
# A dry run keeps its own log: overwriting the build's would lose the
|
|
110
|
+
# record of the build to a question about it.
|
|
111
|
+
if [ "$CHECK" = 1 ]; then
|
|
112
|
+
log="$LOGS/check-$name.log"
|
|
113
|
+
else
|
|
114
|
+
log="$LOGS/setup-$name.log"
|
|
115
|
+
fi
|
|
86
116
|
echo
|
|
87
117
|
echo "-- $name $(date '+%H:%M:%S') ($log)"
|
|
88
118
|
|
|
@@ -96,6 +126,10 @@ for name in $STEPS; do
|
|
|
96
126
|
case "$code" in
|
|
97
127
|
0) word=ok ;;
|
|
98
128
|
3) word=skipped ;;
|
|
129
|
+
4)
|
|
130
|
+
word="needs setup"
|
|
131
|
+
pending=1
|
|
132
|
+
;;
|
|
99
133
|
*)
|
|
100
134
|
word="failed ($code)"
|
|
101
135
|
failed=1
|
|
@@ -105,12 +139,20 @@ for name in $STEPS; do
|
|
|
105
139
|
"
|
|
106
140
|
# Later steps depend on earlier ones, so a failure stops rather than
|
|
107
141
|
# producing a second failure that is only a consequence of the first.
|
|
142
|
+
# `needs setup` does not stop it: the point of asking is the whole list.
|
|
108
143
|
if [ "$failed" = 1 ]; then
|
|
109
144
|
break
|
|
110
145
|
fi
|
|
111
146
|
done
|
|
112
147
|
|
|
113
148
|
echo
|
|
114
|
-
|
|
149
|
+
if [ "$CHECK" = 1 ]; then
|
|
150
|
+
echo "setup check:"
|
|
151
|
+
else
|
|
152
|
+
echo "setup:"
|
|
153
|
+
fi
|
|
115
154
|
printf '%s' "$summary"
|
|
116
|
-
|
|
155
|
+
if [ "$failed" = 1 ] || [ "$pending" = 1 ]; then
|
|
156
|
+
exit 1
|
|
157
|
+
fi
|
|
158
|
+
exit 0
|