AgentSkillsCN

SaveContext-MCP

通过MCP工具为AI编码代理提供持久化记忆。适用于用户提出“保存上下文”、“记住这一点”、“设置检查点”、“恢复会话”、“准备压缩”、“收尾”等需求,或开始一项可能跨多个会话的项目时使用。

SKILL.md
--- frontmatter
name: SaveContext-MCP
description: Persistent memory for AI coding agents via MCP tools. USE WHEN user says "save context", "remember this", "checkpoint", "resume session", "prepare for compaction", "wrap up", OR when starting work on a project that may span sessions.

SaveContext (MCP)

Save decisions, track progress, and maintain continuity across coding sessions.

Critical Rules

NEVER use context_session_start when the user says "resume". The word "resume" (or "continue session", "pick up where I left off") ALWAYS means:

  1. context_list_sessions to find the session
  2. context_session_resume to resume it

context_session_start creates NEW sessions. It has limited auto-resume that only works for active sessions on the exact same project path. Using it to "resume" almost always creates duplicates.

Quick Actions

For most requests, use these patterns directly:

User SaysDo This
"save this decision"context_save key="..." value="..." category="decision"
"remember this"context_save key="..." value="..." category="note"
"checkpoint"context_checkpoint name="..."
"wrap up"See WrapUp workflow
"resume [topic]"MUST search sessions, then context_session_resume
"start session" / "begin work"context_session_start (new sessions only)

Context Injection

Use context_prime to get full project awareness in a single call.

code
context_prime()                                    # Full context dump
context_prime(smart=true)                          # Relevance-ranked within token budget
context_prime(smart=true, budget=2000)             # Custom token budget
context_prime(smart=true, query="authentication")  # Boost auth-related items
context_prime(smart=true, decay_days=7)            # Aggressive recency bias

Smart mode scores items by temporal_decay * priority * category * semantic_boost, applies MMR diversity re-ranking, and packs into the token budget.

Workflow Routing

WorkflowTriggerFile
QuickSave"save", "remember", "note this"Workflows/QuickSave.md
SessionStartStarting work, "begin session"Workflows/SessionStart.md
WrapUp"wrap up", "end of day", "checkpoint everything"Workflows/WrapUp.md
Resume"resume", "continue", "pick up where I left off"Workflows/Resume.md
Compaction"prepare for compaction", context getting longWorkflows/Compaction.md
IssueTracking"create issue", "track this bug"Workflows/IssueTracking.md
Planning"plan this feature"Workflows/Planning.md
FeatureLifecycle"implement", "build this", "plan and execute"Workflows/FeatureLifecycle.md
AdvancedMulti-day projects, multi-agent, branch switching, subagentsWorkflows/AdvancedWorkflows.md

Examples

Example 1: Quick save during work

code
User: "remember that we chose JWT over sessions for auth"
→ context_save key="auth-decision" value="Chose JWT over sessions for stateless scaling" category="decision" priority="high"
→ Saved. No session management needed.

Example 2: Starting a work session

code
User: "let's work on the payment feature"
→ context_session_start name="payment-feature" description="Implementing Stripe integration"
→ Session started (or resumed if exists)

Example 3: Wrapping up

code
User: "wrap up for today"
→ Invokes WrapUp workflow
→ Saves progress, creates checkpoint, pauses session

Do NOT Automatically

  • Start sessions for quick saves (just save the item)
  • Run multiple tools when one suffices
  • Load full reference docs unless user asks how something works

Reference

Full tool documentation: Workflows/Reference.md