Skip to main content

Turn Claude Code plan mode into a visual design tree - verify it against your code and embed it in PRs.

Project description

cc-plan-tree 🌳

Turn Claude Code's plan mode into a visual design tree — see every design decision (including the options you didn't take), verify the finished code still matches the design, and embed the tree right in your pull request.

flowchart TD
  root["Add JWT authentication"]
  root --> d{"Where to store the refresh token?"}
  d --> o1["HttpOnly cookie"]
  d -.-> o2["✗ localStorage"]
  o1 --> s1["✓ Set cookie flags (Secure, SameSite)"]
  root --> p["Backend"]
  p --> s2["✓ Auth middleware verifying JWT"]
  p --> s3["… POST /login and /refresh endpoints"]
  classDef rejected fill:#f1f5f9,stroke:#94a3b8,color:#64748b,stroke-dasharray: 4 3
  class o2 rejected

Why

Plan mode produces walls of text. The design decisions — "we considered localStorage but chose HttpOnly cookies because of XSS" — vanish the moment the session ends. cc-plan-tree keeps them:

  • 🌳 Plans become trees. Phases, steps, and every clarifying question as a decision node with chosen/rejected options.
  • 🔍 Design ⇄ code verification. Before your PR is ready, /plan-verify checks each step of the tree against the actual diff and reports what matches, diverges, or is missing.
  • 📎 Lives in your PR. The tree is embedded in the PR body as Mermaid — GitHub renders it natively, reviewers see the design at a glance.
  • 🖼️ PNG export for docs, Slack, and anywhere Mermaid doesn't render.

Install

# with uv (recommended)
uv tool install cc-plan-tree
cc-plan-tree init            # installs the slash commands into ~/.claude/commands

# or with pip
pip install cc-plan-tree && cc-plan-tree init

# or zero-install, one shot
uvx cc-plan-tree init

Use cc-plan-tree init --project to install into the current project's .claude/commands instead.

Upgrading

init copies the slash commands into .claude/commands, so after upgrading the package, re-run init to refresh them:

uv tool upgrade cc-plan-tree && cc-plan-tree init   # pip: pip install -U cc-plan-tree

From source:

git clone https://github.com/natsu0529/cc-plan-tree
cd cc-plan-tree && pip install -e . && cc-plan-tree init

Workflow

Inside Claude Code:

Command What it does
/plan-tree <task> Plans the task. Clarifying questions become decision nodes (rejected options stay visible, greyed out). The plan is saved to .cc-plan-tree/plan.json and opened as an interactive HTML tree (collapsible nodes, hover a rejected option to see why). Approve it and implementation starts; step statuses update as work completes.
/plan-verify Diffs the branch against the design tree. Reports ✅ matches / ⚠️ diverges / ❌ missing per node. On divergence you choose: fix the code, or fix the tree. When consistent, it offers to embed the tree into the PR body via gh (with your confirmation).
/plan-export [path] Renders the tree to PNG (default ./plan-tree.png). No headless browser — pure Pillow.

The CLI also works standalone:

cc-plan-tree render .cc-plan-tree/plan.json --format mermaid   # stdout
cc-plan-tree render --format html --out design.html            # interactive, self-contained
cc-plan-tree render --format svg --out design.svg
cc-plan-tree render --format png --out design.png

Plan file format

.cc-plan-tree/plan.json is a nested tree of nodes:

type meaning
goal The root: what is being built
phase A group of steps
step Concrete work item, carries status: pending / in_progress / done
decision A design question that was asked
option An answer to a decision; chosen: true/false, rejected ones keep a reason
note Free-form annotation

See examples/sample-plan.json for a full example.

Roadmap

  • Adapters for other coding agents (Codex CLI, Gemini CLI) via the shared plan format
  • Plan version diffing (what changed between plan v1 and what shipped)
  • Interactive HTML view (--format html, v0.2)

Contributions welcome — the plan format is intentionally agent-agnostic, so adapters are a great first PR.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cc_plan_tree-0.2.0.tar.gz (17.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cc_plan_tree-0.2.0-py3-none-any.whl (19.3 kB view details)

Uploaded Python 3

File details

Details for the file cc_plan_tree-0.2.0.tar.gz.

File metadata

  • Download URL: cc_plan_tree-0.2.0.tar.gz
  • Upload date:
  • Size: 17.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for cc_plan_tree-0.2.0.tar.gz
Algorithm Hash digest
SHA256 a846668ab9045d60e9255e21d5a3aaced8381eeaacd4aa22d26d9d345af92818
MD5 356af4c605089e4647d316a765d4f1e0
BLAKE2b-256 84534e38bf7b2e0c0074a9f290fbbfe1968e326004086a331d3a3e5657d7c2c8

See more details on using hashes here.

Provenance

The following attestation bundles were made for cc_plan_tree-0.2.0.tar.gz:

Publisher: publish.yml on natsu0529/cc-plan-tree

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cc_plan_tree-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: cc_plan_tree-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 19.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for cc_plan_tree-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d506cb86c3b8c14ae77b04f7da1f2cbbb661aba37990b5bb8935359aedf04a27
MD5 02c2f82f1522adb029b2674d795a3c24
BLAKE2b-256 69f01ecbd3d94dbd83e2c583be234ab91bdb853069611336dcccb5324aa07d8f

See more details on using hashes here.

Provenance

The following attestation bundles were made for cc_plan_tree-0.2.0-py3-none-any.whl:

Publisher: publish.yml on natsu0529/cc-plan-tree

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page