Skip to Content
harness-kit

Sessions and stop checks

How harness-kit remembers what a session changed, and why a stop check never nags a session that touched nothing.

When does a stop check keep the agent working, and when does it let it stop?

A stop check is a Policy on the Stop event that objects at the end of a turn: lint has not passed, the work is not committed, the pull request does not describe it. It judges only what the session changed, objects once per state, and waits for background agents.

What the kit remembers about a session

Each Claude Code session gets its own folder of small records, .git/harness-kit/<session id>/, inside the git directory of the working copy it runs in. So it is never committed, each git worktree has its own, and deleting the clone removes it.

What counts as a change: Touches

A Touch is the kit's record that the session changed a branch in a working copy. The kit records one, without any configuration:

  • after Edit, MultiEdit, NotebookEdit and Write, for the branch of the working copy the edited file lies in;
  • after a Bash call that runs git commit, for the working copy it commits in;
  • after a Bash call that pushes a branch or opens a pull request for it, when a hand-off check is configured.

A file outside any repository, or a detached HEAD, records nothing.

When a stop check blocks and when it lets go

  1. A session with no Touch is never judged. A session that only read, answered a question or ran commands is allowed to stop at once. A check judges only the branches the session touched.
  2. It waits for background agents. While the transcript shows a background agent the session launched and no notice that it finished, the stop is allowed and judged again at the next stop, since the agent's work is not done yet.
  3. It blocks once for each state. When a check objects, it remembers what it objected to. If the agent stops again with nothing changed, the stop goes through, so an agent that cannot fix something (a flaky test, a push it may not make) is never stuck in a loop. Any change to what the check objects to blocks again.

A blocked stop keeps the turn going, and the agent reads each objection with its fix:

What the agent reads
`npx turbo run lint --filter=...[37d0beebec6a60cf0cf78736eae0c50d88b3a2d6]` failed (exit 1). Fix these issues:

src/a.ts(1,1): error TS2322: Type 'string' is not assignable to type 'number'.

The full output is in /work/repository/.git/harness-kit/session-1/stop-output/lint.log.
Fix: Fix these issues, then end the turn again; `npx turbo run lint --filter=...[37d0beebec6a60cf0cf78736eae0c50d88b3a2d6]` in /work/repository checks them.

Which Policies are stop checks

On this page