| name | save-session-context |
| description | Save current session state for later resumption. Use after completing workflow phases or before ending a session. |
| trigger | After completing a workflow phase, before session end, or when switching to different task |
Save Session Context
Saves the current workflow state to enable seamless session resumption.
When to Use
- After completing each phase in health orchestrator workflows
- Before ending a long-running session
- When switching context to a different task
- After significant progress that should be preserved
When NOT to Use
- For simple, quick tasks that don't need resumption
- When workflow is fully complete (clean up instead)
Algorithm
Step 1: Gather Current State
Collect the following information:
- Current workflow name and phase
- Priority level and completion counts
- Last completed action
- List of modified files (from git status)
Step 2: Get Git State
Run git status and git log -1 to capture:
- Current branch
- Uncommitted files count
- Last commit hash and message
Step 3: Determine Next Steps
Based on current phase and workflow, identify:
- Immediate next action
- Following 2-3 actions
Step 4: Write Context File
Write to .tmp/current/session/context.md:
# Session Context
> Auto-generated by save-session-context skill. Updated: [ISO timestamp]
## Current State
- **Workflow:** [workflow-name]
- **Phase:** [current]/[total] ([phase-name])
- **Priority:** [priority-level] ([completed] of [total] fixed)
- **Last Action:** [description]
## Active Files
[List from git status]
## Next Steps
1. [Next action]
2. [Following action]
3. [Third action]
## Git State
- **Branch:** [branch-name]
- **Uncommitted:** [count] files
- **Last Commit:** [hash] "[message]"
## Quality Gate Status
- **Type-check:** [status]
- **Build:** [status]
- **Tests:** [status]
## Resume Instructions
To continue this session:
1. Read this file to understand current state
2. Read `session-log.md` for recent decisions
3. Continue from "Next Steps" section
Step 5: Confirm Save
Output confirmation message with file path.
Implementation Notes
git status --porcelain | wc -l
git log -1 --format="%h %s"
git branch --show-current
Output
Confirmation message:
Session context saved to .tmp/current/session/context.md
- Workflow: health-bugs
- Phase: 3/7 (Staged Fixing)
- Uncommitted: 2 files
Token Cost
- Execution: ~50 tokens for git commands
- Output: 0 (write-only operation)
Related Skills
resume-session — Read saved context to continue
run-quality-gate — Update quality gate status in context