@gtheys/pi-interactive-subagents 0.0.0-stage → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +462 -2
- package/agents/claude-code.md +23 -0
- package/agents/planner.md +569 -0
- package/agents/reviewer.md +152 -0
- package/agents/scout.md +112 -0
- package/agents/visual-tester.md +202 -0
- package/agents/worker.md +109 -0
- package/config.json.example +6 -0
- package/config.schema.json +71 -0
- package/package.json +59 -4
- package/pi-extension/subagents/activity.ts +730 -0
- package/pi-extension/subagents/asks.ts +234 -0
- package/pi-extension/subagents/assignments.ts +395 -0
- package/pi-extension/subagents/config.ts +191 -0
- package/pi-extension/subagents/control.ts +172 -0
- package/pi-extension/subagents/dataroot.ts +52 -0
- package/pi-extension/subagents/delivered.ts +81 -0
- package/pi-extension/subagents/flow-env.ts +112 -0
- package/pi-extension/subagents/herdr.ts +323 -0
- package/pi-extension/subagents/inbox.ts +213 -0
- package/pi-extension/subagents/index.ts +5003 -0
- package/pi-extension/subagents/lock.ts +318 -0
- package/pi-extension/subagents/peer-bindings.ts +175 -0
- package/pi-extension/subagents/peers.ts +401 -0
- package/pi-extension/subagents/plan-skill.md +219 -0
- package/pi-extension/subagents/plugin/.claude-plugin/plugin.json +5 -0
- package/pi-extension/subagents/plugin/hooks/hooks.json +15 -0
- package/pi-extension/subagents/plugin/hooks/on-stop.sh +68 -0
- package/pi-extension/subagents/retention.ts +918 -0
- package/pi-extension/subagents/retirement.ts +216 -0
- package/pi-extension/subagents/session.ts +194 -0
- package/pi-extension/subagents/snapshot.ts +151 -0
- package/pi-extension/subagents/spawn.ts +237 -0
- package/pi-extension/subagents/spawnseq.ts +116 -0
- package/pi-extension/subagents/state-events.ts +152 -0
- package/pi-extension/subagents/status.ts +886 -0
- package/pi-extension/subagents/store.ts +245 -0
- package/pi-extension/subagents/subagent-done.ts +1452 -0
- package/pi-extension/subagents/surface.ts +365 -0
- package/pi-extension/subagents/task-composition.ts +113 -0
- package/pi-extension/subagents/tool-effects.ts +203 -0
- package/pi-extension/subagents/usage.ts +330 -0
- package/pi-extension/subagents/watermark.ts +126 -0
- package/pi-extension/subagents/worktrees.ts +147 -0
- package/skills/subagent-orchestration/SKILL.md +57 -0
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Stop hook for pi-spawned Claude sessions.
|
|
3
|
+
# Writes a sentinel file when Claude completes autonomously (no user interjection).
|
|
4
|
+
|
|
5
|
+
set -euo pipefail
|
|
6
|
+
|
|
7
|
+
# Read JSON input from stdin
|
|
8
|
+
input=$(cat)
|
|
9
|
+
|
|
10
|
+
# Guard: if stop_hook_active is true, we're in a loop — bail out
|
|
11
|
+
stop_hook_active=$(echo "$input" | python3 -c "import sys,json; d=json.load(sys.stdin); print(d.get('stop_hook_active', False))" 2>/dev/null || echo "False")
|
|
12
|
+
if [ "$stop_hook_active" = "True" ]; then
|
|
13
|
+
exit 0
|
|
14
|
+
fi
|
|
15
|
+
|
|
16
|
+
# Guard: only act for pi-spawned sessions
|
|
17
|
+
if [ -z "${PI_CLAUDE_SENTINEL:-}" ]; then
|
|
18
|
+
exit 0
|
|
19
|
+
fi
|
|
20
|
+
|
|
21
|
+
# Get transcript path
|
|
22
|
+
transcript_path=$(echo "$input" | python3 -c "import sys,json; d=json.load(sys.stdin); print(d.get('transcript_path', ''))" 2>/dev/null || echo "")
|
|
23
|
+
if [ -z "$transcript_path" ] || [ ! -f "$transcript_path" ]; then
|
|
24
|
+
exit 0
|
|
25
|
+
fi
|
|
26
|
+
|
|
27
|
+
# Count real human messages in transcript (not tool results)
|
|
28
|
+
# Claude's transcript format:
|
|
29
|
+
# Human message: {"type": "user", "message": {"role": "user", "content": "..."}}
|
|
30
|
+
# Tool result: {"type": "user", "message": {"role": "user", "content": [{"type": "tool_result", ...}]}}
|
|
31
|
+
# We only count entries where content is a string (real human input)
|
|
32
|
+
user_msg_count=$(python3 - "$transcript_path" <<'EOF'
|
|
33
|
+
import sys, json
|
|
34
|
+
|
|
35
|
+
transcript_path = sys.argv[1]
|
|
36
|
+
count = 0
|
|
37
|
+
with open(transcript_path, 'r') as f:
|
|
38
|
+
for line in f:
|
|
39
|
+
line = line.strip()
|
|
40
|
+
if not line:
|
|
41
|
+
continue
|
|
42
|
+
try:
|
|
43
|
+
entry = json.loads(line)
|
|
44
|
+
if entry.get('type') != 'user':
|
|
45
|
+
continue
|
|
46
|
+
content = entry.get('message', {}).get('content', '')
|
|
47
|
+
# Real human messages have string content
|
|
48
|
+
# Tool results have array content with tool_result blocks
|
|
49
|
+
if isinstance(content, str):
|
|
50
|
+
count += 1
|
|
51
|
+
except (json.JSONDecodeError, AttributeError):
|
|
52
|
+
pass
|
|
53
|
+
print(count)
|
|
54
|
+
EOF
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
# Always write transcript path so the watcher can copy the session file
|
|
58
|
+
if [ -n "$transcript_path" ]; then
|
|
59
|
+
echo "$transcript_path" > "${PI_CLAUDE_SENTINEL}.transcript" 2>/dev/null || true
|
|
60
|
+
fi
|
|
61
|
+
|
|
62
|
+
# If exactly 1 user message (the initial prompt), this was autonomous — signal completion
|
|
63
|
+
if [ "$user_msg_count" -eq 1 ]; then
|
|
64
|
+
# Write last_assistant_message to sentinel so the watcher gets a clean result
|
|
65
|
+
echo "$input" | python3 -c "import sys,json; d=json.load(sys.stdin); print(d.get('last_assistant_message', ''))" > "$PI_CLAUDE_SENTINEL" 2>/dev/null || touch "$PI_CLAUDE_SENTINEL"
|
|
66
|
+
fi
|
|
67
|
+
|
|
68
|
+
exit 0
|