Loading...
Loading...
Extract and organize Claude Code session history into project .chats directory. Use when users want to document their Claude sessions, export conversation inputs, or maintain a log of instructions given to Claude.
npx skill4agent add tyrchen/claude-skills chat-history~/.claude/projects/.chats.jsonl~/.claude/projects/{project-path-encoded}/.jsonltype: "user"userType: "external"message.content.chats/{YYYYMMDD}.md/--~/.claude/projects/{encoded-path}/# Example: /Users/tchen/projects/tubi/titc
# Becomes: -Users-tchen-projects-tubi-titc
# Full path: ~/.claude/projects/-Users-tchen-projects-tubi-titc/# List all main session files (excluding agent-* files) for a specific date
ls -la ~/.claude/projects/{project-dir}/*.jsonl | grep "Dec 25" | grep -v agent-cat {session-file}.jsonl | jq -r '
select(.type == "user" and .userType == "external" and (.isMeta | not)) |
.message.content |
if type == "string" then . else empty end
' | grep -v "^Caveat:" \
| grep -v "^<command" \
| grep -v "^<local-command" \
| grep -v "^This session is being continued" \
| grep -v "^<user-prompt-submit-hook>" \
| grep -v "^Analysis:" \
| grep -v "^$".chats/# Instructions
## {task title}
{user instruction}
## {another task title}
{another user instruction}git add .chats/*.md
git commit -m "docs(chats): add session history for {date range}".chats/{YYYYMMDD}.md# Instructions##.chats/20251225.md# Instructions
## implement feature X
based on @specs/feature-x.md implement all phases entirely
commit the code and test
## fix bug Y
investigate why component Z is not working
use sub agents to analyze the issue in parallel<command-name><local-command-stdout><user-prompt-submit-hook>~/.claude/projects/{encoded-path}/.chats/{YYYYMMDD}.md.chats/# Get encoded project path
PROJECT_PATH=$(pwd | sed 's|/|-|g' | sed 's|^|/|' | sed 's|^/|-|')
SESSION_DIR="$HOME/.claude/projects/$PROJECT_PATH"
# Check if exists
if [ -d "$SESSION_DIR" ]; then
echo "Session directory: $SESSION_DIR"
echo "Sessions by date:"
ls -la "$SESSION_DIR"/*.jsonl 2>/dev/null | grep -v agent- | awk '{print $6, $7}' | sort -u
else
echo "No session directory found for this project"
fiagent-*.jsonl01e78099-de0e-4424-845c-518638c8241e.jsonl.message.content