|
2 | 2 |
|
3 | 3 | ## What this is |
4 | 4 |
|
5 | | -**memory-os is the Knowledge OS for the studio**, consolidated into one repo so it can evolve as a single surface. It folds together three previously-separate npm packages: |
| 5 | +**memory-os is the Knowledge OS for the studio**, consolidated into one repo so it can evolve as a single surface. It folds together three previously-separate npm packages plus the live runtime hook: |
6 | 6 |
|
7 | 7 | | Was | Now lives at | Role | |
8 | 8 | |---|---|---| |
9 | | -| `@mcptoolshop/ai-loadout` | `packages/kernel/` | Dispatch table, matching, resolver, runtime | |
10 | | -| `@mcptoolshop/claude-memories` | `packages/memories/` | MEMORY.md parser + index/validate/stats | |
11 | | -| `@mcptoolshop/claude-rules` | `packages/rules/` | CLAUDE.md parser + split/analyze/stats | |
| 9 | +| `@mcptoolshop/ai-loadout` (npm 1.4.3 — only one published) | `packages/kernel/` | Dispatch table, matching, resolver, runtime (`matchLoadout`, `planLoad`, `resolveLoadout`, `recordLoad`) | |
| 10 | +| `@mcptoolshop/claude-memories` (unpublished) | `packages/memories/` | MEMORY.md parser + `index`/`validate`/`stats`/`health` | |
| 11 | +| `@mcptoolshop/claude-rules` (unpublished) | `packages/rules/` | CLAUDE.md parser + `analyze`/`split`/`validate`/`stats` | |
| 12 | +| `~/.claude/loadout-hook/` (LIVE) | `apps/hook/` | UserPromptSubmit hook — injects pointer lines to relevant memory entries | |
12 | 13 |
|
13 | | -Plus the runtime pointer-injection hook earned in the 2026-06-10 session: |
| 14 | +## The live system (do not break this) |
14 | 15 |
|
15 | | -| Was | Now lives at | Role | |
16 | | -|---|---|---| |
17 | | -| `~/.claude/loadout-hook/` | `apps/hook/` | UserPromptSubmit hook — injects pointer lines to relevant memory entries | |
| 16 | +The production data flow, running on this rig right now: |
| 17 | + |
| 18 | +``` |
| 19 | +canonical store C:/Users/mikey/.claude/projects/F--AI/memory/ (~330 .md files + MEMORY.md) |
| 20 | + │ claude-memories index + validate ← "Index Freshness Ritual" in global CLAUDE.md |
| 21 | + ▼ |
| 22 | +store dispatch table <store>/index.json |
| 23 | + │ ~/.ai-loadout/refresh.ps1 (absolute-path rewrite + copy) |
| 24 | + ▼ |
| 25 | +global layer ~/.ai-loadout/index.json (~319 entries) |
| 26 | + │ read on EVERY UserPromptSubmit |
| 27 | + ▼ |
| 28 | +hook ~/.claude/loadout-hook/loadout-hook.mjs (wired in ~/.claude/settings.json) |
| 29 | + │ matchLoadout(prompt) → ≤5 pointer lines, ≤200 tokens, pointers NOT payloads |
| 30 | + ▼ |
| 31 | +injected additionalContext + usage events → ~/.ai-loadout/usage.jsonl |
| 32 | +``` |
| 33 | + |
| 34 | +Operational consequences: |
18 | 35 |
|
19 | | -## Status — PROTOTYPE (2026-06-10) |
| 36 | +- **The live hook is `~/.claude/loadout-hook/`** — `apps/hook/` here is a mirror for refactor work. If you change hook behavior: update BOTH copies, run `apps/hook/smoke-test.ps1`, and keep the command path in `~/.claude/settings.json` pointing at the live copy. Off-switch for testing: `AI_LOADOUT_HOOK=off`. |
| 37 | +- **Never edit `~/.claude/settings.json` hook wiring casually** — a broken hook fires on every prompt of every session. |
| 38 | +- Index changes only take effect after the ritual (index → validate → refresh). The hook reads the GLOBAL copy, not the store copy. |
20 | 39 |
|
21 | | -This is a **prototype consolidation**, not a finished product. Expect 1–2 months of work to reach shippable state. Pick up via `ROADMAP.md` at the repo root. |
| 40 | +## Status — PROTOTYPE (bootstrapped 2026-06-10) |
| 41 | + |
| 42 | +Phase 0 of 6 done. Pick up via `ROADMAP.md` (six phases: wiring → runtime quality → unified CLI → docs → npm/GitHub bootstrap → publish + retirement). |
22 | 43 |
|
23 | 44 | ## Source-of-truth rule (load-bearing) |
24 | 45 |
|
25 | | -Until memory-os reaches first-shippable, the **upstream source-of-truth** still lives at: |
| 46 | +Until Phase 6 retirement, **upstream source-of-truth stays at**: |
| 47 | + |
| 48 | +- `E:/AI/ai-loadout/` (kernel), `E:/AI/claude-memories/`, `E:/AI/claude-rules/` — the globally-installed CLIs come from these dirs |
| 49 | +- `~/.claude/loadout-hook/` — the running hook |
26 | 50 |
|
27 | | -- `E:/AI/ai-loadout/` (kernel — npm `@mcptoolshop/ai-loadout@1.4.3`, the only one published) |
28 | | -- `E:/AI/claude-memories/` (memories — local-only, README rewritten 2026-06-10 to admit not-on-npm) |
29 | | -- `E:/AI/claude-rules/` (rules — local-only, README rewritten 2026-06-10 to admit not-on-npm) |
30 | | -- `~/.claude/loadout-hook/` (hook — wired into `~/.claude/settings.json`, runs every UserPromptSubmit) |
| 51 | +**Do not edit the three upstream repos from inside memory-os sessions.** Edits here stay here until the explicit Phase 6 cutover. The one exception is the hook's both-copies rule above. |
31 | 52 |
|
32 | | -**Do not edit the three upstream source repos from inside memory-os.** Edits inside memory-os stay inside memory-os until the explicit retirement step in `ROADMAP.md` (Phase 5). |
| 53 | +## Repo-first waiver (deliberate — do not "fix") |
33 | 54 |
|
34 | | -**The live hook** at `~/.claude/loadout-hook/` is what's actually running in every session. `apps/hook/` here is a mirror for refactor work. If you change the hook contract, update both — and the wired path in `~/.claude/settings.json`. |
| 55 | +This repo intentionally has **no GitHub remote yet**, which violates the workspace Repo-First Hard Rule. The waiver is director-approved (2026-06-10): it's a local prototype consolidating already-pushed upstream sources; nothing here is unrecoverable. The remote lands at Phase 5. Do not create the remote early or halt over the rule. |
35 | 56 |
|
36 | 57 | ## Why this consolidation |
37 | 58 |
|
38 | | -The "three small packages, one kernel + two adapters" design is architecturally clean (decompose-by-secrets, Parnas 1972) but operationally broken for the studio's solo + LLM-crew shape. Multi-repo work fragments Claude context across sessions, lets unpublished adapters rot (only kernel was published), and forces serial advancement when one-repo work could be parallel-within-session. Full reasoning: `C:/Users/mikey/.claude/projects/F--AI/memory/Feedback/feedback_consolidate_when_cant_juggle_repos.md`. |
| 59 | +Decompose-by-secrets (Parnas 1972) is right for N humans, operationally broken for solo + LLM-crew: multi-repo work fragments Claude context, unpublished adapters rot (only the kernel ever shipped), and advancement serializes across repos. Full reasoning: `memory/Feedback/feedback_consolidate_when_cant_juggle_repos.md` in the canonical store. |
39 | 60 |
|
40 | 61 | ## Working rules |
41 | 62 |
|
42 | | -- **Read `ROADMAP.md` first.** It's the dispatch table for this repo. |
43 | | -- **Read the global rules** at `C:/Users/mikey/.claude/CLAUDE.md` and the workspace rules at `E:/AI/.claude/CLAUDE.md` — they apply here too. |
44 | | -- **Read the canonical memory store** at `C:/Users/mikey/.claude/projects/F--AI/memory/MEMORY.md` before any Write/Edit (enforced by hook). |
45 | | -- The `loadout-hook` from session 2026-06-10 is live — it injects pointer lines on every prompt. Use them; don't paraphrase from the summaries. |
46 | | -- Workflow standards apply: any new pipeline/script/SKILL.md needs the six-standards compliance block (`workflow_standards.md`). |
| 63 | +- **Read `ROADMAP.md` first** — it's the dispatch table for this repo, and each phase has a gate that halts on failure. |
| 64 | +- Global rules (`C:/Users/mikey/.claude/CLAUDE.md`) and workspace rules (`E:/AI/.claude/CLAUDE.md`) apply here. |
| 65 | +- **Cost discipline:** no agent fleets, no Workflow orchestration without explicit pricing + director approval. This layer's work is deterministic-first: scripts, validators, hand edits. |
| 66 | +- The loadout-hook injects pointer lines on prompts — open the pointed file before acting; don't paraphrase from the summary line. |
| 67 | +- Any new pipeline/script/SKILL.md authored here needs the six-standards compliance block (`workflow_standards.md`). Phase 6 (publish/deprecate/cutover) additionally requires a compensators table — no skip allowed. |
| 68 | +- If the session touches the canonical memory store, end with the Index Freshness Ritual (global CLAUDE.md, Non-Negotiable). |
| 69 | + |
| 70 | +## Verification |
| 71 | + |
| 72 | +- Per-package (until Phase 1 wires the root): `npm test` inside `packages/{kernel,memories,rules}` — all three have real suites. |
| 73 | +- Hook: `apps/hook/smoke-test.ps1` (drives the hook with sample stdin JSON; also run it against the live copy after any hook change). |
| 74 | +- System: `claude-memories validate <store>/MEMORY.md` (expect 0 errors) and `ai-loadout validate <store>/index.json` / `~/.ai-loadout/index.json`. |
| 75 | +- This is a CLI/library repo — never use preview/browser tools here. |
47 | 76 |
|
48 | | -## Standards compliance — repo bootstrap |
| 77 | +## Known issues (field evidence, 2026-06-10 — Phase 2 owns these) |
49 | 78 |
|
50 | | -This repo is a prototype clone-in, not a workflow. The six-standards rule applies to workflows authored INSIDE this repo (CI pipelines, swarm dispatchers, multi-step builds), not to the bootstrap itself. |
| 79 | +1. **Hook has no score threshold.** Design said below-threshold → silence; implementation injects top-5 regardless (observed: irrelevant claude-guardian/duel-system pointers on a memory-os prompt). |
| 80 | +2. **Junk index entries** derived from prose lines: `memory-files`, `full-frame`, `see-also-…` (100+-char id). Root cause is in `packages/memories` parsing/index-gen, not the data. |
| 81 | +3. **Weak keyword matching** on auto-extracted keywords; `ai-loadout overlaps` shows routing ambiguities. Hand-curated frontmatter keywords is the cheap fix. |
| 82 | +4. One LONG_SUMMARY warning left in the store index (`newsletter-publishing-…`). |
51 | 83 |
|
52 | 84 | ## Quick orientation |
53 | 85 |
|
54 | | -- `packages/kernel/` — published as `@mcptoolshop/ai-loadout@1.4.3`. Stable API surface (`matchLoadout`, `planLoad`, `resolveLoadout`, `recordLoad`). Don't break this. |
55 | | -- `packages/memories/` — CLI `claude-memories` (installed globally from this directory's upstream). Commands: `analyze`, `index`, `validate`, `stats`, `health`. |
56 | | -- `packages/rules/` — CLI `claude-rules` (installed globally from upstream). Commands: `analyze`, `split`, `validate`, `stats`, `init-signals`. |
57 | | -- `apps/hook/` — Node project, single mjs entrypoint, depends on `@mcptoolshop/ai-loadout` (npm). When Phase 1 lands, swap to a workspace dep on `packages/kernel`. |
| 86 | +- `packages/kernel/` — published API surface; **don't break it**, and don't rename the package before Phase 5's naming decision. |
| 87 | +- `packages/memories/` — the parser quirks to know: one ref parsed per line (first backtick path wins), wildcard paths error, any backticked `*.md` token in prose is treated as a ref. |
| 88 | +- `packages/rules/` — frontmatter is source-of-truth; `validate` flags drift against `.claude/rules/index.json`. |
| 89 | +- `apps/hook/` — single-file mjs, fail-silent by design (every error path exits 0 so a broken hook can never block a prompt). |
0 commit comments