Codebase Ingest
Analyze and onboard any codebase with automated context generation.
Codebase Ingest
The storm ingest command analyzes any codebase and generates the configuration files Brainstorm needs to work effectively. It produces a BRAINSTORM.md context file, agent-specific documentation, and workflow recipes tailored to your project.
Three-Phase Pipeline
Phase 1: Analyze
Scans your codebase to understand its structure:
- Languages: Detects all programming languages and their proportions
- Frameworks: Identifies frameworks (Next.js, FastAPI, Rails, etc.) and their versions
- Dependencies: Maps the dependency graph across package managers
- Complexity: Measures cyclomatic complexity, file counts, and module coupling
- Patterns: Recognizes architectural patterns (monorepo, microservices, MVC, etc.)
``bash
storm ingest --analyze
`
Phase 2: Docgen
Generates documentation artifacts from the analysis:
- BRAINSTORM.md: A comprehensive context file describing your project's architecture, conventions, and key modules
- .agent.md files: Per-directory context files for large codebases, giving agents focused context for specific areas
- API documentation: Extracted endpoint documentation from route handlers
- Component catalog: UI component inventory with props and usage patterns
`bash
storm ingest --docgen
`
Phase 3: Setup-Infra
Configures Brainstorm's infrastructure for the project:
- brainstorm.toml: Project-specific configuration with appropriate routing settings
- Recipes: Workflow recipes in .brainstorm/recipes/
for common tasks in your project - Agent profiles: Custom agent configurations tuned for your tech stack
- Tool permissions: Recommended permission levels based on the project type
`bash
storm ingest --setup-infra
`
Running the Full Pipeline
Run all three phases in sequence:
`bash
storm ingest
`
This takes 30-60 seconds for a typical project. Large monorepos may take longer as more directories are scanned.
Generated BRAINSTORM.md
The generated context file includes:
`markdown
Project Name
Architecture
Turborepo monorepo with 3 apps and 5 shared packages...
Tech Stack
- Frontend: Next.js 16, React 19, Tailwind v4
- Backend: FastAPI 0.115, SQLAlchemy 2.0
- Database: PostgreSQL 16 via Drizzle ORM
- Auth: Supabase Auth with JWT
Conventions
- ESM modules throughout
- Zod for all validation
- Vitest for testing
`
Incremental Re-Ingest
After significant project changes, re-run ingest to update the context:
`bash
storm ingest --refresh # only update changed areas
`
The --refresh flag performs a diff against the previous ingest and only regenerates affected sections, making it much faster than a full re-ingest.
Custom Ingest Rules
Control what gets analyzed in your project config:
`toml
[ingest]
include = ["src/", "lib/", "api/**"]
exclude = ["/*.test.*", "/__mocks__/", "dist/"]
max_file_size = "100KB"
``