AgentSkillsCN

claude-praetorian

自动保留上下文信息——在不同会话间节省 50–60% 的 Token 消耗

SKILL.md
--- frontmatter
name: claude-praetorian
description: Automatic context preservation - saves 50-60% tokens across sessions
triggers: [SessionStart, PreCompact, PostToolUse, Stop]

⚜️ Claude Praetorian Plugin

Set it and forget it context preservation. Automatically saves valuable work and restores it when needed.

Value Proposition

Without PluginWith Plugin
Research lost after compactionResearch persists across sessions
Re-explore codebase every sessionCodebase insights restored instantly
Decisions forgottenDecisions + rationale preserved
~2000 tokens re-learning context~200 tokens loading compacted context

Typical savings: 50-60% fewer tokens for returning to previous work.

Automatic Hooks

All notifications appear as: ⚜️ [claude-praetorian] ...

HookWhenWhat It Does
SessionStartNew sessionShows relevant compactions, offers restore
PreCompactBefore context resetCritical - prompts save before context loss
PostToolUseAfter WebFetch/WebSearch/TaskPrompts to save research & subagent findings
PostToolUseAfter explorationPrompts to save codebase insights
StopSession endPrompts final save of decisions/insights

Commands

CommandDescription
/compactSave current context manually
/restoreLoad previous context
/search <query>Search past compactions

Requirements

Install the MCP server first:

json
// ~/.claude.json
"mcpServers": {
  "praetorian": { "command": "npx", "args": ["claude-praetorian-mcp"] }
}

Then install this plugin for automatic hooks.

Compaction Types

TypeUse ForToken Value
web_researchWebFetch results, API docs~200 tokens saved
task_resultSubagent findings, exploration~300 tokens saved
file_readsCodebase patterns, architecture~400 tokens saved
decisionsTechnical decisions + rationale~150 tokens saved

How It Works

code
Session 1: Research + exploration → hooks prompt compact → saved to ~/.praetorian/
Session 2: Start → hook shows compactions → /restore → instant context (~200 tokens vs ~2000)

The plugin wraps (not duplicates) MCP functionality:

  • Hooks inject prompts that trigger praetorian_compact() / praetorian_restore()
  • Project detection shows relevant compactions first
  • Token estimates help you understand the value