update_state
Saves decisions and context from the current session to a git branch state file, merging with prior memory to maintain project history across context resets.
Instructions
Updates the project memory with decisions made this session. Writes to the state file of the current git branch when the project is a git repository. Call this at the END of every session. Merges with existing state and does not erase previous memory.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| next | No | What to pick up in the next session. | |
| avoid | No | What failed and should not be repeated. | |
| force | No | Recover from a state file that cannot be decrypted (corrupted or encrypted with an orphaned key). When true and the existing file fails to decrypt, the corrupted file is renamed to a '.corrupted-backup-<timestamp>' sibling instead of being read, and this call's data becomes the fresh state — nothing is merged in from the unreadable file, and nothing is deleted. Only set this after confirming the failure is persistent, not a transient lock from another process writing at the same moment. | |
| context | No | What this project is and its current phase. | |
| decisions | No | Decisions made this session. | |
| preferences | No | Coding style, workflow, or communication preferences discovered. | |
| project_path | No | Absolute path to the project root (or worktree) to scope this state to. Always pass this explicitly when calling from an agent or worktree that is not the caller's own working directory — an omitted value falls back to this process's cwd, which can silently resolve to the wrong project/branch and collide with another process's state file. |