> ## Documentation Index
> Fetch the complete documentation index at: https://docs.monolex.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# MonoTree

> Browse large directory trees in a keyboard-first TUI with search, sorting, bounded expansion, history, and context actions.

MonoTree is a native file-tree TUI for exploring a directory without loading
every descendant eagerly. It provides keyboard navigation, incremental search,
sort modes, explicit expansion depth, directory history, and a context menu.

*Published contract: `monotree 0.1.5`, OpenCLIs build
`2026-06-30-131509`. The executing binary, registry, and public CDN metadata
agree on this release.*

## Quick Start

```bash theme={null}
openclis install monotree

monotree --version
monotree                         # project-aware root detection
monotree ~/Projects              # exact explicit root
monotree search renderer .       # non-interactive search
```

The optional positional path becomes the exact root. Without it, MonoTree
starts from the current directory and applies project-root detection before
opening the TUI.

## Complete CLI Reference

Version 0.1.5 has four operational families—interactive browse, search, docs,
and test—plus help/version aliases.

| Invocation                            | What it does                                                                     | Output or effect boundary                                                                         |
| ------------------------------------- | -------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- |
| `monotree [path]`                     | Opens the interactive tree at an explicit path or an auto-detected project root. | Full-screen TUI; context actions can edit files.                                                  |
| `monotree search <query> [path]`      | Loads the tree to depth 5 and searches files beneath `path` or `.`.              | Summary on stderr, at most 15 matching file rows on stdout; zero matches still exit successfully. |
| `monotree docs [topic]`               | Lists embedded docs or prints one topic.                                         | Version 0.1.5 contains the `index` topic. Unknown/reserved topics exit non-zero.                  |
| `monotree test`                       | Runs three breadcrumb/path-bar tests in a PTY harness.                           | Unix-only; creates and removes an isolated `/tmp/monotree-test-PID` fixture.                      |
| `monotree help`, `-h`, `--help`       | Prints the bundled TUI key reference.                                            | Read-only.                                                                                        |
| `monotree version`, `-V`, `--version` | Prints `monotree 0.1.5`.                                                         | Read-only installed-payload proof.                                                                |

<Warning>
  The bundled 0.1.5 help text lists only `[path]`, help, version, and TUI keys;
  it omits the working `search`, `docs`, and `test` commands. Also,
  `monotree search` without a query does not show search help—it falls through
  and treats `search` as an interactive path. Supply the query explicitly.
</Warning>

## Non-Interactive Search

```bash theme={null}
monotree search "session" .
```

Search canonicalizes the optional path when possible, loads five levels,
filters out directory rows, and prints only the first 15 matching files. The
`Loaded N files, searched "QUERY", M matches` line goes to stderr, which lets a
script capture file rows separately. This is filesystem/name search; use
[Monogram](/ai-clis/monogram) for indexed code symbols and call relationships.

## Navigation and Search

| Keys                     | Action                                                |
| ------------------------ | ----------------------------------------------------- |
| `Up` / `Down`, `j` / `k` | Move the selection.                                   |
| `Enter`                  | Expand/collapse a directory or select a file.         |
| `Left`                   | Collapse the current directory or move to its parent. |
| `/`                      | Start tree search/filtering.                          |
| `b`                      | Go back through directory history.                    |
| `Ctrl+F`                 | Go forward through directory history.                 |
| `u` or Backspace         | Move to the parent directory.                         |
| `r`                      | Refresh filesystem state.                             |
| `q`                      | Quit.                                                 |

## Tree Shape and Context

| Keys    | Action and cost boundary                                                                                  |
| ------- | --------------------------------------------------------------------------------------------------------- |
| `s`     | Toggle name/time sorting.                                                                                 |
| `e`     | Expand all top-level directories.                                                                         |
| `E`     | Expand the selected directory through all descendants; use carefully on very large trees.                 |
| `1`…`5` | Expand the selected directory to a bounded depth.                                                         |
| `c`     | Collapse the complete tree.                                                                               |
| `m`     | Open the selected item's context menu. Inspect the menu action before confirming any filesystem mutation. |

Prefer bounded `1`…`5` expansion when repository size is unknown. `E` is a
deliberate full traversal and can be expensive even though it does not edit
files.

## Context Menu Effects

The menu is not read-only. Its current actions divide into three groups:

| Group                | Actions                                                                                                        | Effect                                                                                                                          |
| -------------------- | -------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- |
| Navigation/read      | Open, Send Path, Copy Path, Copy Content, Refresh Folder, Close All Nested, Set as Root, Open/Reveal in Finder | Changes view state, opens the platform file manager, or writes to the clipboard.                                                |
| Filesystem mutation  | New File, New Folder, Rename, Delete, Duplicate, Duplicate with Timestamp                                      | Creates, renames, recursively deletes, or copies entries. Delete requires confirmation; path/name validation rejects traversal. |
| Placeholder in 0.1.5 | Zip Folder, Zip (gitignore), Git Blame, Git History                                                            | Displays a message only; it does not yet create an archive or open Git history.                                                 |

Deletion uses `symlink_metadata`: a symlink itself is removed rather than
following it, while a real directory is removed recursively. Treat `m` as an
entry into a mixed read/write surface, not merely an information panel.

## Self-Test Contract

`monotree test` verifies three concrete behaviors: initial breadcrumb rendering,
`Up` → `Left` → `Enter` re-rooting, and `Esc` returning focus to the tree. The
PTY harness uses Unix `openpty`/`fork`; Windows returns exit code 2 without
running it.

## Published Platforms

Version 0.1.5 ships `darwin-aarch64`, `linux-x86_64`, `linux-aarch64`, and
`windows-x86_64` archives. Browse, search, and embedded docs are cross-platform;
the built-in PTY test is Unix-only.

## Relationships

| Tool                                              | Ownership                                                                               |
| ------------------------------------------------- | --------------------------------------------------------------------------------------- |
| [Maxmux](/ai-clis/maxmux)                         | Embeds a project/prompt file-tree experience inside a terminal multiplexer              |
| [MonoTerm File Tree](/ai-clis/monoterm/file-tree) | Explains how the embedded prompt tree shares the engine but uses a different input mode |
| [Monogram](/ai-clis/monogram)                     | Searches indexed code symbols and call relationships rather than directory shape        |
| [MonoDoc](/ai-clis/monodoc)                       | Converts selected documents into Markdown; MonoTree only locates them                   |
