# Design: memory store and capture ## Context The CLI must be standard-library only and deterministic (constitution). The store must be readable by humans in a pull request and by any agent runtime. ## Goals / Non-Goals **Goals:** one file per lesson; lifecycle in fields; a small always-loaded index; validation that a script can run in CI. **Non-Goals:** semantic search, team sharing, automatic capture from hooks. ## Decisions ### Decision: Memory lives in the repository under .flywheel/memory/ Versioned with the code, reviewable in pull requests, and independent of any one runtime's private memory folder. Rejected: the runtime's per-user memory folder (not shared, not reviewable); a database (not needed at this size). ### Decision: Configuration is JSON The stdlib parses JSON; YAML needs a third-party library. Rejected: YAML (dependency), TOML (read-only in the stdlib, one more format). ### Decision: A small built-in frontmatter parser It supports exactly the subset the templates use (flat keys, inline lists and maps, block lists, one level of nesting, folded scalars). Rejected: a full YAML parser (dependency). ### Decision: The index lists only active entries Promoted, superseded, and stale entries stay on disk for provenance but cost no tokens. Rejected: listing every entry with a status marker (index grows without bound). ### Decision: occurrences is derived from distinct sources `occurrences` must equal the number of distinct source changes; `check` rejects anything else, so one change can never count twice toward promotion. Rejected: a counter that `add-source` increments (it drifts after hand edits and can count one change twice); no field at all (the index and `candidates` would have to recount every time). ## Risks / Trade-offs - The parser rejects YAML features outside the subset; templates and `check` errors make the subset visible. - Capture quality depends on the agent following the skill; the golden-set evals measure it. ## Deviations None.