Treeship
Integrations

Claude Code

Add Treeship to Claude Code for signed, verifiable session receipts of every tool call and command.

Claude Code integration uses the instruction boundary pattern: add TREESHIP.md to your project root and Claude Code follows the instructions to wrap commands, track costs, and produce verifiable receipts.

Quick setup

Install Treeship CLI

curl -fsSL treeship.dev/install | sh
treeship init

Add TREESHIP.md to your project

Copy the skill file from the Treeship repo:

curl -o TREESHIP.md https://raw.githubusercontent.com/zerkerlabs/treeship/main/TREESHIP.md

Claude Code reads TREESHIP.md automatically when it exists in the project root.

Start a session

Claude Code will follow the TREESHIP.md instructions to start a session, wrap commands, and close with a narrative. You can also start manually:

treeship session start --name "my task"

How it works

Claude Code's built-in tools (read_file, write_file, bash, search) are not MCP server tools. They run inside the Claude Code runtime. Treeship captures them through the command wrapping pattern:

  1. Claude Code reads TREESHIP.md from the project root
  2. The skill instructs Claude Code to prefix every shell command with treeship wrap --
  3. Each wrapped command produces a signed artifact with the command string, exit code, duration, and output digest
  4. At session close, all artifacts are composed into a Session Receipt with a Merkle root

Environment variables for rich receipts

Set these before starting Claude Code to capture model and cost data:

export TREESHIP_MODEL=claude-opus-4-6
export TREESHIP_TOKENS_IN=12000
export TREESHIP_TOKENS_OUT=3000
export TREESHIP_COST_USD=0.42

These flow into the receipt's agent table showing model, token counts, and cost per interaction.

Live monitoring

While Claude Code is working, watch the session in real time from another terminal:

treeship session status --watch

This shows a live TUI with agents, events, security status, and verification progress updating every 2 seconds.

What appears in the receipt

SectionContentCapture method
Agent identity"treeship-cli", model name, hostTREESHIP_MODEL env var [AUTO]
TimelineEvery wrapped command in ordertreeship wrap events [AUTO]
CommandsFull command strings with exit codesProcess events [AUTO]
File operationsCreated/modified/deleted filesFile snapshot diff [AUTO]
CostModel, tokens, cost per wrapEnv vars [EXPLICIT]
NarrativeHeadline, summary, reviewCLI flags at close [EXPLICIT]

Claude Code's file reads (when it reads source code to understand context) are NOT captured through wrapping. To capture file reads, run treeship daemon start before the session. The daemon uses atime-based detection for sensitive files (.env, .ssh, .aws).

Attach to Hub for shareable receipts

treeship hub attach --endpoint https://api.treeship.dev

Follow the device code flow to authenticate. Then after any session:

treeship session report

This uploads the receipt and prints a permanent public URL like https://treeship.dev/receipt/ssn_xxx.

Integration patterns

PatternWhat it capturesSetup
TREESHIP.md in project rootShell commands via wrappingDrop-in, zero config
treeship daemon startSensitive file reads via atimeOne command
TREESHIP_MODEL env varModel, tokens, costEnvironment setup
treeship session status --watchLive monitoringSeparate terminal

What is NOT captured

  • Claude Code's internal tool calls (read_file, write_file, search): these happen inside the runtime and are not shell commands. They don't go through treeship wrap.
  • Network connections: not auto-captured. Use treeship session event --type agent.connected_network explicitly.
  • Multi-agent handoffs: only captured if agents explicitly emit handoff events.

The TREESHIP.md skill is honest about this boundary. The receipt proves what was instrumented, not everything the agent did.