@zenera/cli 1.1.55 → 1.1.56
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/batch.d.ts +3 -3
- package/dist/batch.js +5 -6
- package/dist/commands/inspect.js +2 -2
- package/dist/commands/memory.js +1 -1
- package/dist/commands/sandbox.js +1 -17
- package/dist/sandbox.js +1 -1
- package/dist/validate.js +6 -8
- package/package.json +4 -4
- package/templates/editor/.github/copilot-instructions.md +17 -30
- package/templates/editor/.github/skills/zen-analyze-run/SKILL.md +2 -1
- package/templates/editor/.github/skills/zen-instructions/SKILL.md +3 -2
- package/templates/editor/.github/skills/zen-memory/SKILL.md +25 -22
- package/templates/editor/.github/skills/zen-review/SKILL.md +3 -3
- package/templates/editor/.github/skills/zen-review/scripts/check-paths.sh +3 -3
- package/templates/editor/.github/skills/zen-sandbox/SKILL.md +5 -16
- package/templates/editor/.vscode/agents.schema.json +3 -2
- package/templates/project/agents/files-instructions.md +3 -2
- package/templates/project/agents/memory-instructions.md +8 -6
- package/templates/project/sandbox/Dockerfile.tmpl +28 -2
package/dist/batch.d.ts
CHANGED
|
@@ -44,9 +44,9 @@ export interface BatchOptions {
|
|
|
44
44
|
export type MemoryMode = 'read-only' | 'copied' | 'none';
|
|
45
45
|
export declare function runBatch(opts: BatchOptions): Promise<void>;
|
|
46
46
|
/**
|
|
47
|
-
* The
|
|
48
|
-
*
|
|
49
|
-
*
|
|
47
|
+
* The containers one item can start: one, shared by every agent, when any
|
|
48
|
+
* agent can reach a shell, and none otherwise. A project that does not load
|
|
49
|
+
* is each item's to report, so it counts none.
|
|
50
50
|
*/
|
|
51
51
|
export declare function containersPerItem(dir: string): number;
|
|
52
52
|
/**
|
package/dist/batch.js
CHANGED
|
@@ -170,9 +170,9 @@ export async function runBatch(opts) {
|
|
|
170
170
|
// One item
|
|
171
171
|
// ---------------------------------------------------------------------------
|
|
172
172
|
/**
|
|
173
|
-
* The
|
|
174
|
-
*
|
|
175
|
-
*
|
|
173
|
+
* The containers one item can start: one, shared by every agent, when any
|
|
174
|
+
* agent can reach a shell, and none otherwise. A project that does not load
|
|
175
|
+
* is each item's to report, so it counts none.
|
|
176
176
|
*/
|
|
177
177
|
export function containersPerItem(dir) {
|
|
178
178
|
let read;
|
|
@@ -183,7 +183,7 @@ export function containersPerItem(dir) {
|
|
|
183
183
|
return 0;
|
|
184
184
|
}
|
|
185
185
|
const tools = availableTools(read.root, read.config);
|
|
186
|
-
const
|
|
186
|
+
const shell = read.config.agents.some((a) => {
|
|
187
187
|
try {
|
|
188
188
|
return selectTools(tools, [...(a.tools ?? [])], { where: a.name }).some((t) => t.group === SANDBOX_GROUP);
|
|
189
189
|
}
|
|
@@ -191,8 +191,7 @@ export function containersPerItem(dir) {
|
|
|
191
191
|
return false;
|
|
192
192
|
}
|
|
193
193
|
});
|
|
194
|
-
|
|
195
|
-
return own + (shells.length > own ? 1 : 0);
|
|
194
|
+
return shell ? 1 : 0;
|
|
196
195
|
}
|
|
197
196
|
/**
|
|
198
197
|
* A failure is data. One item that asks something the model cannot answer must
|
package/dist/commands/inspect.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { display, KeyStore, listRuns, listSessions, loadProjectEnv, newestRun, readRunMeta, requireSession, runPaths, runPathsAt, sessionIds, sessionPaths, } from '@zenera/engine';
|
|
2
|
-
import { assertState, buildRunReport, FilePayloadStore, isMemory, memoryDir, MemoryStore, PayloadResolver, projectRegistry, readProjectConfig, renderReportHtml,
|
|
2
|
+
import { assertState, buildRunReport, FilePayloadStore, isMemory, memoryDir, MemoryStore, PayloadResolver, projectRegistry, readProjectConfig, renderReportHtml, WORKSPACE_MOUNT, text, } from '@zenera/neo';
|
|
3
3
|
import { spawn } from 'node:child_process';
|
|
4
4
|
import { existsSync } from 'node:fs';
|
|
5
5
|
import { readFile, writeFile } from 'node:fs/promises';
|
|
@@ -654,7 +654,7 @@ async function rebuild(session, run, store) {
|
|
|
654
654
|
title: run.id,
|
|
655
655
|
memory: store,
|
|
656
656
|
// The run never recorded a `workdir:`, so the default name is the guess.
|
|
657
|
-
mounts: workspace ? [{ at:
|
|
657
|
+
mounts: workspace ? [{ at: WORKSPACE_MOUNT, href: pathToFileURL(workspace).href }] : [],
|
|
658
658
|
});
|
|
659
659
|
await writeFile(run.report, renderReportHtml(report), 'utf8');
|
|
660
660
|
}
|
package/dist/commands/memory.js
CHANGED
|
@@ -983,7 +983,7 @@ function textLast(rows, texts) {
|
|
|
983
983
|
: Infinity;
|
|
984
984
|
return table(rows.map((r, i) => [...r, clip(texts[i] ?? '', room)]));
|
|
985
985
|
}
|
|
986
|
-
/** The stored `/memory/<id>.<ext>`
|
|
986
|
+
/** The stored `/memory/<id>.<ext>` names the file, not where it is; a terminal needs the host path. */
|
|
987
987
|
function onHost(o, n) {
|
|
988
988
|
return n.file ? { ...n, file: { ...n.file, path: hostPath(o.dir, n.file) } } : n;
|
|
989
989
|
}
|
package/dist/commands/sandbox.js
CHANGED
|
@@ -122,7 +122,7 @@ async function projectSandbox(cwd, values) {
|
|
|
122
122
|
name: found.name,
|
|
123
123
|
image: build?.tag ?? config.sandbox?.image,
|
|
124
124
|
build,
|
|
125
|
-
limits:
|
|
125
|
+
limits: sandboxLimits(config.sandbox),
|
|
126
126
|
};
|
|
127
127
|
}
|
|
128
128
|
catch {
|
|
@@ -237,22 +237,6 @@ const PAINT = {
|
|
|
237
237
|
function ansi(line) {
|
|
238
238
|
return line.map((s) => PAINT[s.tone ?? 'plain'](s.text)).join('');
|
|
239
239
|
}
|
|
240
|
-
/**
|
|
241
|
-
* The hungriest container this project can start. An agent may override the
|
|
242
|
-
* project's `sandbox:` block, and it is the largest of them that decides
|
|
243
|
-
* whether a batch fits — reporting the project's own figure would understate
|
|
244
|
-
* the machine by however much an agent asked for on top.
|
|
245
|
-
*
|
|
246
|
-
* The overrides are merged onto the project's block rather than read alone,
|
|
247
|
-
* because that is what `SandboxPool.for` does when it builds the container: an
|
|
248
|
-
* agent that names only `memory:` still runs with the project's `cpus:`.
|
|
249
|
-
*/
|
|
250
|
-
function widest(config) {
|
|
251
|
-
const base = config.sandbox ?? {};
|
|
252
|
-
return config.agents
|
|
253
|
-
.map((a) => sandboxLimits(a.sandbox ? { ...base, ...a.sandbox } : base))
|
|
254
|
-
.reduce((most, one) => (one.memory > most.memory ? one : most), sandboxLimits(base));
|
|
255
|
-
}
|
|
256
240
|
/**
|
|
257
241
|
* How many containers of this size the engine could hold at once.
|
|
258
242
|
*
|
package/dist/sandbox.js
CHANGED
|
@@ -18,7 +18,7 @@ export async function preflight(setup, yes) {
|
|
|
18
18
|
yes,
|
|
19
19
|
});
|
|
20
20
|
// A resumed session restarts its own stopped container, which needs no lock.
|
|
21
|
-
await assertLocks(1, { reuses: setup.
|
|
21
|
+
await assertLocks(1, { reuses: setup.sandbox.name });
|
|
22
22
|
READY.add(setup.image);
|
|
23
23
|
}
|
|
24
24
|
//# sourceMappingURL=sandbox.js.map
|
package/dist/validate.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SHAPES, auditModels, credentialFor, envNames, form, machinePluginTools, PLUGINS_ENV, resolveBuild, } from '@zenera/engine';
|
|
2
|
-
import { EXA_GROUP, FileSkillProvider,
|
|
2
|
+
import { EXA_GROUP, FileSkillProvider, PodmanSandbox, WORKSPACE_MOUNT, exaTools, fileTools, frontmatter, projectRegistry, readProjectConfig, sandboxTools, selectTools, toList, } from '@zenera/neo';
|
|
3
3
|
import { existsSync, mkdtempSync, readFileSync, readdirSync, realpathSync, rmSync, statSync, writeFileSync, } from 'node:fs';
|
|
4
4
|
import { tmpdir } from 'node:os';
|
|
5
5
|
import { basename, dirname, isAbsolute, join, relative, resolve, sep } from 'node:path';
|
|
@@ -625,9 +625,9 @@ export function availableTools(root, config) {
|
|
|
625
625
|
return [
|
|
626
626
|
...fileTools({
|
|
627
627
|
root,
|
|
628
|
-
mount: config.sandbox?.workdir ??
|
|
628
|
+
mount: config.sandbox?.workdir ?? WORKSPACE_MOUNT,
|
|
629
629
|
}),
|
|
630
|
-
...sandboxTools({ root, key: 'check' }),
|
|
630
|
+
...sandboxTools(new PodmanSandbox({ root, key: 'check' })),
|
|
631
631
|
...exaTools(),
|
|
632
632
|
];
|
|
633
633
|
}
|
|
@@ -1435,7 +1435,7 @@ async function probeSandbox(config, build, opts, add) {
|
|
|
1435
1435
|
return false;
|
|
1436
1436
|
}
|
|
1437
1437
|
const root = realpathSync(mkdtempSync(join(tmpdir(), 'zen-check-')));
|
|
1438
|
-
const box = new
|
|
1438
|
+
const box = new PodmanSandbox({
|
|
1439
1439
|
root,
|
|
1440
1440
|
key: 'check',
|
|
1441
1441
|
image,
|
|
@@ -1444,13 +1444,11 @@ async function probeSandbox(config, build, opts, add) {
|
|
|
1444
1444
|
network: config.sandbox?.network,
|
|
1445
1445
|
workdir: config.sandbox?.workdir,
|
|
1446
1446
|
user: config.sandbox?.user,
|
|
1447
|
-
engine,
|
|
1448
|
-
exec: opts.exec,
|
|
1449
1447
|
// Not the project's: a check forwards no host values, and keeping the
|
|
1450
1448
|
// container is the caller's choice about their work, not about this.
|
|
1451
1449
|
env: {},
|
|
1452
1450
|
persist: false,
|
|
1453
|
-
});
|
|
1451
|
+
}, { engine, exec: opts.exec });
|
|
1454
1452
|
opts.onProgress?.(`starting ${image ?? 'the container'}`);
|
|
1455
1453
|
try {
|
|
1456
1454
|
const res = await box.exec([
|
|
@@ -1483,7 +1481,7 @@ async function probeSandbox(config, build, opts, add) {
|
|
|
1483
1481
|
return false;
|
|
1484
1482
|
}
|
|
1485
1483
|
finally {
|
|
1486
|
-
await box.
|
|
1484
|
+
await box.close().catch(() => undefined);
|
|
1487
1485
|
rmSync(root, { recursive: true, force: true });
|
|
1488
1486
|
}
|
|
1489
1487
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zenera/cli",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.56",
|
|
4
4
|
"description": "Command-line front end for @zenera/neo: agentic projects you can run, share and commit.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"agents",
|
|
@@ -54,9 +54,9 @@
|
|
|
54
54
|
"@google/genai": "^2.30.0",
|
|
55
55
|
"@inkjs/ui": "^2.0.0",
|
|
56
56
|
"@openrouter/sdk": "^1.4.25",
|
|
57
|
-
"@zenera/engine": "^1.1.
|
|
58
|
-
"@zenera/neo": "^1.1.
|
|
59
|
-
"@zenera/view": "^1.1.
|
|
57
|
+
"@zenera/engine": "^1.1.56",
|
|
58
|
+
"@zenera/neo": "^1.1.56",
|
|
59
|
+
"@zenera/view": "^1.1.56",
|
|
60
60
|
"google-auth-library": "^10.0.0",
|
|
61
61
|
"ink": "^7.1.1",
|
|
62
62
|
"openai": "^6.0.0",
|
|
@@ -128,9 +128,9 @@ reports the first as `memory.uninstructed` and the second as `rules.stale` -
|
|
|
128
128
|
by bytes, so trailing whitespace inside a table, invisible on screen, is caught
|
|
129
129
|
too - and `zen check --fix` repairs both.
|
|
130
130
|
|
|
131
|
-
Nothing else tells a running agent how the store works, so without it
|
|
132
|
-
|
|
133
|
-
|
|
131
|
+
Nothing else tells a running agent how the store works, so without it an agent
|
|
132
|
+
guesses at paths for remembered files instead of copying them into the workspace
|
|
133
|
+
with `memory_copy_file`, and treats a stale recollection as current. Leave the
|
|
134
134
|
file untouched and put this project's own memory policy in a second topic file,
|
|
135
135
|
`agents/memory-policy-instructions.md`, which is read straight after it: then
|
|
136
136
|
`zen check --fix` can replace the first after any upgrade without losing
|
|
@@ -381,10 +381,10 @@ it. Its entire world is the tools it was granted (§3.5) and four paths:
|
|
|
381
381
|
| `/workspace` | the session's workspace - the work itself | read/write; `zen run --read-only` withholds the writes |
|
|
382
382
|
| `/assets` | `assets/`, reference material - §3.11 | read-only |
|
|
383
383
|
| `/skills` | the whole skill catalog - §3.4.1 | read-only |
|
|
384
|
-
| `/memory` | files carried by remembered nodes - §5.3 | read-only, and only when `memory:` is configured |
|
|
385
384
|
|
|
386
385
|
Commands run inside the container `sandbox:` describes (§3.7): the same
|
|
387
|
-
`/workspace`, and whatever the image ships.
|
|
386
|
+
`/workspace`, and whatever the image ships. Remembered files are not mounted
|
|
387
|
+
anywhere: an agent copies one into `/workspace` with `memory_copy_file` (§5.3).
|
|
388
388
|
|
|
389
389
|
Everything else in the project directory is **invisible at run time** -
|
|
390
390
|
`agents.yaml`, `agents/instructions.md`, `agents/prompts/`, `agents/skills/`
|
|
@@ -413,8 +413,9 @@ Run this over every `agents/*instructions.md`, every `agents/prompts/*.md` and
|
|
|
413
413
|
every `agents/skills/*/SKILL.md` after editing any of them. Every path-shaped
|
|
414
414
|
token in those files is read by a model as an instruction to open something:
|
|
415
415
|
|
|
416
|
-
- [ ] Every absolute path begins `/workspace`, `/assets
|
|
417
|
-
|
|
416
|
+
- [ ] Every absolute path begins `/workspace`, `/assets` or `/skills`. Nothing
|
|
417
|
+
else exists - remembered files included; they reach the workspace through
|
|
418
|
+
`memory_copy_file`.
|
|
418
419
|
- [ ] No project file is named: `agents.yaml`, `agents/instructions.md`,
|
|
419
420
|
`agents/prompts/…`, `agents/skills/…`, `sandbox/Dockerfile`, `.env`,
|
|
420
421
|
`.github/…`, `sessions/…`, `SPECIFICATION.md`, `README.md`, `docs/…`.
|
|
@@ -426,8 +427,8 @@ token in those files is read by a model as an instruction to open something:
|
|
|
426
427
|
- [ ] A skill referring to its own sibling file writes the full
|
|
427
428
|
`/skills/<name>/` prefix, not `./rates.csv`: the body is rendered into a
|
|
428
429
|
prompt, not executed from its folder.
|
|
429
|
-
- [ ]
|
|
430
|
-
and `/assets` only where an `assets/` directory exists.
|
|
430
|
+
- [ ] `memory_copy_file` is named only in prompts for agents that have
|
|
431
|
+
`memory:` (§5.3), and `/assets` only where an `assets/` directory exists.
|
|
431
432
|
- [ ] The agent holding the prompt has the tool the path implies - `read_file`
|
|
432
433
|
to open one, `sandbox:*` to run one (§3.4.1).
|
|
433
434
|
- [ ] Every instruction that opens a file states what to do when it is not there
|
|
@@ -1031,22 +1032,9 @@ prompt is executed on every run, by an agent that is root in a filesystem that
|
|
|
1031
1032
|
is about to be thrown away.
|
|
1032
1033
|
|
|
1033
1034
|
Agents share one container, because they share the workspace and a hand-off is
|
|
1034
|
-
meant to be continuous.
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
```yaml
|
|
1038
|
-
sandbox:
|
|
1039
|
-
image: docker.io/library/python:3.14-slim-bookworm
|
|
1040
|
-
|
|
1041
|
-
agents:
|
|
1042
|
-
- name: builder
|
|
1043
|
-
tools: [files:*, sandbox:*]
|
|
1044
|
-
sandbox:
|
|
1045
|
-
image: docker.io/library/node:22-bookworm-slim
|
|
1046
|
-
memory: 8192
|
|
1047
|
-
- name: analyst
|
|
1048
|
-
tools: [files:*, sandbox:*] # shares the project's container
|
|
1049
|
-
```
|
|
1035
|
+
meant to be continuous. There is one `sandbox:` block, at the top level; an
|
|
1036
|
+
agent cannot have its own (`agents[].sandbox` fails to load). A tool one agent
|
|
1037
|
+
needs goes into the project's image, so every agent has it.
|
|
1050
1038
|
|
|
1051
1039
|
**Write `persist: true` unless you have a reason not to.** By default the
|
|
1052
1040
|
container is _removed_ when the session closes, and only two paths survive it:
|
|
@@ -1407,7 +1395,7 @@ zen check --fix
|
|
|
1407
1395
|
|
|
1408
1396
|
It is what tells the agent that the store is reached only through the tools, that
|
|
1409
1397
|
`memory_search` clips a node's text and `memory_load` reads it whole, that a
|
|
1410
|
-
remembered file
|
|
1398
|
+
remembered file is run by copying it into the workspace with `memory_copy_file`,
|
|
1411
1399
|
what a node must carry to be worth having, and that a correction is a
|
|
1412
1400
|
`SUPERSEDES` edge rather than an edit. It is its own file rather than a section of
|
|
1413
1401
|
`agents/instructions.md` because it arrives with the `memory:` block and leaves
|
|
@@ -1431,7 +1419,7 @@ persist. Anything authoritative - a rate, a policy clause, a procedure - belongs
|
|
|
1431
1419
|
in a skill, where it is versioned and reviewable.
|
|
1432
1420
|
|
|
1433
1421
|
The full treatment - kinds and relations, how ranking and stitching spend their
|
|
1434
|
-
budget, remembered files
|
|
1422
|
+
budget, remembered files and `memory_copy_file`, audience design, and how to put memory
|
|
1435
1423
|
in front of a `zen rag` index - is in the `zen-memory` skill.
|
|
1436
1424
|
|
|
1437
1425
|
### 5.4 Cache discipline
|
|
@@ -1979,8 +1967,7 @@ Before finishing any change here:
|
|
|
1979
1967
|
candidates; these are the judgements to make about each one)**
|
|
1980
1968
|
|
|
1981
1969
|
- [ ] Every absolute path in `agents/*instructions.md`, `agents/prompts/*.md` and
|
|
1982
|
-
`agents/skills/*/SKILL.md` is under `/workspace`, `/assets
|
|
1983
|
-
`/memory`
|
|
1970
|
+
`agents/skills/*/SKILL.md` is under `/workspace`, `/assets` or `/skills`
|
|
1984
1971
|
- [ ] No prompt or skill names a project file - `agents.yaml`, a prompt path, a
|
|
1985
1972
|
skill's repository path, `sandbox/Dockerfile`, `.env`, `sessions/`
|
|
1986
1973
|
- [ ] No `../`, `~`, or host path; nothing assumes the workspace is the project
|
|
@@ -2089,7 +2076,7 @@ candidates; these are the judgements to make about each one)**
|
|
|
2089
2076
|
| Fails only on genuinely hard cases | Promote that agent's tier, or split the hard path out |
|
|
2090
2077
|
| Shows no reasoning while it works | Turn summaries on for that model - §7.6 |
|
|
2091
2078
|
| Forgets across conversations | Continue the session rather than starting a new one |
|
|
2092
|
-
|
|
|
2079
|
+
| Guesses a path for a remembered file | `agents/memory-instructions.md` is missing the block - §5.3 |
|
|
2093
2080
|
| Recalls a note it cannot check or continue | Same block: it is what requires provenance on every node - §5.3 |
|
|
2094
2081
|
| Breaks at load with a named path | Read the message - it names the exact key |
|
|
2095
2082
|
|
|
@@ -268,7 +268,8 @@ steps 2-3. Otherwise work through these with node ids:
|
|
|
268
268
|
memory (`--dir <memory dir>`). Today's results are only a findability
|
|
269
269
|
probe: memory may have changed since the run. Do not claim a hit was
|
|
270
270
|
available then, or memory was empty then, without historical evidence.
|
|
271
|
-
5. **Wrong channel.**
|
|
271
|
+
5. **Wrong channel.** A remembered file is reached only by `memory_copy_file`;
|
|
272
|
+
a `run_command` or file tool guessing a path for one breaks
|
|
272
273
|
`agents/memory-instructions.md`.
|
|
273
274
|
|
|
274
275
|
### Memory - saved correctly
|
|
@@ -177,8 +177,9 @@ a file short.
|
|
|
177
177
|
## Paths
|
|
178
178
|
|
|
179
179
|
Every path-shaped token in these files is read by a model as an instruction to
|
|
180
|
-
open something, and a running agent sees
|
|
181
|
-
`/skills
|
|
180
|
+
open something, and a running agent sees three: `/workspace`, `/assets`,
|
|
181
|
+
`/skills`. Remembered files are not mounted; `memory_copy_file` brings one into
|
|
182
|
+
`/workspace`. The sweep is in the `zen-review` skill:
|
|
182
183
|
|
|
183
184
|
```sh
|
|
184
185
|
.github/skills/zen-review/scripts/check-paths.sh
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: zen-memory
|
|
3
|
-
description: Agent memory in Zenera projects - the `memory:` block and per-agent `access`/`sees`/`writes`/`autoRecall`, the
|
|
3
|
+
description: Agent memory in Zenera projects - the `memory:` block and per-agent `access`/`sees`/`writes`/`autoRecall`, the six `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 and copying them back with `memory_copy_file`, and putting memory in front of a `zen rag` index.
|
|
4
4
|
user-invocable: false
|
|
5
5
|
---
|
|
6
6
|
|
|
@@ -120,8 +120,8 @@ are the same result - and the second is what you need when the question is
|
|
|
120
120
|
whether a host, a flag or a command was already written down. Grep reads the
|
|
121
121
|
text, the metadata and the bytes of remembered files, applies the mask, leaves
|
|
122
122
|
out superseded nodes unless asked, and names any file it could not read. It is
|
|
123
|
-
also what an agent is supposed to reach for instead of
|
|
124
|
-
|
|
123
|
+
also what an agent is supposed to reach for instead of looking for the files
|
|
124
|
+
some other way: they are never mounted, so the tools are the only way in.
|
|
125
125
|
|
|
126
126
|
It is not a diagnostic instrument, though - it is ordinary retrieval, and an
|
|
127
127
|
agent is expected to reach for it mid-run as readily as for search. The line
|
|
@@ -160,7 +160,7 @@ later.
|
|
|
160
160
|
| `plan` | an approach that worked, worth reusing on a similar request |
|
|
161
161
|
| `fact` | a durable truth about the environment or the domain |
|
|
162
162
|
| `snippet` | a short piece of code or configuration, too small to be a file |
|
|
163
|
-
| `file` | an artifact kept whole
|
|
163
|
+
| `file` | an artifact kept whole, to copy back and run again |
|
|
164
164
|
| `operation` | an external call that was made - an endpoint, command or query |
|
|
165
165
|
| `preference` | a standing instruction from the user that applies to every run |
|
|
166
166
|
|
|
@@ -225,8 +225,9 @@ below.
|
|
|
225
225
|
|
|
226
226
|
Several runs may read and write one memory at once, and a run killed mid-write
|
|
227
227
|
leaves the last commit intact. It is committed with the project - everything
|
|
228
|
-
but `memory.db-wal`/`memory.db-shm`, which are runtime state.
|
|
229
|
-
mounted
|
|
228
|
+
but `memory.db-wal`/`memory.db-shm`, which are runtime state. Nothing here is
|
|
229
|
+
mounted into the sandbox: a remembered file reaches the workspace only as a copy
|
|
230
|
+
made by `memory_copy_file`. A memory from an
|
|
230
231
|
older `zen` (`graph.json`, `vectors.f32`) is refused until converted once with
|
|
231
232
|
`zen memory migrate`.
|
|
232
233
|
|
|
@@ -386,18 +387,16 @@ a `file` argument on a node instead, and copies the **bytes** out:
|
|
|
386
387
|
```
|
|
387
388
|
|
|
388
389
|
The path is the one the **file tools** use, resolved the same way. The copy
|
|
389
|
-
lands at `<project>/memory/files/<id>.<ext
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
/memory/01JD9Q7X8N2K4M6P8R0T2V4W6Y.py
|
|
393
|
-
```
|
|
390
|
+
lands at `<project>/memory/files/<id>.<ext>`, and the agent knows it by that
|
|
391
|
+
name - `01JD9Q7X8N2K4M6P8R0T2V4W6Y.py` - and by its node id. It is not on any
|
|
392
|
+
path the agent can open.
|
|
394
393
|
|
|
395
394
|
| Rule | Value |
|
|
396
395
|
| --------- | ---------------------------------------------------------------- |
|
|
397
396
|
| Size cap | 2 MiB. Over it, keep the artifact and commit a `snippet` instead |
|
|
398
397
|
| Inlined | under 32 KiB - `memory_load` returns the contents |
|
|
399
|
-
| Larger | `memory_load` returns the
|
|
400
|
-
| Mount |
|
|
398
|
+
| Larger | `memory_load` returns the name; `memory_copy_file` to open it |
|
|
399
|
+
| Mount | none - `memory_copy_file` copies into `/workspace` |
|
|
401
400
|
| Extension | preserved, because it decides how the file runs and renders |
|
|
402
401
|
|
|
403
402
|
### The agent has to be able to write the file first
|
|
@@ -415,7 +414,7 @@ text no matter how much the memory design leans on `file` nodes.
|
|
|
415
414
|
| Neither | No. Everything worth keeping has to fit on one line of `text` |
|
|
416
415
|
|
|
417
416
|
The workspace is the only tree that round-trips, because it is the only
|
|
418
|
-
writable one. `/assets
|
|
417
|
+
writable one. `/assets` and `/skills` resolve as well - they are
|
|
419
418
|
mounts the file tools know by name - but they are **read-only**, so nothing can
|
|
420
419
|
be put there to be remembered. Every other absolute path is real to
|
|
421
420
|
`run_command` and outside the workspace root, so a file written to `/tmp` comes
|
|
@@ -434,10 +433,13 @@ context ever uses workspace vocabulary and the model has no reason to prefer
|
|
|
434
433
|
`/workspace` over `/tmp`. Either give it the file tools, or say in its prompt
|
|
435
434
|
that work it means to keep goes in `/workspace`.
|
|
436
435
|
|
|
437
|
-
Reusing one is the point of keeping it
|
|
436
|
+
Reusing one is the point of keeping it. `memory_copy_file` needs only `read`
|
|
437
|
+
access, puts the file at `/workspace/<id>.<ext>` unless given a `to`, and will
|
|
438
|
+
not replace an existing file without `overwrite`:
|
|
438
439
|
|
|
439
440
|
```
|
|
440
|
-
|
|
441
|
+
memory_copy_file { "id": "01JD9Q7X8N2K4M6P8R0T2V4W6Y" } → /workspace/01JD9Q7X8N2K4M6P8R0T2V4W6Y.py
|
|
442
|
+
run_command python3 01JD9Q7X8N2K4M6P8R0T2V4W6Y.py
|
|
441
443
|
```
|
|
442
444
|
|
|
443
445
|
Which means the file has to be **self-contained**. A script that reads
|
|
@@ -445,10 +447,10 @@ Which means the file has to be **self-contained**. A script that reads
|
|
|
445
447
|
that takes its inputs as arguments will. If it needs a credential, it should
|
|
446
448
|
read it from the environment and say so in the node text.
|
|
447
449
|
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
remembered file: copy it
|
|
451
|
-
and link it with `SUPERSEDES` to the old.
|
|
450
|
+
Only a commit puts a file in the store, so every file there has a node
|
|
451
|
+
explaining what it is and the graph cannot acquire orphans. The copy in the
|
|
452
|
+
workspace is the agent's to edit. To change a remembered file: copy it, edit the
|
|
453
|
+
copy, commit the new one and link it with `SUPERSEDES` to the old.
|
|
452
454
|
|
|
453
455
|
The node text describes and locates; the file carries the content. Reach for a
|
|
454
456
|
node with no file only when the whole of what you know fits on one line.
|
|
@@ -559,7 +561,8 @@ gets whether it loads the skill or not.
|
|
|
559
561
|
|
|
560
562
|
**Every project that enables memory carries `agents/memory-instructions.md`**,
|
|
561
563
|
as shipped by `zen`. That file is how the agent is told to use the store: read
|
|
562
|
-
and search it only through the tools,
|
|
564
|
+
and search it only through the tools, copy a file out with `memory_copy_file`
|
|
565
|
+
before running it, and what a
|
|
563
566
|
node must carry to still be worth having.
|
|
564
567
|
|
|
565
568
|
`zen init` writes it, because the projects it scaffolds have memory on from the
|
|
@@ -778,7 +781,7 @@ agents:
|
|
|
778
781
|
| Vectors fewer than nodes | Some nodes were committed with no embedder; they are only reachable by term overlap |
|
|
779
782
|
| The graph fills with restated requests | The commit rule is not in a prompt or skill. State the "would a later run redo this" test |
|
|
780
783
|
| Runs do real work and the graph stays empty | The agent is bound `read`, or nothing names the moments: empty recall then work, before an answer, a handoff or a fork's return |
|
|
781
|
-
| An agent
|
|
784
|
+
| An agent guesses a path for a remembered file | The house-rules block is missing from `agents/memory-instructions.md` - nothing tells it to use `memory_copy_file` |
|
|
782
785
|
| A recalled fact cannot be checked or continued | Nodes were committed with no provenance. The block's "say where it came from" rule is what prevents it |
|
|
783
786
|
| Recall returns pointers and the run re-reads it all | Content was committed as `text` alone. A node's text describes and locates; the content belongs in a file |
|
|
784
787
|
| A wrong memory keeps coming back | It was edited instead of superseded, or superseded in the wrong direction - the **new** node is the source |
|
|
@@ -78,10 +78,10 @@ the sandbox pin. Finish setup and all edits before saving the final receipt.
|
|
|
78
78
|
|
|
79
79
|
### `check-paths.sh` - the §2.5 sweep
|
|
80
80
|
|
|
81
|
-
A running agent's whole world is
|
|
82
|
-
|
|
81
|
+
A running agent's whole world is three paths: `/workspace`, `/assets` and
|
|
82
|
+
`/skills`. Every path-shaped token in `agents/*instructions.md`,
|
|
83
83
|
`agents/prompts/*.md` and a skill's markdown is read by a model as an
|
|
84
|
-
instruction to open something, so anything outside those
|
|
84
|
+
instruction to open something, so anything outside those three is an instruction
|
|
85
85
|
to open a file that is not there.
|
|
86
86
|
|
|
87
87
|
```sh
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
# check-paths.sh each candidate, with the file and line it is on
|
|
7
7
|
# check-paths.sh raw the tokens alone, unfiltered — the sweep itself
|
|
8
8
|
#
|
|
9
|
-
# A running agent sees
|
|
9
|
+
# A running agent sees three paths: /workspace, /assets and /skills.
|
|
10
10
|
# Everything else printed here is either noise this script has not learned yet
|
|
11
11
|
# or an instruction to open a file that is not there. There is no third case,
|
|
12
12
|
# which is why this exits non-zero whenever it prints one: the list is meant to
|
|
@@ -24,9 +24,9 @@ cd "$(dirname "$0")/../../../.."
|
|
|
24
24
|
# stray `/examples.md`, and that fragment is noise on every run of every project.
|
|
25
25
|
TOKEN='[~.]?/?[A-Za-z0-9_.-]*(/[A-Za-z0-9_.*-]+)+'
|
|
26
26
|
|
|
27
|
-
# The
|
|
27
|
+
# The three mounts, and only those: a token under one of them is a path that
|
|
28
28
|
# resolves.
|
|
29
|
-
MOUNTS='^/(workspace|assets|skills
|
|
29
|
+
MOUNTS='^/(workspace|assets|skills)(/|$)'
|
|
30
30
|
|
|
31
31
|
# English that happens to contain a slash, and the placeholder paths of a
|
|
32
32
|
# worked example. Add to this rather than teaching a reviewer to skip the same
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: zen-sandbox
|
|
3
|
-
description: 'How the container sandbox works, when and how to configure it in `agents.yaml` (`sandbox:`
|
|
3
|
+
description: 'How the container sandbox works, when and how to configure it in `agents.yaml` (the project's `sandbox:` block, one container per session), the four `sandbox:*` tools, mount layout (/workspace, $HOME, /tmp, /run/zenera/keys), lifecycle and persistence (`persist: true`), credential forwarding by name, resource ceilings (cpus, memory, pids), standard vs strict hardening profiles, path rules, and debugging container issues with `zen sandbox`. Refers to `zen-cli` (`.github/skills/zen-cli/references/sandbox.md`).'
|
|
4
4
|
user-invocable: false
|
|
5
5
|
---
|
|
6
6
|
|
|
@@ -95,7 +95,6 @@ Inside the container, paths are isolated to designated mount points:
|
|
|
95
95
|
| `/workspace` | Session workspace | read-write* | The work itself. Changes survive session completion. |
|
|
96
96
|
| `/home/agent` | `.data/sandbox/home` | read-write | User home (`$HOME`). Persists across sessions. |
|
|
97
97
|
| `/tmp` | In-memory / host tmpfs | read-write | Ephemeral scratch; holds `/tmp/zenera-jobs`. |
|
|
98
|
-
| `/memory` | Session memory directory | read-only | Generated memory files (when `memory:` is enabled). |
|
|
99
98
|
| `/assets` | Project assets directory | read-only | Reference assets declared in `SPECIFICATION.md`. |
|
|
100
99
|
| `/skills` | Project skills directory | read-only | Custom skill files available to agents. |
|
|
101
100
|
| `/run/zenera/keys` | Keychain / temp directory | read-only | Forwarded file credentials (e.g. Vertex service keys). |
|
|
@@ -138,7 +137,7 @@ zn-<key>-<digest>
|
|
|
138
137
|
|
|
139
138
|
## 5. Configuring `sandbox:` in `agents.yaml`
|
|
140
139
|
|
|
141
|
-
Configured at the top level
|
|
140
|
+
Configured once, at the top level. Every agent in a session shares the one container; `agents[].sandbox` was removed and fails to load:
|
|
142
141
|
|
|
143
142
|
```yaml
|
|
144
143
|
sandbox:
|
|
@@ -151,15 +150,6 @@ sandbox:
|
|
|
151
150
|
hardening: standard
|
|
152
151
|
env: [HTTPS_PROXY, NO_PROXY]
|
|
153
152
|
keys: true
|
|
154
|
-
|
|
155
|
-
agents:
|
|
156
|
-
- name: builder
|
|
157
|
-
# Inherits base sandbox configuration
|
|
158
|
-
|
|
159
|
-
- name: isolated-runner
|
|
160
|
-
sandbox:
|
|
161
|
-
hardening: strict
|
|
162
|
-
network: none
|
|
163
153
|
```
|
|
164
154
|
|
|
165
155
|
### Configuration Fields
|
|
@@ -247,11 +237,10 @@ Every container runs with baseline safety controls:
|
|
|
247
237
|
|
|
248
238
|
---
|
|
249
239
|
|
|
250
|
-
## 8.
|
|
240
|
+
## 8. One Sandbox per Session
|
|
251
241
|
|
|
252
|
-
-
|
|
253
|
-
-
|
|
254
|
-
- The `sandbox:*` tool definitions remain uniform across the session; when an agent calls a tool, the pool routes the call to that specific agent's container at invocation time.
|
|
242
|
+
- Every agent in a session runs in the **same container** and sees the same `/workspace`.
|
|
243
|
+
- A tool only one agent needs still goes in the project's image; there is no per-agent sandbox.
|
|
255
244
|
|
|
256
245
|
---
|
|
257
246
|
|
|
@@ -603,8 +603,9 @@
|
|
|
603
603
|
"oneOf": [{ "type": "boolean" }, { "$ref": "#/$defs/memoryBinding" }]
|
|
604
604
|
},
|
|
605
605
|
"sandbox": {
|
|
606
|
-
"description": "
|
|
607
|
-
"
|
|
606
|
+
"description": "Removed: a session has one sandbox, the project's, shared by every agent.",
|
|
607
|
+
"deprecationMessage": "Per-agent sandboxes were removed — move these settings to the project's top-level `sandbox:`.",
|
|
608
|
+
"not": {}
|
|
608
609
|
},
|
|
609
610
|
"default": {
|
|
610
611
|
"description": "The entry point, when no top-level `default:` names one.",
|
|
@@ -87,7 +87,8 @@ Use `copy_file` to duplicate a file, never `read_file` + `write_file`. The bytes
|
|
|
87
87
|
conversation, so there is no size cap and binaries arrive intact.
|
|
88
88
|
|
|
89
89
|
- The source may be in a read-only mount; only the destination must be writable.
|
|
90
|
-
This is how something under `/assets
|
|
90
|
+
This is how something under `/assets` or `/skills` reaches `/workspace`. Remembered
|
|
91
|
+
files are not mounted; `memory_copy_file` brings one into the workspace.
|
|
91
92
|
- Set `overwrite: true` only when intentionally replacing an existing destination.
|
|
92
93
|
- Copying a directory and its contents requires `recursive: true`.
|
|
93
94
|
|
|
@@ -103,6 +104,6 @@ All file operations are confined to mounted trees:
|
|
|
103
104
|
|
|
104
105
|
- `/workspace`: The primary writable directory for the project. Paths inside the workspace
|
|
105
106
|
(such as `/workspace/src/main.ts`) are where project files reside.
|
|
106
|
-
- `/assets`, `/skills
|
|
107
|
+
- `/assets`, `/skills`: Read-only mounts. You may read, list, and search them,
|
|
107
108
|
but you cannot write, move, or delete files inside them.
|
|
108
109
|
- Any attempt to reach outside these mounts fails with a containment error.
|
|
@@ -71,9 +71,10 @@ above produced it, `←informed` means it informed the line above.
|
|
|
71
71
|
background. A `+` reference points to an id already shown above.
|
|
72
72
|
|
|
73
73
|
Node text is clipped to 160 characters. A file node adds one line with its
|
|
74
|
-
|
|
75
|
-
complete node
|
|
76
|
-
|
|
74
|
+
`<id>.<ext>` name, size, and use count. Use `memory_load` to obtain the
|
|
75
|
+
complete node; a small file comes back inline. To open or run a remembered
|
|
76
|
+
file, copy it into the workspace with `memory_copy_file`, then use the path it
|
|
77
|
+
returns. Remembered files are not on any mounted path.
|
|
77
78
|
|
|
78
79
|
Direct store access is prohibited because it bypasses audience controls, may
|
|
79
80
|
serve superseded nodes, does not record use, and can race with another writer.
|
|
@@ -93,7 +94,7 @@ inputs, outputs, and credentials handling.
|
|
|
93
94
|
### Keep memory out of ordinary answers
|
|
94
95
|
|
|
95
96
|
Report findings and checkable sources, not the mechanism that found them. Do
|
|
96
|
-
not expose
|
|
97
|
+
not expose remembered file names, node ids, or say that something was recalled or
|
|
97
98
|
remembered. The exception is a request about the store itself, where ids and
|
|
98
99
|
memory state are the subject.
|
|
99
100
|
|
|
@@ -208,8 +209,9 @@ of living project files.
|
|
|
208
209
|
|
|
209
210
|
Put provenance in the file itself as a short header. Make executable artifacts
|
|
210
211
|
self-contained, take request-specific values as arguments, read credentials
|
|
211
|
-
from the environment, and accept an output path under `/workspace`.
|
|
212
|
-
|
|
212
|
+
from the environment, and accept an output path under `/workspace`. A later run
|
|
213
|
+
reaches the script only through `memory_copy_file`, so it must not depend on
|
|
214
|
+
where it was stored.
|
|
213
215
|
|
|
214
216
|
Commit a script only after it ran successfully against the intended environment
|
|
215
217
|
and produced verified output. Commit its invocation and operations, not its
|
|
@@ -18,8 +18,34 @@ COPY --from=node /usr/local/lib/node_modules /usr/local/lib/node_modules
|
|
|
18
18
|
RUN ln -s /usr/local/lib/node_modules/npm/bin/npm-cli.js /usr/local/bin/npm \
|
|
19
19
|
&& ln -s /usr/local/lib/node_modules/npm/bin/npx-cli.js /usr/local/bin/npx
|
|
20
20
|
|
|
21
|
-
# Keep the
|
|
22
|
-
|
|
21
|
+
# Keep the third-party dependencies of @zenera/{cli,engine,neo,rag,view} cached
|
|
22
|
+
# when the pinned CLI release changes. Keep in sync with their package.json files.
|
|
23
|
+
RUN npm install -g \
|
|
24
|
+
"@anthropic-ai/sdk@^0.120.0" \
|
|
25
|
+
"@apidevtools/swagger-parser@^12.0.0" \
|
|
26
|
+
"@google/genai@^2.30.0" \
|
|
27
|
+
"@inkjs/ui@^2.0.0" \
|
|
28
|
+
"@lancedb/lancedb@^0.38.0" \
|
|
29
|
+
"@openrouter/sdk@^1.4.25" \
|
|
30
|
+
"@types/hast@^3.0.5" \
|
|
31
|
+
"google-auth-library@^10.0.0" \
|
|
32
|
+
"graphology@^0.26.0" \
|
|
33
|
+
"ink@^7.1.1" \
|
|
34
|
+
"lowlight@^3.3.0" \
|
|
35
|
+
"mermaid@^12.2.0" \
|
|
36
|
+
"openai@^6.0.0" \
|
|
37
|
+
"react@^19.2.8" \
|
|
38
|
+
"rehype-sanitize@^6.0.0" \
|
|
39
|
+
"rehype-slug@^6.0.0" \
|
|
40
|
+
"remark-frontmatter@^5.0.0" \
|
|
41
|
+
"remark-gfm@^4.0.1" \
|
|
42
|
+
"remark-parse@^11.0.0" \
|
|
43
|
+
"remark-rehype@^11.1.2" \
|
|
44
|
+
"unified@^11.0.5" \
|
|
45
|
+
"yaml@^2.9.1" \
|
|
46
|
+
"yauzl@^3.4.0" \
|
|
47
|
+
"yazl@^3.3.1" \
|
|
48
|
+
"zod@^4.6.7"
|
|
23
49
|
|
|
24
50
|
# Pinned to the `zen` that wrote this file, so the tools in the container are
|
|
25
51
|
# the ones the session outside it was built by. Bump both together.
|