{"_id":"@adi-mudi/pi-senai","_rev":"5-700f26d50ee4b316fabdf06c44ee5094","name":"@adi-mudi/pi-senai","dist-tags":{"latest":"1.8.0"},"versions":{"0.1.0":{"name":"@adi-mudi/pi-senai","version":"0.1.0","keywords":["pi-senai","orchestration","stage-gated","pi-package"],"license":"MIT","_id":"@adi-mudi/pi-senai@0.1.0","maintainers":[{"name":"adi-mudi","email":"dkfoundation24@gmail.com"}],"homepage":"https://github.com/Adi-Mudi/pi-senai#readme","bugs":{"url":"https://github.com/Adi-Mudi/pi-senai/issues"},"pi":{"skills":["./skills"],"extensions":["./dist/index.js"]},"dist":{"shasum":"73ef195f07cde2264fda124f32499264da2f1fda","tarball":"https://registry.npmjs.org/@adi-mudi/pi-senai/-/pi-senai-0.1.0.tgz","fileCount":166,"integrity":"sha512-BfnjwySrUPjA8zFwAozm04pwddUpQBQUIlooHaI1/TkVpmmoLM8TLkvTIcOipclJFUeCyusIIJPfK9/xjWpCPg==","signatures":[{"sig":"MEQCIDdJ3l99+izSROCZcobTQHUeiAhLNjpa8YlqVcFLj9y/AiBEy9Kr0P4iUS+KF5eOLcwgz8MnCerxEoyKghvtbLCLKA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":773260},"type":"module","gitHead":"9d80fc48905024a33012671551b24cca49c374ce","scripts":{"test":"npm run build && node --test $(find dist/pi-extension/test -name '*.test.js' -not -path '*/e2e/*')","build":"tsc","prepare":"npm run build","test:e2e":"RUN_E2E=1 node --test --test-force-exit --test-timeout=180000 dist/pi-extension/test/e2e/*.test.js","prepublishOnly":"npm run build && npm test","test:e2e:tier2":"RUN_E2E=1 RUN_LLM_E2E=1 node --test --test-force-exit --test-timeout=300000 dist/pi-extension/test/e2e/2*.test.js","test:e2e:update-snapshots":"RUN_E2E=1 UPDATE_SNAPSHOTS=1 node --test --test-force-exit --test-timeout=180000 dist/pi-extension/test/e2e/*.test.js"},"_npmUser":{"name":"adi-mudi","email":"dkfoundation24@gmail.com"},"repository":{"url":"git+https://github.com/Adi-Mudi/pi-senai.git","type":"git"},"_npmVersion":"9.2.0","description":"Senai — stage-gated agent orchestration extension for Pi — Plan → Implement → Document → Deliver","directories":{},"_nodeVersion":"22.22.1","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.9.3","@types/node":"^20.19.43","@mariozechner/pi-tui":"^0.73.1"},"peerDependencies":{"@sinclair/typebox":"*","@mariozechner/pi-ai":"*","@mariozechner/pi-tui":"*","@mariozechner/pi-agent-core":"*","@mariozechner/pi-coding-agent":"*"},"_npmOperationalInternal":{"tmp":"tmp/pi-senai_0.1.0_1788696325438_0.4249528416457884","host":"s3://npm-registry-packages-npm-production"}},"1.5.0":{"name":"@adi-mudi/pi-senai","version":"1.5.0","keywords":["pi-senai","orchestration","stage-gated","pi-package"],"license":"MIT","_id":"@adi-mudi/pi-senai@1.5.0","maintainers":[{"name":"adi-mudi","email":"dkfoundation24@gmail.com"}],"homepage":"https://github.com/Adi-Mudi/pi-senai#readme","bugs":{"url":"https://github.com/Adi-Mudi/pi-senai/issues"},"pi":{"skills":["./skills"],"extensions":["./dist/index.js"]},"dist":{"shasum":"8c0d023b64b9af6c21bad13b88659d8da73ebe9d","tarball":"https://registry.npmjs.org/@adi-mudi/pi-senai/-/pi-senai-1.5.0.tgz","fileCount":180,"integrity":"sha512-EUiaw4hSXsUKo08Pnm7g/HgZUe9/kPJ96OFfskS+nRrs/6mMQlW62Vp9abIFqlsgH1Qc0aGAPJdqoqLStp8wrA==","signatures":[{"sig":"MEQCIEt6Ynam2qX7iTi3POnu0dbx8Ao+HnidgP1dhMBt1J8/AiA08QSxuLAGyORAn/pDspic7OV2M0VtQdi2rbcnyrvmOQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"sig":"MEUCIQD9M3UT51VlHY3z8f+3QR45Twh6kELB/RmtKcOmt7zzagIgek2HzNYaQLhONd/fWdpNAprMwNR83E4BMMfQp72dmUQ=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":888990},"type":"module","gitHead":"e6b213a6219bcd18d639e680b84ddefd34512940","scripts":{"test":"npm run build && node --test $(find dist/pi-extension/test -name '*.test.js' -not -path '*/e2e/*')","build":"tsc","prepare":"npm run build","test:e2e":"RUN_E2E=1 node --test --test-force-exit --test-timeout=180000 dist/pi-extension/test/e2e/*.test.js","prepublishOnly":"npm run build && npm test","test:e2e:tier2":"RUN_E2E=1 RUN_LLM_E2E=1 node --test --test-force-exit --test-timeout=300000 dist/pi-extension/test/e2e/2*.test.js","test:e2e:update-snapshots":"RUN_E2E=1 UPDATE_SNAPSHOTS=1 node --test --test-force-exit --test-timeout=180000 dist/pi-extension/test/e2e/*.test.js"},"_npmUser":{"name":"adi-mudi","email":"dkfoundation24@gmail.com"},"repository":{"url":"git+https://github.com/Adi-Mudi/pi-senai.git","type":"git"},"_npmVersion":"9.2.0","description":"Senai — stage-gated agent orchestration extension for Pi — Plan → Implement → Document → Deliver","directories":{},"_nodeVersion":"22.22.1","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.9.3","@types/node":"^20.19.43","@mariozechner/pi-tui":"^0.73.1"},"peerDependencies":{"@sinclair/typebox":"*","@mariozechner/pi-ai":"*","@mariozechner/pi-tui":"*","@mariozechner/pi-agent-core":"*","@mariozechner/pi-coding-agent":"*"},"_npmOperationalInternal":{"tmp":"tmp/pi-senai_1.5.0_1788710371857_0.17498574546204826","host":"s3://npm-registry-packages-npm-production"}},"1.7.0":{"name":"@adi-mudi/pi-senai","version":"1.7.0","keywords":["pi-senai","orchestration","stage-gated","pi-package"],"license":"MIT","_id":"@adi-mudi/pi-senai@1.7.0","maintainers":[{"name":"adi-mudi","email":"dkfoundation24@gmail.com"}],"homepage":"https://github.com/Adi-Mudi/pi-senai#readme","bugs":{"url":"https://github.com/Adi-Mudi/pi-senai/issues"},"pi":{"skills":["./skills"],"extensions":["./dist/index.js"]},"dist":{"shasum":"55c387bd27f04017d0183a646bf972f0ab18598c","tarball":"https://registry.npmjs.org/@adi-mudi/pi-senai/-/pi-senai-1.7.0.tgz","fileCount":197,"integrity":"sha512-C4yTBOYjrIwReZd/CF8v3YfDzIdhpOXbss9O3Q0FOBcu+xyhlbpLNEmcVfnheER5AvUc5QWCMMhQx9oU9cSIYQ==","signatures":[{"sig":"MEYCIQDrO5W/xRnMi5oriNexv7VDo/l8AE0qAMv3MGKFh0M31AIhANa++Byb6ZU4QMsf5TnUxOT7ZcXL/5FfV9oPsBabqNMf","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"sig":"MEQCICaA7bm0xO11YuqeRk9VSyy3aeE4uTs0y86m2PohiPNJAiBmPrc2rvlnCqYSif/JA03tDOQevaiDIXNlVrx9YzLBwg==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":946780},"type":"module","gitHead":"eb6b343d87966a4556ea936adf47307dc034f03d","scripts":{"test":"npm run build && node --test $(find dist/pi-extension/test -name '*.test.js' -not -path '*/e2e/*')","build":"tsc","prepare":"npm run build","test:e2e":"RUN_E2E=1 node --test --test-force-exit --test-timeout=180000 dist/pi-extension/test/e2e/*.test.js","prepublishOnly":"npm run build && npm test","test:e2e:tier2":"RUN_E2E=1 RUN_LLM_E2E=1 node --test --test-force-exit --test-timeout=300000 dist/pi-extension/test/e2e/2*.test.js","test:e2e:update-snapshots":"RUN_E2E=1 UPDATE_SNAPSHOTS=1 node --test --test-force-exit --test-timeout=180000 dist/pi-extension/test/e2e/*.test.js"},"_npmUser":{"name":"adi-mudi","email":"dkfoundation24@gmail.com"},"repository":{"url":"git+https://github.com/Adi-Mudi/pi-senai.git","type":"git"},"_npmVersion":"9.2.0","description":"Senai — stage-gated agent orchestration extension for Pi — Plan → Implement → Document → Deliver","directories":{},"_nodeVersion":"22.22.1","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.9.3","@types/node":"^20.19.43","@mariozechner/pi-tui":"^0.73.1"},"peerDependencies":{"@sinclair/typebox":"*","@mariozechner/pi-ai":"*","@mariozechner/pi-tui":"*","@mariozechner/pi-agent-core":"*","@mariozechner/pi-coding-agent":"*"},"_npmOperationalInternal":{"tmp":"tmp/pi-senai_1.7.0_1788767089986_0.38189639998163427","host":"s3://npm-registry-packages-npm-production"}},"1.7.2":{"name":"@adi-mudi/pi-senai","version":"1.7.2","keywords":["pi-senai","orchestration","stage-gated","pi-package"],"license":"MIT","_id":"@adi-mudi/pi-senai@1.7.2","maintainers":[{"name":"adi-mudi","email":"dkfoundation24@gmail.com"}],"homepage":"https://github.com/Adi-Mudi/pi-senai#readme","bugs":{"url":"https://github.com/Adi-Mudi/pi-senai/issues"},"pi":{"skills":["./skills"],"extensions":["./dist/index.js"]},"dist":{"shasum":"bdc60319320dd39e9f89a7dc498cde636c5f5451","tarball":"https://registry.npmjs.org/@adi-mudi/pi-senai/-/pi-senai-1.7.2.tgz","fileCount":243,"integrity":"sha512-/ZhZHjXBlJOp+s/3qTcorA5xQmuEHPtfps1z59x9BS2QShosRw7CdkD6S/zeVPlk4XP1LGv60VJjbdqyaoLNjw==","signatures":[{"sig":"MEUCIFOyOoDZay2zUoY9Fl3IcfO+ffN7n7FPD4tePntAvK4pAiEAnNI/4ut1p2Sb8HquVeUUFbtKOm7IgTKLgtGlHyoZly8=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"sig":"MEUCIHpWE4KgVrYc0NwPfSzw11YPFgfvJuqNHS4d9nBQXqSFAiEA+UbSRYmQgq7wuyFHFTNpIomfkVZHmpVgDFxnlhuL/0k=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":1003367},"type":"module","gitHead":"074eff37a0e632fde9c6a01b6c6bf5344d39c622","scripts":{"test":"npm run build && node --test $(find dist/pi-extension/test -name '*.test.js' -not -path '*/e2e/*')","build":"tsc","prepare":"npm run build","test:e2e":"RUN_E2E=1 node --test --test-force-exit --test-timeout=180000 dist/pi-extension/test/e2e/*.test.js","prepublishOnly":"npm run build && npm test","test:e2e:tier2":"RUN_E2E=1 RUN_LLM_E2E=1 node --test --test-force-exit --test-timeout=300000 dist/pi-extension/test/e2e/2*.test.js","test:e2e:update-snapshots":"RUN_E2E=1 UPDATE_SNAPSHOTS=1 node --test --test-force-exit --test-timeout=180000 dist/pi-extension/test/e2e/*.test.js"},"_npmUser":{"name":"adi-mudi","email":"dkfoundation24@gmail.com"},"repository":{"url":"git+https://github.com/Adi-Mudi/pi-senai.git","type":"git"},"_npmVersion":"9.2.0","description":"Senai — stage-gated agent orchestration extension for Pi — Plan → Implement → Document → Deliver","directories":{},"_nodeVersion":"22.22.1","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.9.3","@types/node":"^20.19.43","@mariozechner/pi-tui":"^0.73.1"},"peerDependencies":{"@sinclair/typebox":"*","@mariozechner/pi-ai":"*","@mariozechner/pi-tui":"*","@mariozechner/pi-agent-core":"*","@mariozechner/pi-coding-agent":"*"},"_npmOperationalInternal":{"tmp":"tmp/pi-senai_1.7.2_1788811240604_0.6225687426432571","host":"s3://npm-registry-packages-npm-production"}},"1.8.0":{"pi":{"skills":["./skills"],"extensions":["./dist/index.js"]},"_id":"@adi-mudi/pi-senai@1.8.0","bugs":{"url":"https://github.com/Adi-Mudi/pi-senai/issues"},"dist":{"shasum":"7b1ecb2433b925268e455b30e2aafe5f1e74645d","tarball":"https://registry.npmjs.org/@adi-mudi/pi-senai/-/pi-senai-1.8.0.tgz","fileCount":184,"integrity":"sha512-8/Goi1cavn7Gi0Qqg4lgMF7JdmELEEhrA3QSZJra2kB5+2Fr5JqrkTYBgu58bUJVF3mDHPWT+MA8agOHKFYrQg==","signatures":[{"sig":"MEUCIQD5tcXTL0g+jodoO6VDELDDrrQtzybo4Wh3QalQBPoPTwIgCTRZReJ1wkEfcHbOvmHozOd21gtEG0xFmlj9A4CaBxs=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDNUUDaZvjQauDI+K8p4yzB7Rc1Cj6QQtDlCngCHB3FPgIgf2lVUViCc8DyIFzkuktBq83plYVtbSJlZd4TgnxT9kk="}],"unpackedSize":987046},"name":"@adi-mudi/pi-senai","type":"module","gitHead":"40e184e3295f718c79f7132764738c629f7141f8","license":"MIT","scripts":{"test":"npm run build && node --test $(find dist/pi-extension/test -name '*.test.js' -not -path '*/e2e/*')","build":"tsc","prepare":"npm run build","test:e2e":"RUN_E2E=1 node --test --test-force-exit --test-timeout=180000 dist/pi-extension/test/e2e/*.test.js","prepublishOnly":"npm run build && npm test","test:e2e:tier2":"RUN_E2E=1 RUN_LLM_E2E=1 node --test --test-force-exit --test-timeout=300000 dist/pi-extension/test/e2e/2*.test.js","test:e2e:update-snapshots":"RUN_E2E=1 UPDATE_SNAPSHOTS=1 node --test --test-force-exit --test-timeout=180000 dist/pi-extension/test/e2e/*.test.js"},"version":"1.8.0","_npmUser":{"name":"adi-mudi","email":"dkfoundation24@gmail.com"},"homepage":"https://github.com/Adi-Mudi/pi-senai#readme","keywords":["pi-senai","orchestration","stage-gated","pi-package"],"repository":{"url":"git+https://github.com/Adi-Mudi/pi-senai.git","type":"git"},"_npmVersion":"9.2.0","description":"Senai — stage-gated agent orchestration extension for Pi — Plan → Implement → Document → Deliver","directories":{},"maintainers":[{"name":"adi-mudi","email":"dkfoundation24@gmail.com"}],"_nodeVersion":"22.22.1","dependencies":{"@adi-mudi/pi-chirpi":"file:../pi-chirpi"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"typebox":"^1.3.27","typescript":"^5.9.3","@types/node":"^20.19.43","@earendil-works/pi-tui":"^0.85.0","@earendil-works/pi-coding-agent":"*"},"peerDependencies":{"typebox":"*","@earendil-works/pi-ai":"*","@earendil-works/pi-tui":"*","@earendil-works/pi-agent-core":"*","@earendil-works/pi-coding-agent":"*"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/pi-senai_1.8.0_1789249050980_0.8710463254509839"}}},"time":{"created":"2026-09-06T12:05:25.316Z","modified":"2026-09-12T21:37:31.439Z","0.1.0":"2026-09-06T12:05:25.616Z","1.5.0":"2026-09-06T15:59:32.014Z","1.7.0":"2026-09-07T07:44:50.093Z","1.7.2":"2026-09-07T20:00:40.703Z","1.8.0":"2026-09-12T21:37:31.113Z"},"bugs":{"url":"https://github.com/Adi-Mudi/pi-senai/issues"},"license":"MIT","homepage":"https://github.com/Adi-Mudi/pi-senai#readme","keywords":["pi-senai","orchestration","stage-gated","pi-package"],"repository":{"url":"git+https://github.com/Adi-Mudi/pi-senai.git","type":"git"},"description":"Senai — stage-gated agent orchestration extension for Pi — Plan → Implement → Document → Deliver","maintainers":[{"name":"adi-mudi","email":"dkfoundation24@gmail.com"}],"readme":"# Pi Senai\n\nStage-gated agent orchestration extension for Pi — **Plan → Implement → Document → Deliver**.\n\n> **Note:** This extension and all its slash commands are branded as **Senai** (`/senai-*`). Pi loads it automatically from `package.json`.\n>\n> **Why \"Senai\"?** Senai (சேனை) is a Tamil word meaning \"army,\" \"troop,\" or \"crowd.\" It describes a disciplined force where every member has a role, follows orders, and advances only when commanded. That matches how Senai works: agents are assigned roles, follow stage-gated slash commands, and obey system-prompt injections and approval gates before moving forward. \"Orchestra\" is a common English word with no built-in sense of command or discipline, so Senai gives the project a clearer identity.\n\n## Quick install\n\n```bash\npi install npm:@adi-mudi/pi-senai\npi install npm:@adi-mudi/pi-chirpi   # required companion: architecture factory\n```\n\nThen open Pi in any directory and run `/senai-doctor` to verify.\n\nFor all install paths (global, project-local, dev), upgrade/uninstall, troubleshooting, and maintainer publishing instructions, see **[INSTALL.md](./INSTALL.md)**.\n\n## Project layout\n\n- `.pi/` — Pi's official project-local directory. Holds agents, skills, extensions, and the permanent architecture factory output (`architect/`).\n- `.IDE_Plans/` — A project-local folder used to keep temporary planning artifacts, run state, and draft documents out of the repo root. It is **not** a standard Pi directory; it is a convention used by this project for transient files.\n\n## What it does\n\nPi Senai splits software work into four explicit stages. Each stage runs a dedicated skill, produces artifacts in `.IDE_Plans/pi-senai/runs/<run-id>/`, and requires user approval before the next stage starts.\n\n- **Plan** — Spawn four scout agents, interview the user, write an approved `plan.md` (capped at ~15KB and ending with a `## Verification` section that proves the mission).\n- **Implement** — Build and test the feature according to the plan.\n- **Document** — Update README, CHANGELOG, API docs, and other project docs — only the writers a deterministic per-project selection says this project needs.\n- **Deliver** — Re-run the plan's verification steps as a blocking gate, run a final security audit, and package the deliverable.\n\nMissions typed `bugfix` (chosen during `/senai-brainstorm`) follow a stricter path: the mission brief must fill four extra sections (reproduction steps, expected vs actual, root cause, regression test plan) before it can be approved, the Plan stage runs a deep scout dig into the root cause before planning, and the Implement stage writes the failing regression test first — the approve gate blocks when the regression test named in the brief is missing on disk or not covered by the plan's `## Files` manifest.\n\n## Before your first run\n\nRun these commands in order. The generate commands create your sub-agent team and the `agents.json` mapping for you:\n\n1. **Project file configuration** — tell Senai which code, input documents, and tests to include:\n\n   ```\n   /senai-configure-files\n   ```\n\n2. **Architect inputs** — select the documents the architect agent reads (provided by the companion `@adi-mudi/pi-chirpi` package):\n\n   ```\n   /chirpi-configure-architect-inputs\n   ```\n\n3. **Architecture generation** — create the architecture documents, agents, and skills (also provided by `@adi-mudi/pi-chirpi`). This also creates `.pi/senai/agents.json` and maps the seven architecture-bound roles:\n\n   ```\n   /chirpi-generate-architect\n   ```\n\n4. **Sub-agent generation** — generate agents for the remaining fourteen roles and map them in `agents.json`. Existing custom agents are skipped, never touched:\n\n   ```\n   /senai-generate-sub-agents\n   ```\n\n5. **Agent document assignments** — assign truth and comparison documents to each role:\n\n   ```\n   /senai-configure-agents-files\n   ```\n\n   **Alternative to step 3** — if you don't have PRD/NFR documents and just want to pick an architecture from the library, use `/chirpi-predefined-architect` (from `@adi-mudi/pi-chirpi`). For **Pi extension projects** it auto-detects and skips all questions (1 dialog total). For other projects, it asks 4 project questions (purpose, scale, deployment, real-time), shows the top 3 matches from the 36-entry library with rationale, and runs the factory with your chosen architecture. No input docs needed. The doctor also points to this command for Pi extension projects.\n\nOptionally, create the documentation skeleton up front — otherwise the Document stage will ask for it when it runs:\n\n```\n/senai-generate-docs-structure\n```\n\nThis creates only the docs your project needs: template stubs with fixed section order and hard length caps (Standard Readme, Keep a Changelog, Nygard ADR, Google API style, Diátaxis, arc42-lite), under `docs/tutorials|how-to|reference|explanation|adr/` (only for selected types) with `README.md`/`CHANGELOG.md`/`CONTRIBUTING.md` at the root. Existing hand-written docs are never overwritten.\n\nYou can check the current settings with `/senai-agents`, `/senai-files`, and `/senai-agents-files`.\n\n`/senai-configure-agents` is optional: use it only to hand-pick your own agents instead of the generated ones. Pi Senai requires all three configuration files (`agents.json`, `files.json`, `agents_files.json`) before any stage command will run.\n\nAfter configuring, run a full diagnostic:\n\n```\n/senai-doctor\n```\n\nThis checks that all config files exist, every mapped agent is found in the right place, each agent has the right tools for its Senai role, file scopes are valid, truth documents exist, and you are running inside a supported terminal multiplexer.\n\nOnce an architecture is generated, doctor also validates it: the seven architecture-bound roles (`scout-1`, `planner`, `implementer`, `reviewer-correctness`, `reviewer-security`, `reviewer-tests`, `code-review`) must map to the generated agents, each generated agent file must be intact (tools, a working skill link, and references to `architecture.md`, the ADRs, and the forbidden patterns), and no generated file may be modified after generation (drift warning).\n\nDoctor is the final authority on your setup. Every report opens with a **Setup progress** section that shows which of the 7 setup steps are done and names the one next command — run `/senai-doctor` after every step and follow the arrow. Beyond the basics it also checks: generated team agents (mandate and technology craft present), technology resources (valid frontmatter, `generic` fallback present), every skill referenced by any agent (exists and is a valid SKILL.md), agent file integrity (name matches filename, no tool typos, valid thinking level, non-empty body), document misassignments (artifact-driven roles carrying truth/comparison documents, a truth document that contradicts the role's expected document type, or a document that does not match the agent's mandate — all errors, with an explicit warning when an assignment cannot be verified), and secrets accidentally committed in agent, skill, or config files. It also audits the subagent extension setup (pi-interactive-subagents present and up to date, no competing subagent providers, no dead package entries), flags stray `tmp_*` helper files left by subagent workarounds, recommends retry/compaction settings for long runs, and treats a run whose stage state disagrees with its artifacts (delivered but missing reports, empty `document/`, implement files in `deliver/`, oversized plan.md) as an error. When a docs skeleton was generated, doctor also validates it: missing stubs warn, filled docs must contain their template's required sections and stay within the length cap, and stray non-stub files in factory docs folders are reported as info.\n\nEvery run saves the full report to `.IDE_Plans/pi-senai/doctor-report.md` (overwritten each run).\n\n## Usage\n\nStart a new run:\n\n```\n/senai-plan <mission>\n```\n\nThe agent will run the Plan stage. When the plan is ready, approve it:\n\n```\n/senai-approve\n```\n\n`/senai-approve` marks the current stage complete and automatically starts the next stage. Before advancing it verifies the stage's artifacts — if any are missing or empty it asks whether to advance anyway — and records the outcome in the run's `state.json` (`stageResults`). While a run is active, a completion guard also watches subagent completion notices: if a subagent reports \"completed\" but its artifact file was never written, the guard appends a resume instruction so the run cannot stall on an empty deliverable.\n\nThe Document stage runs as a factory: doc writers fill the template stubs created by `/senai-generate-docs-structure`, working in batches of at most 4 concurrent writers (batch N+1 waits for batch N; enforced by the stage prompt plus the completion guard — pi.dev has no official concurrency/locking). Every write task carries its target path, template id, and length cap, so docs stay few, short, and standard-formatted. Generated doc-writer agents embed the same contract (target, template, cap) in their agent body.\n\nYou can also run stages manually when the previous stage is already approved:\n\n```\n/senai-implement\n/senai-document\n/senai-deliver\n```\n\nCheck status at any time:\n\n```\n/senai-status\n```\n\nReset the current run:\n\n```\n/senai-reset\n```\n\nRefine the mission in a structured pass before planning (understand → confirm → scans → discuss → approve; invocable from any state):\n\n```\n/senai-brainstorm \"<topic>\"\n/senai-brainstorm-approve\n```\n\n## Agent configuration\n\nBefore running any stage, Pi Senai needs three valid configuration files under `.pi/senai/`: `agents.json`, `files.json`, and `agents_files.json`.\n\nCreate the configuration interactively:\n\n```\n/senai-configure-agents\n```\n\nThis discovers agents from:\n\n1. The current project's `.pi/agents/*.md` files.\n2. Your user agents directory (via Pi's `getAgentDir()`).\n3. Built-in defaults: `scout`, `planner`, `worker`, `reviewer`, `security-auditor`.\n\nFor each Senai role you can accept a suggested agent, choose a different one, or fall back to the default.\n\nCheck the current mapping and validation status:\n\n```\n/senai-agents\n```\n\nStage commands (`/senai-plan`, `/senai-implement`, `/senai-document`, `/senai-deliver`) will warn and stop if any of these configs is missing, invalid, or maps a custom agent that cannot be found.\n\n## Document scope configuration\n\nYou can control which documents each subagent reads. Pi Senai uses three config files:\n\n- `.pi/senai/files.json` — categorized project context (code paths, input documents, test paths).\n- `.pi/senai/agents_files.json` — per-role truth document and comparison documents.\n\nConfigure the project context:\n\n```\n/senai-configure-files\n```\n\nThis command deep-scans your project and suggests real files and folders. It splits selections into three categories:\n\n1. **Code paths** — folders that contain source code (e.g., `src/`, `app/`, `backend/`).\n2. **Input documents** — files the agent should read as instructions (e.g., `docs/PRD.md`, `README.md`).\n3. **Test paths** — folders or files that contain tests (e.g., `tests/`, `e2e/`).\n\nThe scanner recognizes both standard folder names (like `src/`, `docs/`, `tests/`) and custom names by looking at the file types inside each folder. If you select a folder, the tool will not let you also select a file inside it, and vice versa, to avoid conflicts.\n\nThe picker shows two clear sections: `✅ Selected (N)` pinned on top and `💡 Suggestions (N)` below, with uniform markers — Enter toggles an item between the groups. Long paths are middle-truncated so the filename always stays visible, and the focused row shows its full path in a detail line below the list.\n\nConfigure document assignments for each role:\n\n```\n/senai-configure-agents-files\n```\n\nThis command shows the document-reading Senai roles in a custom top-level picker with friendly labels (e.g., `Scout 1 — Architecture / big-picture`) so you can see what each role does before assigning documents. Only the 7 picker-visible roles are listed — the four scouts and the three reviewers. The sequence-orchestrated roles (discussion, planner, code review, security gate) follow stage artifacts automatically and are hidden; the artifact-driven roles (implementer, linter, writers, archive, …) consume stage outputs and are also hidden. Hidden roles stay valid in `agents_files.json` if you want to assign them by hand, and `/senai-doctor` still suggests documents for the sequence roles. Roles that already have a truth document or comparison documents are highlighted, so configured and unconfigured roles are easy to tell apart. Each row also shows a colored guidance tag: `[design-defined]` (green — set by the architecture factory), `[recommended]` (yellow — should be configured), or `[optional]` (dim — your choice). Rows also name the plain document type each role needs (e.g., `needs: RTM / traceability document`), and unassigned roles show doctor's concrete suggestion (e.g., `suggested: docs/RTM.md`), so you can assign correctly without prior knowledge. Selecting a role opens the same custom list editor used by `/senai-configure-files`, pre-filled with documents from `/senai-configure-files` (the `inputDocuments` pool plus discovered markdown files). Assignments are optional; when recommended roles have no truth document, `/senai-doctor` warns and suggests specific documents (from your `architect-inputs.json` document types first).\n\nEach role can have:\n\n1. A **truth document** — the primary document the agent must follow.\n2. **Comparison documents** — other files the agent checks against the truth document.\n\nUse the action bar to set/clear the truth document or add a custom path. Press Enter on a suggestion to add it to the reads list, or on a selected read to remove it.\n\nIf a role has no assignment, it falls back to the relevant project context category plus the current stage artifacts.\n\nCheck the current settings:\n\n```\n/senai-files\n/senai-agents-files\n```\n\n## Testing discipline\n\nPi Senai enforces a testing discipline across the four stages. It is opt-in by default — strict mode is off, so all checks are advisory until you opt in.\n\n### What is enforced\n\nEvery test written in the **Implement** stage follows these rules:\n\n- **AAA** structure — Arrange, Act, Assert, separated by blank lines or comments\n- **Equivalence partitioning** — one representative value per input class\n- **Boundary value analysis** — boundary, just-below, just-above for every numeric / length / range contract\n- **Naming** — one convention everywhere (`should_<expected>_<when>_<condition>`)\n- **Table-driven / parameterized** cases for repeated logic\n- **Property-based** tests for pure functions (Hypothesis, fast-check, jqwik, proptest, FsCheck)\n- **FIRST** quality — Fast, Independent, Repeatable, Self-validating, Timely\n- **Coverage target** — 80% line + branch on changed files, 100% on security-critical paths\n\n### Anti-patterns the scanner rejects\n\nThe deterministic scanner (`pi-extension/src/test-discipline.ts`) flags:\n\n| # | Anti-pattern | Severity | Description |\n|---|---|---|---|\n| 1 | `zero-assertion` | blocking | Test runs but has no assert/expect/should |\n| 2 | `over-mocking` | blocking | More than 3 test doubles in one test |\n| 3 | `mirror-logic` | actionable | Assertion duplicates the production expression (e.g. `assert(add(a,b), a+b)`) |\n| 4 | `flaky-timing` | actionable | `sleep`/`setTimeout` not wrapped in a polling helper |\n| 5 | `no-aaa` | informational | Test body has no blank lines or Arrange/Act/Assert comments |\n| 6 | `mystery-guest` | actionable | Test reads a file from outside the configured fixture paths |\n| 7 | `private-method` | actionable | Test calls a method starting with `_` or `@private` |\n| 8 | `god-test` | actionable | More than 5 asserts or body longer than 50 lines |\n| 9 | `weakened-assertion` | actionable | Skipped/disabled test, commented-out or tautological assertion |\n| 10 | `swallowed-error` | actionable | Empty catch or catch-and-return-null |\n| 11 | `deleted-test-file` | actionable | A test file planned in the `## Files` manifest is missing on disk |\n\nFor `bugfix` missions, rows 9–11 escalate to blocking (`swallowed-error` only when the file is the fix target); escalated smell findings gate in strict mode (`SENAI_TEST_DISCIPLINE_STRICT=1`). Independently of strict mode, the implement approve gate also collects a `bugfixRegressionTest` signal for bugfix runs: the brief's `## Regression test plan` must name a test file that exists on disk and is covered by the plan's `## Files` manifest, otherwise the advance is blocked (confirm-overridable, same style as verification failures).\n\n### Tool: `senai_scan_test_smells`\n\nCall the scanner on test paths:\n\n```\nsenai_scan_test_smells\n```\n\nOr from Node:\n\n```typescript\nimport { scanTestFilesOnDisk } from \"./dist/pi-extension/src/test-discipline.js\";\nconst report = scanTestFilesOnDisk([\"tests/\", \"src/**/*.test.ts\"]);\nconsole.log(report.blockingCount, report.findings);\n```\n\n### Environment variables\n\n| # | Variable | Default | Purpose |\n|---|---|---|---|\n| 1 | `SENAI_TEST_DISCIPLINE_STRICT=1` | unset | Promote blocking findings + below-floor coverage to hard gates (otherwise advisory) |\n| 2 | `SENAI_TEST_DISCIPLINE_COVERAGE_FLOOR` | 80 | Minimum line + branch coverage % on changed files (0 disables the floor) |\n\n### Where the discipline shows up\n\n| # | Where | What |\n|---|---|---|\n| 1 | `skills/senai-implement.md` | `## Testing discipline` block tells the orchestrator what good tests look like; `## Approval gate` requires scan + coverage + verification before prompting |\n| 2 | `skills/senai-document.md` | Orchestrator must run `npm test` AND `senai_scan_test_smells` before presenting the doc-stage approval gate |\n| 3 | `skills/senai-deliver.md` | Orchestrator must re-scan and block on any NEW blocking finding not seen at implement-end (drift detection) |\n| 4 | Generated `<project>-test-skeleton.md` | Carries the discipline rules in its `## Your mandate`; its `## Out of scope` forbids implementing source code |\n| 5 | Generated `<project>-linter.md` | Flags the 8 anti-patterns alongside style violations |\n| 6 | Generated `<project>-full-test.md` | Refuses to declare success when there are skipped tests without TODO comments |\n| 7 | Generated doc-writer agents | `## Out of scope` forbids modifying test files or tested code examples |\n| 8 | Architecture-generated `implementer` / `reviewer-tests` / `reviewer-correctness` | `## Testing discipline` / `## Review checklist` / `## Anti-pattern scan` sections |\n| 9 | `/senai-doctor` | Two new sections: **Testing discipline** (strict mode, coverage, scanner, skills, version distribution) and **Sub-agent generator completeness** (every GENERATED_ROLES row has the v5 fields) |\n\n## Framework lock\n\nArchitecture is mandatory; a framework is the project's choice — but once chosen, it is locked by machine at the same standard. The plan's manifest records it in an optional `## Framework` field: a framework id from the pi-chirpi `framework-library/` (e.g. `nextjs`, `express`, `django`), or `none`.\n\n- **Planning approve gate** — when the codebase profiler detected a framework from dependencies or the plan's `## Tech Stack` names one, the manifest must record the same id; a missing entry, `none`, or a contradicting id hard-blocks the advance.\n- **Implement gate** — the locked framework's machine-readable `## Rules` run right after the architecture layer-map check (dependency-cruiser for TypeScript maps, import-linter for Python maps; the runner emits the config and uses the tool only when the target project has it installed — tool-absent is an honest skip, never silent). Violations are blocking reasons; the run is persisted to `implement/framework-rules-report.md`.\n- **`none`** — skips every framework check cleanly; architecture rules still apply.\n\n## Architecture generation\n\nPi Senai can generate project-specific architecture agents and skills from your requirements documents. The architecture factory lives in the companion package `@adi-mudi/pi-chirpi` (a hard dependency — `/senai-doctor` reports an error when it is missing); Senai drives it and validates its outputs.\n\n1. **Choose the input documents** the architect should read:\n\n   ```\n   /chirpi-configure-architect-inputs\n   ```\n\n   This command reuses the same file picker as `/senai-configure-files`. Select PRDs, NFRs, RTMs, test plans, READMEs, feasibility studies, and any other documents that describe the architecture. You can also add additional constraints that are not in any file.\n\n   The selection is saved to `.pi/senai/architect-inputs.json`.\n\n2. **Generate the architecture agents and skills**:\n\n   ```\n   /chirpi-generate-architect\n   ```\n\n   This runs the **architecture factory**. It reads the selected documents in parallel (Map-Reduce), extracts architectural drivers, asks clarifying questions, matches the drivers against the architecture library, and produces a complete software architecture.\n\n   The factory uses two deterministic extension tools to avoid LLM drift:\n   - `senai_merge_architect_drivers` — merges per-document map outputs into the final drivers file.\n   - `senai_finalize_architecture` — generates docs, agents, and skills with exact names.\n\n   The architecture library includes 36 entries grouped into three categories:\n   - **Application architectures** (17): monolith, modular monolith, microservices, event-driven, serverless, layered, clean, SOA, hexagonal, CQRS, pipeline, microkernel, space-based, embedded-iot, plc-scada, and Google Apps Script spreadsheet automation.\n   - **Pi extension sub-patterns** (10): orchestrator, subagent-delegator, memory, tool-provider, guard, compactor, theme, provider, mcp-bridge, rpc.\n   - **Pi official specs** (6): package-manifest, lifecycle-events, api-surface, skill-format, agent-format, discovery-paths.\n   - **Pi-aware project architectures** (3): coding-agent, skill-package, rpc-host.\n\n   When `/chirpi-generate-architect` runs on a project whose `package.json` imports from `@earendil-works/pi-*` (or the legacy `@mariozechner/pi-*`) and has a `pi-package` keyword, the factory detects the Pi extension shape (4 signal sources: drivers, inputsConfig, packageJson, agent files), biases architecture selection toward `pi-architecture`, and emits a \"Pi Extension Mandatory Rules\" section in the generated `architecture.md` (12 official rules covering layered deps, peerDependencies, atomic writes, skill/agent frontmatter, lifecycle event handlers, TypeBox schemas, `ctx.signal` use, and run state paths). Generated agents carry a \"Pi Extension Tool Constraints\" block; generated skills carry a \"Pi Extension Compliance\" pointer. The architecture library itself is bundled with `@adi-mudi/pi-chirpi` and is project-overridable: copy any entry into the project's `.pi/architecture-library/` to shadow the bundled version without forking.\n\n   Generated state and artifacts (kept in `.pi/architect/`):\n\n   - `.pi/architect/architectural-drivers.json` — merged architectural drivers.\n   - `.pi/architect/architect-profile.json` — the chosen architecture id and project profile.\n   - `.pi/architect/architect-report.json` — the full architecture report.\n   - `.pi/architect/architecture.md` — the human-readable software architecture document.\n   - `.pi/architect/adrs/*.md` — architecture decision records.\n   - `.IDE_Plans/architect-map/*.json` — intermediate per-document driver files (temporary).\n\n   Generated Pi-discoverable outputs:\n\n   - `.pi/agents/<project>-<architecture-id>-<role>.md` — project-specific agents for planner, implementer, reviewer-correctness, reviewer-security, and reviewer-tests.\n   - `.pi/skills/<project>-<architecture-id>-<stage>/SKILL.md` — project-specific skills for plan, implement, document, and deliver stages.\n\n   The generated planner agent is used for architecture scouting (`scout-1`), and all generated agents instruct subagents to read `.pi/architect/architecture.md` and the relevant ADRs before acting.\n\n   If the input documents, the document list, or the additional constraints change, `/chirpi-generate-architect` detects it and asks whether to re-run the full architecture factory. Re-runs are safe: map files from removed documents are discarded before merging, agents and skills from a previous architecture are removed, and the ADR set is regenerated to match the new report.\n\n   If the architecture library lacks a matching pattern, the agent falls back to web search to gather relevant guidance before generating the agents.\n\n   After generation, `/senai-doctor` also validates the architecture setup.\n\n## Agent generation\n\n`/senai-generate-sub-agents` creates project-specific sub-agents for the 14 non-architecture Senai roles (scouts 2–4, discussion, plan overview, test skeleton, linter, full test, the four doc writers, security gate, archive). The 7 architecture-bound roles are owned by `/chirpi-generate-architect` and are never generated here.\n\n- **Basic mode (default):** if no architect report exists, you answer 3–4 questions (project type, language, framework) and the full team is generated with sensible defaults. With an architect report, the generator reuses its tech stack and constraints.\n- **Technology resources:** agent craft comes from bundled resource files in `resources/technologies/` (`google-apps-script`, `python`, `generic`). The generator matches your tech stack against them. Every resource is sourced from official documentation with cited URLs.\n- **No silent generic:** when no resource matches, you choose — **Fetch from official docs** (the agent searches official documentation and distills a real resource file into `.pi/technologies/<tech>.md`, cited per section; re-run the command to use it), **Use generic**, or **Cancel**.\n- **Safety:** existing custom agents are never overwritten, and existing custom mappings are never changed. Re-running the command regenerates old generated agents in place — but only files the generation manifest proves pi-senai wrote and you never edited (sha256 match); your edited agents are detected and kept. A generated file you deleted is recreated automatically if its mapping still exists. The confirmation dialog shows the exact write set (create / regenerate / recreate / kept / skipped) before anything is written. After one confirmation, the new agents are written to `.pi/agents/` and mapped in `agents.json`.\n- Run `/senai-doctor` afterwards to validate the setup.\n\nTo add a technology: copy `resources/technologies/_template.md` to `<technology>.md`, fill the sections from official documentation (cite the URLs), and it is picked up automatically — no code change needed. Projects can also add or override resources in `.pi/technologies/`.\n\n## Artifact layout\n\n```\n.IDE_Plans/pi-senai/\n  state.json\n  runs/\n    YYYY-MM-DD-HH-MM-<mission-slug>/\n      plan/\n        plan.md\n        plan-overview.md\n        discussion-notes.md\n        scouts/\n          scout-angle_1.md\n          scout-angle_2.md\n          scout-angle_3.md\n          scout-angle_4.md\n        reviews/\n          review-correctness.md\n          review-security.md\n          review-tests.md\n      implement/\n      document/\n      deliver/\n        security-report.md\n        deliver-summary.md\n\n.pi/architect/        # one-time architecture factory output\n  architectural-drivers.json\n  architect-profile.json\n  architect-report.json\n  architecture.md\n  adrs/\n    0001-<title>.md\n\n.IDE_Plans/architect-map/   # intermediate per-document drivers (temporary)\n  <sanitized-path>.json\n```\n\n## Development\n\nBuild:\n\n```bash\nnpm run build\n```\n\nRun tests:\n\n```bash\nnpm test\n```\n\nTests are in `pi-extension/test/` and use Node's built-in test runner.\n\n## See also\n\n- [`Doc/senai-sequence.md`](Doc/senai-sequence.md) — high-level stage flow.\n- [`Doc/senai-full-sequence.md`](Doc/senai-full-sequence.md) — full sequence specification.\n- [`Doc/step-by-step-guide.md`](Doc/step-by-step-guide.md) — detailed walkthrough.\n- [`AGENTS.md`](AGENTS.md) — contributor / agent notes.\n\n## License\n\nMIT\n","readmeFilename":"README.md"}