# Save Context

> Save session to CONTEXT-llm.md with conversation summary. Use when saving work, checkpointing progress, preserving session state. Triggers include "save context", "save session", "checkpoint", "save my progress".

- **Type:** Skill
- **Install:** `agentstack add skill-digital-stoic-org-agent-skills-save-context`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [digital-stoic-org](https://agentstack.voostack.com/s/digital-stoic-org)
- **Installs:** 0
- **Category:** [AI & ML](https://agentstack.voostack.com/c/ai-and-ml)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [digital-stoic-org](https://github.com/digital-stoic-org)
- **Source:** https://github.com/digital-stoic-org/agent-skills/tree/main/dstoic/skills/save-context

## Install

```sh
agentstack add skill-digital-stoic-org-agent-skills-save-context
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# Save Context

Save current session state to `CONTEXT-{stream}-llm.md` with LLM-optimized format.

**Target**: 1200-1500 tokens MAX | **Speed**: 3-5 seconds

## ⚠️ AskUserQuestion Guard

**CRITICAL**: After EVERY `AskUserQuestion` call, check if answers are empty/blank. Known Claude Code bug: outside Plan Mode, AskUserQuestion silently returns empty answers without showing UI.

**If answers are empty**: DO NOT proceed with assumptions. Instead:
1. Output: "⚠️ Questions didn't display (known Claude Code bug outside Plan Mode)."
2. Present the options as a **numbered text list** and ask user to reply with their choice number.
3. WAIT for user reply before continuing.

## Performance Rules

1. **Use `rtk` for ALL shell commands**
2. **Parallel tool calls** — ALL independent calls in one message
3. **Minimize round-trips** — gather all data phase 1, reason phase 2, write phase 3

## Workflow

### Phase 1: Gather Data (parallel)

```
Bash: rtk ls openspec/changes/ + rtk ls -t CONTEXT-*llm.md
```

**Stream resolution**: First word of `$ARGUMENTS` = stream name (`^[a-zA-Z0-9_-]{1,50}$`), rest = description. Empty → reuse prior `/load-context` stream or AskUserQuestion.

### Phase 1b: Detect Thinking Artifacts (parallel with Phase 1)

If `$PRAXIS_DIR` is set:
```
Bash: ls -t "$PRAXIS_DIR/thinking"/*/{project}/ 2>/dev/null | head -10
```
Where `{project}` = current project folder name. Collect recent artifact paths written during this session (match conversation timestamps/topics).

If `$PRAXIS_DIR` is unset or empty: skip silently — no error, no warning.

### Phase 2: Analyze & Synthesize (single pass)

From conversation (last 15-20 messages):
1. **Next** — infer 3 tasks from OpenSpec/conversation (IMPORTANT: use heading "Next" — Claude Code compaction grep-matches `next`/`todo`/`pending`/`remaining` keywords for survival priority)
2. **Session** — progression, decisions, thinking, unexpected (780 tokens max)
3. **Hot Files** — max 10 discussed/edited
4. **Focus & Goal** — 1-2 sentence focus + goal
5. **Thinking Artifacts** (if Phase 1b found any) — list paths only, no content

### Phase 3: Write & Report

Write CONTEXT file using template.

**Stream naming**: `"default" → CONTEXT-llm.md`, `"{name}" → CONTEXT-{name}-llm.md`

### Phase 3b: Auto-archive to `done/`

If status is `done` or `parked` → move file to `done/` subfolder:
```
Bash: mkdir -p done && mv CONTEXT-{stream}-llm.md done/
```
Report: `"📦 Archived to done/ (status: {status})"`

See `reference.md` for CONTEXT file template, quality self-check, and done/ archival rules.

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [digital-stoic-org](https://github.com/digital-stoic-org)
- **Source:** [digital-stoic-org/agent-skills](https://github.com/digital-stoic-org/agent-skills)
- **License:** MIT

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-digital-stoic-org-agent-skills-save-context
- Seller: https://agentstack.voostack.com/s/digital-stoic-org
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
