Skip to main content

OTel-native MeshAI connector for Claude Code — durable, evidence-grade telemetry for AI coding agent activity

Project description

meshai-claude-code

OTel-native MeshAI connector for Claude Code: durable, evidence-grade telemetry for AI coding agent activity, aimed at EU AI Act Article 12 record-keeping. Every hook event is fsynced to a local write-ahead log before anything else happens; a daemon publishes the WAL to MeshAI over OTLP. Daemon crash, OOM, or network outage cannot lose events — only disk failure can.

Platforms (v1): macOS, Linux, and WSL. On WSL the state directory must live in the Linux filesystem (it does by default: ~/.local/state/meshai-cc); the daemon refuses to run against /mnt/c (DrvFS/9p), where fsync and file locks do not hold. Native Windows support (TCP loopback) is v2.

Install

pip install meshai-claude-code
meshai-claude-code login --api-key msh_...
meshai-claude-code install     # registers hooks in ~/.claude/settings.json

The daemon starts automatically on the next Claude Code session (auto_start_daemon: true), or run meshai-cc-daemon yourself. Check health with meshai-claude-code status.

Architecture

                fsync                    tail              OTLP POST
  ┌──────┐  event ┌──────┐    nudge   ┌────────┐         ┌────────────┐
  │ hook │───────▶│ WAL  │◀───────────│ daemon │────────▶│ MeshAI API │
  └──────┘        └──────┘            └────┬───┘         └────────────┘
                                      1s poll backstop
  • Hooks (meshai-cc-hook <Event>) are registered for SessionStart, UserPromptSubmit, PreToolUse, PostToolUse, PreCompact, and Stop. Each one appends a CRC-framed record to the WAL with a real fsync (F_FULLFSYNC on macOS) and exits — p99 under 50ms, CI-enforced.
  • The WAL lives at ~/.local/state/meshai-cc/wal/ (owner-only). Hooks own writes and rotation; the daemon is a pure reader.
  • The daemon (one per user, PID-file flock) converts events to OpenTelemetry spans and exports OTLP/HTTP protobuf to MeshAI. Offsets advance only after a successful export: delivery is at-least-once, and span ids are minted once at hook time, so MeshAI's ingest dedup makes accounting exactly-once.
  • Usage & cost: on session Stop, the transcript is parsed for per-turn token usage, emitted with gen_ai.* attributes MeshAI turns into cost rows. Pricing comes from GET /api/v1/pricing/anthropic at daemon startup, with a bundled offline fallback.

What leaves your machine (default: metadata only)

Tool content (tool_input/tool_output) is dropped by default. Structural metadata (event type, tool name, timing, token counts) always flows. Opt in per tool in ~/.config/meshai/filters.yaml:

tools:
  Bash:
    allow: [tool_input]

Allowlisted content passes through the MeshAI SDK's secret-redaction pipeline (API keys, JWTs, private-key blocks, homoglyph and base64-wrapped variants) and fails closed on any doubt. Filtering happens at emission in the daemon; the WAL itself is owner-only local state.

Compliance mode

# ~/.config/meshai/policy.yaml
fail_closed: true    # WAL append failure blocks Claude Code (exit 2)
agent_name: my-cc    # registry identity; default claude-code-<hostname>
base_url: https://api.meshai.dev

With fail_closed: true, no evidence means no action — a tool call that cannot be durably recorded does not run.

Development

pip install -e ".[dev]"
pytest -q            # includes Hypothesis WAL property tests + latency gate
ruff check src/ tests/

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

meshai_claude_code-0.1.0.tar.gz (29.3 kB view details)

Uploaded Source

Built Distribution

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

meshai_claude_code-0.1.0-py3-none-any.whl (27.1 kB view details)

Uploaded Python 3

File details

Details for the file meshai_claude_code-0.1.0.tar.gz.

File metadata

  • Download URL: meshai_claude_code-0.1.0.tar.gz
  • Upload date:
  • Size: 29.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for meshai_claude_code-0.1.0.tar.gz
Algorithm Hash digest
SHA256 c9c22db1e2fa93ba5262e0cd7661f17d9da61e1896cd5f4ecd71be8e57241a0e
MD5 d7d688a19f550656363f43f8c22aaffe
BLAKE2b-256 476827126d6b133817d3df698da2a0916731fb967d0d3f5613cc8a8ff5f6a1f9

See more details on using hashes here.

Provenance

The following attestation bundles were made for meshai_claude_code-0.1.0.tar.gz:

Publisher: publish.yml on meshailabs-org/meshai-claude-code

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

File details

Details for the file meshai_claude_code-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for meshai_claude_code-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9bacb504f36d20f40242d2c9b78ce8d4bd9d71d79ee9331d1ea37fda42beb3c3
MD5 490a5776ac10b4a53b03ba9ea5951833
BLAKE2b-256 dccec46f6dda1b781dc7f9b6c487af96130340bf1d55f571e1364f87ab98e3a4

See more details on using hashes here.

Provenance

The following attestation bundles were made for meshai_claude_code-0.1.0-py3-none-any.whl:

Publisher: publish.yml on meshailabs-org/meshai-claude-code

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