Skip to main content
Glama
README.md
# BranchWire

**MCP Dry-Run & Transactional Staging Gateway (Plan-Verify-Commit with Sagas)**

BranchWire is a Stateless MCP (`2026-07-28`) HTTP gateway that lets AI agents explore, simulate, and compare multi-tool write workflows (_Best-of-N_) with **zero production side effects**, audit a deterministic **Transactional Plan Diff**, and materialize only approved plans via a durable **Saga Executor** with idempotency keys and automatic compensation.

## Architecture

```
packages/
├── manifest/        @branchwire/manifest        x-branchwire tool manifest schema & template contract
├── core/            @branchwire/core            Branches, SnapshotReadCache, ShadowOverlay, $ref, RYOW
├── storage-sqlite/  @branchwire/storage-sqlite  node:sqlite WAL StorageDriver + SQL migrations
├── planner/         @branchwire/planner         DAG compiler, write collapsing, Transactional Plan Diff
├── policy/          @branchwire/policy          Deterministic policy engine + Decision Model gate
├── saga/            @branchwire/saga            Durable Saga executor, idempotency & compensation
├── gateway/         @branchwire/gateway         Stateless MCP Hono HTTP gateway & Branch REST API
├── sdk/             @branchwire/sdk             TypeScript client for agents
└── adapters/        sqlite-branch, neon-branch, stripe, hubspot
apps/
├── inspector/       Branch & Diff Inspector UI
├── agent-harness/   Gemini agent & Best-of-N evaluation harness
└── docs/            Documentation site
```

## Prerequisites

- **Node.js** `>= 24.0.0` (developed and verified on Node `26.13.1` Active LTS; see `.node-version`)
- **pnpm** `12.21.0`

## Quick Commands

```bash
pnpm install
pnpm turbo run lint typecheck test build
pnpm check:deps
pnpm check:secrets
```

## Documentation & ADRs

- [Masterplan](./18NOV-BranchWire-Masterplan.md)
- [Implementation Plan](./18NOV-OPUS-IMPLEMENTATION-PLAN.md)
- [ADR-0001: Technology Stack, Pinned Versions, and Free-Tier Verification](./docs/adr/0001-stack-and-free-tier-verification.md)
- [ADR-0002: Stateless MCP (2026-07-28) Transport & SDK Strategy](./docs/adr/0002-stateless-mcp-transport.md)

## License

Licensed under the [Apache License 2.0](./LICENSE).