Initial commit

This commit is contained in:
Zhongwei Li
2025-11-30 08:54:24 +08:00
commit cfdfb1c17b
5 changed files with 210 additions and 0 deletions

View File

@@ -0,0 +1,60 @@
You are being asked to restore (load and display) a previously saved context summary.
## Your Task
1. **List available contexts (if needed)**
- Use Glob tool to find files: `.claude/context/*.md`
- Sort by filename (which includes timestamp) to show newest first
- Display list with dates and descriptions extracted from filenames
2. **Load the context file**
- If user specified a filename, load that file
- Otherwise, load the most recent (alphabetically last) file
- Use Read tool to load the content
3. **Display the summary**
- Present the full context summary in a clear, readable format
- Optionally highlight key sections for easier reading
- Explain what the summary contains and when it was created
4. **Offer to continue work**
- Ask if they want to continue where that context left off
- Reference any "Next Steps" from the summary
## Important Notes
- Context files are in `.claude/context/` with format: `yyyyMMDD-HHmm - description.md`
- Filename timestamps are sortable (newest = largest number)
- No external scripts needed - you can directly read the files
## Example Workflow
**Restore most recent:**
```
User: /restore-context
You: [Uses Glob to find .claude/context/*.md files]
You: [Sorts and picks the newest]
You: [Reads with Read tool]
You: "Here's your most recent context from 2025-10-28 11:45 (Plugin development work):"
You: [Displays the summary]
You: "Would you like to continue where we left off?"
```
**List first:**
```
User: /restore-context
You: "I found 3 saved contexts:"
You: "1. 20251028-1145 - Plugin development work.md (Oct 28, 11:45 AM)"
You: "2. 20251027-1630 - Bug fixes and testing.md (Oct 27, 4:30 PM)"
You: "3. 20251026-0920 - Initial setup.md (Oct 26, 9:20 AM)"
You: "Which would you like to restore? (or I can show the most recent)"
User: "Show #1"
You: [Reads and displays that file]
```
**Restore specific:**
```
User: /restore-context 20251028-1145 - Plugin development work.md
You: [Reads that specific file with Read tool]
You: [Displays the summary]
```

87
commands/save-context.md Normal file
View File

@@ -0,0 +1,87 @@
You are being asked to save the current conversation context to a compressed summary file by directly summarizing your own context.
## Your Task
1. **Prompt user for description**
- Ask the user for a brief description of this conversation (e.g., "Feature implementation", "Bug fixes", "Refactoring work")
- This will be used in the filename
2. **Analyze your conversation context**
- Review the full conversation history available in your context
- Identify key topics, decisions, code changes, and outcomes
- Count approximate number of messages/exchanges
3. **Create progressive summary**
- Since you can't process everything at once, work in logical sections:
- Early conversation: Initial requests and setup
- Middle sections: Main work and implementations
- Recent exchanges: Final changes and current state
- For each section, extract:
- Key decisions made
- Code changes and their purposes
- Problems solved
- Important discoveries
- Ongoing work or next steps
4. **Synthesize final summary**
- Combine section summaries into one coherent document
- Use this markdown format:
```markdown
# Context Summary - [Description]
**Date**: YYYY-MM-DD HH:mm
**Messages**: Approximately N exchanges
## Overview
[High-level summary of the conversation]
## Key Topics
- Topic 1
- Topic 2
- ...
## Work Completed
### [Feature/Area 1]
- Changes made
- Files affected
### [Feature/Area 2]
- Changes made
- Files affected
## Decisions Made
1. Decision 1 and rationale
2. Decision 2 and rationale
## Problems Solved
- Problem 1: Solution
- Problem 2: Solution
## Next Steps
- [ ] Task 1
- [ ] Task 2
```
5. **Save the summary**
- Create filename: `yyyyMMDD-HHmm - <description>.md`
- Write to `.claude/context/` using Write tool
- Report success with file path
## Important Notes
- You have direct access to your conversation context - no external API needed
- Focus on technical substance, omit pleasantries
- Be comprehensive but concise
- Preserve critical technical details and decisions
- Group related changes together
## Example
```
User: /save-context
You: "What would you like to call this context summary? (e.g., 'Feature implementation', 'Bug fixes')"
User: "Plugin development work"
You: [Analyzes conversation, creates structured summary, saves to .claude/context/20251028-1145 - Plugin development work.md]
You: "✅ Context saved to .claude/context/20251028-1145 - Plugin development work.md"
```