{"_id":"@ai-agentx/pi-men","name":"@ai-agentx/pi-men","dist-tags":{"latest":"0.84.4"},"versions":{"0.84.4":{"name":"@ai-agentx/pi-men","version":"0.84.4","description":"pi-men: a coding agent with built-in four-layer memory (conversations, atomic memories, scenes, persona), built on the pi base","type":"module","main":"./dist/cli.js","bin":{"pi-men":"dist/cli.js"},"publishConfig":{"access":"public"},"scripts":{"clean":"node -e \"import('node:fs/promises').then(fs=>fs.rm('dist',{recursive:true,force:true}))\"","build":"tsgo -p tsconfig.build.json && shx chmod +x dist/cli.js","prepublishOnly":"npm run clean && npm run build"},"keywords":["coding-agent","agent","memory","cli"],"author":{"name":"Earendil Works"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/earendil-works/pi.git","directory":"packages/pi-men-cli"},"engines":{"node":">=22.19.0"},"dependencies":{"@earendil-works/pi-coding-agent":"^0.84.4","undici":"8.9.0"},"devDependencies":{"@types/node":"22.19.19"},"gitHead":"2d0200c0e837cf108da834a86b65b57518333ac4","types":"./dist/cli.d.ts","_id":"@ai-agentx/pi-men@0.84.4","bugs":{"url":"https://github.com/earendil-works/pi/issues"},"homepage":"https://github.com/earendil-works/pi#readme","_nodeVersion":"24.14.1","_npmVersion":"11.11.0","dist":{"integrity":"sha512-nBG+zpM//v506jG9hPihjzeLIM2l6YsQ4lwKuXjVRdG6bUWh0U+w8DkQyXeDzPGdxX0lzkzDaEUjabgY64ah5g==","shasum":"d245b7ca88abb34b378d5435764c05d0706f475a","tarball":"https://registry.npmjs.org/@ai-agentx/pi-men/-/pi-men-0.84.4.tgz","fileCount":12,"unpackedSize":21910,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIDkI+QC4D5Tywaaza35QmvUqbzcfKZUB93N7sn0+AGZmAiEArXobWpB/CLyoCGgYR7Swsy0ioij+ni2LOPHuzOnAp10="}]},"_npmUser":{"name":"qqlcx5","email":"893917884@qq.com"},"directories":{},"maintainers":[{"name":"qqlcx5","email":"893917884@qq.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/pi-men_0.84.4_1788401773415_0.4487396525936853"},"_hasShrinkwrap":false}},"time":{"created":"2026-09-03T02:16:13.222Z","0.84.4":"2026-09-03T02:16:13.578Z","modified":"2026-09-03T02:16:13.894Z"},"maintainers":[{"name":"qqlcx5","email":"893917884@qq.com"}],"description":"pi-men: a coding agent with built-in four-layer memory (conversations, atomic memories, scenes, persona), built on the pi base","homepage":"https://github.com/earendil-works/pi#readme","keywords":["coding-agent","agent","memory","cli"],"repository":{"type":"git","url":"git+https://github.com/earendil-works/pi.git","directory":"packages/pi-men-cli"},"author":{"name":"Earendil Works"},"bugs":{"url":"https://github.com/earendil-works/pi/issues"},"license":"MIT","readme":"# pi-men\n\nA coding agent with built-in four-layer memory, built on the [pi](https://github.com/earendil-works/pi) base.\n\n`pi-men` works exactly like `pi` — same interaction, same commands, same modes — plus a memory engine that captures your conversations and work, distills them into reusable memory, and re-injects the relevant parts into future sessions. The more you use it, the less you have to re-explain yourself.\n\n## Quick start\n\n```bash\nnpm install -g @ai-agentx/pi-men\npi-men              # first run asks you to configure a model/API key, like pi\n```\n\nAll data lives in `~/.pi-men` (independent of any existing pi installation).\n\n## What you get\n\n### A full coding agent\n\npi-men inherits the complete pi base: multi-provider models (Anthropic, OpenAI, Google, Bedrock, and more, plus a built-in llama.cpp provider for local models), the standard tool set (read, bash, edit, write, grep, find, ls), interactive TUI with session tree and compaction, print/RPC/JSON modes for scripting, an extension API, skills, prompt templates, and themes.\n\n### Four-layer memory (the pi-men part)\n\n| Layer | What it stores | Where |\n|---|---|---|\n| L0 Conversation | every turn, full fidelity | SQLite + daily JSONL |\n| L1 Atom | structured memories: preferences, events, instructions, project facts, tasks, methods, artifacts | SQLite |\n| L2 Scenario | narrative scene blocks that consolidate related memories | `scene_blocks/*.md` |\n| L3 Core | a long-term persona / operating doctrine distilled from scenes | `persona.md` |\n\n**Capture is automatic.** Finished turns are recorded, and every few turns (or after an idle timeout) a background pipeline distills them into L1 memories — with LLM-based deduplication that can store, update, merge, or skip against what it already knows. L2 and L3 consolidate periodically as new memories accumulate. The pipeline never blocks your turns.\n\n**Recall is hybrid and cache-friendly.** Each request gets the relevant memories injected as a `<relevant-memories>` block on the user message, while a stable persona block is appended to the system prompt (so provider prompt caches stay valid). Search fuses SQLite FTS5 keyword scoring with vector similarity (when an embedding endpoint is configured) using reciprocal rank fusion; it works in one language-agnostic shot — Chinese and English both covered.\n\n**You can always dig deeper** with two built-in tools the agent can call: `memory_search` (structured memories) and `conversation_search` (raw past conversations). Or save something explicitly with `/remember <text>`; `/memory` shows store status.\n\n**It is optional.** Disable memory with one setting and pi-men behaves as a plain agent; the store stays on disk untouched.\n\n## Commands and tools\n\n| Item | Type | Purpose |\n|---|---|---|\n| `/remember <text>` | command | save a long-term memory right now |\n| `/memory` | command | show memory store status (counts, last pipeline runs) |\n| `memory_search` | tool | agent searches structured memories (L1) |\n| `conversation_search` | tool | agent searches raw past conversations (L0) |\n\n## Storage\n\n```\n~/.pi-men/\n  auth.json          provider credentials\n  settings.json      settings (pi format)\n  sessions/          session transcripts\n  memory/\n    memory.db        SQLite: conversations, memories, FTS + vector indexes\n    conversations/   append-only daily JSONL (source of truth)\n    records/         append-only audit of every memory write/update/merge\n    scene_blocks/    L2 scene blocks + scene_index.json\n    persona.md       L3 persona / operating doctrine\n    .backup/         persona backups\n    .metadata/       pipeline checkpoint (survives restarts)\n```\n\n## Configuration\n\nDisable memory in `~/.pi-men/settings.json`:\n\n```json\n{ \"memory\": { \"enabled\": false } }\n```\n\nTune the engine in `~/.pi-men/memory.json` (all keys optional; defaults shown):\n\n```json\n{\n  \"promptMode\": \"code\",\n  \"capture\": { \"enabled\": true },\n  \"extraction\": { \"enabled\": true, \"enableDedup\": true },\n  \"pipeline\": { \"everyNConversations\": 5, \"l1IdleTimeoutSeconds\": 600 },\n  \"recall\": { \"enabled\": true, \"strategy\": \"hybrid\", \"maxResults\": 5, \"scoreThreshold\": 0.3 },\n  \"embedding\": {\n    \"provider\": \"none\",\n    \"baseUrl\": \"https://api.openai.com/v1\",\n    \"apiKey\": \"sk-...\",\n    \"model\": \"text-embedding-3-small\",\n    \"dimensions\": 1536\n  }\n}\n```\n\n- `promptMode`: `\"code\"` extracts work memories (facts / tasks / methods / artifacts); `\"chat\"` extracts personal memories (persona / episodic / instructions).\n- `embedding.provider`: `\"none\"` keeps recall keyword-only with zero network calls; `\"openai\"` enables semantic recall against any OpenAI-compatible `/embeddings` endpoint.\n\n## Notes\n\n- Memory distillation uses your configured model and consumes tokens in the background. If you want the agent without the cost, set `memory.enabled: false` or `extraction.enabled: false`.\n- Memory data never leaves your machine; the only network calls are to your model/embedding providers.\n\n## License\n\nMIT — see [LICENSE](./LICENSE). Built on [pi](https://github.com/earendil-works/pi) by Earendil Works.\n","readmeFilename":"README.md","_rev":"1-317c7fbdbd9bfab4a9750b818ec055d8"}