zam-core 0.3.7 → 0.3.11

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.
@@ -30,12 +30,13 @@ zam token deprecate --slug <slug> # mark outdated knowledge
30
30
  # Card & review management
31
31
  zam card due --user <username>
32
32
  zam card update --user <username> --token <slug> --rating <1-4>
33
+ zam card block --user <username> --token <slug>
33
34
  zam card unblock --user <username>
34
35
 
35
36
  # Sessions
36
37
  zam session start --user <username> --task "<description>" [--context shell|ui|reallife]
37
38
  zam session log --session <id> --token <slug> --done-by <user|agent> [--rating <n>]
38
- zam session end --session <id>
39
+ zam session end --session <id> [--synthesize] [--patterns <json-file>]
39
40
 
40
41
  # Stats
41
42
  zam stats --user <username>
@@ -216,12 +217,11 @@ This spawns a new terminal window (Terminal.app or iTerm2 on macOS), already `cd
216
217
  Shell hooks silently capture every command with timestamps, exit codes, and working directory to a JSONL log. When the user returns:
217
218
 
218
219
  ```bash
219
- # Read the raw command log
220
- zam bridge get-monitor --session <session-id>
220
+ # Preview evidence, confirm each rating, and end the session
221
+ zam session end --session <session-id> --synthesize
221
222
 
222
- # Auto-rate tokens by matching commands to patterns
223
- echo '{"patterns":[{"slug":"docker-build","patterns":["docker build","docker image build"]}]}' \
224
- | zam bridge analyze-monitor --session <session-id>
223
+ # Supply task-specific mappings when skill-to-token links are ambiguous
224
+ zam session end --session <session-id> --synthesize --patterns <json-file>
225
225
  ```
226
226
 
227
227
  The analyzer infers ratings from:
@@ -230,7 +230,15 @@ The analyzer infers ratings from:
230
230
  - **Speed**: inter-command gaps, thinking pauses → lower if slow
231
231
  - **Self-corrections**: same command prefix run repeatedly with different args → lower rating
232
232
 
233
- Review the suggested ratings before submitting. Override if the heuristic seems wrong.
233
+ Single-token agent skills supply command patterns automatically. A pattern file
234
+ contains an array (or `{ "patterns": [...] }`) of
235
+ `{ "slug": "<token>", "patterns": ["<command>"] }` entries. Only medium- and
236
+ high-confidence candidates are proposed. Accept, override, or skip every
237
+ rating; accepted ratings are applied atomically and repeated synthesis is
238
+ idempotent.
239
+
240
+ Use `zam bridge get-monitor` and `zam bridge analyze-monitor` only when raw
241
+ diagnostic output is needed.
234
242
 
235
243
  When done, the user can simply close the monitored terminal window — hooks only live in that shell process. No cleanup command needed.
236
244
 
@@ -284,6 +292,10 @@ Use it to:
284
292
 
285
293
  ### STEP 5 — End session
286
294
  ```bash
295
+ # Monitored executable session
296
+ zam session end --session <id> --synthesize
297
+
298
+ # Conceptual or unmonitored session
287
299
  zam session end --session <id>
288
300
  zam stats --user <username>
289
301
  ```
@@ -328,6 +340,157 @@ Never present a blocked token to the user.
328
340
 
329
341
  ---
330
342
 
343
+ ## Dynamic Token Decomposition
344
+
345
+ **Principle:** Do not pre-create hundreds of tokens. Let the dependency graph grow
346
+ from real gaps discovered during review. Every rating of 1 is an opportunity to
347
+ diagnose *why* the user couldn't answer — and to create the missing foundations.
348
+
349
+ This applies primarily to tokens at Bloom 3-5 (apply, analyze, synthesize) that
350
+ cover broad learning areas. School curricula — where a single "Lernbereich" spans
351
+ many underlying concepts — are the canonical use case.
352
+
353
+ ### When to split
354
+
355
+ A token should be decomposed when ALL of the following hold:
356
+
357
+ 1. The user rated it **1** (drew a blank / couldn't answer)
358
+ 2. The token is at **Bloom ≥ 3** (application or above)
359
+ 3. The token covers **multiple distinct concepts** (not atomic)
360
+ 4. No prerequisite tokens already exist for the specific gap you diagnose
361
+
362
+ ### How to diagnose
363
+
364
+ After a rating of 1, pause. Do not just re-ask the same question or move on.
365
+ Ask yourself: **"What would the user have needed to know to answer this?"**
366
+
367
+ | Symptom | Missing foundation | Create Bloom 1-2 token for |
368
+ |---------|-------------------|---------------------------|
369
+ | Couldn't name key terms | Factual recall | Definitions, terminology |
370
+ | Used terms incorrectly | Conceptual understanding | Explain the concept in own words |
371
+ | Knew facts but couldn't connect them | Structural understanding | How A relates to B |
372
+ | Understood but couldn't apply | Procedural knowledge | Apply concept to a simple case first |
373
+
374
+ ### Source-grounded splitting
375
+
376
+ When the high-level token has a `source_link` pointing to a curriculum (LehrplanPLUS,
377
+ school syllabus, certification exam outline), **consult it before creating any
378
+ foundation tokens**. The source defines the official scope — your foundations must
379
+ stay inside it.
380
+
381
+ **Protocol:**
382
+
383
+ 1. Fetch or follow the `source_link` (WebFetch for URLs, Read for local files)
384
+ 2. Locate the relevant Lernbereich / topic section in the source
385
+ 3. Extract the **explicitly listed** basic terms, dates, concepts, and
386
+ "grundlegende Daten und Begriffe" (for LehrplanPLUS) or equivalent
387
+ 4. Create foundation tokens ONLY for items that appear in the source
388
+
389
+ **Example of a BAD split (terms not in curriculum):**
390
+
391
+ > `ge-aufklaerung-begriffe`: "Define: Aufklärung, Emanzipation, Toleranz,
392
+ > Vernunft, Fortschritt, Naturrecht."
393
+ >
394
+ > Problem: The LehrplanPLUS Geschichte 8 LB2 lists "Aufklärung, Menschenrechte,
395
+ > Volkssouveränität, Gewaltenteilung, Parlament, konstitutionelle Monarchie,
396
+ > Bürgertum" as required terms. Emanzipation, Toleranz, and Fortschrittsglaube
397
+ > are NOT part of the 8th-grade Realschule curriculum for this Lernbereich.
398
+
399
+ **Example of a CORRECT split (terms from the source):**
400
+
401
+ > `ge-aufklaerung-begriffe`: "Define: Aufklärung, Volkssouveränität,
402
+ > Gewaltenteilung, konstitutionelle Monarchie, Menschenrechte."
403
+ >
404
+ > Every term appears in the LehrplanPLUS. The student won't be tested on
405
+ > anything outside this list.
406
+
407
+ **Rule of thumb:** For curriculum-based tokens, the source is the contract.
408
+ If the source says "grundlegende Daten und Begriffe: X, Y, Z", only X, Y,
409
+ and Z are fair game for Bloom 1-2 foundations. Adding extra terms is scope
410
+ creep and undermines the learner's trust.
411
+
412
+ ### Registration protocol
413
+
414
+ For each gap you diagnose, register a new token and wire it immediately:
415
+
416
+ ```bash
417
+ # 1. Register the foundation token (Bloom 1-2, atomic, single concept)
418
+ zam token register \
419
+ --slug <parent-slug>-<gap-keyword> \
420
+ --concept "<one atomic concept the user was missing>" \
421
+ --domain <same-domain> \
422
+ --bloom <1-or-2> \
423
+ --question "<direct recall or explain question>"
424
+
425
+ # 2. Wire it as a prerequisite of the high-level token
426
+ zam token prereq --token <high-level-slug> --requires <parent-slug>-<gap-keyword>
427
+
428
+ # 3. Block the high-level card after all new prerequisites are wired
429
+ zam card block --user <username> --token <high-level-slug>
430
+ ```
431
+
432
+ ### What happens next
433
+
434
+ After wiring prerequisites and blocking the card:
435
+ - The high-level token is removed from the review queue
436
+ - The next review session will surface the *foundation tokens first*
437
+ - Once all prerequisites reach `reps >= 1`, `zam card unblock` promotes the
438
+ high-level token back into the review queue
439
+
440
+ If prerequisites already existed when the token was rated 1, the rating command
441
+ blocks it automatically. Use `zam card block` when the missing prerequisites were
442
+ discovered and registered only after the rating.
443
+
444
+ ### Example: High-school history
445
+
446
+ > User rates `ge-aufklaerung` (Bloom 4: "How did Enlightenment ideas shape the
447
+ > French Revolution and transform Europe's political order?") as **1**.
448
+
449
+ Agent diagnoses:
450
+ - *"You couldn't name the three estates. You weren't sure what 'popular sovereignty'
451
+ means. You mixed up 1789 and 1793."*
452
+
453
+ Agent creates three foundations:
454
+
455
+ | Token | Bloom | Question |
456
+ |-------|-------|----------|
457
+ | `ge-aufklaerung-staende` | 1 | Who belonged to each of the three estates in 18th-century France? |
458
+ | `ge-aufklaerung-begriffe` | 1 | Define: Enlightenment, popular sovereignty, separation of powers, natural rights. |
459
+ | `ge-aufklaerung-daten` | 1 | Name the five key events of the French Revolution (1789–1799) with dates. |
460
+
461
+ Agent wires them:
462
+ ```bash
463
+ zam token prereq --token ge-aufklaerung --requires ge-aufklaerung-staende
464
+ zam token prereq --token ge-aufklaerung --requires ge-aufklaerung-begriffe
465
+ zam token prereq --token ge-aufklaerung --requires ge-aufklaerung-daten
466
+ zam card block --user <username> --token ge-aufklaerung
467
+ ```
468
+
469
+ `ge-aufklaerung` is now blocked. Next session: foundations first. When they
470
+ stick → `ge-aufklaerung` reappears — this time with a fighting chance.
471
+
472
+ ### Sizing rule
473
+
474
+ - Create **2–4 foundations per failed high-level token**, not 10
475
+ - Each foundation must be **genuinely atomic** — one fact or concept
476
+ - If the user still fails a foundation, split it further (e.g. "too many dates
477
+ at once" → one token per date)
478
+ - Over time this builds a **Bloom ladder**: Level 1 facts → Level 2 understanding
479
+ → Level 3 application → Level 4+ analysis
480
+
481
+ ### Safety
482
+
483
+ - **Never create more than 10 new tokens in a single session** — if a rating of 1
484
+ reveals massive gaps, prioritize the 3 most urgent foundations and let the rest
485
+ emerge in subsequent sessions
486
+ - **Always dedup before registering** — `zam token find --query "<keywords>"`
487
+ - **Do not split Bloom 1-2 tokens** — they are already atomic; if the user fails
488
+ them, the fix is re-exposure and practice, not further decomposition
489
+ - A rating of 1 on a Bloom 1 token means the user needs simpler wording or a
490
+ mnemonic, not more tokens
491
+
492
+ ---
493
+
331
494
  ## Token Deprecation
332
495
 
333
496
  Knowledge goes stale. If a token comes up for review and the user indicates it's outdated ("that's not how it works anymore"):
@@ -33,12 +33,13 @@ zam token deprecate --slug <slug> # mark outdated knowledge
33
33
  # Card & review management
34
34
  zam card due --user <username>
35
35
  zam card update --user <username> --token <slug> --rating <1-4>
36
+ zam card block --user <username> --token <slug>
36
37
  zam card unblock --user <username>
37
38
 
38
39
  # Sessions
39
40
  zam session start --user <username> --task "<description>" [--context shell|ui|reallife]
40
41
  zam session log --session <id> --token <slug> --done-by <user|agent> [--rating <n>]
41
- zam session end --session <id>
42
+ zam session end --session <id> [--synthesize] [--patterns <json-file>]
42
43
 
43
44
  # Stats
44
45
  zam stats --user <username>
@@ -220,12 +221,11 @@ This spawns a new terminal window (Terminal.app or iTerm2 on macOS), already `cd
220
221
  Shell hooks silently capture every command with timestamps, exit codes, and working directory to a JSONL log. When the user returns:
221
222
 
222
223
  ```bash
223
- # Read the raw command log
224
- zam bridge get-monitor --session <session-id>
224
+ # Preview evidence, confirm each rating, and end the session
225
+ zam session end --session <session-id> --synthesize
225
226
 
226
- # Auto-rate tokens by matching commands to patterns
227
- echo '{"patterns":[{"slug":"docker-build","patterns":["docker build","docker image build"]}]}' \
228
- | zam bridge analyze-monitor --session <session-id>
227
+ # Supply task-specific mappings when skill-to-token links are ambiguous
228
+ zam session end --session <session-id> --synthesize --patterns <json-file>
229
229
  ```
230
230
 
231
231
  The analyzer infers ratings from:
@@ -234,7 +234,15 @@ The analyzer infers ratings from:
234
234
  - **Speed**: inter-command gaps, thinking pauses → lower if slow
235
235
  - **Self-corrections**: same command prefix run repeatedly with different args → lower rating
236
236
 
237
- Review the suggested ratings before submitting. Override if the heuristic seems wrong.
237
+ Single-token agent skills supply command patterns automatically. A pattern file
238
+ contains an array (or `{ "patterns": [...] }`) of
239
+ `{ "slug": "<token>", "patterns": ["<command>"] }` entries. Only medium- and
240
+ high-confidence candidates are proposed. Accept, override, or skip every
241
+ rating; accepted ratings are applied atomically and repeated synthesis is
242
+ idempotent.
243
+
244
+ Use `zam bridge get-monitor` and `zam bridge analyze-monitor` only when raw
245
+ diagnostic output is needed.
238
246
 
239
247
  When done, the user can simply close the monitored terminal window — hooks only live in that shell process. No cleanup command needed.
240
248
 
@@ -288,6 +296,10 @@ Use it to:
288
296
 
289
297
  ### STEP 5 — End session
290
298
  ```bash
299
+ # Monitored executable session
300
+ zam session end --session <id> --synthesize
301
+
302
+ # Conceptual or unmonitored session
291
303
  zam session end --session <id>
292
304
  zam stats --user <username>
293
305
  ```
@@ -332,6 +344,157 @@ Never present a blocked token to the user.
332
344
 
333
345
  ---
334
346
 
347
+ ## Dynamic Token Decomposition
348
+
349
+ **Principle:** Do not pre-create hundreds of tokens. Let the dependency graph grow
350
+ from real gaps discovered during review. Every rating of 1 is an opportunity to
351
+ diagnose *why* the user couldn't answer — and to create the missing foundations.
352
+
353
+ This applies primarily to tokens at Bloom 3-5 (apply, analyze, synthesize) that
354
+ cover broad learning areas. School curricula — where a single "Lernbereich" spans
355
+ many underlying concepts — are the canonical use case.
356
+
357
+ ### When to split
358
+
359
+ A token should be decomposed when ALL of the following hold:
360
+
361
+ 1. The user rated it **1** (drew a blank / couldn't answer)
362
+ 2. The token is at **Bloom ≥ 3** (application or above)
363
+ 3. The token covers **multiple distinct concepts** (not atomic)
364
+ 4. No prerequisite tokens already exist for the specific gap you diagnose
365
+
366
+ ### How to diagnose
367
+
368
+ After a rating of 1, pause. Do not just re-ask the same question or move on.
369
+ Ask yourself: **"What would the user have needed to know to answer this?"**
370
+
371
+ | Symptom | Missing foundation | Create Bloom 1-2 token for |
372
+ |---------|-------------------|---------------------------|
373
+ | Couldn't name key terms | Factual recall | Definitions, terminology |
374
+ | Used terms incorrectly | Conceptual understanding | Explain the concept in own words |
375
+ | Knew facts but couldn't connect them | Structural understanding | How A relates to B |
376
+ | Understood but couldn't apply | Procedural knowledge | Apply concept to a simple case first |
377
+
378
+ ### Source-grounded splitting
379
+
380
+ When the high-level token has a `source_link` pointing to a curriculum (LehrplanPLUS,
381
+ school syllabus, certification exam outline), **consult it before creating any
382
+ foundation tokens**. The source defines the official scope — your foundations must
383
+ stay inside it.
384
+
385
+ **Protocol:**
386
+
387
+ 1. Fetch or follow the `source_link` (WebFetch for URLs, Read for local files)
388
+ 2. Locate the relevant Lernbereich / topic section in the source
389
+ 3. Extract the **explicitly listed** basic terms, dates, concepts, and
390
+ "grundlegende Daten und Begriffe" (for LehrplanPLUS) or equivalent
391
+ 4. Create foundation tokens ONLY for items that appear in the source
392
+
393
+ **Example of a BAD split (terms not in curriculum):**
394
+
395
+ > `ge-aufklaerung-begriffe`: "Define: Aufklärung, Emanzipation, Toleranz,
396
+ > Vernunft, Fortschritt, Naturrecht."
397
+ >
398
+ > Problem: The LehrplanPLUS Geschichte 8 LB2 lists "Aufklärung, Menschenrechte,
399
+ > Volkssouveränität, Gewaltenteilung, Parlament, konstitutionelle Monarchie,
400
+ > Bürgertum" as required terms. Emanzipation, Toleranz, and Fortschrittsglaube
401
+ > are NOT part of the 8th-grade Realschule curriculum for this Lernbereich.
402
+
403
+ **Example of a CORRECT split (terms from the source):**
404
+
405
+ > `ge-aufklaerung-begriffe`: "Define: Aufklärung, Volkssouveränität,
406
+ > Gewaltenteilung, konstitutionelle Monarchie, Menschenrechte."
407
+ >
408
+ > Every term appears in the LehrplanPLUS. The student won't be tested on
409
+ > anything outside this list.
410
+
411
+ **Rule of thumb:** For curriculum-based tokens, the source is the contract.
412
+ If the source says "grundlegende Daten und Begriffe: X, Y, Z", only X, Y,
413
+ and Z are fair game for Bloom 1-2 foundations. Adding extra terms is scope
414
+ creep and undermines the learner's trust.
415
+
416
+ ### Registration protocol
417
+
418
+ For each gap you diagnose, register a new token and wire it immediately:
419
+
420
+ ```bash
421
+ # 1. Register the foundation token (Bloom 1-2, atomic, single concept)
422
+ zam token register \
423
+ --slug <parent-slug>-<gap-keyword> \
424
+ --concept "<one atomic concept the user was missing>" \
425
+ --domain <same-domain> \
426
+ --bloom <1-or-2> \
427
+ --question "<direct recall or explain question>"
428
+
429
+ # 2. Wire it as a prerequisite of the high-level token
430
+ zam token prereq --token <high-level-slug> --requires <parent-slug>-<gap-keyword>
431
+
432
+ # 3. Block the high-level card after all new prerequisites are wired
433
+ zam card block --user <username> --token <high-level-slug>
434
+ ```
435
+
436
+ ### What happens next
437
+
438
+ After wiring prerequisites and blocking the card:
439
+ - The high-level token is removed from the review queue
440
+ - The next review session will surface the *foundation tokens first*
441
+ - Once all prerequisites reach `reps >= 1`, `zam card unblock` promotes the
442
+ high-level token back into the review queue
443
+
444
+ If prerequisites already existed when the token was rated 1, the rating command
445
+ blocks it automatically. Use `zam card block` when the missing prerequisites were
446
+ discovered and registered only after the rating.
447
+
448
+ ### Example: High-school history
449
+
450
+ > User rates `ge-aufklaerung` (Bloom 4: "How did Enlightenment ideas shape the
451
+ > French Revolution and transform Europe's political order?") as **1**.
452
+
453
+ Agent diagnoses:
454
+ - *"You couldn't name the three estates. You weren't sure what 'popular sovereignty'
455
+ means. You mixed up 1789 and 1793."*
456
+
457
+ Agent creates three foundations:
458
+
459
+ | Token | Bloom | Question |
460
+ |-------|-------|----------|
461
+ | `ge-aufklaerung-staende` | 1 | Who belonged to each of the three estates in 18th-century France? |
462
+ | `ge-aufklaerung-begriffe` | 1 | Define: Enlightenment, popular sovereignty, separation of powers, natural rights. |
463
+ | `ge-aufklaerung-daten` | 1 | Name the five key events of the French Revolution (1789–1799) with dates. |
464
+
465
+ Agent wires them:
466
+ ```bash
467
+ zam token prereq --token ge-aufklaerung --requires ge-aufklaerung-staende
468
+ zam token prereq --token ge-aufklaerung --requires ge-aufklaerung-begriffe
469
+ zam token prereq --token ge-aufklaerung --requires ge-aufklaerung-daten
470
+ zam card block --user <username> --token ge-aufklaerung
471
+ ```
472
+
473
+ `ge-aufklaerung` is now blocked. Next session: foundations first. When they
474
+ stick → `ge-aufklaerung` reappears — this time with a fighting chance.
475
+
476
+ ### Sizing rule
477
+
478
+ - Create **2–4 foundations per failed high-level token**, not 10
479
+ - Each foundation must be **genuinely atomic** — one fact or concept
480
+ - If the user still fails a foundation, split it further (e.g. "too many dates
481
+ at once" → one token per date)
482
+ - Over time this builds a **Bloom ladder**: Level 1 facts → Level 2 understanding
483
+ → Level 3 application → Level 4+ analysis
484
+
485
+ ### Safety
486
+
487
+ - **Never create more than 10 new tokens in a single session** — if a rating of 1
488
+ reveals massive gaps, prioritize the 3 most urgent foundations and let the rest
489
+ emerge in subsequent sessions
490
+ - **Always dedup before registering** — `zam token find --query "<keywords>"`
491
+ - **Do not split Bloom 1-2 tokens** — they are already atomic; if the user fails
492
+ them, the fix is re-exposure and practice, not further decomposition
493
+ - A rating of 1 on a Bloom 1 token means the user needs simpler wording or a
494
+ mnemonic, not more tokens
495
+
496
+ ---
497
+
335
498
  ## Token Deprecation
336
499
 
337
500
  Knowledge goes stale. If a token comes up for review and the user indicates it's outdated ("that's not how it works anymore"):
@@ -30,12 +30,13 @@ zam token deprecate --slug <slug> # mark outdated knowledge
30
30
  # Card & review management
31
31
  zam card due --user <username>
32
32
  zam card update --user <username> --token <slug> --rating <1-4>
33
+ zam card block --user <username> --token <slug>
33
34
  zam card unblock --user <username>
34
35
 
35
36
  # Sessions
36
37
  zam session start --user <username> --task "<description>" [--context shell|ui|reallife]
37
38
  zam session log --session <id> --token <slug> --done-by <user|agent> [--rating <n>]
38
- zam session end --session <id>
39
+ zam session end --session <id> [--synthesize] [--patterns <json-file>]
39
40
 
40
41
  # Stats
41
42
  zam stats --user <username>
@@ -216,12 +217,11 @@ This spawns a new terminal window (Terminal.app or iTerm2 on macOS), already `cd
216
217
  Shell hooks silently capture every command with timestamps, exit codes, and working directory to a JSONL log. When the user returns:
217
218
 
218
219
  ```bash
219
- # Read the raw command log
220
- zam bridge get-monitor --session <session-id>
220
+ # Preview evidence, confirm each rating, and end the session
221
+ zam session end --session <session-id> --synthesize
221
222
 
222
- # Auto-rate tokens by matching commands to patterns
223
- echo '{"patterns":[{"slug":"docker-build","patterns":["docker build","docker image build"]}]}' \
224
- | zam bridge analyze-monitor --session <session-id>
223
+ # Supply task-specific mappings when skill-to-token links are ambiguous
224
+ zam session end --session <session-id> --synthesize --patterns <json-file>
225
225
  ```
226
226
 
227
227
  The analyzer infers ratings from:
@@ -230,7 +230,15 @@ The analyzer infers ratings from:
230
230
  - **Speed**: inter-command gaps, thinking pauses → lower if slow
231
231
  - **Self-corrections**: same command prefix run repeatedly with different args → lower rating
232
232
 
233
- Review the suggested ratings before submitting. Override if the heuristic seems wrong.
233
+ Single-token agent skills supply command patterns automatically. A pattern file
234
+ contains an array (or `{ "patterns": [...] }`) of
235
+ `{ "slug": "<token>", "patterns": ["<command>"] }` entries. Only medium- and
236
+ high-confidence candidates are proposed. Accept, override, or skip every
237
+ rating; accepted ratings are applied atomically and repeated synthesis is
238
+ idempotent.
239
+
240
+ Use `zam bridge get-monitor` and `zam bridge analyze-monitor` only when raw
241
+ diagnostic output is needed.
234
242
 
235
243
  When done, the user can simply close the monitored terminal window — hooks only live in that shell process. No cleanup command needed.
236
244
 
@@ -284,6 +292,10 @@ Use it to:
284
292
 
285
293
  ### STEP 5 — End session
286
294
  ```bash
295
+ # Monitored executable session
296
+ zam session end --session <id> --synthesize
297
+
298
+ # Conceptual or unmonitored session
287
299
  zam session end --session <id>
288
300
  zam stats --user <username>
289
301
  ```
@@ -328,6 +340,157 @@ Never present a blocked token to the user.
328
340
 
329
341
  ---
330
342
 
343
+ ## Dynamic Token Decomposition
344
+
345
+ **Principle:** Do not pre-create hundreds of tokens. Let the dependency graph grow
346
+ from real gaps discovered during review. Every rating of 1 is an opportunity to
347
+ diagnose *why* the user couldn't answer — and to create the missing foundations.
348
+
349
+ This applies primarily to tokens at Bloom 3-5 (apply, analyze, synthesize) that
350
+ cover broad learning areas. School curricula — where a single "Lernbereich" spans
351
+ many underlying concepts — are the canonical use case.
352
+
353
+ ### When to split
354
+
355
+ A token should be decomposed when ALL of the following hold:
356
+
357
+ 1. The user rated it **1** (drew a blank / couldn't answer)
358
+ 2. The token is at **Bloom ≥ 3** (application or above)
359
+ 3. The token covers **multiple distinct concepts** (not atomic)
360
+ 4. No prerequisite tokens already exist for the specific gap you diagnose
361
+
362
+ ### How to diagnose
363
+
364
+ After a rating of 1, pause. Do not just re-ask the same question or move on.
365
+ Ask yourself: **"What would the user have needed to know to answer this?"**
366
+
367
+ | Symptom | Missing foundation | Create Bloom 1-2 token for |
368
+ |---------|-------------------|---------------------------|
369
+ | Couldn't name key terms | Factual recall | Definitions, terminology |
370
+ | Used terms incorrectly | Conceptual understanding | Explain the concept in own words |
371
+ | Knew facts but couldn't connect them | Structural understanding | How A relates to B |
372
+ | Understood but couldn't apply | Procedural knowledge | Apply concept to a simple case first |
373
+
374
+ ### Source-grounded splitting
375
+
376
+ When the high-level token has a `source_link` pointing to a curriculum (LehrplanPLUS,
377
+ school syllabus, certification exam outline), **consult it before creating any
378
+ foundation tokens**. The source defines the official scope — your foundations must
379
+ stay inside it.
380
+
381
+ **Protocol:**
382
+
383
+ 1. Fetch or follow the `source_link` (WebFetch for URLs, Read for local files)
384
+ 2. Locate the relevant Lernbereich / topic section in the source
385
+ 3. Extract the **explicitly listed** basic terms, dates, concepts, and
386
+ "grundlegende Daten und Begriffe" (for LehrplanPLUS) or equivalent
387
+ 4. Create foundation tokens ONLY for items that appear in the source
388
+
389
+ **Example of a BAD split (terms not in curriculum):**
390
+
391
+ > `ge-aufklaerung-begriffe`: "Define: Aufklärung, Emanzipation, Toleranz,
392
+ > Vernunft, Fortschritt, Naturrecht."
393
+ >
394
+ > Problem: The LehrplanPLUS Geschichte 8 LB2 lists "Aufklärung, Menschenrechte,
395
+ > Volkssouveränität, Gewaltenteilung, Parlament, konstitutionelle Monarchie,
396
+ > Bürgertum" as required terms. Emanzipation, Toleranz, and Fortschrittsglaube
397
+ > are NOT part of the 8th-grade Realschule curriculum for this Lernbereich.
398
+
399
+ **Example of a CORRECT split (terms from the source):**
400
+
401
+ > `ge-aufklaerung-begriffe`: "Define: Aufklärung, Volkssouveränität,
402
+ > Gewaltenteilung, konstitutionelle Monarchie, Menschenrechte."
403
+ >
404
+ > Every term appears in the LehrplanPLUS. The student won't be tested on
405
+ > anything outside this list.
406
+
407
+ **Rule of thumb:** For curriculum-based tokens, the source is the contract.
408
+ If the source says "grundlegende Daten und Begriffe: X, Y, Z", only X, Y,
409
+ and Z are fair game for Bloom 1-2 foundations. Adding extra terms is scope
410
+ creep and undermines the learner's trust.
411
+
412
+ ### Registration protocol
413
+
414
+ For each gap you diagnose, register a new token and wire it immediately:
415
+
416
+ ```bash
417
+ # 1. Register the foundation token (Bloom 1-2, atomic, single concept)
418
+ zam token register \
419
+ --slug <parent-slug>-<gap-keyword> \
420
+ --concept "<one atomic concept the user was missing>" \
421
+ --domain <same-domain> \
422
+ --bloom <1-or-2> \
423
+ --question "<direct recall or explain question>"
424
+
425
+ # 2. Wire it as a prerequisite of the high-level token
426
+ zam token prereq --token <high-level-slug> --requires <parent-slug>-<gap-keyword>
427
+
428
+ # 3. Block the high-level card after all new prerequisites are wired
429
+ zam card block --user <username> --token <high-level-slug>
430
+ ```
431
+
432
+ ### What happens next
433
+
434
+ After wiring prerequisites and blocking the card:
435
+ - The high-level token is removed from the review queue
436
+ - The next `/zam` session will surface the *foundation tokens first*
437
+ - Once all prerequisites reach `reps >= 1`, `zam card unblock` promotes the
438
+ high-level token back into the review queue
439
+
440
+ If prerequisites already existed when the token was rated 1, the rating command
441
+ blocks it automatically. Use `zam card block` when the missing prerequisites were
442
+ discovered and registered only after the rating.
443
+
444
+ ### Example: High-school history
445
+
446
+ > User rates `ge-aufklaerung` (Bloom 4: "How did Enlightenment ideas shape the
447
+ > French Revolution and transform Europe's political order?") as **1**.
448
+
449
+ Agent diagnoses:
450
+ - *"You couldn't name the three estates. You weren't sure what 'popular sovereignty'
451
+ means. You mixed up 1789 and 1793."*
452
+
453
+ Agent creates three foundations:
454
+
455
+ | Token | Bloom | Question |
456
+ |-------|-------|----------|
457
+ | `ge-aufklaerung-staende` | 1 | Who belonged to each of the three estates in 18th-century France? |
458
+ | `ge-aufklaerung-begriffe` | 1 | Define: Enlightenment, popular sovereignty, separation of powers, natural rights. |
459
+ | `ge-aufklaerung-daten` | 1 | Name the five key events of the French Revolution (1789–1799) with dates. |
460
+
461
+ Agent wires them:
462
+ ```bash
463
+ zam token prereq --token ge-aufklaerung --requires ge-aufklaerung-staende
464
+ zam token prereq --token ge-aufklaerung --requires ge-aufklaerung-begriffe
465
+ zam token prereq --token ge-aufklaerung --requires ge-aufklaerung-daten
466
+ zam card block --user <username> --token ge-aufklaerung
467
+ ```
468
+
469
+ `ge-aufklaerung` is now blocked. Next session: foundations first. When they
470
+ stick → `ge-aufklaerung` reappears — this time with a fighting chance.
471
+
472
+ ### Sizing rule
473
+
474
+ - Create **2–4 foundations per failed high-level token**, not 10
475
+ - Each foundation must be **genuinely atomic** — one fact or concept
476
+ - If the user still fails a foundation, split it further (e.g. "too many dates
477
+ at once" → one token per date)
478
+ - Over time this builds a **Bloom ladder**: Level 1 facts → Level 2 understanding
479
+ → Level 3 application → Level 4+ analysis
480
+
481
+ ### Safety
482
+
483
+ - **Never create more than 10 new tokens in a single session** — if a rating of 1
484
+ reveals massive gaps, prioritize the 3 most urgent foundations and let the rest
485
+ emerge in subsequent sessions
486
+ - **Always dedup before registering** — `zam token find --query "<keywords>"`
487
+ - **Do not split Bloom 1-2 tokens** — they are already atomic; if the user fails
488
+ them, the fix is re-exposure and practice, not further decomposition
489
+ - A rating of 1 on a Bloom 1 token means the user needs simpler wording or a
490
+ mnemonic, not more tokens
491
+
492
+ ---
493
+
331
494
  ## Token Deprecation
332
495
 
333
496
  Knowledge goes stale. If a token comes up for review and the user indicates it's outdated ("that's not how it works anymore"):
package/README.de.md CHANGED
@@ -77,7 +77,7 @@ ZAM ist das Werkzeug für den Übergang in eine Welt, in der Fürsorge und gemei
77
77
 
78
78
  ZAM enthält nun eine plattformübergreifende Desktop-Anwendung im Verzeichnis [`desktop/`](desktop/). Entwickelt mit **Tauri v2**, **Vite**, **TypeScript** und **Vanilla CSS**, bietet sie ein hochmodernes Dark-Mode-Lernstudio, das dieselbe SQLite-Datenbank wie das CLI nutzt.
79
79
 
80
- ### Starten unter Windows oder macOS:
80
+ ### Starten unter Windows, macOS oder Linux:
81
81
 
82
82
  1. **CLI Bridge kompilieren**:
83
83
  Stelle sicher, dass der neueste CLI-Code im Hauptverzeichnis kompiliert ist:
@@ -98,7 +98,7 @@ Dies kompiliert das Rust-Backend im Hintergrund, startet den Vite-Entwicklungsse
98
98
 
99
99
  ### 📦 Automatische GitHub Releases & Native Installer
100
100
 
101
- Wir haben eine **GitHub Actions CI/CD-Pipeline** integriert, die automatisch native Installationsdateien (Windows `.msi`/`.exe`, macOS `.dmg` und Linux `.deb`/`.AppImage`) kompiliert und verpackt, sobald ein neuer Git-Tag gepusht wird.
101
+ Wir haben eine **GitHub Actions CI/CD-Pipeline** integriert, die derzeit native Installationsdateien für Windows (`.msi`/`.exe`) und Linux (`.deb`/`.rpm`) kompiliert und verpackt, sobald ein neuer Git-Tag gepusht wird. AppImage-Pakete sind vorläufig ausgesetzt, weil `linuxdeploy` das mitgelieferte native `libsql`-Modul noch nicht zuverlässig verarbeiten kann. macOS kann weiterhin aus dem Quellcode gebaut werden; signierte und notarisierte macOS-Release-Artefakte folgen, sobald der Apple-Signing-Account verfügbar ist.
102
102
 
103
103
  Um eine neue Version zu veröffentlichen (z.B. `v0.1.0`):
104
104
 
@@ -110,7 +110,7 @@ git tag v0.1.0
110
110
  git push origin v0.1.0
111
111
  ```
112
112
 
113
- Dies startet automatisch die Build-Umgebungen auf GitHub-Runnern und erstellt einen Entwurf (Draft) für ein GitHub Release, das alle kompilierten Installationsdateien enthält!
113
+ Dies startet automatisch die Windows- und Linux-Builds auf GitHub-Runnern und erstellt einen Entwurf (Draft) mit den kompilierten Installationsdateien.
114
114
 
115
115
  ---
116
116