How it works
Six layers.
Events at the top fire agents. Agents lean on skills, rules, and the brain. Auto-detection at the bottom keeps the brain honest. Nothing fancy; everything composable.
Events
Schedules, hooks, webhooks, and manual triggers. Today: four maintenance crons (decay, audit-edges, dedupe, contradictions) plus the Claude Code SessionStart and PreToolUse hooks. Soon: GitHub webhooks so a push to a content/ file auto-ingests into the brain.
Agents
Claude Code sessions across the portfolio. Each gets brain access via local stdio MCP (low latency, ~50ms) or HTTPS MCP (works from anywhere with Bearer auth). The PreToolUse advisor reads the file Claude is about to write, surfaces the relevant brain context, and lets the model read it before generating code. The harness is the runtime; Roushi is the persistent layer.
Skills
Claude Code skills live on disk at ~/.claude/skills/<name>/SKILL.md so the harness can invoke them natively (e.g. /frontend-design, /seo-optimizer). Roushi indexes them as `skill` entities so the brain can recommend one in an answer or via the PreToolUse advisor — and so a team can git-track and share them via `pnpm roushi skill push`.
Rules
Durable instructions stored as first-class `rule` entities. Each rule has scope: applies_to_slug (one product), applies_to_type (every product), or applies_to: portfolio (everywhere). The SessionStart hook syncs every applicable rule into the workspace's Claude memory dir, so the next session starts with the right context already loaded.
Brain
Twelve entity types (product, tech, vendor, decision, pattern, incident, lesson, goal, person, roadmap_item, rule, skill) and ten typed edge relations. Hybrid search (HNSW vector + tsvector keyword + Reciprocal Rank Fusion at k=60). Graph traversal via recursive CTEs. Markdown files in `content/` are canonical; Postgres is the index, not the master.
Auto-detector
Four cron-driven scans plus a maintenance_runs log. Decay flags entities unvalidated > 90 days. Audit-edges flags relation mismatches. Dedupe finds near-duplicate slugs. Contradictions runs pgvector close-pair search + an LLM judge over rules/decisions/lessons. Findings post as [system] goals that auto-close when the next scan finds zero. The brain audits itself.
Want the architectural decisions + stack rationale? It's all in TECH_STACK.md on the public repo.