From 3295f50ddcc150ca22a7e3511add409a430237ae Mon Sep 17 00:00:00 2001 From: Zhongwei Li Date: Sun, 30 Nov 2025 08:57:20 +0800 Subject: [PATCH] Initial commit --- .claude-plugin/plugin.json | 15 ++++++++++ README.md | 3 ++ commands/convo-list.md | 9 ++++++ commands/convo-recent.md | 9 ++++++ commands/convo-search.md | 9 ++++++ hooks/stop.sh | 37 +++++++++++++++++++++++++ plugin.lock.json | 57 ++++++++++++++++++++++++++++++++++++++ 7 files changed, 139 insertions(+) create mode 100644 .claude-plugin/plugin.json create mode 100644 README.md create mode 100644 commands/convo-list.md create mode 100644 commands/convo-recent.md create mode 100644 commands/convo-search.md create mode 100755 hooks/stop.sh create mode 100644 plugin.lock.json diff --git a/.claude-plugin/plugin.json b/.claude-plugin/plugin.json new file mode 100644 index 0000000..eb7a896 --- /dev/null +++ b/.claude-plugin/plugin.json @@ -0,0 +1,15 @@ +{ + "name": "conversation-saver", + "description": "Auto-save and search your Claude Code conversations", + "version": "0.0.0-2025.11.28", + "author": { + "name": "sirkitree", + "email": "zhongweili@tubi.tv" + }, + "commands": [ + "./commands" + ], + "hooks": [ + "./hooks" + ] +} \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..9cee957 --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# conversation-saver + +Auto-save and search your Claude Code conversations diff --git a/commands/convo-list.md b/commands/convo-list.md new file mode 100644 index 0000000..6193cd6 --- /dev/null +++ b/commands/convo-list.md @@ -0,0 +1,9 @@ +--- +description: List all saved Claude Code conversations +--- + +List all saved conversations: + +```bash +${CLAUDE_PLUGIN_ROOT}/scripts/search-conversations.sh --list +``` diff --git a/commands/convo-recent.md b/commands/convo-recent.md new file mode 100644 index 0000000..deaeda1 --- /dev/null +++ b/commands/convo-recent.md @@ -0,0 +1,9 @@ +--- +description: Show recent Claude Code conversations +--- + +Show the {{count:5}} most recent conversations: + +```bash +${CLAUDE_PLUGIN_ROOT}/scripts/search-conversations.sh --recent {{count}} +``` diff --git a/commands/convo-search.md b/commands/convo-search.md new file mode 100644 index 0000000..32d4c16 --- /dev/null +++ b/commands/convo-search.md @@ -0,0 +1,9 @@ +--- +description: Search through saved Claude Code conversations +--- + +Search for conversations containing: {{term}} + +```bash +${CLAUDE_PLUGIN_ROOT}/scripts/search-conversations.sh "{{term}}" --context 5 +``` diff --git a/hooks/stop.sh b/hooks/stop.sh new file mode 100755 index 0000000..44cb835 --- /dev/null +++ b/hooks/stop.sh @@ -0,0 +1,37 @@ +#!/bin/bash +# Stop hook - saves conversation after each Claude response +# Calls the conversation-logger skill for actual save logic + +# Read hook context from stdin +HOOK_DATA=$(cat) + +# Extract session info from the hook data +TRANSCRIPT_PATH=$(echo "$HOOK_DATA" | jq -r '.transcript_path // empty' 2>/dev/null) +SESSION_ID=$(echo "$HOOK_DATA" | jq -r '.session_id // "unknown"' 2>/dev/null) + +# Check if we have a valid transcript path +if [ -z "$TRANSCRIPT_PATH" ] || [ ! -f "$TRANSCRIPT_PATH" ]; then + echo "Warning: No valid transcript path found, skipping save" >&2 + exit 0 +fi + +# Call the conversation-logger skill's save script +SKILL_SCRIPT="$HOME/.claude/skills/conversation-logger/scripts/save-conversation.sh" + +if [ -f "$SKILL_SCRIPT" ]; then + # Skill is installed, use it + bash "$SKILL_SCRIPT" "$TRANSCRIPT_PATH" "$SESSION_ID" +else + # Skill not found, provide helpful message + echo "Warning: conversation-logger skill not found at $SKILL_SCRIPT" >&2 + echo "Please install the skill: cd ~/.claude/skills && git clone https://github.com/sirkitree/conversation-logger.git" >&2 + + # Fall back to basic save (just copy the JSONL) + LOG_DIR="$HOME/.claude/conversation-logs" + mkdir -p "$LOG_DIR" + TIMESTAMP=$(date +"%Y-%m-%d_%H-%M-%S") + cp "$TRANSCRIPT_PATH" "$LOG_DIR/conversation_$TIMESTAMP.jsonl" + echo "Conversation saved to: $LOG_DIR/conversation_$TIMESTAMP.jsonl" >&2 +fi + +exit 0 diff --git a/plugin.lock.json b/plugin.lock.json new file mode 100644 index 0000000..9c374d8 --- /dev/null +++ b/plugin.lock.json @@ -0,0 +1,57 @@ +{ + "$schema": "internal://schemas/plugin.lock.v1.json", + "pluginId": "gh:sirkitree/claude-conversation-saver:.claude-plugin", + "normalized": { + "repo": null, + "ref": "refs/tags/v20251128.0", + "commit": "b1fb136789984790ea5d93e94dae25225dd37e66", + "treeHash": "c3b3704fd72600a2f5e898b5a34229bcdc77c5e7cf6f6b1a465f00395f01ff2e", + "generatedAt": "2025-11-28T10:28:21.761458Z", + "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": "conversation-saver", + "description": "Auto-save and search your Claude Code conversations", + "version": null + }, + "content": { + "files": [ + { + "path": "README.md", + "sha256": "ad1ce77d67c21147eb04ebc96da0069948cdafa9dd82a090cc7432a1c1387da4" + }, + { + "path": "hooks/stop.sh", + "sha256": "bcf4d428a4f2aaadd75ed1b621696e57ff76ab3bd88b2879c9aff0d04c89c206" + }, + { + "path": ".claude-plugin/plugin.json", + "sha256": "c399f7aad026a0ab86107072ee60848b91a5db87a32db5ffb81f1c0ab34da325" + }, + { + "path": "commands/convo-list.md", + "sha256": "daebdc98768d032958b3b88ea069825a3e3ae598193bcf7af1bec9fce683397b" + }, + { + "path": "commands/convo-search.md", + "sha256": "87d9817c849f073b9a33166c3358536fdd516c453a12e595c56e23d7ca2b27f4" + }, + { + "path": "commands/convo-recent.md", + "sha256": "3ba0f24fba8729cea51b698957064a16e7d65bdd0378aa85c43f4288b9120445" + } + ], + "dirSha256": "c3b3704fd72600a2f5e898b5a34229bcdc77c5e7cf6f6b1a465f00395f01ff2e" + }, + "security": { + "scannedAt": null, + "scannerVersion": null, + "flags": [] + } +} \ No newline at end of file