↑ subaud · local-first · MIT

Apply

Nothing outward without a plan you approved.

A decision says what should happen; applying it makes it happen. casebook builds a plan with the exact command for every step, runs nothing until you approve it, re-checks the world just before each step, writes a restore record before anything destructive, and calls a step done only when a fresh observation shows it.

plans

From decided items to a plan.

An item whose decision the world does not show yet is to-apply: a branch decided delete that still exists, a repo decided archive that is not archived. In the to apply section, select items or press Plan all.

A plan of seven steps: local and remote branch deletions as exact git commands in casebook's lane, a pull request close and two repo archives as gh commands in the agent's lane, and an approve area asking which session the outward steps go to. A plan of seven steps: local and remote branch deletions as exact git commands in casebook's lane, a pull request close and two repo archives as gh commands in the agent's lane, and an approve area asking which session the outward steps go to.
  • The plan groups steps by lane and action and shows the exact command for each one.
  • A machine applies what is on that machine. Local branch deletions and worktree removals are planned only on the machine that has them. Remote and GitHub steps run once, from whichever machine applies them. A branch still present on another machine stays to-apply there until that machine applies it.
  • casebook refuses to build a plan from an observation older than one sync interval (sync_interval, 30 minutes by default) and offers sync first.
  • An item can be in one open plan at a time; the list shows which plan holds it.
  • If the plan has outward steps, you choose the agent session they go to. Then approve (a), or approve and run when every step is local. discard drops the plan.

lanes

Two lanes.

casebook's lane runs mechanical, local, reversible steps from its own code, and approving the plan is the confirmation. The agent's lane takes outward steps: it reaches the chosen session as a job, the agent runs each step and reports it with casebook_job_step, and approving the plan is followed by a confirmation of the batch, plus your confirmation of any public text.

actionlanedecisioncommandprecondition
branch-delete-localcasebookbranch · deletegit -C <clone> update-ref -d refs/heads/<b> <tip>the tip is unchanged and still landed
branch-delete-remotecasebookbranch · deletegit -C <clone> push --force-with-lease=refs/heads/<b>:<tip> <remote> :refs/heads/<b>the remote tip is unchanged and landed
worktree-removecasebookworktree · deletegit -C <clone> worktree remove <path>the worktree is clean
repo-archiveagentrepo · archivegh repo archive <repo> --yesthe repo has no open pull requests from people
repo-deleteagentrepo · deletegh repo delete <repo> --yesnone
pr-closeagentpr · closegh pr close <n> -R <repo> --comment <text>no new activity since the decision
pr-mergeagentpr · mergegh pr merge <n> -R <repo>no new activity since the decision
issue-closeagentissue · closegh issue close <n> -R <repo> --comment <text>none

The deletes carry the expected tip in the command itself, so git refuses if the branch moved between the check and the delete. A close with no note on its decision posts Closing. as its comment, and you see that text before anything is posted.

preconditions

Checked against the world, not the snapshot.

Every step re-checks its precondition just before it runs, by looking at the repo or GitHub at that moment. When a precondition fails, a casebook-lane step is skipped with the reason and its item returns to Attention. In the agent's lane the agent pauses the step with its reason, and you choose on the card whether to run it anyway or skip it. A step whose target is already in the intended state runs no command and goes straight to verification.

Step states

statemeaning
pendingwaiting its turn
runningrunning now
reportedran, or the agent reported it; waiting for an observation
verifieda fresh observation shows the result
skippedits precondition failed; the item returns to Attention
pausedthe agent stopped it with a reason
failedthe command failed, or the observation contradicts it
needs_youwaiting on a card

confirmations

Needs you.

When a job needs a decision it opens a needs you card, in the job and on its row in the list.

batchThe agent has the outward steps. confirm lets it proceed; skip batch skips them.
textA step that posts, such as a closing comment, shows the exact text the agent drafted with casebook_job_ask: post and close, edit text, close without comment or skip. Nothing is posted until you press one.
pausedThe agent stopped a step and says why: run it anyway, or skip.
failedA step failed. Hand it to the agent's lane, or skip. casebook never retries a failed step blindly.
A running job with a needs-you card holding a closing comment and the buttons post and close, edit text, close without comment and skip, above the step list. A running job with a needs-you card holding a closing comment and the buttons post and close, edit text, close without comment and skip, above the step list.

restore records

Written before the step, not after.

Before each destructive step in casebook's lane, casebook appends a line to restores/<YYYY-MM-DD>.tsv in your casebook repo and commits it. If that commit fails, the step fails and its command never runs. Each line is key, action, before and restore-command, separated by tabs.

actionbeforerestore command
branch-delete-localthe branch tipgit -C <clone> branch <b> <tip>
branch-delete-remotethe remote tipgit -C <clone> push <remote> <tip>:refs/heads/<b>
worktree-removethe worktree headgit -C <clone> worktree add <path> <branch or tip>

verification

Done means observed.

A step that ran, or that the agent reported, is reported. It becomes verified only when a fresh observation shows the result: the branch or worktree or repo is gone, the repo is archived, the pull request or issue is closed, the pull request is merged. If the observation contradicts the step, it fails and the item returns to Attention. An inconclusive look leaves it reported, and the next sync is the backstop.

pause and undo

Pause, resume, undo.

pausePause job in the bar, or p, stops both lanes after their current step. Resume continues where they stopped.
undoA verified step with an automatic restore command shows undo, which runs the command from its restore record. Those are the steps in casebook's lane. A posted comment is never undoable.