Skip to Content
MeowKit

Session State vs Claude Code --resume

What .meowkit/state/ holds, how it differs from the conversation that Claude Code --resume restores, and which of the two to look at for a given question.

Claude Code's --resume restores a conversation. MeowKit's .meowkit/state/ holds what the hooks recorded while the session ran: counters, caches, the detected model and checkpoints. The two answer different questions and neither replaces the other.

Claude Code --resumeMeowKit .meowkit/state/
RestoresThe transcript: messages and tool callsHook-layer records
Knows aboutWhat was saidWhat the process did: edits, builds, spend, model
Cannot restoreHook counters, build caches, git driftThe conversation

What the hooks keep in state

State files are written and read by hook handlers. Each handler is a separate process with no shared memory, so the files are how handlers pass data to each other.

FileWritten byRead byPurpose
detected-model.jsonmodel-detector.cjs (SessionStart)budget-tracker, auto-checkpoint, checkpoint-writerModel tier and density, from the SessionStart model field
budget-state.jsonbudget-tracker.cjs (PostToolUse)The same handler, auto-checkpoint, checkpoint-writer, post-sessionRunning token and cost estimate. Advisory: over the cap it prints a notice and stops nothing
edit-counts.jsonloop-detection.cjs (PostToolUse)The same handlerEdits per file, keyed by session and real path
build-verify-cache.jsonbuild-verify.cjs (PostToolUse)The same handlerFile hash, so an unchanged file skips the compile and lint check
learning-observer.jsonllearning-observer.cjs (PostToolUse)post-session.cjs (Stop)Per-file edit ledger
last-session-idproject-context-loader.cjs (SessionStart)The same hookDetects a new session id
checkpoints/checkpoint-latest.jsoncheckpoint-writer.cjs (Stop), auto-checkpoint.cjs (phase changes)orientation-ritual.cjs (SessionStart), as a fallback when mewkit orient cannot runOne file of resume context: model tier, density, plan path, git state, budget

When project-context-loader.cjs sees a new session id, it resets the edit counts, the build cache and the budget estimate, and clears the TDD sentinel. Inside one session they accumulate. The cost history is kept separately in .meowkit/telemetry/cost-log.json.

What this enables

  • Loop detection. After 4 edits to one file, loop-detection.cjs adds a reminder to re-read the plan and the failing output. At 8 edits it tells the model to stop editing that file and re-plan. It repeats at every further multiple of 4. These are messages to the model, not blocks.
  • Cheap verification. build-verify.cjs hashes the edited file and skips the compile and lint check when the hash is unchanged. A failure is reported to the model.
  • Density and pricing. The detected model drives the autobuild density (see Adaptive density) and the per-tier cost estimate.
  • Resume context. The checkpoint carries the plan path and git state, so a new session can see whether the working tree changed since the last checkpoint.

What survives a resume

Some behavior survives --resume because it lives in project files Claude Code reads again at session start.

SurvivesWhatWhere
YesAlways-on rules.claude/rules/*.md
YesSkills and agents.claude/skills/, .claude/agents/
YesProject contextdocs/project-context.md
YesTeam memory.meowkit/memory/
Yes, read on demandThe durable task recordtasks/active/<id>.json, shown with mewkit task-state show
NoEdit counters, build cache, budget, model tier, checkpoint.meowkit/state/

The task record is a project file, but it is not injected into every session. A fresh session reads it when it asks for the active task, so resume state costs no context until it is needed.

Which layer answers which question

QuestionLook at
What was said in the last conversation?--resume
What was the agent doing when the session ended?.meowkit/state/checkpoints/
Has the agent edited one file too many times?.meowkit/state/edit-counts.json
Did this session go over budget?budget-state.json now, .meowkit/telemetry/cost-log.json for history
Which model tier is this session on?.meowkit/state/detected-model.json
Has the working tree changed since the last checkpoint?checkpoint-latest.json (git hash comparison)
What did the last bug fix teach?.meowkit/memory/gotchas.md, which mk:fix greps on demand
  • Memory system for the durable, reviewed lessons that are separate from state
  • The workflow for where each phase reads and writes state
  • Hooks for the handlers

On this page