How mycelium-hq/ai-brain-starter works
AI Brain Starter is a local-first memory and verification harness for AI-assisted work. The main workflow loads vault context at session start, guards edits deterministically, and files decisions and other useful material at session close; bi-temporal rules and drift/closed-loop scripts support ongoing verification. The repository also includes ingestion, graph-query, and health-data capabilities. Arrows follow the README or shown source references; several branches are documented or indexed but their internal wiring was not sampled.
Main entry points: main.py Health MCP server · hooks Edit guards · analytics.py Health analytics · ingest.py YouTube ingestion
Components 27
Vault and memory
- Markdown vault
- Context loading
hooks/session-start-context.py - Typed extractors
scripts/extractors/_base.py - Vault insights
scripts/vault-insight-engine.py - Graph query MCP
scripts/mcps/graph-query-server.py - Memory REST API
services/memory-api/app.py - Graph store
services/memory-api/graph_store.py
Deterministic guards
- Edit guards
hooks - Safe file access
hooks/_lib/safe_read.py - Vault resolution
hooks/_lib/vault_root.py - Worktree safety
hooks/_lib/worktree_safety.py
Session lifecycle
- Session coordination
hooks/session-lock.py - Close verification
hooks/verify-session-close-cascade.py
Rule quality loop
- Rule lineage
scripts/resolver-build.py - Drift detection
scripts/drift-detection.py - Memory promotion loop
scripts/closed-loop-daemon.py
Data integrations
- Health MCP server
services/health-mcp/main.py - Health database
services/health-mcp/db.py - Health analytics
services/health-mcp/analytics.py - Health scoring
services/health-mcp/scores.py - Vault health context
services/health-mcp/vault_aware.py - Google Health client
services/health-mcp/google_health_client.py - Oura client
services/health-mcp/oura_client.py - External connectors
skills/_shared/connector_utils.py - YouTube ingestion
skills/ingest-youtube/ingest.py - GitHub ingestion
skills/ingest-github/ingest.py
Other components
- User
Connections 36
- User → Context loading: starts session
README.md - Context loading → Markdown vault: loads context
README.md - User → Edit guards: edits content
README.md - Edit guards → Markdown vault: guards writes
README.md - Edit guards → Safe file access: uses safe reads
hooks/_lib/worktree_safety.py - Worktree safety → Safe file access: reads safely
hooks/_lib/worktree_safety.py - Worktree safety → Vault resolution: resolves vault
hooks/_lib/worktree_safety.py - User → Session coordination: starts session
hooks/session-lock.py - User → Close verification: closes session
README.md - Close verification → Markdown vault: verifies filing
hooks/verify-session-close-cascade.py - Markdown vault → Typed extractors: provides notes
- Typed extractors → Vault insights: supports analysis
scripts/vault-insight-engine.py - Markdown vault → Vault insights: reads metadata
scripts/vault-insight-engine.py - User → Graph query MCP: queries memory
- User → Memory REST API: queries remotely
services/memory-api/app.py - Memory REST API → Graph store: queries graphs
services/memory-api/app.py - Markdown vault → Rule lineage: holds rules
README.md - Rule lineage → Drift detection: checks drift
README.md - Drift detection → Memory promotion loop: informs promotion
README.md - Memory promotion loop → Markdown vault: updates memory
README.md - User → Health MCP server: requests health data
- Health MCP server → Health database: reads and writes
services/health-mcp/main.py - Health MCP server → Health analytics: calls analytics
services/health-mcp/main.py - Health MCP server → Health scoring: calls scoring
services/health-mcp/main.py - Health MCP server → Vault health context: calls vault context
services/health-mcp/main.py - Health MCP server → Google Health client: imports provider data
services/health-mcp/main.py - Health MCP server → Oura client: imports provider data
services/health-mcp/main.py - Health analytics → Health database: queries data
- Health analytics → Health scoring: uses scores
- Vault health context → Health scoring: uses scores
services/health-mcp/vault_aware.py - User → YouTube ingestion: submits video
skills/ingest-youtube/ingest.py - YouTube ingestion → External connectors: uses helpers
skills/ingest-youtube/ingest.py - YouTube ingestion → Markdown vault: writes normalized note
skills/ingest-youtube/ingest.py - User → GitHub ingestion: submits repository data
skills/ingest-github/ingest.py - GitHub ingestion → External connectors: uses helpers
skills/ingest-github/ingest.py - GitHub ingestion → Markdown vault: writes normalized note
skills/ingest-github/ingest.py