{"_id":"@cooper-zygao/pwa-mystery","_rev":"3-c453f3994a63021722aeac3758c7d211","name":"@cooper-zygao/pwa-mystery","dist-tags":{"latest":"0.1.2"},"versions":{"0.1.0":{"name":"@cooper-zygao/pwa-mystery","version":"0.1.0","keywords":["writing-agent","novel","mystery","llm","cli","tui"],"author":{"name":"Zhengyuan Gao"},"license":"MIT","_id":"@cooper-zygao/pwa-mystery@0.1.0","maintainers":[{"name":"cooper-zygao","email":"cooper-gao@outlook.com"}],"bin":{"PWA-mystery":"dist/cli.js"},"dist":{"shasum":"565aca517609eaf0689b4db48cffc094a566e9dc","tarball":"https://registry.npmjs.org/@cooper-zygao/pwa-mystery/-/pwa-mystery-0.1.0.tgz","fileCount":124,"integrity":"sha512-41ohT/V8raB8UUB+76pYy04OCJFmejdTWG5QUGVyxp0AD60MBjWL4YtmJP7O5BImj6I+4RCzs5jHgMHKJsvyvQ==","signatures":[{"sig":"MEUCIQC6KKhS0Sj8vcLT4UM9QakKjnOsxN0oN/7dFGgdwjNYjAIgS8ZMGiHYwk0l8a/A2WcIbzRE6Iykl9YG8W9MtsPb+dU=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":440933},"main":"./dist/index.js","type":"module","_from":"file:cooper-zygao-pwa-mystery-0.1.0.tgz","types":"./dist/index.d.ts","engines":{"node":">=20.6.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"scripts":{"dev":"tsgo -p tsconfig.build.json --watch --preserveWatchOutput","test":"vitest --run","build":"tsgo -p tsconfig.build.json && shx chmod +x dist/cli.js","clean":"shx rm -rf dist","typecheck":"tsgo --noEmit -p tsconfig.build.json"},"_npmUser":{"name":"cooper-zygao","email":"cooper-gao@outlook.com"},"piConfig":{"name":"pwa-mystery","configDir":".pwa-mystery"},"_resolved":"/Users/dino/Downloads/20260602/cooper-zygao-pwa-mystery-0.1.0.tgz","_integrity":"sha512-41ohT/V8raB8UUB+76pYy04OCJFmejdTWG5QUGVyxp0AD60MBjWL4YtmJP7O5BImj6I+4RCzs5jHgMHKJsvyvQ==","_npmVersion":"11.9.0","description":"Pi Writing Agent - An AI agent that writes mystery novels. Decomposes the novel-writing process into isolated phases, each guarded by a file-system access matrix.","directories":{},"_nodeVersion":"24.14.0","dependencies":{"yaml":"^2.8.2","chalk":"^5.5.0","@mariozechner/pi-ai":"^0.67.68","@mariozechner/pi-tui":"^0.67.68","@mariozechner/pi-agent-core":"^0.67.68","@mariozechner/pi-coding-agent":"^0.67.68"},"_hasShrinkwrap":false,"devDependencies":{"shx":"^0.4.0","vitest":"^3.2.4","typescript":"^5.7.3","@types/node":"^24.3.0"},"_npmOperationalInternal":{"tmp":"tmp/pwa-mystery_0.1.0_1780383691813_0.405603681266242","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"@cooper-zygao/pwa-mystery","version":"0.1.1","keywords":["writing-agent","novel","mystery","llm","cli","tui"],"author":{"name":"Zhengyuan Gao"},"license":"MIT","_id":"@cooper-zygao/pwa-mystery@0.1.1","maintainers":[{"name":"cooper-zygao","email":"cooper-gao@outlook.com"}],"bin":{"PWA-mystery":"dist/cli.js"},"dist":{"shasum":"7a1651fb7026dd8d729ea9883a8b5af242772658","tarball":"https://registry.npmjs.org/@cooper-zygao/pwa-mystery/-/pwa-mystery-0.1.1.tgz","fileCount":124,"integrity":"sha512-V6p5iu3JIuci9nDTJ9gt3j0ScYuubs65KLk+bDUZJN5YVuiWKbNmgQCGIt7KQ6P26u1dKTs4GH26MaF+Bi7YQg==","signatures":[{"sig":"MEQCICVVN7hkzVqvmKT8mmHvMtLH6apNG1OZ6yExPXHZGfqBAiAeBW5Yxt04MMsvTl+neWzKHTmjbmyu2z+CdSHrBZCwrA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":436834},"main":"./dist/index.js","type":"module","_from":"file:cooper-zygao-pwa-mystery-0.1.1.tgz","types":"./dist/index.d.ts","engines":{"node":">=20.6.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"scripts":{"dev":"tsgo -p tsconfig.build.json --watch --preserveWatchOutput","test":"vitest --run","build":"tsgo -p tsconfig.build.json && shx chmod +x dist/cli.js","clean":"shx rm -rf dist","typecheck":"tsgo --noEmit -p tsconfig.build.json"},"_npmUser":{"name":"cooper-zygao","email":"cooper-gao@outlook.com"},"piConfig":{"name":"pwa-mystery","configDir":".pwa-mystery"},"_resolved":"/Users/dino/Downloads/20260602/cooper-zygao-pwa-mystery-0.1.1.tgz","_integrity":"sha512-V6p5iu3JIuci9nDTJ9gt3j0ScYuubs65KLk+bDUZJN5YVuiWKbNmgQCGIt7KQ6P26u1dKTs4GH26MaF+Bi7YQg==","_npmVersion":"11.9.0","description":"Pi Writing Agent - An AI agent that writes mystery novels. Decomposes the novel-writing process into isolated phases, each guarded by a file-system access matrix.","directories":{},"_nodeVersion":"24.14.0","dependencies":{"yaml":"^2.8.2","chalk":"^5.5.0","@mariozechner/pi-ai":"^0.67.68","@mariozechner/pi-tui":"^0.67.68","@mariozechner/pi-agent-core":"^0.67.68","@mariozechner/pi-coding-agent":"^0.67.68"},"_hasShrinkwrap":false,"devDependencies":{"shx":"^0.4.0","vitest":"^3.2.4","typescript":"^5.7.3","@types/node":"^24.3.0"},"_npmOperationalInternal":{"tmp":"tmp/pwa-mystery_0.1.1_1780384056932_0.9498771272268087","host":"s3://npm-registry-packages-npm-production"}},"0.1.2":{"name":"@cooper-zygao/pwa-mystery","version":"0.1.2","description":"LLM-powered mystery novel writing agent. 5-phase pipeline (truth → world → plan → write → review) with hard file-system isolation, per-chapter AI-pattern scanning, paragraph-level polishing, and targeted revision mode. Built on pi-agent-core.","type":"module","piConfig":{"name":"pwa-mystery","configDir":".pwa-mystery"},"bin":{"PWA-mystery":"dist/cli.js"},"main":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"scripts":{"clean":"shx rm -rf dist","dev":"tsgo -p tsconfig.build.json --watch --preserveWatchOutput","build":"tsgo -p tsconfig.build.json && shx chmod +x dist/cli.js","typecheck":"tsgo --noEmit -p tsconfig.build.json","test":"vitest --run"},"dependencies":{"@mariozechner/pi-agent-core":"^0.67.68","@mariozechner/pi-ai":"^0.67.68","@mariozechner/pi-coding-agent":"^0.67.68","@mariozechner/pi-tui":"^0.67.68","chalk":"^5.5.0","yaml":"^2.8.2"},"devDependencies":{"@types/node":"^24.3.0","shx":"^0.4.0","typescript":"^5.7.3","vitest":"^3.2.4"},"keywords":["writing-agent","novel","mystery","llm","cli","tui"],"author":{"name":"Zhengyuan Gao"},"license":"MIT","engines":{"node":">=20.6.0"},"_id":"@cooper-zygao/pwa-mystery@0.1.2","_integrity":"sha512-mhVEJcenvUjYiAyBy4Uz3QEHbgwV53u/L9Q5baDwsD6gAuXTnIj1kFbs+6GnqSeCmRZOBJ0hZY1t5n+6gCWdkQ==","_resolved":"/Users/dino/Downloads/20260602/cooper-zygao-pwa-mystery-0.1.2.tgz","_from":"file:cooper-zygao-pwa-mystery-0.1.2.tgz","_nodeVersion":"24.14.0","_npmVersion":"11.9.0","dist":{"integrity":"sha512-mhVEJcenvUjYiAyBy4Uz3QEHbgwV53u/L9Q5baDwsD6gAuXTnIj1kFbs+6GnqSeCmRZOBJ0hZY1t5n+6gCWdkQ==","shasum":"d52653bccb0bcda28ecfc2f39d73d46c4a0c048e","tarball":"https://registry.npmjs.org/@cooper-zygao/pwa-mystery/-/pwa-mystery-0.1.2.tgz","fileCount":128,"unpackedSize":461314,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDwAnGsvoCU9GXxyOzjRpW814bg1U/XCug6EAcsGl0eRQIgUI6y1LW3N5YUXTQWrmwhzcOQlVbmuFUMvs3dJnRPUCI="}]},"_npmUser":{"name":"cooper-zygao","email":"cooper-gao@outlook.com"},"directories":{},"maintainers":[{"name":"cooper-zygao","email":"cooper-gao@outlook.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/pwa-mystery_0.1.2_1780892831430_0.857657752871201"},"_hasShrinkwrap":false}},"time":{"created":"2026-06-02T07:01:31.568Z","modified":"2026-06-08T04:27:11.714Z","0.1.0":"2026-06-02T07:01:31.970Z","0.1.1":"2026-06-02T07:07:37.087Z","0.1.2":"2026-06-08T04:27:11.592Z"},"author":{"name":"Zhengyuan Gao"},"license":"MIT","keywords":["writing-agent","novel","mystery","llm","cli","tui"],"description":"LLM-powered mystery novel writing agent. 5-phase pipeline (truth → world → plan → write → review) with hard file-system isolation, per-chapter AI-pattern scanning, paragraph-level polishing, and targeted revision mode. Built on pi-agent-core.","maintainers":[{"name":"cooper-zygao","email":"cooper-gao@outlook.com"}],"readme":"# PWA-mystery v0.1.2\n\nLLM-powered mystery novel writing agent. Five-phase pipeline (truth → world → plan → write → review) with hard file-system isolation to prevent spoiler leaks. Built on [pi-agent-core](https://www.npmjs.com/package/@mariozechner/pi-agent-core).\n\n**Core invariant**: the Writer agent never reads `truths/`. Access is enforced at the tool level — not prompt etiquette.\n\n---\n\n## Features\n\n- **5-phase pipeline**: truth design → world-building → chapter planning → prose generation → final review\n- **Hard file-system isolation**: access matrix prevents each agent from reading forbidden directories\n- **reviewPolish v3**: per-chapter AI-pattern scanning (`scan_ai_patterns`, `scan_repetition`, `scan_density`), paragraph-level rewriting via `apply_patch` with staging + atomic rename\n- **Targeted revision**: `/phase:write --revise` reads `finalReview.fixes[]` and applies precise patches across chapters without full rewrites\n- **Self-reflection**: every phase runs a consistency check after generation (name cross-references, timeline coherence, spoiler leakage prevention)\n- **Batch final review**: processes chapters in batches of 3 to avoid context overflow; 70% reader perspective + 30% editor\n- **Snapshot-based rollback**: `/rewind N --force` resets drafts/state from chapter N onward\n- **TUI with pi logo**: gradient ASCII art header, model selector, phase-aware footer\n\n---\n\n## Install\n\n```bash\nnpm install -g @cooper-zygao/pwa-mystery\n```\n\nRequires Node.js 20+. Dependencies (`@mariozechner/pi-*`, `chalk`, `yaml`) auto-installed.\n\n---\n\n## Quick Start\n\n```bash\nmkdir my-novel && cd my-novel\nPWA-mystery .\n```\n\nDescribe your novel in the TUI:\n```\nI want an English short mystery, ~20,000 words, 4 chapters.\nSetting: Shanghai + New York, 2025, cyberpunk.\n```\n\nThe assistant creates `config.md`. Then run phases:\n\n```\n/phase:truth     # Design the mystery\n/phase:world     # Build reader-facing world\n/phase:plan      # Per-chapter outlines\n/phase:write     # Write prose + auto-polish\n/phase:review    # Full-book review → fixes[]\n```\n\nOr: `/auto --confirm`\n\nAfter review: `/phase:write --revise` to apply fixes. Repeat review → revise until satisfied.\n\n---\n\n## Commands\n\n| Command | Purpose |\n|---|---|\n| `/phase:truth` | Design killer, motive, method, clues |\n| `/phase:world` | Build reader-facing world (no spoilers) |\n| `/phase:plan` | Per-chapter plan JSON |\n| `/phase:write [N] [M] [--revise]` | Write chapters or apply review fixes |\n| `/phase:review` | Full-book review → structured fixes[] |\n| `/auto [--from X] [--through Y] [--confirm]` | Run phases sequentially |\n| `/interrogate` | Independent reviewer session |\n| `/rewind N --force` | Roll back from chapter N |\n| `/model <spec>` | Set/view writer model |\n| `/model-reviewer <spec>` | Set/view reviewer model |\n| `/status` | Project state |\n| `/help` | All commands |\n\n---\n\n## Project Layout\n\n```\nmy-novel/\n├── config.md                  ← Author brief (deleted after /phase:truth)\n├── .pwa-mystery/state.json    ← Phase state\n├── truths/                    ← God's-eye view (WRITER CANNOT READ)\n├── world/\n│   ├── meta.json              ← language, title, chapterCount, wordsPerChapter\n│   ├── language.md / scene.md\n│   └── structure/chapter-N.md\n├── plan/chapter-N.json\n├── drafts/chapter-N.md\n├── state/chapter-N-state.json\n├── reviews/final.json\n└── sessions/<role>/messages.jsonl\n```\n\n---\n\n## Model Configuration\n\n`~/.pwa-mystery/models.json`:\n\n```jsonc\n{\n  \"schemaVersion\": 2,\n  \"writer\": \"minimax/MiniMax-M3-highspeed\",\n  \"reviewer\": \"deepseek-v4-flash\",\n  \"providers\": {\n    \"opencode-go-minimax\": {\n      \"baseUrl\": \"https://opencode.ai/zen/go/v1\",\n      \"apiKey\": \"sk-...\",\n      \"api\": \"anthropic-messages\",\n      \"models\": [{ \"id\": \"MiniMax-M3-highspeed\", \"name\": \"MiniMax M3\" }]\n    }\n  }\n}\n```\n\nShare with coding-agent: `ln -s ~/.pi/agent/models.json ~/.pwa-mystery/models.json`\n\n---\n\n## Architecture\n\nSee `overview.md` for detailed architecture documentation (tools, access matrix, rendering pipeline, test suite).\n","readmeFilename":"README.md"}