TreeTrace
Documentation

GET STARTED

TreeTrace runs in any repo after an AI coding session. It reads local transcripts, writes a structured record, and never touches the network. Node.js 18 or newer, zero runtime dependencies, no accounts.

$cd your-project && npx treetrace
01 · Install

Install

There is nothing to install globally. TreeTrace ships with no runtime dependencies, so npx treetrace needs nothing else on your machine. No accounts, no uploads, no telemetry. Your transcripts never leave your machine.

Run it with npx

From inside the project you want to trace:

terminal
cd your-project
npx treetrace

Node 18+ required. Claude Code sessions are discovered automatically from your local history. Other tools (Codex, Cursor, Copilot, Gemini, Grok, ChatGPT export, or a plain transcript) import with --file and an optional --from.

Or run it in CI with the GitHub Action

To regenerate the report in a pull request from a committed transcript or a committed .treetrace/tree.json, add the action to a workflow. See the GitHub Action below for the full YAML.

02 · Quickstart

Quickstart

Trace your last session, then read it in your terminal. The same run writes the machine-readable artifacts into .treetrace/.

1. Trace the current project

Writes TREETRACE_REPORT.md, PROMPT_TREE.md, and the .treetrace/*.json lineage from your local Claude Code history.

terminal
npx treetrace

2. Print the human report in the terminal

Good for a Codex CLI, Claude Code, or SSH session where you want the report in the window. --redact-auto redacts every detected secret without prompting, which is what you want outside an interactive shell.

terminal
npx treetrace --report --redact-auto

3. Import another tool's session

Pass a .json or .jsonl file and the format is auto-detected; force it with --from. A pasted User: / Assistant: transcript works on --stdin.

terminal
npx treetrace --from chatgpt --file conversations.json
npx treetrace --stdin < chat.txt

4. Hand the next agent its lessons

Start a read-only MCP server over stdio, or print a continuation brief to stdout for the next session.

terminal
npx treetrace --handoff
npx treetrace mcp
03 · CLI reference

CLI command reference

Every command runs locally and passes the same redaction gate before anything is written or printed. The graph modes (--graph, --full, --summary) return early and do not compose with --report; run the graph as its own invocation.

CommandWhat it does
Core
npx treetraceTrace this project and write all artifacts.
npx treetrace --reportWrite all artifacts and print the human report.
npx treetrace --handoffPrint an agent-ready continuation brief.
npx treetrace --securityPrint a security-focused report and write .treetrace/hallucinations.json.
Import sources
npx treetrace --file session.jsonlImport specific session or transcript files (format auto-detected).
npx treetrace --from chatgpt --file conversations.jsonImport another tool's export with an explicit format.
npx treetrace --stdin < chat.txtParse a pasted User: / Assistant: transcript.
npx treetrace --since 2026-06-01Limit to sessions on or after a date.
Targeted artifacts
npx treetrace --failuresWrite and print .treetrace/failures.json.
npx treetrace --rejectionsWrite and print .treetrace/rejections.json.
npx treetrace --lessonsWrite and print .treetrace/lessons.md.
npx treetrace --evalsWrite and print .treetrace/evals.jsonl.
npx treetrace --memoryWrite and print .treetrace/agent-memory.md.
Graph & output modes
npx treetrace --graphWrite PROMPT_TREE_GRAPH.md, a branded Mermaid graph that renders free on GitHub; large projects auto-summarize.
npx treetrace --titles-onlyCompact human tree, no full prompt details.
npx treetrace --eachWrite one full report bundle per session into --out-dir (default treetrace-reports/), with INDEX.md and index.json.
npx treetrace --deterministicPin the generation timestamp so re-running on the same session is byte-identical.
Privacy & integration
npx treetrace --redact-autoRedact every detected secret without prompting (used automatically outside a TTY).
npx treetrace mcpStart a read-only Model Context Protocol server over stdio.

Tip. For both terminal output and a shell-captured copy, pipe it: npx treetrace --report --redact-auto | tee treetrace-output.md.

04 · GitHub Action

GitHub Action

TreeTrace ships a composite action. Session logs live on dev machines, not in CI, so the typical use is regenerating the report in a pull request from a committed transcript or a committed .treetrace/tree.json, and optionally posting it as a PR comment.

Inputs

InputDefaultDescription
source''Path to a committed transcript file (.jsonl or plain text). When set, it runs treetrace --file on it.
comment-pr'false'Post the tree summary as a PR comment. Requires GITHUB_TOKEN.

Workflow example

Add this to .github/workflows/treetrace.yml:

.github/workflows/treetrace.yml
name: TreeTrace

on:
  pull_request:

permissions:
  contents: read
  pull-requests: write

jobs:
  treetrace:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: '20'
      - uses: TreeTraceTool/TreeTrace@v1
        with:
          source: .treetrace/session.jsonl
          comment-pr: 'true'

No source? If source is empty, the action uses a committed .treetrace/tree.json when present; commit TREETRACE_REPORT.md and PROMPT_TREE.md alongside it so the report renders. With nothing to read, the step is a no-op.

05 · Config

Config

TreeTrace is configured entirely by flags. There is no config file and nothing to set up. The defaults are local-first and fail-closed.

Where it reads from

  • Claude Code sessions are discovered automatically from ~/.claude/projects/…, no flags needed.
  • Other tools import with --file (format auto-detected) or are forced with --from <tool>: codex, chatgpt, cursor, copilot, gemini, grok, transcript.
  • Pasted text is read on --stdin as a User: / Assistant: transcript.
  • Date filter: --since YYYY-MM-DD limits to sessions on or after a date.

What it writes

TREETRACE_REPORT.mdCombined human-readable report for review and chat handoff.
PROMPT_TREE.mdHuman-readable narrative of the build path.
.treetrace/tree.jsonCanonical machine-readable lineage (v0.3 schema).
.treetrace/lessons.mdHuman-readable lessons for future work.
.treetrace/evals.jsonlGeneric, model-agnostic eval cases.
.treetrace/agent-memory.mdCompact memory pack for the next agent.

Privacy & determinism

  • Redaction gate. Every export is shadow-scanned before write. In a TTY each unique hit is reviewed interactively; outside a TTY redaction is automatic, or force it with --redact-auto.
  • Reproducible output. --deterministic pins the generation timestamp so re-running on the same session produces byte-identical artifacts.
  • Per-session bundles. --each writes one bundle per session into --out-dir (default treetrace-reports/), each auto-redacted and failing closed.
  • Zero network, zero deps. No accounts, no uploads, no telemetry. Node.js 18+ is the only requirement.