Skip to main content

Treespeak

Flask drawn by Treespeak: a blue Python trunk, limbs per directory, each file a leaf in its technology's brand colours, outlined where it changed since June 2025
pallets/flask at 49943b5 (30 October 2026), growth since 1 June 2025: tree_watch.py --repo flask --since 2025-06-01 --png flask.png

"If the AI can communicate at terabits per second, and you're communicating at bits per second, it's like talking to a tree." — Elon Musk, Lex Fridman Podcast #438, 2 August 2024; first said at the World AI Conference, Shanghai, 29 August 2019.

This is the tree. Treespeak draws a git repository as a growing plant — directories as branches, files as leaves sized by written lines, hotspots by churn, growth rendered since a start date. Ships as a skill plus an MCP server for architecture-facts queries (fat files, thin or fat directories, hotspots, growth since start). A "file tree" button adds a classic directory list beside the drawing, hover-linked both ways.

A leaf wears its technology's brand: a natural leaf on its stalk, turned at its habit's angle, painted in the brand's colours with the brand's mark along the blade — Angular's red leaf with the white A, TypeScript's blue TS, JavaScript's yellow JS, Python's blue-and-yellow leaf with the two eyes, the C family's blues, Rust's gear, Go's cyan, Java's cup, Ruby's gem, React's atom, Vue's V, and some sixty more; a file of a technology the viewer does not know is the plain lens leaf. A brand that already has a leaf-like shape of its own keeps it, hung from the stalk by its flat edge and turned with the twig like every other leaf: Angular's, HTML5's and CSS3's shields, Vue's V, Ruby's gem. Size is still lines. The wood itself ends in rounded caps, so every joint is a smooth knee rather than a notch. Git state is the leaf's outline (green added, orange modified, blue moved, red deleted) and an untouched leaf is faded, so growth still reads. A limb's wood takes the brand colour of what the limb is mostly made of, so an Angular app is a red tree with a blue Python limb before any name is read, and a "Made of" card draws each technology's leaf beside its share, for the whole tree or the focused limb. Within a technology a file's role shapes the blade: a header or a declaration is a half leaf, a test has a toothed edge. Each technology family also keeps a twig habit (needles for the C family, pairs for the Java family, fronds for the web, scales for config, drooping for prose, broad for scripting). Hover a leaf and the tip shows its leaf and names its technology and role; hover a limb and it says what the limb is mostly made of. Zoom in and a tree under 2,500 parts is redrawn as vectors, so the leaves and their letters stay crisp. A directory's children fan out as a leader and sectors: the heaviest continues the parent's line, the rest alternate to either side by rank, each with room proportional to the square root of its file count, so a chain of single directories goes straight and a big subtree gets a big sector. A day's work turns no limb: each child's place is kept until the directory grows by a tenth, a newcomer takes the fan's edge, and the drawing keeps its scale while it still fits.

On a touch screen, a tap reveals what a hover reveals — the name of the leaf, branch or twig under the finger. A second tap on the same branch or twig focuses it, the way a click does with a mouse. A tap on empty ground clears. The tip stays inside the drawing box on every side.

Two zones: product and lab

plugin/ is the product: what the marketplace ships (source: ./plugin), whole, to any project that installs it — stdlib Python and git only. lab/ is the laboratory, whose front door is the workbench: the viewer's box (the tree drawing with the file-tree panel) wrapped by toolbars of orthogonal arguments, one realm per toolbar, redrawing live as controls move.

python3 lab/workbench.py --repo <path>

See lab/README.md for the lab's contract.

Install

claude plugin marketplace add NivDvir/treespeak
claude plugin install treespeak@treespeak-marketplace

After a version bump in plugin/.claude-plugin/plugin.json:

claude plugin marketplace update treespeak-marketplace
claude plugin update treespeak@treespeak-marketplace

Without Claude Code

The viewer is also a plain Python command, with no MCP server and no dependencies beyond git. From the git URL, with Python 3.7 or newer (the package is not on PyPI):

uvx --from git+https://github.com/NivDvir/treespeak treespeak --repo <path> --port 8770
pip install git+https://github.com/NivDvir/treespeak

The command takes the flags of the viewer run by hand. The MCP tools stay in the plugin.

Windows

Claude Code on Windows runs with Git for Windows, whose bash runs the plugin's launcher. A Python 3.10 or newer must answer as py, python or python3 for the MCP tools, since the mcp package needs it. The PNG export finds Chrome or Edge under Program Files or LocalAppData. The viewer is stopped with TerminateProcess. Windows support is built from the documentation and has not yet been run on a Windows machine.

The tree on every pull request (GitHub Action)

action.yml at this repository's root draws the repository in a workflow and puts the tree on the pull request as a comment, light and dark, refreshed on every push to the branch. Growth is measured from where the branch left the default branch, so the outlines show what the pull request touches.

name: treespeak
on: pull_request
permissions:
  contents: write        # the images are committed to the treespeak-images branch
  pull-requests: write   # the comment
jobs:
  tree:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0   # growth needs the history
      - uses: NivDvir/treespeak@main

On a push (say to main), the action publishes latest/light.png and latest/dark.png on the treespeak-images branch instead, at fixed addresses a README can show:

![tree](https://github.com/<owner>/<repo>/blob/treespeak-images/latest/light.png?raw=true#gh-light-mode-only)
![tree](https://github.com/<owner>/<repo>/blob/treespeak-images/latest/dark.png?raw=true#gh-dark-mode-only)

The images live on their own branch, which holds nothing else and can be deleted at any time; the default branch is never written to. A pull request from a fork gets a read-only token, so there the images are only kept as the run's artifact. The runner needs Python 3.7 or newer and Chrome or Chromium, both already on GitHub's ubuntu-latest.

Input Meaning
mode auto (comment on a pull request, publish on a push), comment, publish, or none (only draw, keep the artifact).
since branch, tag, ref:<rev>, a date, or config. Empty: .treespeak.json when it sets since or start, else branch on a pull request and tag otherwise.
path The repository to draw; default ..
width, height, scale As --width, --height, --scale; default 1600, 1000, 2.
padding Transparent margin kept around the tree in CSS pixels; default 40, -1 keeps the whole window.
images-branch Where the images are committed; default treespeak-images.
folder With publish, the folder on that branch; default latest.
artifact Name of the run artifact holding the PNGs; default treespeak, empty for none.
github-token Default the job's token.

Outputs: light, dark (local paths), light-url, dark-url, comment-url.

Run the viewer by hand

python3 plugin/server/tree_watch.py --repo <path> --port 8770
Flag Meaning
--repo Repository to draw; defaults to the working directory.
--port Port to listen on; overrides the config file.
--start Growth start YYYY-MM-DD HH:MM; overrides the config file.
--since Measure growth from a commit instead of a date: branch, tag, ref:<rev>, or a date; overrides start and the config file.
--config Config file elsewhere than <repo>/.treespeak.json.
--facts Print the facts JSON and exit, no server.
--init Print the proposed .treespeak.json and the heavy directories as JSON and exit, no server.
--static Print a self-contained snapshot page, data inlined and no live updates, and exit, no server. Redirect it to a file.
--png Write the drawing to this PNG file through a headless Chrome and exit, no server left running.
--width With --png: the window width in CSS pixels; default 1600.
--height With --png: the window height in CSS pixels; default 1000.
--scale With --png: the pixel ratio; default 2, so the file is width*scale by height*scale.
--theme With --png: light or dark; default the system's.
--focus With --png: start focused on this directory.

The MCP tools

  • tree_start(repo, port, since) — start the viewer, return its URL.
  • tree_status(repo) — running or not, on which port, what it last drew; also sees a viewer a launcher or a hand-run command already started on the repo's configured port.
  • tree_stop(repo) — stop the viewer this plugin started.
  • tree_snapshot(repo, facts, files, since, path, limit, depth) — the facts alone, without a server; compact by default: each list cut to limit (20), directories to depth (2) levels, path narrows everything to one directory, counts says how many entries each list had before the cut; limit=0, depth=0 gives everything.
  • tree_export(repo, path, width, height, scale, theme, focus) — write the drawing to a PNG; by default tree.png under the repo's state dir, never into the repository.
  • tree_init(repo, write) — propose a .treespeak.json (trunk, port, and skip for directories that are mostly data, generated or vendored), list those heavy directories, and give the launch.json recipe; write=True writes the file when none exists.

Embedding the drawing under another interface

The drawing is meant to sit behind a list that already exists, a file browser or a repository page. Open the page with ?bare=1 and it shows the canvas alone: no header, breadcrumb, counts, cards, zoom buttons or file tree, and a transparent background, so only wood, leaves and marks are drawn over whatever is underneath. Hover, click to focus, Escape and Tab still work. The same query works on a --static page opened from a file.

Query Meaning
bare=1 The canvas alone, on a transparent background.
theme=light or theme=dark Force the theme; without it the page follows the system.
focus=<directory> Start focused on that directory, as a click on it would.
scale=<number> The pixel ratio of the PNG button's file; default the screen's.
host=<origin> The one origin the bridge below talks to, e.g. https://github.com; without it the bridge is off.

A page in a frame named by host talks to its parent with postMessage. Every message carries type: 'treespeak'.

The parent sends:

  • {type: 'treespeak', action: 'hover', path} lights the leaf or branch at path, as a mouse hover would.
  • {type: 'treespeak', action: 'clear'} clears the hover.
  • {type: 'treespeak', action: 'focus', path} focuses that directory.
  • {type: 'treespeak', action: 'export', format: 'png', scale} asks for the canvas; the page answers the sender with {type: 'treespeak', event: 'export', dataURL}.

The page sends its parent:

  • {type: 'treespeak', event: 'hover', path, kind} whenever the hover changes; kind is 'leaf', 'branch', 'twig' or null.
  • {type: 'treespeak', event: 'focus', path} whenever the focus changes.
  • {type: 'treespeak', event: 'ready', name, tracked} once, after the first snapshot is drawn.

Without host the bridge is off: the page posts nothing, not even ready, and ignores every message. With host it posts only to that origin and hears only messages from it, so another website that frames the page learns nothing. host=null is for a host page opened from a file, whose origin is null; it is the weakest setting, since any page with a null origin can talk to it.

To get a picture instead, the PNG button beside the zoom buttons downloads the canvas as <trunk name>.png, on the page's background colour (transparent with bare=1). From the command line, --png <file> writes the bare drawing and exits; for Claude, tree_export does the same. Both need a Chrome or Chromium on the machine; none is bundled. They look for TREESPEAK_BROWSER first, then Chrome or Chromium in /Applications on macOS, then google-chrome, google-chrome-stable, chromium and chromium-browser on the PATH. Without one, --png exits with status 2 and tree_export returns an error; the page's button still works.

Both draw a snapshot, not the live page. The live page keeps an event stream open, and headless Chrome's virtual clock waits on any open fetch, so a screenshot of it would never be taken; the export serves the snapshot page, without the stream, on a free loopback port for the length of the shot. When a viewer already runs, tree_export draws what that viewer last served. The window is passed to Chrome as --window-size=W,H: Chrome misreads the WxH form.

.treespeak.json at a repository's root

A repository configured before Treespeak keeps its .growing-tree.json: it is still read when .treespeak.json is absent.

Key Default Meaning
port 8770 Port the viewer listens on.
start first run, remembered under the state dir Growth is measured from this YYYY-MM-DD HH:MM.
since absent Measure growth from a commit instead of a date: branch (the merge base with the default branch), tag (the nearest tag), ref:<rev>, or a date. Overrides start. A preset that cannot resolve falls back to start. An explicit --start or --since on the command line beats the file.
trunk the repo folder name Name on the trunk; the browser tab reads <trunk> · Treespeak.
skip [] Path prefixes left out entirely.
skip_segments node_modules, dist, build, .build, .angular, target, venv, .venv, __pycache__, .pytest_cache, .ruff_cache Directory names left out at any depth.
keep [] Globs rescued from skip and skip_segments.
kinds generated, vendored, data Per kind, names / suffixes / segments / prefixes; a kind given here replaces that kind's defaults whole.
leaf_cap 24 Direct files above which a directory counts as fat. A directory in the top 5 % by authored lines (at least one) counts as fat too.
warn_lines 400 Lines above which a file gets the red rim and counts as fat.
max_read 2097152 Bytes read per file when counting lines.

A worked example, for a repo with an Angular front end, a Swift back end and a corpus:

{ "start": "2026-09-05 17:40", "port": 8770, "trunk": "reticle-access",
  "skip": ["angular/node_modules/", "swift/.build/", "angular/dist/", "angular/.angular/", "data/"],
  "keep": ["data/*/baseline/*"],
  "kinds": {
    "generated": {"names": ["package-lock.json", "Package.resolved"], "suffixes": [".lock", ".min.js", ".min.css"], "segments": ["dist", ".angular"]},
    "vendored":  {"prefixes": [".vale/styles/ai-tells/", ".vale/styles/ai-tells-commits/", "angular/tools/"]},
    "data":      {"prefixes": ["corpus/", "data/", "tests/fixtures/"], "suffixes": [".png", ".jpg", ".pdf"]} },
  "leaf_cap": 24, "warn_lines": 400, "max_read": 2097152 }

The viewer as a project's preview server

A project that wants the tree in its Browser pane adds to its .claude/launch.json:

{ "version": "0.0.1", "configurations": [
  { "name": "tree", "runtimeExecutable": "/Users/<you>/.treespeak/bin/treespeak",
    "runtimeArgs": ["--repo", "/path/to/the/project", "--port", "8770"],
    "port": 8770 } ] }

~/.treespeak/bin/treespeak (treespeak.cmd on Windows) is a one-line launcher the MCP server rewrites every time it starts, so it always points at the installed plugin and survives version bumps; write the home directory out in full. tree_init returns this recipe filled in.

State on disk

~/.treespeak/venv/                 the mcp dependency, bootstrapped on first run
~/.treespeak/bootstrap.log         what that bootstrap printed
~/.treespeak/bin/treespeak          the launcher shim, rewritten at every MCP server start
~/.treespeak/<repo-id>/start       the growth start date, written once
~/.treespeak/<repo-id>/viewer.pid  the running viewer, its port and its log
~/.treespeak/<repo-id>/viewer.port
~/.treespeak/<repo-id>/viewer.log

An existing ~/.the-growing-tree is moved to ~/.treespeak on first run, venv and start dates with it.

<repo-id> is the repository's folder name plus a hash of its real path, so two checkouts of one project keep separate state.

Design record

The drawing itself — layout, colours, geometry, interaction — changes only on the owner's word.

License

Treespeak is source-available under the PolyForm Noncommercial License 1.0.0. It may be used, changed and shared for any noncommercial purpose: personal use, study, research, and use by charities, schools and other noncommercial organizations. Commercial use needs a separate license from the copyright holder; ask through github.com/NivDvir.

Metadata

Release files for treespeak 0.8.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for treespeak 0.8.5
File Interpreter ABI Platform Actions
treespeak-0.8.5-py3-none-any.whl Python 3 none any Details for treespeak-0.8.5-py3-none-any.whl

Release files / treespeak-0.8.5-py3-none-any.whl

Download URL treespeak-0.8.5-py3-none-any.whl
Size 46.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7e14effc071d777db63bf9ea75242bb7c1dccd8581e2874725bc67dec4f3dbc8
BLAKE2b-256 checksum
How to use checksums
a3c8d7b33db372fa3503cb68248648e2ad80568fd3cc2abc5a87dfed99df6a81
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Dec 4, 2026.

Transparency log

Security for treespeak 0.8.5

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

1 file in this release has been uploaded with provenance metadata.

Attestation for treespeak-0.8.5-py3-none-any.whl

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 Dec 4, 2026.

Transparency log

A 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.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.8.5 This release

1 release file Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page