zam-core 0.6.3 → 0.7.1

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.
@@ -125,7 +125,11 @@ For **review/conceptual** sessions, use `--summary` to avoid spoiling answers:
125
125
  ```bash
126
126
  zam card due --user <username> --summary
127
127
  ```
128
- For **executable/task** sessions, the full listing is fine since the agent needs to plan.
128
+ For **executable/task** sessions, the full listing is fine since the agent needs to plan. Also query ZAM for tokens relevant to the current task to weave them into the session:
129
+ ```bash
130
+ echo '{"context":"<1-2 sentence description of the current task>"}' | zam bridge relevant-tokens --user <username>
131
+ ```
132
+ If relevant tokens are returned, weave them into the planning session (e.g. "We will be working on task T; you already know X, which applies here").
129
133
 
130
134
  Classify session type:
131
135
  - **Executable** — real commands, code, or file edits (e.g. "set up Homebrew", "commit this change")
@@ -141,7 +145,13 @@ Decompose into a dependency-ordered list of knowledge tokens.
141
145
  ```bash
142
146
  zam token find --query "<keywords>"
143
147
  ```
144
- Only register genuinely new concepts. Reuse existing slugs where the concept matches.
148
+ Only register genuinely new concepts. Reuse existing slugs where the concept matches. Note that `zam token find` matches paraphrases semantically.
149
+
150
+ After deduplication and before registering a new token, check for existing semantically related tokens that could be prerequisites ("foundations"):
151
+ ```bash
152
+ echo '{"concept":"<concept>","question":"<question>","domain":"<domain>"}' | zam bridge suggest-foundations
153
+ ```
154
+ Present non-flagged suggestions to the user ("Related existing concept X — link it as a foundation?"); on approval link via the existing prereq path after registering.
145
155
 
146
156
  **Register tokens and prerequisites:**
147
157
 
@@ -367,6 +377,12 @@ A token should be decomposed when ALL of the following hold:
367
377
  After a rating of 1, pause. Do not just re-ask the same question or move on.
368
378
  Ask yourself: **"What would the user have needed to know to answer this?"**
369
379
 
380
+ Always check for existing related foundation tokens first:
381
+ ```bash
382
+ echo '{"slug":"<failed-token-slug>"}' | zam bridge suggest-foundations
383
+ ```
384
+ Offer existing tokens returned as suggestions to the user first (linking them feeds the existing `confirmFoundations` path with `exists: true` and `slug`). Only generate NEW foundation proposals via the LLM for gaps that the suggestions do not cover.
385
+
370
386
  | Symptom | Missing foundation | Create Bloom 1-2 token for |
371
387
  |---------|-------------------|---------------------------|
372
388
  | Couldn't name key terms | Factual recall | Definitions, terminology |
@@ -486,7 +502,7 @@ stick → `ge-aufklaerung` reappears — this time with a fighting chance.
486
502
  - **Never create more than 10 new tokens in a single session** — if a rating of 1
487
503
  reveals massive gaps, prioritize the 3 most urgent foundations and let the rest
488
504
  emerge in subsequent sessions
489
- - **Always dedup before registering** — `zam token find --query "<keywords>"`
505
+ - **Always dedup before registering** — `zam token find --query "<keywords>"`. Note that `zam token find` matches paraphrases semantically, and that `add-token` returns `possible_duplicates` which the agent must surface to the user.
490
506
  - **Do not split Bloom 1-2 tokens** — they are already atomic; if the user fails
491
507
  them, the fix is re-exposure and practice, not further decomposition
492
508
  - A rating of 1 on a Bloom 1 token means the user needs simpler wording or a
@@ -156,7 +156,11 @@ For **review/conceptual** sessions, use `--summary` to avoid spoiling answers:
156
156
  ```bash
157
157
  zam card due --user <username> --summary
158
158
  ```
159
- For **executable/task** sessions, the full listing is fine since the agent needs to plan.
159
+ For **executable/task** sessions, the full listing is fine since the agent needs to plan. Also query ZAM for tokens relevant to the current task to weave them into the session:
160
+ ```bash
161
+ echo '{"context":"<1-2 sentence description of the current task>"}' | zam bridge relevant-tokens --user <username>
162
+ ```
163
+ If relevant tokens are returned, weave them into the planning session (e.g. "We will be working on task T; you already know X, which applies here").
160
164
 
161
165
  Classify session type:
162
166
  - **Executable** — real commands, code, or file edits (e.g. "set up Homebrew", "commit this change")
@@ -172,7 +176,13 @@ Decompose into a dependency-ordered list of knowledge tokens.
172
176
  ```bash
173
177
  zam token find --query "<keywords>"
174
178
  ```
175
- Only register genuinely new concepts. Reuse existing slugs where the concept matches.
179
+ Only register genuinely new concepts. Reuse existing slugs where the concept matches. Note that `zam token find` matches paraphrases semantically.
180
+
181
+ After deduplication and before registering a new token, check for existing semantically related tokens that could be prerequisites ("foundations"):
182
+ ```bash
183
+ echo '{"concept":"<concept>","question":"<question>","domain":"<domain>"}' | zam bridge suggest-foundations
184
+ ```
185
+ Present non-flagged suggestions to the user ("Related existing concept X — link it as a foundation?"); on approval link via the existing prereq path after registering.
176
186
 
177
187
  **Register tokens and prerequisites:**
178
188
 
@@ -463,6 +473,12 @@ A token should be decomposed when ALL of the following hold:
463
473
  After a rating of 1, pause. Do not just re-ask the same question or move on.
464
474
  Ask yourself: **"What would the user have needed to know to answer this?"**
465
475
 
476
+ Always check for existing related foundation tokens first:
477
+ ```bash
478
+ echo '{"slug":"<failed-token-slug>"}' | zam bridge suggest-foundations
479
+ ```
480
+ Offer existing tokens returned as suggestions to the user first (linking them feeds the existing `confirmFoundations` path with `exists: true` and `slug`). Only generate NEW foundation proposals via the LLM for gaps that the suggestions do not cover.
481
+
466
482
  | Symptom | Missing foundation | Create Bloom 1-2 token for |
467
483
  |---------|-------------------|---------------------------|
468
484
  | Couldn't name key terms | Factual recall | Definitions, terminology |
@@ -582,7 +598,7 @@ stick → `ge-aufklaerung` reappears — this time with a fighting chance.
582
598
  - **Never create more than 10 new tokens in a single session** — if a rating of 1
583
599
  reveals massive gaps, prioritize the 3 most urgent foundations and let the rest
584
600
  emerge in subsequent sessions
585
- - **Always dedup before registering** — `zam token find --query "<keywords>"`
601
+ - **Always dedup before registering** — `zam token find --query "<keywords>"`. Note that `zam token find` matches paraphrases semantically, and that `add-token` returns `possible_duplicates` which the agent must surface to the user.
586
602
  - **Do not split Bloom 1-2 tokens** — they are already atomic; if the user fails
587
603
  them, the fix is re-exposure and practice, not further decomposition
588
604
  - A rating of 1 on a Bloom 1 token means the user needs simpler wording or a
@@ -125,7 +125,11 @@ For **review/conceptual** sessions, use `--summary` to avoid spoiling answers:
125
125
  ```bash
126
126
  zam card due --user <username> --summary
127
127
  ```
128
- For **executable/task** sessions, the full listing is fine since the agent needs to plan.
128
+ For **executable/task** sessions, the full listing is fine since the agent needs to plan. Also query ZAM for tokens relevant to the current task to weave them into the session:
129
+ ```bash
130
+ echo '{"context":"<1-2 sentence description of the current task>"}' | zam bridge relevant-tokens --user <username>
131
+ ```
132
+ If relevant tokens are returned, weave them into the planning session (e.g. "We will be working on task T; you already know X, which applies here").
129
133
 
130
134
  Classify session type:
131
135
  - **Executable** — real commands, code, or file edits (e.g. "set up Homebrew", "commit this change")
@@ -141,7 +145,13 @@ Decompose into a dependency-ordered list of knowledge tokens.
141
145
  ```bash
142
146
  zam token find --query "<keywords>"
143
147
  ```
144
- Only register genuinely new concepts. Reuse existing slugs where the concept matches.
148
+ Only register genuinely new concepts. Reuse existing slugs where the concept matches. Note that `zam token find` matches paraphrases semantically.
149
+
150
+ After deduplication and before registering a new token, check for existing semantically related tokens that could be prerequisites ("foundations"):
151
+ ```bash
152
+ echo '{"concept":"<concept>","question":"<question>","domain":"<domain>"}' | zam bridge suggest-foundations
153
+ ```
154
+ Present non-flagged suggestions to the user ("Related existing concept X — link it as a foundation?"); on approval link via the existing prereq path after registering.
145
155
 
146
156
  **Register tokens and prerequisites:**
147
157
 
@@ -367,6 +377,12 @@ A token should be decomposed when ALL of the following hold:
367
377
  After a rating of 1, pause. Do not just re-ask the same question or move on.
368
378
  Ask yourself: **"What would the user have needed to know to answer this?"**
369
379
 
380
+ Always check for existing related foundation tokens first:
381
+ ```bash
382
+ echo '{"slug":"<failed-token-slug>"}' | zam bridge suggest-foundations
383
+ ```
384
+ Offer existing tokens returned as suggestions to the user first (linking them feeds the existing `confirmFoundations` path with `exists: true` and `slug`). Only generate NEW foundation proposals via the LLM for gaps that the suggestions do not cover.
385
+
370
386
  | Symptom | Missing foundation | Create Bloom 1-2 token for |
371
387
  |---------|-------------------|---------------------------|
372
388
  | Couldn't name key terms | Factual recall | Definitions, terminology |
@@ -486,7 +502,7 @@ stick → `ge-aufklaerung` reappears — this time with a fighting chance.
486
502
  - **Never create more than 10 new tokens in a single session** — if a rating of 1
487
503
  reveals massive gaps, prioritize the 3 most urgent foundations and let the rest
488
504
  emerge in subsequent sessions
489
- - **Always dedup before registering** — `zam token find --query "<keywords>"`
505
+ - **Always dedup before registering** — `zam token find --query "<keywords>"`. Note that `zam token find` matches paraphrases semantically, and that `add-token` returns `possible_duplicates` which the agent must surface to the user.
490
506
  - **Do not split Bloom 1-2 tokens** — they are already atomic; if the user fails
491
507
  them, the fix is re-exposure and practice, not further decomposition
492
508
  - A rating of 1 on a Bloom 1 token means the user needs simpler wording or a