pi-anycopy
Pi's /tree with a live syntax-highlighted preview, ability to copy any node(s) to the clipboard, and persistence of folded branches
Package details
Install pi-anycopy from npm and Pi will load the resources declared by the package manifest.
$ pi install npm:pi-anycopy- Package
pi-anycopy- Version
0.3.5- Published
- Sep 7, 2026
- Downloads
- 325/mo · 49/wk
- Author
- w-winter
- License
- MIT
- Types
- extension
- Size
- 55.6 KB
- Dependencies
- 0 dependencies · 2 peers
Pi manifest JSON
{
"image": "https://raw.githubusercontent.com/w-winter/dot314/main/assets/anycopy-demo.gif",
"extensions": [
"extensions/anycopy/index.ts"
]
}Security note
Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.
README
anycopy for Pi (pi-anycopy)
This extension mirrors all the behaviors of Pi's native /tree while adding a live, syntax-highlighting preview of each node's content, the ability to copy any node(s) to the clipboard, and optional node creation timestamps.
Install
From npm:
pi install npm:pi-anycopy
From the dot314 git bundle (filtered install):
Add to ~/.pi/agent/settings.json (or replace an existing unfiltered git:github.com/w-winter/dot314 entry):
{
"packages": [
{
"source": "git:github.com/w-winter/dot314",
"extensions": ["extensions/anycopy/index.ts"],
"skills": [],
"themes": [],
"prompts": []
}
]
}
Restart Pi after installation.
Usage
/anycopy
Keys
Defaults (customizable in config.json):
| Key | Action |
|---|---|
Enter |
Navigate to the focused node (same semantics as /tree) |
Shift+A |
Select/unselect focused node for copy |
Shift+C |
Copy selected nodes, or the focused node if nothing is selected. Tool results include the originating call |
Shift+X |
Clear selection |
Shift+R |
Start or finish inclusive range selection |
Tab |
Toggle between tree-focused and preview-focused layouts |
Shift+L |
Label node (native tree behavior) |
Shift+T |
Toggle label timestamps for labeled nodes |
Shift+Ctrl+T |
Toggle node creation timestamps |
Shift+Up / Shift+Down |
Scroll node preview by line |
Shift+PageUp / Shift+PageDown |
Page through node preview |
? |
Show available anycopy and native tree keybindings |
Esc |
Close |
Notes:
Enteralways navigates the focused node, not the marked set- After
Enter,/anycopyoffers the same summary choices as/tree:No summary,Summarize, andSummarize with custom prompt - If
branchSummary.skipPromptistruein Pi settings,/anycopymatches native/treeand skips the summary chooser, defaulting to no summary - Escaping the summary chooser reopens
/anycopywith focus restored to the node you tried to select - Cancelling the custom summarization editor returns to the summary chooser
- If no nodes are selected,
Shift+Ccopies the focused node - Tool-result previews always show the originating tool name and arguments above the result. Copying the node includes both the call and result
Shift+Ranchors a range at the focused node. Tree movement extends or shrinks the inclusive range and adds every node in that range to the existing selection- Search, filter, and fold changes finish an active range while preserving its selected nodes
- The default and no-tools views hide custom messages listed in
hiddenCustomTypes. Use the all-entries filter to inspect or copy those messages. Tabswitches directly between the tree-focused and preview-focused layouts. Both panes remain visible according to their configured ratios?lists the anycopy and native tree keybindings available in the overlay- An optional Pi shortcut opens anycopy without clearing the editor draft. This copy-only view keeps
Shift+Cavailable; use/anycopywhen you wantEnterto navigate the session tree - Custom session entries use readable labeled content in previews and clipboard output. Timestamps in custom session entries use the local time zone
- Single-node copies use just that node's content; role prefixes like
user:orassistant:are only added when copying 2 or more nodes - When copying multiple selected nodes, they are auto-sorted chronologically by position in the session tree, not by selection order
Shift+A/Shift+Cmulti-select copy behavior is unchanged by navigation support, while plain space remains available for search queries/anycopyopens over the session view, so widgets above the editor do not reduce the space available to its previewShift+Tis configurable viakeys.toggleLabelTimestampsinconfig.jsonShift+Tshows timestamps for labeled nodes only, using the latest label-change time for each labelShift+Ctrl+Tis configurable viakeys.toggleEntryTimestampsinconfig.jsonShift+Ctrl+Tshows each node's creation time right-aligned at the far right of each visible tree row- Nodes without a creation time show no timestamp
- Timestamps use a compact format: same-day
HH:MM, same-yearM/D HH:MM, cross-yearYY/M/D HH:MM - Label edits are persisted via
pi.setLabel(...) - Folded branches are persisted by default in hidden
/anycopysession entries, so closing/reopening/anycopy, switching to a sibling branch, or revisiting the session later restores the same folded view until you explicitly unfold it again - Search and filter changes still reset the live overlay's fold state temporarily; reopening
/anycopyrestores the persisted folded branches
Configuration
Edit ~/.pi/agent/extensions/anycopy/config.json:
treeFilterMode: initial tree filter mode when opening/anycopy; defaults todefaultto match/tree- one of:
default|no-tools|user-only|labeled-only|all
- one of:
hiddenCustomTypes: custom message type names to hide in default and no-tools views. Names match the entry'scustomTypeexactly and case-sensitively, for example["background-status", "tool-diagnostics"]. Defaults to[]. Each name must be a nonblank string.persistFoldState: whether/anycopypersists folded branches across reopenings and later sessions; defaults totrue; when disabled,/anycopydoes not read or write hidden fold-state session entriesshortcut: optional Pi shortcut that opens copy-only anycopy without clearing the current editor draft. Set it to a key such asctrl+shift+c, or leave it asnullhints.mode:fulldisplays shortcut hints below the tree, whilecompactuses one status row for help and Enter guidancelayout.treeFocusTreeRatio: fraction of pane rows used by the tree in tree-focused mode; must be greater than0and less than1layout.previewFocusTreeRatio: fraction of pane rows used by the tree in preview-focused mode; must be greater than0and less than1keys: keybindings used inside the/anycopyoverlay
{
"treeFilterMode": "default",
"hiddenCustomTypes": [],
"persistFoldState": true,
"shortcut": null,
"hints": {
"mode": "full"
},
"layout": {
"treeFocusTreeRatio": 0.85,
"previewFocusTreeRatio": 0.15
},
"keys": {
"toggleSelect": "shift+a",
"copy": "shift+c",
"clear": "shift+x",
"toggleLabelTimestamps": "shift+t",
"toggleEntryTimestamps": "shift+ctrl+t",
"scrollUp": "shift+up",
"scrollDown": "shift+down",
"pageUp": "shift+pageup",
"pageDown": "shift+pagedown",
"togglePaneFocus": "tab",
"toggleRangeSelection": "shift+r",
"help": "?"
}
}
