Skip to content
All case studies

Roushi · Private beta

The brain that runs while you build.

"Ask the master." A self-wiring knowledge layer and autonomous coordination plane for portfolio operators. Roushi is the oracle, not an assistant — every decision, pattern, lesson, and goal across all your products lives here, and it prescribes context to Claude Code before you write code, not after. Built on Next.js 16, Neon Postgres + pgvector, Drizzle, Auth.js v5, and a custom MCP server (stdio + HTTPS).

MCP tools
35
MCP tools
Entity types
12
Entity types
Indexed entities
100+
Indexed entities
Cron-driven scans
4
Cron-driven scans
Product
Roushi (roushi.ai)
Industry
Developer tools · Portfolio knowledge
Services
Full-stack, AI integration, Claude Code workflow
Status
Private beta
The challenge

A brain for solo portfolio operators.

Solo founders and portfolio operators carry the entire context of their business in their head. As the portfolio grows past five products, that context fragments — decisions in product A are forgotten when working on product B, lessons from a painful incident in repo X don't surface when the same trap appears in repo Y, and every AI agent (Claude Code, Cursor, Windsurf) cold-starts each session with no memory of prior work.

Pain points identified

What's broken

  • Cross-product context fragments as the portfolio crosses ~5 products
  • Architectural decisions get re-litigated every quarter — the rationale isn't durable
  • Lessons from painful 3am incidents don't transfer to the next product
  • Marketing, /help pages, and changelogs drift the moment code ships
  • Every Claude Code session starts cold — no memory of the prior session
  • Notion / Obsidian are passive: they wait to be queried, never act or coordinate

Goals defined

What we built

  • A persistent, queryable, event-aware memory layer every product and every agent shares
  • Hybrid search (HNSW + tsvector + RRF) so the right context surfaces by intent OR by keyword
  • A typed graph (12 entity types, 10 relations) — "which products use Drizzle?" returns a real answer
  • Cron-driven self-maintenance — the brain flags its own stale, duplicate, contradictory entries
  • A Claude Code integration that prescribes context while you write code, not after
  • Markdown in git as source of truth — Postgres is the index, not the master
Our solution

The brain runs while you build.

Six layers, one purpose: the brain knows what you've built, and Claude Code uses that knowledge before generating each next file. Roushi is wired into every project workspace via PreToolUse hooks that inject relevant context the moment you start editing.

01

Ask the master (synthesis with citations)

The homepage Ask flow runs your question through hybrid search (top-12 by default), grounds an LLM (gpt-4o) on the retrieved entities, and returns a synthesized answer with [slug] citations linking to entity detail pages. Below the answer: a gap analysis — what the LLM judged the brain doesn't know yet, which becomes leads for what to ingest next.

  • Grounded synthesis (no hallucinated entities)
  • Clickable [slug] citation chips
  • Gap analysis surfaces what to learn next
  • Same engine via `pnpm roushi think` and MCP
02

Roushi-as-advisor (PreToolUse context)

Before every Edit/Write in any project workspace, a hook classifies the file by path pattern, looks up the most relevant lessons/decisions/patterns/rules from the brain, and injects them as context. Claude reads the prior knowledge before generating the code. Result: code lands secure and idiomatic on the first try.

  • Fires globally across all project workspaces
  • 8 file-type classifications (cron route, API route, Server Action, middleware, auth, schema, env, client component)
  • ~500ms wall-clock per fire, gated to be silent when nothing matches
  • Composes with the always-on security checklist hook
03

Typed graph + visual explorer

Twelve entity types (product, tech, vendor, decision, pattern, incident, lesson, goal, person, roadmap_item, rule, skill) connected by ten typed relations (uses, depends_on, hosted_on, defined_by, led_to, mentions, applies_to, blocks, shares_pattern, supersedes). The /graph page renders the full portfolio knowledge as a force-directed view; click any node to open its entity.

  • Zero-LLM extraction from wikilinks + frontmatter
  • LLM-augmented sub-entity extraction during add-project
  • Recursive-CTE traversal for multi-hop queries
  • cytoscape force-directed viz at /graph
04

Cron-driven self-maintenance

Four scans run on schedule: decay (daily 3am UTC) flags entities unvalidated >90d; audit-edges (Sun 4am) flags wrong relations; dedupe (1st of month) finds near-duplicate slugs; contradictions (Sun 6am) uses pgvector close-pair search + LLM judge to flag conflicting rules/decisions/lessons. Each scan posts findings as [system] goals; goals auto-close when findings clear.

  • maintenance_runs table logs every invocation
  • Per-kind threshold gating prevents goal spam
  • LLM judge on contradictions uses gpt-4o-mini (~$0.01/run)
  • /goals shows recent cron activity + next scheduled run
Technical deep dive

Architecture and infrastructure.

Frontend & app shape

Single Next.js 16 app at the repo root — web UI, API routes, Server Actions, MCP route, and CLI all live in one tree. Turborepo split deferred until CLI/SDK shape stabilizes.

  • shadcn/ui + Tailwind CSS 4
  • Strict TypeScript with bundler resolution + .js import extensions
  • react-markdown for Ask flow citations (custom [slug] chip renderer)
  • cytoscape (built-in cose layout) for the /graph view
  • Server Components for read paths; Server Actions with Zod for mutations

Backend & infrastructure

Vercel Fluid Compute with Node 24 LTS for the API surface. Four Vercel Cron jobs invoke maintenance scans on schedule. The MCP server ships as both a stdio binary (pnpm mcp) and a deployed HTTPS Route Handler at /api/mcp.

  • Auth.js v5 + GitHub OAuth, JWT sessions, gated by AUTH_ALLOWED_EMAILS
  • Neon Postgres via Vercel Marketplace (scale-to-zero, multi-machine from day 1)
  • Bearer-token auth on /api/cron/* (CRON_SECRET) and /api/mcp (ROUSHI_MCP_HTTP_TOKEN)
  • Stateless JSON-RPC over POST on the deployed MCP route — McpServer cached at module scope, Fluid Compute reuses across requests
  • No vendor lock — markdown in git is the source of truth; Postgres is the index

MCP tool catalog (35)

Every brain capability is a typed MCP tool. Local stdio is registered globally in Claude Code for low-latency access; the deployed HTTPS endpoint exposes the same 35 tools to remote agents.

  • Synthesis: think (gpt-4o with citations + gaps)
  • Retrieval: search (hybrid + --rerank), graph_query (multi-hop CTE), get_entity, list_entities
  • Ingestion: add, ingest, scan_projects, add_project (LLM-extracts sub-entities)
  • Goals: goal_add / goal_list / goal_update_status (full lifecycle)
  • Scratchpad: write / read / list (per-agent ephemeral memory)
  • Playbooks: 9 tools — registry + invocation tracking
  • Rules: list / get / sync_workspace (auto-distribute into project workspaces)
  • Skills: list / get / ingest (index ~/.claude/skills as brain entities)
  • Optimize: audit_edges, find_duplicates, merge_entities, list_stale, touch_entity

Database & storage

Neon Postgres with pgvector for embeddings (1536-dim text-embedding-3-small) and tsvector for full-text. Drizzle ORM with snapshot migrations. Hybrid search fuses both rankings via Reciprocal Rank Fusion (k=60).

  • HNSW index on embeddings (cosine distance)
  • GIN index on tsvector (generated column from name + description)
  • 12 entity types + 10 typed edge relations in pgEnums
  • maintenance_runs table logs every cron scan (kind, ran_at, findings, duration)
  • Markdown in git as the canonical source — drizzle-kit push + post-migration-indexes.sql two-step
Key features

Twelve feature pillars.

Ask the Master

LLM-synthesized answers grounded in the brain. Citations and gap analysis on every response.

Hybrid Search + RRF

pgvector cosine + Postgres tsvector keyword, fused via Reciprocal Rank Fusion. Optional LLM rerank stage.

Visual Graph at /graph

Force-directed cytoscape view of every entity and edge. Type-filter legend, name search, click-to-navigate.

Typed Knowledge Graph

12 entity types and 10 typed relations. Multi-hop traversal via recursive CTE with cycle protection.

PreToolUse Advisor

Roushi-as-advisor hook injects relevant brain context into Claude Code before every Edit/Write.

Security Checklist Hook

File-path-pattern security guidance fires before code lands. Composes with portfolio-security-baseline rule.

Auto-Synced Portfolio Rules

Rules in the brain auto-write into every workspace's Claude memory dir via the SessionStart hook.

Self-Maintenance Crons

Decay / dedupe / audit-edges / contradictions scans run on schedule; findings surface as [system] goals.

CLI + Stdio MCP

pnpm roushi <cmd> for local ops; pnpm mcp for stdio MCP server. Both share the same library code.

Deployed MCP over HTTPS

/api/mcp Route Handler exposes the same 35 tools to remote agents. Bearer-token auth via ROUSHI_MCP_HTTP_TOKEN.

Auto-Indexed Skills

Claude Code skills stay on disk for native /<skill> invocation; Roushi indexes them so think can recommend them.

Markdown-First, DB-Indexed

Content in git is the source of truth. Neon Postgres is the index. Survives DB loss without losing knowledge.

Built with

Technology stack.

Next.js 16TypeScript (strict)Tailwind 4shadcn/uiDrizzle ORMNeon PostgrespgvectorOpenAI EmbeddingsVercel AI GatewayMCP (stdio + HTTP)Vercel Croncytoscapereact-markdownAuth.js v5pnpm + tsxBiome
Private beta

Want early access?

Roushi is in private beta — currently single-tenant for KumoKodo's own portfolio of 20+ products. Multi-tenant SaaS rollout is on the roadmap once the brain primitives prove their value over a full quarter of dogfooding. Get in touch if you operate a 5+ product portfolio and want to be a design partner.