Skip to main content

Claude Code Integration

Claude Code is Anthropic’s official CLI for Claude. AgentLogs provides deep integration with Claude Code, including automatic transcript sync and commit tracking.

Features

  • Automatic sync - Transcripts are uploaded automatically at the end of each session
  • Commit tracking - Links AI sessions to the git commits they produced

Installation

1. Authentication

Run the following command in the terminal:
npx agentlogs login agentlogs.ai

2. Claude Code Plugin

Inside Claude Code, run the following commands:
/plugin marketplace add agentlogs/claude-code
/plugin install agentlogs

How It Works

The plugin captures transcripts and tracks commits using Claude Code hooks:
  • Stop - Captures after each agent response (real-time visibility)
  • SessionEnd - Captures complete session (guaranteed final state)
  • PreToolUse - Runs before Bash commands to snapshot git state
  • PostToolUse - Runs after Bash commands to detect new commits
Transcripts are automatically deduplicated server-side based on session ID. The PreToolUse and PostToolUse hooks work together to track commits: PreToolUse captures the current HEAD before a Bash command runs, and PostToolUse compares it after to detect any commits made by Claude Code.

Manual Upload

You can manually upload transcripts using the CLI:
# Interactive picker to browse and upload any transcript
npx agentlogs upload

# Upload a specific transcript file
npx agentlogs claudecode upload ~/.claude/projects/-path-to-project/session-id.jsonl

# Sync all transcripts from a specific project
npx agentlogs claudecode sync --cwd /path/to/project
The interactive upload command discovers transcripts from all agents and lets you pick one to upload.