meshai-claude-code
MeshAI · Why durable telemetry · PyPI
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
Install with pipx. It puts the connector in its own
isolated environment and exposes the meshai-claude-code, meshai-cc-hook,
and meshai-cc-daemon commands on your PATH, which is what Claude Code needs
to run the hooks.
pipx install meshai-claude-code
meshai-claude-code login --api-key msh_...
meshai-claude-code install # registers hooks in ~/.claude/settings.json
If you do not have pipx: sudo apt install pipx (or brew install pipx),
then pipx ensurepath and restart your shell.
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.
Plain
pip install meshai-claude-codealso works inside a virtual environment. On a system Python it fails witherror: externally-managed-environment(PEP 668) on modern Debian, Ubuntu, and Homebrew. Use pipx, a venv, orpip install --break-system-packagesif you understand the tradeoff.
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, with a p99 under 50ms that CI enforces. - 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/
Metadata
Release files for meshai-claude-code 0.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| meshai_claude_code-0.2.1.tar.gz | 40.0 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| meshai_claude_code-0.2.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 71.8 kB
Release files / meshai_claude_code-0.2.1.tar.gz
| Download URL | meshai_claude_code-0.2.1.tar.gz |
|---|---|
| Size | 40.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9dbe8836bb48d2b545d153efd398b3018344b4a76f051a4e336e6d00c5395b80
|
|
BLAKE2b-256 checksum How to use checksums |
b431948baef8df4773f7fd0a468b070a4a75eaec0103d981d27dd43439adcc0a
|
| 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 Aug 11, 2026.
Transparency logRelease files / meshai_claude_code-0.2.1-py3-none-any.whl
| Download URL | meshai_claude_code-0.2.1-py3-none-any.whl |
|---|---|
| Size | 31.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7198c07e581ca2c351f689f2169f4b50bc134765699fb91aedf9a3a80117a27d
|
|
BLAKE2b-256 checksum How to use checksums |
b19a972a8b7c11695e637c03a5ef6a6a6c8db994f17ae1c614580713b968e285
|
| 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 Aug 11, 2026.
Transparency logSecurity for meshai-claude-code 0.2.1
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.
Attestation for meshai_claude_code-0.2.1.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 Aug 11, 2026.
Transparency logA 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.