---
name: continue
description: Capture a full project status snapshot so the next session can continue seamlessly from where this one left off. Use when the user is ending a session and wants to preserve context for resumption.
license: MIT
compatibility: Requires git. OpenSpec CLI optional (gracefully skipped if unavailable).
metadata:
  author: sentryagent
  version: "1.0"
  generatedBy: "1.2.0"
---

Capture the full current project status and store it in persistent memory so the next session can pick up exactly where this one left off — no context lost, no recap needed.

**Input**: No arguments required. Invoke at any point when ending a session.

**Steps**

1. **Capture git state**

   Run the following in parallel:
   ```bash
   git status
   git branch --show-current
   git log --oneline -10
   git diff --stat HEAD
   git stash list
   ```

   Record:
   - Current branch name
   - Uncommitted files (staged and unstaged), with change type (M/A/D/?)
   - Last 10 commit messages (for continuity context)
   - Summary of diff stats if uncommitted changes exist
   - Any stashed work

2. **Capture OpenSpec change state**

   Run `openspec list --json` to get all active changes.

   For each active (non-archived) change, run:
   ```bash
   openspec status --change "<name>" --json
   ```

   For each active change, also read its `tasks.md` to count:
   - Total tasks
   - Completed tasks (`- [x]`)
   - Pending tasks (`- [ ]`)
   - The text of the next pending task (to know what's up next)

   Record per change:
   - Change name
   - Schema
   - Artifact completion (which are done, which are pending)
   - Task progress (X of Y complete)
   - Next pending task description
   - Any delta specs present (`openspec/changes/<name>/specs/`)

   **If `openspec` CLI is unavailable or fails:** Note it and skip this section gracefully.
   **If no active changes:** Note that there are no active OpenSpec changes.

3. **Capture in-session conversation context**

   Summarize what was worked on in this session based on the conversation:
   - What was the user trying to accomplish?
   - What was completed?
   - What was left in-progress or blocked?
   - Any key decisions made during this session
   - Any open questions or next actions the user mentioned

   Keep this factual and brief — 3–8 bullet points.

4. **Capture memory file state**

   Read `MEMORY.md` from the project memory directory:
   `~/.claude/projects/-home-ubuntu-vj-ai-agents-dev-sentryagent-idp/memory/MEMORY.md`

   Note the existing memory entries to avoid duplication in the next step.

5. **Write session snapshot to memory**

   Write a `session_snapshot.md` file to the project memory directory:
   `~/.claude/projects/-home-ubuntu-vj-ai-agents-dev-sentryagent-idp/memory/session_snapshot.md`

   Use this structure:

   ```markdown
   ---
   name: Session Snapshot
   description: Last session status — git state, OpenSpec progress, and conversation context for seamless resumption
   type: project
   ---

   **Session ended:** YYYY-MM-DD (today's date)

   ## Git State

   **Branch:** <branch-name>
   **Uncommitted changes:** <count> files (<list filenames>)
   **Last commit:** <hash> <message>

   <If uncommitted changes exist, list them with their status>

   <If stashes exist, list them>

   ## OpenSpec Changes

   <For each active change:>
   ### <change-name>
   - **Schema:** <schema-name>
   - **Artifacts:** <done-count>/<total-count> complete (<list incomplete artifact names>)
   - **Tasks:** <done-count>/<total-count> complete
   - **Next task:** <text of next pending task>
   - **Delta specs:** <present / none>

   <If no active changes:> No active OpenSpec changes.

   ## Session Work

   <Bullet list of what was worked on, completed, and left in-progress>

   ## Next Actions

   <Bullet list of concrete next steps to resume — derived from pending tasks, blockers, open questions>
   ```

   **IMPORTANT:** Always overwrite `session_snapshot.md` — this is a rolling snapshot, not a log. Only the most recent session state matters.

6. **Update MEMORY.md index**

   Read the current `MEMORY.md`. If `session_snapshot.md` is not already listed, add it:
   ```
   - [Session Snapshot](session_snapshot.md) — Last session: YYYY-MM-DD | branch: <name> | <N> active changes | <N> uncommitted files
   ```

   If it is already listed, update the line to reflect today's date and current state.

   Write the updated `MEMORY.md`.

7. **Display break summary**

   Show a clean summary so the user knows the snapshot is complete:

   ```
   ## Snapshot Saved — See You Next Session

   **Branch:** <branch-name>
   **Uncommitted files:** <count> (<filenames>)
   **Active changes:** <count>

   <For each active change:>
   - <change-name>: <done>/<total> tasks complete — Next: "<next task text>"

   **Session context saved to memory.**

   To resume: start a new session and run /continue — Claude will load the snapshot and pick up where you left off.
   ```

**Output On Success**

```
## Snapshot Saved — See You Next Session

**Branch:** develop
**Uncommitted files:** 3 (src/auth/token.ts, tests/auth.test.ts, README.md)
**Active changes:** 1

- add-agent-auth: 4/7 tasks complete — Next: "Implement JWT signing with RS256"

**Session context saved to memory.**

To resume: start a new session and run /continue — Claude will load the snapshot and pick up where you left off.
```

**Guardrails**
- Always overwrite `session_snapshot.md` — do NOT append or create versioned copies
- Never include secrets, tokens, or credentials in the snapshot
- If `openspec list` fails (CLI not available), note that and skip OpenSpec capture gracefully
- If git is unavailable, note that and skip git capture gracefully
- Keep the session context summary factual — no speculation beyond what the user explicitly stated
- The MEMORY.md index line for `session_snapshot.md` must stay under 150 characters
- This skill does NOT commit code, push branches, or modify any project files — it only writes to the memory directory
- Session date must use the actual current date (not a placeholder)
