Skip to content
TypeScript

Brainstorm,
as a library

Run agents, classify tasks, analyze codebases, and generate documentation — all from TypeScript. Perfect for CI/CD pipelines, scripts, and custom tooling.

$npm install @brainstorm/sdk
/ Usage(01)
index.ts

import { Brainstorm } from '@brainstorm/sdk';

 

const bs = new Brainstorm({ projectPath: '.' });

 

// Run an agent with intelligent routing

const result = await bs.run('fix the failing test in auth.ts');

console.log(result.text);   // Agent's response

console.log(result.modelUsed); // "claude-sonnet-4.6"

console.log(result.cost);     // $0.0042

 

// Classify without executing

const info = bs.classify('refactor the auth middleware');

console.log(info.type);      // "refactoring"

console.log(info.model);     // "Claude Sonnet 4.6"

 

// Analyze a codebase (no LLM needed)

const analysis = bs.analyze();

console.log(analysis.summary.totalFiles);  // 847

console.log(analysis.summary.moduleCount); // 12

 

// Generate documentation

bs.generateDocs(analysis, './docs/generated');

/ Capabilities(02)
run(prompt)

Execute a prompt through the full agent loop with intelligent routing, tools, and cost tracking.

classify(prompt)

Classify a task and get routing info (type, complexity, model, strategy) without executing.

analyze(path)

Deterministic codebase analysis — languages, frameworks, dependencies, complexity. No LLM.

generateDocs(analysis)

Generate architecture docs, module docs, and API reference from analysis results.