Repository navigation
Conversation
`disktree mcp` serves the Model Context Protocol over stdio, so Claude Code, Codex or any MCP client can scan, walk the tree and mark what can go, and the person removes it on the review screen. One command connects it and there is nothing to configure, sign in to or approve: the agent runs disktree as the user, and can do no more than the user's shell can. Eight tools: status, scan, ls, find, show, mark, unmark and review. Each mark answers with the real removal plan, what the guards keep back and why, what another mark covers, and the free space it gives back on the volume, counted the way the meter counts it. There is no tool that deletes. A window follows along over a per-user socket (disktree-link): marks land in the mosaic and the meter, `show` moves the view, `review` opens the review screen, and the top bar names the agent and its last action while it is connected. When no window is open the agent can start one. Without a display it works headless. Windows is headless for now; the link needs a named pipe there. The free-space procedure ships as a prompt and a resource from skills/disktree-free-space/SKILL.md.
When a disktree window is open it is now the agent's source of truth. disktree_ls, disktree_find and disktree_scan are answered from the tree on screen, a mark is measured from it, and a path outside its root is an error that tells the agent to scan from higher up, which the window follows. The server's own scans are read only while no window is open, so an agent in a terminal still needs nothing else. The listing and search logic moves into disktree-core (query) so both sides answer alike; the link gains Scan, Ls and Find requests, a Marked answer that says what the window refused, and a tree summary with the panel's findings in every State. The window applies the agent's scan options, and a scan it is asked for lands as any other.
The line under the disk meter is easy to miss; Help is where a person looks for how to hook something up. One item, the same overlay.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
disktree mcpturns disktree into an MCP server, so an AI agent can find what is eating a disk and mark it, while the person removes it on the review screen. One command connects it:(Codex:
codex mcp add disktree -- disktree mcp.) The window's Work with an AI agent line under the disk meter, and Help › Work with an AI Agent…, show the commands with the binary's full path and a Copy button.In practice
Claude Code, asked "what is eating my disk?" against a live window. It scanned the home directory, noticed 900 GiB of the volume was outside it, scanned the whole volume, and marked a conservative set: dev-tool caches, stale build output, long-idle
node_modules. The review screen in the window is where the person decides.What it left out, with the reasoning and the command to use instead where one exists:
What the agent gets
Eight tools over stdio:
disktree_status,disktree_scan,disktree_ls,disktree_find,disktree_show,disktree_mark,disktree_unmark,disktree_review. Afree-spaceprompt and adisktree://skills/free-spaceresource carry the procedure (skills/disktree-free-space/SKILL.md). Answers are short aligned tables with the share bar, size, kind of data, whether the space can be had back and why, and the age, so a listing costs few tokens.There is no tool that deletes.
disktree_markreturns the real plan fromremoval::plan: what the guards keep back and why, what another mark covers, and the free space it gives back on the volume, counted the way the meter counts it.disktree_reviewopens the review screen, and the person presses Enter there.The window follows, and is the source of truth
When a disktree window is open, it is what the agent reads.
ls,findandscanare answered from the tree on screen, a mark is measured from it, and a path outside its root is an error that tells the agent to scan from higher up, which the window follows. The agent's marks appear in the mosaic and the free-space meter as it makes them,showmoves the view, and the header names the agent and its last action while it is connected. Marks made before a window opened are handed over when one does.With no window the server scans on its own, so an agent in a terminal needs nothing else, and it can open a window for the review.
The link is a per-user Unix socket (
$XDG_RUNTIME_DIRor$TMPDIR,DISKTREE_LINKto override),0600, one JSON line per request. No token, no port: it is the same trust boundary the shell has, and nothing over it deletes. On Windows the agent works headless for now; the link needs a named pipe there.Layout
crates/disktree-core/src/query.rs: listing and search, shared by both sides so they answer alike.Category::name/named,Finding::describe,Node::descend.crates/disktree-link: the messages and the socket.crates/disktree-mcp: the MCP surface (rmcp), the session, and how a listing or plan reads.crates/disktree-app/src/agent.rs: the window's end of the link.views.rs: the header pill, the line under the disk, the overlay.Verification
cargo xtask lintgreen on macOS; the link and MCP crates pass clippy forx86_64-pc-windows-msvctoo.disktree mcpdoes: hello, mark (measured from the tree, a missing path refused), ls, find, show, scan, review, unmark, hang up. The mcp tests run every tool as a function against a temporary tree, with a stand-in window on the socket for the linked cases.