pi-side-chat 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +156 -0
  2. package/package.json +29 -0
package/README.md ADDED
@@ -0,0 +1,156 @@
1
+ <p>
2
+ <img src="banner.png" alt="pi-side-chat" width="1100">
3
+ </p>
4
+
5
+ # pi-side-chat
6
+
7
+ A Pi extension that forks the current conversation into a temporary side chat while the main agent keeps working.
8
+
9
+ ```typescript
10
+ /side
11
+ ```
12
+
13
+ Open the overlay, ask a quick question, close it, and go back to what the main agent was already doing.
14
+
15
+ ## Why
16
+
17
+ This exists for the annoying in-between moments. You're in the middle of a longer task and want to ask something small without derailing the main thread: check an API detail, sanity-check an approach, inspect recent progress, or make a tiny edit off to the side.
18
+
19
+ Without a side chat, you either interrupt the main agent, open a completely separate Pi session with no context, or context-switch out to the browser. None of those feel great.
20
+
21
+ `pi-side-chat` gives you a fork of the current conversation in an overlay. It starts with the same context, stays separate from the main thread, and disappears when you're done.
22
+
23
+ ## Install
24
+
25
+ The extension lives in `/Users/nicobailon/.pi/agent/extensions/pi-side-chat`.
26
+
27
+ Restart Pi and it will be auto-discovered.
28
+
29
+ ## Quick Start
30
+
31
+ Open side chat with `Alt+/` or `/side`.
32
+
33
+ Ask a question and press `Enter`.
34
+
35
+ Press `Esc` to close it.
36
+
37
+ **Toggle focus**: Press `Alt+/` again to switch back to the main editor without closing the overlay. The side chat stays visible but unfocused. Press `Alt+/` once more to refocus it.
38
+
39
+ **Toggle mode**: Press `Ctrl+T` to switch from read-only mode to edit mode if you need write access.
40
+
41
+ ## What it does
42
+
43
+ ### Forks the current conversation
44
+
45
+ The overlay starts with a copy of the current branch context, so the side agent already knows what you've been working on. It does not write anything back into the main conversation history.
46
+
47
+ ### Starts in read-only mode
48
+
49
+ The safe default is read-only. That makes it useful for quick questions, code reading, and checking progress without risking accidental edits.
50
+
51
+ Press `Ctrl+T` to switch between:
52
+ - **read-only mode** — safe for quick questions and code reading
53
+ - **edit mode** — enables write, edit, and bash tools
54
+
55
+ The header shows the current mode (`[Read-only]` or `[Edit]`), and the footer shows what `Ctrl+T` will do next.
56
+
57
+ ### Warns on file overlap
58
+
59
+ If the side chat tries to modify a file that the main agent has already touched, it asks before proceeding.
60
+
61
+ ```text
62
+ File Overlap
63
+
64
+ Main agent has modified:
65
+ src/api/handler.ts
66
+
67
+ Editing may cause conflicts. Proceed?
68
+ ```
69
+
70
+ It does not block automatically. It just makes the conflict explicit.
71
+
72
+ ### Can peek at the main agent
73
+
74
+ The side agent gets a `peek_main` tool for reading recent activity from the main session.
75
+
76
+ Useful prompts:
77
+
78
+ ```text
79
+ What is the main agent doing right now?
80
+ What changed since I opened this side chat?
81
+ Show me the last 10 things main did.
82
+ ```
83
+
84
+ ### Stays out of the way
85
+
86
+ The overlay is non-capturing, so you can leave it visible and switch focus back to the main editor.
87
+
88
+ It opens near the top of the screen so the main editor stays visible underneath.
89
+
90
+ ## Controls
91
+
92
+ | Key | Action |
93
+ |-----|--------|
94
+ | `Alt+/` | Open side chat. When already open, toggles focus between side chat and main editor. |
95
+ | `Enter` | Send message |
96
+ | `Esc` | Close side chat |
97
+ | `Ctrl+T` | Toggle between read-only mode and edit mode (enables write/edit/bash) |
98
+ | `PgUp` / `Shift+↑` | Scroll up |
99
+ | `PgDn` / `Shift+↓` | Scroll down |
100
+
101
+ ## Command reference
102
+
103
+ ### `/side`
104
+
105
+ Opens the side chat overlay.
106
+
107
+ ### `peek_main`
108
+
109
+ Available to the side agent only.
110
+
111
+ Parameters:
112
+
113
+ | Param | Type | Description |
114
+ |------|------|-------------|
115
+ | `lines` | integer | Max number of recent items to inspect, default `20`, max `50` |
116
+ | `since_fork` | boolean | If `true`, only show activity after the side chat was opened |
117
+
118
+ ## Configuration
119
+
120
+ Create `/Users/nicobailon/.pi/agent/extensions/pi-side-chat/config.json` if you want a different shortcut.
121
+
122
+ ```json
123
+ {
124
+ "shortcut": "alt+/"
125
+ }
126
+ ```
127
+
128
+ ## How it works
129
+
130
+ When you open side chat, the extension clones the current session context, creates a separate agent instance, and renders it in a TUI overlay. The main agent keeps running on its own branch.
131
+
132
+ The extension also listens for main-agent tool execution events and keeps a small in-memory set of paths that have been written. When side chat is in edit mode, its write-capable tools are wrapped so they can warn before touching one of those paths.
133
+
134
+ `peek_main` reads the current session branch on demand, formats the recent messages, and returns a compact summary back to the side agent.
135
+
136
+ ## File layout
137
+
138
+ ```text
139
+ pi-side-chat/
140
+ ├── index.ts
141
+ ├── side-chat-overlay.ts
142
+ ├── side-chat-messages.ts
143
+ ├── file-activity-tracker.ts
144
+ ├── tool-wrapper.ts
145
+ ├── banner.png
146
+ └── README.md
147
+ ```
148
+
149
+ ## Limitations
150
+
151
+ - Only one side chat can be open at a time.
152
+ - Side chat will not open on top of another visible overlay.
153
+ - The conversation is ephemeral. Closing the overlay discards it.
154
+ - Side chat does not merge messages back into the main thread.
155
+ - Bash overlap detection is heuristic. It catches common write cases, not every possible shell write.
156
+ - `peek_main` is on-demand, not a live streaming view.
package/package.json ADDED
@@ -0,0 +1,29 @@
1
+ {
2
+ "name": "pi-side-chat",
3
+ "version": "0.1.0",
4
+ "description": "Pi extension that forks the current conversation into a temporary side chat",
5
+ "type": "module",
6
+ "main": "index.js",
7
+ "files": [
8
+ "*.js",
9
+ "*.d.ts"
10
+ ],
11
+ "keywords": [
12
+ "pi",
13
+ "extension",
14
+ "side-chat",
15
+ "coding-agent"
16
+ ],
17
+ "author": "Nico Bailon",
18
+ "license": "MIT",
19
+ "repository": {
20
+ "type": "git",
21
+ "url": "git+https://github.com/nicobailon/pi-side-chat.git"
22
+ },
23
+ "peerDependencies": {
24
+ "@mariozechner/pi-coding-agent": "*",
25
+ "@mariozechner/pi-agent-core": "*",
26
+ "@mariozechner/pi-ai": "*",
27
+ "@mariozechner/pi-tui": "*"
28
+ }
29
+ }