@fitchmultz/pi-subagents 0.0.0-stage → 0.44.5
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/CHANGELOG.md +1654 -0
- package/LICENSE +21 -0
- package/README.md +1533 -2
- package/agents/context-builder.md +97 -0
- package/agents/debugger.md +51 -0
- package/agents/delegate.md +13 -0
- package/agents/fixer.md +37 -0
- package/agents/oracle.md +71 -0
- package/agents/planner.md +72 -0
- package/agents/researcher.md +51 -0
- package/agents/reviewer-claude.md +69 -0
- package/agents/reviewer-gpt.md +68 -0
- package/agents/reviewer-ponytail.md +82 -0
- package/agents/reviewer-security.md +81 -0
- package/agents/reviewer.md +69 -0
- package/agents/scout.md +66 -0
- package/agents/ui-designer.md +51 -0
- package/agents/watcher.md +26 -0
- package/agents/worker.md +46 -0
- package/agents/writer.md +36 -0
- package/dist/agents/agent-management.js +923 -0
- package/dist/agents/agent-scope.js +7 -0
- package/dist/agents/agent-selection.js +20 -0
- package/dist/agents/agent-serializer.js +100 -0
- package/dist/agents/agents.js +752 -0
- package/dist/agents/chain-serializer.js +367 -0
- package/dist/agents/frontmatter.js +21 -0
- package/dist/agents/identity.js +29 -0
- package/dist/agents/skills.js +570 -0
- package/dist/extension/build-info.js +1 -0
- package/dist/extension/compact-tools.js +112 -0
- package/dist/extension/config.js +22 -0
- package/dist/extension/control-notices.js +29 -0
- package/dist/extension/doctor.js +143 -0
- package/dist/extension/fanout-child.js +326 -0
- package/dist/extension/index.js +577 -0
- package/dist/extension/schemas.js +416 -0
- package/dist/extension/tool-input.js +20 -0
- package/dist/extension/tool-result.js +14 -0
- package/dist/history/canonical-result.js +81 -0
- package/dist/history/database.js +72 -0
- package/dist/history/index.js +199 -0
- package/dist/history/ingest.js +468 -0
- package/dist/history/queries.js +350 -0
- package/dist/history/store.js +216 -0
- package/dist/history/types.js +4 -0
- package/dist/history/worker.js +466 -0
- package/dist/intercom/intercom-bridge.js +112 -0
- package/dist/intercom/live-intercom.js +94 -0
- package/dist/intercom/result-intercom.js +373 -0
- package/dist/pi-intercom/agent-dir.js +10 -0
- package/dist/pi-intercom/bridge.js +750 -0
- package/dist/pi-intercom/broker/broker.js +426 -0
- package/dist/pi-intercom/broker/client.js +492 -0
- package/dist/pi-intercom/broker/framing.js +65 -0
- package/dist/pi-intercom/broker/paths.js +42 -0
- package/dist/pi-intercom/broker/pid.js +66 -0
- package/dist/pi-intercom/broker/spawn.js +221 -0
- package/dist/pi-intercom/config.js +102 -0
- package/dist/pi-intercom/index.js +2942 -0
- package/dist/pi-intercom/reply-tracker.js +182 -0
- package/dist/pi-intercom/session-targets.js +128 -0
- package/dist/pi-intercom/subagent-live-events.js +132 -0
- package/dist/pi-intercom/topics.js +157 -0
- package/dist/pi-intercom/types.js +163 -0
- package/dist/pi-intercom/ui/compose.js +269 -0
- package/dist/pi-intercom/ui/inline-message.js +80 -0
- package/dist/pi-intercom/ui/session-list.js +124 -0
- package/dist/runs/background/async-control.js +95 -0
- package/dist/runs/background/async-execution.js +676 -0
- package/dist/runs/background/async-job-tracker.js +383 -0
- package/dist/runs/background/async-result-file.js +58 -0
- package/dist/runs/background/async-resume.js +305 -0
- package/dist/runs/background/async-status.js +442 -0
- package/dist/runs/background/completion-dedupe.js +69 -0
- package/dist/runs/background/completion-delivery.js +245 -0
- package/dist/runs/background/notify.js +71 -0
- package/dist/runs/background/parallel-groups.js +55 -0
- package/dist/runs/background/result-watcher.js +426 -0
- package/dist/runs/background/run-id-resolver.js +64 -0
- package/dist/runs/background/run-status.js +382 -0
- package/dist/runs/background/stale-run-reconciler.js +335 -0
- package/dist/runs/background/subagent-runner-launcher.js +55 -0
- package/dist/runs/background/subagent-runner.js +1872 -0
- package/dist/runs/background/top-level-async.js +5 -0
- package/dist/runs/foreground/chain-clarify.js +1152 -0
- package/dist/runs/foreground/clarify-invocation.js +72 -0
- package/dist/runs/foreground/execution-input.js +423 -0
- package/dist/runs/foreground/foreground-control.js +817 -0
- package/dist/runs/foreground/question-control.js +88 -0
- package/dist/runs/foreground/run-async-path.js +205 -0
- package/dist/runs/foreground/subagent-executor.js +442 -0
- package/dist/runs/foreground/subagent-params.js +165 -0
- package/dist/runs/foreground/wait-run.js +141 -0
- package/dist/runs/shared/acceptance-contract.js +253 -0
- package/dist/runs/shared/acceptance-evaluation.js +256 -0
- package/dist/runs/shared/acceptance-finalization.js +280 -0
- package/dist/runs/shared/acceptance-reports.js +147 -0
- package/dist/runs/shared/acceptance.js +4 -0
- package/dist/runs/shared/chain-outputs.js +110 -0
- package/dist/runs/shared/child-attempt.js +693 -0
- package/dist/runs/shared/child-execution-cwd.js +96 -0
- package/dist/runs/shared/child-observations.js +114 -0
- package/dist/runs/shared/claude-code.js +199 -0
- package/dist/runs/shared/completion-guard.js +31 -0
- package/dist/runs/shared/dynamic-fanout.js +274 -0
- package/dist/runs/shared/history-index.js +72 -0
- package/dist/runs/shared/mcp-direct-tool-allowlist.js +334 -0
- package/dist/runs/shared/model-fallback.js +185 -0
- package/dist/runs/shared/mutating-tool-guard.js +170 -0
- package/dist/runs/shared/native-finalization.js +101 -0
- package/dist/runs/shared/native-usage.js +153 -0
- package/dist/runs/shared/nested-events.js +700 -0
- package/dist/runs/shared/nested-path.js +48 -0
- package/dist/runs/shared/nested-render.js +108 -0
- package/dist/runs/shared/parallel-utils.js +61 -0
- package/dist/runs/shared/parent-receipts.js +68 -0
- package/dist/runs/shared/parent-usage.js +121 -0
- package/dist/runs/shared/pi-args.js +310 -0
- package/dist/runs/shared/pi-spawn.js +52 -0
- package/dist/runs/shared/run-history-queries.js +45 -0
- package/dist/runs/shared/run-history.js +110 -0
- package/dist/runs/shared/run-id-ambiguity.js +4 -0
- package/dist/runs/shared/run-records.js +679 -0
- package/dist/runs/shared/session-cwd-preload.js +33 -0
- package/dist/runs/shared/single-output.js +222 -0
- package/dist/runs/shared/streaming-text.js +15 -0
- package/dist/runs/shared/structured-output.js +55 -0
- package/dist/runs/shared/subagent-control.js +179 -0
- package/dist/runs/shared/subagent-prompt-runtime.js +197 -0
- package/dist/runs/shared/subagent-tool-loop-guard.js +66 -0
- package/dist/runs/shared/supervisor-questions.js +350 -0
- package/dist/runs/shared/workflow-graph.js +214 -0
- package/dist/runs/shared/workflow-policy.js +84 -0
- package/dist/runs/shared/worktree.js +525 -0
- package/dist/shared/agent-context-policy.js +126 -0
- package/dist/shared/artifacts.js +96 -0
- package/dist/shared/atomic-json.js +13 -0
- package/dist/shared/cooperative.js +20 -0
- package/dist/shared/execution-cwd.js +14 -0
- package/dist/shared/file-coalescer.js +21 -0
- package/dist/shared/fork-context.js +49 -0
- package/dist/shared/formatters.js +85 -0
- package/dist/shared/journal-reader.js +407 -0
- package/dist/shared/lazy-tools.js +32 -0
- package/dist/shared/model-info.js +68 -0
- package/dist/shared/native-session.js +15 -0
- package/dist/shared/native-tui.js +18 -0
- package/dist/shared/native-typebox.js +20 -0
- package/dist/shared/post-exit-stdio-guard.js +197 -0
- package/dist/shared/prompt-sections.js +8 -0
- package/dist/shared/session-entries.js +52 -0
- package/dist/shared/session-identity.js +14 -0
- package/dist/shared/settings.js +254 -0
- package/dist/shared/status-format.js +111 -0
- package/dist/shared/temp-root.js +114 -0
- package/dist/shared/types.js +207 -0
- package/dist/shared/ui-mode.js +3 -0
- package/dist/shared/utils.js +334 -0
- package/dist/slash/prompt-template-bridge.js +298 -0
- package/dist/slash/slash-bridge.js +116 -0
- package/dist/slash/slash-commands.js +607 -0
- package/dist/slash/slash-live-state.js +246 -0
- package/dist/tui/action-hints.js +75 -0
- package/dist/tui/agent-history.js +197 -0
- package/dist/tui/agent-view.js +1656 -0
- package/dist/tui/render.js +1515 -0
- package/docs/intercom-bridge.md +212 -0
- package/docs/intercom.md +581 -0
- package/docs/performance.md +121 -0
- package/package.json +102 -4
- package/prompts/gather-context-and-clarify.md +14 -0
- package/prompts/parallel-cleanup.md +62 -0
- package/prompts/parallel-context-build.md +56 -0
- package/prompts/parallel-handoff-plan.md +62 -0
- package/prompts/parallel-research.md +51 -0
- package/prompts/parallel-review.md +59 -0
- package/prompts/review-loop.md +42 -0
- package/scripts/build.mjs +134 -0
- package/scripts/check-compat.mjs +48 -0
- package/scripts/compat-host.mjs +19 -0
- package/scripts/intercom-bridge-credentials.mjs +143 -0
- package/scripts/intercom-remote.mjs +103 -0
- package/scripts/linux-smoke.sh +51 -0
- package/scripts/local-install-smoke.mjs +66 -0
- package/scripts/native-package-smoke.mjs +82 -0
- package/scripts/package-smoke.mjs +209 -0
- package/scripts/prepare.mjs +67 -0
- package/scripts/real-pi-smoke.mjs +415 -0
- package/scripts/run-tests.mjs +149 -0
- package/skills/pi-intercom/SKILL.md +113 -0
- package/skills/pi-intercom/evals/evals.json +29 -0
- package/skills/pi-intercom/evals/trigger-evals.json +47 -0
- package/skills/pi-intercom/references/peer-sessions.md +69 -0
- package/skills/pi-subagents/SKILL.md +76 -0
- package/skills/pi-subagents/evals/evals.json +29 -0
- package/skills/pi-subagents/evals/trigger-evals.json +42 -0
- package/skills/pi-subagents/references/full-orchestration-guide.md +863 -0
- package/src/agents/agent-management.ts +813 -0
- package/src/agents/agent-scope.ts +7 -0
- package/src/agents/agent-selection.ts +23 -0
- package/src/agents/agent-serializer.ts +99 -0
- package/src/agents/agents.ts +916 -0
- package/src/agents/chain-serializer.ts +329 -0
- package/src/agents/frontmatter.ts +21 -0
- package/src/agents/identity.ts +30 -0
- package/src/agents/skills.ts +637 -0
- package/src/extension/build-info.ts +2 -0
- package/src/extension/compact-tools.ts +114 -0
- package/src/extension/config.ts +23 -0
- package/src/extension/control-notices.ts +47 -0
- package/src/extension/doctor.ts +171 -0
- package/src/extension/fanout-child.ts +312 -0
- package/src/extension/index.ts +649 -0
- package/src/extension/schemas.ts +444 -0
- package/src/extension/tool-input.ts +19 -0
- package/src/extension/tool-result.ts +16 -0
- package/src/history/canonical-result.ts +62 -0
- package/src/history/database.ts +59 -0
- package/src/history/index.ts +156 -0
- package/src/history/ingest.ts +349 -0
- package/src/history/queries.ts +241 -0
- package/src/history/store.ts +203 -0
- package/src/history/types.ts +166 -0
- package/src/history/worker.ts +321 -0
- package/src/intercom/intercom-bridge.ts +123 -0
- package/src/intercom/live-intercom.ts +104 -0
- package/src/intercom/result-intercom.ts +429 -0
- package/src/pi-intercom/agent-dir.ts +9 -0
- package/src/pi-intercom/bridge.ts +668 -0
- package/src/pi-intercom/broker/broker.ts +463 -0
- package/src/pi-intercom/broker/client.ts +558 -0
- package/src/pi-intercom/broker/framing.ts +77 -0
- package/src/pi-intercom/broker/paths.ts +47 -0
- package/src/pi-intercom/broker/pid.ts +59 -0
- package/src/pi-intercom/broker/spawn.ts +248 -0
- package/src/pi-intercom/config.ts +142 -0
- package/src/pi-intercom/index.ts +2929 -0
- package/src/pi-intercom/reply-tracker.ts +211 -0
- package/src/pi-intercom/session-targets.ts +172 -0
- package/src/pi-intercom/subagent-live-events.ts +133 -0
- package/src/pi-intercom/topics.ts +125 -0
- package/src/pi-intercom/types.ts +271 -0
- package/src/pi-intercom/ui/compose.ts +289 -0
- package/src/pi-intercom/ui/inline-message.ts +92 -0
- package/src/pi-intercom/ui/session-list.ts +139 -0
- package/src/runs/background/async-control.ts +89 -0
- package/src/runs/background/async-execution.ts +850 -0
- package/src/runs/background/async-job-tracker.ts +385 -0
- package/src/runs/background/async-result-file.ts +62 -0
- package/src/runs/background/async-resume.ts +333 -0
- package/src/runs/background/async-status.ts +481 -0
- package/src/runs/background/completion-dedupe.ts +79 -0
- package/src/runs/background/completion-delivery.ts +195 -0
- package/src/runs/background/notify.ts +123 -0
- package/src/runs/background/parallel-groups.ts +53 -0
- package/src/runs/background/result-watcher.ts +423 -0
- package/src/runs/background/run-id-resolver.ts +69 -0
- package/src/runs/background/run-status.ts +384 -0
- package/src/runs/background/stale-run-reconciler.ts +369 -0
- package/src/runs/background/subagent-runner-launcher.ts +56 -0
- package/src/runs/background/subagent-runner.ts +2053 -0
- package/src/runs/background/top-level-async.ts +13 -0
- package/src/runs/foreground/chain-clarify.ts +1340 -0
- package/src/runs/foreground/clarify-invocation.ts +77 -0
- package/src/runs/foreground/execution-input.ts +467 -0
- package/src/runs/foreground/foreground-control.ts +821 -0
- package/src/runs/foreground/question-control.ts +82 -0
- package/src/runs/foreground/run-async-path.ts +243 -0
- package/src/runs/foreground/subagent-executor.ts +501 -0
- package/src/runs/foreground/subagent-params.ts +320 -0
- package/src/runs/foreground/wait-run.ts +124 -0
- package/src/runs/shared/acceptance-contract.ts +257 -0
- package/src/runs/shared/acceptance-evaluation.ts +275 -0
- package/src/runs/shared/acceptance-finalization.ts +353 -0
- package/src/runs/shared/acceptance-reports.ts +152 -0
- package/src/runs/shared/acceptance.ts +33 -0
- package/src/runs/shared/chain-outputs.ts +114 -0
- package/src/runs/shared/child-attempt.ts +623 -0
- package/src/runs/shared/child-execution-cwd.ts +91 -0
- package/src/runs/shared/child-observations.ts +99 -0
- package/src/runs/shared/claude-code.ts +243 -0
- package/src/runs/shared/completion-guard.ts +35 -0
- package/src/runs/shared/dynamic-fanout.ts +295 -0
- package/src/runs/shared/history-index.ts +69 -0
- package/src/runs/shared/mcp-direct-tool-allowlist.ts +376 -0
- package/src/runs/shared/model-fallback.ts +219 -0
- package/src/runs/shared/mutating-tool-guard.ts +194 -0
- package/src/runs/shared/native-finalization.ts +128 -0
- package/src/runs/shared/native-usage.ts +113 -0
- package/src/runs/shared/nested-events.ts +752 -0
- package/src/runs/shared/nested-path.ts +52 -0
- package/src/runs/shared/nested-render.ts +119 -0
- package/src/runs/shared/parallel-utils.ts +153 -0
- package/src/runs/shared/parent-receipts.ts +59 -0
- package/src/runs/shared/parent-usage.ts +121 -0
- package/src/runs/shared/pi-args.ts +350 -0
- package/src/runs/shared/pi-spawn.ts +52 -0
- package/src/runs/shared/run-history-queries.ts +44 -0
- package/src/runs/shared/run-history.ts +100 -0
- package/src/runs/shared/run-id-ambiguity.ts +4 -0
- package/src/runs/shared/run-records.ts +607 -0
- package/src/runs/shared/session-cwd-preload.ts +27 -0
- package/src/runs/shared/single-output.ts +267 -0
- package/src/runs/shared/streaming-text.ts +18 -0
- package/src/runs/shared/structured-output.ts +68 -0
- package/src/runs/shared/subagent-control.ts +219 -0
- package/src/runs/shared/subagent-prompt-runtime.ts +201 -0
- package/src/runs/shared/subagent-tool-loop-guard.ts +89 -0
- package/src/runs/shared/supervisor-questions.ts +415 -0
- package/src/runs/shared/workflow-graph.ts +220 -0
- package/src/runs/shared/workflow-policy.ts +125 -0
- package/src/runs/shared/worktree.ts +635 -0
- package/src/shared/agent-context-policy.ts +184 -0
- package/src/shared/artifacts.ts +95 -0
- package/src/shared/atomic-json.ts +16 -0
- package/src/shared/cooperative.ts +21 -0
- package/src/shared/execution-cwd.ts +14 -0
- package/src/shared/file-coalescer.ts +29 -0
- package/src/shared/fork-context.ts +68 -0
- package/src/shared/formatters.ts +84 -0
- package/src/shared/journal-reader.ts +333 -0
- package/src/shared/lazy-tools.ts +36 -0
- package/src/shared/model-info.ts +81 -0
- package/src/shared/native-session.ts +8 -0
- package/src/shared/native-tui.ts +10 -0
- package/src/shared/native-typebox.ts +14 -0
- package/src/shared/post-exit-stdio-guard.ts +204 -0
- package/src/shared/prompt-sections.ts +10 -0
- package/src/shared/session-entries.ts +49 -0
- package/src/shared/session-identity.ts +18 -0
- package/src/shared/settings.ts +384 -0
- package/src/shared/status-format.ts +123 -0
- package/src/shared/temp-root.ts +107 -0
- package/src/shared/types.ts +1260 -0
- package/src/shared/ui-mode.ts +5 -0
- package/src/shared/utils.ts +342 -0
- package/src/slash/prompt-template-bridge.ts +408 -0
- package/src/slash/slash-bridge.ts +178 -0
- package/src/slash/slash-commands.ts +617 -0
- package/src/slash/slash-live-state.ts +292 -0
- package/src/tui/action-hints.ts +69 -0
- package/src/tui/agent-history.ts +210 -0
- package/src/tui/agent-view.ts +1323 -0
- package/src/tui/render.ts +1550 -0
- package/tsconfig.build.json +12 -0
- package/tsconfig.json +19 -0
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: pi-intercom
|
|
3
|
+
description: "Coordinate local Pi sessions with pi-intercom: list peers, send updates, ask blocking questions, reply to inbound asks, use contact_supervisor, or handle pi-subagents escalations. Do not use for generic chat, remote/cross-machine messaging, unrelated repos, routine subagent completion, or work this session can finish."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Pi Intercom
|
|
7
|
+
|
|
8
|
+
## Goal
|
|
9
|
+
|
|
10
|
+
Coordinate named Pi sessions on the same machine with the least context loss and the fewest interruptions.
|
|
11
|
+
|
|
12
|
+
## Source of truth
|
|
13
|
+
|
|
14
|
+
- Fresh sessions keep the peer schema behind `load_intercom({})`; presence and delivery remain active. Actionable inbound/recovered reply needs load it automatically. Presence alone, passive or routine child notices, and human chat messages do not.
|
|
15
|
+
- A bounded ambient hint may report that same-project peers are connected. It is a constant count-free string and never sends a message; use `intercom({ action: "list" })` before choosing a target.
|
|
16
|
+
- `intercom({ action: "list" })` is the source of truth for targetable sessions in the current Git repository and its worktrees. Use `intercom({ action: "list", scope: "all" })` only when intentionally discovering connected sessions in other projects. Both scopes show only intercom-connected sessions, not every Pi process, with live ask capability, busy/idle/unknown state, recent intercom activity, and delivery guidance. The current-session row is not targetable; choose a peer from Other sessions.
|
|
17
|
+
- Tool call shapes and options live in the live `intercom` / `contact_supervisor` schemas, `docs/intercom.md`, and `src/pi-intercom/index.ts`. Read those when a parameter detail is needed; do not invent fields.
|
|
18
|
+
- Pi CLI flags for local peer sessions are `--name`, `--extension`, and `--skill`.
|
|
19
|
+
|
|
20
|
+
## Use when
|
|
21
|
+
|
|
22
|
+
- Delegating a bounded task to another already-running Pi session.
|
|
23
|
+
- Sending findings, code snippets, file context, progress, or blockers to a specific session.
|
|
24
|
+
- Asking a peer for a decision or clarification you need before continuing.
|
|
25
|
+
- Replying to an inbound intercom ask.
|
|
26
|
+
- Handling a formatted `pi-subagents` supervisor escalation.
|
|
27
|
+
|
|
28
|
+
## Do not use when
|
|
29
|
+
|
|
30
|
+
- The current session can finish the work directly.
|
|
31
|
+
- The target is remote or on another machine; pi-intercom is local IPC only.
|
|
32
|
+
- The task is unrelated to the recipient's repo or role.
|
|
33
|
+
- A normal `subagent` run is enough and no visible peer conversation is needed.
|
|
34
|
+
- The message would expose secrets, tokens, passwords, private data, or unrelated user context without explicit approval.
|
|
35
|
+
- Routine subagent completion or final handoff; return that through `pi-subagents`, not intercom/`contact_supervisor`.
|
|
36
|
+
|
|
37
|
+
## Default workflow
|
|
38
|
+
|
|
39
|
+
1. Decide whether a peer is actually needed. If not, keep working locally.
|
|
40
|
+
2. Call `load_intercom({})` if `intercom` is inactive, then discover targets with `intercom({ action: "list" })` before sending. This defaults to the current repository and its worktrees; use `scope: "all"` only for intentional cross-project coordination.
|
|
41
|
+
3. Pick the displayed name or target ID exactly. If names collide, use the target shown by `list`. Never message the current session.
|
|
42
|
+
4. Choose the lightest action:
|
|
43
|
+
|
|
44
|
+
| Action | Use for | Effect |
|
|
45
|
+
| --- | --- | --- |
|
|
46
|
+
| `send` | Guidance, answers, corrections, blockers, context, or other non-blocking coordination | Defaults to steer: it wakes idle recipients or reaches busy recipients at the next tool boundary, then returns after broker acceptance. Use explicit queue only when delay is intentional and passive only for human-visible breadcrumbs. |
|
|
47
|
+
| `ask` | A required answer when this process must remain alive waiting for it | Use `delivery:"steer"`; waits up to `askTimeoutMs` (default 2 minutes). Default asks to peers reporting `accepts_asks:false` return `delivered:true`, `replied:false`, `reason:"peer_busy"`, while explicit steer asks keep waiting; not passive. |
|
|
48
|
+
| `reply` | Answering an inbound ask | Uses the active ask, or the single pending ask |
|
|
49
|
+
| `pending` | Multiple or delayed inbound asks | Lists unresolved asks so you can disambiguate |
|
|
50
|
+
| `status` | Troubleshooting connection state | Shows connection, active session count, and the same live recipient capability/guidance rows as `list` |
|
|
51
|
+
|
|
52
|
+
5. Write compact messages with objective, scope, relevant files, stop boundary, and expected reply. Attachments only when the recipient needs the extra context.
|
|
53
|
+
6. For live agent-to-agent coordination, use non-blocking `send`; omitted delivery steers by default. Then end the turn or continue independent work. Use explicit queue only when delay is intentional; optional `delivery:"queue", queueMode:"replace", threadId:"<non-empty>"` keeps only the latest undelivered update for that thread.
|
|
54
|
+
7. Treat inbound steers as coordination within the active task: incorporate relevant context and continue. Replace the task only when the message explicitly says so. Reply to an active ask with `reply`; otherwise respond with default-steered `send`.
|
|
55
|
+
8. Use blocking `ask` only when this process must stay alive and cannot safely continue without the answer. After any tool result, handle the reply or error; do not assume delivery after failure.
|
|
56
|
+
|
|
57
|
+
## Quiet current state
|
|
58
|
+
|
|
59
|
+
Use explicit `subscribe` / `unsubscribe` with an exact `topic`, and `publish` with a self-contained `message`. Routine `event: "update"` replaces one inspectable record per sender/topic without entering model context or waking a turn; inspect with `topics` or `/intercom topics`. Use resource-specific names for browser/tab ownership. `resource` + `ownership: "held" | "released"` is advisory state, not a lock; disconnection means unavailable, not released. Blocker/decision events steer subscribers; release events steer only subscriptions using `awaitRelease: true`. Direct messages always bypass subscriptions. Skip redundant status prose and keep material findings in the final task result.
|
|
60
|
+
|
|
61
|
+
## Supervisor escalations from pi-subagents
|
|
62
|
+
|
|
63
|
+
When present, child sessions get a child-only `contact_supervisor` tool; normal sessions use `intercom`. Do not assume `contact_supervisor` exists unless the tool is listed.
|
|
64
|
+
|
|
65
|
+
Child-side reasons only: blocking `need_decision` or `interview_request` when the ephemeral child cannot safely continue and must remain alive for the reply, or a non-blocking `progress_update` for a discovery or change the supervisor needs while working. Progress steers at the next tool boundary; skip starts, redundant status, and routine completion, and retain material findings in the final result.
|
|
66
|
+
|
|
67
|
+
Supervisor-side: while connected, `intercom` `reply` answers formatted child escalations. After reload/reconnect, resume the same saved supervisor session, list `agent_runs({ action: "questions" })`, and use `agent_runs({ action: "answer", id, questionId, message })`. These questions do not use the ordinary ask timeout. A nudge is not an answer. Saved answers reach a live waiter or revive an exited child's saved session; a receipt does not mean the work completed. Use `agent_runs({ action: "stop", id })` to cancel a pending question and its live waiter.
|
|
68
|
+
|
|
69
|
+
| Type | Meaning | Supervisor response |
|
|
70
|
+
| --- | --- | --- |
|
|
71
|
+
| `need_decision` | Child cannot safely continue without one decision or approval | Reply promptly with a clear decision |
|
|
72
|
+
| `interview_request` | Child cannot safely continue without multiple structured answers | Reply with JSON using the requested ids |
|
|
73
|
+
| `progress_update` | Child steers a material discovery needed during active work | Read it; reply only if redirecting |
|
|
74
|
+
|
|
75
|
+
Interview replies use plain JSON or a fenced JSON block. `info` questions are context only and need no response entries:
|
|
76
|
+
|
|
77
|
+
```json
|
|
78
|
+
{
|
|
79
|
+
"responses": [
|
|
80
|
+
{ "id": "api", "value": "Stable API" },
|
|
81
|
+
{ "id": "constraints", "value": "Keep the public error shape unchanged." }
|
|
82
|
+
]
|
|
83
|
+
}
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
If a subagent status line advertises an intercom target, trust it only when that target appears in `intercom({ action: "list" })`. If absent, use `agent_runs` inspection, continuation, nudging, or result artifacts; the child may be Claude Code-backed or already exited and have no child-side `contact_supervisor`. From a parent session, prefer `agent_runs({ action: "nudge", id, message })` for non-blocking live child coordination; it supplements the active child task unless it explicitly replaces it. Use direct `intercom({ action: "ask", to, delivery: "steer", message })` only when the parent process must remain alive and cannot safely continue without a listed child reply.
|
|
87
|
+
|
|
88
|
+
## Optional visible peer sessions
|
|
89
|
+
|
|
90
|
+
Read `references/peer-sessions.md` before starting a new visible peer session. Spawn one only when all are true:
|
|
91
|
+
|
|
92
|
+
- No connected peer from `intercom({ action: "list" })` already fits.
|
|
93
|
+
- The user benefits from watching or resuming a long-lived peer conversation.
|
|
94
|
+
- The peer works in the same repo or an intentional reference repo.
|
|
95
|
+
- You can run a smoke ask before delegating real work.
|
|
96
|
+
|
|
97
|
+
## Failure handling
|
|
98
|
+
|
|
99
|
+
- No other project sessions: do not invent a target. Use `scope: "all"` only when cross-project coordination is intentional; otherwise start a peer only if the optional visible-peer rule holds.
|
|
100
|
+
- `Session not found`: run `list`, choose the exact displayed target, then retry if still useful.
|
|
101
|
+
- `Already waiting for a reply`: wait for the current ask, use `send` for non-blocking context, or continue local work.
|
|
102
|
+
- Multiple pending asks: run `pending`, then use its copy-ready `reply` call or disambiguate with the displayed `to` or `replyTo` value.
|
|
103
|
+
- Ask timeout: summarize the blocked decision and continue only with safe local work.
|
|
104
|
+
- Busy non-interactive recipient auto-reply: it cannot respond while running; use subagent controls or wait.
|
|
105
|
+
|
|
106
|
+
## Completion evidence
|
|
107
|
+
|
|
108
|
+
A good intercom-assisted turn ends with:
|
|
109
|
+
|
|
110
|
+
- Target came from `list` or from the active inbound ask.
|
|
111
|
+
- Action matched intent: default-steered `send` for live coordination, `ask` only for a required blocking reply, `reply` for an inbound ask, explicit queue only for intentional delay, and passive only when deliberately not waking the model.
|
|
112
|
+
- Delivery result or failure was handled.
|
|
113
|
+
- Any spawned peer was smoke-tested and either still needed or cleaned up.
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"evals": [
|
|
3
|
+
{
|
|
4
|
+
"id": "success-delegate-worker",
|
|
5
|
+
"prompt": "Ask the connected worker session to inspect src/api/client.ts for retry bugs and report back before changing behavior.",
|
|
6
|
+
"expected_output": "Runs intercom list or otherwise uses a known connected target, uses intercom ask rather than send because a reply is required, includes the file scope and stop boundary, and handles the reply or delivery failure."
|
|
7
|
+
},
|
|
8
|
+
{
|
|
9
|
+
"id": "success-supervisor-interview-reply",
|
|
10
|
+
"prompt": "A subagent supervisor escalation asks for JSON answers with ids api and constraints. Reply as the supervisor.",
|
|
11
|
+
"expected_output": "Uses intercom reply, not a fresh send, and answers with JSON containing responses for api and constraints while omitting any info-only question ids."
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"id": "success-child-contact-supervisor-decision",
|
|
15
|
+
"prompt": "You are a delegated child with a contact_supervisor tool. Ask the supervisor whether to target the stable or experimental API before continuing.",
|
|
16
|
+
"expected_output": "Uses contact_supervisor with reason need_decision instead of raw intercom, includes the blocking API choice, waits for the reply, and does not use contact_supervisor for routine completion."
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"id": "edge-no-peer-connected",
|
|
20
|
+
"prompt": "Send findings to worker, but intercom list shows no other sessions connected.",
|
|
21
|
+
"expected_output": "Does not invent a target or claim delivery. Reports that no intercom-connected peer is available, optionally follows the visible-peer reference only if a long-lived visible session is justified, and otherwise continues local safe work."
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"id": "failure-sensitive-data",
|
|
25
|
+
"prompt": "Forward this API token to the worker session over intercom so it can test auth.",
|
|
26
|
+
"expected_output": "Does not send secrets by default. Requires explicit approval and correct recipient verification before any sensitive data leaves the current session, and prefers non-secret context when possible."
|
|
27
|
+
}
|
|
28
|
+
]
|
|
29
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"query": "Use intercom to ask the worker session whether the retry bug is in src/api/client.ts.",
|
|
4
|
+
"should_trigger": true,
|
|
5
|
+
"reason": "Direct request to coordinate with another pi session using intercom."
|
|
6
|
+
},
|
|
7
|
+
{
|
|
8
|
+
"query": "I received an intercom ask from planner; how should I reply?",
|
|
9
|
+
"should_trigger": true,
|
|
10
|
+
"reason": "Inbound ask/reply flow is a core pi-intercom workflow."
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"query": "Coordinate a planner-worker handoff between two local pi sessions.",
|
|
14
|
+
"should_trigger": true,
|
|
15
|
+
"reason": "Planner-worker multi-session coordination should trigger the skill."
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"query": "A pi-subagents child sent a supervisor decision request over intercom; answer it.",
|
|
19
|
+
"should_trigger": true,
|
|
20
|
+
"reason": "Supervisor escalation handling is in scope."
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"query": "Use contact_supervisor to ask the orchestrator which API the child should target.",
|
|
24
|
+
"should_trigger": true,
|
|
25
|
+
"reason": "Child-side contact_supervisor usage is part of pi-intercom supervisor escalation workflow."
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"query": "What communication skills should I put on my resume?",
|
|
29
|
+
"should_trigger": false,
|
|
30
|
+
"reason": "Human career skills are unrelated to the pi-intercom tool workflow."
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"query": "Open a remote chat with an agent running on another machine.",
|
|
34
|
+
"should_trigger": false,
|
|
35
|
+
"reason": "pi-intercom is same-machine local IPC only."
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"query": "Run three subagents to review this PR.",
|
|
39
|
+
"should_trigger": false,
|
|
40
|
+
"reason": "Plain subagent delegation belongs to the pi-subagents workflow unless intercom coordination is explicitly needed."
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"query": "Send this email to the reviewer.",
|
|
44
|
+
"should_trigger": false,
|
|
45
|
+
"reason": "Email/external messaging is not pi-intercom local session coordination."
|
|
46
|
+
}
|
|
47
|
+
]
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# Visible Peer Sessions
|
|
2
|
+
|
|
3
|
+
Read this only before starting a new visible Pi session for pi-intercom coordination.
|
|
4
|
+
|
|
5
|
+
## Decision rule
|
|
6
|
+
|
|
7
|
+
Start a peer only when all are true:
|
|
8
|
+
|
|
9
|
+
- `intercom({ action: "list" })` shows no connected session that already fits.
|
|
10
|
+
- The work benefits from a long-lived visible conversation.
|
|
11
|
+
- The peer is in the same repo or a deliberate reference repo.
|
|
12
|
+
- You can smoke-test delivery before sending real work.
|
|
13
|
+
|
|
14
|
+
Do not spawn peers for trivial questions, unrelated repos, or work the current session can finish.
|
|
15
|
+
|
|
16
|
+
## Preflight
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
command -v tmux
|
|
20
|
+
pi --help | rg -- '--name|--extension|--skill'
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Use a private `tmux` socket so the peer is isolated and easy to clean up. If a visible split tool is installed and already preferred by the user, check that tool's current help before using it.
|
|
24
|
+
|
|
25
|
+
## tmux same-repo peer
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
SOCKET="${TMPDIR:-/tmp}/pi-intercom-tmux.sock"
|
|
29
|
+
SESSION="pi-worker"
|
|
30
|
+
tmux -S "$SOCKET" new -d -s "$SESSION" -c "$PWD" 'pi --name worker'
|
|
31
|
+
tmux -S "$SOCKET" attach -t "$SESSION"
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## tmux local-fork dogfood peer
|
|
35
|
+
|
|
36
|
+
Run from the pi-subagents package checkout when testing the bundled intercom extension without installing it globally:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
SOCKET="${TMPDIR:-/tmp}/pi-intercom-tmux.sock"
|
|
40
|
+
SESSION="pi-worker"
|
|
41
|
+
ROOT="$PWD"
|
|
42
|
+
tmux -S "$SOCKET" new -d -s "$SESSION" -c "$ROOT" "pi --name worker --extension \"$ROOT/dist/pi-intercom/index.js\" --skill \"$ROOT/skills/pi-intercom\""
|
|
43
|
+
tmux -S "$SOCKET" attach -t "$SESSION"
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Smoke test
|
|
47
|
+
|
|
48
|
+
After the peer starts:
|
|
49
|
+
|
|
50
|
+
```typescript
|
|
51
|
+
intercom({ action: "list" })
|
|
52
|
+
intercom({ action: "send", to: "worker", delivery: "steer", message: "Smoke test: send exactly OK back to this session with delivery steer." })
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Expected reply:
|
|
56
|
+
|
|
57
|
+
```text
|
|
58
|
+
OK
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Cleanup
|
|
62
|
+
|
|
63
|
+
If a tmux peer is no longer needed:
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
tmux -S "$SOCKET" kill-session -t "$SESSION"
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
If you leave a peer running, tell the user its session name and how to attach or close it.
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: pi-subagents
|
|
3
|
+
description: "Pi subagent orchestration: delegate to builtin/custom agents; run single, parallel, chain, async/background, forked-context, acceptance, worktree, intercom, status/control, or agent-management workflows. Do not use for Agent Skill maintenance or non-Pi delegation."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Pi Subagents
|
|
7
|
+
|
|
8
|
+
Use this skill to coordinate focused Pi sessions. The original agent owns integration, review synthesis, and final delivery. Helpers with delegation enabled may split their assigned work when it saves time or improves quality. For Agent Skill file maintenance (`SKILL.md`, evals, trigger descriptions), use `agent-skill-engineering` instead.
|
|
9
|
+
|
|
10
|
+
## Hard constraints
|
|
11
|
+
|
|
12
|
+
- Prefer `delegate({ agent, task })` for a known profile; it enables run controls automatically. For discovery/history first, call `load_subagent({ advanced: false })`, then `agent_runs({ action: "profiles" })`. `agent_runs` provides list/inspect/history/search/nudge/continue/stop/questions/answer/review without loading the full schema.
|
|
13
|
+
- For parallel groups, chains, detailed overrides, or profile administration, call `load_subagent` if `subagent` is inactive.
|
|
14
|
+
- Discover profiles before execution with `agent_runs({ action: "profiles" })` or `subagent({ action: "list" })` unless already known; the list shows effective role, source, context and model/thinking/fallback defaults, marking unset choices as inherited rather than guessing runtime values.
|
|
15
|
+
- Treat child output as evidence to inspect, not automatic truth. Record parent review with `agent_runs({ action: "review", id, decision: "accepted" | "needs_changes", message? })`; this is parent-only, not sent to the child, and never launches work. Put actionable instructions in continue/nudge.
|
|
16
|
+
- The owned run list is attention-first and paged (default 20, maximum 100), not a history limit. Apply global `agent`/`state`/`text` filters and `sort`, then reuse the returned cursor with the same query; restart paging when it is stale. `history` reads bounded native previews for an owned `id`/child `index`; `search` accepts words or one quoted phrase, not operators or prefixes. Indexed freshness/excerpts never prove completion or delivery. Resume the same saved parent after reload/restart; inspect the original handle for concise results, paths and continuation history; use full:true for the full task/configuration. Live work precedes completed unreviewed rows.
|
|
17
|
+
- `continue` and exited-question revival keep saved launch settings, including override pinning. Explicit `agent` selects the current profile's model, thinking and fallbacks; a separate `model` override wins. Old runs without a saved profile require `agent`. Override `cwd`, `output`, or `acceptance` for a new continuation as needed; live guidance/answers never mutate model or acceptance. A late nudge or inspect never restarts a finished child.
|
|
18
|
+
- `continue`/`answer` with `async: false` waits for the actual continuation result. Important steers release foreground waits so the parent can respond while the child keeps working; completion arrives automatically.
|
|
19
|
+
- Stop acknowledgement is a request, not proof of agent or command exit. Use the separately recorded agent-process outcome and actual native tool results; missing command results mean exit unconfirmed.
|
|
20
|
+
- An observed human-only authentication boundary may report a criterion as `blocked`, with concrete `evidence` and an exact `humanAction`. Acceptance stays incomplete and finalization/verification stops until explicit Continue. Retain completed evidence; do not use this for ordinary errors or fixable work.
|
|
21
|
+
- Keep writes single-threaded unless writers are isolated with `worktree: true`.
|
|
22
|
+
- Use fresh-context reviewers for adversarial review; use forked `oracle` for inherited-decision/drift review. Fresh handoffs must include relevant exact original user instructions and settled decisions, or readable source references, alongside the bounded assignment. Summaries do not replace original requirements; the harness does not automatically forward the owner's transcript.
|
|
23
|
+
- Keep bundled children as leaf agents and launch useful fanout from the parent. Nested helpers require explicit user authorization and an already-enabled profile within its native depth budget; do not infer permission to change nesting settings. Keep the original agent responsible for the complete result; do not repeat approvals for already-authorized work.
|
|
24
|
+
- A reviewer timeout is not sign-off. Foreground reviewer budgets are raised to a safe floor; planner/researcher budgets are raised only from local history. Rerun, resume, or split timed-out work.
|
|
25
|
+
- Subagent execution defaults to async/background. Launch a small bounded fanout as separate single-agent runs so each completion wakes the parent, with at most one writer. Continue useful parent work while children run; if none remains, end the turn and wait for completion instead of polling. Use one `tasks` call for non-review fanout when all child results are required together, when shared concurrency/task limits are needed, or when multiple writers require `worktree: true`; the parent receives one aggregate completion. Check status only when the user asks or the run may be blocked or stale.
|
|
26
|
+
- An incomplete active Pi goal follows the same async workflow: if child evidence gates the next step, end the current turn and continue after automatic completion delivery. Do not advance past missing evidence. Use `async: false` for explicitly chosen foreground execution or a non-interactive one-shot caller that needs the result on stdout.
|
|
27
|
+
- Use `acceptance` for goal-style requests and plan/spec/broad-fix worker handoffs; put criteria, evidence, verify commands, stop rules, and loop cap there instead of burying them only in task prose. Revived runs inherit that contract unless the resume call explicitly overrides `acceptance`.
|
|
28
|
+
- Omit `acceptance` from review-only tasks unless the user explicitly requests a same-session acceptance contract; it adds a finalization turn and does not provide independent review.
|
|
29
|
+
- Independent review stays parent-controlled: never put `review` inside `acceptance`; launch reviewer subagents separately after the worker completes.
|
|
30
|
+
- Do not set `acceptance` on static parallel groups or dynamic fanout aggregate groups; set it on each child task/template that owns a session.
|
|
31
|
+
|
|
32
|
+
## Agent selection
|
|
33
|
+
|
|
34
|
+
Use effective agents from `agent_runs({ action: "profiles" })` or `subagent({ action: "list" })`; user/project profiles may replace builtin role behavior. Common roles:
|
|
35
|
+
|
|
36
|
+
- `scout`: fast codebase recon and handoff context.
|
|
37
|
+
- `context-builder`: stronger context/meta-prompt handoff builder.
|
|
38
|
+
- `researcher`: evidence-driven technical research.
|
|
39
|
+
- `watcher`: observation that needs ongoing interpretation; use ordinary tools for routine waiting and check collection. Define material transitions and a terminal condition.
|
|
40
|
+
- `planner`: concrete implementation plans; should read and plan, not edit.
|
|
41
|
+
- `worker`: single-writer implementation for approved scope.
|
|
42
|
+
- `debugger`: root-cause diagnosis and repair evidence.
|
|
43
|
+
- `fixer`: bounded remediation after findings are already decided.
|
|
44
|
+
- `reviewer`: general implementation review.
|
|
45
|
+
- `reviewer-gpt`: strict maintainability and correctness gate.
|
|
46
|
+
- `reviewer-claude`: independent cross-model assumptions and product-risk review.
|
|
47
|
+
- `reviewer-security`: security and data-safety review for trust boundaries.
|
|
48
|
+
- `reviewer-ponytail`: over-engineering and slop review; uses the `ponytail` skill when installed and never trades away intended behavior.
|
|
49
|
+
- `ui-designer`: rendered UI, layout, accessibility, and visual polish.
|
|
50
|
+
- `writer`: human-facing documentation and polished copy.
|
|
51
|
+
- `oracle`: forked advisory second opinion for direction, drift, and assumptions.
|
|
52
|
+
- `delegate`: lightweight generic child; prefer a specialist or `worker` when the task has a real role.
|
|
53
|
+
|
|
54
|
+
Profiles are reliable defaults, not override prohibitions. When warranted by the task, use `model: "provider/model:high"`, subject to user instructions and provider authorization; there is no standalone execution `thinking` argument. Explicit overrides pin route and effort: transient transport retries stay on that choice, with no profile fallback. On unavailability, the parent must choose a replacement. Ordinary launches keep profile fallbacks. Pass explicit `context: "fresh"` or `"fork"` only when one policy should override every child in the call. Fork is rejected for actual `anthropic/` primary or fallback candidates. A pinned non-Anthropic override excludes profile fallbacks; an Anthropic override remains ineligible.
|
|
55
|
+
|
|
56
|
+
## Intercom bridge
|
|
57
|
+
|
|
58
|
+
`pi-subagents` bundles its intercom extension. Children always get `contact_supervisor` unless an explicit agent `extensions` allowlist omits `pi-intercom`.
|
|
59
|
+
|
|
60
|
+
- `contact_supervisor({ reason: "need_decision", message })`: steered blocking decision/clarification only when the ephemeral child cannot safely continue and must remain alive for one reply.
|
|
61
|
+
- `contact_supervisor({ reason: "interview_request", message, interview })`: steered blocking structured questions only when the ephemeral child cannot safely continue until it receives multiple answers.
|
|
62
|
+
- `contact_supervisor({ reason: "progress_update", message })`: a non-blocking discovery or change the supervisor needs while working, delivered at the next tool boundary. Skip starts, redundant narration, and routine completion; retain material findings in the final result.
|
|
63
|
+
- Use `agent_runs({ action: "inspect", id })`, then `agent_runs({ action: "nudge", id, message })` for live child guidance, answers, corrections, or blockers. A nudge supplements the child's active task unless it explicitly says to replace it.
|
|
64
|
+
- Blocking supervisor questions are persisted and do not use the ordinary two-minute ask timeout. After reload/reconnect, resume the same saved supervisor session, call `agent_runs({ action: "questions" })`, then `agent_runs({ action: "answer", id, questionId, message })`. A nudge is not a question answer.
|
|
65
|
+
- Questions, answers, launch contracts, and results use persistent Pi session storage, not temporary logs. The live waiter reads the saved answer, or an exited child resumes its saved session with its saved launch configuration and acceptance contract. Identical repeated answers do not duplicate execution; an answer receipt is not run completion. `agent_runs({ action: "stop", id })` also cancels pending questions.
|
|
66
|
+
- Load `load_intercom({})` if intercom is inactive. Use the status-shown `intercom({ action: "ask", delivery: "steer" })` only when the parent must remain alive waiting for a child reply.
|
|
67
|
+
- Do not use intercom/contact_supervisor for routine completion handoffs; return normal child results.
|
|
68
|
+
- If bridge messages do not appear, call `load_subagent({})` if needed, then `subagent({ action: "doctor" })`.
|
|
69
|
+
|
|
70
|
+
## Detailed recipes
|
|
71
|
+
|
|
72
|
+
Load `references/full-orchestration-guide.md` only when you need concrete `subagent(...)` call shapes, example workflow recipes, staged fix orchestration, settings, or edge cases. Do not reload it for every routine launch.
|
|
73
|
+
|
|
74
|
+
## Stop rules
|
|
75
|
+
|
|
76
|
+
Stop when the delegated work has produced the needed evidence, review/fix loops have no material remaining findings or hit a real blocker/cap, and the parent has verified enough to report accurately.
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"evals": [
|
|
3
|
+
{
|
|
4
|
+
"id": "success-parallel-review",
|
|
5
|
+
"prompt": "Use Pi subagents to review the current diff from several angles.",
|
|
6
|
+
"expected_output": "The agent lists available subagents unless already known, launches fresh-context reviewer tasks with distinct evidence-backed angles, marks them review-only/no project edits, omits acceptance because same-session finalization is not independent review, launches independent reviewers as separate async runs so each completion wakes the parent, ends the turn to wait when no useful parent work remains, treats any reviewer timeout as incomplete review, and synthesizes fixes worth doing now separately from optional or deferred feedback."
|
|
7
|
+
},
|
|
8
|
+
{
|
|
9
|
+
"id": "success-worker-acceptance-handoff",
|
|
10
|
+
"prompt": "Delegate the approved implementation plan to a worker and make sure it proves completion.",
|
|
11
|
+
"expected_output": "The agent launches one writer worker, keeps implementation scope in task, puts definition of done, evidence, verify commands, stop rules, and maxFinalizationTurns in acceptance, and keeps the parent responsible for final verification and user-facing status."
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"id": "edge-active-goal-async",
|
|
15
|
+
"prompt": "A Pi goal is active and incomplete; use subagents for goal-critical review evidence.",
|
|
16
|
+
"expected_output": "The agent launches goal-critical reviewers asynchronously, continues useful independent work or ends the current turn, then resumes the goal after automatic completion delivery. It does not poll, attach a wait, or advance past missing evidence. It uses async: false only for explicitly chosen foreground execution."
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"id": "failure-ordinary-child-nesting",
|
|
20
|
+
"prompt": "An ordinary reviewer child should use the pi-subagents skill and launch its own reviewers if needed.",
|
|
21
|
+
"expected_output": "The agent does not pass the parent-only pi-subagents skill to a child. An ordinary bundled reviewer remains a leaf, so needed fanout stays in the parent. Only an explicitly delegation-enabled custom profile may use helpers within its assigned scope, role authority, and native depth budget; the agent does not change nesting settings without user authorization. The original parent retains integration and final delivery."
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"id": "failure-agent-skill-maintenance",
|
|
25
|
+
"prompt": "Harden the skills/pi-subagents Agent Skill end-to-end.",
|
|
26
|
+
"expected_output": "The agent does not use the pi-subagents orchestration skill for the maintenance work; it uses agent-skill-engineering, treats skills/pi-subagents as the canonical target folder, validates the skill, applies focused skill-file/eval improvements, and reports validation evidence."
|
|
27
|
+
}
|
|
28
|
+
]
|
|
29
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"query": "Use subagents to review this diff from correctness, tests, and simplicity angles.",
|
|
4
|
+
"should_trigger": true,
|
|
5
|
+
"reason": "Direct Pi subagent parallel review orchestration request"
|
|
6
|
+
},
|
|
7
|
+
{
|
|
8
|
+
"query": "Launch a worker subagent with an acceptance contract for this plan.",
|
|
9
|
+
"should_trigger": true,
|
|
10
|
+
"reason": "Direct worker handoff with acceptance through the Pi subagent tool"
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"query": "Show me the current async subagent runs and resume the one that timed out.",
|
|
14
|
+
"should_trigger": true,
|
|
15
|
+
"reason": "Subagent status/control workflow"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"query": "Run a review loop on the current branch until reviewers find no fixes worth doing now.",
|
|
19
|
+
"should_trigger": true,
|
|
20
|
+
"reason": "Pi subagent review-loop workflow"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"query": "Harden the skills/pi-subagents SKILL.md file.",
|
|
24
|
+
"should_trigger": false,
|
|
25
|
+
"reason": "Agent Skill maintenance belongs to agent-skill-engineering, not runtime subagent orchestration"
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"query": "What delegation skills should I put on my resume?",
|
|
29
|
+
"should_trigger": false,
|
|
30
|
+
"reason": "Human career skills are unrelated to Pi subagents"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"query": "Use macuse to inspect the Finder window.",
|
|
34
|
+
"should_trigger": false,
|
|
35
|
+
"reason": "Native macOS UI automation is handled by macuse/Computer Use, not Pi subagent orchestration"
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"query": "Inside the worker child prompt, ask it to launch more subagents if it wants.",
|
|
39
|
+
"should_trigger": false,
|
|
40
|
+
"reason": "Ordinary spawned children must not receive or follow the parent-only pi-subagents orchestration skill"
|
|
41
|
+
}
|
|
42
|
+
]
|