@a-t-h-i/bot-lobby 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.
- package/LICENSE +201 -0
- package/README.md +406 -0
- package/package.json +46 -0
- package/prompts/backend.md +28 -0
- package/prompts/designer.md +33 -0
- package/prompts/global.md +42 -0
- package/prompts/master.md +107 -0
- package/prompts/qa.md +26 -0
- package/prompts/researcher.md +32 -0
- package/prompts/reviewer.md +43 -0
- package/prompts/scout.md +36 -0
- package/prompts/worker.md +49 -0
- package/src/agents/backend.ts +10 -0
- package/src/agents/designer.ts +10 -0
- package/src/agents/qa.ts +10 -0
- package/src/agents/registry.ts +14 -0
- package/src/execution/agent-runner.ts +150 -0
- package/src/execution/git.ts +42 -0
- package/src/execution/pi-runner.ts +292 -0
- package/src/index.ts +13 -0
- package/src/knowledge/compactor.ts +135 -0
- package/src/knowledge/paths.ts +43 -0
- package/src/knowledge/selector.ts +82 -0
- package/src/knowledge/store.ts +111 -0
- package/src/master/decisions.ts +53 -0
- package/src/master/master.ts +298 -0
- package/src/master/research.ts +98 -0
- package/src/master/synthesis.ts +57 -0
- package/src/pi/activity.ts +60 -0
- package/src/pi/commands.ts +268 -0
- package/src/pi/events.ts +76 -0
- package/src/pi/expressions.ts +101 -0
- package/src/pi/mascot-art.ts +252 -0
- package/src/pi/notify.ts +42 -0
- package/src/pi/quiet.ts +46 -0
- package/src/pi/settings-ui.ts +258 -0
- package/src/pi/tool-renderers.ts +121 -0
- package/src/pi/tools.ts +158 -0
- package/src/pi/ui.ts +227 -0
- package/src/pi/zen-large.ts +483 -0
- package/src/pi/zen-metrics.ts +80 -0
- package/src/pi/zen.ts +460 -0
- package/src/prompts/compiler.ts +50 -0
- package/src/prompts/loader.ts +20 -0
- package/src/roles/markdown.ts +64 -0
- package/src/roles/registry.ts +16 -0
- package/src/roles/researcher.ts +83 -0
- package/src/roles/reviewer.ts +65 -0
- package/src/roles/scout.ts +61 -0
- package/src/roles/worker.ts +94 -0
- package/src/schemas/agent.ts +39 -0
- package/src/schemas/configuration.ts +107 -0
- package/src/schemas/findings.ts +110 -0
- package/src/schemas/task.ts +113 -0
- package/src/state/persistence.ts +232 -0
- package/src/state/project.ts +99 -0
- package/src/state/task-state.ts +22 -0
- package/src/text.ts +51 -0
- package/src/workflow/approvals.ts +45 -0
- package/src/workflow/transitions.ts +41 -0
- package/src/workflow/workflow.ts +771 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,406 @@
|
|
|
1
|
+
# Bot-Lobby
|
|
2
|
+
|
|
3
|
+
A Pi-native TypeScript extension that turns Pi into a structured multi-agent
|
|
4
|
+
software engineering orchestrator.
|
|
5
|
+
|
|
6
|
+
`/bot-lobby <request>` starts a task. One Master agent (the Pi session you are
|
|
7
|
+
already talking to) coordinates three domain agents — **Designer+Frontend**,
|
|
8
|
+
**Backend**, and **QA** — each able to act as a **Scout** or **Worker** in an
|
|
9
|
+
isolated Pi subprocess. **QA** also runs the read-only **Reviewer** role as the
|
|
10
|
+
single quality gate. A read-only **Researcher** role can be
|
|
11
|
+
summoned for cited internet evidence.
|
|
12
|
+
|
|
13
|
+
The core rule: **LLMs make decisions; the engine enforces the rules.** Agents
|
|
14
|
+
propose work; the extension validates state transitions, role permissions,
|
|
15
|
+
approval gates, and completion authority through one `orchestrate` tool.
|
|
16
|
+
|
|
17
|
+
## Install
|
|
18
|
+
|
|
19
|
+
Install the published package from npm:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
pi install npm:@a-t-h-i/bot-lobby
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Pi records the declaration and loads the package's extension and prompt layers
|
|
26
|
+
from Pi's own npm directory; `pi list` shows what is installed. Use
|
|
27
|
+
`pi -e npm:@a-t-h-i/bot-lobby` to try it for a single invocation without adding
|
|
28
|
+
it to settings.
|
|
29
|
+
|
|
30
|
+
### Advanced and local options
|
|
31
|
+
|
|
32
|
+
Reference the entry file from `settings.json` (global, or project
|
|
33
|
+
`.pi/settings.json`):
|
|
34
|
+
|
|
35
|
+
```json
|
|
36
|
+
{
|
|
37
|
+
"extensions": ["/absolute/path/to/bot-lobby/src/index.ts"]
|
|
38
|
+
}
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Or, for auto-discovery and `/reload` support, add a one-line shim at
|
|
42
|
+
`.pi/extensions/bot-lobby/index.ts` (project) or
|
|
43
|
+
`~/.pi/agent/extensions/bot-lobby/index.ts` (global):
|
|
44
|
+
|
|
45
|
+
```ts
|
|
46
|
+
export { default } from "/absolute/path/to/bot-lobby/src/index.ts";
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Or run it for a single session without installing: `pi -e ./src/index.ts`.
|
|
50
|
+
|
|
51
|
+
The published package ships `prompts/` alongside `src/`, so an npm install loads
|
|
52
|
+
the prompt layers without a local checkout. A source checkout must keep
|
|
53
|
+
`prompts/` beside `src/`, because the loader resolves the directory relative to
|
|
54
|
+
its own source files.
|
|
55
|
+
|
|
56
|
+
## Recommended companion: ask-user-question
|
|
57
|
+
|
|
58
|
+
Bot-lobby's `clarify` step and proposal ceremony work best when the Master can ask
|
|
59
|
+
you a concrete question with typed options instead of guessing. The
|
|
60
|
+
[ask-user-question](https://github.com/juicesharp/rpiv-mono) extension adds an
|
|
61
|
+
`ask_user_question` tool — one or more questions, each with described options and
|
|
62
|
+
a free-form answer, and optional previews — which fits this system directly: the
|
|
63
|
+
Master asks during `clarify`, you answer in a single panel, and the decision is
|
|
64
|
+
recorded in the task.
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
pi install npm:@juicesharp/rpiv-ask-user-question
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
It is optional. Without it `clarify` still works through Pi's built-in
|
|
71
|
+
`select`/`input` prompts (or the Master asks in plain text), just with less
|
|
72
|
+
structure.
|
|
73
|
+
|
|
74
|
+
## Usage
|
|
75
|
+
|
|
76
|
+
```
|
|
77
|
+
/bot-lobby <request> Start a task and hand it to the Master
|
|
78
|
+
/bot-lobby status [taskId] Active task, state, approvals, blockers, legal next states
|
|
79
|
+
/bot-lobby tasks Task list (plus any unreadable task state)
|
|
80
|
+
/bot-lobby pause | resume Stop or allow further workflow steps
|
|
81
|
+
/bot-lobby cancel [taskId] Abandon a task (scratchpad retained)
|
|
82
|
+
/bot-lobby approve Approve the current proposal
|
|
83
|
+
/bot-lobby amend <text> Record an amendment; the Master re-proposes
|
|
84
|
+
/bot-lobby decline Decline the proposal and abandon the task
|
|
85
|
+
/bot-lobby knowledge Knowledge file sizes vs. the compaction threshold
|
|
86
|
+
/bot-lobby config Effective configuration and its file path
|
|
87
|
+
/bot-lobby settings Edit per-agent model, thinking, and instructions
|
|
88
|
+
/bot-lobby-settings Same as the settings subcommand
|
|
89
|
+
/bot-lobby minimize|restore Hide or restore bot-lobby for this session (ctrl+shift+m)
|
|
90
|
+
/bot-lobby claim <taskId> Take ownership of an orphaned task
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## Sessions and ownership
|
|
94
|
+
|
|
95
|
+
A task is owned by the pi session that started it (`ctx.sessionManager` id,
|
|
96
|
+
`ownerSessionId` on the task). Only the owning session shows the zen widget and
|
|
97
|
+
injects the Master prompt; any other pi session in the same project stays
|
|
98
|
+
ordinary pi. Each session owns at most one active task, so several sessions can
|
|
99
|
+
drive their own tasks concurrently over the shared per-project task and
|
|
100
|
+
knowledge files. A task with no owner (legacy state, or one created before this
|
|
101
|
+
is claimed by the first session that runs a state-moving `orchestrate` action;
|
|
102
|
+
`/bot-lobby status`, `tasks` and the widget never claim. Take over an orphaned or
|
|
103
|
+
foreign task — including one whose owning session has ended — explicitly with
|
|
104
|
+
`/bot-lobby claim <taskId>`.
|
|
105
|
+
|
|
106
|
+
`/bot-lobby minimize` (or `ctrl+shift+m`) collapses the widget and skips the
|
|
107
|
+
Master prompt for that session only, so plain prompts go straight to standard
|
|
108
|
+
pi; ownership is kept, and `/bot-lobby restore` resumes exactly where you were.
|
|
109
|
+
|
|
110
|
+
Subcommands only win when no free-form text follows, so `/bot-lobby status page
|
|
111
|
+
redesign` still starts a task named "status page redesign".
|
|
112
|
+
|
|
113
|
+
Press `Esc` during a run to abort the current step: the signal propagates to
|
|
114
|
+
every in-flight subagent process.
|
|
115
|
+
|
|
116
|
+
While the owning session has a task active, its transcript switches to a zen view: `orchestrate` rows
|
|
117
|
+
and the built-in spinner are hidden, and a widget above the editor animates the
|
|
118
|
+
task. At 72 columns and wider it draws a large scene: a header box with the task
|
|
119
|
+
title and state in its top border, a progress bar, and a metadata row with
|
|
120
|
+
elapsed time, quiet-mode hint and task id; a spinner line above the oracle
|
|
121
|
+
naming the master's live tool activity (`⠋ delegating`, `⠋ planning`) or
|
|
122
|
+
`dormant` when the task is paused or finished; an oracle tower with its ORC
|
|
123
|
+
door, animated orb, window eyes and seven-column mouth;
|
|
124
|
+
four animated slots — DEV, DESIGN, RESEARCH and QA — each with a status face, a
|
|
125
|
+
caption and two status rows: while running, a braille spinner beside the agent's
|
|
126
|
+
live one-word activity (for example `⠋ reading` or `⠋ editing`) with its elapsed
|
|
127
|
+
time on the row beneath; otherwise the coloured status glyph and state word over
|
|
128
|
+
that elapsed time; and a full-width TASKS checklist windowed on the current
|
|
129
|
+
step. Narrower
|
|
130
|
+
terminals keep the
|
|
131
|
+
boxed banner, header and compact animated strip, whose working line names the
|
|
132
|
+
newest running agent's activity and elapsed time. Each sprite rests on one calm
|
|
133
|
+
face and, independently every 20–30 s, briefly blinks (~500 ms) or emotes
|
|
134
|
+
(~2 s, stepping through its kaomoji frames); the oracle's mouth moves with its
|
|
135
|
+
adaptive clock — 250 ms while work is live, 1 s when idle and ~120 ms while an
|
|
136
|
+
expression plays — and their faces, colours and words follow each agent's status
|
|
137
|
+
(working, idle, done, failed). The large scene's rest and blink frames stay the
|
|
138
|
+
five-column ASCII eyes, while its emote frames are status-aware kaomoji: nervous
|
|
139
|
+
while working, happy when done (QA flexes and dances), scared on failure. The
|
|
140
|
+
header progress bar is plan-derived.
|
|
141
|
+
New tasks get a <=3-word title derived from the request (for example "create
|
|
142
|
+
landing page") plus an id `TASK-<slug>` built from the full request, so the banner
|
|
143
|
+
and header stay concise; older `TASK-<timestamp>` tasks keep loading untouched.
|
|
144
|
+
|
|
145
|
+
## Lifecycle
|
|
146
|
+
|
|
147
|
+
```
|
|
148
|
+
REQUEST → CLARIFY → (CHALLENGE) → SCOUT → SYNTHESIS → PROPOSAL
|
|
149
|
+
→ APPROVE / AMEND / DECLINE → PLAN → WORK → QA GATE → (FIX → QA GATE)
|
|
150
|
+
→ KNOWLEDGE UPDATE → CLEANUP → COMPLETE
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
States: `created`, `clarifying`, `scouting`, `synthesizing`,
|
|
154
|
+
`awaiting_approval`, `planning`, `implementing`, `reviewing`, `blocked`,
|
|
155
|
+
`completed`, `abandoned`. Only the transitions in
|
|
156
|
+
`src/workflow/transitions.ts` are legal, plus abandonment from any
|
|
157
|
+
non-terminal state.
|
|
158
|
+
|
|
159
|
+
A trivial, single-domain request may go straight from `clarifying` to
|
|
160
|
+
`awaiting_approval` to `planning`, skipping the Scout round and the proposal
|
|
161
|
+
ceremony; the Master is instructed to reserve that shortcut for small, obvious,
|
|
162
|
+
one-domain changes.
|
|
163
|
+
|
|
164
|
+
## The `orchestrate` tool
|
|
165
|
+
|
|
166
|
+
One tool, every workflow step. It is the Master's only way to move a task.
|
|
167
|
+
|
|
168
|
+
| Action | State required | Effect |
|
|
169
|
+
|---|---|---|
|
|
170
|
+
| `clarify` | created, clarifying | Ask the user a question (or return it for the Master to ask) |
|
|
171
|
+
| `scout` | created…synthesizing | Run domain reconnaissance in parallel; repeat later to target-verify a claim |
|
|
172
|
+
| `research` | any active | Summon the read-only Researcher (domain + instruction) for cited internet evidence; persists the report for audit |
|
|
173
|
+
| `propose` | created…awaiting_approval | Record the proposal, request approval, handle approve/amend/decline |
|
|
174
|
+
| `plan` | planning | Record the internal plan (all §12 areas required) |
|
|
175
|
+
| `implement` | planning, implementing, reviewing | Delegate one step to a domain Worker |
|
|
176
|
+
| `qa` | implementing, reviewing | Run the QA gate — the only review — over the whole feature |
|
|
177
|
+
| `knowledge` | any active | Record Master-approved knowledge or a decision |
|
|
178
|
+
| `compact` | any active | Replace a knowledge file with a rewritten version (archived) |
|
|
179
|
+
| `resolve_approval` | any active | Approve or reject a Worker's dependency, architecture or pushback request |
|
|
180
|
+
| `complete` | reviewing | Check every gate, record history, drop scratchpads, finish |
|
|
181
|
+
| `block` / `resume` | implementing, reviewing / blocked | Escalate or continue |
|
|
182
|
+
| `decide`, `status`, `cancel` | any active | Record a decision, inspect, abandon |
|
|
183
|
+
|
|
184
|
+
## Research
|
|
185
|
+
|
|
186
|
+
`orchestrate action=research` summons a read-only **Researcher** for one domain
|
|
187
|
+
(reusing that domain's model, thinking level, and prompt layers) with a `domain`
|
|
188
|
+
and an `instruction`. It is legal in any non-terminal state, is never callable by
|
|
189
|
+
workers, and never changes the task state or `task.domains`.
|
|
190
|
+
|
|
191
|
+
The researcher has read-only repository tools plus `web_search`, `fetch_content`,
|
|
192
|
+
`source_check`, and `get_search_content`. It must cite a URL (and a date or
|
|
193
|
+
version where the source states one) for every claim, list what it could not
|
|
194
|
+
verify, and state a confidence level; it never implements, writes, or installs
|
|
195
|
+
anything. Reports are persisted for audit as `research-<domain>.json` and
|
|
196
|
+
appended to `research.md` in the task directory, and the tool returns a bounded
|
|
197
|
+
summary to the Master.
|
|
198
|
+
|
|
199
|
+
Those web tools come from the separate `pi-web-access` extension. The pi CLI
|
|
200
|
+
silently ignores unknown `--tools` names, so without it the researcher loses
|
|
201
|
+
internet access and degrades to repository-only; the returned message says so
|
|
202
|
+
explicitly instead of presenting it as findings.
|
|
203
|
+
|
|
204
|
+
Research is evidence only: it is not injected into worker, reviewer, or QA
|
|
205
|
+
prompts, and it never enters persistent knowledge automatically. The Master must
|
|
206
|
+
decide to record it with `action=knowledge`.
|
|
207
|
+
|
|
208
|
+
## What the engine enforces (not just prompts)
|
|
209
|
+
|
|
210
|
+
| Rule | Enforcement |
|
|
211
|
+
|---|---|
|
|
212
|
+
| A step cannot run out of order | State machine validated in `runWorkflowAction` |
|
|
213
|
+
| No implementation before user approval | `implement` rejects any pre-approval state |
|
|
214
|
+
| Scouts cannot modify anything | Spawned with `--tools read,grep,find,ls` |
|
|
215
|
+
| The QA gate cannot modify implementation | Read-only Reviewer tools plus `bash` for tests/analysis |
|
|
216
|
+
| Dependency and architecture changes need approval | Worker output is parsed; pending approvals block that domain until resolved |
|
|
217
|
+
| An agent pushback blocks its domain until the oracle decides it | A pushback is recorded as a pending approval; `assertNoPendingApprovals` blocks that domain, and only the Master resolves it |
|
|
218
|
+
| QA review loops are bounded | `maxReviewIterations`; exceeding it forces the blocked path |
|
|
219
|
+
| Only the Master writes knowledge | Agents only propose; one dedup-aware write path |
|
|
220
|
+
| Research never becomes knowledge by itself | Reports are artifacts; only the Master's `action=knowledge` writes persistent knowledge |
|
|
221
|
+
| Completion is gated | Plan, passing QA gate, no blockers or pending approvals |
|
|
222
|
+
| A task has one owning session | Ownership is stamped at start; a foreign session is rejected unless it claims the task |
|
|
223
|
+
| Proposals are short and scannable | `validateProposal` rejects non-bullet or over-long proposals before they reach the user |
|
|
224
|
+
| Failure is never success | Unknown verdicts, empty output, crashes, and timeouts map to failed/timeout/blocked |
|
|
225
|
+
| Task state is never corrupted by a crash | Single mutation point + disk state; interrupted tasks resume from their state |
|
|
226
|
+
|
|
227
|
+
Domain boundaries between *writers* remain prompt-enforced and Master
|
|
228
|
+
coordinated: Workers run sequentially and only the affected domain is asked to
|
|
229
|
+
change its own code. Worktree isolation is deferred (§14 of the plan).
|
|
230
|
+
|
|
231
|
+
## Configuration
|
|
232
|
+
|
|
233
|
+
Per-agent settings are edited interactively with `/bot-lobby settings` (or the
|
|
234
|
+
top-level `/bot-lobby-settings`) and persist globally to
|
|
235
|
+
`~/.pi/bot-lobby/config.json`:
|
|
236
|
+
|
|
237
|
+
```json
|
|
238
|
+
{
|
|
239
|
+
"master": { "model": "inherit", "thinking": "high", "instructions": "" },
|
|
240
|
+
"agents": {
|
|
241
|
+
"designer": { "model": "inherit", "thinking": "medium", "instructions": "" },
|
|
242
|
+
"backend": { "model": "inherit", "thinking": "medium", "instructions": "" },
|
|
243
|
+
"qa": { "model": "inherit", "thinking": "high", "instructions": "" }
|
|
244
|
+
},
|
|
245
|
+
"workflow": {
|
|
246
|
+
"maxReviewIterations": 2,
|
|
247
|
+
"maxParallelScouts": 3,
|
|
248
|
+
"requireApprovalForFeatures": true,
|
|
249
|
+
"requireApprovalForDependencies": true,
|
|
250
|
+
"requireApprovalForArchitectureChanges": true,
|
|
251
|
+
"agentTimeoutMs": 900000,
|
|
252
|
+
"maxAgentRetries": 1
|
|
253
|
+
},
|
|
254
|
+
"knowledge": {
|
|
255
|
+
"compactionThreshold": 20000,
|
|
256
|
+
"backupCount": 1,
|
|
257
|
+
"scratchpadMaxParagraphs": 4,
|
|
258
|
+
"scratchpadMaxChars": 2000
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
`"model": "inherit"` uses the session's model; any other value is passed to the
|
|
264
|
+
subagent as `--model` (e.g. `"anthropic/claude-sonnet-4-5"`). `thinking` must be
|
|
265
|
+
one of `off`, `minimal`, `low`, `medium`, `high`, `xhigh`, `max`; an invalid value
|
|
266
|
+
falls back to the default. `instructions` is appended to that agent's compiled
|
|
267
|
+
system prompt as a `Custom Instructions` layer (empty layers are dropped). The
|
|
268
|
+
master's model and thinking are applied to the live session when a task starts
|
|
269
|
+
and when you change them in the settings TUI. A malformed config falls back to
|
|
270
|
+
the defaults; `BOT_LOBBY_CONFIG_DIR` overrides the config directory.
|
|
271
|
+
|
|
272
|
+
The model picker is searchable: type to fuzzy-filter by `provider/id` or model
|
|
273
|
+
name, `inherit` and `custom…` stay reachable, and ↑↓/enter/esc behave as before.
|
|
274
|
+
|
|
275
|
+
### Prompts and custom instructions
|
|
276
|
+
|
|
277
|
+
Every agent's system prompt is composed, never duplicated, from the baked-in
|
|
278
|
+
Markdown in `prompts/`: `global.md`, the domain file (`designer.md`,
|
|
279
|
+
`backend.md`, `qa.md`), the role file (`scout.md`, `worker.md`, `reviewer.md`,
|
|
280
|
+
`researcher.md`) with that role's output contract, and then the task context,
|
|
281
|
+
selected standards/knowledge/decisions, and workflow context. `src/prompts/compiler.ts`
|
|
282
|
+
joins the layers and drops empty ones, so an agent never sees an empty heading.
|
|
283
|
+
`prompts/master.md` is the Master's operating prompt and is injected only into the
|
|
284
|
+
live session that owns the task.
|
|
285
|
+
|
|
286
|
+
Your own prompt is injected as a `Custom Instructions` layer on top of those
|
|
287
|
+
built-ins. Set it per agent — `master`, `designer`, `backend`, `qa` — either in
|
|
288
|
+
config (`instructions`) or via `/bot-lobby settings` → Instructions. It applies to
|
|
289
|
+
every run of that agent: the Master's instructions to the orchestrating session,
|
|
290
|
+
and a domain's instructions to its Scouts, Workers and (for QA) the Reviewer. The
|
|
291
|
+
layer is additive — the built-in prompts still define role boundaries, permissions
|
|
292
|
+
and the output contract — and an empty layer is dropped.
|
|
293
|
+
|
|
294
|
+
## On-disk layout
|
|
295
|
+
|
|
296
|
+
```
|
|
297
|
+
.pi/bot-lobby/
|
|
298
|
+
├── Master/knowledge/ knowledge.md, standards.md, decisions.md, completed-tasks.md
|
|
299
|
+
├── Designer/knowledge/ knowledge.md, design-language.md, decisions.md, completed-tasks.md
|
|
300
|
+
├── Backend/knowledge/ knowledge.md, engineering-standards.md, decisions.md, completed-tasks.md
|
|
301
|
+
├── QA/knowledge/ knowledge.md, testing-standards.md, decisions.md, completed-tasks.md
|
|
302
|
+
├── archive/<Agent>/ previous knowledge versions (outside all retrieval paths)
|
|
303
|
+
└── tasks/TASK-<stamp>/
|
|
304
|
+
├── state.json the task record (kept after completion)
|
|
305
|
+
├── proposal.md scratchpads: deleted on completion
|
|
306
|
+
├── plan.md
|
|
307
|
+
├── designer.md backend.md qa.md
|
|
308
|
+
├── scout-<domain>.json structured scout artifacts
|
|
309
|
+
├── research-<domain>.json structured research reports (kept for audit)
|
|
310
|
+
└── research.md appended research log (kept for audit)
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
The global config lives outside this per-project tree, at
|
|
314
|
+
`~/.pi/bot-lobby/config.json`.
|
|
315
|
+
|
|
316
|
+
After the dev-house → dev-lobby → bot-lobby renames, reads merge every tree:
|
|
317
|
+
`listTasks` and `taskHealth` enumerate `.pi/bot-lobby`, `.pi/dev-lobby` and the
|
|
318
|
+
pre-rename `.pi/dev-house` tree with the newest root winning per task id,
|
|
319
|
+
`loadTask` and knowledge reads fall back per file, and the newest existing of
|
|
320
|
+
`~/.pi/bot-lobby/config.json`, `~/.pi/dev-lobby/config.json` and
|
|
321
|
+
`~/.pi/dev-house/config.json` is still read while no bot-lobby config exists.
|
|
322
|
+
Writes always target the bot-lobby paths, and `ensureProjectStructure` seeds the
|
|
323
|
+
new knowledge files from the newest pre-rename tree so legacy knowledge is
|
|
324
|
+
migrated rather than shadowed by defaults.
|
|
325
|
+
|
|
326
|
+
Scratchpads are capped (`scratchpadMaxParagraphs`, `scratchpadMaxChars`) by the
|
|
327
|
+
engine, not by prompt discipline.
|
|
328
|
+
|
|
329
|
+
## Architecture
|
|
330
|
+
|
|
331
|
+
```
|
|
332
|
+
src/
|
|
333
|
+
├── index.ts Extension entry: lifecycle, commands, orchestrate tool
|
|
334
|
+
├── master/
|
|
335
|
+
│ ├── master.ts Scout/Worker/Reviewer delegation and artifact persistence
|
|
336
|
+
│ ├── research.ts Researcher delegation and research artifact persistence
|
|
337
|
+
│ ├── synthesis.ts Bounded summaries, shared-file and gap detection
|
|
338
|
+
│ └── decisions.ts Decision log, review-loop rule, completion gates
|
|
339
|
+
├── agents/ Domain specs (designer, backend, qa) + registry
|
|
340
|
+
├── roles/ Scout/Worker/Reviewer/Researcher specs, contracts, parsers
|
|
341
|
+
├── workflow/
|
|
342
|
+
│ ├── workflow.ts The engine: every action, every guard
|
|
343
|
+
│ ├── transitions.ts Legal state machine
|
|
344
|
+
│ └── approvals.ts Dependency/architecture/pushback approval bookkeeping
|
|
345
|
+
├── execution/
|
|
346
|
+
│ ├── agent-runner.ts Single/parallel/sequential runs, cancellation, retries
|
|
347
|
+
│ ├── pi-runner.ts Isolated `pi --mode json` subprocess + stream parsing
|
|
348
|
+
│ └── git.ts Diff evidence for reviewers
|
|
349
|
+
├── knowledge/ Paths, store (single write path), selector, compactor
|
|
350
|
+
├── prompts/ Layer loader + compiler
|
|
351
|
+
├── state/ Project root, config, task persistence, state mutation
|
|
352
|
+
├── schemas/ Task, agent, findings, configuration types
|
|
353
|
+
└── pi/ Commands, lifecycle, orchestrate tool, status widget
|
|
354
|
+
prompts/ global, master, designer, backend, qa, scout, worker, reviewer, researcher
|
|
355
|
+
```
|
|
356
|
+
|
|
357
|
+
Prompts are composed, never duplicated: `global + domain + role + task context +
|
|
358
|
+
standards + knowledge + decisions + workflow context + output contract`, with
|
|
359
|
+
empty layers dropped and only task-relevant knowledge slices included.
|
|
360
|
+
|
|
361
|
+
## Development
|
|
362
|
+
|
|
363
|
+
```bash
|
|
364
|
+
npm install
|
|
365
|
+
npm run typecheck
|
|
366
|
+
npm test # node:test, no extra framework
|
|
367
|
+
```
|
|
368
|
+
|
|
369
|
+
Live end-to-end checks (spend tokens, need a configured model):
|
|
370
|
+
|
|
371
|
+
```bash
|
|
372
|
+
BOT_LOBBY_E2E=1 npx tsx --test test/e2e.test.ts # or: node --test test/e2e.test.ts
|
|
373
|
+
```
|
|
374
|
+
|
|
375
|
+
They cover: a real isolated subagent run, a real workflow-level scout that
|
|
376
|
+
advances the task state, and the Master prompt injection in a real Pi session.
|
|
377
|
+
|
|
378
|
+
## Publishing (maintainers)
|
|
379
|
+
|
|
380
|
+
The [Pi package gallery](https://pi.dev/packages) discovers npm packages that
|
|
381
|
+
carry the `pi-package` keyword, which `package.json` already sets: the package
|
|
382
|
+
page is [pi.dev/packages/@a-t-h-i/bot-lobby](https://pi.dev/packages/@a-t-h-i/bot-lobby)
|
|
383
|
+
and the registry page is
|
|
384
|
+
[npmjs.com/package/@a-t-h-i/bot-lobby](https://www.npmjs.com/package/@a-t-h-i/bot-lobby).
|
|
385
|
+
|
|
386
|
+
A release is a version bump followed by:
|
|
387
|
+
|
|
388
|
+
```bash
|
|
389
|
+
npm publish --access public
|
|
390
|
+
```
|
|
391
|
+
|
|
392
|
+
`publishConfig.access` pins public access, and `files` (`src`, `prompts`) keeps the
|
|
393
|
+
tarball to the extension and its prompt layers — check it with
|
|
394
|
+
`npm pack --dry-run`. Pi supplies the Pi packages at runtime, so they stay in
|
|
395
|
+
`peerDependencies` with a `"*"` range.
|
|
396
|
+
|
|
397
|
+
## Scope of v0.1
|
|
398
|
+
|
|
399
|
+
Included: the full workflow above, persistent knowledge with governance and
|
|
400
|
+
compaction, bounded review loops, dependency/architecture approval, retries,
|
|
401
|
+
cancellation, corrupted-state detection, and the commands/status UI.
|
|
402
|
+
|
|
403
|
+
Deliberately deferred (matching the build plan): worktree-based parallel
|
|
404
|
+
Workers, a large dashboard, cost/token analytics beyond per-run usage, and
|
|
405
|
+
cross-platform runtime abstractions. The internal module boundaries keep those
|
|
406
|
+
extractable.
|
package/package.json
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@a-t-h-i/bot-lobby",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Structured multi-agent software engineering orchestrator for Pi",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "Apache-2.0",
|
|
7
|
+
"keywords": [
|
|
8
|
+
"pi-package"
|
|
9
|
+
],
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "git+https://github.com/a-t-h-i/bot-lobby.git"
|
|
13
|
+
},
|
|
14
|
+
"homepage": "https://github.com/a-t-h-i/bot-lobby#readme",
|
|
15
|
+
"bugs": {
|
|
16
|
+
"url": "https://github.com/a-t-h-i/bot-lobby/issues"
|
|
17
|
+
},
|
|
18
|
+
"files": [
|
|
19
|
+
"src",
|
|
20
|
+
"prompts"
|
|
21
|
+
],
|
|
22
|
+
"publishConfig": {
|
|
23
|
+
"access": "public"
|
|
24
|
+
},
|
|
25
|
+
"pi": {
|
|
26
|
+
"extensions": ["./src/index.ts"]
|
|
27
|
+
},
|
|
28
|
+
"scripts": {
|
|
29
|
+
"typecheck": "tsc --noEmit",
|
|
30
|
+
"test": "node --test --test-reporter=dot test/*.test.ts"
|
|
31
|
+
},
|
|
32
|
+
"peerDependencies": {
|
|
33
|
+
"@earendil-works/pi-ai": "*",
|
|
34
|
+
"@earendil-works/pi-coding-agent": "*",
|
|
35
|
+
"@earendil-works/pi-tui": "*",
|
|
36
|
+
"typebox": "*"
|
|
37
|
+
},
|
|
38
|
+
"devDependencies": {
|
|
39
|
+
"@earendil-works/pi-coding-agent": "0.87.0",
|
|
40
|
+
"@earendil-works/pi-ai": "0.87.0",
|
|
41
|
+
"@earendil-works/pi-tui": "0.87.0",
|
|
42
|
+
"@types/node": "^22.10.0",
|
|
43
|
+
"typebox": "1.3.27",
|
|
44
|
+
"typescript": "^5.7.0"
|
|
45
|
+
}
|
|
46
|
+
}
|