Skip to main content

CLI Reference

Full documentation for the treeship command-line tool.

Installation

npm install -g treeship-cli

Configuration

Environment Variables

export TREESHIP_API_KEY=your-api-key      # Required for attest
export TREESHIP_AGENT=my-agent            # Default agent slug
export TREESHIP_API_URL=https://api.treeship.dev  # API endpoint

Config File

treeship config set api-key your-api-key
treeship config set default-agent my-agent
treeship config list

Commands

treeship attest

Create a cryptographic attestation.
treeship attest --action "Description" --inputs-hash "sha256..."
Options:
OptionDescriptionRequired
--action <text>Description of the actionYes
--inputs-hash <hash>SHA256 hash of inputsYes
--agent <slug>Agent slug (or use TREESHIP_AGENT)No
--publicMake attestation public (default)No
--privateMake attestation privateNo
--zkEnable ZK proof for privacyNo
--tools <tools...>Tools used in this actionNo
--human-approvedMark as human-approvedNo
--approver <hash>Hash of approver identityNo
--jsonOutput as JSONNo
--quietOutput only the verification URLNo
Examples:
# Basic attestation
treeship attest \
  --action "Processed order #123" \
  --inputs-hash "abc123..."

# With tool verification
treeship attest \
  --agent my-agent \
  --action "Sent report via email" \
  --inputs-hash "def456..." \
  --tools read_file send_email

# With human approval
treeship attest \
  --action "Released payment of $10,000" \
  --inputs-hash "ghi789..." \
  --human-approved \
  --approver "sha256-of-manager-email"

# Private attestation
treeship attest \
  --action "Internal audit completed" \
  --inputs-hash "jkl012..." \
  --private

# JSON output for scripts
treeship attest \
  --action "..." \
  --inputs-hash "..." \
  --json

treeship verify

Verify an attestation by ID.
treeship verify <attestation-id>
Options:
OptionDescription
--jsonOutput as JSON
--quietOutput only “valid” or “invalid”
Examples:
# Standard verification
treeship verify abc123-def456-ghi789

# JSON output
treeship verify abc123-def456-ghi789 --json

# Script-friendly (exits 0 if valid, 1 if invalid)
treeship verify abc123-def456-ghi789 --quiet

treeship whoami

Show current configuration.
treeship whoami
Output:
Treeship CLI

  API URL   https://api.treeship.dev
  API Key   set
  Agent     my-agent

  Feed      https://treeship.dev/verify/my-agent

treeship identity

Manage agent identity and verification.

identity register

Register or update agent identity.
treeship identity register --agent my-agent --code-hash "sha256..." --model-id "gpt-4-turbo"
Options:
OptionDescriptionRequired
--agent <slug>Agent slugYes
--name <name>Human-readable nameNo
--description <text>Agent descriptionNo
--code-hash <hash>SHA256 of agent codeNo
--model-id <id>AI model identifierNo
--domain <domain>Domain to verifyNo
--public-key <file>Path to Ed25519 public keyNo
--jsonOutput as JSONNo

identity info

Get agent identity information.
treeship identity info --agent my-agent
Output:
Agent: my-agent
  Name           My AI Agent
  Identity Score 75/100
  Code Hash      e3b0c442...
  Model          gpt-4-turbo
  Domain         ✓ agent.example.com

  Verified Proofs:
    ✓ domain: agent.example.com

  Authorized Tools:
    • read_file
    • send_email
    • search_web

identity set-tools

Set authorized tools for an agent.
treeship identity set-tools --agent my-agent --tools read_file send_email search_web

identity verify-tools

Verify tools are authorized.
treeship identity verify-tools --agent my-agent --tools read_file delete_database
Output:
✗ Unauthorized tools detected

  Authorized:
    ✓ read_file
  Unauthorized:
    ✗ delete_database

treeship config

Manage CLI configuration.
treeship config set <key> <value>
treeship config get <key>
treeship config list
treeship config reset
Keys:
KeyDescription
api-keyAPI key for authentication
api-urlAPI base URL
default-agentDefault agent slug

Exit Codes

CodeMeaning
0Success
1Error or verification failed

Scripting Examples

# Create attestation and capture URL
URL=$(treeship attest --action "Deploy" --inputs-hash "..." --quiet)
echo "Attestation: $URL"

# Verify in CI/CD
if treeship verify $ATTESTATION_ID --quiet; then
  echo "Verified!"
else
  echo "Verification failed!"
  exit 1
fi

# Process JSON output
treeship attest --action "..." --inputs-hash "..." --json | jq '.attestation_id'