Skip to content
Set it up

The hooks

The hooks are what keeps the repo in step without anyone asking: they run at four moments of a session and say nothing when there is nothing to say. All of them are the plancia command the plugin ships, in plain code: no tokens are spent to decide what they say, only to read it. Without Node, or in a repo without .plancia/schema.yaml, they stay silent.

Hook When it runs
Session start When a session starts, resumes, or its context is cleared or compacted
After every edit After the agent writes a file
Before a push Before a shell command, when it is a git push
End of an answer When the agent is about to stop

Session start

A short brief of what asks for action, so the session starts from the same state as everyone else:

  • commits to pull or to push, and files left uncommitted;
  • a log missing for the last day of work;
  • overdue items, and done items still outside their archive;
  • what others changed since yesterday (a decision taken, a task closed by a teammate);
  • notes left in .plancia/inbox/; a handoff from an earlier session comes first, with what to do with it;
  • items closed in parallel worktrees that wait to be applied on the main checkout, and, inside a worktree, how to close items there.

It also gives the agent the method’s rules in a few lines: where each kind of item lives, that what depends on a change is updated in the same turn, that what a later session must do is left as a note in .plancia/inbox/ (one file per note, its first line saying what to do), and that a push needs plancia check clean.

After every edit

After each file the agent writes:

  1. The archive. For the types whose schema says auto_archive: true, done items move to their archive, under the title of the file they left. For the others it only says how many could move: plancia archive --write, if the person agrees.
  2. The rollups. The rollups of the repo (the rows of an index that say where each phase stands) are rewritten from the items, so nobody writes those rows by hand.
  3. The radius. For the items whose status changed, it lists what cites them elsewhere: the documents and tasks to review.
  4. What others changed. When the edit touches an item that cites something a teammate changed in the last 7 days, pulled or not yet, it says so: “T3 cites D3, changed today by marta (open → taken)”.
  5. The log. The file is counted as the session’s work, for the end of the answer.

An edit by hand to a mirror is pointed out, since the next refresh would undo it. In a parallel worktree nothing is archived or rewritten, and an item marked done by hand is pointed out: there items close with plancia close <ID>.

Before a push

Before a shell command that runs git push, it runs plancia check on the repo, uncommitted files included. A problem (a broken link, an ID cited that matches no item, two items with one ID) stops the push, with the reason and the place. Notes do not stop it.

Only when the person explicitly asks to publish anyway: PLANCIA_PUSH_UNCHECKED=1 git push.

End of an answer

When the schema declares a log and the session closed items, or changed several files, or worked for a while without a log entry, it asks the agent to write one with /log before it stops. It never asks twice in a row, nor within half an hour of the last entry or request. Work pulled from others is not the session’s and asks for nothing.

What they write

The repo is the truth: the hooks read it, and the only files they change on their own are done items going to the archive the schema declares (where auto_archive says so) and the rows between the comments of a rollup. Their memory of the session and the cache of the index live in .git/plancia/, never in the working tree.

The same four hooks run in Codex and Cursor: Codex and Cursor.