Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Ak Save?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/ivan-ii-tech-digital-ak-save)
---
name: ak-save
description: Save where this piece of work stands to .agent-kit/state/<branch>.md, so a fresh session can pick it up with /ak-resume
disable-model-invocation: true
argument-hint: "[<name>]"
# No model: line on purpose: a model switch at a large context re-reads it all without the prompt cache.
---
# ak-save
Writes or updates the state file of one piece of work: what is done with its evidence, what failed and
must not be retried, where it stopped and what comes next. The file lives in the primary checkout's
`.agent-kit/state/` (gitignored), so it survives a restart and the removal of its worktree.
1. Run `ak-state save $ARGUMENTS` from the work's worktree (no argument: the name is the current branch).
It prints `created <file>` or `updated <file>` (header facts refreshed: branch, worktree, commit, PR,
saved time; every section kept), then one `uncommitted: <git status line>` per uncommitted file. On
exit 2, relay its reason; on a detached HEAD ask the user for a name and stop.
2. Read `<file>` and write each section from this session, never invented. Replace each `_..._` hint
line; a section with nothing to say gets `none`.
- **Where it stopped**: the task and the exact point it stopped at.
- **Next step**: the first action on resume, concrete enough to start without asking.
- **Done (with evidence)**: one line per item, with the evidence seen in this session: the command
and its result, the commit, `file:line`. An item without evidence is not done: it goes under
Where it stopped as "unverified".
- **Failed — do not retry**: each approach that failed, and why. Keep the earlier lines; drop one
only when the user says it now works.
- **Open questions**: numbered, each still waiting for the user.
- **Files touched**: the `uncommitted:` lines from step 1, each with why it changed.
- **Last failing gate**: the gate or check, its command and the first error line, or `none`.
3. Write only to `<file>`, the path step 1 printed: never another path, never a copy elsewhere. No
secret values, tokens or personal data. Never commit it (it is gitignored).
4. Run `ak-state check <name>`: it prints `hint: <section>` (a `_..._` line left), `empty: <section>`
or `empty file`. Fix every line it prints and re-run until exit 0. Then, and only then, print
`Saved <file>. Resume in a fresh session with: /ak-resume <name>` (`<name>` = the file name without
`.md`). When the context-limit hand-off led to this save (the hook's message, or the user says so),
print on the next line, verbatim: `Before you close this session, type /reflect for the close-out
(it runs only below context.stopTokens).` Only the user starts /reflect; never run it.
## Called by other commands
- **The context-limit hook** (this plugin, `context.warnTokens`) has the model propose this save to the
user when the context passes the warn mark, do steps 1–4 on their yes (a teammate or subagent saves at
once), then offer `/reflect` before the session closes; past `context.stopTokens` only these steps run
(`ak-state` and Read/Write/Edit of `.agent-kit/state/*.md`), so `/reflect` no longer can.
- **The `spec.*` commands** (ak-spec, which requires this plugin, so `ak-state` is on its PATH) end each
phase with steps 1–4 in the change worktree: Where it stopped = the phase just finished, Next step =
the next spec command, Done = the files written with their validation result, Open questions = the
open `clarifications.md` items. The change folder's `tasks.md` Progress and `.change.yaml` status stay
as they are; the state file adds the session facts they do not hold.