Raw capture โ raw/barnstormer.md
url: https://github.com/2389-research/barnstormer date_fetched: 2026-07-05 backfilled: true
Agentic spec builder โ an event-sourced specification management tool with an AI agent swarm and a real-time web UI.
barnstormer helps you build software specifications collaboratively with AI. You describe what you want to build, and a swarm of specialized agents brainstorm ideas, organize plans, identify risks, and generate architecture diagrams โ all in real time through an interactive web interface.
# From GitHub (requires Rust toolchain)
cargo install --git https://github.com/2389-research/barnstormer
# Or clone and build
git clone https://github.com/2389-research/barnstormer.git
cd barnstormer
cargo build --release
Prebuilt binaries for Linux, macOS (Intel + Apple Silicon), and Windows are available on the Releases page.
A native macOS wrapper now lives in crates/barnstormer-tauri/. It launches Barnstormer's existing Axum UI in an embedded local runtime and stores desktop data under macOS Application Support instead of assuming a terminal-managed .env.
Build the app bundle with:
cargo tauri build --bundles app --config crates/barnstormer-tauri/tauri.conf.jsonThe desktop setup flow opens a native settings window first if no provider key is configured, then launches the main Barnstormer window after saving at least one provider key. More detail is in docs/desktop-app.md. For release-grade macOS signing and the required GitHub secret contract, see docs/release-signing-secrets.md.
# Configure at least one LLM provider
cp .env.example .env
# Edit .env and set ANTHROPIC_API_KEY, OPENAI_API_KEY, or GEMINI_API_KEY
# Start the server (opens browser automatically)
barnstormer start
# Or start without opening a browser
barnstormer start --no-open
# Check if barnstormer is running
barnstormer status
# Import a spec from any file (DOT, YAML, markdown, plain text)
barnstormer import path/to/file.md
barnstormer import design.dot --format dot
barnstormer import --text "Build a CLI task manager"
cat notes.txt | barnstormer import -
The server runs at http://127.0.0.1:7331 by default.
Four crates in a Cargo workspace, plus a binary entrypoint:
| Crate | Path | Purpose |
|---|---|---|
| barnstormer-core | crates/barnstormer-core/ |
Domain types, commands, events, state reducer, actor, exporters (Markdown, YAML, DOT) |
| barnstormer-store | crates/barnstormer-store/ |
Persistence: JSONL event log, snapshots, SQLite index, crash recovery |
| barnstormer-server | crates/barnstormer-server/ |
Axum HTTP API, SSE streaming, Askama+HTMX web UI, auth middleware |
| barnstormer-agent | crates/barnstormer-agent/ |
Agent runtime, LLM provider adapters (Anthropic, OpenAI, Gemini), swarm orchestrator |
Binary entrypoint: src/main.rs
All mutations flow through event sourcing:
Command โ SpecActor โ Event โ SpecState (in-memory)
โ
โโโ JSONL log (durable)
โโโ SQLite index (queryable cache)
โโโ SSE broadcast (real-time UI)
State is materialized by replaying events through a reducer. The JSONL log is the source of truth; SQLite serves as a queryable cache. On startup, barnstormer recovers all specs from persisted events.
The SwarmOrchestrator runs a team of specialized AI agents that collaborate on your spec. Each agent has its own event receiver and a focused role:
| Role | Description |
|---|---|
| Manager | Primary point of contact. Parses your description into structured fields, creates initial cards, asks clarifying questions, and coordinates the other agents. Prioritizes responding to human messages. |
| Brainstormer | Generates creative ideas and explores possibilities. Creates idea cards with breadth-first exploration and narrates its thought process. |
| Planner | Organizes ideas into structured, actionable plans. Moves promising ideas to the Plan lane, creates task cards, and updates constraints and success criteria. |
| DotGenerator | Analyzes spec structure and card relationships. Identifies gaps (ideas without plans, plans without tasks), suggests structural improvements, and summarizes pipeline health. Does not create cards. |
| Critic(available, not in default swarm) | Reviews the spec for gaps, inconsistencies, and risks. Creates risk and constraint cards and asks users about ambiguities. |
The default swarm runs 4 agents (Manager, Brainstormer, Planner, DotGenerator). The Critic role is defined and available but not activated by default.
Agents communicate through 7 tools:
The UI is built with Askama templates, HTMX, and SSE for real-time updates without full page reloads.
Layout:
Diagramโ DOT graph rendered with Viz.js
Chat rail(right) โ Conversation transcript, question cards, and message input
SSE events (card changes, transcript updates, agent status) trigger HTMX partial re-renders to keep the UI in sync.
Copy .env.example to .env and configure:
| Variable | Default | Description |
|---|---|---|
BARNSTORMER_HOME |
~/.barnstormer |
Data directory for event logs, snapshots, and SQLite index |
BARNSTORMER_BIND |
127.0.0.1:7331 |
Listen address |
BARNSTORMER_PUBLIC_BASE_URL |
derived from BARNSTORMER_BIND |
Public base URL |
BARNSTORMER_AUTH_TOKEN |
(none) | Bearer token for API auth (optional, enables auth middleware) |
BARNSTORMER_ALLOW_REMOTE |
false |
Allow non-loopback connections (requires auth token) |
BARNSTORMER_DEFAULT_PROVIDER |
(auto-detect) | LLM provider: anthropic,openai, orgemini |
BARNSTORMER_DEFAULT_MODEL |
(provider default) | Model override (e.g. claude-sonnet-4-5-20250929) |
ANTHROPIC_API_KEY |
โ | Anthropic API key |
ANTHROPIC_BASE_URL |
โ | Anthropic API proxy URL (optional) |
OPENAI_API_KEY |
โ | OpenAI API key |
OPENAI_BASE_URL |
โ | OpenAI API proxy URL (optional) |
GEMINI_API_KEY |
โ | Gemini API key |
GEMINI_BASE_URL |
โ | Gemini API proxy URL (optional) |
Specs can be exported in three formats:
Export via the web UI (/web/specs/{id}/export/markdown|yaml|dot) or the API.
| Method | Path | Description |
|---|---|---|
GET |
/health |
Health check |
GET |
/api/specs |
List all specs |
POST |
/api/specs |
Create a new spec |
GET |
/api/specs/{id}/state |
Get full spec state |
POST |
/api/specs/{id}/commands |
Submit commands |
POST |
/api/specs/{id}/undo |
Undo last command |
GET |
/api/specs/{id}/events/stream |
SSE event stream |
When BARNSTORMER_AUTH_TOKEN is set, API routes require Authorization: Bearer <token>.
Subscribe to /api/specs/{id}/events/stream for real-time updates:
spec_created, spec_core_updated, card_created, card_updated, card_moved, card_deleted, transcript_appended, question_asked, question_answered, agent_step_started, agent_step_finished, undo_applied, snapshot_written
# Run all tests
cargo test --all
# Run with clippy
cargo clippy --all-targets -- -D warnings
Tests cover domain logic, persistence, crash recovery, API routes, auth middleware, SSE streaming, agent tools, swarm orchestration, and an integration smoke test (tests/smoke.rs).
barnstormer/
โโโ src/main.rs # Binary entrypoint (CLI, server startup)
โโโ crates/
โ โโโ barnstormer-core/ # Domain types, events, commands, state, exporters
โ โ โโโ src/
โ โ โโโ actor.rs # SpecActor (command processing, event broadcast)
โ โ โโโ command.rs # Command definitions (tagged enum)
โ โ โโโ event.rs # Event definitions and payload types
โ โ โโโ state.rs # SpecState reducer
โ โ โโโ card.rs # Card model (idea, task, plan, decision, constraint, risk)
โ โ โโโ transcript.rs # Transcript entries
โ โ โโโ export/ # Markdown, YAML, DOT exporters
โ โโโ barnstormer-store/ # Persistence layer
โ โ โโโ src/
โ โ โโโ jsonl.rs # JSONL event log
โ โ โโโ snapshot.rs # State snapshots
โ โ โโโ sqlite.rs # SQLite index
โ โ โโโ recovery.rs # Crash recovery
โ โ โโโ manager.rs # StorageManager orchestration
โ โโโ barnstormer-server/ # HTTP server and web UI
โ โ โโโ src/
โ โ โโโ routes.rs # Route definitions
โ โ โโโ web/ # Web UI handlers
โ โ โโโ api/ # JSON API handlers
โ โ โโโ auth.rs # Bearer token middleware
โ โ โโโ config.rs # Server configuration
โ โโโ barnstormer-agent/ # AI agent system
โ โโโ src/
โ โโโ swarm.rs # SwarmOrchestrator (agent lifecycle, round-robin)
โ โโโ context.rs # AgentRole enum, per-agent context
โ โโโ client.rs # LLM provider adapters
โ โโโ import.rs # LLM-powered spec import (any text โ structured spec)
โ โโโ mux_tools/ # 7 agent tools (read, write, narrate, ask)
โโโ static/ # CSS, JS (board.js, style.css)
โโโ templates/ # Askama HTML templates
โโโ tests/smoke.rs # Integration smoke test
โโโ .env.example # Environment variable template
ABOUTME:comment describing the file's purpose#[serde(tag = "type")]โ agents must produce{"type": "CreateCard", ...}Built by 2389 Research, Inc. ยท GitHub ยท Email ยท Twitter ยท LinkedIn ยท Bluesky
ยฉ 2026 2389 Research, Inc.