refactor: load subagents from user config (~/.pi/subagents/)

- Discover prompts from ~/.pi/subagents/*.md instead of bundled prompts/
- Only register the subagent tool when at least one subagent exists
- Remove directory path from tool description (agents listed dynamically)
This commit is contained in:
2026-05-12 16:35:37 -04:00
parent 5c5cdb3aec
commit 84bcff94a0
4 changed files with 18 additions and 10 deletions

View File

@@ -9,6 +9,8 @@ This repo implements the `subagent` pi extension in `index.ts`.
- Parent-facing tool: `subagent`.
- Internal child-only tool: `subagent_finalize`.
- Never register `subagent_finalize` in the parent context; only when `PI_SUBAGENT_CHILD=1`.
- Subagents are loaded from `~/.pi/subagents/*.md` (user config only).
- The `subagent` tool is only registered when at least one subagent exists.
- Subagent sessions are sticky and persisted at:
`~/.pi/subagent-sessions/<cwd-hash>/<agent>_<sessionId>.jsonl`.
- Omitting `sessionId` creates a new UUID-backed session.