refactor: ai-proj-plugin 移至 skills-core,合并冗余 session 插件
- ai-proj-plugin 作为 MCP 基础设施移入 skills-core/ - 删除 4 个冗余 session 子插件(save/reload/read/search), session-plugin 已包含全部功能 - 48 → 44 插件 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -10,6 +10,19 @@
|
||||
"pluginRoot": "."
|
||||
},
|
||||
"plugins": [
|
||||
{
|
||||
"name": "ai-proj-plugin",
|
||||
"source": "./skills-core/ai-proj-plugin",
|
||||
"description": "AI project management via REST API. Works out of the box!",
|
||||
"version": "2.0.1",
|
||||
"category": "productivity",
|
||||
"keywords": [
|
||||
"project-management",
|
||||
"tasks",
|
||||
"requirements"
|
||||
],
|
||||
"strict": false
|
||||
},
|
||||
{
|
||||
"name": "agent-swarm-plugin",
|
||||
"source": "./skills-dev/agent-swarm-plugin",
|
||||
@@ -457,71 +470,6 @@
|
||||
],
|
||||
"strict": false
|
||||
},
|
||||
{
|
||||
"name": "ai-proj-plugin",
|
||||
"source": "./skills-workflow/ai-proj-plugin",
|
||||
"description": "AI project management via REST API. Works out of the box!",
|
||||
"version": "2.0.1",
|
||||
"category": "productivity",
|
||||
"keywords": [
|
||||
"project-management",
|
||||
"tasks",
|
||||
"requirements"
|
||||
],
|
||||
"strict": false
|
||||
},
|
||||
{
|
||||
"name": "read-session-plugin",
|
||||
"source": "./skills-workflow/read-session-plugin",
|
||||
"description": "Plugin for read-session",
|
||||
"version": "1.0.0",
|
||||
"category": "workflow",
|
||||
"keywords": [
|
||||
"session",
|
||||
"workflow",
|
||||
"productivity"
|
||||
],
|
||||
"strict": false
|
||||
},
|
||||
{
|
||||
"name": "reload-session-plugin",
|
||||
"source": "./skills-workflow/reload-session-plugin",
|
||||
"description": "Plugin for reload-session",
|
||||
"version": "1.0.0",
|
||||
"category": "workflow",
|
||||
"keywords": [
|
||||
"session",
|
||||
"workflow",
|
||||
"productivity"
|
||||
],
|
||||
"strict": false
|
||||
},
|
||||
{
|
||||
"name": "save-session-plugin",
|
||||
"source": "./skills-workflow/save-session-plugin",
|
||||
"description": "Plugin for save-session",
|
||||
"version": "1.0.0",
|
||||
"category": "workflow",
|
||||
"keywords": [
|
||||
"session",
|
||||
"workflow",
|
||||
"productivity"
|
||||
],
|
||||
"strict": false
|
||||
},
|
||||
{
|
||||
"name": "search-sessions-plugin",
|
||||
"source": "./skills-workflow/search-sessions-plugin",
|
||||
"description": "Plugin for search-sessions",
|
||||
"version": "1.0.0",
|
||||
"category": "workflow",
|
||||
"keywords": [
|
||||
"session",
|
||||
"workflow",
|
||||
"productivity"
|
||||
],
|
||||
"strict": false
|
||||
},
|
||||
{
|
||||
"name": "session-plugin",
|
||||
"source": "./skills-workflow/session-plugin",
|
||||
|
||||
@@ -16,6 +16,7 @@ marketplace_file = script_dir / ".claude-plugin" / "marketplace.json"
|
||||
|
||||
# Skill directories (label, directory name)
|
||||
SKILL_DIRS = [
|
||||
("core", "skills-core"),
|
||||
("dev", "skills-dev"),
|
||||
("req", "skills-req"),
|
||||
("ops", "skills-ops"),
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
{
|
||||
"name": "read-session-plugin",
|
||||
"description": "Plugin for read-session",
|
||||
"version": "1.0.0",
|
||||
"author": {
|
||||
"name": "qiudl"
|
||||
}
|
||||
}
|
||||
@@ -1,211 +0,0 @@
|
||||
---
|
||||
name: read-session
|
||||
description: View a saved Claude session without reloading it for continuation
|
||||
---
|
||||
|
||||
# Read Session Skill
|
||||
|
||||
You are now in session read mode. Your task is to display a previously saved conversation for review without loading it as active context for continuation.
|
||||
|
||||
## Instructions
|
||||
|
||||
1. **Get Session ID**: Extract the session ID from user's request
|
||||
- Format: `YYYY-MM-DD_HHmm` (e.g., "2026-01-20_1430")
|
||||
- User might provide:
|
||||
- Exact ID: "2026-01-20_1430"
|
||||
- Partial ID: "0120" or "1430"
|
||||
- Title keywords: "read the authentication session"
|
||||
- Description: "show me the JWT session from yesterday"
|
||||
- If ambiguous, search `~/.claude/sessions/index.json` and ask for clarification
|
||||
|
||||
2. **Find Session File**:
|
||||
- First check index.json to find the exact filename
|
||||
- Load `~/.claude/sessions/<session-id>_<sanitized-title>.json`
|
||||
- If file not found, inform user and offer similar sessions
|
||||
|
||||
3. **Load and Parse**: Read the JSON file and extract:
|
||||
- Metadata (id, title, date, tags)
|
||||
- Summary (context, approach, changes, outcome, next steps)
|
||||
- Conversation history (all messages)
|
||||
- File modifications
|
||||
|
||||
4. **Display Session**: Show a comprehensive read-only view:
|
||||
```
|
||||
📖 Session: [Title]
|
||||
|
||||
📅 Date: YYYY-MM-DD HH:mm (X days ago)
|
||||
🏷️ Tags: tag1, tag2, tag3
|
||||
💬 Messages: X messages
|
||||
📝 Files Modified: file1, file2, file3
|
||||
|
||||
## Summary
|
||||
|
||||
**Context**: [summary.context]
|
||||
|
||||
**Approach**: [summary.approach]
|
||||
|
||||
**Key Changes**: [summary.keyChanges]
|
||||
|
||||
**Outcome**: [summary.outcome]
|
||||
|
||||
**Next Steps**: [summary.nextSteps]
|
||||
|
||||
## Conversation History
|
||||
|
||||
[Display the full conversation in a readable format]
|
||||
|
||||
---
|
||||
|
||||
To reload and continue this session: /reload-session <id>
|
||||
To search for similar sessions: /search-sessions <keywords>
|
||||
```
|
||||
|
||||
5. **Display Options**:
|
||||
- View full conversation (show all messages)
|
||||
- View summary only (already shown)
|
||||
- View specific messages (by index or search)
|
||||
- Export to different format
|
||||
- Reload to continue working
|
||||
|
||||
## Display Modes
|
||||
|
||||
**Summary Mode (default):**
|
||||
- Show metadata and summary only
|
||||
- Don't display full conversation unless requested
|
||||
|
||||
**Full Mode:**
|
||||
- Show metadata, summary, AND full conversation history
|
||||
- Use when user says "read full session" or "show everything"
|
||||
|
||||
**Conversation-only Mode:**
|
||||
- Skip summary, just show the conversation
|
||||
- Use when user says "show me the conversation" or "messages only"
|
||||
|
||||
## Usage Examples
|
||||
|
||||
**Read summary:**
|
||||
```
|
||||
/read-session 2026-01-20_1430
|
||||
read session 2026-01-20_1430
|
||||
show me the authentication session
|
||||
```
|
||||
|
||||
**Read full conversation:**
|
||||
```
|
||||
/read-session 2026-01-20_1430 --full
|
||||
read full session about authentication
|
||||
show me everything from the JWT session
|
||||
```
|
||||
|
||||
**Read specific messages:**
|
||||
```
|
||||
/read-session 2026-01-20_1430 --messages 5-10
|
||||
show messages 5-10 from session 2026-01-20_1430
|
||||
```
|
||||
|
||||
## Important Notes
|
||||
|
||||
- This is a READ-ONLY view - don't load context for continuation
|
||||
- Default to showing summary unless user asks for full conversation
|
||||
- Format conversation messages clearly with role labels (User/Assistant)
|
||||
- Show timestamps for each message if in full mode
|
||||
- Provide options at the end to reload or search
|
||||
- If session file not found, search index.json for similar titles
|
||||
|
||||
## Example Output
|
||||
|
||||
**Summary view (default):**
|
||||
```
|
||||
📖 Session: Implement User Authentication with JWT
|
||||
|
||||
📅 Date: Jan 18, 2026 16:00 (2 days ago)
|
||||
🏷️ Tags: authentication, jwt, security, api
|
||||
💬 Messages: 45 messages
|
||||
📝 Files Modified: src/auth/jwt.ts, src/middleware/auth.ts, tests/auth.test.ts
|
||||
|
||||
## Summary
|
||||
|
||||
**Context**: User needed to implement JWT-based authentication for their REST API
|
||||
|
||||
**Approach**: Created JWT service with access/refresh tokens, added middleware for route protection
|
||||
|
||||
**Key Changes**:
|
||||
- Implemented JWT token generation and validation
|
||||
- Added authentication middleware
|
||||
- Created login/logout endpoints
|
||||
- Added comprehensive tests
|
||||
|
||||
**Outcome**: Authentication system fully implemented and tested with 95% coverage
|
||||
|
||||
**Next Steps**: Consider adding password reset functionality and rate limiting
|
||||
|
||||
---
|
||||
|
||||
**Actions:**
|
||||
- View full conversation: /read-session 2026-01-20_1430 --full
|
||||
- Reload to continue: /reload-session 2026-01-20_1430
|
||||
- Search similar: /search-sessions authentication jwt
|
||||
```
|
||||
|
||||
**Full view (with --full flag):**
|
||||
```
|
||||
📖 Session: Implement User Authentication with JWT
|
||||
|
||||
📅 Date: Jan 18, 2026 16:00 (2 days ago)
|
||||
🏷️ Tags: authentication, jwt, security, api
|
||||
💬 Messages: 45 messages
|
||||
📝 Files Modified: src/auth/jwt.ts, src/middleware/auth.ts, tests/auth.test.ts
|
||||
|
||||
## Summary
|
||||
|
||||
[Summary content as above]
|
||||
|
||||
## Conversation
|
||||
|
||||
**[User - 16:00:00]**
|
||||
I need to implement JWT authentication for my REST API
|
||||
|
||||
**[Assistant - 16:00:15]**
|
||||
I'll help you implement JWT authentication. Let me first explore your existing codebase...
|
||||
|
||||
**[User - 16:02:30]**
|
||||
The API is in src/api/ and uses Express
|
||||
|
||||
**[Assistant - 16:02:45]**
|
||||
Perfect! I can see your Express setup. Let me create the JWT service...
|
||||
|
||||
[... full conversation continues ...]
|
||||
|
||||
---
|
||||
|
||||
**Actions:**
|
||||
- Reload to continue: /reload-session 2026-01-20_1430
|
||||
- Search similar: /search-sessions authentication jwt
|
||||
```
|
||||
|
||||
**Session not found:**
|
||||
```
|
||||
❌ Session "2026-01-99_9999" not found.
|
||||
|
||||
Did you mean one of these?
|
||||
|
||||
1. [2026-01-20_1430] Implement User Authentication with JWT
|
||||
📅 Jan 20, 14:30 | 🏷️ authentication, jwt, security
|
||||
|
||||
2. [2026-01-18_1600] Setup OAuth2 Integration
|
||||
📅 Jan 18, 16:00 | 🏷️ oauth, authentication, api
|
||||
|
||||
To read: /read-session <id>
|
||||
To search: /search-sessions <keywords>
|
||||
```
|
||||
|
||||
## Formatting Guidelines
|
||||
|
||||
When displaying conversation messages:
|
||||
- Use clear role labels: **[User]** and **[Assistant]**
|
||||
- Include timestamps in full mode
|
||||
- Preserve code blocks and formatting
|
||||
- Show system messages if present
|
||||
- Use horizontal rules to separate messages
|
||||
- Limit very long messages (offer to show full text)
|
||||
- Number messages for easy reference
|
||||
@@ -1,8 +0,0 @@
|
||||
{
|
||||
"name": "reload-session-plugin",
|
||||
"description": "Plugin for reload-session",
|
||||
"version": "1.0.0",
|
||||
"author": {
|
||||
"name": "qiudl"
|
||||
}
|
||||
}
|
||||
@@ -1,177 +0,0 @@
|
||||
---
|
||||
name: reload-session
|
||||
description: Reload a previously saved Claude session to continue the conversation
|
||||
---
|
||||
|
||||
# Reload Session Skill
|
||||
|
||||
You are now in session reload mode. Your task is to load a previously saved conversation and help the user continue from where they left off.
|
||||
|
||||
## Instructions
|
||||
|
||||
1. **Get Session ID**: Extract the session ID from user's request
|
||||
- Format: `YYYY-MM-DD_HHmm` (e.g., "2026-01-20_1430")
|
||||
- User might provide:
|
||||
- Exact ID: "2026-01-20_1430"
|
||||
- Partial ID: "0120" or "1430"
|
||||
- Title keywords: "the authentication session"
|
||||
- Description: "the one about JWT from yesterday"
|
||||
- If ambiguous, search `~/.claude/sessions/index.json` and ask for clarification
|
||||
|
||||
2. **Find Session File**:
|
||||
- First check index.json to find the exact filename
|
||||
- Load `~/.claude/sessions/<session-id>_<sanitized-title>.json`
|
||||
- If file not found, inform user and offer similar sessions
|
||||
|
||||
3. **Load and Parse**: Read the JSON file and extract:
|
||||
- Metadata (id, title, date, tags)
|
||||
- Summary (context, approach, changes, outcome, next steps)
|
||||
- Conversation history (all messages)
|
||||
- File modifications
|
||||
|
||||
4. **Display Session Context**: Show the user a comprehensive summary:
|
||||
```
|
||||
📂 Loaded Session: [Title]
|
||||
|
||||
📅 Original: YYYY-MM-DD HH:mm (X days ago)
|
||||
🏷️ Tags: tag1, tag2, tag3
|
||||
💬 Messages: X messages
|
||||
📝 Modified: file1, file2, file3
|
||||
|
||||
## Summary
|
||||
|
||||
**Context**: [summary.context]
|
||||
|
||||
**Approach**: [summary.approach]
|
||||
|
||||
**Key Changes**: [summary.keyChanges]
|
||||
|
||||
**Outcome**: [summary.outcome]
|
||||
|
||||
**Next Steps**: [summary.nextSteps]
|
||||
|
||||
---
|
||||
|
||||
✅ Session loaded. I have full context of this conversation.
|
||||
What would you like to work on?
|
||||
```
|
||||
|
||||
5. **Maintain Context**:
|
||||
- You now have the full conversation history available
|
||||
- Reference specific details from the loaded session when helpful
|
||||
- If user asks about the session, you can recall exact details
|
||||
- Continue naturally from where the conversation ended
|
||||
- Remember all files that were modified
|
||||
- Recall all decisions and approaches discussed
|
||||
|
||||
6. **Options to Offer**:
|
||||
- Continue the last task that was being worked on (from "Next Steps")
|
||||
- Review what was accomplished
|
||||
- Make changes to previous work
|
||||
- Answer questions about the session
|
||||
- If work continues, offer to save as a new session or update existing one
|
||||
|
||||
## Usage Examples
|
||||
|
||||
**By exact ID:**
|
||||
```
|
||||
/reload-session 2026-01-20_1430
|
||||
```
|
||||
|
||||
**By partial ID:**
|
||||
```
|
||||
reload 0120_1430
|
||||
reload 1430
|
||||
```
|
||||
|
||||
**By title keyword:**
|
||||
```
|
||||
reload the dark mode session
|
||||
continue the authentication work
|
||||
```
|
||||
|
||||
**By description:**
|
||||
```
|
||||
continue the JWT work from yesterday
|
||||
reload the session about React bugs
|
||||
```
|
||||
|
||||
## Important Notes
|
||||
|
||||
- If session file not found, search index.json for similar titles and offer alternatives
|
||||
- When continuing work, naturally reference the previous conversation context
|
||||
- If user wants to modify previous work, ask whether to:
|
||||
- Save as a new session (recommended to preserve history)
|
||||
- Update the existing session (overwrite)
|
||||
- Show relative dates ("2 days ago", "last week") for better context
|
||||
- If files were modified in the original session, note if they still exist
|
||||
- Provide actionable options based on "Next Steps" from the summary
|
||||
|
||||
## Example Output
|
||||
|
||||
**Successful load:**
|
||||
```
|
||||
📂 Loaded Session: Implement User Authentication with JWT
|
||||
|
||||
📅 Original: Jan 18, 2026 16:00 (2 days ago)
|
||||
🏷️ authentication, jwt, security, api
|
||||
💬 45 messages
|
||||
📝 Modified: src/auth/jwt.ts, src/middleware/auth.ts, tests/auth.test.ts
|
||||
|
||||
## Summary
|
||||
|
||||
**Context**: User needed to implement JWT-based authentication for their REST API
|
||||
|
||||
**Approach**: Created JWT service with access/refresh tokens, added middleware for route protection
|
||||
|
||||
**Key Changes**:
|
||||
- Implemented JWT token generation and validation
|
||||
- Added authentication middleware
|
||||
- Created login/logout endpoints
|
||||
- Added comprehensive tests
|
||||
|
||||
**Outcome**: Authentication system fully implemented and tested with 95% coverage
|
||||
|
||||
**Next Steps**: Consider adding password reset functionality and rate limiting
|
||||
|
||||
---
|
||||
|
||||
✅ Session loaded. I have full context of this conversation.
|
||||
|
||||
What would you like to work on?
|
||||
|
||||
**Suggested options:**
|
||||
1. Implement password reset functionality (from Next Steps)
|
||||
2. Add rate limiting to prevent brute force attacks (from Next Steps)
|
||||
3. Review or modify the existing authentication code
|
||||
4. Something else
|
||||
|
||||
Let me know and I'll continue from where we left off!
|
||||
```
|
||||
|
||||
**Session not found:**
|
||||
```
|
||||
❌ Session "2026-01-99_9999" not found.
|
||||
|
||||
Did you mean one of these?
|
||||
|
||||
1. [2026-01-20_1430] Implement User Authentication with JWT
|
||||
📅 Jan 20, 14:30 | 🏷️ authentication, jwt, security
|
||||
|
||||
2. [2026-01-18_1600] Setup OAuth2 Integration
|
||||
📅 Jan 18, 16:00 | 🏷️ oauth, authentication, api
|
||||
|
||||
To reload: /reload-session <id>
|
||||
To search: /search-sessions <keywords>
|
||||
```
|
||||
|
||||
**Ambiguous request:**
|
||||
```
|
||||
🔍 Found multiple sessions matching "authentication":
|
||||
|
||||
1. [2026-01-20_1430] Implement JWT Authentication
|
||||
2. [2026-01-18_1600] Setup OAuth2 Integration
|
||||
3. [2026-01-15_1000] Add API Authentication
|
||||
|
||||
Which session would you like to reload? (Use the ID)
|
||||
```
|
||||
@@ -1,8 +0,0 @@
|
||||
{
|
||||
"name": "save-session-plugin",
|
||||
"description": "Plugin for save-session",
|
||||
"version": "1.0.0",
|
||||
"author": {
|
||||
"name": "qiudl"
|
||||
}
|
||||
}
|
||||
@@ -1,206 +0,0 @@
|
||||
---
|
||||
name: save-session
|
||||
description: Auto-save Claude session conversation with AI-generated title, summary, and tags in searchable JSON format
|
||||
---
|
||||
|
||||
# Save Session Skill
|
||||
|
||||
You are now in session save mode. Your task is to save the current conversation with a meaningful title and comprehensive summary.
|
||||
|
||||
## Auto-Save Mode
|
||||
|
||||
If this skill was triggered by an `<auto-save-trigger>` tag, operate in **auto-save mode**:
|
||||
- Skip all user confirmations and questions
|
||||
- Generate title, summary, and tags automatically
|
||||
- Save immediately without asking for custom tags
|
||||
- Output a brief confirmation only
|
||||
|
||||
## Instructions
|
||||
|
||||
1. **Analyze the Conversation**: Review the entire conversation history to understand:
|
||||
- Main topics discussed
|
||||
- Key problems solved
|
||||
- Important decisions made
|
||||
- Technologies or files involved
|
||||
|
||||
2. **Generate Title**: Create a concise, descriptive title (5-10 words) that captures the essence of the conversation.
|
||||
- Use imperative or descriptive form
|
||||
- Include key technologies/features mentioned
|
||||
- Example: "Implement User Authentication with JWT"
|
||||
- Example: "Debug Memory Leak in React Component"
|
||||
|
||||
3. **Generate Summary**: Write a structured summary (3-5 paragraphs) that includes:
|
||||
- **Context**: What was the initial request or problem?
|
||||
- **Approach**: What approach or solution was taken?
|
||||
- **Key Changes**: What were the main changes or implementations?
|
||||
- **Outcome**: What was achieved or what's the current status?
|
||||
- **Next Steps** (if applicable): What remains to be done?
|
||||
|
||||
4. **Extract Tags**: Identify 3-8 relevant tags:
|
||||
- Technologies used (e.g., "react", "typescript", "docker")
|
||||
- Task type (e.g., "bug-fix", "feature", "refactor", "documentation")
|
||||
- Domain (e.g., "authentication", "ui", "api", "database")
|
||||
|
||||
5. **Get Session ID**: Check `~/.claude/hooks/.current-session` for the current session ID. If it doesn't exist, generate one using format `YYYY-MM-DD_HHmm`.
|
||||
|
||||
6. **Filter Conversation Content**: Before saving, clean the conversation:
|
||||
|
||||
**EXCLUDE these from saved conversation:**
|
||||
- Bash/shell command outputs (keep only the command intent)
|
||||
- Full file contents from Read tool (keep only file path + brief note)
|
||||
- Tool result outputs (Glob results, Grep results, etc.)
|
||||
- `<system-reminder>` tags and their contents
|
||||
- `<auto-save-trigger>` tags
|
||||
- Raw JSON/XML tool responses
|
||||
- Error stack traces (summarize the error instead)
|
||||
- Large code blocks from file reads (keep only relevant snippets)
|
||||
|
||||
**INCLUDE and preserve:**
|
||||
- User's questions and requests (the actual intent)
|
||||
- Assistant's explanations and reasoning
|
||||
- Key decisions and why they were made
|
||||
- Code changes made (what was added/modified)
|
||||
- Important findings and conclusions
|
||||
- File paths that were modified
|
||||
- Summary of what tools accomplished (not raw output)
|
||||
|
||||
**Transform tool calls to summaries:**
|
||||
- Instead of: `[Bash output: 500 lines of npm install...]`
|
||||
- Save as: `"Installed dependencies with npm install"`
|
||||
- Instead of: `[Read file: 200 lines of code...]`
|
||||
- Save as: `"Read MallPurchaseManager.java to understand order push logic"`
|
||||
|
||||
7. **Save to File**: Create a JSON file in `~/.claude/sessions/` with:
|
||||
- Filename: `<session-id>_<sanitized-title>.json`
|
||||
- Content structure:
|
||||
```json
|
||||
{
|
||||
"id": "YYYY-MM-DD_HHmm",
|
||||
"title": "[Generated Title]",
|
||||
"date": "[ISO 8601 format]",
|
||||
"timestamp": 1234567890,
|
||||
"tags": ["tag1", "tag2"],
|
||||
"summary": {
|
||||
"context": "What was the initial request or problem?",
|
||||
"approach": "What approach or solution was taken?",
|
||||
"keyChanges": "What were the main changes or implementations?",
|
||||
"outcome": "What was achieved or what's the current status?",
|
||||
"nextSteps": "What remains to be done (if applicable)"
|
||||
},
|
||||
"metadata": {
|
||||
"messageCount": 0,
|
||||
"technologies": ["tech1", "tech2"],
|
||||
"filesModified": ["file1", "file2"]
|
||||
},
|
||||
"conversation": [
|
||||
{
|
||||
"role": "user|assistant",
|
||||
"content": "cleaned message content - NO raw tool outputs",
|
||||
"timestamp": "ISO 8601",
|
||||
"toolSummary": "optional: brief summary of tools used in this turn"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
8. **Update Index**: After saving the session, update `~/.claude/sessions/index.json`:
|
||||
- Add entry with id, title, date, tags, and summary preview
|
||||
- Keep index sorted by date (newest first)
|
||||
- If index doesn't exist, create it
|
||||
- Index structure:
|
||||
```json
|
||||
{
|
||||
"sessions": [
|
||||
{
|
||||
"id": "YYYY-MM-DD_HHmm",
|
||||
"title": "Title",
|
||||
"date": "ISO 8601",
|
||||
"tags": ["tag1"],
|
||||
"summaryPreview": "First 200 chars of context..."
|
||||
}
|
||||
],
|
||||
"lastUpdated": "ISO 8601"
|
||||
}
|
||||
```
|
||||
|
||||
9. **Post-Save Actions**: After saving:
|
||||
- Reset autosave timer: `~/.claude/hooks/autosave-mark.sh`
|
||||
- Clear pending save flag: `rm -f ~/.claude/hooks/.pending-save`
|
||||
|
||||
10. **Confirm**: After saving, report back to the user:
|
||||
- The session ID and filename
|
||||
- The generated title
|
||||
- Main tags extracted
|
||||
- Brief confirmation with instructions on how to reload
|
||||
|
||||
## Important Notes
|
||||
|
||||
- Create `~/.claude/sessions/` directory if it doesn't exist
|
||||
- Sanitize the title for filename (lowercase, replace spaces with hyphens, remove special chars)
|
||||
- In manual mode, ask user if they want to add any custom tags before saving
|
||||
- In auto-save mode, skip all user interactions
|
||||
- Always update the index file for fast searching
|
||||
- Use current timestamp in ISO 8601 format
|
||||
- Count actual messages in conversation for metadata
|
||||
- Each conversation MUST have its own unique JSON file
|
||||
|
||||
## Conversation Filtering Example
|
||||
|
||||
**RAW conversation (DON'T save like this):**
|
||||
```
|
||||
User: "找一下订单推送的代码"
|
||||
Assistant: [Grep tool output with 50 matching files...]
|
||||
Assistant: [Read file output with 200 lines of Java code...]
|
||||
Assistant: "I found the order push code in MallPurchaseManager.java"
|
||||
User: "修改它加上channelType"
|
||||
Assistant: [Edit tool with full file diff...]
|
||||
<system-reminder>Task tools haven't been used...</system-reminder>
|
||||
```
|
||||
|
||||
**CLEANED conversation (Save like this):**
|
||||
```json
|
||||
{
|
||||
"conversation": [
|
||||
{
|
||||
"role": "user",
|
||||
"content": "找一下订单推送的代码"
|
||||
},
|
||||
{
|
||||
"role": "assistant",
|
||||
"content": "Found order push code in MallPurchaseManager.java:5536 in the getJsonString() method. This method assembles order data for pushing to Lining platform.",
|
||||
"toolSummary": "Searched codebase, read MallPurchaseManager.java"
|
||||
},
|
||||
{
|
||||
"role": "user",
|
||||
"content": "修改它加上channelType"
|
||||
},
|
||||
{
|
||||
"role": "assistant",
|
||||
"content": "Added channelType field to the order push logic. Now when orders are pushed to Lining platform, it will include the external platform type (卓望/南航).",
|
||||
"toolSummary": "Edited MallPurchaseManager.java - added order.setChannelType()"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
## Example Output (Manual Mode)
|
||||
|
||||
```
|
||||
Session saved successfully!
|
||||
|
||||
ID: 2026-01-20_1430
|
||||
Title: Implement Dark Mode Toggle Feature
|
||||
Tags: react, css, ui, feature
|
||||
File: ~/.claude/sessions/2026-01-20_1430_implement-dark-mode-toggle-feature.json
|
||||
|
||||
The conversation has been archived with full history (45 messages).
|
||||
|
||||
To reload this session: /reload-session 2026-01-20_1430
|
||||
To search sessions: /search-sessions dark mode
|
||||
```
|
||||
|
||||
## Example Output (Auto-Save Mode)
|
||||
|
||||
```
|
||||
[Auto-saved] 2026-01-20_1430: "Implement Dark Mode Toggle Feature" (45 messages)
|
||||
```
|
||||
@@ -1,8 +0,0 @@
|
||||
{
|
||||
"name": "search-sessions-plugin",
|
||||
"description": "Plugin for search-sessions",
|
||||
"version": "1.0.0",
|
||||
"author": {
|
||||
"name": "qiudl"
|
||||
}
|
||||
}
|
||||
@@ -1,128 +0,0 @@
|
||||
---
|
||||
name: search-sessions
|
||||
description: Search saved Claude sessions by title, tags, date, or content
|
||||
---
|
||||
|
||||
# Search Sessions Skill
|
||||
|
||||
You are now in session search mode. Your task is to help the user find saved conversations.
|
||||
|
||||
## Instructions
|
||||
|
||||
1. **Read Index**: Load `~/.claude/sessions/index.json` to get the list of all sessions
|
||||
- If file doesn't exist, inform user no sessions have been saved yet
|
||||
|
||||
2. **Parse Search Query**: Understand what the user is looking for:
|
||||
- Keywords in title or summary
|
||||
- Specific tags (e.g., "react", "bug-fix", "authentication")
|
||||
- Date range (e.g., "last week", "January 2026", "today")
|
||||
- Combination of filters
|
||||
- Special flags like "--all" to show all results
|
||||
|
||||
3. **Search Logic**:
|
||||
- First search in index.json (fast search by title, tags, date, summary preview)
|
||||
- If user needs full content search, load individual session JSON files from `~/.claude/sessions/`
|
||||
- Support case-insensitive search
|
||||
- Support partial matches
|
||||
- Score results by relevance
|
||||
|
||||
4. **Display Results**: Show matching sessions in a clear, readable format:
|
||||
```
|
||||
🔍 Found 3 sessions matching "react":
|
||||
|
||||
1. [2026-01-20_1430] Implement Dark Mode Toggle Feature
|
||||
📅 2026-01-20 14:30 | 🏷️ react, css, ui, feature
|
||||
💡 Added dark mode toggle to application settings...
|
||||
|
||||
2. [2026-01-19_1015] Debug Memory Leak in React Component
|
||||
📅 2026-01-19 10:15 | 🏷️ react, debugging, performance
|
||||
💡 Investigated and fixed memory leak caused by...
|
||||
|
||||
3. [2026-01-18_1600] Setup Authentication with JWT
|
||||
📅 2026-01-18 16:00 | 🏷️ authentication, jwt, security
|
||||
💡 Implemented JWT-based authentication system...
|
||||
|
||||
To reload a session: /reload-session <id>
|
||||
```
|
||||
|
||||
5. **Advanced Search**:
|
||||
- Support filtering by multiple tags: "react AND authentication"
|
||||
- Support OR logic: "react OR vue"
|
||||
- Support date ranges: "between 2026-01-01 and 2026-01-20"
|
||||
- Support exclusion: "react NOT bug"
|
||||
- Support tag-specific search: "tag:authentication"
|
||||
|
||||
## Search Examples
|
||||
|
||||
**By keyword:**
|
||||
- `search sessions about react` → Search for "react" in title, tags, and summary
|
||||
|
||||
**By date:**
|
||||
- `find sessions from last week` → Filter by date range (last 7 days)
|
||||
- `sessions from January` → Filter by month
|
||||
- `sessions today` → Today's sessions only
|
||||
|
||||
**By tag:**
|
||||
- `search sessions tagged authentication` → Filter by specific tag
|
||||
- `sessions with tag:bug-fix` → Explicit tag search
|
||||
|
||||
**List all:**
|
||||
- `list all sessions` → Show all sessions (newest first)
|
||||
- `show recent sessions` → Show last 10 sessions
|
||||
|
||||
**Combined:**
|
||||
- `search react sessions from last month` → Keyword + date filter
|
||||
- `find authentication AND api sessions` → Multiple tags
|
||||
|
||||
## Important Notes
|
||||
|
||||
- Show most recent sessions first by default
|
||||
- Limit initial results to 10, offer to show more with --all flag
|
||||
- If no matches found, suggest related searches or show recent sessions
|
||||
- Provide the session ID clearly so user can reload it
|
||||
- Display dates in human-readable format (e.g., "2 days ago", "last week")
|
||||
- If only one result found, offer to load it automatically
|
||||
|
||||
## Example Output Formats
|
||||
|
||||
**Multiple results:**
|
||||
```
|
||||
🔍 Found 5 sessions matching "authentication":
|
||||
|
||||
1. [2026-01-20_1430] Setup OAuth2 Integration
|
||||
📅 Jan 20, 14:30 (today) | 🏷️ oauth, authentication, api
|
||||
💡 Integrated OAuth2 provider for third-party login...
|
||||
|
||||
2. [2026-01-18_1600] Implement JWT Authentication
|
||||
📅 Jan 18, 16:00 (2 days ago) | 🏷️ jwt, authentication, security
|
||||
💡 Built JWT-based auth system with refresh tokens...
|
||||
|
||||
Showing 2 of 5 results. Use "/search-sessions authentication --all" to see all.
|
||||
To reload: /reload-session <id>
|
||||
```
|
||||
|
||||
**No results:**
|
||||
```
|
||||
🔍 No sessions found matching "xyz"
|
||||
|
||||
Suggestions:
|
||||
- Try different keywords
|
||||
- Check spelling
|
||||
- Use broader search terms
|
||||
|
||||
Recent sessions:
|
||||
1. [2026-01-20_1430] Implement Dark Mode Toggle Feature
|
||||
2. [2026-01-19_1015] Debug Memory Leak in React Component
|
||||
...
|
||||
```
|
||||
|
||||
**Single result:**
|
||||
```
|
||||
🔍 Found 1 session matching "oauth":
|
||||
|
||||
[2026-01-20_1430] Setup OAuth2 Integration
|
||||
📅 Jan 20, 14:30 (today) | 🏷️ oauth, authentication, api
|
||||
💡 Integrated OAuth2 provider for third-party login...
|
||||
|
||||
Would you like to reload this session? (/reload-session 2026-01-20_1430)
|
||||
```
|
||||
Reference in New Issue
Block a user