Skip to main content

cc-observatory

Local observability for Claude Code: see your sessions, subagents, blocks, logs, tokens and cost, on your own machine.

Leia em português

CI PyPI License: MIT Python 3.12+

Status

Pre-alpha. v0.1.0 is the first release and closes milestone 0 of 8 (foundation). There is still nothing useful to install.

What v0.1.0 contains:

  • the repository foundation: the Python package cc-observatory (import package ccobs), published to PyPI, with a ccobs CLI that only prints its version;
  • tooling: uv, ruff, mypy in strict mode, pytest with a coverage gate, pre-commit and Commitizen;
  • CI on GitHub Actions: lint, type checks and tests on Linux, macOS and Windows, a package build, a Conventional Commits check on PR titles, and a release workflow that publishes to PyPI with trusted publishing;
  • architecture decision records (ADRs) 0001 to 0012 for the decisions made so far, including how hooks reach the app (ADR 0011) and what Claude Code 2.1.296 really sends in its telemetry and hooks (ADR 0012);
  • fixture capture tooling for development (tools/capture/, not part of the package) and sanitized test fixtures recorded from real, isolated Claude Code sessions (tests/fixtures/).

What comes next: milestone 1 (v0.2.0), the observability stack in Docker Compose with a provisioned Grafana. The full plan is in the roadmap below.

Unless a section says otherwise, the rest of this README describes the planned design.

What it will show

None of this works yet. The release that is planned to bring each part is in parentheses.

  • Live overview of the Claude Code sessions on your machine: which ones are working, waiting on you, idle or ended (v0.4.0).
  • Agent tree: each session's main agent and the subagents it started (v0.4.0).
  • Blocks: sessions waiting on you, such as a permission prompt, an idle prompt, an MCP elicitation or a failed API request, with how long each one has been waiting (tracked from v0.3.0, shown in the web UI from v0.4.0).
  • Events and logs for each session (v0.4.0).
  • Tokens and cost (v0.4.0) by day, model and agent type (built-in agent names; your own agents show as custom unless you opt in to tool details) and by project (joined from the working directory that hooks report). Cost is an estimate that comes from Claude Code's telemetry, not the amount you are billed.
  • Health page: whether each part of the stack is up and receiving data (v0.4.0).
  • Grafana for deeper analysis, provisioned with its datasources (v0.2.0) and with dashboards that the app links to, already filtered to the session, agent or project you were looking at (v0.7.0).
  • Alerts (v0.6.0): browser notifications and, optionally, a Discord webhook when a session has been waiting on you for longer than a threshold, when API errors keep repeating, or when the estimated cost of a session or of a day goes over a limit. You set the thresholds with environment variables or on a settings screen.

How it works

Claude Code ──OTLP (4317/4318)──► OTel Collector ──► Prometheus (metrics)
     │                                         ├──► Loki (events/logs)
     │                                         └──► Tempo (traces, optional profile)
     └──hooks──► app (FastAPI) ──► SQLite (sessions, agents, blocks, alerts)
                    │  └─ /metrics ◄── scraped by Prometheus (live state)
                    └─ queries Prometheus and Loki over HTTP
Grafana ◄── Prometheus, Loki, Tempo (provisioned datasources and dashboards)
  • Telemetry. Claude Code's native OpenTelemetry support exports metrics, events and, optionally, traces over OTLP to an OpenTelemetry Collector. The collector removes personal attributes and sends metrics to Prometheus, events to Loki and traces to Tempo. Tempo runs only in an optional traces profile, because tracing is a beta feature in Claude Code.
  • Hooks. Claude Code hooks send lifecycle events (a prompt submitted, a permission request, a notification, a subagent starting or stopping, a compaction, the end of a session) to the app, a FastAPI service that keeps sessions, agents, blocks and alerts in SQLite.
  • Live state as metrics. The app exposes that live state on /metrics, which Prometheus scrapes, so it can be charted next to the telemetry.
  • The app also queries Prometheus and Loki over HTTP for its token, cost and event views.
  • Grafana comes provisioned with the Prometheus, Loki and Tempo datasources and with the dashboards.
  • Why both sources: telemetry tells you what a session consumed (tokens, cost, API calls, tool results) but not that it is waiting on you right now, which only hooks report, at the moment it happens.

More detail for contributors is in docs/architecture.md. The decisions behind this design, and their reasons, are recorded as architecture decision records in docs/adr/.

Quick start (planned, available from v0.5.0)

These steps do not work yet. The stack arrives in v0.2.0 and the setup command in v0.5.0.

  1. Start the stack:

    git clone https://github.com/Luanderson-Dev/cc-observatory
    cd cc-observatory
    docker compose up -d
    
  2. Connect Claude Code to it:

    uvx cc-observatory setup
    

    setup backs up ~/.claude/settings.json and merges in the telemetry env block and the hooks without touching your existing entries, marking what it adds so that ccobs uninstall removes only that; --dry-run shows the diff without writing anything.

  3. Open the app at the address that setup prints.

  4. Restart Claude Code so that new sessions load the new settings.

ccobs and cc-observatory are the same CLI; uvx cc-observatory <command> runs it without installing it.

Privacy

  • Metadata only by default. Prompt text, tool inputs and outputs, assistant messages and error text are not stored.
  • Content capture is an explicit opt-in. ccobs setup --capture-content shows a warning and then turns content capture on in Claude Code's telemetry settings and in the stack (the collector and the app). Without it, the collector drops content from the telemetry even if Claude Code was set to send it.
  • Personal attributes are removed. The collector deletes your email address and your user, account and organization IDs from the telemetry before anything is stored.
  • Everything stays on your machine. That is a design goal that the bundled configs enforce: every port binds to 127.0.0.1, and the usage reporting and update checks of Grafana, Loki and Tempo are turned off. At runtime, nothing leaves your machine except the optional Discord webhook, and only if you configure one.
  • Retention is configurable (the observability stack from v0.2.0, the app database from v0.3.0), so old data is deleted after the period you choose.

See SECURITY.md for the security model and how to report a vulnerability.

No interference with Claude Code

  • Hooks never change Claude Code's decisions. The app answers every hook call with an empty 2xx response, never with a decision, and setup gives every hook a short timeout.
  • If the stack is down, Claude Code keeps working. While the stack is down, Claude Code shows a hook-error notice in the transcript on most hook events (Claude itself does not see these notices). ADR 0011 explains this trade-off and how cc-observatory keeps it small: ccobs doctor checks that the hook endpoint answers and reports failing hooks, and ccobs uninstall removes the hooks.

Requirements (planned)

  • Docker with Compose v2 (Docker Desktop on Windows and macOS, or Docker Engine with the Compose plugin on Linux).
  • uv.
  • Claude Code 2.1.296 or later. That is the version cc-observatory was tested against (ADR 0012); older versions are not supported until they are tested.

Roadmap

Milestone Release Scope Status
0 v0.1.0 Foundation, tooling, CI, ADRs, telemetry and hooks spike, fixtures, first PyPI release Released
1 v0.2.0 Observability stack in compose, provisioned Grafana Planned
2 v0.3.0 Hook ingestion, session state machine, SQLite, blocks, /metrics Planned
3 v0.4.0 Web UI (HTMX + SSE) Planned
4 v0.5.0 ccobs setup, uninstall, doctor, status Planned
5 v0.6.0 Alerts (browser and Discord) Planned
6 v0.7.0 Grafana dashboards and polish Planned
7 v1.0.0 Distribution: GHCR multi-arch images, release hardening, contributor docs Planned

Development

You need uv; it installs the right Python version for you.

uv sync                            # create the virtualenv with the dev dependencies
uv run pre-commit install          # install the pre-commit and commit-msg hooks
uv run pytest                      # unit tests with the coverage gate
uv run mypy                        # strict type checks
uv run pre-commit run --all-files  # every check that the CI lint job runs
  • The project uses Gitflow. develop is the default branch: feature pull requests target develop and are squash-merged, and release pull requests go to main with merge commits.
  • The title of a feature pull request becomes its commit on develop (and, for feat, fix, refactor and perf, a changelog line), so every PR title must be a Conventional Commit (for example, feat: add the session state machine). CI checks it.
  • A contributor guide comes with v1.0.0.

Disclaimer

cc-observatory is an independent open-source project. It is not affiliated with, endorsed by or sponsored by Anthropic. "Claude" and "Claude Code" are trademarks of Anthropic, PBC.

License

MIT. Copyright (c) 2026 Luanderson Pimenta Mendes (Luanderson-Dev).

Metadata

Release files for cc-observatory 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cc-observatory 0.1.0
File Size Uploaded Provenance
cc_observatory-0.1.0.tar.gz 8.1 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for cc-observatory 0.1.0
File Interpreter ABI Platform
cc_observatory-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 16.6 kB

Release files / cc_observatory-0.1.0.tar.gz

Download URL cc_observatory-0.1.0.tar.gz
Size 8.1 kB
Tags Source
SHA-256 checksum
How to use checksums
c0dce401333d6214c79fa19ea08f9b88b296d79cce8568ac5974521bc20ad3a1
BLAKE2b-256 checksum
How to use checksums
53e49fda96ef23e39d63620bdecec45c12ac7caee5b762e9deff64a45a1193ef
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 14, 2026.

Transparency log

Release files / cc_observatory-0.1.0-py3-none-any.whl

Download URL cc_observatory-0.1.0-py3-none-any.whl
Size 8.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c9c64895dd79d527ddc858485263f204bc847358f972b80072a405c78edb8162
BLAKE2b-256 checksum
How to use checksums
3b60a42e77652799eebfc93ea177e20ee4645b9b554048574b90eee8bc870e11
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 14, 2026.

Transparency log

Security for cc-observatory 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for cc_observatory-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 14, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page