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_FULLFSYNCon 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 fromGET /api/v1/pricing/anthropicat 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c9c22db1e2fa93ba5262e0cd7661f17d9da61e1896cd5f4ecd71be8e57241a0e
|
|
| MD5 |
d7d688a19f550656363f43f8c22aaffe
|
|
| BLAKE2b-256 |
476827126d6b133817d3df698da2a0916731fb967d0d3f5613cc8a8ff5f6a1f9
|
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
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
meshai_claude_code-0.1.0.tar.gz -
Subject digest:
c9c22db1e2fa93ba5262e0cd7661f17d9da61e1896cd5f4ecd71be8e57241a0e - Sigstore transparency entry: 2088320654
- Sigstore integration time:
-
Permalink:
meshailabs-org/meshai-claude-code@5648a074612bbe7875394b6545d3918a5e1be6dd -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/meshailabs-org
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@5648a074612bbe7875394b6545d3918a5e1be6dd -
Trigger Event:
release
-
Statement type:
File details
Details for the file meshai_claude_code-0.1.0-py3-none-any.whl.
File metadata
- Download URL: meshai_claude_code-0.1.0-py3-none-any.whl
- Upload date:
- Size: 27.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9bacb504f36d20f40242d2c9b78ce8d4bd9d71d79ee9331d1ea37fda42beb3c3
|
|
| MD5 |
490a5776ac10b4a53b03ba9ea5951833
|
|
| BLAKE2b-256 |
dccec46f6dda1b781dc7f9b6c487af96130340bf1d55f571e1364f87ab98e3a4
|
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
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
meshai_claude_code-0.1.0-py3-none-any.whl -
Subject digest:
9bacb504f36d20f40242d2c9b78ce8d4bd9d71d79ee9331d1ea37fda42beb3c3 - Sigstore transparency entry: 2088320715
- Sigstore integration time:
-
Permalink:
meshailabs-org/meshai-claude-code@5648a074612bbe7875394b6545d3918a5e1be6dd -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/meshailabs-org
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@5648a074612bbe7875394b6545d3918a5e1be6dd -
Trigger Event:
release
-
Statement type: