Skip to main content

AnoSys observability hook for Claude Code — automatic audit logging of Claude Code sessions

Project description

anosys-sdk-claude-code

AnoSys observability and analytics hook for Anthropic's Claude Code.

This package automatically captures Claude Code's telemetry, session turns, context sizes, and API costs, and sends them to your AnoSys workspace. It integrates directly into Claude Code's native Stop hook mechanism.

Installation

You can install the package via pip or your favorite Python package manager:

pip install anosys-sdk-claude-code

After installing the package, run the setup wizard to configure the hook:

anosys-claude-code install

The installer will prompt you for:

  1. AnoSys API Key for logs: Your ingestion API key from the AnoSys Console.
  2. AnoSys API Key for OTEL (optional): Your OpenTelemetry ingestion API key from the AnoSys Console.
  3. Content Redaction: If enabled, all conversation content (prompts, answers, thinking) will be redacted and replaced with REDACTED before being sent. Only metadata and tokens will be tracked.

Headless Installation

If you prefer to install without interactive prompts, you can pass the configuration via flags:

anosys-claude-code install \
  --api-key "your_logs_api_key" \
  --otel-key "your_otel_api_key" \
  --redaction

CLI Commands

The package provides a unified CLI to manage your hook installation safely. It modifies ~/.claude/settings.json and creates automatic backups (~/.claude/settings.json.{TIMESTAMP}.bak) before any changes.

status

Check the current installation status of the AnoSys hook:

anosys-claude-code status

install

Installs or updates the hook in your Claude Code settings:

anosys-claude-code install

uninstall

Safely removes the AnoSys hook and related environment variables from your settings:

anosys-claude-code uninstall

run

This command is executed automatically by Claude Code when a session ends. You generally do not need to run this manually:

anosys-claude-code run

How it works

When installed, this package registers a Stop hook in ~/.claude/settings.json using the {"owner": "anosys"} tag. When a Claude Code session concludes, the hook is invoked. It scans your local Claude transcripts (~/.claude/projects/), incrementally maps any new messages or subagent events using the AnoSys schemas, calculates accurate pricing, applies optional PII redaction, and batches the results to your AnoSys workspace.

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

anosys_claude_code-0.2.8.tar.gz (26.7 kB view details)

Uploaded Source

Built Distribution

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

anosys_claude_code-0.2.8-py3-none-any.whl (28.5 kB view details)

Uploaded Python 3

File details

Details for the file anosys_claude_code-0.2.8.tar.gz.

File metadata

  • Download URL: anosys_claude_code-0.2.8.tar.gz
  • Upload date:
  • Size: 26.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for anosys_claude_code-0.2.8.tar.gz
Algorithm Hash digest
SHA256 316f25c89414ca6657458356d73a7f553e2ec4063803ce8a6d570c83290a75ae
MD5 178266283abe15d0a623d2b843ddb702
BLAKE2b-256 23b0d88c5cdd147b71d5104e43f7d54006c8fce4044853b99dd27ed58d8a66a6

See more details on using hashes here.

File details

Details for the file anosys_claude_code-0.2.8-py3-none-any.whl.

File metadata

File hashes

Hashes for anosys_claude_code-0.2.8-py3-none-any.whl
Algorithm Hash digest
SHA256 4d3becea197c092ba11fc3491bbbb4e99b2a2e3ec957775595bf7a6f2dc78484
MD5 1f933181a778161f2825baa56afe7425
BLAKE2b-256 1c789e09f465f8a4244c69c43b28a2cc727685bd965a62c7286a3349ed856ef5

See more details on using hashes here.

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