{"_id":"@adamjen/pi-one-subagent-at-a-time","_rev":"3-dc9c836d4888eb31ee7701d578978328","name":"@adamjen/pi-one-subagent-at-a-time","dist-tags":{"latest":"0.1.2"},"versions":{"0.1.0":{"name":"@adamjen/pi-one-subagent-at-a-time","version":"0.1.0","keywords":["pi-package","pi-extension","subagent","sequential","single-agent","local-models","rate-limiter"],"author":{"name":"Adam","email":"adamjen"},"license":"MIT","_id":"@adamjen/pi-one-subagent-at-a-time@0.1.0","maintainers":[{"name":"adamjen","email":"adamjentv@gmail.com"}],"homepage":"https://github.com/adamjen/pi-one-subagent-at-a-time","bugs":{"url":"https://github.com/adamjen/pi-one-subagent-at-a-time/issues"},"pi":{"extensions":["extensions/one-subagent-at-a-time.ts"]},"dist":{"shasum":"eb8595e27b4ea8138a5b22c5f60ef881a8909837","tarball":"https://registry.npmjs.org/@adamjen/pi-one-subagent-at-a-time/-/pi-one-subagent-at-a-time-0.1.0.tgz","fileCount":3,"integrity":"sha512-gPLVSWPCoyuOc2ObiWyHNZ/Pe95kJQAKACVaNTVm0Q27n/sQ1aAq782C1dUmmlMxaFz6ZbnbHwsuyMZ1ck51IQ==","signatures":[{"sig":"MEUCIGTnbsafrO/z9og7dZAGP0t3Qo2ZMHoXZw2sV35j/fApAiEArpA5aK0IRHK794LsyQb6bkVRn8fuYzag5dpVEi1yZg8=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":7039},"main":"extensions/one-subagent-at-a-time.ts","type":"module","gitHead":"4d2bffea4412d7ae43c90ec376adbc8e3b687a2a","_npmUser":{"name":"adamjen","email":"adamjentv@gmail.com"},"repository":{"url":"git+https://github.com/adamjen/pi-one-subagent-at-a-time.git","type":"git"},"_npmVersion":"10.9.7","description":"Enforces sequential subagent execution — prevents concurrent subagent spawns that cause model swapping overhead on single-GPU setups.","directories":{},"_nodeVersion":"22.22.2","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/pi-one-subagent-at-a-time_0.1.0_1779543408478_0.3975410588532329","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"@adamjen/pi-one-subagent-at-a-time","version":"0.1.1","keywords":["pi-package","pi-extension","subagent","sequential","single-agent","local-models","rate-limiter"],"author":{"name":"Adam","email":"adamjen"},"license":"MIT","_id":"@adamjen/pi-one-subagent-at-a-time@0.1.1","maintainers":[{"name":"adamjen","email":"adamjentv@gmail.com"}],"homepage":"https://github.com/adamjen/pi-one-subagent-at-a-time","bugs":{"url":"https://github.com/adamjen/pi-one-subagent-at-a-time/issues"},"pi":{"image":"https://raw.githubusercontent.com/adamjen/pi-one-subagent-at-a-time/master/screenshot.png","extensions":["extensions/one-subagent-at-a-time.ts"]},"dist":{"shasum":"ebb356e9773eb8e53ef121feb8303a3d7515a533","tarball":"https://registry.npmjs.org/@adamjen/pi-one-subagent-at-a-time/-/pi-one-subagent-at-a-time-0.1.1.tgz","fileCount":4,"integrity":"sha512-tVgRNL0JEIy2uw6Ds625VDy06Gem9xaxjjoVdAvEb4zP6PFV31WffPLPxNxmO+RnZzvCw8/paH2YZlWgiEfnJw==","signatures":[{"sig":"MEYCIQD4rYAKW/r1sUGB/RIqFs0s4dhWIk96BTdLvTkdkFqX8wIhAO2ydAcEN7o7uDo/R3BrtMK1s7LWw7LgHWfSuqrK3Bqa","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":1668165},"main":"extensions/one-subagent-at-a-time.ts","type":"module","gitHead":"55df49c234a55e8bed148950088f628d8c8f98d1","_npmUser":{"name":"adamjen","email":"adamjentv@gmail.com"},"repository":{"url":"git+https://github.com/adamjen/pi-one-subagent-at-a-time.git","type":"git"},"_npmVersion":"10.9.7","description":"Enforces sequential subagent execution — prevents concurrent subagent spawns that cause model swapping overhead on single-GPU setups.","directories":{},"_nodeVersion":"22.22.2","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/pi-one-subagent-at-a-time_0.1.1_1779543822858_0.009883703562240553","host":"s3://npm-registry-packages-npm-production"}},"0.1.2":{"name":"@adamjen/pi-one-subagent-at-a-time","version":"0.1.2","description":"Enforces sequential subagent execution — prevents concurrent subagent spawns that cause model swapping overhead on single-GPU setups.","type":"module","main":"extensions/one-subagent-at-a-time.ts","keywords":["pi-package","pi-extension","subagent","sequential","single-agent","local-models","rate-limiter"],"author":{"name":"Adam","email":"adamjen"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/adamjen/pi-one-subagent-at-a-time.git"},"homepage":"https://github.com/adamjen/pi-one-subagent-at-a-time","bugs":{"url":"https://github.com/adamjen/pi-one-subagent-at-a-time/issues"},"pi":{"extensions":["extensions/one-subagent-at-a-time.ts"],"image":"https://raw.githubusercontent.com/adamjen/pi-one-subagent-at-a-time/master/screenshot.png"},"_id":"@adamjen/pi-one-subagent-at-a-time@0.1.2","gitHead":"a536077b6dde0970ecc8b2365d15b07b34541bee","_nodeVersion":"22.22.2","_npmVersion":"10.9.7","dist":{"integrity":"sha512-rKC5wfCLgIHsEWYHLRWN83cAapt0HwV598DY6drTixOLtCRiBGmQqYzgpG+rdT24VT4VPTCwBU8UsjC44FJUMw==","shasum":"707f23be89afcd77e72da59e8b9f2750830f0d7f","tarball":"https://registry.npmjs.org/@adamjen/pi-one-subagent-at-a-time/-/pi-one-subagent-at-a-time-0.1.2.tgz","fileCount":5,"unpackedSize":1669955,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIEyyynThSNd5rHxjUw3mN7APTPRWABOX9lyal8XG5euxAiEAijz4Pu0uKwGF759dzhFPGJQnkW+zcyfFO4TvoHqy0Ik="}]},"_npmUser":{"name":"adamjen","email":"adamjentv@gmail.com"},"directories":{},"maintainers":[{"name":"adamjen","email":"adamjentv@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/pi-one-subagent-at-a-time_0.1.2_1779546982964_0.24647793641850368"},"_hasShrinkwrap":false}},"time":{"created":"2026-05-23T13:36:48.266Z","modified":"2026-05-23T14:36:23.282Z","0.1.0":"2026-05-23T13:36:48.625Z","0.1.1":"2026-05-23T13:43:43.057Z","0.1.2":"2026-05-23T14:36:23.179Z"},"bugs":{"url":"https://github.com/adamjen/pi-one-subagent-at-a-time/issues"},"author":{"name":"Adam","email":"adamjen"},"license":"MIT","homepage":"https://github.com/adamjen/pi-one-subagent-at-a-time","keywords":["pi-package","pi-extension","subagent","sequential","single-agent","local-models","rate-limiter"],"repository":{"type":"git","url":"git+https://github.com/adamjen/pi-one-subagent-at-a-time.git"},"description":"Enforces sequential subagent execution — prevents concurrent subagent spawns that cause model swapping overhead on single-GPU setups.","maintainers":[{"name":"adamjen","email":"adamjentv@gmail.com"}],"readme":"# @adamjen/pi-one-subagent-at-a-time\n\n**Enforces sequential subagent execution — prevents concurrent subagent spawns.**\n\n---\n\n## Why This Exists\n\nThis extension was born from a real hardware constraint.\n\nI'm running a **Qwen3.6-27B orchestrator** on an **RTX 3090** (24GB VRAM) using **llama-swap** for model swapping between agents. The orchestrator would naturally want to spawn multiple subagents simultaneously — but each subagent spawn triggers a model swap, which means:\n\n1. **Unload current model from VRAM**\n2. **Load new model into VRAM** (takes seconds per swap)\n3. **Reload full context** (adds more overhead)\n\nWith 3-4 agents spawning concurrently, this meant constant swapping — models loading and unloading in rapid succession. The time overhead was massive: what should take 10 seconds of actual work would take 60+ seconds just waiting for model swaps to complete.\n\nThe solution? **Force subagents to run one at a time.** No concurrent spawns, no model swapping chaos, no unnecessary context reloads. Just clean sequential execution.\n\nIf you're running local models on a single-GPU setup and experiencing similar slowdowns from agent spawning, this extension solves that problem.\n\n---\n\n## What It Does\n\nBlocks concurrent `subagent()` tool calls. When one subagent is already running, subsequent spawn attempts are blocked with a clear message until the first completes.\n\n**Before:** Orchestrator spawns 3 agents simultaneously → model swapping chaos → 60+ second delays  \n**After:** Agents run sequentially → no swapping overhead → clean execution flow\n\n---\n\n## Install\n\n```bash\npi install npm:@adamjen/pi-one-subagent-at-a-time\n```\n\nOr try without installing:\n\n```bash\npi -e npm:@adamjen/pi-one-subagent-at-a-time\n```\n\nFor local development:\n\n```bash\npi install ~/projects/pi-one-subagent-at-a-time\n```\n\n---\n\n## How It Works\n\nThe extension hooks into three pi lifecycle events:\n\n1. **`session_start`** — Shows status indicator (\"🔒 agent-gate active\")\n2. **`tool_call`** — Intercepts `subagent` calls; blocks if one is already pending\n3. **`agent_end`** — Decrements the pending counter when an agent finishes\n\n```typescript\n// Simplified logic\nlet pending = 0;\n\npi.on(\"tool_call\", async (event, ctx) => {\n  if (event.toolName === \"subagent\") {\n    if (pending >= 1) {\n      return { block: true, reason: \"BLOCKED: subagent already running. Wait for steer-back.\" };\n    }\n    pending++;\n  }\n});\n\npi.on(\"agent_end\", async () => {\n  if (pending > 0) pending--;\n});\n```\n\n---\n\n## Target Audience\n\nThis extension is ideal for users who:\n\n- **Run local models** on single-GPU hardware (RTX 3090, 4090, etc.)\n- **Use model swapping** (llama-swap or similar) between agents\n- **Experience slowdowns** from concurrent agent spawns causing context reloads\n- **Want predictable sequential execution** rather than parallel chaos\n\nIf you have multiple GPUs or cloud models with no swap overhead, this extension is optional — but it still enforces cleaner execution patterns.\n\n---\n\n## Configuration\n\nNo configuration needed — works out of the box with a hard limit of **1 concurrent subagent**.\n\nThe status indicator shows in the pi TUI:\n- `🔒 agent-gate active` — extension loaded, no agents running\n- `🔒 1 running` — one subagent is currently executing\n\n---\n\n## Browse All Packages\n\n**[pi.dev/packages/@adamjen/pi-one-subagent-at-a-time?name=adamjen](https://pi.dev/packages/@adamjen/pi-one-subagent-at-a-time?name=adamjen)** — browse all my pi extensions.\n\n## License\n\nMIT\n","readmeFilename":"README.md"}