@pi-unipi/btw 2.0.1 → 2.0.3
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 +17 -17
- package/extensions/btw.ts +29 -20
- package/package.json +2 -2
- package/skills/btw/SKILL.md +27 -27
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @pi-unipi/btw
|
|
2
2
|
|
|
3
|
-
Side conversations that run in parallel. Ask a question using `/btw` while the main agent keeps working — the answer streams into a modal overlay without interrupting the current task.
|
|
3
|
+
Side conversations that run in parallel. Ask a question using `/unipi:btw` while the main agent keeps working — the answer streams into a modal overlay without interrupting the current task.
|
|
4
4
|
|
|
5
5
|
BTW opens a real Pi sub-session with coding-tool access. Use it to clarify something, explore an idea, or think through next steps without derailing the main turn. When you're ready, inject the thread back or summarize it.
|
|
6
6
|
|
|
@@ -10,12 +10,12 @@ Based on [pi-btw](https://github.com/Neuron-Mr-White/pi-btw) by Dan Bachelder.
|
|
|
10
10
|
|
|
11
11
|
| Command | Description |
|
|
12
12
|
|---------|-------------|
|
|
13
|
-
| `/btw [--save] <question>` | Ask a question in a side thread |
|
|
14
|
-
| `/btw
|
|
15
|
-
| `/btw
|
|
16
|
-
| `/btw
|
|
17
|
-
| `/btw
|
|
18
|
-
| `/btw
|
|
13
|
+
| `/unipi:btw [--save] <question>` | Ask a question in a side thread |
|
|
14
|
+
| `/unipi:btw-new [question]` | Start a fresh thread with main-session context |
|
|
15
|
+
| `/unipi:btw-tangent [--save] <question>` | Contextless tangent thread |
|
|
16
|
+
| `/unipi:btw-clear` | Dismiss modal and clear thread |
|
|
17
|
+
| `/unipi:btw-inject [instructions]` | Send full thread to main agent |
|
|
18
|
+
| `/unipi:btw-summarize [instructions]` | Summarize thread and inject into main agent |
|
|
19
19
|
|
|
20
20
|
### Keyboard Shortcuts
|
|
21
21
|
|
|
@@ -29,13 +29,13 @@ Based on [pi-btw](https://github.com/Neuron-Mr-White/pi-btw) by Dan Bachelder.
|
|
|
29
29
|
### Examples
|
|
30
30
|
|
|
31
31
|
```text
|
|
32
|
-
/btw what file defines this route?
|
|
33
|
-
/btw how would you refactor this parser?
|
|
34
|
-
/btw --save summarize the last error in one sentence
|
|
35
|
-
/btw
|
|
36
|
-
/btw
|
|
37
|
-
/btw
|
|
38
|
-
/btw
|
|
32
|
+
/unipi:btw what file defines this route?
|
|
33
|
+
/unipi:btw how would you refactor this parser?
|
|
34
|
+
/unipi:btw --save summarize the last error in one sentence
|
|
35
|
+
/unipi:btw-new let's start a fresh thread about auth
|
|
36
|
+
/unipi:btw-tangent brainstorm from first principles without using the current chat context
|
|
37
|
+
/unipi:btw-inject implement the plan we just discussed
|
|
38
|
+
/unipi:btw-summarize turn that side thread into a short handoff
|
|
39
39
|
```
|
|
40
40
|
|
|
41
41
|
## Special Triggers
|
|
@@ -46,14 +46,14 @@ The BTW overlay opens top-centered so the main session remains visible underneat
|
|
|
46
46
|
|
|
47
47
|
## How It Works
|
|
48
48
|
|
|
49
|
-
1. `/btw` creates or reuses a BTW sub-session
|
|
49
|
+
1. `/unipi:btw` creates or reuses a BTW sub-session
|
|
50
50
|
2. Your question runs in a real Pi session with tool access
|
|
51
51
|
3. The answer streams into the BTW modal overlay
|
|
52
52
|
4. The thread continues until you clear it or inject it back
|
|
53
53
|
|
|
54
|
-
`/btw
|
|
54
|
+
`/unipi:btw-inject` sends the full thread to the main agent as a user message. If Pi is busy, it queues as a follow-up. `/unipi:btw-summarize` does the same but summarizes first.
|
|
55
55
|
|
|
56
|
-
`/btw
|
|
56
|
+
`/unipi:btw-tangent` starts a separate thread that doesn't inherit the main session's conversation context. Use it for unrelated exploration.
|
|
57
57
|
|
|
58
58
|
The `--save` flag saves that single exchange as a visible session note.
|
|
59
59
|
|
package/extensions/btw.ts
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @pi-unipi/btw — Side Conversation Extension
|
|
3
3
|
*
|
|
4
|
-
* A /btw side conversation channel that opens a real pi sub-session
|
|
4
|
+
* A /unipi:btw side conversation channel that opens a real pi sub-session
|
|
5
5
|
* with coding-tool access, running immediately even while the main
|
|
6
6
|
* agent is still busy.
|
|
7
7
|
*
|
|
8
8
|
* Based on pi-btw by Dan Bachelder, adapted for the Unipi suite.
|
|
9
9
|
*
|
|
10
10
|
* Commands:
|
|
11
|
-
* /btw [--save] <question>
|
|
12
|
-
* /btw
|
|
13
|
-
* /btw
|
|
14
|
-
* /btw
|
|
15
|
-
* /btw
|
|
16
|
-
* /btw
|
|
11
|
+
* /unipi:btw [--save] <question> - Side conversation (contextual)
|
|
12
|
+
* /unipi:btw-tangent [--save] <q> - Contextless tangent thread
|
|
13
|
+
* /unipi:btw-new [question] - Fresh thread with main-session context
|
|
14
|
+
* /unipi:btw-clear - Dismiss and clear thread
|
|
15
|
+
* /unipi:btw-inject [instructions] - Send full thread to main agent
|
|
16
|
+
* /unipi:btw-summarize [instructions] - Summarize and inject into main agent
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
19
|
import {
|
|
@@ -44,6 +44,7 @@ import {
|
|
|
44
44
|
type OverlayHandle,
|
|
45
45
|
type TUI,
|
|
46
46
|
} from "@mariozechner/pi-tui";
|
|
47
|
+
import { BTW_COMMANDS, UNIPI_PREFIX } from "@pi-unipi/core";
|
|
47
48
|
|
|
48
49
|
// ─── Constants ──────────────────────────────────────────────────────────────
|
|
49
50
|
|
|
@@ -1615,15 +1616,23 @@ export default function (pi: ExtensionAPI) {
|
|
|
1615
1616
|
|
|
1616
1617
|
function parseOverlayBtwCommand(value: string): { name: string; args: string } | null {
|
|
1617
1618
|
const trimmed = value.trim();
|
|
1618
|
-
const
|
|
1619
|
-
if (
|
|
1620
|
-
return
|
|
1619
|
+
const legacy = trimmed.match(/^\/(btw:(?:new|tangent|clear|inject|summarize))(?:\s+(.*))?$/);
|
|
1620
|
+
if (legacy) {
|
|
1621
|
+
return {
|
|
1622
|
+
name: legacy[1],
|
|
1623
|
+
args: legacy[2]?.trim() ?? "",
|
|
1624
|
+
};
|
|
1621
1625
|
}
|
|
1622
1626
|
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
+
const unipi = trimmed.match(/^\/unipi:btw-(new|tangent|clear|inject|summarize)(?:\s+(.*))?$/);
|
|
1628
|
+
if (unipi) {
|
|
1629
|
+
return {
|
|
1630
|
+
name: `btw:${unipi[1]}`,
|
|
1631
|
+
args: unipi[2]?.trim() ?? "",
|
|
1632
|
+
};
|
|
1633
|
+
}
|
|
1634
|
+
|
|
1635
|
+
return null;
|
|
1627
1636
|
}
|
|
1628
1637
|
|
|
1629
1638
|
async function submitFromOverlay(ctx: ExtensionCommandContext | ExtensionContext, value: string): Promise<void> {
|
|
@@ -1928,42 +1937,42 @@ export default function (pi: ExtensionAPI) {
|
|
|
1928
1937
|
});
|
|
1929
1938
|
}
|
|
1930
1939
|
|
|
1931
|
-
pi.registerCommand(
|
|
1940
|
+
pi.registerCommand(`${UNIPI_PREFIX}${BTW_COMMANDS.BTW}`, {
|
|
1932
1941
|
description: "Continue a side conversation in a focused BTW modal. Add --save to also persist a visible note.",
|
|
1933
1942
|
handler: async (args, ctx) => {
|
|
1934
1943
|
await dispatchBtwCommand("btw", args, ctx);
|
|
1935
1944
|
},
|
|
1936
1945
|
});
|
|
1937
1946
|
|
|
1938
|
-
pi.registerCommand(
|
|
1947
|
+
pi.registerCommand(`${UNIPI_PREFIX}${BTW_COMMANDS.TANGENT}`, {
|
|
1939
1948
|
description: "Start or continue a contextless BTW tangent in the focused BTW modal.",
|
|
1940
1949
|
handler: async (args, ctx) => {
|
|
1941
1950
|
await dispatchBtwCommand("btw:tangent", args, ctx);
|
|
1942
1951
|
},
|
|
1943
1952
|
});
|
|
1944
1953
|
|
|
1945
|
-
pi.registerCommand(
|
|
1954
|
+
pi.registerCommand(`${UNIPI_PREFIX}${BTW_COMMANDS.NEW}`, {
|
|
1946
1955
|
description: "Start a fresh BTW thread with main-session context. Optionally ask the first question immediately.",
|
|
1947
1956
|
handler: async (args, ctx) => {
|
|
1948
1957
|
await dispatchBtwCommand("btw:new", args, ctx);
|
|
1949
1958
|
},
|
|
1950
1959
|
});
|
|
1951
1960
|
|
|
1952
|
-
pi.registerCommand(
|
|
1961
|
+
pi.registerCommand(`${UNIPI_PREFIX}${BTW_COMMANDS.CLEAR}`, {
|
|
1953
1962
|
description: "Dismiss the BTW modal/widget and clear the current thread.",
|
|
1954
1963
|
handler: async (args, ctx) => {
|
|
1955
1964
|
await dispatchBtwCommand("btw:clear", args, ctx);
|
|
1956
1965
|
},
|
|
1957
1966
|
});
|
|
1958
1967
|
|
|
1959
|
-
pi.registerCommand(
|
|
1968
|
+
pi.registerCommand(`${UNIPI_PREFIX}${BTW_COMMANDS.INJECT}`, {
|
|
1960
1969
|
description: "Inject the full BTW thread into the main agent as a user message.",
|
|
1961
1970
|
handler: async (args, ctx) => {
|
|
1962
1971
|
await dispatchBtwCommand("btw:inject", args, ctx);
|
|
1963
1972
|
},
|
|
1964
1973
|
});
|
|
1965
1974
|
|
|
1966
|
-
pi.registerCommand(
|
|
1975
|
+
pi.registerCommand(`${UNIPI_PREFIX}${BTW_COMMANDS.SUMMARIZE}`, {
|
|
1967
1976
|
description: "Summarize the BTW thread, then inject the summary into the main agent.",
|
|
1968
1977
|
handler: async (args, ctx) => {
|
|
1969
1978
|
await dispatchBtwCommand("btw:summarize", args, ctx);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pi-unipi/btw",
|
|
3
|
-
"version": "2.0.
|
|
4
|
-
"description": "A pi extension for parallel side conversations with /btw — part of the Unipi suite",
|
|
3
|
+
"version": "2.0.3",
|
|
4
|
+
"description": "A pi extension for parallel side conversations with /unipi:btw — part of the Unipi suite",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"author": "Neuron Mr White",
|
package/skills/btw/SKILL.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: btw
|
|
3
|
-
description: Helps you use the /btw side-conversation workflow effectively. Use when you want to think in parallel, ask side questions without interrupting ongoing work, or inject a side thread back into the main agent.
|
|
3
|
+
description: Helps you use the /unipi:btw side-conversation workflow effectively. Use when you want to think in parallel, ask side questions without interrupting ongoing work, or inject a side thread back into the main agent.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# BTW
|
|
@@ -21,14 +21,14 @@ Prefer the BTW workflow when the user wants to:
|
|
|
21
21
|
Use these commands in your guidance to the user:
|
|
22
22
|
|
|
23
23
|
```text
|
|
24
|
-
/btw <question>
|
|
25
|
-
/btw --save <question>
|
|
26
|
-
/btw
|
|
27
|
-
/btw
|
|
28
|
-
/btw
|
|
29
|
-
/btw
|
|
30
|
-
/btw
|
|
31
|
-
/btw
|
|
24
|
+
/unipi:btw <question>
|
|
25
|
+
/unipi:btw --save <question>
|
|
26
|
+
/unipi:btw-new [question]
|
|
27
|
+
/unipi:btw-tangent <question>
|
|
28
|
+
/unipi:btw-tangent --save <question>
|
|
29
|
+
/unipi:btw-clear
|
|
30
|
+
/unipi:btw-inject [instructions]
|
|
31
|
+
/unipi:btw-summarize [instructions]
|
|
32
32
|
```
|
|
33
33
|
|
|
34
34
|
## How to guide the user
|
|
@@ -38,7 +38,7 @@ Use these commands in your guidance to the user:
|
|
|
38
38
|
Recommend:
|
|
39
39
|
|
|
40
40
|
```text
|
|
41
|
-
/btw <question>
|
|
41
|
+
/unipi:btw <question>
|
|
42
42
|
```
|
|
43
43
|
|
|
44
44
|
Use this when the user wants an immediate aside and does not need a visible saved note.
|
|
@@ -48,7 +48,7 @@ Use this when the user wants an immediate aside and does not need a visible save
|
|
|
48
48
|
Recommend:
|
|
49
49
|
|
|
50
50
|
```text
|
|
51
|
-
/btw --save <question>
|
|
51
|
+
/unipi:btw --save <question>
|
|
52
52
|
```
|
|
53
53
|
|
|
54
54
|
Use this when the user wants the exchange to appear as a visible BTW note in the session transcript.
|
|
@@ -58,13 +58,13 @@ Use this when the user wants the exchange to appear as a visible BTW note in the
|
|
|
58
58
|
Recommend:
|
|
59
59
|
|
|
60
60
|
```text
|
|
61
|
-
/btw
|
|
61
|
+
/unipi:btw-new
|
|
62
62
|
```
|
|
63
63
|
|
|
64
64
|
or
|
|
65
65
|
|
|
66
66
|
```text
|
|
67
|
-
/btw
|
|
67
|
+
/unipi:btw-new <question>
|
|
68
68
|
```
|
|
69
69
|
|
|
70
70
|
Use this when the previous BTW discussion is no longer relevant, but you still want the new side thread to inherit the current main-session context.
|
|
@@ -74,13 +74,13 @@ Use this when the previous BTW discussion is no longer relevant, but you still w
|
|
|
74
74
|
Recommend:
|
|
75
75
|
|
|
76
76
|
```text
|
|
77
|
-
/btw
|
|
77
|
+
/unipi:btw-tangent <question>
|
|
78
78
|
```
|
|
79
79
|
|
|
80
80
|
or
|
|
81
81
|
|
|
82
82
|
```text
|
|
83
|
-
/btw
|
|
83
|
+
/unipi:btw-tangent --save <question>
|
|
84
84
|
```
|
|
85
85
|
|
|
86
86
|
Use this when the user wants a side conversation that does not include the current main-session context.
|
|
@@ -90,7 +90,7 @@ Use this when the user wants a side conversation that does not include the curre
|
|
|
90
90
|
Recommend:
|
|
91
91
|
|
|
92
92
|
```text
|
|
93
|
-
/btw
|
|
93
|
+
/unipi:btw-inject <instructions>
|
|
94
94
|
```
|
|
95
95
|
|
|
96
96
|
Use this when the exact discussion matters and the user wants the main agent to act on it.
|
|
@@ -100,19 +100,19 @@ Use this when the exact discussion matters and the user wants the main agent to
|
|
|
100
100
|
Recommend:
|
|
101
101
|
|
|
102
102
|
```text
|
|
103
|
-
/btw
|
|
103
|
+
/unipi:btw-summarize <instructions>
|
|
104
104
|
```
|
|
105
105
|
|
|
106
106
|
Use this when the thread is long and only the distilled outcome should go back into the main agent.
|
|
107
107
|
|
|
108
108
|
## Recommendation rules
|
|
109
109
|
|
|
110
|
-
- Prefer `/btw` over normal chat when the user explicitly wants a side conversation.
|
|
111
|
-
- Prefer `/btw
|
|
112
|
-
- Prefer `/btw
|
|
113
|
-
- Prefer `/btw
|
|
114
|
-
- Suggest `/btw
|
|
115
|
-
- Suggest `/btw
|
|
110
|
+
- Prefer `/unipi:btw` over normal chat when the user explicitly wants a side conversation.
|
|
111
|
+
- Prefer `/unipi:btw-tangent` when the user wants that side conversation to be contextless.
|
|
112
|
+
- Prefer `/unipi:btw-summarize` over `/unipi:btw-inject` for long exploratory threads.
|
|
113
|
+
- Prefer `/unipi:btw-inject` when precise wording, detailed tradeoffs, or a full plan matters.
|
|
114
|
+
- Suggest `/unipi:btw-new` before starting a totally unrelated side topic when main-session context is still useful.
|
|
115
|
+
- Suggest `/unipi:btw-clear` when the widget/thread should be dismissed.
|
|
116
116
|
|
|
117
117
|
## Response style
|
|
118
118
|
|
|
@@ -127,23 +127,23 @@ When helping the user use BTW:
|
|
|
127
127
|
### Example: brainstorm while coding continues
|
|
128
128
|
|
|
129
129
|
```text
|
|
130
|
-
/btw what are the risks of switching this to optimistic updates?
|
|
130
|
+
/unipi:btw what are the risks of switching this to optimistic updates?
|
|
131
131
|
```
|
|
132
132
|
|
|
133
133
|
### Example: create a clean new thread
|
|
134
134
|
|
|
135
135
|
```text
|
|
136
|
-
/btw
|
|
136
|
+
/unipi:btw-new sketch a safer migration plan
|
|
137
137
|
```
|
|
138
138
|
|
|
139
139
|
### Example: start a contextless tangent
|
|
140
140
|
|
|
141
141
|
```text
|
|
142
|
-
/btw
|
|
142
|
+
/unipi:btw-tangent think through this from first principles without using the current chat context
|
|
143
143
|
```
|
|
144
144
|
|
|
145
145
|
### Example: send the result back
|
|
146
146
|
|
|
147
147
|
```text
|
|
148
|
-
/btw
|
|
148
|
+
/unipi:btw-summarize implement the recommended migration plan
|
|
149
149
|
```
|