@brainst0rm/core
v0.14.3
Published
Agent loop engine, session manager, middleware pipeline, and intelligence
Downloads
441
Maintainers
Readme
@brainst0rm/core
The brain of Brainstorm — agent loop, session management, and intelligence features.
Key Exports
runAgentLoop()— Main loop using AI SDK v6streamTextwith tool callingSessionManager— Conversation history and turn trackingPermissionManager— Permission modes (strict, normal, permissive)compactContext()— Context window management with scratchpad preservationbuildSystemPrompt()— Construct system prompt with project context and tool awareness
Intelligence
BuildStateTracker— Tracks build/test results, injects persistent warningsLoopDetector— Detects repetitive tool call patterns (4+ reads, duplicates)SessionPatternLearner— Cross-session learning from tool usage patternsErrorFixTracker— Records error → fix sequences for future referenceFileWatcher— Detects external file changes viafs.watchReactionTracker— Classifies user satisfaction signalsdetectTone()— Heuristic user sentiment detection
Usage
import { runAgentLoop } from "@brainst0rm/core";
for await (const event of runAgentLoop(options)) {
// Handle: text, tool-call, tool-result, compaction-warning, loop-warning
}