How google-developers-group-iit-mandi/brain works
Brain is a local-first codebase intelligence daemon. The main workflow is project initialization or scanning, followed by source parsing and graph updates; change events also feed temporal and memory features. Users inspect results through CLI queries, the dashboard, or local MCP tools, and can optionally use Groq for chat and AI summaries. The graph shows relationships confirmed by the excerpts, SOURCE INDEX references, or README; unsampled subsystem links are omitted rather than inferred.
Main entry points: pipeline.ts Change pipeline · server.ts MCP tools · context-builder.ts Code context · index.ts Brain CLI
Components 23
Entry points
- Brain CLI
src/cli/index.ts - Repository scan
src/cli/scan.ts - Project config
src/config/loader.ts
Indexing and graph
- Change pipeline
src/ingestion/pipeline.ts - Symbol extraction
src/ingestion/tree-sitter.ts - Diff parsing
src/ingestion/diff-parser.ts - Graph updates
src/graph/writer.ts - Local graph store
src/graph/client.ts - Graph insights
src/graph/insights.ts
Memory and temporal analysis
- Memory database
src/memory/db.ts - Event memory
src/memory/tier1.ts - Memory decay
src/memory/decay.ts - Hot zones
src/temporal/hotzone.ts - Change impact
src/query/diff-impact.ts
User access
- Dashboard and API
src/ingestion/routes/dashboard.ts - Prompt ingestion
src/ingestion/routes/ingest.ts - MCP tools
src/mcp/server.ts - Code context
src/query/context-builder.ts
Automation and AI
- AGENTS generator
src/agents/generator.ts - Groq query engine
src/query/engine.ts - AI code review
src/automation/code-reviewer.ts - PR comments
src/automation/pr-commenter.ts
Other components
- Project user
Connections 25
- Project user → Brain CLI: runs commands
- Brain CLI → Repository scan: dispatches scan
src/cli/index.ts - Repository scan → Change pipeline: indexes changes
- Change pipeline → Project config: loads config
src/ingestion/pipeline.ts - Change pipeline → Diff parsing: parses changes
src/ingestion/pipeline.ts - Change pipeline → Symbol extraction: extracts symbols
src/ingestion/pipeline.ts - Change pipeline → Graph updates: applies deltas
src/ingestion/pipeline.ts - Change pipeline → Event memory: writes events
src/ingestion/pipeline.ts - Change pipeline → Hot zones: recomputes zones
src/ingestion/pipeline.ts - Change pipeline → AGENTS generator: generates guidance
src/ingestion/pipeline.ts - Change pipeline → AI code review: requests review
src/ingestion/pipeline.ts - Change pipeline → PR comments: requests comments
src/ingestion/pipeline.ts - AGENTS generator → Local graph store: queries graph
src/agents/generator.ts - Brain CLI → Dashboard and API: starts daemon
- Project user → Prompt ingestion: selects files
src/ingestion/routes/ingest.ts - Project user → MCP tools: uses tools
- MCP tools → Code context: builds context
src/mcp/server.ts - MCP tools → Hot zones: reads zones
src/mcp/server.ts - MCP tools → Change impact: computes ripple
src/mcp/server.ts - Code context → Memory database: reads memory
src/query/context-builder.ts - Code context → Graph insights: loads overview
src/query/context-builder.ts - MCP tools → Groq query engine: streams answers
src/mcp/server.ts - AI code review → Code context: builds review context
src/automation/code-reviewer.ts - AI code review → Groq query engine: requests review
src/automation/code-reviewer.ts - Project user → Groq query engine: asks optional chat