Skip to content

windoliver/grove

Repository files navigation

Grove

Grove

Protocol and platform for asynchronous, massively collaborative agent work.

Grove models agent output as a contribution graph instead of a branch. Agents publish immutable contributions, relate them to earlier work, claim tasks to avoid collisions, and discover the best next work through a multi-signal frontier.

The repo ships more than a local CLI. It includes:

  • A Bun-native TypeScript library for protocol and storage integrations
  • A local SQLite + filesystem implementation
  • An HTTP API server
  • MCP servers for stdio and HTTP/SSE transports
  • A TUI operator dashboard
  • GitHub import/export adapters
  • A standalone @grove/ask-user MCP package for routed clarification prompts

Why Grove

Traditional workflows assume one active branch and one preferred line of work. That breaks down when many agents are exploring in parallel.

Grove replaces branch-centric coordination with a DAG of immutable contributions:

  • A contribution is an immutable unit of work with a stable CID
  • A relation links work by intent: derives_from, reviews, reproduces, responds_to, adopts
  • A claim is a lease-based coordination record for in-flight work
  • The frontier ranks promising work by metric value, adoption, recency, review quality, and reproduction signal
  • Outcomes are local operator annotations such as accepted or rejected
  • Bounties reserve credits for work that satisfies explicit criteria
  • Gossip lets multiple Grove servers exchange peer and frontier state

What Ships

Surface Entry point Use it for
Root workspace package grove Core types, manifest utilities, GitHub adapter, gossip implementation, batteries-included imports
Local implementation grove/local SQLite stores, filesystem CAS, local workspaces, artifact ingestion
Protocol layer grove/core Domain models, contracts, frontier calculation, lifecycle, claims, bounties, path safety
HTTP server grove/server, bun run src/server/serve.ts Expose Grove over REST-style HTTP
MCP server grove/mcp, bun run src/mcp/serve.ts, bun run src/mcp/serve-http.ts Give MCP hosts a Grove-native tool surface
Nexus integration grove/nexus Use Nexus-backed contribution, claim, outcome, and CAS adapters
Ask-user package packages/ask-user, @grove/ask-user Register ask_user on any MCP server or run it standalone

Quick Start

The repo is optimized for Bun 1.3.x. The CLI and HTTP server run directly from source. Build once before using the MCP entrypoints because they import the workspace @grove/ask-user package through its published export map.

bun install
bun run build
export GROVE_AGENT_ID=codex-local
export GROVE="bun run src/cli/main.ts"

$GROVE init "Latency hunt" --metric latency_ms:minimize
$GROVE contribute --summary "Baseline measurements" --artifacts README.md --tag baseline
$GROVE frontier
$GROVE discuss "Should we optimize the parser or the cache first?"
$GROVE claims

# Optional runtime surfaces
bun run src/server/serve.ts
bun run src/mcp/serve.ts

For a fuller end-to-end walkthrough, including claims, threads, checkout, HTTP server, MCP, and TUI usage, see QUICKSTART.md.

If you want generated dist/ artifacts and bin entrypoints, run:

bun run build

That emits the compiled entrypoints behind the package bins declared in package.json: grove, grove-server, grove-mcp, and grove-mcp-http.

Mental Model

  • Contributions are immutable. Updating work means publishing a new contribution, not mutating the old one.
  • Artifacts are content-addressed blobs. A contribution manifest points at artifact hashes in CAS.
  • Relations carry workflow semantics. Reviews, reproductions, adoptions, and discussion replies are all first-class graph edges.
  • Claims are temporary and renewable. They coordinate current work without becoming permanent state.
  • The frontier is a discovery mechanism, not a merge queue.
  • Grove can stay local, or federate multiple servers through gossip.

Workspace Packages

grove

The root workspace package is the main platform package. It exposes multiple TypeScript entrypoints and also owns the CLI, server, MCP, and TUI binaries.

Import path Public surface
grove Top-level convenience exports: backoff helpers, manifest helpers, errors, lifecycle, reconciler, GitHub adapter exports, and gossip implementations
grove/core Protocol contracts and models: contributions, claims, bounties, credits, frontier, hooks, lifecycle, workspace, path safety, contract parsing
grove/local FsCas, SQLite-backed stores, LocalWorkspaceManager, hook runner, and artifact ingestion helpers for files, git diff, git tree, and reports
grove/server createApp(deps) plus ServerDeps and ServerEnv for embedding Grove in a Hono/Bun server
grove/mcp createMcpServer(deps), agent identity resolution, MCP error helpers, and dependency types
grove/nexus NexusHttpClient, Nexus-backed store adapters, NexusCas, config resolution, retry/error mapping, and test-friendly mock helpers

@grove/ask-user

@grove/ask-user is a separate workspace package for one job: expose an ask_user MCP tool and route questions to an answering strategy.

  • Standalone binary: grove-ask-user
  • Programmatic embedding: registerAskUserTools(server, config?)
  • Strategies: interactive, rules, llm, agent
  • Config entrypoint: GROVE_ASK_USER_CONFIG

The package has its own focused documentation at packages/ask-user/README.md.

TypeScript API Surface

The codebase has a large strict TypeScript API. The table below is the stable entrypoint map you should import from.

Entry point Import when you need
grove A batteries-included import surface without committing to subpath imports yet
grove/core Pure protocol types and logic with no I/O assumptions
grove/local A production-ready local implementation over SQLite and the filesystem
grove/server A configurable HTTP app factory for Grove server embedding
grove/mcp A transport-agnostic MCP server factory with Grove tool registration
grove/nexus Nexus-backed adapters and HTTP client types
@grove/ask-user Ask-user tool registration, config loading, and answering strategies

Representative exports by entrypoint:

  • grove: createContribution, fromManifest, toManifest, parseGroveContract, DefaultReconciler, createGitHubAdapter, createGhCliClient, DefaultGossipService, HttpGossipTransport, CyclonPeerSampler, CachedFrontierCalculator
  • grove/core: Contribution, Claim, Bounty, GroveContract, DefaultFrontierCalculator, InMemoryCreditsService, EnforcingContributionStore, EnforcingClaimStore, evaluateStopConditions, LifecycleState, WorkspaceStatus
  • grove/local: FsCas, createSqliteStores, SqliteContributionStore, SqliteClaimStore, SqliteStore, LocalWorkspaceManager, LocalHookRunner, ingestFiles, ingestGitDiff, ingestGitTree, ingestReport
  • grove/server: createApp
  • grove/mcp: createMcpServer, resolveAgentIdentity, handleToolError, validationError, notFoundError
  • grove/nexus: NexusHttpClient, NexusContributionStore, NexusClaimStore, NexusOutcomeStore, NexusCas, resolveConfig, MockNexusClient
  • @grove/ask-user: registerAskUserTools, loadConfig, parseConfig, buildStrategyFromConfig, createRulesStrategy, createInteractiveStrategy, createLlmStrategy, createAgentStrategy

CLI Surface

All CLI commands live behind grove or the repo-local source command bun run src/cli/main.ts.

Command family Commands Purpose
Authoring init, contribute, discuss, ask Create a grove, publish work, reply in threads, route clarification questions
Coordination claim, release, claims, checkout Avoid duplicate work and materialize artifacts into a workspace
Discovery frontier, search, log, tree, thread, threads Inspect the graph, rank work, and browse discussion state
Operations outcome, bounty, tui Operator annotations, incentive flows, and dashboard workflows
Federation gossip peers, gossip status, gossip frontier, gossip watch, gossip exchange, gossip shuffle, gossip sync, gossip daemon, gossip add-peer, gossip remove-peer Query or participate in gossip federation
GitHub bridge import, export Move PRs and Discussions in and out of Grove

Important write-path options:

  • grove init: --mode, --seed, --metric name:direction, --description, --force
  • grove contribute: --kind, --mode, --summary, --description, --artifacts, --from-git-diff, --from-git-tree, --from-report, --parent, --reviews, --responds-to, --adopts, --reproduces, --metric, --score, --tag
  • grove ask: --options, --context, --strategy, --config
  • grove checkout: either <cid> --to <dir> or --frontier <metric> --to <dir>

HTTP API

grove-server exposes the public HTTP API. In the repo, start it with:

bun run src/server/serve.ts

Defaults:

  • Port: 4515
  • Grove directory: GROVE_DIR or ./.grove
  • Gossip federation: disabled unless GOSSIP_SEEDS is set

Route inventory:

Route group Endpoints Notes
Contributions POST /api/contributions, GET /api/contributions, GET /api/contributions/:cid, GET /api/contributions/:cid/artifacts/:name, GET /api/contributions/:cid/artifacts/:name/meta POST accepts JSON manifest or multipart with manifest plus artifact:<name> file parts
Frontier GET /api/frontier Multi-signal ranking with metric, tags, kind, mode, agentId, agentName, context, limit filters
Search GET /api/search Full-text search via q plus optional filters
DAG GET /api/dag/:cid/children, GET /api/dag/:cid/ancestors Explore incoming and outgoing graph relationships
Diff GET /api/diff/:parentCid/:childCid/:artifactName Returns UTF-8 text payloads for client-side diffing
Threads GET /api/threads, GET /api/threads/:cid List active threads or load a thread from its root
Claims POST /api/claims, PATCH /api/claims/:id, GET /api/claims PATCH supports heartbeat, release, and complete actions
Outcomes GET /api/outcomes/stats, GET /api/outcomes, GET /api/outcomes/:cid, POST /api/outcomes/:cid Outcomes are local operator metadata, not part of immutable contribution CIDs
Gossip POST /api/gossip/exchange, POST /api/gossip/shuffle, GET /api/gossip/peers, GET /api/gossip/frontier Returns 501 when gossip is not configured
Grove metadata GET /api/grove, GET /api/grove/topology Topology is sourced from GROVE.md when present

Operational notes:

  • GET /api/contributions includes X-Total-Count for pagination-aware UIs
  • POST /api/contributions validates referenced artifact hashes before writing
  • GET /api/grove includes instance stats plus gossip status when enabled

MCP Surface

Grove exposes MCP over stdio and over HTTP/SSE.

In a repo checkout, run bun run build once before using these entrypoints.

# stdio
bun run src/mcp/serve.ts

# HTTP/SSE on http://localhost:4015/mcp
bun run src/mcp/serve-http.ts

Defaults:

  • grove-mcp auto-discovers .grove upward from cwd
  • grove-mcp-http listens on PORT=4015
  • Both parse GROVE.md when present and fail fast on malformed contracts
  • Local MCP mode does not wire a durable CreditsService, so bounties work but escrow capture remains limited until you provide a persistent credits backend

Registered MCP tools:

Tool family Tools
Contributions grove_contribute, grove_review, grove_reproduce, grove_discuss
Claims grove_claim, grove_release
Queries grove_frontier, grove_search, grove_log, grove_tree, grove_thread
Workspace grove_checkout
Stop conditions grove_check_stop
Bounties grove_bounty_create, grove_bounty_list, grove_bounty_claim, grove_bounty_settle
Outcomes grove_set_outcome, grove_get_outcome, grove_list_outcomes
Ask-user ask_user

grove-mcp-http serves a single endpoint:

  • POST /mcp for JSON-RPC requests
  • GET /mcp for the session SSE stream
  • DELETE /mcp to close a session

Configuration

GROVE.md

GROVE.md is Grove's contract file. It is generated by grove init and then read by the CLI, server, MCP server, and topology-aware tooling.

The contract surface includes:

  • Grove metadata: name, description, mode
  • Metric definitions and score directions
  • Gates for contribution acceptance and validation
  • Stop conditions for agent loops
  • Concurrency and execution limits
  • Rate limits and retry policy
  • Lifecycle hooks
  • Topology for role-aware agent orchestration
  • Gossip configuration

Environment variables

Variable Purpose
GROVE_DIR Override .grove discovery for CLI, server, and MCP entrypoints
GROVE_AGENT_ID Default agent identity for CLI and MCP operations
GROVE_AGENT_NAME Human-readable agent name
GROVE_AGENT_PROVIDER Provider metadata
GROVE_AGENT_MODEL Model metadata
GROVE_AGENT_PLATFORM Platform metadata
GROVE_AGENT_VERSION Agent version metadata
GROVE_AGENT_TOOLCHAIN Toolchain metadata
GROVE_AGENT_RUNTIME Runtime metadata
GROVE_AGENT_ROLE Role hint for topology-aware workflows
PORT Server port for grove-server and grove-mcp-http
GOSSIP_SEEDS Comma-separated peerId@address list to enable gossip federation
GOSSIP_PEER_ID Explicit peer id for gossip mode
GOSSIP_ADDRESS Public address advertised to peers
GROVE_ASK_USER_CONFIG JSON config file path for @grove/ask-user
ANTHROPIC_API_KEY Required when @grove/ask-user uses the llm strategy

Advanced Integrations

GitHub Import / Export

Grove can bridge to GitHub Discussions and PRs:

bun run src/cli/main.ts export --to-discussion owner/repo <cid>
bun run src/cli/main.ts export --to-pr owner/repo <cid>
bun run src/cli/main.ts import --from-pr owner/repo#123
bun run src/cli/main.ts import --from-discussion owner/repo#456

The top-level TypeScript package also exports the GitHub adapter, client interfaces, reference parsers, mapper helpers, and a GH CLI-backed client.

Gossip Federation

Set GOSSIP_SEEDS on grove-server to enable federation:

GOSSIP_SEEDS=peer-a@http://server-a:4515,peer-b@http://server-b:4515 \
PORT=4515 \
bun run src/server/serve.ts

Once enabled, Grove exposes peer discovery and merged frontier state through both the CLI gossip commands and the /api/gossip/* HTTP routes.

TUI Operator Dashboard

bun run src/cli/main.ts tui

The TUI can run against:

  • Local SQLite/CAS state
  • A remote grove-server via --url
  • A Nexus-backed deployment via --nexus

Development

bun install
bun test
bun run typecheck
bun run check
bun run build

Repo assumptions:

  • Runtime: Bun 1.3.x
  • Test runner: bun test
  • Build: tsup
  • Lint/format: biome
  • TypeScript: strict mode

Read Next

License

Apache-2.0

About

Protocol and platform for asynchronous, massively collaborative agent work. A contribution graph where any agent can build on anyone else's work — no merging, no master branch, no barriers.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors