resume · diff
git:20260611.1d9847e to git:20260911.15f5b03
37 added, 24 removed. Audit A to A.
---
name: resume
description: Load a previous session from TokenMizer graph memory. Returns a compact context block (100-600 tokens) covering goals, completed work, decisions, open tasks, and files. Inject this as system context to continue exactly where you left off. Use when user says "resume", "continue from last time", "load my project", "what did we do on X", or starts a session on a known project.
---
Load a previous session from TokenMizer graph memory.
- ## What to do
+ ## Session ID
- 1. Get the session ID from $ARGUMENTS (or ask the user if not provided)
- 2. Determine the level from $ARGUMENTS:
- - `critical` = ~100 tokens, only open blockers + key decisions
- - `standard` = ~300 tokens, normal resume (default)
- - `full` = ~600 tokens, everything including env, schemas, endpoints
+ Do not ask for one. The first word of `$ARGUMENTS` is the session ID. If
+ `$ARGUMENTS` is empty, TokenMizer derives the ID from the working directory
+ name, the same way `checkpoint` does, and prints the ID it chose.
- 3. Call the TokenMizer resume API:
+ Ask only if the command exits 2, which means the directory has no usable name
+ to derive from. Then ask exactly: `Which session ID should I resume?`
- ```bash
- SESSION_ID=$(echo "$ARGUMENTS" | awk '{print $1}')
- LEVEL=$(echo "$ARGUMENTS" | awk '{print $2}')
- LEVEL=${LEVEL:-standard}
+ ## Level
- curl -s "http://localhost:8000/api/resume/${SESSION_ID}?level=${LEVEL}"
- ```
+ The second word of `$ARGUMENTS`, if present:
- 4. Inject the returned `resume_context` as a system message at the top of the conversation — NOT as a user message.
+ | Level | Size | Contents |
+ |---|---|---|
+ | `critical` | ~100 tokens | open blockers and key decisions only |
+ | `standard` | ~300 tokens | the default |
+ | `full` | ~600 tokens | adds environment, schemas, endpoints |
- 5. Tell the user: "Loaded [X] tokens of context for '[session-id]'. Continuing from: [next_action]"
+ ## What to do
- ## Format for system injection
+ ```bash
+ tokenmizer resume $ARGUMENTS
+ ```
+ Then inject the returned resume context as a **system** message at the top of
+ the conversation, never as a user message, in this wrapper:
+
```
[TokenMizer — session: {session_id}]
{resume_context}
[End of session context — continue from here]
```
- ## If no checkpoint found
+ ## Output
- Tell the user: "No checkpoint found for '[session-id]'. Either the session hasn't been checkpointed yet, or TokenMizer isn't running."
+ Report in exactly this shape:
- Suggest: `tokenmizer checkpoint {session-id}` to save the current session first.
+ ```
+ Resumed auth-service — 247 tokens, standard
+ Next: implement the token refresh endpoint
+ ```
- ## Examples of $ARGUMENTS
+ Take `Next` from the resume context's continue line. If it has none, omit the
+ line rather than inventing one. Add no commentary, and do not address the
+ operator by name.
- - `auth-service` → load standard resume for auth-service
- - `auth-service full` → load full 600-token resume
- - `auth-service critical` → load critical 100-token resume
- - (empty) → ask user which project to resume
+ ## If no checkpoint is found
+
+ The command exits 1 and prints what happened. Relay that, then:
+
+ ```
+ Nothing saved for auth-service yet. Save the current session first:
+ tokenmizer checkpoint auth-service
+ ```