| name | SaveContext-CLI |
| description | Persistent memory for AI coding agents via CLI. USE WHEN user says "save context", "remember this", "checkpoint", "resume session", "prepare for compaction", "wrap up", OR when starting work on a project that may span sessions. |
| allowed-tools | Bash(sc:*) |
SaveContext (CLI)
Save decisions, track progress, and maintain continuity across coding sessions using the sc command-line tool.
All commands use the sc binary. Add --json for structured JSON output.
Critical Rules
NEVER use sc session start when the user says "resume". The word "resume" (or "continue session", "pick up where I left off") ALWAYS means:
sc session list --search "<topic>" to find the session
sc session resume <session_id> to resume it
sc session start creates NEW sessions. Using it to "resume" almost always creates duplicates.
Quick Actions
| User Says | Do This |
|---|
| "save this decision" | sc save "key" "value" -c decision -p high |
| "remember this" | sc save "key" "value" -c note |
| "checkpoint" | sc checkpoint create "name" |
| "wrap up" | See WrapUp workflow |
| "resume [topic]" | MUST sc session list --search "topic" then sc session resume <id> |
| "start session" | sc session start "name" -d "description" (new sessions only) |
| "what went wrong" | Check the error hint — includes suggestions, similar IDs |
Error Handling
Errors include hints and suggestions. If an ID is not found, check the hint for similar IDs.
When no session is active, the error lists recent resumable sessions.
Structured JSON errors are automatic when piped. See cli/AGENTS.md for error codes.
Command Cheatsheet
Sessions
sc session start "name" -d "description"
sc session list --search "query"
sc session resume <id>
sc session pause
sc session end
sc status
Context Items
sc save "key" "value" -c decision -p high
sc get -s "search query"
sc get -s "auth" --search-all-sessions
sc get -k "exact-key"
sc get -c decision -P high
sc update "key" --value "new value"
sc delete "key"
Search tips: Single keywords work best (sc get -s "auth" > sc get -s "authentication login session token handling"). Smart search auto-decomposes multi-word queries, adapts thresholds, and expands scope when no results found.
Issues
sc issue create "title" -t task -p 2
sc issue create "title" -t epic -p 3
sc issue create "subtask" --parent SC-xxxx
sc issue batch --json-input '{"issues":[...]}'
sc issue list -s open
sc issue list --parent SC-xxxx
sc issue claim <id>
sc issue complete <id>
sc issue complete <id> --reason "Done"
sc issue update <id> -s in_progress
sc issue count
sc issue count --group-by type
sc issue stale
sc issue stale --days 3
sc issue blocked
sc issue dep tree <id>
sc issue dep tree
Checkpoints
sc checkpoint create "name" --include-git
sc checkpoint list -s "query"
sc checkpoint show <id>
sc checkpoint restore <id>
Memory (persistent across sessions)
sc memory save "key" "value" -c command
sc memory get "key"
sc memory list
Plans
sc plan create "title" --content "markdown"
sc plan list
sc plan show <id>
sc plan capture
sc plan capture --agent claude --max-age 60
sc plan capture --file /path/to/plan.md
Prime (full context)
sc prime
sc prime --compact
sc prime --smart --compact
sc prime --smart --compact --query "auth"
sc prime --smart --compact --budget 2000
sc prime --transcript
Workflow Routing
| Workflow | Trigger | File |
|---|
| QuickSave | "save", "remember", "note this" | Workflows/QuickSave.md |
| SessionStart | Starting work, "begin session" | Workflows/SessionStart.md |
| WrapUp | "wrap up", "end of day" | Workflows/WrapUp.md |
| Resume | "resume", "continue" | Workflows/Resume.md |
| Compaction | "prepare for compaction" | Workflows/Compaction.md |
| IssueTracking | "create issue", "track this bug" | Workflows/IssueTracking.md |
| Planning | "plan this feature" | Workflows/Planning.md |
| FeatureLifecycle | "implement", "build this", "plan and execute" | Workflows/FeatureLifecycle.md |
| Prime | "what's the full context", conversation start | Workflows/Prime.md |
| Advanced | Multi-day projects, multi-agent, branch switching, subagents | Workflows/AdvancedWorkflows.md |
Examples
Example 1: Quick save during work
sc save "auth-decision" "Chose JWT over sessions for stateless scaling" -c decision -p high
Example 2: Starting a work session
sc session start "payment-feature" -d "Implementing Stripe integration"
Example 3: Wrapping up
sc save "wrapup-2025-01-30" "Completed login flow. Next: rate limiting" -c progress
sc checkpoint create "wrapup-2025-01-30" --include-git
sc session pause
Do NOT Automatically
- Start sessions for quick saves (just save the item)
- Run multiple commands when one suffices
- Load full reference docs unless user asks how something works
Reference
Full CLI reference: Workflows/Reference.md