/ extensions / anycopy / README.md
README.md
 1  # anycopy
 2  
 3  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 display of the timestamps of labeled nodes' last labelings.
 4  
 5  ## Usage
 6  
 7  ```text
 8  /anycopy
 9  ```
10  
11  ## Keys
12  
13  Defaults (customizable in `config.json`):
14  
15  | Key | Action |
16  |-----|--------|
17  | `Enter` | Navigate to the focused node (same semantics as `/tree`) |
18  | `Shift+A` | Select/unselect focused node for copy |
19  | `Shift+C` | Copy selected nodes, or the focused node if nothing is selected |
20  | `Shift+X` | Clear selection |
21  | `Shift+L` | Label node (native tree behavior) |
22  | `Shift+T` | Toggle label timestamps for labeled nodes |
23  | `Shift+Up` / `Shift+Down` | Scroll node preview by line |
24  | `Shift+PageUp` / `Shift+PageDown` | Page through node preview |
25  | `Esc` | Close |
26  
27  Notes:
28  - `Enter` always navigates the focused node, not the marked set
29  - After `Enter`, `/anycopy` offers the same summary choices as `/tree`: `No summary`, `Summarize`, and `Summarize with custom prompt`
30  - If `branchSummary.skipPrompt` is `true` in Pi settings, `/anycopy` matches native `/tree` and skips the summary chooser, defaulting to no summary
31  - Escaping the summary chooser reopens `/anycopy` with focus restored to the node you tried to select
32  - Cancelling the custom summarization editor returns to the summary chooser
33  - If no nodes are selected, `Shift+C` copies the focused node
34  - Single-node copies use just that node's content; role prefixes like `user:` or `assistant:` are only added when copying 2 or more nodes
35  - When copying multiple selected nodes, they are auto-sorted chronologically by position in the session tree, not by selection order
36  - `Shift+A`/`Shift+C` multi-select copy behavior is unchanged by navigation support, while plain space remains available for search queries
37  - `Shift+T` is configurable via `keys.toggleLabelTimestamps` in `config.json`
38  - `Shift+T` shows timestamps for labeled nodes only, using the latest label-change time for each label
39  - Same-day labels show `HH:MM`; older labels show `M/D HH:MM`; cross-year labels show `YY/M/D HH:MM`
40  - Label edits are persisted via `pi.setLabel(...)`
41  - [Folded](https://github.com/badlogic/pi-mono/blob/09e9de5749193beab234f30ed220a77f3d91cfad/packages/coding-agent/docs/tree.md#controls) branches are persisted by default in hidden `/anycopy` session 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
42  - Search and filter changes still reset the live overlay's fold state temporarily; reopening `/anycopy` restores the persisted folded branches
43  
44  ## Configuration
45  
46  Edit `~/.pi/agent/extensions/anycopy/config.json`:
47  
48  - `treeFilterMode`: initial tree filter mode when opening `/anycopy`; defaults to `default` to match `/tree`
49    - one of: `default` | `no-tools` | `user-only` | `labeled-only` | `all`
50  - `persistFoldState`: whether `/anycopy` persists folded branches across reopenings and later sessions; defaults to `true`; when disabled, `/anycopy` does not read or write hidden fold-state session entries
51  - `keys`: keybindings used inside the `/anycopy` overlay for copy/preview actions, including the label timestamp toggle
52  
53  ```json
54  {
55    "treeFilterMode": "default",
56    "persistFoldState": true,
57    "keys": {
58      "toggleSelect": "shift+a",
59      "copy": "shift+c",
60      "clear": "shift+x",
61      "toggleLabelTimestamps": "shift+t",
62      "scrollUp": "shift+up",
63      "scrollDown": "shift+down",
64      "pageUp": "shift+pageup",
65      "pageDown": "shift+pagedown"
66    }
67  }
68  ```
69  
70  For npm installation and package-specific docs, see [`packages/pi-anycopy/README.md`](../../packages/pi-anycopy/README.md)