Initial commit

This commit is contained in:
Zhongwei Li
2025-11-30 09:03:26 +08:00
commit 2bbfb3f5bc
9 changed files with 371 additions and 0 deletions

18
commands/install.md Normal file
View File

@@ -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
```

31
commands/remember.md Normal file
View File

@@ -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.

146
commands/save-session.md Normal file
View File

@@ -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`

44
commands/session-start.md Normal file
View File

@@ -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`

46
commands/working-plan.md Normal file
View File

@@ -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.