pi-btw 0.1.0 → 0.2.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.
package/README.md CHANGED
@@ -1,20 +1,21 @@
1
1
  # pi-btw
2
2
 
3
- A small [pi](https://github.com/badlogic/pi-mono) extension that adds a `/btw` command for side questions.
3
+ A small [pi](https://github.com/badlogic/pi-mono) extension that adds a `/btw` side conversation channel.
4
4
 
5
- `/btw` runs immediately, even while the main agent is still busy.
5
+ `/btw` opens a real pi sub-session with coding-tool access, and it runs immediately even while the main agent is still busy.
6
6
 
7
7
  ![BTW overlay example](docs/btw-overlay.png)
8
8
 
9
9
  ## What it does
10
10
 
11
- - asks a one-off side question using the current session context
12
- - returns an answer immediately in an overlay
13
- - does **not** disturb the running agent
14
- - does **not** save anything by default
15
- - optionally saves the result into the session with `--save`
16
-
17
- Saved BTW notes are visible in the session transcript, but excluded from future LLM context.
11
+ - opens a parallel side conversation without interrupting the main run
12
+ - runs that side conversation as a real pi sub-session with `read` / `bash` / `edit` / `write` tool access
13
+ - keeps a continuous BTW thread by default
14
+ - supports `/btw:tangent` for a contextless side thread that does not inherit the current main-session conversation
15
+ - opens a focused BTW modal shell with its own composer and transcript
16
+ - keeps BTW thread entries out of the main agent's future context
17
+ - lets you inject the full thread, or a summary of it, back into the main agent
18
+ - optionally saves an individual BTW exchange as a visible session note with `--save`
18
19
 
19
20
  ## Install
20
21
 
@@ -46,31 +47,111 @@ pi install /absolute/path/to/pi-btw
46
47
 
47
48
  ```text
48
49
  /btw what file defines this route?
49
- /btw --save what file defines this route?
50
- /btw -s summarize the last error in one sentence
50
+ /btw how would you refactor this parser?
51
+ /btw --save summarize the last error in one sentence
52
+ /btw:new let's start a fresh thread about auth
53
+ /btw:tangent brainstorm from first principles without using the current chat context
54
+ /btw:inject implement the plan we just discussed
55
+ /btw:summarize turn that side thread into a short handoff
56
+ /btw:clear
51
57
  ```
52
58
 
53
- ## Behavior
59
+ ## Commands
54
60
 
55
- ### `/btw <question>`
61
+ ### `/btw [--save] <question>`
56
62
 
57
63
  - runs right away
58
- - shows the answer in an overlay
59
- - does not save it to the session
64
+ - works while pi is busy
65
+ - creates or reuses a real BTW sub-session instead of a one-off completion call
66
+ - continues the current BTW thread
67
+ - opens or refreshes the focused BTW modal shell
68
+ - streams into the BTW modal transcript/status surface
69
+ - persists the BTW exchange as hidden thread state
70
+ - with `--save`, also saves that single exchange as a visible session note
71
+
72
+ ### `/btw:new [question]`
73
+
74
+ - clears the current BTW thread
75
+ - starts a fresh thread that still inherits the current main-session context
76
+ - optionally asks the first question in the new thread immediately
77
+ - if no question is provided, opens a fresh BTW modal ready for the next prompt
78
+
79
+ ### `/btw:tangent [--save] <question>`
80
+
81
+ - starts or continues a contextless tangent thread
82
+ - does not inherit the current main-session conversation
83
+ - if you switch from `/btw` to `/btw:tangent` (or back), the previous side thread is cleared so the modes do not mix
84
+ - opens or refreshes the same focused BTW modal shell
85
+ - with `--save`, also saves that single exchange as a visible session note
86
+
87
+ ### `/btw:clear`
88
+
89
+ - dismisses the BTW modal/widget
90
+ - clears the current BTW thread
91
+
92
+ ### `/btw:inject [instructions]`
93
+
94
+ - sends the full BTW thread back to the main agent as a user message
95
+ - if pi is busy, queues it as a follow-up
96
+ - clears the BTW thread after sending
97
+
98
+ ### `/btw:summarize [instructions]`
99
+
100
+ - summarizes the BTW thread with the current model
101
+ - injects the summary into the main agent
102
+ - if pi is busy, queues it as a follow-up
103
+ - clears the BTW thread after sending
104
+
105
+ ## Behavior
106
+
107
+ ### Real sub-session model
108
+
109
+ BTW is implemented as an actual pi sub-session with its own in-memory session state, transcript events, and tool surface.
60
110
 
61
- ### `/btw --save <question>`
111
+ - contextual `/btw` threads seed that sub-session from the current main-session branch while filtering out BTW-visible notes from the parent context
112
+ - `/btw:tangent` starts the same BTW UI in a contextless mode with no inherited main-session conversation
113
+ - the overlay transcript/status line is driven from sub-session events, so tool activity, streaming deltas, failures, and recovery are all visible without scraping rendered output
114
+ - handoff commands (`/btw:inject` and `/btw:summarize`) read from the BTW sub-session thread rather than maintaining a separate manual transcript model
62
115
 
63
- - if pi is idle: saves the BTW note immediately
64
- - if pi is busy: queues the BTW note and saves it after the current turn finishes
65
- - does not steer or interrupt the current agent run
116
+ ### In-modal slash behavior
117
+
118
+ Inside the BTW modal composer, slash handling is split at the BTW/session boundary:
119
+
120
+ - `/btw:new`, `/btw:tangent`, `/btw:clear`, `/btw:inject`, and `/btw:summarize` stay owned by BTW because they control BTW lifecycle or handoff behavior
121
+ - any other slash-prefixed input is routed through the BTW sub-session's normal `prompt()` path
122
+ - this means ordinary pi slash commands like `/help` are handled by the sub-session instead of being rejected by a modal-only fallback
123
+ - if the sub-session cannot handle a slash command, BTW surfaces the real sub-session failure through the transcript/status state instead of inventing an "unsupported slash input" warning
124
+
125
+ This keeps BTW-owned lifecycle commands explicit while giving the side conversation the same slash-command surface as the underlying sub-session.
126
+
127
+ ## Behavior
128
+
129
+ ### Hidden BTW thread state
130
+
131
+ BTW exchanges are persisted in the session as hidden custom entries so they:
132
+
133
+ - survive reloads and restarts
134
+ - rehydrate the BTW modal shell for the current branch
135
+ - preserve whether the current side thread is a normal `/btw` thread or a contextless `/btw:tangent`
136
+ - stay out of the main agent's LLM context
137
+
138
+ ### Visible saved notes
139
+
140
+ If you use `--save`, that one BTW exchange is also written as a visible custom message in the session transcript.
66
141
 
67
142
  ## Why
68
143
 
69
- Sometimes you want to ask a quick side question without:
144
+ Sometimes you want to:
145
+
146
+ - ask a clarifying question while the main agent keeps working
147
+ - think through next steps without derailing the current turn
148
+ - explore an idea, then inject it back once it's ready
149
+
150
+ ## Included skill
70
151
 
71
- - interrupting the current turn
72
- - adding noise to the main transcript
73
- - waiting for another user turn
152
+ This package also ships a small `btw` skill so pi can better recognize when a side-conversation workflow is appropriate.
153
+
154
+ It helps with discoverability and guidance, but it is not required for the extension itself to work.
74
155
 
75
156
  ## Development
76
157
 
@@ -78,6 +159,10 @@ The extension entrypoint is:
78
159
 
79
160
  - `extensions/btw.ts`
80
161
 
162
+ The included skill is:
163
+
164
+ - `skills/btw/SKILL.md`
165
+
81
166
  To use it without installing:
82
167
 
83
168
  ```bash
Binary file