agentic-os/brain/graph
Austin e723908916 feat: continuous-learning loop for the central brain
- brain/graph/learn-loop.sh: rebuild+cluster -> (LLM-tier) deep-extract corpus
  -> merge -> measure & heuristically optimize (orphan rate, community balance,
  size) -> record metrics.json + learnings.md -> sync to Windows
- brain/corpus/{diagrams,designs,notes}/: drop sources for the brain to learn
- cron agentic-os-brain-rebuild now runs the learn-loop (compounding)
- README documents the learning tiers (offline structural vs LLM semantic)

Verified: 614 nodes, 1024 links, 0.2% orphans after optimization; no node loss.
2026-07-26 15:07:40 -07:00
..
README.md feat: continuous-learning loop for the central brain 2026-07-26 15:07:40 -07:00
agentic-os.json feat: continuous-learning loop for the central brain 2026-07-26 15:07:40 -07:00
build-central.sh feat: central graphify brain (merged cross-project knowledge graph) 2026-07-26 12:44:25 -07:00
keepalive-brain-wsl.sh feat: redundant WSL brain serve + keepalive (fail-safe) 2026-07-26 14:31:46 -07:00
learn-loop.sh feat: continuous-learning loop for the central brain 2026-07-26 15:07:40 -07:00
learnings.md feat: continuous-learning loop for the central brain 2026-07-26 15:07:40 -07:00
link-project.sh feat: central graphify brain (merged cross-project knowledge graph) 2026-07-26 12:44:25 -07:00
metrics.json feat: continuous-learning loop for the central brain 2026-07-26 15:07:40 -07:00
serve-brain-wsl.sh feat: redundant WSL brain serve + keepalive (fail-safe) 2026-07-26 14:31:46 -07:00
serve-brain.sh feat: central graphify brain (merged cross-project knowledge graph) 2026-07-26 12:44:25 -07:00
sync-to-windows.sh feat: two-brain topology — WSL Agentic-OS brain + Windows standalone central brain 2026-07-26 13:04:16 -07:00

README.md

Central Brain — Graphify knowledge graph

One central, queryable brain that project graphs roll up into.

Topology (two brains)

  1. Agentic-OS brain (WSL) — this folder. agentic-os.json + merged central-graph.json.
  2. Windows central brain (device-wide, offline, standalone)C:\Users\Austin\Brains\central\. Its own Python venv + Graphify, serves central-graph.json over HTTP MCP at http://127.0.0.1:8090/mcp from Windows. No WSL dependency at query time. WSL's sync-to-windows.sh pushes the merged graph into it hourly.

Per-project graphs: projects/<name>.json (linked via link-project.sh) roll up into central-graph.json here, which is then synced to Windows.

Commands (WSL side)

bash brain/graph/build-central.sh            # rebuild WSL central brain (code graph + merge linked projects)
bash brain/graph/link-project.sh <name> <graph.json>   # register a project's graph into the brain
bash brain/graph/sync-to-windows.sh          # rebuild + push merged graph to Windows central brain
bash brain/graph/serve-brain.sh             # serve WSL central brain over HTTP MCP (:8090)
bash brain/graph/serve-brain-wsl.sh         # redundant WSL serve (:8090, independent of Windows brain)
bash brain/graph/keepalive-brain-wsl.sh     # restart WSL serve if :8090 drops (fail-safe)

Set CENTRAL_BRAIN_PORT to override the serve port (default 8090).

Continuous learning

learn-loop.sh runs the self-improving pass (replaces the plain rebuild):

  1. Rebuild code graph + cluster (edges + community labels).
  2. If an LLM key is set (GEMINI/OPENAI/ANTHROPIC/GOOGLE), deep-extract brain/corpus/ (diagrams/designs/notes) into the graph.
  3. Merge agentic-os + corpus + linked projects → central-graph.json.
  4. Measure + heuristically optimize (offline learning): computes node/link counts, orphan rate, community-size balance, and file size; collapses tiny communities into _misc for tighter recall; records metrics to metrics.json and writes what it improved to learnings.md (the brain's own memory of improvements — compounds each run).
  5. Sync to Windows brain (redundant).

Drop sources to learn from in brain/corpus/{diagrams,designs,notes}/. Without an LLM key, corpus files are stored but only become graph nodes via the semantic (keyed) path — code is always graphed offline.

Hourly cron agentic-os-brain-rebuild runs the learn-loop.

Notes

  • graphify's MCP HTTP serve requires the extra: pip install "graphifyy[mcp]" (done in the venv).
  • The write path for memory is still brain/*.md + audit + data/; graphify reads those, never writes them.
  • Rebuild is scheduled hourly by the agentic-os-brain-rebuild cron.
  • WSL serve is kept alive every 5 min by the agentic-os-brain-keepalive-wsl cron (fail-safe; mirrors Windows keepalive-brain.bat).
  • Two independent brain endpoints exist on :8090 — WSL (this tree) and Windows (C:\Users\Austin\Brains\central\). Either can answer if the other is down.