Context System Architecture
How Bootspring generates and manages project context.
Overview#
The context system generates CLAUDE.md files that help AI assistants understand your project. It analyzes your codebase and produces structured documentation.
Context Generation Pipeline#
┌─────────────┐ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐
│ Discovery │───▶│ Analysis │───▶│ Aggregation │───▶│ Rendering │
└─────────────┘ └─────────────┘ └─────────────┘ └─────────────┘
│ │ │ │
▼ ▼ ▼ ▼
Find files Run analyzers Combine data Apply template
Discovery Phase#
File Scanner#
Loading code block...
Default Patterns#
Loading code block...
Analysis Phase#
Analyzer Interface#
Loading code block...
Built-in Analyzers#
Package Analyzer#
Loading code block...
Framework Analyzer#
Loading code block...
Structure Analyzer#
Loading code block...
Database Analyzer#
Loading code block...
Aggregation Phase#
Result Aggregator#
Loading code block...
Rendering Phase#
Template System#
Loading code block...
Template Structure#
Loading code block...
{{structure.tree}}
## Key Files
{{#each keyFiles}}
### {{path}}
{{description}}
{{/each}}
## Database Schema
{{#if database.models}}
{{#each database.models}}
### {{name}}
{{#each fields}}
- {{name}}: {{type}}
{{/each}}
{{/each}}
{{/if}}
## API Routes
{{#each api.routes}}
- `{{method}}` {{path}} - {{description}}
{{/each}}
## Development
```bash
{{commands.dev}}
## Incremental Updates
### Change Detection
```typescript
// core/context/incremental.ts
export class IncrementalUpdater {
private hashStore: HashStore;
async shouldRegenerate(project: Project): Promise<boolean> {
const currentHashes = await this.computeHashes(project);
const storedHashes = await this.hashStore.get(project.path);
if (!storedHashes) return true;
// Check for significant changes
const changed = this.findChanges(storedHashes, currentHashes);
return changed.some(c => this.isSignificant(c));
}
private isSignificant(change: FileChange): boolean {
// Config changes are always significant
if (CONFIG_FILES.includes(change.path)) return true;
// Schema changes are significant
if (change.path.includes('schema')) return true;
// Many file changes are significant
return change.type === 'added' || change.type === 'deleted';
}
}
Partial Regeneration#
Loading code block...
Caching#
Analysis Cache#
Loading code block...
Configuration#
Context Config#
Loading code block...
Performance#
Parallel Analysis#
Loading code block...
Large Project Handling#
For large codebases:
Loading code block...