@giladbarnea/pi-simple-team 1.0.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 ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Gilad Barnea
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,65 @@
1
+ # pi-simple-team
2
+
3
+ > The team extension with no features.
4
+
5
+ No roles. No org chart. No mailboxes. No routing rules.
6
+
7
+ `pi-simple-team` spawns a flat team of Pi agents that can all talk to each other, **and then stays out of the way.**
8
+
9
+ ## Why
10
+
11
+ The best work I've ever done happened in a small room with a few capable people, building something together.
12
+
13
+ Yell out "has anyone figured out the auth service yet?" instead of filing a "request for assistance".
14
+
15
+ Tap the person next to you and ask them to grind you on your idea.
16
+
17
+ Nobody's nervous around the CEO. You started the thing together.
18
+
19
+ That's the whole design. Not a swarm, not a company. *A room.*
20
+
21
+ ## The mechanics
22
+
23
+ The team is *live*.
24
+
25
+ Teammates react to each other, know what everyone else is on, and take the shape of the task — because no shape is imposed on them.
26
+
27
+ #### Push, not pull.
28
+
29
+ No inbox to forget, no polling to exhaust your context window.
30
+
31
+ Messages land like the ones you send your own agent:
32
+
33
+ - Sub-second, when the recipient is idle.
34
+ - The moment the current bout of work ends, when busy.
35
+
36
+ #### Interrupts, when the situation calls for it.
37
+
38
+ The scout spots a private SSH key not covered by .gitignore. The implementer's status: "preparing commit message". One interrupt later, the key never leaves the machine.
39
+
40
+ #### Statuses everyone can see.
41
+
42
+ Teammates publish a one-liner — "done, awaiting review". Your main agent reads the map instead of interviewing the team.
43
+
44
+ #### Work in the open.
45
+
46
+ Every team action lands in a timestamped, filterable log. Main agent reads it to catch up rather than calling a status meeting.
47
+
48
+ #### Teams shaped by the task.
49
+
50
+ One shared briefing, an individual prompt per teammate. Flat by default; if the task wants a reviewer gate or a lead, your main agent prompts it into being — that's a sentence, not a framework.
51
+
52
+ ## Tools
53
+
54
+ | Where | Tools |
55
+ | ------------ | ---------------------------------------------------------------------------- |
56
+ | Main session | `team_spawn`, `teamsend`, `teamstatus`, `teamlog`, `team_shutdown` |
57
+ | Teammates | `teamsend` (anyone → anyone, optional `interrupt`), `teammain`, `teamstatus` |
58
+
59
+ ## Install
60
+
61
+ ```sh
62
+ pi install npm:@giladbarnea/pi-simple-team
63
+ ```
64
+
65
+ That's it.
package/child-tools.ts ADDED
@@ -0,0 +1,117 @@
1
+ import { defineTool, type ExtensionAPI } from "@earendil-works/pi-coding-agent";
2
+ import { Type } from "typebox";
3
+
4
+ type JsonRecord = Record<string, unknown>;
5
+
6
+ export interface ChildRuntimeConfig {
7
+ callbackUrl: string;
8
+ callbackToken: string;
9
+ teamName: string;
10
+ teammateName: string;
11
+ }
12
+
13
+ function requiredEnvironmentVariable(name: string): string {
14
+ const value = process.env[name];
15
+ if (!value) throw new Error(`Missing ${name}`);
16
+ return value;
17
+ }
18
+
19
+ function readRequiredChildRuntimeConfig(): ChildRuntimeConfig {
20
+ return {
21
+ callbackUrl: requiredEnvironmentVariable("PI_SIMPLE_TEAM_CALLBACK_URL"),
22
+ callbackToken: requiredEnvironmentVariable("PI_SIMPLE_TEAM_CALLBACK_TOKEN"),
23
+ teamName: requiredEnvironmentVariable("PI_SIMPLE_TEAM_TEAM"),
24
+ teammateName: requiredEnvironmentVariable("PI_SIMPLE_TEAM_MEMBER"),
25
+ };
26
+ }
27
+
28
+ export function readChildRuntimeConfig(): ChildRuntimeConfig | undefined {
29
+ if (process.env.PI_SIMPLE_TEAM_CHILD !== "1") return undefined;
30
+ return readRequiredChildRuntimeConfig();
31
+ }
32
+
33
+ async function callParent(config: ChildRuntimeConfig, tool: string, args: JsonRecord, signal?: AbortSignal): Promise<JsonRecord> {
34
+ const response = await fetch(config.callbackUrl, {
35
+ method: "POST",
36
+ headers: { "content-type": "application/json" },
37
+ body: JSON.stringify({
38
+ token: config.callbackToken,
39
+ team: config.teamName,
40
+ from: config.teammateName,
41
+ tool,
42
+ args,
43
+ }),
44
+ signal,
45
+ });
46
+
47
+ if (!response.ok) {
48
+ throw new Error(`team runtime rejected ${tool}: ${response.status} ${await response.text()}`);
49
+ }
50
+
51
+ return (await response.json()) as JsonRecord;
52
+ }
53
+
54
+ function toolResult(payload: JsonRecord): { content: [{ type: "text"; text: string }]; details: JsonRecord } {
55
+ return {
56
+ content: [{ type: "text" as const, text: JSON.stringify(payload, null, 2) }],
57
+ details: payload,
58
+ };
59
+ }
60
+
61
+ export function registerChildTools(pi: ExtensionAPI, config: ChildRuntimeConfig): void {
62
+ pi.registerTool(
63
+ defineTool({
64
+ name: "teamsend",
65
+ label: "Team Send",
66
+ description: "Send a message to teammates. To message the main agent, use teammain. Returns once the runtime accepts the send request, not after recipients reply.",
67
+ promptSnippet: "Send a message to teammate(s)",
68
+ promptGuidelines: [
69
+ "Use teamsend to talk to teammates. It is fire-and-forget: do not wait for a reply unless a teammate later sends one.",
70
+ ],
71
+ parameters: Type.Object({
72
+ to: Type.Array(Type.String(), { description: "Recipient teammate names" }),
73
+ message: Type.String({ description: "Message to send" }),
74
+ interrupt: Type.Optional(Type.Boolean({ description: "Abort busy recipients before delivering this message" })),
75
+ }),
76
+ async execute(_toolCallId, params, signal) {
77
+ return toolResult(await callParent(config, "teamsend", params, signal));
78
+ },
79
+ }),
80
+ );
81
+
82
+ pi.registerTool(
83
+ defineTool({
84
+ name: "teammain",
85
+ label: "Team Main",
86
+ description: "Send a message to the main agent/team lead. The main agent is never interrupted.",
87
+ promptSnippet: "Send a message to the main agent/team lead",
88
+ promptGuidelines: ["Use teammain to update or ask the main agent. The main agent may receive it later if busy."],
89
+ parameters: Type.Object({
90
+ message: Type.String({ description: "Message to send to the main agent" }),
91
+ }),
92
+ async execute(_toolCallId, params, signal) {
93
+ return toolResult(await callParent(config, "teammain", params, signal));
94
+ },
95
+ }),
96
+ );
97
+
98
+ pi.registerTool(
99
+ defineTool({
100
+ name: "teamstatus",
101
+ label: "Team Status",
102
+ description: "Set your public status and read everyone's public status.",
103
+ promptSnippet: "Set/read the public team status map",
104
+ parameters: Type.Object({
105
+ word: Type.Optional(Type.String({ description: "One-word status" })),
106
+ phrase: Type.Optional(Type.String({ description: "Short status phrase" })),
107
+ }),
108
+ async execute(_toolCallId, params, signal) {
109
+ return toolResult(await callParent(config, "teamstatus", params, signal));
110
+ },
111
+ }),
112
+ );
113
+ }
114
+
115
+ export default function (pi: ExtensionAPI) {
116
+ registerChildTools(pi, readRequiredChildRuntimeConfig());
117
+ }