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:

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

Built by 2389 Research, Inc. ยท GitHub ยท Email ยท Twitter ยท LinkedIn ยท Bluesky

ยฉ 2026 2389 Research, Inc.