PROTOCOL skill for checkpoint-based context preservation using Serena MCP. Automatically creates checkpoints at wave boundaries and before PreCompact. Enables zero-context-loss multi-session work with structured metadata collection. Use this skill for ALL Shannon projects - checkpoints are mandatory, not optional.
Creates structured checkpoints at wave boundaries and before context compaction to preserve project state. Automatically triggered at wave transitions, PreCompact events, or session end to enable zero-context-loss multi-session work.
/plugin marketplace add krzemienski/shannon-framework/plugin install shannon@shannon-frameworkThis skill is limited to using the following tools:
RED-PHASE-BASELINE.mdREFACTOR-PHASE-PRESSURE.mdexamples/checkpoint-example.mdreferences/CONTEXT_MANAGEMENT.mdThis skill implements Shannon Framework's zero-context-loss preservation system through systematic checkpoint creation, metadata collection, and Serena MCP storage. It ensures that no project progress is lost due to context compaction, session interruptions, or multi-wave execution.
Core Value: Transforms fragile multi-session work into reliable, resumable workflows with complete state preservation.
Use this skill in these situations:
MANDATORY (Must Use):
/shannon:checkpoint)RECOMMENDED (Should Use):
CONDITIONAL (May Use):
DO NOT rationalize skipping checkpoints because:
Required:
mode (string): Operation mode
"checkpoint": Manual user-requested checkpoint"wave-checkpoint": Automatic wave boundary checkpoint"precompact": Emergency save triggered by PreCompact hook"session-end": Clean session closure checkpointlabel (string): Human-readable checkpoint label (e.g., "wave-2-complete", "mvp-launch")Optional:
wave_number (integer): Current wave number if in wave executioninclude_files (boolean): Include modified file list (default: true)include_tests (boolean): Include test results if available (default: true)compression (boolean): Enable gzip compression for large checkpoints (default: true)Step 1: Identify Active Context
Step 2: Collect Project Metadata
Step 3: Collect Goal State
search_nodes for shannon/goals)Step 4: Collect Wave State
Step 5: Collect Task Progress
Step 6: Collect Test Results
Step 7: Collect Modified Files
git status, git diff --name-only)Step 8: Collect MCP Status
Step 9: Generate Checkpoint ID
SHANNON-W{wave}-{YYYYMMDD}T{HHMMSS}SHANNON-W2-20251103T143000Step 10: Create Conversation Summary
Step 11: Identify Next Actions
Step 12: Assemble Complete Checkpoint
Step 13: Create Checkpoint Entity
create_entitiesStep 14: Create Context Relations
create_relationsStep 15: Store Supplementary Data
add_observationsStep 16: Compute Integrity Hash
Step 17: Generate Restoration Command
/shannon:restore {checkpoint_id}Step 18: Calculate Checkpoint Size
Step 19: Present Checkpoint Summary
Step 20: Return Checkpoint ID
🚨 PROTOCOL ENFORCEMENT 🚨
This section addresses every rationalization pattern from RED phase baseline testing:
Detection: Task complexity < 0.30, single wave, "quick implementation"
Violation: Skip checkpoint creation due to perceived simplicity
Counter-Argument:
Protocol: Create checkpoint at wave boundary regardless of complexity score. Even 0.10 complexity tasks get checkpoints.
Detection: No automated checkpoint trigger, relying on memory/discretion
Violation: Skip systematic checkpointing in favor of ad-hoc manual approach
Counter-Argument:
Protocol: Mandatory checkpoints at wave boundaries. Discretion is not permitted. Follow the workflow.
Detection: User provides spec without mentioning checkpoints explicitly
Violation: Skip checkpoints because user request is missing
Counter-Argument:
Protocol: Checkpoints are framework responsibility, not user's. Create them automatically as part of Shannon workflow.
Detection: Approaching token limits, relying on emergency hook
Violation: Skip proactive checkpointing, rely on emergency fallback
Counter-Argument:
Protocol: PreCompact hook is emergency fallback. Create wave-checkpoints proactively with full metadata.
Detection: Time pressure, fast turnaround requested
Violation: Skip checkpoints to maximize implementation velocity
Counter-Argument:
Protocol: Time pressure increases checkpoint value. Never skip checkpoints to "go faster." 30s investment prevents hours of loss.
This skill is PROTOCOL type:
Violation Detection: If you find yourself thinking any of these:
STOP. You are rationalizing. Return to PROTOCOL workflow. Create the checkpoint.
Structured output object:
{
"success": true,
"checkpoint_id": "SHANNON-W2-20251103T143000",
"label": "wave-2-complete",
"type": "wave-checkpoint",
"size_bytes": 45623,
"size_kb": "44.6 KB",
"compression": "gzip",
"storage_location": "serena://shannon/checkpoints/SHANNON-W2-20251103T143000",
"restore_command": "/shannon:restore SHANNON-W2-20251103T143000",
"retention_days": 30,
"expires_at": "2025-12-03T14:30:00.000Z",
"integrity_hash": "sha256:a7f2b3d4e5f6...",
"summary": {
"wave": 2,
"wave_status": "complete",
"tasks_completed": 35,
"tasks_total": 47,
"tests_passed": 23,
"tests_total": 23,
"files_modified": 12
},
"next_actions": [
"Start Wave 3: Frontend integration with backend APIs",
"Test complete auth flow with Puppeteer"
]
}
This skill succeeds if:
Validation:
def validate_checkpoint(checkpoint_id):
# Check 1: Entity exists in Serena
checkpoint = serena.open_nodes([checkpoint_id])
assert checkpoint is not None
# Check 2: Has required fields
data = json.loads(checkpoint.observations[0])
assert "checkpoint_id" in data
assert "context" in data
assert "metadata" in data
# Check 3: Integrity hash valid
computed_hash = sha256(json.dumps(data, sort_keys=True))
assert computed_hash == data["metadata"]["integrity_hash"]
# Check 4: Can restore
restoration_result = restore_checkpoint(checkpoint_id)
assert restoration_result.success
Wrong:
This is just a quick 2-phase task. No need for checkpoints.
Let me implement directly without the overhead.
Right:
Creating checkpoint before Wave 1, even for simple tasks.
Reason: Interruptions happen regardless of complexity.
Checkpoint cost: 30 seconds. Rework cost: 2 hours.
Why: Checkpoint overhead (30s) is trivial compared to rework cost (hours). Even "simple" tasks get interrupted. Always checkpoint at wave boundaries, regardless of complexity.
Wrong:
There's a PreCompact hook, so checkpoints are automatic.
I don't need to create wave checkpoints manually.
Right:
PreCompact hook is emergency fallback, not primary strategy.
Creating structured wave-checkpoint with rich metadata now.
Emergency saves lack wave deliverables and context.
Why: PreCompact hook saves minimal context in emergency situations. Proactive wave checkpoints include structured metadata that emergency saves lack.
Wrong:
User didn't ask for checkpoint. I'll create one if I remember,
or if I think the work is significant enough.
Right:
Checkpoints are Shannon PROTOCOL, not discretionary.
Wave boundary reached → checkpoint created automatically.
User request is not required for mandatory checkpoints.
Why: Checkpointing cannot be left to discretion. Shannon mandates checkpoints at wave boundaries, period. This is PROTOCOL skill type - follow the structure.
Input:
{
"mode": "checkpoint",
"label": "mvp-feature-complete",
"include_files": true,
"include_tests": true
}
Process:
Output:
{
"success": true,
"checkpoint_id": "SHANNON-W3-20251103T163000",
"label": "mvp-feature-complete",
"type": "checkpoint",
"size_kb": "52.3 KB",
"restore_command": "/shannon:restore SHANNON-W3-20251103T163000",
"summary": {
"wave": 3,
"tasks_completed": 42,
"tests_passed": 31,
"files_modified": 18
}
}
Input:
{
"mode": "wave-checkpoint",
"label": "wave-2-complete",
"wave_number": 2
}
Process:
Output:
{
"success": true,
"checkpoint_id": "SHANNON-W2-20251103T140000",
"label": "wave-2-complete",
"type": "wave-checkpoint",
"summary": {
"wave": 2,
"wave_status": "complete",
"deliverables_count": 8,
"agents_used": ["backend-dev", "test-dev"],
"tests_passed": 23
}
}
Input:
{
"mode": "precompact",
"label": "emergency-20251103T153000",
"compression": true
}
Process:
Output:
{
"success": true,
"checkpoint_id": "SHANNON-EMERGENCY-20251103T153000",
"type": "precompact",
"size_kb": "28.1 KB",
"retention_days": 60,
"note": "Emergency checkpoint - restore ASAP"
}
How to verify this skill worked correctly:
search_nodes to verify checkpoint entity existsopen_nodes to verify metadata presentIn SKILL.md (this file):
In references/ (for deep details):
references/CHECKPOINT_SCHEMA.md: Complete schema specificationreferences/SERENA_OPERATIONS.md: Detailed MCP integrationreferences/PRECOMPACT_INTEGRATION.md: Hook implementationshannon-plugin/core/CONTEXT_MANAGEMENT.md@context-restoration, @goal-management, @wave-orchestration/shannon:check_mcps for Serena MCP configuration.claude-plugin/hooks/pre_compact.pySkill Type: PROTOCOL - Follow structure precisely, no discretionary skipping
This skill should be used when the user asks to "create a slash command", "add a command", "write a custom command", "define command arguments", "use command frontmatter", "organize commands", "create command with file references", "interactive command", "use AskUserQuestion in command", or needs guidance on slash command structure, YAML frontmatter fields, dynamic arguments, bash execution in commands, user interaction patterns, or command development best practices for Claude Code.
This skill should be used when the user asks to "create an agent", "add an agent", "write a subagent", "agent frontmatter", "when to use description", "agent examples", "agent tools", "agent colors", "autonomous agent", or needs guidance on agent structure, system prompts, triggering conditions, or agent development best practices for Claude Code plugins.
This skill should be used when the user asks to "create a hook", "add a PreToolUse/PostToolUse/Stop hook", "validate tool use", "implement prompt-based hooks", "use ${CLAUDE_PLUGIN_ROOT}", "set up event-driven automation", "block dangerous commands", or mentions hook events (PreToolUse, PostToolUse, Stop, SubagentStop, SessionStart, SessionEnd, UserPromptSubmit, PreCompact, Notification). Provides comprehensive guidance for creating and implementing Claude Code plugin hooks with focus on advanced prompt-based hooks API.