update_state
Persist session decisions to project memory to prevent data loss. Merges new insights with existing state, recording next steps, preferences, and prior failures for continuity across sessions.
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. | |
| scope | No | Where to write. 'project' (default) scopes to the current project/branch. 'global' writes to the user-wide memory shared across all projects (~/.egc/global/state.md); use it only for transversal preferences and lessons the user wants everywhere, never for project-specific state. | |
| 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. |