omp packages

pi-md-tree0.1.0

Save, browse, search, open, and preview Markdown from Pi

alexanderbianchi Published 1 month ago MIT ~202 downloads/mo

Untested on omp

This is a pi package. No one has reported whether it works on omp yet. If you try it, add your result below.

Did it work for you?

Result

One report per person. A new report replaces your old one.

Reports 0

No reports yet.

Readme

pi-md-tree

Save assistant responses as Markdown, then browse, search, open, load, or preview them from a keyboard-driven tree inside Pi.

pi-md-tree keeps temporary notes out of your working tree by default while making project documentation and saved notes available from one picker.

Features

  • Save the latest assistant response without thinking or tool-call content.
  • Keep default saves under the repository's private .git metadata.
  • Browse configured notes, hidden saves, and repository documentation together.
  • Find Markdown with an incremental, case-insensitive path search.
  • Load a document into Pi's editor as context.
  • Open a document in its system application or editor.
  • Preview through pi-markdown-preview in the browser or inline in a supported terminal.
  • Navigate with arrows or Vim-style keys.

Install

pi install npm:pi-md-tree

Reload an existing Pi session after installation:

/reload

Preview prerequisites

Previewing requires Pandoc:

brew install pandoc

Inline terminal previews also require a Chromium-based browser and an image-capable terminal such as Ghostty, Kitty, iTerm2, or WezTerm. Browser preview works without terminal image support.

Commands

Save a response

/save-md <name> [directory]

The .md suffix is optional. Existing files are never overwritten.

Inside a Git repository, the default destination is:

.git/pi-save-md/<session-working-directory>/

The path is scoped to Pi's working directory within the repository. Outside Git, the fallback is saved-md/ beneath the current directory.

Examples:

/save-md query-plan
/save-md design ./notes
/save-md design "~/Documents/project notes"

Browse documents

/md [directory]
/md-tree [directory]

/md-tree is an alias for /md. The picker combines these sources when they contain matching files:

  1. A directory passed to /md, or the configured PI_SAVE_MD_DIR.
  2. The hidden .git/pi-save-md/<session-working-directory>/ directory, even when another save directory is configured.
  3. Tracked and unignored, untracked .md and .AGENTS files from the current Git repository, including AGENTS.md.

Picker keys

Key Action
j / k, ↓ / ↑ Move down or up
Ctrl+D / Ctrl+U Move down or up half a page
h / l Collapse or expand a directory
Enter Toggle a directory or load a file into Pi's editor
/ Enter or edit path search
Enter while searching Apply the current filter
Esc while searching Clear the filter
o or e Open the selected file
p, then b Preview the selected file in a browser
p, then t Preview the selected file inline in the terminal
Esc Cancel the current action or close the picker

Search is case-insensitive and matches both labels and full paths. Matching files retain their parent directories in the filtered tree.

Configuration

Set PI_SAVE_MD_DIR before starting Pi to choose the default save directory:

export PI_SAVE_MD_DIR="$HOME/Documents/pi-notes"

A directory supplied directly to /save-md or /md overrides this value for that command. The hidden repository save location remains visible in /md either way.

Opening files

On macOS, o uses open; on Linux, it uses xdg-open.

When HERDR_ENV=1, o opens a focused sibling Herdr pane and starts $VISUAL, $EDITOR, or nvim with the selected file.

Development

npm install
npm run check

License

MIT