Skip to main content

Sync Claude Code conversation logs to Git repository

Project description

ccjournal

Sync Claude Code conversation logs to a Git repository.

日本語

Prerequisites

Required

  • Python 3.11+
  • Git - for committing and pushing logs
  • Claude Code - this tool syncs logs generated by Claude Code

Optional

  • GitHub CLI (gh) - required for public repository detection

Features

  • Automatically sync Claude Code session logs to a Git repository
  • Organize logs by date or project
  • Support for worktrees (groups by Git remote URL)
  • Auto-commit and push to remote
  • Configurable via TOML

Installation

pipx install ccjournal
# or
uv tool install ccjournal

Quick Start

# Initialize configuration
ccjournal init

# Manually sync logs
ccjournal sync

# Show configuration
ccjournal config show

Configuration

Configuration file is located at ~/.config/ccjournal/config.toml.

Quick reference:

[output]
repository = "~/Documents/claude-logs"
structure = "date"                    # "date" or "project"
auto_push = true
allow_public_repository = false       # Security: block push to public repos
allow_unknown_visibility = false      # Security: block push when visibility unknown

[sync]
interval = 300                        # seconds (for daemon)
exclude_system = true                 # exclude system messages
exclude_tool_messages = true          # exclude [Tool: XXX] only messages

[projects.aliases]
"/path/to/project" = "custom-name"    # optional: customize project names

For complete configuration reference, see docs/configuration.md.

Security

Fail-Safe Design

ccjournal includes multiple security layers to prevent accidental exposure of sensitive information:

  1. Public repository protection - Blocks push to public repositories by default
  2. Unknown visibility protection - Blocks push when visibility cannot be determined (non-GitHub repos)
  3. Sensitive data masking - Automatically masks API keys, tokens, passwords in output

Public Repository Protection

By default, ccjournal blocks pushing to public repositories to prevent accidental exposure of sensitive information that may be included in conversation logs, such as:

  • API keys or passwords mentioned in prompts
  • Internal URLs (Notion, Confluence, etc.)
  • Confidential discussion content

If the output repository is detected as public on GitHub, the sync will fail with an error:

Error: Refusing to push to public repository: /path/to/repo

Note: Public repository detection requires GitHub CLI (gh). For non-GitHub repositories, set allow_unknown_visibility = true after confirming the repository is private.

Directory Structure

Date-based (default):

claude-logs/
└── 2026/01/16/
    ├── my-project.md
    └── another-repo.md

Project-based:

claude-logs/
└── github.com-user-my-project/
    ├── 2026-01-16.md
    └── 2026-01-15.md

Commands

Command Description
ccjournal init Initialize configuration interactively
ccjournal sync Sync logs to repository
ccjournal sync --dry-run Preview what would be synced
ccjournal sync --date 2026-01-16 Sync specific date
ccjournal config show Show current configuration
ccjournal config edit Open config in editor
ccjournal list List recent synced logs
ccjournal daemon install Install daemon as system service
ccjournal daemon uninstall Uninstall daemon service

Automatic Sync

macOS (launchd)

ccjournal daemon install

Follow the instructions to set up automatic sync every 5 minutes.

Linux (systemd)

Create user services for periodic sync. See ccjournal daemon install for details.

cron

# Sync every 5 minutes
*/5 * * * * /usr/local/bin/ccjournal sync

Troubleshooting

macOS: "unidentified developer" warning

When running ccjournal daemon install, macOS may show a security warning because the package is not signed with an Apple Developer ID.

Option 1: Allow via System Settings (Apple recommended)

  1. Open "System Settings" → "Privacy & Security"
  2. Find the blocked app and click "Open Anyway"

See: Open a Mac app from an unknown developer - Apple Support

Option 2: Remove quarantine attribute

# Remove quarantine attribute from ccjournal
xattr -dr com.apple.quarantine ~/.local/bin/ccjournal
xattr -dr com.apple.quarantine ~/.local/share/uv/tools/ccjournal/

Then reload the service:

launchctl unload ~/Library/LaunchAgents/com.ccjournal.daemon.plist
launchctl load ~/Library/LaunchAgents/com.ccjournal.daemon.plist

See: Apple Developer Forums - Avoiding notarisation & Gatekeeper

Development

# Clone the repository
git clone https://github.com/TAKEDA-Takashi/ccjournal.git
cd ccjournal

# Install dependencies
uv sync --dev

# Run tests
uv run pytest

# Type check
uv run pyright

# Lint
uv run ruff check

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ccjournal-0.3.0.tar.gz (57.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ccjournal-0.3.0-py3-none-any.whl (23.0 kB view details)

Uploaded Python 3

File details

Details for the file ccjournal-0.3.0.tar.gz.

File metadata

  • Download URL: ccjournal-0.3.0.tar.gz
  • Upload date:
  • Size: 57.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for ccjournal-0.3.0.tar.gz
Algorithm Hash digest
SHA256 ca0c3b652ab2ceec1009ed75bf1a0a5606621bdaada08fcc20f4ad27f66edc5a
MD5 bc4bded1f87bde89ca0d324d64f296d8
BLAKE2b-256 a4d85c99d2cbc3e38cb9c0b2b66f931d92943a8aa444da41b2454043dea582b9

See more details on using hashes here.

Provenance

The following attestation bundles were made for ccjournal-0.3.0.tar.gz:

Publisher: publish.yml on TAKEDA-Takashi/ccjournal

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ccjournal-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: ccjournal-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 23.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for ccjournal-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5da4a95d5fc901fc46762ffbe15215b1f59d2edf43f3c039755e28278d155788
MD5 c4a7b6364640f01fb43e384e36c39e65
BLAKE2b-256 fa400ad4c677daee9bd47a379b6e36450d021f4a13af27ea2bcb5c90cf3fe9cc

See more details on using hashes here.

Provenance

The following attestation bundles were made for ccjournal-0.3.0-py3-none-any.whl:

Publisher: publish.yml on TAKEDA-Takashi/ccjournal

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page