@isparling/engram-coach 0.1.0 → 0.2.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.
Files changed (51) hide show
  1. package/README.md +85 -18
  2. package/SETUP.md +559 -0
  3. package/SKILL_PACK.md +75 -0
  4. package/analyses/catalog.md +257 -0
  5. package/analysis-tools/hrv-trend.ts +592 -0
  6. package/analysis-tools/migrate-structured-capture.ts +234 -0
  7. package/analysis-tools/race-context.ts +96 -0
  8. package/analysis-tools/stream-analyze.ts +1008 -0
  9. package/analysis-tools/tsb-predict.ts +117 -0
  10. package/capture-handler.ts +301 -0
  11. package/config.json.example +21 -0
  12. package/engram-coach-ambient-capture.ts +336 -0
  13. package/engram-coach-capture-types.ts +185 -0
  14. package/engram-coach-config.ts +268 -0
  15. package/engram-coach-domain.ts +7 -2
  16. package/engram-coach-keys.ts +189 -0
  17. package/engram-coach-materialization.ts +638 -0
  18. package/engram-coach-migration.ts +1078 -0
  19. package/engram-coach-pack.ts +17 -12
  20. package/engram-coach-presentation.ts +10 -1
  21. package/engram-coach-reconciliation.ts +305 -2
  22. package/engram-coach-structured-capture.ts +622 -0
  23. package/package.json +39 -6
  24. package/personas/aggressive-monitoring.md +121 -0
  25. package/personas/aggressive.json +85 -0
  26. package/personas/conservative-monitoring.md +133 -0
  27. package/personas/conservative.json +93 -0
  28. package/personas/polarized-monitoring.md +112 -0
  29. package/personas/polarized.json +72 -0
  30. package/personas/volume-monitoring.md +85 -0
  31. package/personas/volume.json +108 -0
  32. package/shared/retrieval.md +71 -0
  33. package/shared/setup.md +207 -0
  34. package/skills/.gitkeep +0 -0
  35. package/skills/adapt-plan/SKILL.md +263 -0
  36. package/skills/block-review/SKILL.md +275 -0
  37. package/skills/consult/SKILL.md +176 -0
  38. package/skills/intake/SKILL.md +315 -0
  39. package/skills/lactate-analyze/SKILL.md +230 -0
  40. package/skills/lessons-rollup/SKILL.md +196 -0
  41. package/skills/monitoring-rollup/SKILL.md +208 -0
  42. package/skills/race-analysis/SKILL.md +219 -0
  43. package/skills/season-retrospective/SKILL.md +200 -0
  44. package/skills/set-goal/SKILL.md +297 -0
  45. package/templates/base.md +55 -0
  46. package/templates/build-1.md +57 -0
  47. package/templates/build-2.md +62 -0
  48. package/templates/race-report.md +51 -0
  49. package/templates/race-specificity.md +62 -0
  50. package/templates/season-review.md +40 -0
  51. package/engram-coach-extractor.ts +0 -295
package/README.md CHANGED
@@ -46,11 +46,11 @@ extensions:
46
46
  ```
47
47
 
48
48
  This does not include core Engram onboarding. The OMP extension resolves
49
- `engram-coach` by declaring it in the `installed_packs` of a space's binding
50
- inside an **existing, active Engram binding registry** with a session-aware
51
- active space already registered and selected. That registry is an external
52
- prerequisite; this package neither creates nor configures one. Set one up
53
- through your own Engram deployment, then add the pack declaration:
49
+ `engram-coach` through an **existing Engram binding registry** whose `training`
50
+ space is already registered. The extension selects that space for each new OMP
51
+ session from the nearest `engram.space.json`; `ENGRAM_SPACE_ID` overrides the
52
+ manifest when needed. This package neither creates nor registers spaces. Set
53
+ one up through your own Engram deployment, then add the pack declaration:
54
54
 
55
55
  ```json
56
56
  {
@@ -65,36 +65,103 @@ through your own Engram deployment, then add the pack declaration:
65
65
  }
66
66
  ```
67
67
 
68
+ That `version` is the pack identity exported as `engramCoachPackVersion`, not
69
+ the npm release version — they move independently, and the identity version
70
+ changes only alongside a record migration. See
71
+ [`SETUP.md`](SETUP.md#6-install-the-plugin) and
72
+ [`docs/architecture.md`](docs/architecture.md).
73
+
68
74
  **Set `ENGRAM_BINDING_REGISTRY`** to the absolute path of that binding
69
75
  registry file before starting OMP. It is required, not optional: without it
70
76
  the adapter disables knowledge capture entirely for the whole session. See
71
77
  [`SETUP.md`](SETUP.md#6-install-the-plugin) (Alternative: Direct OMP
72
78
  integration) for the full walkthrough.
73
79
 
80
+ That binding's `write_roots` must also authorize your `coaching_docs_dir`
81
+ and `prescriptions_dir`. Generated views are ordinary artifact writes: if
82
+ those roots are unauthorized, captures still commit records but every
83
+ regenerated view is reported stale with `root_not_writable` instead of being
84
+ written.
85
+
74
86
  ### Verifying the direct OMP integration
75
87
 
76
88
  Bind the pack, start an OMP session, and complete one full agent turn — the
77
- adapter resolves the session's active space and pack only inside its first
78
- `agent_end` handler, not at session start. After that turn settles, call the
79
- `engram_status` tool. It reports the binding-selected pack identity and CLI
80
- mode:
89
+ adapter resolves the session's active space and pack inside its awaited
90
+ `session_stop` final-settle hook, not at session start. After that turn
91
+ settles, call the `engram_status` tool. It reports the binding-selected pack
92
+ identity and CLI mode:
81
93
 
82
94
  ```json
83
95
  { "mode": "cli", "pack_id": "engram-coach", "pack_version": "0.1.0" }
84
96
  ```
85
97
 
86
- `mode` is always `"cli"` the adapter shells out to the Engram CLI and
87
- never injects knowledge directly into context. `pack_id: null` before the
88
- first turn has settled is expected, not a binding failure — call
89
- `engram_status` again after a turn completes.
90
- If `pack_id` is still `null` after that, the active space's
91
- binding has not resolved `engram-coach`; recheck `ENGRAM_BINDING_REGISTRY`
92
- and the `installed_packs` declaration above.
98
+ `mode` is always `"cli"` because the CLI remains the space-resolution and
99
+ fallback control plane; the adapter never injects knowledge directly into
100
+ model context. `pack_id: null` before the first turn has settled is expected,
101
+ not a binding failure. If it remains `null` afterwards, recheck
102
+ `ENGRAM_BINDING_REGISTRY`, the session's active-space selection, and the
103
+ `installed_packs` declaration above.
104
+
105
+ For settled turns containing coaching knowledge, this pack's exported
106
+ `captureFromTurn` handler creates a parseable `status: "candidate"` draft in
107
+ the active space's records root and refreshes that space's scoped qmd index.
108
+ Create-only writes make repeated settlement idempotent. Candidate drafts are
109
+ excluded from recall and profile presentation until explicitly promoted to
110
+ `status: "active"`.
93
111
 
94
112
  ## Configuration
95
113
 
96
114
  Copy [`config.json.example`](config.json.example) to your local configuration path and replace every placeholder. Keep credentials and athlete records outside this repository. The example config defaults to the generic `conservative` persona.
97
115
 
116
+ ## Structured coaching capture
117
+
118
+ Engram active records are the authoritative store for mutable coaching state
119
+ and chronological events. Every record declares a role in
120
+ `details.recordRole` — exactly one of `state` (one current value per canonical
121
+ key; approved changes supersede), `event` (append-only history), or
122
+ `report-claim` (a structured conclusion extracted from an approved report).
123
+ Canonical entity keys are pack-derived:
124
+
125
+ ```text
126
+ workout:<session-id>
127
+ prescription:<arc-id>:<session-id>
128
+ threshold:<sport>:lt1
129
+ threshold:<sport>:lt2
130
+ persona:<active-profile>
131
+ monitoring:<concern-id>:<signal>
132
+ ```
133
+
134
+ Workout identity is the durable `session_id`; dates, titles, week position,
135
+ and contents are mutable attributes, never identity.
136
+
137
+ During a turn, skills commit changes through two typed OMP tools:
138
+ `engram_capture_preview({ change_set })` builds the mutation plan bound to an
139
+ immutable plan hash, and `engram_capture_apply({ plan_hash })` commits exactly
140
+ the hash the athlete approved. After apply, the pack regenerates deterministic
141
+ compatibility views — prescription YAML, `consultations.md`, monitoring logs,
142
+ doctor-prep summaries — each carrying a byte-exact warning header
143
+ (`GENERATED FROM ENGRAM ACTIVE RECORDS. DO NOT EDIT DIRECTLY.`) and never
144
+ edited directly. Long-form reports (`RACE_REPORT.md`, block `SUMMARY.md`,
145
+ `SEASON_REVIEW.md`, methodology and arc-overview documents) remain canonical
146
+ approved documents that skills author themselves.
147
+
148
+ - A stale apply requires a fresh preview plus fresh approval; the old hash is
149
+ never accepted.
150
+ - An `index-stale` status leaves committed records authoritative; only the qmd
151
+ index needs a later refresh.
152
+ - A stale view after materialization failure is retried by re-calling
153
+ `engram_capture_apply` with the same committed hash in the same session —
154
+ this reruns only view regeneration, never record mutations.
155
+
156
+ Ambient conversation capture runs separately through the pack's
157
+ `captureFromTurn` handler using an explicit provider/model configured in
158
+ `.engram-coach/config.json` (`capture.model`, overridable **model-only** via
159
+ `ENGRAM_COACH_CAPTURE_MODEL`; absence of both is a configuration error).
160
+ Extraction is LLM-only: failure emits a visible warning and creates no draft.
161
+ Legacy workspaces migrate through the dry-run sequence documented in
162
+ [SETUP.md](SETUP.md#7-knowledge-records-generated-views-and-migration):
163
+ `scan` → `apply-baseline` → `emit-change-set` → `compare`.
164
+
98
165
  ## Privacy boundary
99
166
 
100
167
  This repository ships no athlete records, medical information, real event data, personal narratives, credentials, or historical coaching artifacts. Examples and fixtures are synthetic. Do not commit local `config.json`, `.env`, generated data, or athlete-owned coaching documents.
@@ -104,8 +171,8 @@ This repository ships no athlete records, medical information, real event data,
104
171
  Install tool dependencies and run the public test suite:
105
172
 
106
173
  ```bash
107
- npm install --prefix tools
108
- npm test --prefix tools
174
+ npm install --prefix analysis-tools
175
+ npm test --prefix analysis-tools
109
176
  ```
110
177
 
111
178
  For the lactate package: