Memory v2 / Step 2 · Wed 29 Apr 2026

Bootstrap ingest plan

Seed ~/cosmo-memory/topics/ from existing knowledge sources. Three-pass Opus pipeline. Shadow-mode review. Dashboard upgrade first.

Listen — tap to start, auto-plays each section
What we're solving. Right now ~/cosmo-memory/topics/ is empty. The router can't pull anything into Cosmo's prompt because there's nothing to pull. Until topics exist, the read path is task-only. Bootstrap fills topics from sources we already have, in one careful pass with verification, before the dream pass starts running nightly.
Contents
  1. What's at stake
  2. The corpus — what's in scope
  3. What's NOT in scope (yet)
  4. MEMORY.md as migration, not rebuild
  5. Topic granularity rules
  6. Date extraction rules
  7. Three-pass Opus pipeline
  8. Dashboard upgrade (built first)
  9. Shadow-mode review flow
  10. Estimated cost & time
  11. Deferred to later steps
  12. Build order

What's at stake

Bootstrap is the only ingest pass that runs over all existing knowledge before the dream pass takes over. The dream pass after this only sees new episodes from chat turns. Anything not picked up here either:

So: we ARE aiming for completeness, but only over a defined corpus. The trick is defining the corpus precisely, then verifying coverage of THAT corpus. We're not aiming for "all knowledge ever" — that's impossible. We're aiming for "every durable fact present in these specific files."

How do we know what we missed? Three verification mechanisms working together. No single one is sufficient.

  1. Coverage pass (Pass 2 of the pipeline). Opus reads source files + generated topics, lists facts NOT extracted, categorises as (a) intentionally excluded, (b) ambiguous, (c) genuine miss. Human reviews the miss list.
  2. Round-trip pass (Pass 3). Opus reads each topic, traces it back to source paragraphs. Untraceable topics = invented = revise or delete.
  3. Use-driven gap detection (deferred). Over time, log router-misses (zero topics matched) and direct-source-reads. Each is a missing-topic signal. Captured as a future task; lands with step 3 dream pass infrastructure.
Success criteria. After bootstrap:

The corpus — what's in scope

Programmatic enumeration. The bootstrap script discovers sources at runtime rather than hardcoding paths. Categories:

CategoryPatternNotes
Auto-memory (existing) ~/.claude/projects/-Users-sahil-cosmo/memory/MEMORY.md + linked files Highest-signal source. Treated as migration (see next section).
Cosmo project rules ~/cosmo/CLAUDE.md Deployment, ports, MCP, communication preferences.
User global rules ~/.claude/CLAUDE.md Cross-project conventions, dates format, em-dash rule, etc.
All Sites projects ~/Sites/**/CLAUDE.md (recursive) Per-project rules. Includes subprojects under ~/Sites/labs/ etc. All of them, not just active.
Project skills (cosmo) ~/cosmo/.claude/skills/**/*.md health (extensive), dms, fleet, cosmo-development, etc.
User skills (global) ~/.claude/skills/**/*.md Bear, gmail, calendar, contacts, etc. — the user-level skills.
Specs & reference docs ~/cosmo/specs/**/*.md
~/cosmo/.claude/skills/health/reference/**/*.md
Architecture, research notes, health protocols, daily-commands, progressive-overload reference.
Session continuation files Programmatically discovered by reading /continue and /catchup skill source code to enumerate every location they touch. This includes: ~/cosmo/session-docs/, ~/cosmo/.sessions/, ~/cosmo/.claude/, per-project ~/Sites/{project}/session-docs/ + .sessions/ + .claude/, domain logs at ~/cosmo/.claude/skills/health/sessions/, etc. Old AND new files.
Domain session logs ~/cosmo/.claude/skills/*/sessions/**/*.md Coaching threads (health/Phase 9), work coaching, etc. Each session log is a continuity artefact.

Total input estimate: 150-250K tokens. Larger than v1 estimate because session-files set was undercounted before.

Programmatic source discovery. Hardcoding paths is brittle. The bootstrap script reads the /continue and /catchup skill source files (under ~/.claude/skills/continue/ and /catchup/) and extracts the directory patterns they reference. Those skills already enumerate every session file location authoritatively. This makes the bootstrap script's source list match reality automatically.

What's NOT in scope (yet)

These are real sources of memory but require their own ingest strategy. Captured as task files in ~/cosmo-memory/tasks/active/ so we don't forget:

And the SCHEMA-level exclusions (always):


MEMORY.md as migration, not rebuild

The existing MEMORY.md at ~/.claude/projects/-Users-sahil-cosmo/memory/ is human-curated. Each entry has explicit Why: and How to apply: lines that took real failures to learn. Re-deriving via Opus risks losing those load-bearing rationales.

Migration approach:

  1. Preserve the rule text verbatim. "NEVER copy dist files to server" stays exactly as is.
  2. Preserve Why: and How to apply: lines intact.
  3. Preserve the date when known.
  4. Drop the <type> categorisation (user/feedback/project/reference). The old structure organises by category-of-rule. The new system organises by life domain. The type is metadata that doesn't carry semantic weight in topic-space.
  5. Re-route by domain. A feedback_h2os_deployment.md becomes a section inside topics/work-h2os.md, OR its own topic file if substantial enough.

This is migration in the sense that matters: facts kept, structure rebuilt around them. Pass 1 of the pipeline handles MEMORY.md with explicit instructions to preserve verbatim rule text + rationale.


Topic granularity rules

One topic per:

NOT one topic per:

Splitting heuristic

If a topic file would mix "current state" + "history" of something, split into two: X-current and X-history. The router pulls current-state files way more often; history files only when the user explicitly asks back in time.


Date extraction rules

Date typeFormatExample
Ongoing fact*(since YYYY-MM)*"Lives in Adelaide *(since 2024-03)*"
Range*(YYYY-MM to YYYY-MM)*"Used Mem0 *(2025-04 to 2026-04)*"
Exact day*(YYYY-MM-DD)*"First date with Kathryn *(2026-01-25)*"
Fuzzy*(~YYYY)*"Started caring about climate *(~2018)*"
Unknown(no date — flag in dream pass review)

If the source doesn't include a date and Pass 1 can't infer with confidence, leave dateless and add to a TODO list for human review. Don't invent precision.


Three-pass Opus pipeline

One Opus run isn't enough. Three sequential passes, each with one job:

1Extract

Input: all source files concatenated, plus SCHEMA.md, plus the rule set above.

Job: produce topic files. Output format: stream of === FILE: topics/<basename>.md === blocks. Plus a TODO list of dates/facts that were ambiguous.

Cost: ~150-250K input + ~50K output ≈ $4-6 with Opus 4.7.

Time: 10-15 min.

2Coverage check

Input: all source files + Pass 1's topic outputs.

Job: for each source file, list facts that did NOT make it into a topic. Categorise as:

Output: a coverage report at ~/cosmo-memory/inbox/bootstrap-coverage-YYYY-MM-DD.md. Human reviews the (c) list.

Cost: ~250-300K input + ~5-10K output ≈ $4-5.

Time: 10-15 min.

3Round-trip

Input: Pass 1's topic outputs + source files.

Job: for each topic, identify which source paragraph(s) produced it. Flag any topic that can't be traced as "potentially invented."

Output: source-link metadata appended to topic frontmatter as sources: [path1, path2, ...], plus a "potentially invented" list at ~/cosmo-memory/inbox/bootstrap-roundtrip-YYYY-MM-DD.md.

Cost: ~200-300K input + ~5K output ≈ $3-4.

Time: 10-15 min.

Why three passes, not one? The science: long-context models do well at synthesis (Pass 1) but worse at "what's missing from this synthesis" (different cognitive task — needs the input visible AND the output side-by-side). And round-trip provenance is yet another distinct task. Splitting them lets each call focus on one job, which the literature consistently shows beats multi-job prompts. Total cost stays bounded at ~$10-15.

Dashboard upgrade — built first

The current dashboard at http://127.0.0.1:9876 is a viewer. Bootstrap output is 60-100 topic files. Reviewing in a viewer with no review tooling is brutal. So upgrade dashboard FIRST, then run bootstrap.

New features:

Time: ~2-3 hours of work.


Shadow-mode review flow

Bootstrap writes to ~/cosmo-memory/topics-draft-YYYY-MM-DD/, NOT directly to topics/. Review happens in the draft dir. Once approved, files move into topics/.

The flow:

  1. Run bootstrap script → writes to topics-draft-2026-04-29/
  2. Open dashboard → see all draft topics with their review state (initially all "pending")
  3. Review each: approved | needs-revision | delete
  4. For "needs-revision": edit the file directly via VSCode or leave a note and come back
  5. For "delete": click delete, file goes to topics-draft-DATE/.deleted/ (audit trail, not lost)
  6. Once everything is approved or deleted: run cosmo-mem bootstrap merge → moves approved files into topics/, archives the draft dir
  7. Commit cosmo-memory repo
  8. Restart cosmo-agent so the live system picks up the new topics
Idempotency. If bootstrap output is bad: delete the draft dir, fix the prompt, re-run. The draft dir is throwaway. topics/ stays untouched until merge. This makes re-runs trivial and risk-free.

Estimated cost & time

ItemEstimate
Pass 1 (extract)~$4-6 · 10-15 min
Pass 2 (coverage)~$4-5 · 10-15 min
Pass 3 (round-trip)~$3-4 · 10-15 min
LLM cost total~$11-15
Pipeline wall-clock~30-45 min
Dashboard upgrade build~2-3 h
Bootstrap script build~1-2 h
Human review time~3-4 h spread over a day
Total wall time~1-1.5 days

This is bounded and worth it. The downstream value (router has things to pick from, dream pass starts running on real topics, "what does Cosmo know about me" actually works) is huge.


Deferred to later steps

Captured as task files in ~/cosmo-memory/tasks/active/ so they don't get forgotten:


Build order

  1. This doc, signed off.(if you're reading this, we're here)
  2. Deploy doc to Cloudflare Pages (sibling to memory-v2.pages.dev).
  3. Dashboard upgrade — review state, comments, source links, coverage view, diff-vs-source. (~2-3h)
  4. Bootstrap script at ~/cosmo/scripts/cosmo-mem-bootstrap.js. Reads /continue+/catchup skills to enumerate sources, runs Pass 1, Pass 2, Pass 3 sequentially, writes to topics-draft-YYYY-MM-DD/, generates inbox reports. (~1-2h)
  5. Dry-run on MEMORY.md only — sanity check the migration approach for ~$1, ~3 min.
  6. Full bootstrap run — all sources, three passes. (~30-45 min, ~$11-15)
  7. Review via dashboard — mark every topic. (~3-4h spread over a day)
  8. Merge into topics/. Archive draft dir. Commit cosmo-memory.
  9. Restart cosmo-agent. Live system picks up new INDEX (auto-loaded).
  10. Smoke-test via Telegram — "what's my current training plan?", "where do I live?", "what's H2OS?".
Decision points along the way:

Doc lives at plans/memory-v2-step2-bootstrap.html on the memory-v2 branch. Generated Wed 29 Apr 2026.

Now playing