skills/session-state/SKILL.md
Shared session state management for agents — right-panel todos, rate limit handling, and compaction recovery patterns. Triggers on: session state, restore session, rate limit recovery, compaction recovery, todo sync.
npx skillsauth add mdmagnuson-creator/yo-go session-stateInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Shared session management for agents with state persistence.
This skill provides common patterns for right-panel todos, rate limit handling, and compaction recovery that are shared across builder, planner, and toolkit agents.
docs/sessions/{id}/session.json (see session-log skill for full details)docs/planner-state.json~/.config/opencode/.tmp/toolkit-state.jsonEach agent uses its own state file:
| Agent | State File |
|-------|------------|
| builder | <project>/docs/sessions/{id}/session.json (committed to git) + <project>/docs/builder-config.json (gitignored, machine-local) |
| planner | <project>/docs/planner-state.json |
| toolkit | ~/.config/opencode/.tmp/toolkit-state.json |
Builder note: Builder's state has been split into two files.
session.jsonholds the session log (committed to git for cross-machine resume).builder-config.jsonholds machine-specific data (availableCLIs,projectContext,lastSessionPath). See thesession-logskill for full details.
Planner and toolkit share this core structure:
{
"uiTodos": {
"flow": "draft|adhoc|updates|...",
"lastSyncedAt": "2026-02-28T10:00:00Z",
"items": [
{
"content": "Task description",
"status": "pending|in_progress|completed|cancelled",
"priority": "high|medium|low",
"flow": "draft|adhoc|updates|...",
"refId": "US-001|adhoc-001|filename.md|..."
}
]
},
"currentTask": {
"description": "What the agent is doing",
"startedAt": "2026-02-28T10:00:00Z",
"lastAction": "Last completed action",
"contextAnchor": "File or section being worked on",
"rateLimitDetectedAt": null
}
}
Builder uses a different structure. Builder's
session.jsonusescurrentAction(notcurrentTask) and derives todos fromchunks[](no separateuiTodos). See thesession-logskill for Builder's state structure.
Keep OpenCode right-panel todos and state file synchronized for resumability.
Builder exception: Builder derives todos from
session.json→chunks[]instead of a separateuiTodosstore. The contract below applies to planner and toolkit; Builder follows thesession-logskill.
uiTodos.items) via todowritetodowriteuiTodos.items, uiTodos.lastSyncedAt, uiTodos.flow)in_progress at a time| Field | Description |
|-------|-------------|
| content | Task description (shown in panel) |
| status | pending, in_progress, completed, cancelled |
| priority | high, medium, low |
| flow | Workflow context (for resume) |
| refId | Reference ID (story ID, update filename, etc.) |
⚠️ Rate limits are NOT transient tool failures. Do not auto-retry.
Rate limit detected when error contains:
429"rate limit""quota""too many requests"Write state immediately:
currentTask.lastAction and contextAnchorcurrentTask.rateLimitDetectedAt (ISO timestamp)Show clear message and stop:
⚠️ RATE LIMITED
The model provider has temporarily limited requests.
Current task state has been saved.
What to do:
• Wait a few minutes, then respond to resume
• Or close this session and start a new one later — I'll remember where we were
Task in progress: [currentTask.description]
Last action: [currentTask.lastAction]
Rate limit detected at: [currentTask.rateLimitDetectedAt]
Track currentTask so work can resume after context compaction or rate limiting.
Builder uses
currentAction(insession.json) instead ofcurrentTask. Same purpose, different field name. Seesession-logskill.
| Event | Action |
|-------|--------|
| Task start | Set description, startedAt, contextAnchor |
| After every tool call | Update lastAction and contextAnchor |
| Rate limit detected | Set rateLimitDetectedAt |
| Task completion | Clear currentTask (set to null) |
currentTask.lastActioncurrentTask exists, output: Resuming: [currentTask.description]Update lastAction and contextAnchor after:
Each agent integrates this skill at startup:
# Read state (may not exist)
cat <state-file> 2>/dev/null || echo '{}'
If uiTodos.items exists:
todowritein_progress itemIf currentTask exists and has a description:
Resuming: [currentTask.description]contextAnchorIf no currentTask, proceed to normal welcome/menu flow.
Builder todos are derived from
session.json→chunks[]. Each chunk = one todo.
| Flow | Todo Granularity | Completion Condition |
|------|------------------|----------------------|
| prd | One per chunk (story) | Story implemented, checks pass |
| adhoc | One per chunk (task) | Task completed by @developer |
| updates | One per update file | Update applied or skipped |
| e2e | One per E2E file | Test passed or skipped |
| Flow | Todo Granularity | Completion Condition |
|------|------------------|----------------------|
| draft | One per refinement task | Draft updated |
| new | One per creation step | Draft + registry updated |
| ready | One per PRD moved | PRD converted, status ready |
| updates | One per planning update | Update applied or skipped |
| Flow | Todo Granularity | Completion Condition |
|------|------------------|----------------------|
| pending | One per pending update | Update applied + committed |
| adhoc | One per toolkit task | File updates complete |
| workflow | One per post-change step | Manifest/README/website sync done |
data-ai
Generate verification contracts before delegating tasks to sub-agents, defining how success will be measured. Triggers on: verification contract, delegation contract, task verification, contract-first delegation.
testing
Verify that Vercel environment variables point to the correct Supabase project for each environment to prevent staging/production cross-wiring. Triggers on: vercel supabase check, environment alignment, env var check, supabase environment.
development
Manage codebase and database vectorization for semantic search. Use when initializing, refreshing, or querying the vector index. Triggers on: vectorize init, vectorize refresh, vectorize search, semantic search, vector index, enable vectorization.
testing
Patterns for XCUITest UI tests for native Apple apps (macOS/iOS). Use when writing or reviewing XCUITest tests for Swift apps. Triggers on: XCUITest, xcuitest, native app testing, Apple UI tests, SwiftUI tests, AppKit tests, UIKit tests.