[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6E35KMXXFF8J82CX2YD4P9B":3,"skill-same:01M6E35KMXXFF8J82CX2YD4P9B":49},{"skillNo":4,"name":5,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":17,"publishedAt":22,"linkOnly":23,"markdownContent":24,"markdownBody":24,"frontMatter":25,"refName":26,"commitSha":27,"skillDirectory":28,"forksCount":29,"repositoryHtmlUrl":30,"repositoryHomepageUrl":31,"ownerHtmlUrl":32,"ownerBlogUrl":6,"ownerDescription":33,"updatedAt":34,"install":35,"resources":48},"01M6E35KMXXFF8J82CX2YD4P9B","demo-subagents-tui",null,"dimetron\u002Fpi-go","dimetron","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F877433?v=4","01M6E34QX9HKYKMWJVZQEPR2Q3","Dmytro Rashko","01M6E34R2A6563XM0PTZE8KPGG",224,"MIT","https:\u002F\u002Fgithub.com\u002Fdimetron\u002Fpi-go\u002Fblob\u002Fmain\u002F.pi-go\u002Fskills\u002Fdemo-subagents-tui\u002FSKILL.md",[],[18,19,20,21],"demo","tui","subagents","demo subagents tui","2026-11-10 10:12:30",false,"# Demo: Subagents in pi-go TUI\n\nThis skill demonstrates how to use the **agent tool** to spawn subagents within the pi-go TUI for parallel task execution. Subagents are autonomous child processes that run concurrently, enabling efficient parallelization of independent tasks.\n\n## Overview\n\nThe subagent system allows the main agent to spawn child agents that execute tasks independently. Each subagent:\n- Runs as a separate `pi` subprocess\n- Receives its own prompt and context\n- Streams events back to the TUI for live display\n- Returns a final result upon completion\n\n**Available agent types:**\n\n| Type | Role | Worktree | Best For |\n|------|------|----------|----------|\n| `explore` | smol | No | Fast, read-only codebase exploration |\n| `plan` | plan | No | Analysis and implementation planning |\n| `task` | default | Yes | Full coding tasks with code changes |\n| `designer` | slow | Yes | Code creation and modification |\n| `reviewer` | slow | No | Code review with git inspection |\n| `quick-task` | smol | No | Small, focused tasks |\n\n**Limitations:**\n- Maximum **8 concurrent subagents** at a time (pool size: 5)\n- Subagents run in isolated git worktrees for `task`, `designer` types\n- Worktrees are automatically cleaned up after completion\n\n---\n\n## Three Execution Modes\n\nThe subagent tool supports three execution modes:\n\n### Single Mode\nSpawn one agent to perform a specific task.\n\n```json\n{\n  \"agent\": \"explore\",\n  \"task\": \"Find all test files in the project and identify testing patterns used.\"\n}\n```\n\n### Parallel Mode\nSpawn multiple agents concurrently (max 8) to work on independent tasks simultaneously.\n\n```json\n{\n  \"tasks\": [\n    {\"agent\": \"explore\", \"task\": \"Find all error handling patterns in internal\u002Ftools\u002F\"},\n    {\"agent\": \"reviewer\", \"task\": \"Review the session package for code quality issues\"},\n    {\"agent\": \"quick-task\", \"task\": \"Run go vet on internal\u002Fagent\u002F and report issues\"}\n  ]\n}\n```\n\n### Chain Mode\nRun agents sequentially, passing each result to the next step.\n\n```json\n{\n  \"chain\": [\n    {\"agent\": \"explore\", \"task\": \"Find the main entry point and session management code\"},\n    {\"agent\": \"plan\", \"task\": \"Based on this: {previous}\\nSuggest a refactoring plan for the session package\"},\n    {\"agent\": \"task\", \"task\": \"Implement the refactoring plan: {previous}\"}\n  ]\n}\n```\n\n---\n\n## Example Usage in TUI\n\nWhen you need to perform multiple independent analysis tasks, use the subagent tool:\n\n### Example 1: Parallel Code Analysis\n\nYou want to simultaneously:\n1. Find all test files and understand testing patterns\n2. Review the tools package for code quality\n3. Check for any TODO comments in the codebase\n\n**Tool call:**\n```\n{type: \"parallel\", tasks: [\n  {agent: \"explore\", task: \"Find all *_test.go files and identify testing patterns (table-driven, testify, golden files). List key packages.\"},\n  {agent: \"reviewer\", task: \"Review internal\u002Ftools\u002F package. Note any code smells, missing error wrapping, or areas for improvement.\"},\n  {agent: \"quick-task\", task: \"Search for TODO comments in the codebase. Return file:line and the TODO text.\"}\n]}\n```\n\n### Example 2: Sequential Investigation\n\nYou want to:\n1. First explore the codebase structure\n2. Then analyze a specific area based on what you find\n3. Finally create a plan for improvements\n\n**Tool call:**\n```\n{type: \"chain\", chain: [\n  {agent: \"explore\", task: \"Explore the subagent system in internal\u002Fsubagent\u002F. What are the main components?\"},\n  {agent: \"plan\", task: \"Based on this exploration: {previous}\\nCreate a plan to add unit tests for the orchestrator.\"},\n  {agent: \"task\", task: \"Implement the test plan: {previous}\\nFocus on the Spawn and Cancel methods.\"}\n]}\n```\n\n---\n\n## TUI Display\n\nWhen subagents run, the TUI displays:\n\n```\n┌─ Subagents ──────────────────────────────────────┐\n│ ┌─ explore ─────────────────────────────────────┐ │\n│ │ ? Spawned: explore (pipe-1234567890)        │ │\n│ │ ? Reading: internal\u002Fagent\u002F                   │ │\n│ │ ? Found: 47 test files                      │ │\n│ │ ✅ Done (2.3s)                               │ │\n│ └───────────────────────────────────────────────┘ │\n│ ┌─ reviewer ────────────────────────────────────┐ │\n│ │ ? Spawned: reviewer (pipe-1234567890)        │ │\n│ │ ? Reviewing internal\u002Ftools\u002F...               │ │\n│ │ ⚠️  Missing error context at tools.go:42     │ │\n│ │ ✅ Done (4.1s)                                │ │\n│ └───────────────────────────────────────────────┘ │\n└───────────────────────────────────────────────────┘\n```\n\n---\n\n## Result Structure\n\nResults are returned as structured JSON:\n\n```json\n{\n  \"mode\": \"parallel\",\n  \"results\": [\n    {\n      \"agent\": \"explore\",\n      \"agent_id\": \"explore-abc123\",\n      \"status\": \"completed\",\n      \"result\": \"Found 47 test files across 12 packages...\",\n      \"duration\": \"2.3s\"\n    },\n    {\n      \"agent\": \"reviewer\",\n      \"agent_id\": \"reviewer-def456\",\n      \"status\": \"completed\",\n      \"result\": \"Review findings:\\n- Missing error context...\",\n      \"duration\": \"4.1s\"\n    }\n  ],\n  \"summary\": \"parallel: 2\u002F2 completed in 4.2s\"\n}\n```\n\n---\n\n## Best Practices\n\n### When to Use Subagents\n\n**Use subagents when:**\n- Tasks are independent and can run concurrently\n- You need specialized expertise (e.g., `reviewer` for code review)\n- Exploring multiple paths or areas simultaneously\n- Work requires isolated environment (git worktree for code changes)\n\n**Do the work directly when:**\n- Tasks are sequential and depend on previous results → use **chain** mode instead\n- The task is simple and quick (under 10 lines of code)\n- You're uncertain about the approach and need to experiment\n\n### Writing Effective Task Prompts\n\n1. **Be specific about output format**\n   - Bad: \"Review the code\"\n   - Good: \"Review the code and return: files_reviewed[], issues_found[], recommendations[]\"\n\n2. **Include context about the project**\n   - Bad: \"Find similar patterns\"\n   - Good: \"In this Go project, find functions that follow the builder pattern\"\n\n3. **Specify constraints**\n   - Time limits, file count limits, or scope limits help agents stay focused\n   - Bad: \"Test everything\"\n   - Good: \"Run tests for the tools package only. Focus on error handling.\"\n\n---\n\n## Quick Reference\n\n```bash\n# Tool schema for LLM calls\n{\n  \"agent\": \"string\",     # single mode: agent name\n  \"task\": \"string\",      # single mode: task prompt\n  \"tasks\": [             # parallel mode: array of {agent, task}\n    {\"agent\": \"explore\", \"task\": \"...\"}\n  ],\n  \"chain\": [             # chain mode: sequential, supports {previous} template\n    {\"agent\": \"explore\", \"task\": \"...\"},\n    {\"agent\": \"plan\", \"task\": \"Based on: {previous}\"}\n  ]\n}\n```\n\n**Typical workflow:**\n1. Analyze the user's request\n2. Identify independent subtasks\n3. Spawn subagents for each subtask (max 8)\n4. Wait for all results\n5. Synthesize results into final response\n6. Report completion with durations\n",{},"main","bcfcd42255878c3d40e545abcdeb2520b6d31a52",".pi-go\u002Fskills\u002Fdemo-subagents-tui",34,"https:\u002F\u002Fgithub.com\u002Fdimetron\u002Fpi-go","https:\u002F\u002Fpi-go.sh","https:\u002F\u002Fgithub.com\u002Fdimetron","🎸💻 🚧🦞","2026-11-15 03:48:24",{"source":7,"skillName":5,"commands":36,"prompt":46,"zipAvailable":47},[37,40,43],{"tool":38,"command":39},"npx","npx skills add dimetron\u002Fpi-go --skill demo-subagents-tui",{"tool":41,"command":42},"bunx","bunx skills add dimetron\u002Fpi-go --skill demo-subagents-tui",{"tool":44,"command":45},"pnpm","pnpm dlx skills add dimetron\u002Fpi-go --skill demo-subagents-tui","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fdimetron\u002Fpi-go\u002Fblob\u002Fmain\u002F.pi-go\u002Fskills\u002Fdemo-subagents-tui\u002FSKILL.md",true,[],[50,76,99,117,132,152],{"skillNo":51,"name":52,"nameZh":6,"description":53,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":54,"categories":55,"keywords":56,"publishedAt":22},"01M70SJ3216A0Y2NXYJJ2MVER0","verify-session-flow","Formally verify the interactive session flow before or after changing it. Use when editing internal\u002Ftui\u002Ftui.go's handleKey, handleInterruptKey, handleInputSubmit, ctrlCCount or quitting, internal\u002Ftui\u002Fagent_loop.go's enqueuePrompt, submit, steerPrompt, cancelAgent or handleAgentDone, or the deferred-init splash — or when a user reports that Ctrl+C quit on the first press, that Esc did not stop a turn or a goal loop, that a queued prompt was lost when they canceled, or that the TUI hung on a spinner nothing could clear.","https:\u002F\u002Fgithub.com\u002Fdimetron\u002Fpi-go\u002Fblob\u002Fmain\u002Finternal\u002Fextension\u002Fbundled_skills\u002Fverify-session-flow\u002FSKILL.md",[],[57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,19],"session","verify session flow","verify","flow","submit","editing","init","use","loop","prompt","when","interactive","reports","first","goal","CTRL","clear","go","spinner",{"skillNo":77,"name":78,"nameZh":6,"description":79,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":80,"categories":81,"keywords":82,"publishedAt":22},"01M70SJ02CTB40V2VFGAF80SBG","verify-run-pipeline","Formally verify the \u002Frun phase machine before or after changing it. Use when editing internal\u002Ftui\u002Frun.go's phase transitions (handleRunAgentDone, runGates result handling, verifyRunComplete, retryRun, reportGateHang, merge), internal\u002Fsop\u002Fverdict.go's Passed, or the checklist refresh — or when a run merged work it should not have, retried a hung gate, lost a cycle at the retry budget, or merged on a stale PASS.","https:\u002F\u002Fgithub.com\u002Fdimetron\u002Fpi-go\u002Fblob\u002Fmain\u002Finternal\u002Fextension\u002Fbundled_skills\u002Fverify-run-pipeline\u002FSKILL.md",[],[83,84,59,85,86,87,62,88,89,90,64,67,91,92,93,94,95,96,97,98],"pipeline","verify run pipeline","run","run pipeline","retry","cycle","run phase","machine","phase","refresh","work","verdict","transitions","result","merge","sop",{"skillNo":100,"name":101,"nameZh":6,"description":102,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":103,"categories":104,"keywords":105,"publishedAt":22},"01M70SHWJV9N3PQWRAMCQE9C2E","verify-history-rewrite","Formally verify the session-history rewrite path before or after changing it. Use when editing internal\u002Fsession\u002Fautocompact.go, internal\u002Fsession\u002Fcompaction*.go, internal\u002Fsession\u002Fstore.go's Compact\u002FClearEvents\u002FrewriteEvents, internal\u002Fagent\u002Fagent.go's Run\u002FRunStreaming\u002FrunPreTurn, or internal\u002Ftui\u002Fcommands.go's clearConversation\u002FclearSessionContext and the context gauge — or when a turn is canceled mid-flight, a tool call and its result get separated, a session's history disappears while the agent is still working, or the model is sent a tool result whose call was compacted away.","https:\u002F\u002Fgithub.com\u002Fdimetron\u002Fpi-go\u002Fblob\u002Fmain\u002Finternal\u002Fextension\u002Fbundled_skills\u002Fverify-history-rewrite\u002FSKILL.md",[],[106,107,108,59,109,110,62,57,111,112,64,113,67,114,115,96,85,116,74,19],"history","rewrite","verify history rewrite","get","model","tool","call","compact","store","gauge","commands",{"skillNo":118,"name":119,"nameZh":6,"description":120,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":121,"categories":122,"keywords":123,"publishedAt":22},"01M70SHSJ5A2XV5SXBXM96RH7P","verify-goal-loop","Formally verify the \u002Fgoal automatic loop before or after changing it. Use when editing internal\u002Ftui\u002Fgoal.go, internal\u002Ftui\u002Fagent_loop.go's handleAgentDone\u002FcancelAgent\u002FsteerPrompt, or internal\u002Ftools\u002Fgoal.go's GoalController — or when a goal loop will not stop, stops one cycle early, closes a goal that is not met, or restarts a goal you finished.","https:\u002F\u002Fgithub.com\u002Fdimetron\u002Fpi-go\u002Fblob\u002Fmain\u002Finternal\u002Fextension\u002Fbundled_skills\u002Fverify-goal-loop\u002FSKILL.md",[],[65,124,125,59,71,126,62,88,64,67,127,128,74,19,129,130,131],"verify goal loop","verify goal","goal loop","you","automatic","Tools","it","stop",{"skillNo":133,"name":134,"nameZh":6,"description":135,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":136,"categories":137,"keywords":138,"publishedAt":22},"01M70SHPYN1AS6D6RJ8HN270RZ","verify-agent-lifecycle","Formally verify the subagent lifecycle before or after changing it. Use when editing internal\u002Fsubagent\u002Forchestrator.go's Spawn, trackAgent, forwardAgentEvents, terminalStatus, Cancel, ShutdownWithTimeout or evictCompletedAgentsLocked, or internal\u002Fsubagent\u002Fpool.go — or when a canceled agent is reported as failed, an agent vanishes from the list with no verdict, the orchestrator panics on a pool release, or an agent can be canceled twice.","https:\u002F\u002Fgithub.com\u002Fdimetron\u002Fpi-go\u002Fblob\u002Fmain\u002Finternal\u002Fextension\u002Fbundled_skills\u002Fverify-agent-lifecycle\u002FSKILL.md",[],[139,140,141,59,142,62,64,67,143,144,145,146,94,147,148,149,150,74,130,151],"lifecycle","verify agent lifecycle","agent lifecycle","as","cancel","subagent","can","with","orchestrator","spawn","release","list","pool",{"skillNo":153,"name":154,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":155,"categories":156,"keywords":157,"publishedAt":22},"01M6E37WZM8ZF36DRYQGZDGP7M","test-new-skill","https:\u002F\u002Fgithub.com\u002Fdimetron\u002Fpi-go\u002Fblob\u002Fmain\u002Finternal\u002Ftui\u002F.pi-go\u002Fskills\u002Ftest-new-skill\u002FSKILL.md",[],[158,159,160,161],"test","new skill","test new skill","new"]