From cfdfb1c17b99a9500998e54d139f5c9699d5b336 Mon Sep 17 00:00:00 2001 From: Zhongwei Li Date: Sun, 30 Nov 2025 08:54:24 +0800 Subject: [PATCH] Initial commit --- .claude-plugin/plugin.json | 11 +++++ README.md | 3 ++ commands/restore-context.md | 60 +++++++++++++++++++++++++ commands/save-context.md | 87 +++++++++++++++++++++++++++++++++++++ plugin.lock.json | 49 +++++++++++++++++++++ 5 files changed, 210 insertions(+) create mode 100644 .claude-plugin/plugin.json create mode 100644 README.md create mode 100644 commands/restore-context.md create mode 100644 commands/save-context.md create mode 100644 plugin.lock.json diff --git a/.claude-plugin/plugin.json b/.claude-plugin/plugin.json new file mode 100644 index 0000000..4f587e9 --- /dev/null +++ b/.claude-plugin/plugin.json @@ -0,0 +1,11 @@ +{ + "name": "context-manager", + "description": "Efficient context management with chunked conversation summarization", + "version": "1.0.0", + "author": { + "name": "Sceleratis" + }, + "commands": [ + "./commands" + ] +} \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..49c7172 --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# context-manager + +Efficient context management with chunked conversation summarization diff --git a/commands/restore-context.md b/commands/restore-context.md new file mode 100644 index 0000000..1937dea --- /dev/null +++ b/commands/restore-context.md @@ -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] +``` diff --git a/commands/save-context.md b/commands/save-context.md new file mode 100644 index 0000000..a7de1d6 --- /dev/null +++ b/commands/save-context.md @@ -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 - .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" +``` diff --git a/plugin.lock.json b/plugin.lock.json new file mode 100644 index 0000000..a771b4a --- /dev/null +++ b/plugin.lock.json @@ -0,0 +1,49 @@ +{ + "$schema": "internal://schemas/plugin.lock.v1.json", + "pluginId": "gh:Sceleratis/claude-code-stuff:plugins/context-manager/plugin", + "normalized": { + "repo": null, + "ref": "refs/tags/v20251128.0", + "commit": "57aec7bf44e10c74b7a7c41fb352d1de68d524a9", + "treeHash": "7a075d997d4148ad72919d0e73f4ac4c4344aeda2e00e3b4ba5fcbe22864cc33", + "generatedAt": "2025-11-28T10:12:45.198679Z", + "toolVersion": "publish_plugins.py@0.2.0" + }, + "origin": { + "remote": "git@github.com:zhongweili/42plugin-data.git", + "branch": "master", + "commit": "aa1497ed0949fd50e99e70d6324a29c5b34f9390", + "repoRoot": "/Users/zhongweili/projects/openmind/42plugin-data" + }, + "manifest": { + "name": "context-manager", + "description": "Efficient context management with chunked conversation summarization", + "version": "1.0.0" + }, + "content": { + "files": [ + { + "path": "README.md", + "sha256": "f1021a665f254d67be4c1db2ada5c3c27a982789d9a6d2498e99952b3ed467dc" + }, + { + "path": ".claude-plugin/plugin.json", + "sha256": "f6b9a44f8245e7711245d859775cb9fbe0acac0e2b0bdebd1efcb604c2870503" + }, + { + "path": "commands/save-context.md", + "sha256": "85195008934946d3aa27cf9fbcc01921e53a298194278bf10b48b974bf9dcb0f" + }, + { + "path": "commands/restore-context.md", + "sha256": "82d6811f07677ac7c1a79d67228c51b09c943a74a9cc8b92494d435eb1583ddf" + } + ], + "dirSha256": "7a075d997d4148ad72919d0e73f4ac4c4344aeda2e00e3b4ba5fcbe22864cc33" + }, + "security": { + "scannedAt": null, + "scannerVersion": null, + "flags": [] + } +} \ No newline at end of file