Track Every Claude Code Session Automatically with This GitHub Hook

Track Every Claude Code Session Automatically with This GitHub Hook

Install claude-session-tracker to automatically save all your Claude Code conversations as GitHub Issues linked to a Projects board—no lost context, searchable history.

1d ago·3 min read·38 views·via hn_claude_code, medium_anthropic
Share:

What It Does — Automatic GitHub Issue Logging for Every Session

claude-session-tracker solves a fundamental problem: Claude Code sessions disappear when they end. You lose the conversation history, the reasoning behind decisions, and any context that could help future you or your team. This tool automatically creates a GitHub Issue for every Claude Code session and logs every prompt and response as timestamped comments.

Since sessions live as GitHub Issues in your project's ecosystem, you can:

  • Search across all past sessions
  • Link issues to PRs naturally
  • Track session status on a GitHub Projects board
  • Maintain permanent, shareable conversation records

Setup — One Command, Zero Configuration

npx claude-session-tracker

That's it. The installer:

  1. Checks for gh CLI (GitHub CLI) and guides you through setup if missing
  2. Creates a private GitHub repository for your session issues
  3. Sets up a GitHub Project with pre-configured status fields (Created, Last Active)
  4. Installs Claude Code hooks globally
  5. Tags each issue with the project name as a label

The installer is idempotent—re-running it just reuses your existing configuration without creating duplicates.

Why GitHub Over Other Tools

The creator built integrations for Notion, Linear, and Plane first, but hit two critical issues:

PRs Welcome

  1. Poor PR linking: Connecting sessions back to GitHub PRs was never smooth on external platforms
  2. API rate limits: Since this fires on every prompt and response (essentially creating a timeline), other platforms' rate limits meant silently dropped entries

GitHub's API rate limits are generous enough for individual usage, and having everything in the same ecosystem eliminates context switching.

Key Design Decisions That Matter

No MCP: The creator deliberately avoided making this an MCP server. Why? To avoid consuming context window tokens for session tracking. Everything runs through Claude Code's native hook system instead.

Fully async: All hooks fire asynchronously, meaning zero impact on Claude's response latency. Your coding flow isn't interrupted.

Smart session management:

  • claude --resume reuses the same GitHub Issue
  • Auto-closes idle sessions after 30 minutes (configurable)
  • Pause/resume functionality for sensitive work
  • Auto-updates issue title with the latest prompt for easy scanning

When To Use It — Specific Workflows That Benefit

  1. Team onboarding: New developers can search past sessions to understand why architectural decisions were made
  2. Debugging retrospectives: When a bug appears, trace back to the session where related code was written
  3. Code review context: Link session issues to PRs so reviewers can see the full conversation behind changes
  4. Personal knowledge base: Build a searchable archive of your problem-solving approaches

npm downloads

Privacy Protection Built In

The system protects your session data if repository or project visibility changes. If you accidentally make the repo public, the tool has safeguards to prevent exposing your conversation history.

What It Doesn't Do (And Why)

This isn't an analytics platform. If you want metrics like "26% of sessions are abandoned" or "skills used in 4% of sessions" (findings from the Rudel analytics tool mentioned in related coverage), you'd need a different solution. This is purely about preservation and searchability.

GitHub Issue with session comments

Getting Started Today

# First, make sure you have GitHub CLI installed
gh auth login

# Then run the installer
npx claude-session-tracker

# Start a Claude Code session as usual
# Watch as it automatically creates and updates a GitHub Issue

Once installed, every Claude Code session you run will be automatically tracked. No additional commands needed, no prompts to remember—just normal Claude Code usage with permanent history.

AI Analysis

Claude Code users should install this immediately if they ever need to reference past conversations. The key insight is that session history has value beyond the immediate coding task—for documentation, onboarding, and debugging. **Workflow change**: Instead of trying to remember "why did I write this code?", you'll search your GitHub Issues. Before starting significant refactoring, check if there were previous sessions about this codebase. When pairing with another developer, share the session issue URL instead of trying to verbally reconstruct your thought process. **Configuration tip**: The 30-minute auto-close is sensible for most workflows, but if you frequently context switch between meetings and coding, consider adjusting this in the configuration. The pause/resume feature is particularly useful for sensitive work where you don't want automatic logging. **Integration strategy**: Since this creates GitHub Issues, you can use GitHub's native features like @mentions, labels, and project automation. Create a label for "critical session" when working on important architectural decisions, or set up notifications when sessions related to specific files are created.
Original sourcegithub.com

Trending Now

More in Products & Launches

View all