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.
- 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.
| action | lane | decision | command | precondition |
|---|---|---|---|---|
| branch-delete-local | casebook | branch · delete | git -C <clone> update-ref -d refs/heads/<b> <tip> | the tip is unchanged and still landed |
| branch-delete-remote | casebook | branch · delete | git -C <clone> push --force-with-lease=refs/heads/<b>:<tip> <remote> :refs/heads/<b> | the remote tip is unchanged and landed |
| worktree-remove | casebook | worktree · delete | git -C <clone> worktree remove <path> | the worktree is clean |
| repo-archive | agent | repo · archive | gh repo archive <repo> --yes | the repo has no open pull requests from people |
| repo-delete | agent | repo · delete | gh repo delete <repo> --yes | none |
| pr-close | agent | pr · close | gh pr close <n> -R <repo> --comment <text> | no new activity since the decision |
| pr-merge | agent | pr · merge | gh pr merge <n> -R <repo> | no new activity since the decision |
| issue-close | agent | issue · close | gh 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
| state | meaning |
|---|---|
| pending | waiting its turn |
| running | running now |
| reported | ran, or the agent reported it; waiting for an observation |
| verified | a fresh observation shows the result |
| skipped | its precondition failed; the item returns to Attention |
| paused | the agent stopped it with a reason |
| failed | the command failed, or the observation contradicts it |
| needs_you | waiting 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.
casebook_job_ask: post and close, edit text, close without comment or skip. Nothing is posted until you press one.
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.
| action | before | restore command |
|---|---|---|
| branch-delete-local | the branch tip | git -C <clone> branch <b> <tip> |
| branch-delete-remote | the remote tip | git -C <clone> push <remote> <tip>:refs/heads/<b> |
| worktree-remove | the worktree head | git -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