From 2bbfb3f5bc2b96b5e4bef1a39089094b8ad7f213 Mon Sep 17 00:00:00 2001 From: Zhongwei Li Date: Sun, 30 Nov 2025 09:03:26 +0800 Subject: [PATCH] Initial commit --- .claude-plugin/plugin.json | 15 ++++ README.md | 3 + commands/install.md | 18 +++++ commands/remember.md | 31 ++++++++ commands/save-session.md | 146 +++++++++++++++++++++++++++++++++++++ commands/session-start.md | 44 +++++++++++ commands/working-plan.md | 46 ++++++++++++ hooks/hooks.json | 3 + plugin.lock.json | 65 +++++++++++++++++ 9 files changed, 371 insertions(+) create mode 100644 .claude-plugin/plugin.json create mode 100644 README.md create mode 100644 commands/install.md create mode 100644 commands/remember.md create mode 100644 commands/save-session.md create mode 100644 commands/session-start.md create mode 100644 commands/working-plan.md create mode 100644 hooks/hooks.json create mode 100644 plugin.lock.json diff --git a/.claude-plugin/plugin.json b/.claude-plugin/plugin.json new file mode 100644 index 0000000..0b3f623 --- /dev/null +++ b/.claude-plugin/plugin.json @@ -0,0 +1,15 @@ +{ + "name": "fb", + "description": "Session management and continuity for Claude Code with automatic memory and working plan tracking", + "version": "1.0.0", + "author": { + "name": "udecode", + "email": "zbeyens@udecode.dev" + }, + "commands": [ + "./commands" + ], + "hooks": [ + "./hooks" + ] +} \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..2c5dcc5 --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# fb + +Session management and continuity for Claude Code with automatic memory and working plan tracking diff --git a/commands/install.md b/commands/install.md new file mode 100644 index 0000000..7aa7430 --- /dev/null +++ b/commands/install.md @@ -0,0 +1,18 @@ +--- +description: Install Flashback session management system +allowed-tools: Bash +--- + +# Install Flashback + +Install `flashback` CLI: + +```bash +curl -fsSL https://raw.githubusercontent.com/zbeyens/flashbacker/main/scripts/install.sh | bash +``` + +Then install the flashback files with shadcn CLI: + +```bash +npx shadcn@latest add https://raw.githubusercontent.com/udecode/dotai/main/registry/flashback.json +``` diff --git a/commands/remember.md b/commands/remember.md new file mode 100644 index 0000000..0e392a4 --- /dev/null +++ b/commands/remember.md @@ -0,0 +1,31 @@ +You are helping add important information to the project's long-term memory system. + +## Context +The user wants to add this information to `.claude/flashback/memory/REMEMBER.md`: "$ARGUMENTS" + +## Current REMEMBER.md Content +``` +{{CURRENT_MEMORY}} +``` + +## Task +Analyze the user's input and add it to the appropriate section in `.claude/flashback/memory/REMEMBER.md`. The information should be: + +1. **Categorized correctly** - Place it in the most relevant section: + - 📋 Project Overview - For high-level project description + - 🏗️ Architecture & Patterns - For design decisions and architectural info + - 🔧 Development Setup - For setup, dependencies, configuration + - 📝 Conventions & Standards - For code style and project standards + - 🚨 Important Constraints - For limitations, requirements, things to avoid + - 🔗 Key Dependencies - For important libraries, frameworks, services + - 📁 Directory Structure - For file locations and organizational patterns + - 🧠 Lessons Learned - For insights, gotchas, knowledge gained + - 🎯 Current Goals - For high-level objectives and current work + +2. **Well-formatted** - Use consistent formatting with existing content +3. **Concise but complete** - Capture the essential information clearly +4. **Actionable** - Make it useful for future sessions + +If the input doesn't clearly fit existing sections, add it to "🧠 Lessons Learned" as the default. + +Please output the complete updated `.claude/flashback/memory/REMEMBER.md` file with the new information properly integrated. \ No newline at end of file diff --git a/commands/save-session.md b/commands/save-session.md new file mode 100644 index 0000000..6c9879c --- /dev/null +++ b/commands/save-session.md @@ -0,0 +1,146 @@ +# Save Session + +**Create a beautifully formatted session summary document** in this conversation capturing meaningful insights. + +## Task Workflow + +1. **Check for Existing Session**: First check if there's an existing session file to archive +2. **Archive Previous Session**: If found, save it to archive before creating new summary +3. **Gather Context**: Run `flashback save-session --context` to get comprehensive session data +4. **Analyze Session**: Extract real accomplishments, file changes, and decisions made +5. **Update Working Plan**: Follow the working plan update process from @.claude/commands/fb/working-plan.md +6. **Create New Summary**: Output polished session documentation **directly in this conversation** +7. **Save Session Record**: Write the formatted summary to `.claude/flashback/memory/CURRENT_SESSION.md` + +## Session File Management + +**Before creating the new session summary:** + +1. **Check for existing session**: Use Read tool to check if `.claude/flashback/memory/CURRENT_SESSION.md` exists +2. **Archive if found**: If file exists, copy it to `.claude/flashback/memory/ARCHIVE/sessions/session-[timestamp].md` +3. **Clean old archives**: Keep only the 10 most recent archived sessions (delete older ones) + +**After creating the session summary:** + +- Save the formatted document to `.claude/flashback/memory/CURRENT_SESSION.md` for future archiving + +## Working Plan Update Process + +**During session analysis, also update the working plan:** + +1. **Read Current Plan**: Load @.claude/flashback/memory/WORKING_PLAN.md to understand current state +2. **Analyze Accomplishments**: Extract what was actually completed, decisions made, next steps identified +3. **Update Plan**: Apply changes to reflect real session progress: + - Move completed tasks from "Next Priorities" to "Completed Recently" + - Update "Current Phase" if phase changed + - Refresh "Immediate Tasks" based on conversation + - Add new tasks discovered during session + - Update session reference and timestamp +4. **Write Updated Plan**: Output the complete updated WORKING_PLAN.md file content + +**CRITICAL**: Always output the complete, updated WORKING_PLAN.md file content. Use concrete, specific language based on actual conversation content, not generalizations. + +## Manual Commands (Alternative) + +If the built-in archiving above fails, you can use: + +- `flashback save-session --archive` - Manually archive session files +- `flashback save-session --prune 5` - Manually prune old archived sessions + +**Note**: The primary workflow handles archiving automatically in the prompt above. + +## Context Gathering + +```bash +flashback save-session --context +``` + +Provides comprehensive session data: + +- **Enhanced Analysis Prompt**: Detailed instructions for creating beautiful documentation +- **Project Context**: Memory and working plan for background +- **Conversation Logs**: Complete session transcript with tool calls +- **Git Analysis**: Actual file changes and repository state +- **Tool Usage Tracking**: All Edit, Write, Bash, and other tool calls made + +## Required Output Structure + +**You MUST create a complete session document** using this exact format: + +```markdown +# 📋 Session Summary - [Month Day, Year] + +## 🎯 Session Overview + +[2-3 sentences describing main focus and outcomes] + +## 📁 Files Modified + +### Code Changes + +- **`src/file.ts`** - [Detailed description with technical context] + +### Documentation Updates + +- **`README.md`** - [Specific documentation changes] + +## ⚒️ Tool Calls & Operations + +### File Operations + +- **Edit**: `file.ts:45-67` - [What was edited and why] +- **Write**: `newfile.md` - [What was created] + +### System Commands + +- **Bash**: `npm run build` - [Command purpose and result] + +## ✅ Key Accomplishments + +- **[Specific Feature]**: [Implementation details and impact] + +## 🔧 Problems Solved + +- **Issue**: [Problem description] + - **Solution**: [Technical solution with details] + - **Verification**: [How solution was validated] + +## 💡 Technical Decisions + +- **Decision**: [What was decided with rationale] + +## 🔄 Next Steps + +- **Immediate**: [Next session priorities] + +## 🧠 Learning & Insights + +- **Technical Patterns**: [Architectural insights discovered] + +## 📊 Session Metrics + +- **Tool Calls**: [Number of tool calls made] +- **Files Changed**: [Number of files modified] + +## 🌳 Git Repository State + +- **Status**: [Current repository state] +``` + +## Quality Standards + +- **Professional Formatting**: Use emojis, proper structure, and clean markdown +- **Specific Details**: Include exact file paths, line numbers, technical specifics +- **Complete Documentation**: Cover all aspects of the session comprehensively +- **Actionable Content**: Focus on concrete changes and decisions made + +## CRITICAL REMINDERS + +- **Dual Output**: Create session document **both in conversation AND save to file** +- **Working Plan Update**: Always update the working plan based on session accomplishments +- **Complete Workflow**: Follow the full archive → analyze → update plan → save process +- **Automatic Archiving**: Handle existing session files before creating new ones +- **Professional Quality**: Make it beautiful, comprehensive, and actionable +- **File Persistence**: Save both `CURRENT_SESSION.md` and `WORKING_PLAN.md` for future session continuity + +Usage: `/fb:save-session` diff --git a/commands/session-start.md b/commands/session-start.md new file mode 100644 index 0000000..be345f8 --- /dev/null +++ b/commands/session-start.md @@ -0,0 +1,44 @@ +# Session Start + +Manual session recovery after compaction or when starting fresh. Uses the hybrid AI+Computer approach for reliable context gathering. + +## Task + +1. **Gather Context**: Run `flashback working-plan --context` to get: + - Current working plan from WORKING_PLAN.md + - **Previous session** conversation history (not empty current session) + - Current session information + +2. **Load Context**: Use `flashback session-start --context` to get recent conversation transcript +3. Understand what you work working on from the conversation transcript, and WORKING_PLAN.md: + - What you were working on (from WORKING_PLAN.md) + - What happened in the last session (from conversation log) + +4. **Welcome User**: After loading context, provide a brief summary of what you understand about the project and ask "What would you like to work on now?" + +## Context Gathering Command + +The CLI command handles all file reading and context formatting consistently: + +```bash +flashback working-plan --context && flashback session-start --context +``` + +This outputs structured context including: + +- Project memory and key learnings +- Current development plan and priorities +- Previous conversation history for continuity +- Session restoration instructions + +## Usage Notes + +This command is used manually when: + +- Starting work after auto-compact (no PostCompact hook exists) +- Beginning a fresh session and need project context +- Hook didn't trigger properly and need manual context restoration + +**CRITICAL**: Gets **previous meaningful conversation**, not empty current session context. + +Usage: `/fb:session-start` diff --git a/commands/working-plan.md b/commands/working-plan.md new file mode 100644 index 0000000..77a5444 --- /dev/null +++ b/commands/working-plan.md @@ -0,0 +1,46 @@ +# Working Plan Update + +You are an expert project manager updating a development working plan based on conversation analysis. + +## Task + +1. **Read the AI analysis prompt**: Load @.claude/flashback/prompts/working-plan-update.md for detailed analysis instructions +2. **Read current working plan**: Load @.claude/flashback/memory/WORKING_PLAN.md to understand current state +3. **Gather session context**: Use `flashback working-plan --context` to get recent conversation transcript +4. **Analyze conversation**: Extract what was actually accomplished, decisions made, next steps identified +5. **Update working plan**: Apply changes to reflect real session progress, not just timestamp updates + +## Archive Management Commands + +For manual plan management: + +- `flashback working-plan --archive` - Archive current plan to `.claude/flashback/memory/ARCHIVE/plans/` and create fresh template +- `flashback working-plan --prune 5` - Keep only 5 most recent archived plans (default: 10) + +## Analysis Focus + +From recent conversation, identify: + +- **Completed Tasks**: What was actually finished or implemented +- **In-Progress Work**: Tasks started but not completed +- **Key Decisions**: Important architectural or design decisions made +- **Blockers**: Issues or obstacles encountered +- **Next Steps**: Explicitly mentioned or implied next actions +- **Scope Changes**: Any changes to project direction or priorities + +## Output Instructions + +**YOU MUST WRITE THE COMPLETE UPDATED `.claude/flashback/memory/WORKING_PLAN.md` FILE.** + +After analyzing the conversation, output the entire updated working plan file with these changes: + +- Move completed tasks from "Next Priorities" to "Completed Recently" +- Update "Current Phase" if phase changed +- Refresh "Immediate Tasks" based on conversation +- Add new tasks discovered during session +- Update session reference and timestamp +- Preserve overall structure and formatting + +**CRITICAL**: Always output the complete, updated WORKING_PLAN.md file content. Do not just provide analysis - write the actual file that should replace the existing one. + +Use concrete, specific language based on actual conversation content, not generalizations. diff --git a/hooks/hooks.json b/hooks/hooks.json new file mode 100644 index 0000000..deffac9 --- /dev/null +++ b/hooks/hooks.json @@ -0,0 +1,3 @@ +{ + "hooks": {} +} diff --git a/plugin.lock.json b/plugin.lock.json new file mode 100644 index 0000000..9a9c8cc --- /dev/null +++ b/plugin.lock.json @@ -0,0 +1,65 @@ +{ + "$schema": "internal://schemas/plugin.lock.v1.json", + "pluginId": "gh:udecode/dotai:.claude-plugin/plugins/fb", + "normalized": { + "repo": null, + "ref": "refs/tags/v20251128.0", + "commit": "d117b0aa8998e806fdd06550966b19b515d6f328", + "treeHash": "421b801a6d999b40d8f5adb38fda6fd064bc2efe003a1dd09941a653cdcfa0ee", + "generatedAt": "2025-11-28T10:28:48.507743Z", + "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": "fb", + "description": "Session management and continuity for Claude Code with automatic memory and working plan tracking", + "version": "1.0.0" + }, + "content": { + "files": [ + { + "path": "README.md", + "sha256": "1f87769e52101c86a6f50e722147b65b074d046ffd0bd48870979c5f3482837d" + }, + { + "path": "hooks/hooks.json", + "sha256": "78922a784ee78e9e50587e93628cd3b9d4dfbe49087adc4514e6781cea38cbb9" + }, + { + "path": ".claude-plugin/plugin.json", + "sha256": "5601eb9342d2982130e479f92612fcd6484d3a787da00911a1e86eaa97ba4f97" + }, + { + "path": "commands/remember.md", + "sha256": "a204b42111798a99be261de86a2a18ed156125fd4890f1abf99cfcaae28cfdec" + }, + { + "path": "commands/working-plan.md", + "sha256": "4d4293a01b1a06c74ca982136b8233a4e09838759d541f827a8116f099bbad0a" + }, + { + "path": "commands/install.md", + "sha256": "fff57dc394ee7f0e67399510548b74d090642f4d560f0b1c23f08af8fd7131b0" + }, + { + "path": "commands/save-session.md", + "sha256": "bf18f5f262d69867974077c40189b2f8e7924e6b393317cacd2bc5d7a4b8e603" + }, + { + "path": "commands/session-start.md", + "sha256": "1a98365b78d6cc01af95d6b306c4cd93925ec5ec621ddcc8926843d250320b5d" + } + ], + "dirSha256": "421b801a6d999b40d8f5adb38fda6fd064bc2efe003a1dd09941a653cdcfa0ee" + }, + "security": { + "scannedAt": null, + "scannerVersion": null, + "flags": [] + } +} \ No newline at end of file