@zenera/cli 1.3.1 → 1.3.2
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/dist/commands/key.js +15 -1
- package/dist/lib.d.ts +1 -0
- package/dist/lib.js +1 -0
- package/package.json +6 -6
- package/templates/editor/.github/copilot-instructions.md +12 -48
- package/templates/editor/.github/skills/project-review/SKILL.md +8 -73
- package/templates/editor/.github/skills/zen-cli/references/meta.md +4 -0
- package/templates/editor/.github/skills/zen-review/SKILL.md +164 -53
- package/templates/editor/.github/skills/zen-review/scripts/review.sh +53 -27
package/dist/commands/key.js
CHANGED
|
@@ -634,7 +634,21 @@ const token = async (ctx, args) => {
|
|
|
634
634
|
keyFile: store.fileOf(entry),
|
|
635
635
|
scopes: ['https://www.googleapis.com/auth/cloud-platform'],
|
|
636
636
|
});
|
|
637
|
-
const
|
|
637
|
+
const client = await auth.getClient();
|
|
638
|
+
// Called before every request of a long session, so one network blip must not fail it.
|
|
639
|
+
let access = {};
|
|
640
|
+
for (let attempt = 0;; attempt++) {
|
|
641
|
+
try {
|
|
642
|
+
access = await client.getAccessToken();
|
|
643
|
+
break;
|
|
644
|
+
}
|
|
645
|
+
catch (err) {
|
|
646
|
+
if (attempt >= 2) {
|
|
647
|
+
throw err;
|
|
648
|
+
}
|
|
649
|
+
await new Promise((done) => setTimeout(done, 500 * 2 ** attempt));
|
|
650
|
+
}
|
|
651
|
+
}
|
|
638
652
|
if (!access.token) {
|
|
639
653
|
throw credentialError(`${keyId(entry)} minted no token`, 'check the service account is still enabled');
|
|
640
654
|
}
|
package/dist/lib.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ export { formatBlocks, formatInline, formatMarkdown, wrapSpans } from './tui/mar
|
|
|
11
11
|
export { matching, projectNames, type Candidate } from './candidates.ts';
|
|
12
12
|
export { editorFiles } from './editor.ts';
|
|
13
13
|
export { copilotEventLog, type EventLine } from './eventlog.ts';
|
|
14
|
+
export { History } from './history.ts';
|
|
14
15
|
export { probeChat, probeModel } from './liveness.ts';
|
|
15
16
|
export { PROVIDER_NAMES, splitRef } from './modelref.ts';
|
|
16
17
|
export { duration } from './narrate.ts';
|
package/dist/lib.js
CHANGED
|
@@ -47,6 +47,7 @@ export { formatBlocks, formatInline, formatMarkdown, wrapSpans } from "./tui/mar
|
|
|
47
47
|
export { matching, projectNames } from "./candidates.js";
|
|
48
48
|
export { editorFiles } from "./editor.js";
|
|
49
49
|
export { copilotEventLog } from "./eventlog.js";
|
|
50
|
+
export { History } from "./history.js";
|
|
50
51
|
export { probeChat, probeModel } from "./liveness.js";
|
|
51
52
|
export { PROVIDER_NAMES, splitRef } from "./modelref.js";
|
|
52
53
|
export { duration } from "./narrate.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zenera/cli",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.2",
|
|
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.
|
|
60
|
-
"@zenera/neo": "^1.3.
|
|
61
|
-
"@zenera/sandbox": "^1.3.
|
|
62
|
-
"@zenera/server": "^1.3.
|
|
63
|
-
"@zenera/view": "^1.3.
|
|
59
|
+
"@zenera/engine": "^1.3.2",
|
|
60
|
+
"@zenera/neo": "^1.3.2",
|
|
61
|
+
"@zenera/sandbox": "^1.3.2",
|
|
62
|
+
"@zenera/server": "^1.3.2",
|
|
63
|
+
"@zenera/view": "^1.3.2",
|
|
64
64
|
"google-auth-library": "^10.0.0",
|
|
65
65
|
"ink": "^7.1.1",
|
|
66
66
|
"openai": "^6.0.0",
|
|
@@ -41,9 +41,6 @@ Copilot is always the meta-agent that creates and changes target projects. Load
|
|
|
41
41
|
the editor's `zen-cli` skill before deciding how a target project should run,
|
|
42
42
|
be validated, or use command-line capabilities. It is the command contract; do
|
|
43
43
|
not reconstruct `zen` arguments from memory or call `--help` to discover them.
|
|
44
|
-
When the task is to bring a project into compliance with `SPECIFICATION.md`,
|
|
45
|
-
load `zen-spec-sync` first; its narrow tiers contain the exact validation
|
|
46
|
-
commands and do not require loading `zen-cli` as well.
|
|
47
44
|
|
|
48
45
|
**Every runtime capability a project turns on carries obligations that are not
|
|
49
46
|
visible in `agents.yaml` and that `zen check` does not report.** Before
|
|
@@ -57,11 +54,8 @@ code, `zen-topology` for `handoffs:` or `fork:` on any agent,
|
|
|
57
54
|
`zen-cli` always. A capability that is already
|
|
58
55
|
configured and already passing `zen check` is exactly the case that looks
|
|
59
56
|
finished and is not: the obligation lives in the skill, so a review that never
|
|
60
|
-
opens the skill cannot find what is missing.
|
|
61
|
-
|
|
62
|
-
skills the `zen-spec-sync` pass plan names for the areas its changes reach - an
|
|
63
|
-
enabled capability no change reaches owes nothing new. A full pass still loads
|
|
64
|
-
every enabled capability's skill.
|
|
57
|
+
opens the skill cannot find what is missing. This applies whatever prompted the
|
|
58
|
+
change.
|
|
65
59
|
|
|
66
60
|
**Load `zen-instructions` before writing, editing, reviewing or deleting any
|
|
67
61
|
`agents/*instructions.md`.** They are the house rules, prepended to every
|
|
@@ -137,16 +131,6 @@ file untouched and put this project's own memory policy in a second topic file,
|
|
|
137
131
|
anything. Never paraphrase it into prose of your own.
|
|
138
132
|
See §5.3.
|
|
139
133
|
|
|
140
|
-
A project with a `SPECIFICATION.md` carries one more: **`.spec-sync/` records
|
|
141
|
-
what the last `/spec-sync-project` pass applied**, and the `zen-spec-sync` skill is
|
|
142
|
-
loaded before running that prompt, whether or not a baseline exists yet. The
|
|
143
|
-
state is committed, because a record only the last machine has is not a record.
|
|
144
|
-
Two things to watch for, neither of which `zen check` reports: a baseline that
|
|
145
|
-
moved without a history entry to match it, which is a pass claiming work it did
|
|
146
|
-
not do, and a `.spec-sync/baseline/` whose `manifest.txt` no longer matches its
|
|
147
|
-
files. Both are reported, not quietly repaired - rewriting the manifest asserts
|
|
148
|
-
a pass that never happened.
|
|
149
|
-
|
|
150
134
|
### 0.2 `zen` is a black box
|
|
151
135
|
|
|
152
136
|
`zen` is the tool you drive, not the code you are working on. What it does is
|
|
@@ -163,8 +147,7 @@ what the `zen-cli` skill and its own output say it does. So:
|
|
|
163
147
|
when its log has not grown for 10 minutes. Embedding a large corpus takes
|
|
164
148
|
hours, and the progress line says how many.
|
|
165
149
|
- When a `zen` command fails, or does something its skill does not describe,
|
|
166
|
-
quote the command and the line it printed in your answer
|
|
167
|
-
`SPECIFICATION-FEEDBACK.md` during a `/spec-sync-project` pass - then go on
|
|
150
|
+
quote the command and the line it printed in your answer, then go on
|
|
168
151
|
with the next step. Do not look for the cause.
|
|
169
152
|
|
|
170
153
|
---
|
|
@@ -258,7 +241,6 @@ my-project/
|
|
|
258
241
|
│ ├── copilot-instructions.md this file
|
|
259
242
|
│ └── skills/*/SKILL.md zen-* reference loaded on demand; the rest /commands
|
|
260
243
|
├── .env this project's environment - NEVER committed
|
|
261
|
-
├── .spec-sync/ what the last /spec-sync-project applied - §0.1
|
|
262
244
|
├── agents.yaml who exists, what they may reach for
|
|
263
245
|
├── agents/
|
|
264
246
|
│ ├── instructions.md house rules, prepended to every agent
|
|
@@ -418,7 +400,7 @@ token in those files is read by a model as an instruction to open something:
|
|
|
418
400
|
`memory_copy_file`.
|
|
419
401
|
- [ ] No project file is named: `agents.yaml`, `agents/instructions.md`,
|
|
420
402
|
`agents/prompts/…`, `agents/skills/…`, `sandbox/Dockerfile`, `.env`,
|
|
421
|
-
`.github/…`, `sessions/…`, `
|
|
403
|
+
`.github/…`, `sessions/…`, `README.md`, `docs/…`.
|
|
422
404
|
- [ ] Nothing escapes a mount: no `../`, no `~`, no host path (`/Users/…`,
|
|
423
405
|
`/home/<someone>`), no `/etc`, `/var` or `/tmp` expected to hold anything
|
|
424
406
|
the project put there.
|
|
@@ -1914,20 +1896,18 @@ ok, `1` failed, `2` usage, `3` invalid project, `4` no usable credential.
|
|
|
1914
1896
|
|
|
1915
1897
|
## 9. Review checklist
|
|
1916
1898
|
|
|
1917
|
-
|
|
1918
|
-
the
|
|
1899
|
+
Load the `zen-review` skill for any review: it picks the depth from the request,
|
|
1900
|
+
runs the mechanical checks, and suggests the command for each finding. The
|
|
1901
|
+
decidable part splits by cost into a fast half and a slow one:
|
|
1919
1902
|
|
|
1920
1903
|
```sh
|
|
1921
|
-
.github/skills/zen-review/scripts/review.sh
|
|
1904
|
+
.github/skills/zen-review/scripts/review.sh fast # zen check --no-models --no-sandbox, paths, setup - seconds
|
|
1905
|
+
.github/skills/zen-review/scripts/review.sh slow # zen check with sandbox build + model probes - minutes
|
|
1922
1906
|
```
|
|
1923
1907
|
|
|
1924
|
-
Run
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
`review.sh --skip-check` instead of probing again, and apply the sync skill's
|
|
1928
|
-
pass plan to this checklist. Use `--skip-check no-sandbox` only when that plan
|
|
1929
|
-
does not reach the sandbox image. Independent reviews still cover the whole
|
|
1930
|
-
checklist.
|
|
1908
|
+
Run `fast` first and read what it says. Warn the user before `slow` - it builds
|
|
1909
|
+
the sandbox image with Docker - and start it separately. Everything else below
|
|
1910
|
+
is judgement, which is why it is still a list.
|
|
1931
1911
|
|
|
1932
1912
|
Before finishing any change here:
|
|
1933
1913
|
|
|
@@ -2024,22 +2004,6 @@ candidates; these are the judgements to make about each one)**
|
|
|
2024
2004
|
- [ ] No key literal in YAML, prompt, skill or log - `${VAR}` only
|
|
2025
2005
|
- [ ] `.env` is git-ignored
|
|
2026
2006
|
|
|
2027
|
-
**Specification** (only where the project has a `SPECIFICATION.md`)
|
|
2028
|
-
|
|
2029
|
-
- [ ] `.github/skills/zen-spec-sync/scripts/snapshot.sh status` does not say
|
|
2030
|
-
`tampered` - the baseline matches its own `manifest.txt`
|
|
2031
|
-
- [ ] `.spec-sync/baseline/applied.txt` names the newest file in
|
|
2032
|
-
`.spec-sync/history/`; a baseline ahead of the history is a pass that
|
|
2033
|
-
claimed work it did not finish
|
|
2034
|
-
- [ ] The newest history entry's `Still open` is what the next pass will trust,
|
|
2035
|
-
and says so honestly - an unchanged specification line is not evidence
|
|
2036
|
-
that anything implements it
|
|
2037
|
-
- [ ] No question in `SPECIFICATION-FEEDBACK.md` has a box marked `[x]`, or
|
|
2038
|
-
exactly one answer left under it, without a matching `✅ Answered` entry
|
|
2039
|
-
or a strike naming the specification line that superseded it - that is
|
|
2040
|
-
an answer given and never folded into the specification
|
|
2041
|
-
- [ ] `.spec-sync/` is committed and `.tmp/` is not
|
|
2042
|
-
|
|
2043
2007
|
---
|
|
2044
2008
|
|
|
2045
2009
|
## 10. Where to change what
|
|
@@ -1,81 +1,16 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: project-review
|
|
3
|
-
description: Review the project
|
|
3
|
+
description: Review the project before committing - loads the `zen-review` skill and follows it (quick by default; say "full" for the sandbox build and model probes too).
|
|
4
4
|
disable-model-invocation: true
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
saying anything.
|
|
7
|
+
Load the `zen-review` skill now, before anything else, and follow it. It owns
|
|
8
|
+
the whole review: which depth to run, the mechanical checks and how to read
|
|
9
|
+
them, the judgement checklist, the suggestions and the report.
|
|
11
10
|
|
|
12
|
-
|
|
11
|
+
Choose the depth from what I typed after the command, as `zen-review` §1 says:
|
|
12
|
+
nothing, or "quick", is a quick review; "full", "everything" or "before commit"
|
|
13
|
+
is a full one. The entry point is
|
|
14
|
+
`.github/skills/zen-review/scripts/review.sh`.
|
|
13
15
|
|
|
14
|
-
```sh
|
|
15
|
-
.github/skills/zen-review/scripts/review.sh
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
That is `zen check`, the §2.5 path sweep and the
|
|
19
|
-
spec-sync record, in the order they matter. Load the `zen-review` skill for what
|
|
20
|
-
each one owns and how to read its output. Do not re-verify by hand anything it
|
|
21
|
-
already decided, and do not go further while `zen check` fails - nothing below
|
|
22
|
-
matters until it passes.
|
|
23
|
-
If `review.sh check` already passed in this conversation and nothing has been
|
|
24
|
-
edited since, run `review.sh --skip-check` instead: it verifies that receipt
|
|
25
|
-
rather than probing again, and fails if the project changed. Reusing the check
|
|
26
|
-
does not narrow the review - everything below still covers the whole project.
|
|
27
|
-
|
|
28
|
-
**Then list the capabilities this project turns on** — a `memory:` block, a
|
|
29
|
-
`zen rag` index, a sandbox, an agent that writes code (`zen-code-python`), a
|
|
30
|
-
`SPECIFICATION.md` — and load the editor skill for each before judging it. The obligations live in the skill, not in
|
|
31
|
-
`agents.yaml`, and `zen check` reports none of them. A capability that is
|
|
32
|
-
already configured and already passing is exactly the case that looks finished
|
|
33
|
-
and is not.
|
|
34
|
-
|
|
35
|
-
Everything that follows is what no tool can see:
|
|
36
|
-
|
|
37
|
-
- **One job each.** Can you state every agent's job in one sentence? If not,
|
|
38
|
-
say which agent and what the two jobs are.
|
|
39
|
-
- **Prompts.** Second person, imperative, failure paths stated, no hedging, no
|
|
40
|
-
politeness padding, no meta-talk about the runtime. Nothing in the house rules
|
|
41
|
-
that is true of only one agent, and nothing in `agents/instructions.md` that
|
|
42
|
-
belongs in a `<topic>-instructions.md` of its own because it only applies when
|
|
43
|
-
one capability is on.
|
|
44
|
-
- **Facts.** Any number, threshold, fee or date living in a prompt is in the
|
|
45
|
-
wrong file. Name it and say which skill it belongs in.
|
|
46
|
-
- **Paths.** For each candidate `check-paths.sh` printed: is it a path the
|
|
47
|
-
agent cannot open, or noise? Say which, and for a real one say what it should
|
|
48
|
-
have been. Judge the rest of the §2.5 checklist yourself — that no instruction
|
|
49
|
-
assumes the workspace is this directory, that every `/assets/…` and
|
|
50
|
-
`/skills/<name>/…` names a committed file, and that the agent holding the
|
|
51
|
-
prompt has the tool the path implies.
|
|
52
|
-
- **Memory.** Anything this project decides for itself belongs in
|
|
53
|
-
`agents/memory-policy-instructions.md`, not in the copy — and it should say
|
|
54
|
-
something. Audiences that exist because an agent would be _misled_ by the
|
|
55
|
-
other slice, not merely because it does not need it.
|
|
56
|
-
- **Skill descriptions.** Each one a condition, not a title; no two overlapping.
|
|
57
|
-
Every skill a folder with a `SKILL.md`, and a skill that ships a script writes
|
|
58
|
-
its `/skills/<name>/…` path.
|
|
59
|
-
- **Tools.** Every grant justified by the agent's job; nothing mutating held by
|
|
60
|
-
an agent that only reads; every granted tool mentioned by the prompt. An agent
|
|
61
|
-
with no `skills:` key indexes the whole catalog - check that every agent can
|
|
62
|
-
actually follow the skills it is offered.
|
|
63
|
-
- **Sandbox.** `persist: true` unless a throwaway rootfs is wanted on purpose.
|
|
64
|
-
What the work always needs is in the image, not installed by a prompt on every
|
|
65
|
-
run.
|
|
66
|
-
- **Control flow.** Whichever this project uses - load the `zen-topology` skill
|
|
67
|
-
first when `agents.yaml` has `handoffs:` or `fork:`. A handoff moves the
|
|
68
|
-
conversation and must have a path back; a fork returns by itself and condenses
|
|
69
|
-
to one result, so whatever the caller needs must be in the branch's answer.
|
|
70
|
-
Wanting one lookup and spending the conversation on it is a fork, not a
|
|
71
|
-
handoff. No router that answers.
|
|
72
|
-
- **Models.** Each agent on the cheapest tier that is right, not the safest.
|
|
73
|
-
- **Cache.** Nothing volatile - dates, ids, counts - in the stable prefix.
|
|
74
|
-
- **Secrets.** No key inlined anywhere; `.env` ignored, `sessions/` ignored.
|
|
75
|
-
- **Specification.** Where a `SPECIFICATION.md` exists, `review.sh` reported the
|
|
76
|
-
record's mode. Judge the rest: the newest history entry's "Still open" is
|
|
77
|
-
honest, its baseline names that entry, and `.spec-sync/` is committed.
|
|
78
|
-
|
|
79
|
-
Report as a list of findings, each naming the file and the line, ordered by how
|
|
80
|
-
much it will cost to leave. Say plainly if you find nothing worth changing.
|
|
81
16
|
Do not edit anything unless I ask.
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
```
|
|
4
4
|
zen meta run [project] "<question>" ask it something
|
|
5
5
|
zen meta run [project] /<name> [words] run the command .github/skills/<name>/SKILL.md
|
|
6
|
+
zen meta chat [project] [question] a conversation, in a terminal only
|
|
6
7
|
zen meta prompts [project] list the commands (skills without zen-)
|
|
7
8
|
zen meta resume [project] [session] carry on a run that stopped
|
|
8
9
|
zen meta model [ref] show or set the model it uses
|
|
@@ -14,6 +15,9 @@ not installed. `zen meta dataset` and `zen meta finetune` come with it.
|
|
|
14
15
|
|
|
15
16
|
`zen meta --help` has every option.
|
|
16
17
|
|
|
18
|
+
`zen meta chat` needs a person at a terminal: it refuses `--json` and a
|
|
19
|
+
stdin that is not a TTY. From a script or another agent, use `zen meta run`.
|
|
20
|
+
|
|
17
21
|
## `--json`
|
|
18
22
|
|
|
19
23
|
`zen meta run --json` prints ONE object on stdout when the run ends:
|
|
@@ -1,47 +1,174 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: zen-review
|
|
3
|
-
description:
|
|
3
|
+
description: Reviewing, checking or validating an agent project - the whole procedure `/project-review` follows. Picks the depth from the request (a quick check by default, everything at once when a full or pre-commit check is asked for), runs the fast mechanical half (`zen check --no-models --no-sandbox`, the §2.5 path sweep, the setup dry run) and the slow half (`zen check` with the sandbox image build and model probes) separately, walks the judgement checklist no tool can make, and reports findings with the command that fixes each one - rebuild the sandbox, run the setup script, `zen check --fix`. Load whenever the user asks to check, review or validate a project, before saying a project is ready, and whenever a review finding needs verifying rather than restating.
|
|
4
4
|
user-invocable: false
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
# Reviewing a project
|
|
8
8
|
|
|
9
9
|
A review of an agent project is two jobs wearing one name. One half is
|
|
10
|
-
decidable - a schema is valid or it is not, a path resolves or it does not,
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
wrong file.
|
|
10
|
+
decidable - a schema is valid or it is not, a path resolves or it does not, an
|
|
11
|
+
index is built or it is not - and a human doing it by hand gets it wrong in the
|
|
12
|
+
same places every time. The other half is judgement: whether an agent has one
|
|
13
|
+
job, whether a description routes, whether a number is in the wrong file.
|
|
15
14
|
|
|
16
|
-
|
|
15
|
+
The decidable half is scripted and split by cost into a **fast** part and a
|
|
16
|
+
**slow** part. The judgement half is the checklist further down. A review ends
|
|
17
|
+
in one report that says what is wrong and what to run next.
|
|
17
18
|
|
|
18
|
-
##
|
|
19
|
+
## 1. Choose the depth from the request
|
|
19
20
|
|
|
20
|
-
|
|
21
|
+
| The user asked | Do |
|
|
22
|
+
| ---------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- |
|
|
23
|
+
| "check", "is it ok?", "quick check", anything unqualified | **Quick**: the fast half and the judgement checklist. Then ask whether to run the slow half. |
|
|
24
|
+
| "full check", "check everything", "deep", "before I commit", "release" | **Full**: the fast half, then warn and start the slow half right away; judgement while it runs. |
|
|
25
|
+
| one area ("check the paths", "does the sandbox build?") | Only the part that owns it - `check-paths.sh`, or the slow half - and say what was not covered. |
|
|
26
|
+
|
|
27
|
+
`/project-review` with nothing after it is a quick review. When in doubt, go
|
|
28
|
+
quick and ask: the fast half costs seconds, the slow one can cost minutes. When
|
|
29
|
+
you ask, say what the slow half would add - whether the Dockerfile builds and
|
|
30
|
+
whether every model id is real - so the answer is an informed one. When nobody
|
|
31
|
+
can answer - a scripted `zen meta run /project-review` - do not ask: run the
|
|
32
|
+
quick review and end the report with the command for the slow half.
|
|
33
|
+
|
|
34
|
+
## 2. The fast half - files, paths, setup
|
|
21
35
|
|
|
22
36
|
```sh
|
|
23
|
-
.github/skills/zen-review/scripts/review.sh
|
|
37
|
+
.github/skills/zen-review/scripts/review.sh fast
|
|
24
38
|
```
|
|
25
39
|
|
|
26
|
-
|
|
40
|
+
Seconds, offline, no Docker, no tokens. It always runs, first. Each step's
|
|
41
|
+
header is the exact command it ran:
|
|
42
|
+
|
|
43
|
+
| Step | Owns |
|
|
44
|
+
| ------------------------------------ | ---------------------------------------------------------------------- |
|
|
45
|
+
| `zen check --no-models --no-sandbox` | everything decidable about the configuration and the files it names |
|
|
46
|
+
| `paths (check-paths.sh)` | paths a running agent cannot open - §2.5 |
|
|
47
|
+
| `setup (scripts/_setup.sh --check)` | whether what must exist before a run (an index, a generated file) does |
|
|
48
|
+
| `sandbox` | a hint: `sandbox/` changed since the last commit |
|
|
49
|
+
|
|
50
|
+
Every step runs even when an earlier one fails. The exit code is `1` if any
|
|
51
|
+
step wants attention, `0` if none does; the `sandbox` step is a hint and never
|
|
52
|
+
fails the run. Nothing else matters while `zen check` fails - report what it
|
|
53
|
+
said and fix that first. There is no point paying for a container build on a
|
|
54
|
+
project whose `agents.yaml` does not parse.
|
|
27
55
|
|
|
28
|
-
|
|
29
|
-
| ----------- | ------------------------------------------ | -------------------------------------------- |
|
|
30
|
-
| `zen check` | the CLI | everything decidable about the configuration |
|
|
31
|
-
| `paths` | `zen-review/scripts/check-paths.sh` | paths a running agent cannot open - §2.5 |
|
|
32
|
-
| `spec-sync` | `zen-spec-sync/scripts/snapshot.sh status` | whether the record of the last pass is sound |
|
|
56
|
+
## 3. The slow half - sandbox build and model probes
|
|
33
57
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
`--no-models --no-sandbox` to `zen check`, which is the right call while
|
|
38
|
-
iterating and the wrong one before committing - a key that authenticates says
|
|
39
|
-
nothing about the model id it is spent on.
|
|
58
|
+
```sh
|
|
59
|
+
.github/skills/zen-review/scripts/review.sh slow # add --fix to repair zen's own files first
|
|
60
|
+
```
|
|
40
61
|
|
|
41
|
-
|
|
42
|
-
|
|
62
|
+
This is the full `zen check`, with the sandbox image build and the model probes
|
|
63
|
+
turned on. **Before starting it, tell the user it may take several minutes**:
|
|
64
|
+
it builds the project's image with Docker (a cold build with no layer cache is
|
|
65
|
+
the slow part) and asks every model that has a credential to answer once. Then
|
|
66
|
+
start it on its own - in the background where your tools allow - and do the
|
|
67
|
+
judgement checklist while it runs. Report its result when it finishes.
|
|
68
|
+
|
|
69
|
+
It is the only check that proves a Dockerfile builds and a model id is real: a
|
|
70
|
+
key that authenticates says nothing about the model it is spent on. A project
|
|
71
|
+
with no sandbox only pays for the model probes; a machine with no container
|
|
72
|
+
engine gets a warning rather than an error - say so, do not call that a pass.
|
|
73
|
+
|
|
74
|
+
`slow` does not repeat the path sweep or the setup dry run, and it saves a
|
|
75
|
+
receipt (§7) so the same pass does not pay for it twice. If files change after
|
|
76
|
+
the fast half, run `fast` again; it is cheap. `review.sh` with no argument
|
|
77
|
+
still runs everything in one blocking go - prefer the split.
|
|
78
|
+
|
|
79
|
+
## 4. The judgement half
|
|
80
|
+
|
|
81
|
+
Read `agents.yaml`, every `agents/*instructions.md`, every file under
|
|
82
|
+
`agents/prompts/` and the skill descriptions under `agents/skills/` before
|
|
83
|
+
saying anything. Do not re-verify by hand anything the scripts already decided.
|
|
84
|
+
|
|
85
|
+
**List the capabilities this project turns on** - a `memory:` block, a `zen
|
|
86
|
+
rag` index, a sandbox, an agent that writes code (`zen-code-python`),
|
|
87
|
+
`handoffs:` or `fork:` (`zen-topology`) - and load the editor skill for each
|
|
88
|
+
before judging it. The obligations live in the skill, not in `agents.yaml`, and
|
|
89
|
+
`zen check` reports none of them. A capability that is already configured and
|
|
90
|
+
already passing is exactly the case that looks finished and is not.
|
|
91
|
+
|
|
92
|
+
Then, what no tool can see:
|
|
93
|
+
|
|
94
|
+
- **One job each.** Can you state every agent's job in one sentence? If not,
|
|
95
|
+
say which agent and what the two jobs are.
|
|
96
|
+
- **Prompts.** Second person, imperative, failure paths stated, no hedging, no
|
|
97
|
+
politeness padding, no meta-talk about the runtime. Nothing in the house rules
|
|
98
|
+
that is true of only one agent, and nothing in `agents/instructions.md` that
|
|
99
|
+
belongs in a `<topic>-instructions.md` of its own because it only applies when
|
|
100
|
+
one capability is on.
|
|
101
|
+
- **Facts.** Any number, threshold, fee or date living in a prompt is in the
|
|
102
|
+
wrong file. Name it and say which skill it belongs in.
|
|
103
|
+
- **Paths.** For each candidate `check-paths.sh` printed: is it a path the agent
|
|
104
|
+
cannot open, or noise? Say which, and for a real one say what it should have
|
|
105
|
+
been. Judge the rest of the §2.5 checklist yourself - that no instruction
|
|
106
|
+
assumes the workspace is this directory, that every `/assets/…` and
|
|
107
|
+
`/skills/<name>/…` names a committed file, and that the agent holding the
|
|
108
|
+
prompt has the tool the path implies.
|
|
109
|
+
- **Memory.** Anything this project decides for itself belongs in
|
|
110
|
+
`agents/memory-policy-instructions.md`, not in the copy - and it should say
|
|
111
|
+
something. Audiences that exist because an agent would be _misled_ by the
|
|
112
|
+
other slice, not merely because it does not need it.
|
|
113
|
+
- **Skill descriptions.** Each one a condition, not a title; no two overlapping.
|
|
114
|
+
Every skill a folder with a `SKILL.md`, and a skill that ships a script writes
|
|
115
|
+
its `/skills/<name>/…` path.
|
|
116
|
+
- **Tools.** Every grant justified by the agent's job; nothing mutating held by
|
|
117
|
+
an agent that only reads; every granted tool mentioned by the prompt. An agent
|
|
118
|
+
with no `skills:` key indexes the whole catalog - check that every agent can
|
|
119
|
+
actually follow the skills it is offered.
|
|
120
|
+
- **Sandbox.** `persist: true` unless a throwaway rootfs is wanted on purpose.
|
|
121
|
+
What the work always needs is in the image, not installed by a prompt on every
|
|
122
|
+
run.
|
|
123
|
+
- **Control flow.** Load `zen-topology` first when `agents.yaml` has
|
|
124
|
+
`handoffs:` or `fork:`. A handoff moves the conversation and must have a path
|
|
125
|
+
back; a fork returns by itself and condenses to one result, so whatever the
|
|
126
|
+
caller needs must be in the branch's answer. Wanting one lookup and spending
|
|
127
|
+
the conversation on it is a fork, not a handoff. No router that answers.
|
|
128
|
+
- **Models.** Each agent on the cheapest tier that is right, not the safest.
|
|
129
|
+
- **Cache.** Nothing volatile - dates, ids, counts - in the stable prefix.
|
|
130
|
+
- **Secrets.** No key inlined anywhere; `.env` ignored, `sessions/` ignored.
|
|
131
|
+
|
|
132
|
+
§9 of the copilot instructions is the long form of this list.
|
|
133
|
+
|
|
134
|
+
## 5. Suggest the next step
|
|
135
|
+
|
|
136
|
+
A finding without a next step is half a finding. Map what the checks said to
|
|
137
|
+
the command that addresses it, and put it in the report:
|
|
138
|
+
|
|
139
|
+
| What the review saw | Suggest |
|
|
140
|
+
| ----------------------------------------------------------------- | ------------------------------------------------------------------------------------------ |
|
|
141
|
+
| `rules.stale`, a missing house-rule copy, an outdated editor tree | `zen check --fix` (load `zen-instructions` first - §9) |
|
|
142
|
+
| `setup` says not done; an index is not `ready` | `scripts/_setup.sh` - and `scripts/_setup.sh --force` when the source documents changed |
|
|
143
|
+
| `sandbox` hint: `sandbox/` changed since the last commit | `review.sh slow` to prove it builds, then `zen sandbox pull` to rebuild the image runs use |
|
|
144
|
+
| slow half: no container engine, or the machine is not running | `zen sandbox up` |
|
|
145
|
+
| slow half: the image build failed | fix `sandbox/Dockerfile`, then `review.sh slow` again; load `zen-sandbox` |
|
|
146
|
+
| slow half: a model refused or never answered | `zen models test <ref>`; fix the model id, or the credential with `zen key` |
|
|
147
|
+
| a sandbox pin was repaired by `--fix` | `review.sh slow` - a repair may have changed the image |
|
|
148
|
+
| quick review done, slow half not run | ask whether to run `review.sh slow`, and say it can take several minutes |
|
|
149
|
+
| only judgement findings | the edit, by file and line - and run `review.sh fast` again after making it |
|
|
150
|
+
|
|
151
|
+
Load `zen-cli` before suggesting any other `zen` command, so the arguments come
|
|
152
|
+
from the contract rather than memory.
|
|
153
|
+
|
|
154
|
+
## 6. The report
|
|
155
|
+
|
|
156
|
+
Open with the mechanical results, one line per command actually run, named as
|
|
157
|
+
the script's step headers name it - never collapse two into one:
|
|
43
158
|
|
|
44
|
-
|
|
159
|
+
```
|
|
160
|
+
• zen check --no-models --no-sandbox: passed (0 errors, 0 warnings)
|
|
161
|
+
• check-paths.sh: passed - every path is under /workspace, /assets or /skills
|
|
162
|
+
• scripts/_setup.sh --check: 1 step needs setup (docs_index)
|
|
163
|
+
• zen check (sandbox build + model probes): not run - quick review
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
Then the findings, each naming the file and the line, ordered by how much they
|
|
167
|
+
will cost to leave, each with its next step from §5. Say plainly if you find
|
|
168
|
+
nothing worth changing, and say which checks did not run. Do not edit anything
|
|
169
|
+
unless the user asks.
|
|
170
|
+
|
|
171
|
+
## 7. Reusing a check within the same pass
|
|
45
172
|
|
|
46
173
|
Instead of calling `zen check` separately and repeating it in the review, run:
|
|
47
174
|
|
|
@@ -51,32 +178,31 @@ Instead of calling `zen check` separately and repeating it in the review, run:
|
|
|
51
178
|
```
|
|
52
179
|
|
|
53
180
|
`check` runs only the CLI check and saves a receipt in `.tmp/review-check.json`
|
|
54
|
-
on success. `--skip-check` verifies that receipt, then still runs the path
|
|
55
|
-
|
|
181
|
+
on success. `--skip-check` verifies that receipt, then still runs the path
|
|
182
|
+
sweep. It fails explicitly for a missing, failed, stale or
|
|
56
183
|
insufficient check; it never silently treats a skipped check as success.
|
|
57
184
|
|
|
58
185
|
Receipts cover project file contents, permissions, additions and deletions, and the CLI
|
|
59
|
-
version. They exclude only root `.git/`, `.tmp/` and
|
|
60
|
-
history does not invalidate a result. Symlinks and
|
|
61
|
-
run the ordinary review instead. Hashing
|
|
62
|
-
can itself be costly for large projects;
|
|
186
|
+
version. They exclude only the root `.git/`, `.tmp/` and history directories,
|
|
187
|
+
so writing scratch output or history does not invalidate a result. Symlinks and
|
|
188
|
+
special files are unsupported: run the ordinary review instead. Hashing
|
|
189
|
+
includes assets and dependencies and can itself be costly for large projects;
|
|
190
|
+
the ordinary review remains available.
|
|
63
191
|
|
|
64
192
|
This is same-pass reuse, not a persistent health cache. Do not reuse after
|
|
65
193
|
changing credentials, environment variables, external files, ignored scratch
|
|
66
194
|
inputs or remote resources: those are not certified by the receipt. Run a fresh
|
|
67
195
|
check instead. Only use reuse for a self-contained project's stable inputs.
|
|
68
196
|
|
|
69
|
-
`check no-sandbox` and `--skip-check no-sandbox` are for a
|
|
70
|
-
|
|
197
|
+
`check no-sandbox` and `--skip-check no-sandbox` are for a change that does not
|
|
198
|
+
reach the sandbox image. They still probe models. `check fast` and
|
|
71
199
|
`--skip-check fast` omit both expensive probes and are for iteration only.
|
|
72
200
|
A full receipt covers either partial mode, but a partial receipt cannot stand
|
|
73
201
|
in for a full one. If a partial check repairs or otherwise changes files, no
|
|
74
202
|
reusable receipt is issued: run `check full`, because a repair may have changed
|
|
75
203
|
the sandbox pin. Finish setup and all edits before saving the final receipt.
|
|
76
204
|
|
|
77
|
-
##
|
|
78
|
-
|
|
79
|
-
### `check-paths.sh` - the §2.5 sweep
|
|
205
|
+
## 8. `check-paths.sh` - the §2.5 sweep
|
|
80
206
|
|
|
81
207
|
A running agent's whole world is three paths: `/workspace`, `/assets` and
|
|
82
208
|
`/skills`. Every path-shaped token in `agents/*instructions.md`,
|
|
@@ -103,7 +229,7 @@ copy sitting in this project.
|
|
|
103
229
|
|
|
104
230
|
`raw` is the sweep with nothing filtered, for when you suspect the filter.
|
|
105
231
|
|
|
106
|
-
## Findings that are not yours to fix in place
|
|
232
|
+
## 9. Findings that are not yours to fix in place
|
|
107
233
|
|
|
108
234
|
`zen check` reports `rules.stale`, `files.uninstructed`, `memory.uninstructed`,
|
|
109
235
|
`fork.uninstructed`, `rules.requires.unknown` or `rules.unreached` against a
|
|
@@ -119,22 +245,7 @@ project's own rules on the same subject go instead, what `requires:` does, and
|
|
|
119
245
|
what filename order decides. A review that fixes one of ours in place has
|
|
120
246
|
undone itself by the next `zen open` and left nothing behind to say so.
|
|
121
247
|
|
|
122
|
-
##
|
|
123
|
-
|
|
124
|
-
Not because it would be hard, but because the answer would be wrong:
|
|
125
|
-
|
|
126
|
-
- **Whether an agent has one job.** Read the prompt.
|
|
127
|
-
- **Whether a description routes.** Two overlapping descriptions both parse.
|
|
128
|
-
- **Whether a fact belongs in a skill.** A threshold in a prompt is valid YAML.
|
|
129
|
-
- **Whether a tool grant is justified.** `zen check` confirms the selector
|
|
130
|
-
resolves, never that the agent needs it.
|
|
131
|
-
- **Whether the newest spec-sync history entry is honest.** A pass can claim
|
|
132
|
-
anything; only reading the diff says whether it did it.
|
|
133
|
-
|
|
134
|
-
That list is `/project-review`, and §9 of the copilot instructions is the long
|
|
135
|
-
form. Run the script first so the prompt is spent on this.
|
|
136
|
-
|
|
137
|
-
## Where these scripts live, and why edits to them vanish
|
|
248
|
+
## 10. Where these scripts live, and why edits to them vanish
|
|
138
249
|
|
|
139
250
|
`zen init` and `zen open` rewrite the whole `.github/` tree from the version of
|
|
140
251
|
`zen` in hand. These scripts arrive with it, so a change made to the copy in a
|
|
@@ -2,17 +2,21 @@
|
|
|
2
2
|
#
|
|
3
3
|
# Every check a review can make without judgement, in the order it makes them.
|
|
4
4
|
#
|
|
5
|
-
# review.sh
|
|
6
|
-
#
|
|
5
|
+
# review.sh fast seconds, offline: `zen check --no-models --no-sandbox`,
|
|
6
|
+
# the path sweep, the setup dry run, the sandbox hint
|
|
7
|
+
# review.sh slow [--fix] minutes: the full `zen check` alone - sandbox image
|
|
8
|
+
# build and model probes - saved as a receipt
|
|
9
|
+
# review.sh both halves in one blocking go
|
|
7
10
|
# review.sh check [full|no-sandbox|fast] [--fix] check and save a receipt
|
|
8
11
|
# review.sh --skip-check [full|no-sandbox|fast] verify and reuse that receipt
|
|
9
12
|
#
|
|
10
|
-
# What it prints is findings
|
|
11
|
-
# whether
|
|
12
|
-
#
|
|
13
|
+
# What it prints is findings, each with the command that addresses it. What it
|
|
14
|
+
# cannot see - whether an agent has one job, whether a description is a
|
|
15
|
+
# condition, whether a fact belongs in a skill - is the judgement half of the
|
|
16
|
+
# zen-review skill.
|
|
13
17
|
#
|
|
14
18
|
# Every step runs even when an earlier one fails: a review that stops at the
|
|
15
|
-
# first problem is one somebody has to run
|
|
19
|
+
# first problem is one somebody has to run twice. The exit code is 1 if
|
|
16
20
|
# anything wants attention, 0 if nothing does.
|
|
17
21
|
#
|
|
18
22
|
# Run it from anywhere; it finds the project root from its own location.
|
|
@@ -32,6 +36,16 @@ if [ "${1:-}" = check ]; then
|
|
|
32
36
|
fi
|
|
33
37
|
exec node "$RECEIPT" run "$@"
|
|
34
38
|
fi
|
|
39
|
+
if [ "${1:-}" = slow ]; then
|
|
40
|
+
shift
|
|
41
|
+
if [ "$#" -gt 1 ] || { [ "$#" -eq 1 ] && [ "$1" != --fix ]; }; then
|
|
42
|
+
echo "usage: review.sh slow [--fix]" >&2
|
|
43
|
+
exit 2
|
|
44
|
+
fi
|
|
45
|
+
echo "review.sh slow: building the sandbox image and probing every model - this can take several minutes" >&2
|
|
46
|
+
printf '\n--- zen check %s(sandbox build + model probes) ---\n' "${1:+$1 }"
|
|
47
|
+
exec node "$RECEIPT" run full "$@"
|
|
48
|
+
fi
|
|
35
49
|
if [ "${1:-}" = --skip-check ]; then
|
|
36
50
|
REUSE=1
|
|
37
51
|
shift
|
|
@@ -42,7 +56,7 @@ case "${1:-full}" in
|
|
|
42
56
|
no-sandbox) CHECK_FLAGS="--no-sandbox" ;;
|
|
43
57
|
fast) CHECK_FLAGS="--no-models --no-sandbox" ;;
|
|
44
58
|
*)
|
|
45
|
-
echo "usage: review.sh [check|--skip-check] [full|no-sandbox|fast] [--fix (check only)]" >&2
|
|
59
|
+
echo "usage: review.sh [fast|slow [--fix]|full] | [check|--skip-check] [full|no-sandbox|fast] [--fix (check only)]" >&2
|
|
46
60
|
exit 2
|
|
47
61
|
;;
|
|
48
62
|
esac
|
|
@@ -67,27 +81,28 @@ step() {
|
|
|
67
81
|
printf '\n--- %s ---\n' "$1"
|
|
68
82
|
}
|
|
69
83
|
|
|
70
|
-
|
|
84
|
+
CHECK_CMD="zen check${CHECK_FLAGS:+ $CHECK_FLAGS}"
|
|
85
|
+
step "$CHECK_CMD"
|
|
71
86
|
if [ "$REUSE" -eq 1 ]; then
|
|
72
87
|
node "$RECEIPT" verify "${1:-full}"
|
|
73
88
|
rc=$?
|
|
74
|
-
verdict
|
|
89
|
+
verdict "$CHECK_CMD" "receipt exit $rc" "$rc"
|
|
75
90
|
elif command -v zen >/dev/null 2>&1; then
|
|
76
91
|
# Unquoted on purpose: empty means no flags rather than one empty argument.
|
|
77
92
|
# shellcheck disable=SC2086
|
|
78
93
|
zen check $CHECK_FLAGS
|
|
79
94
|
rc=$?
|
|
80
95
|
if [ "$rc" -eq 0 ]; then
|
|
81
|
-
verdict
|
|
96
|
+
verdict "$CHECK_CMD" 'ok' 0
|
|
82
97
|
else
|
|
83
|
-
verdict
|
|
98
|
+
verdict "$CHECK_CMD" "exit $rc - nothing below matters until this passes" 1
|
|
84
99
|
fi
|
|
85
100
|
else
|
|
86
|
-
echo "zen is not on PATH
|
|
87
|
-
verdict
|
|
101
|
+
echo "zen is not on PATH - install it, or run check-paths.sh alone"
|
|
102
|
+
verdict "$CHECK_CMD" 'not run' 1
|
|
88
103
|
fi
|
|
89
104
|
|
|
90
|
-
step 'paths'
|
|
105
|
+
step 'paths (check-paths.sh)'
|
|
91
106
|
"$SKILLS/zen-review/scripts/check-paths.sh"
|
|
92
107
|
rc=$?
|
|
93
108
|
if [ "$rc" -eq 0 ]; then
|
|
@@ -96,23 +111,34 @@ else
|
|
|
96
111
|
verdict 'paths' 'candidates to explain or fix' 1
|
|
97
112
|
fi
|
|
98
113
|
|
|
99
|
-
step '
|
|
100
|
-
if [ -f
|
|
101
|
-
|
|
102
|
-
# verdict has to read what it said.
|
|
103
|
-
state="$("$SKILLS/zen-spec-sync/scripts/snapshot.sh" status)"
|
|
114
|
+
step 'setup (scripts/_setup.sh --check)'
|
|
115
|
+
if [ -f scripts/_setup.sh ]; then
|
|
116
|
+
bash scripts/_setup.sh --check
|
|
104
117
|
rc=$?
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
118
|
+
if [ "$rc" -eq 0 ]; then
|
|
119
|
+
verdict 'setup' 'ok' 0
|
|
120
|
+
else
|
|
121
|
+
verdict 'setup' 'not done - run scripts/_setup.sh to build what is missing (indexes, generated files)' 1
|
|
122
|
+
fi
|
|
123
|
+
else
|
|
124
|
+
echo "no scripts/_setup.sh - this project builds nothing before it runs"
|
|
125
|
+
verdict 'setup' 'not applicable' 0
|
|
126
|
+
fi
|
|
127
|
+
|
|
128
|
+
step 'sandbox (changes since the last commit)'
|
|
129
|
+
if [ -d sandbox ] && git rev-parse --is-inside-work-tree >/dev/null 2>&1; then
|
|
130
|
+
changed="$(git status --porcelain -- sandbox 2>/dev/null)"
|
|
131
|
+
if [ -n "$changed" ]; then
|
|
132
|
+
printf '%s\n' "$changed"
|
|
133
|
+
# A hint, not a failure: the files may be fine, the image is what is behind.
|
|
134
|
+
verdict 'sandbox' 'sandbox/ changed - run review.sh slow to prove it builds, then zen sandbox pull to rebuild the image runs use' 0
|
|
110
135
|
else
|
|
111
|
-
|
|
136
|
+
echo "sandbox/ unchanged since the last commit"
|
|
137
|
+
verdict 'sandbox' 'unchanged' 0
|
|
112
138
|
fi
|
|
113
139
|
else
|
|
114
|
-
echo "no
|
|
115
|
-
verdict '
|
|
140
|
+
echo "no sandbox/ under version control - nothing to compare"
|
|
141
|
+
verdict 'sandbox' 'not applicable' 0
|
|
116
142
|
fi
|
|
117
143
|
|
|
118
144
|
step 'summary'
|