the night shift for your backlog

Your backlog,
done by morning.

lazycode is an open-source coding agent that plans with a realtime model and executes on provider batch APIs โ€” half the price, 24-hour SLA. Not a pair programmer: point it at the work that can wait until dawn, close your laptop, review branches over coffee.

realtime โ€” plans now, costs full price batch โ€” executes overnight, costs half
Start tonight โ†’ Read the source pre-alpha ยท M0 ยท Apache-2.0

// architecture

A query engine, not a chat loop.

Chat agents burn tokens round-tripping one message at a time. lazycode treats your goal like a database treats SQL: build a logical plan, run it through an optimizer, compile a physical plan, then execute it in parallel waves on the batch API.

01realtime

Plan

A realtime model reads your repo map and decomposes the goal into a DAG of typed operators โ€” Explore, Generate, Edit, Verify, Judge, Reduce. You approve it before a cent is spent on execution.

02

Optimize

Rule-based rewrites, straight out of a query optimizer: push work to local tools, prune context per node, factor shared prompt prefixes for cache hits, widen independent fan-out.

03batch

Execute in waves

Every node whose dependencies are met ships in one batch submission. One wave can carry fifty file edits. The daemon persists everything, then waits โ€” most batches finish in under an hour.

04

Verify & land

Results are harvested into git worktree sandboxes, diffs applied with three-way merge, your test command run per group. You get branches, a report, and an assumption ledger โ€” not a wall of chat.

physical plan ยท job jb_7f3a ยท goal: "add type hints to services/"

wave 0 ยท realtime wave 1 ยท batch ยท 4 nodes wave 2 ยท batch wave 3 ยท local Decomposerepo map โ†’ DAGamber ยท $$ Generateservices/auth.py Generateservices/billing.py Generateservices/quota.py Generateservices/events.py Verifymypy ยท group A Verifymypy ยท group B Reducebranch + reportโœ“ by 06:12

independent nodes ride the same wave โ€” one batch call, fifty files

// economics

Honest math, measured against the strong baseline.

Batch APIs are 50% off list price. Most tools would stop there. We don't โ€” because realtime agents get prompt-cache discounts on input that batch mostly gives up. Here is where the savings actually come from.

Output tokens: a flat 50% win

Every token the model writes overnight costs half. No caveats. For generation-heavy work โ€” new tests, migrations, mass refactors โ€” this is the bulk of the bill.

Input tokens: won by depth collapse

A chat agent re-reads the conversation every turn; caching makes that cheap (0.1ร— on cache hits). lazycode wins on input differently โ€” it collapses thirty chatty turns into a few wide waves, so the context is simply read far fewer times. Fewer rounds beats cheaper re-reads.

Scheduling: free parallelism

Batch providers don't care if a wave carries one request or a thousand. The optimizer widens fan-out aggressively because breadth is free โ€” only depth costs wall-clock time.

We benchmark against Claude Code with caching on โ€” the real alternative โ€” not an uncached strawman. Typical result: 30โ€“70% cheaper, task-shape dependent. The benchmark harness ships in the repo; run it yourself.

The patience dial

lazycode's ฮป slider โ€” every plan node can run realtime or batch

ฮป=0 ยท all realtimeall batch ยท ฮป=1
RELATIVE COST
44%
DELIVERY
by morning

Illustrative, using list prices and a generation-heavy task shape. Urgent nodes stay realtime; everything that can wait, waits โ€” and gets cheaper.

// durability

Built to survive the night.

An agent that runs while you sleep has one non-negotiable job: never lose work, never pay twice. Every guarantee below is enforced by the test suite, including a kill -9 โ†’ resume end-to-end test.

events.sqlite โ–ธ append-only

Event-sourced core

Every state change is an event in SQLite; job state is a replayable projection. Crash at any instant โ€” plan approved, wave in flight, results half-processed โ€” and lazycode resume reconstructs exactly where it was.

sha256(items) โ–ธ idempotency

Never pay for a batch twice

Submissions carry content-derived idempotency keys, stamped into the provider's batch metadata. If the process dies between paying and recording, reconciliation finds the orphaned batch and adopts it instead of re-submitting.

lease โ–ธ single writer

One writer, ever

A daemon holds a heartbeated per-job lease as the sole database writer; CLI and UI are read-only clients over HTTP. No second process can double-submit your job โ€” not even you, accidentally, from another terminal.

caffeinate -i โ–ธ with consent

Stays awake, applies safely

The daemon keeps your machine from sleeping (it asks first). Results land in git worktree sandboxes, diffs apply with three-way merge and an applied-diff ledger โ€” your working tree is never touched.

// quickstart

Tonight's shift starts here.

Python 3.12+, a git repo with at least one commit, and an Anthropic API key. Or try the built-in mock provider first โ€” zero network, zero spend.

shell
# install
git clone https://github.com/rajagurunath/lazycode && cd lazycode
uv sync

# hand over the backlog
cd /path/to/your-repo
export ANTHROPIC_API_KEY=sk-ant-...
uv run lazycode run "add type hints to services/" --verify "pytest -q"

# approve the plan, close the laptop. in the morning:
uv run lazycode review jb_7f3a
lazycode runPlan with a realtime model, approve, execute in batch waves
lazycode statusPer-node progress: what's queued, in flight, landed, failed
lazycode explainLogical and physical plan trees โ€” Spark-style, for your code
lazycode reviewBranches, verification results, and the assumption ledger
lazycode resumePick an interrupted job back up after a crash or reboot
lazycode daemonSingle-writer orchestrator that owns jobs and stays awake

M0 โ€” shipped

Plan โ†’ waves โ†’ verified branches. Crash-safe resume, idempotent submits, daemon, benchmark harness.

M1 โ€” next

Repair loop: failed verify feeds back into a fix wave instead of stopping. Typed contracts, merge/cancel.

M2

Cost estimates in the plan preview, explain analyze, hedging and deadline-aware realtime fallback.

M3+

Web UI for plan DAGs, rolling wave flush, OpenAI & Gemini batch adapters, webhook-first completion.