CC-025 — Second Brain + Agentic OS: Phases 1-3

Executed: 2026-07-07 on eco-chi-001, as eco user Repo touched: /home/eco/Dev/smk9-app/ (AGENTS.md only)

Summary

Built the three-layer architecture that makes the Van Clief incident (2026-07-02: two research files written to /tmp, lost on reboot) structurally impossible. All three phases complete, all done-criteria met, Fireman 89/89 (no regressions).

Phase 1 — Session Path Resolver

  • Created /home/eco/second-brain/ directory tree: sessions/, notes/{smk9,encompass,personal,tech}, alexandria/{inbox,rejected}, workspaces/
  • Wrote path_resolver.py — returns a durable dated session path per agent/task, verified
  • Added rsync cron (*/15 * * * *) syncing sessions/ → VPS /home/smk9/second-brain-mirror/sessions/; SSH key confirmed working; manual trigger verified a test file arrived on the VPS
  • Appended ## OUTPUT CONTRACT section to /home/eco/Dev/smk9-app/AGENTS.md — two-surface rule, /tmp ban for work output
  • Smoke test passed: session path created → file written → rsync’d → confirmed present on VPS

Phase 2 — LLM Wiki + Basic Memory MCP

  • Installed Basic Memory via pipx (basic-memory 0.22.1)
  • Initialized wiki at notes/: SCHEMA.md (conventions, tag taxonomy, page thresholds), index.md, log.md, all subdirectories (raw/{articles,papers,decisions}, entities/, concepts/, comparisons/, queries/, plus the 4 project namespaces)
  • Registered project smk9-ecosystem/home/eco/second-brain/notes via basic-memory project add (note: the briefing’s suggested ~/.config/basic-memory/config.json path is not what Basic Memory actually reads — real config lives at ~/.basic-memory/config.json, auto-managed by the CLI; used the proper CLI command instead)
  • Registered basic-memory as an MCP server in Hermes via hermes mcp add basic-memory --command basic-memory --args mcp --project smk9-ecosystem — 23 tools connected and enabled; verified via hermes mcp test basic-memory
  • Wrote 9 agent entity pages (notes/entities/: hermes, gary-webb, kobi, spider-man, tom-skilling, jake-from-state-farm, sal-the-plumber, indiana-holmes, alexandria) + 1 architecture decision page (notes/tech/cc-025-second-brain.md)
  • Smoke test: wrote a test note via basic-memory tool write-note, confirmed it landed on disk, retrieved it via basic-memory tool search-notes (exact MCP tool code path, same as what Hermes calls), then deleted the test note

Phase 3 — Alexandria Intake Cron

  • Wrote emit_to_alexandria.py — writes a metadata sidecar (alexandria_meta.json) next to any session output; importable, compiles clean
  • Wrote alexandria_intake.py — walks sessions for pending sidecars, applies the confidence gate (≥0.8 → wiki+decisions_log if decision; 0.6-0.8 → wiki only; <0.6 → quarantine), routes by artifact type
  • Bug found and fixed during testing: quarantine() originally wrote every rejected item to the same filename (rejected/alexandria_meta.json, since sidecar_path.name is identical across all sessions) — a second rejected item would silently overwrite the first, directly undermining Phase 3’s “nothing is lost” goal. Fixed by namespacing the rejected filename with the parent session directory name. Verified fix with two simultaneous low-confidence test items — both now preserved as distinct files.
  • Added intake cron (*/15 * * * *) running alexandria_intake.py
  • End-to-end test using Indiana Holmes as guinea pig: path resolver → wrote fake compliance research output → emitted sidecar (confidence 0.9) → ran intake → wiki note created at notes/smk9/research/2026-07-07-indiana-holmes-test-research-c8552040.md with correct frontmatter
  • Tested all three confidence tiers explicitly: 0.9 → wiki (high), 0.7 → wiki (medium), 0.3 and 0.2 → both quarantined as distinct files
  • MCP query smoke test: after basic-memory reindex (files written directly to disk by the intake script need a sync/reindex pass — the MCP server doesn’t watch continuously unless it’s the active running process), search-notes "rabies vaccination mandated" returned the Indiana Holmes test note as the top scoring result

Deviations from the briefing

  1. Basic Memory config path: briefing said ~/.config/basic-memory/config.json; actual tool reads ~/.basic-memory/config.json and is managed via basic-memory project add. Used the real mechanism.
  2. Hermes MCP registration: briefing suggested hand-editing a mcp: servers: block in config.yaml; that key doesn’t exist in this Hermes version’s schema (the mcp: at line 201 is an LLM-routing-provider config, unrelated). Used hermes mcp add instead — safer, and it’s what the CLI is for.
  3. Files written directly to the wiki directory (not through the MCP write_note tool) require a basic-memory reindex before they’re searchable — not called out in the briefing, worth remembering: the intake cron writes raw markdown files, so downstream search will lag until the next reindex/sync unless a Basic Memory MCP server is kept running continuously to watch the directory.
  4. Fixed a genuine filename-collision bug in alexandria_intake.py’s quarantine() function (see Phase 3 above) — not just following the spec verbatim where it was wrong.

Status vs. DONE CRITERIA

All 11 criteria met:

  1. path_resolver.py verified
  2. ✅ rsync cron verified (manual trigger + file confirmed on VPS)
  3. ✅ AGENTS.md Output Contract section added
  4. ✅ Basic Memory installed, --version clean
  5. ✅ Wiki structure initialized (SCHEMA.md, index.md, log.md)
  6. ✅ 9 agent pages + 1 architecture page created
  7. ✅ Basic Memory registered in Hermes MCP, 23 tools visible/enabled
  8. emit_to_alexandria.py written, importable
  9. alexandria_intake.py routes correctly at all three confidence tiers (bug fixed during verification)
  10. ✅ Full pipeline smoke test passed end-to-end
  11. ✅ Fireman 89/89 — no regressions to SMK9 app (only file touched in the repo was AGENTS.md)

Not done (explicitly out of scope per briefing)

  • Qdrant integration (stubbed in alexandria_intake.py comments, not wired)
  • Firestore client_data routing (stubbed, not wired)
  • Phase 4 (events/ directory) and Phase 5+ (workspaces/ ICM stage folders) — directories created empty per the structure spec, no logic built