# grove

> A fast pool of reusable Git worktrees with durable leases, built for agents, CI, and anyone tired of waiting on clones.

If you run a lot of jobs against the same repo, you know the drill. Agents, CI, parallel tasks, whatever. Clone again. Fetch again. Wait. Grove is what I built to get around that.

It's a TypeScript SDK and CLI that keeps a pool of Git worktrees ready to go. You acquire a lease, get an isolated checkout tied to a stable `leaseId`, do your work, and release when you're done. No full re-clone every time. No sitting there watching `git fetch` while three other jobs pile up behind it.

[Check the code on GitHub](https://github.com/ferueda/grove)

## What problem it solves

Most tools treat every job like a fresh start. Grove treats checkouts more like something you borrow and bring back.

You reserve a slot with a lease ID, check out a branch or ref, run your thing (even if the process restarts), and then release, repair, or destroy when you're finished. Your commits and dirty state stick around until you pick a cleanup policy: keep it (`preserve`), reset it (`reset`), or quarantine it if something went sideways.

## What I like about it

A few things I'm especially proud of:

- **Durable leases.** State survives restarts. Re-acquire the same `leaseId` and pick up where you left off.
- **Fast reuse.** Reset uses `git clean -fd`, not `-xfd`, so ignored stuff like `node_modules` stays put between runs.
- **Crash recovery.** Write-ahead state and an explicit `repair()` when something gets stuck mid-operation.

## CLI and SDK

Grove ships two ways to use it.

There's a **CLI** (`@ferueda/grove-cli`) when you want to run commands from a terminal or shell scripts. Every command supports `--json` with stable envelopes, which is great for glue code and quick automation.

I also built a **TypeScript SDK** (`@ferueda/grove`) because my agents and automation needed to spin up worktrees directly in code. No shelling out to a CLI, no parsing stdout. Your orchestrator calls `acquire`, gets a path back, runs its work, and calls `release`. That's the interface I actually wanted for agent workflows.
