zam-core 0.3.12 → 0.4.0
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/.agents/skills/zam/SKILL.md +97 -5
- package/dist/cli/index.js +1278 -377
- package/dist/cli/index.js.map +1 -1
- package/dist/index.d.ts +148 -2
- package/dist/index.js +538 -204
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -68,8 +68,36 @@ zam bridge submit --user <username> --card-id <id> --rating <1-4>
|
|
|
68
68
|
zam bridge get-skill --slug <slug>
|
|
69
69
|
zam bridge get-monitor --session <id> # read monitor log as JSON
|
|
70
70
|
echo '{"patterns":[...]}' | zam bridge analyze-monitor --session <id> # auto-rate from log
|
|
71
|
+
zam bridge add-token --user <username> # create token + user card from JSON stdin
|
|
72
|
+
zam bridge capture-ui [--session <id>] [--output <path>] [--image <path>] # screenshot for agent-side vision
|
|
71
73
|
```
|
|
72
74
|
|
|
75
|
+
### Codex Execution Notes
|
|
76
|
+
|
|
77
|
+
Use `npx zam ...` from the personal instance unless a linked `zam` binary is known
|
|
78
|
+
to resolve correctly. The configured Turso database is remote; if a ZAM command
|
|
79
|
+
fails with network sandbox errors such as `EACCES ...:443`, retry the same
|
|
80
|
+
command with escalated permissions and a scoped prefix rule like `["npx","zam"]`.
|
|
81
|
+
|
|
82
|
+
On Windows in Codex, prefer the classic Windows PowerShell executable for ZAM
|
|
83
|
+
commands that contain quoted or multi-word arguments:
|
|
84
|
+
|
|
85
|
+
```text
|
|
86
|
+
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
The default `pwsh.exe` runner can fail with `CreateProcessAsUserW failed: 1312`,
|
|
90
|
+
and `cmd` can split quoted arguments in surprising ways. `cmd` is fine for simple
|
|
91
|
+
no-space commands such as `npx zam stats --user thomas`, but use Windows
|
|
92
|
+
PowerShell for `--task`, `--concept`, `--question`, and multi-word `--query`
|
|
93
|
+
values.
|
|
94
|
+
|
|
95
|
+
For a concept that should immediately enter the user's learning queue, prefer
|
|
96
|
+
`zam bridge add-token --user <username>` with JSON on stdin. `zam token register`
|
|
97
|
+
creates the token only; it does not ensure the user's card exists. Do not use
|
|
98
|
+
`bridge add-token` through `zam bridge serve --stdin`, because `add-token` reads
|
|
99
|
+
raw stdin itself.
|
|
100
|
+
|
|
73
101
|
---
|
|
74
102
|
|
|
75
103
|
## What is a Knowledge Token?
|
|
@@ -107,11 +135,11 @@ Always prefer observation over probing. Talking interrupts flow. The best ZAM se
|
|
|
107
135
|
|
|
108
136
|
## Observation Levels
|
|
109
137
|
|
|
110
|
-
- **Level 1 — Shell
|
|
111
|
-
- **Level 2 — Screen
|
|
138
|
+
- **Level 1 — Shell**: Agent reads shell command history and output to infer success/failure
|
|
139
|
+
- **Level 2 — Screen**: Agent captures screenshots via `zam bridge capture-ui` and analyzes them with Codex's multimodal capabilities or a vision-capable subagent
|
|
112
140
|
- **Level 3 — Real life** (future): Voice + visual overlay on device (phone, AR). The agent is an overlay; the user lives in their world.
|
|
113
141
|
|
|
114
|
-
The interface is pluggable — future observers replace Level 1 shell calls with their own primitives.
|
|
142
|
+
The interface is pluggable — future observers replace Level 1 shell calls with their own primitives.
|
|
115
143
|
|
|
116
144
|
---
|
|
117
145
|
|
|
@@ -158,6 +186,13 @@ zam token register --slug <slug> --concept "<one sentence>" --domain <d> --bloom
|
|
|
158
186
|
zam token prereq --token <child> --requires <parent>
|
|
159
187
|
```
|
|
160
188
|
|
|
189
|
+
If the token should be reviewed by this user, create the card in the same step:
|
|
190
|
+
|
|
191
|
+
```bash
|
|
192
|
+
printf '%s\n' '{"slug":"<slug>","concept":"<one sentence>","domain":"<d>","bloom_level":2,"question":"<concept-free recall question>"}' \
|
|
193
|
+
| zam bridge add-token --user <username>
|
|
194
|
+
```
|
|
195
|
+
|
|
161
196
|
### STEP 3 — Start a session
|
|
162
197
|
|
|
163
198
|
**For review/conceptual sessions**, load review data into a temp file so it stays out of the conversation, then start the session quietly:
|
|
@@ -195,7 +230,7 @@ Hand off to the user:
|
|
|
195
230
|
|
|
196
231
|
Step back. Do not interrupt unless the user asks for help.
|
|
197
232
|
|
|
198
|
-
**
|
|
233
|
+
**Choose the observation approach:**
|
|
199
234
|
|
|
200
235
|
Check the user's preference first:
|
|
201
236
|
```bash
|
|
@@ -246,7 +281,64 @@ diagnostic output is needed.
|
|
|
246
281
|
|
|
247
282
|
When done, the user can simply close the monitored terminal window — hooks only live in that shell process. No cleanup command needed.
|
|
248
283
|
|
|
249
|
-
**
|
|
284
|
+
**Approach C — Agent-side UI observation (Level 2):** For GUI tasks where shell hooks can't see what's happening. The agent captures screenshots and analyzes them with Codex's multimodal capabilities, preferably a cost-efficient vision-capable subagent when one is available. Do not rely on the laptop's local LLM for rating unless the user explicitly wants that; it may be too weak for UI evidence.
|
|
285
|
+
|
|
286
|
+
```bash
|
|
287
|
+
zam session start --user <username> --task "<description>" --context ui --skip-review --json
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
Workflow:
|
|
291
|
+
1. Tell the user: *"Perform the task in the app, leave the relevant window visible, and come back when you're done."*
|
|
292
|
+
2. When the user returns, capture the screen:
|
|
293
|
+
```bash
|
|
294
|
+
zam bridge capture-ui --session <session-id> --process-name <app>
|
|
295
|
+
```
|
|
296
|
+
Under the default observer policy (`observer.scope=window`) a capture must
|
|
297
|
+
target a window: pass `--process-name <app>` or `--hwnd <handle>`.
|
|
298
|
+
|
|
299
|
+
If a capture is refused, the response will be `{ "granted": false, "denied": true, "denialReason": "<reason>", "reason": "<explanation>", ... }`.
|
|
300
|
+
Handle these denial reasons accordingly:
|
|
301
|
+
- `scope-requires-target`: Pass a target window (`--process-name` or `--hwnd`), or tell the user to enable full-screen captures via `zam settings set observer.scope fullscreen`.
|
|
302
|
+
- `scope-off`: The observer is disabled. Tell the user to enable it via `zam settings set observer.scope window`.
|
|
303
|
+
- `sensitive`: The targeted or active window matches the built-in sensitive filter (e.g., password manager, banking, private browsing). Skip UI observation for this step and inform the user.
|
|
304
|
+
- `denylisted`: The process is explicitly blocked by the user's denylist. Skip UI observation.
|
|
305
|
+
- `not-allowlisted`: The process is not in the user's allowlist. Suggest the user grant access via `zam observer grant <process>` if appropriate.
|
|
306
|
+
|
|
307
|
+
A granted response is JSON with `granted: true`, `imagePath`, `base64`
|
|
308
|
+
(PNG screenshot), `captureMethod`, `captureTarget` metadata, and a
|
|
309
|
+
`permission` block. Save to a stable file with `--output <path>` whenever
|
|
310
|
+
you will pass the image to a subagent.
|
|
311
|
+
3. If Codex subagents are available, spawn a cheap vision-capable subagent (for example a mini model) and pass the screenshot as a local image plus the task, expected evidence, and candidate token slugs. Ask it for observed facts and suggested 1-4 ratings with brief evidence.
|
|
312
|
+
4. Review `captureTarget` and the visual evidence yourself before writing
|
|
313
|
+
ratings. If `captureMethod` is `fullscreen`, the target is missing, the
|
|
314
|
+
title/process does not match the intended app, or the screenshot is
|
|
315
|
+
ambiguous, recapture with `--process-name <name>` or `--hwnd <handle>`
|
|
316
|
+
before rating. For Windows Store/UWP apps such as Calculator, the visible
|
|
317
|
+
window may belong to `ApplicationFrameHost` even when the app process is
|
|
318
|
+
`CalculatorApp`; prefer a targeted recapture and verify the returned window
|
|
319
|
+
title.
|
|
320
|
+
5. Submit ratings and session logs for only the tokens the user actually exercised.
|
|
321
|
+
|
|
322
|
+
The `capture-ui` command supports:
|
|
323
|
+
- `--image <path>` — analyze an existing image instead of capturing
|
|
324
|
+
- `--output <path>` — save the screenshot to a specific path
|
|
325
|
+
- `--process-name <name>` or `--hwnd <handle>` — target a specific window when known
|
|
326
|
+
|
|
327
|
+
On Windows, uses PowerShell/.NET for screen capture. On macOS, uses `screencapture`.
|
|
328
|
+
|
|
329
|
+
**Observer permissions (Layer 2, ADR-0001).** `capture-ui` enforces a
|
|
330
|
+
user-configurable policy resolved from `zam settings`: `observer.scope`
|
|
331
|
+
(`off` | `window` | `fullscreen`), `observer.allowlist`, `observer.denylist`,
|
|
332
|
+
`observer.consent`, `observer.retention`. Set them with e.g.
|
|
333
|
+
`zam settings set --key observer.scope --value window`. A built-in sensitive
|
|
334
|
+
set (password managers, auth/UAC dialogs, banking) is always refused and
|
|
335
|
+
cannot be allowlisted — those return `denied: true` with
|
|
336
|
+
`denialReason: "sensitive"`. Treat any `denied` response as final: do not
|
|
337
|
+
retry to work around it; tell the user which surface was blocked. To check the
|
|
338
|
+
active scope/allow/denylist up front, call `zam bridge get-observer-policy`.
|
|
339
|
+
The user can adjust it with `zam observer status | grant <app> | revoke <app>`.
|
|
340
|
+
|
|
341
|
+
**Rating scale (all observation approaches):**
|
|
250
342
|
- Completed correctly, no hesitation, no help → **4**
|
|
251
343
|
- Slight pause or looked something up → **3**
|
|
252
344
|
- Made errors, corrected themselves → **2**
|