{"_id":"@djhaskin987/pi-top-of-mind","_rev":"3-9aa1cd4f988946239b673c0dfb5c9e1f","name":"@djhaskin987/pi-top-of-mind","dist-tags":{"latest":"0.4.0"},"versions":{"0.2.0":{"name":"@djhaskin987/pi-top-of-mind","version":"0.2.0","keywords":["pi-package","pi-extension","top-of-mind","persistent-instructions"],"author":{"name":"djha-skin"},"license":"MIT","_id":"@djhaskin987/pi-top-of-mind@0.2.0","maintainers":[{"name":"djhaskin987","email":"djhaskin987@gmail.com"}],"homepage":"https://github.com/djha-skin/pi-top-of-mind#readme","bugs":{"url":"https://github.com/djha-skin/pi-top-of-mind/issues"},"pi":{"extensions":["./extensions/index.ts"]},"dist":{"shasum":"154997147ed76fd1420050225d4dd4cf6f2ca3f5","tarball":"https://registry.npmjs.org/@djhaskin987/pi-top-of-mind/-/pi-top-of-mind-0.2.0.tgz","fileCount":5,"integrity":"sha512-YqZ3rQQJip9SMYs3l+b26om3VjptSHu3I/wrieBiGvj942rtv9D5Ks3GJtCgPoH0fCp7LMK/BJ5UOD1izLKwUw==","signatures":[{"sig":"MEUCIGeLQekvA6xWRnEjeJ1gSb8azBh/OG+wKhhL3MidIv59AiEAimF7wmSS7F9iG5BxyyOv9X2n0uc2+xI9JYlX4jdc3Yw=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":15184},"main":"extensions/index.ts","type":"module","gitHead":"dfd34e61980609ddb78d4932bd867fdec31912b2","scripts":{"test":"npx tsx tests/index.test.ts","prepublishOnly":"npm test"},"_npmUser":{"name":"djhaskin987","email":"djhaskin987@gmail.com"},"repository":{"url":"git+https://github.com/djha-skin/pi-top-of-mind.git","type":"git"},"_npmVersion":"10.9.7","description":"A pi.dev extension that injects persistent instructions into the agent's working memory every turn — inspired by goose's Top of Mind feature.","directories":{},"_nodeVersion":"22.22.2","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.0.0","typescript":"^5.7.0","@types/node":"^22.0.0"},"peerDependencies":{"typebox":"*","@earendil-works/pi-coding-agent":"*"},"_npmOperationalInternal":{"tmp":"tmp/pi-top-of-mind_0.2.0_1785784739263_0.12494668394822295","host":"s3://npm-registry-packages-npm-production"}},"0.3.0":{"name":"@djhaskin987/pi-top-of-mind","version":"0.3.0","keywords":["pi-package","pi-extension","top-of-mind","persistent-instructions"],"author":{"name":"djha-skin"},"license":"MIT","_id":"@djhaskin987/pi-top-of-mind@0.3.0","maintainers":[{"name":"djhaskin987","email":"djhaskin987@gmail.com"}],"homepage":"https://github.com/djha-skin/pi-top-of-mind#readme","bugs":{"url":"https://github.com/djha-skin/pi-top-of-mind/issues"},"pi":{"extensions":["./extensions/index.ts"]},"dist":{"shasum":"8fa7e1d3cb0b386940dd2fe81be87148a9c67358","tarball":"https://registry.npmjs.org/@djhaskin987/pi-top-of-mind/-/pi-top-of-mind-0.3.0.tgz","fileCount":5,"integrity":"sha512-xx1hh9nlVxp0Se5IPRcp+02EJky1i39QcJSTNy7sPUiVrNLlxZ1gyRjlNMYIVXrwvf5XJK6c9e7RbbMYQemxOw==","signatures":[{"sig":"MEUCIDdZClkkW/1pTOFL6NxnJzQdwADq9Kh1wjXoQV8H5tjTAiEA7TJb7OSSlrhTIoeossIE4gMCzkzIPC8wOL9Eq528FLU=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":19801},"main":"extensions/index.ts","type":"module","gitHead":"4fb68b0f1b89d9007835a629908a8da268d6f0c9","scripts":{"test":"npx tsx tests/index.test.ts","prepublishOnly":"npm test"},"_npmUser":{"name":"djhaskin987","email":"djhaskin987@gmail.com"},"repository":{"url":"git+https://github.com/djha-skin/pi-top-of-mind.git","type":"git"},"_npmVersion":"10.9.7","description":"A pi.dev extension that injects persistent instructions into the agent's working memory every turn — inspired by goose's Top of Mind feature.","directories":{},"_nodeVersion":"22.22.2","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.0.0","typescript":"^5.7.0","@types/node":"^22.0.0"},"peerDependencies":{"typebox":"*","@earendil-works/pi-coding-agent":"*"},"_npmOperationalInternal":{"tmp":"tmp/pi-top-of-mind_0.3.0_1785785735010_0.6210111379906693","host":"s3://npm-registry-packages-npm-production"}},"0.4.0":{"name":"@djhaskin987/pi-top-of-mind","version":"0.4.0","description":"A pi.dev extension that injects persistent instructions into the agent's working memory every turn — inspired by goose's Top of Mind feature.","keywords":["pi-package","pi-extension","top-of-mind","persistent-instructions"],"license":"MIT","author":{"name":"djha-skin"},"repository":{"type":"git","url":"git+https://github.com/djha-skin/pi-top-of-mind.git"},"bugs":{"url":"https://github.com/djha-skin/pi-top-of-mind/issues"},"homepage":"https://github.com/djha-skin/pi-top-of-mind#readme","type":"module","main":"extensions/index.ts","pi":{"extensions":["./extensions/index.ts"]},"peerDependencies":{"@earendil-works/pi-coding-agent":"*","typebox":"*"},"devDependencies":{"@types/node":"^22.0.0","tsx":"^4.0.0","typescript":"^5.7.0"},"publishConfig":{"access":"public"},"scripts":{"test":"npx tsx tests/index.test.ts","prepublishOnly":"npm test"},"_id":"@djhaskin987/pi-top-of-mind@0.4.0","gitHead":"b6b6d350ca447f7e577621a39c996d12becfc665","_nodeVersion":"22.22.2","_npmVersion":"10.9.7","dist":{"integrity":"sha512-TkGCEa7qo0Gdvo2zugAn/bt2q7bLkSYvV5Yp/gnRKD56YPGbWHYNHuw3FunKGVpG6ygn7/FnyjAD00gXGwzakw==","shasum":"4ba8100a5a7a58aa09f3255e8ed25c7c8a158170","tarball":"https://registry.npmjs.org/@djhaskin987/pi-top-of-mind/-/pi-top-of-mind-0.4.0.tgz","fileCount":5,"unpackedSize":20950,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCICKOFk/RJu8TcTXv2PXfj395tr8babDulMRrEhzH2RvdAiEAzn5WgmmVUkVyDCx2ZO4cWMkCiYXdXjFm3dbmLcOlKtA="}]},"_npmUser":{"name":"djhaskin987","email":"djhaskin987@gmail.com"},"directories":{},"maintainers":[{"name":"djhaskin987","email":"djhaskin987@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/pi-top-of-mind_0.4.0_1785786637957_0.8319088351325377"},"_hasShrinkwrap":false}},"time":{"created":"2026-08-03T19:18:59.101Z","modified":"2026-08-03T19:50:38.355Z","0.2.0":"2026-08-03T19:18:59.399Z","0.3.0":"2026-08-03T19:35:35.157Z","0.4.0":"2026-08-03T19:50:38.104Z"},"bugs":{"url":"https://github.com/djha-skin/pi-top-of-mind/issues"},"author":{"name":"djha-skin"},"license":"MIT","homepage":"https://github.com/djha-skin/pi-top-of-mind#readme","keywords":["pi-package","pi-extension","top-of-mind","persistent-instructions"],"repository":{"type":"git","url":"git+https://github.com/djha-skin/pi-top-of-mind.git"},"description":"A pi.dev extension that injects persistent instructions into the agent's working memory every turn — inspired by goose's Top of Mind feature.","maintainers":[{"name":"djhaskin987","email":"djhaskin987@gmail.com"}],"readme":"# pi-top-of-mind\n\nA [pi.dev](https://pi.dev) extension that injects persistent instructions into the agent's working memory every turn — inspired by goose's **Top of Mind** feature.\n\n## Features\n\n- **Persistent context**: Inject critical instructions, security guardrails, or project context into every LLM turn\n- **Per-project configuration**: Configure via `.pi/extensions/top-of-mind.json` — share with your team\n- **Global configuration**: Set defaults in `~/.pi/extensions/top-of-mind.json` — applies across all projects\n- **Environment variable overrides**: Use `PI_TOP_OF_MIND_PROMPT`, `PI_TOP_OF_MIND_FILE`, `PI_TOP_OF_MIND_ENABLED`, and `PI_TOP_OF_MIND_FREQUENCY` — highest priority\n- **Configurable frequency**: Control how often instructions are re-injected (every turn, every 3 turns, etc.)\n- **Commands**: Set prompt text or file content at runtime with `/top-of-mind:prompt` and `/top-of-mind:file`\n- **Toggle**: Temporarily enable/disable with `/top-of-mind:start` and `/top-of-mind:stop`\n- **Status**: Check current state with `/top-of-mind:status`\n\n## Installation\n\n```bash\npi install npm:@djhaskin987/pi-top-of-mind\n```\n\nOr for a quick test:\n\n```bash\npi -e npm:@djhaskin987/pi-top-of-mind\n```\n\n## Usage\n\n### Commands\n\n| Command | Description |\n|---------|-------------|\n| `/top-of-mind:prompt <text>` | Set persistent prompt text. Shows current prompt with no args. |\n| `/top-of-mind:file <path>` | Set a file whose contents are injected. Supports absolute, relative, and `~/` paths. |\n| `/top-of-mind:start` | Enable injection (if prompt or file is configured). |\n| `/top-of-mind:stop` | Disable injection. |\n| `/top-of-mind:frequency <n>` | Set injection frequency (turns between injections). Shows current with no args. |\n| `/top-of-mind:status` | Show current configuration and whether injection is active. |\n\n### Configuration\n\nConfiguration is loaded with the following priority (highest to lowest):\n\n1. **Environment variables** — always win\n2. **Project config** — `.pi/extensions/top-of-mind.json`\n3. **Global config** — `~/.pi/extensions/top-of-mind.json`\n4. **Defaults** — built-in\n\n#### Environment Variables\n\n| Variable | Type | Description |\n|----------|------|-------------|\n| `PI_TOP_OF_MIND_PROMPT` | string | Literal prompt text to inject |\n| `PI_TOP_OF_MIND_FILE` | string | Path to a file whose contents are injected |\n| `PI_TOP_OF_MIND_ENABLED` | boolean (`true`/`false`/`1`/`0`) | Whether injection is active |\n| `PI_TOP_OF_MIND_FREQUENCY` | number | How many turns between injections |\n\n#### Project Config File (`.pi/extensions/top-of-mind.json`)\n\nCreate a `.pi/extensions/top-of-mind.json` in your project root:\n\n```json\n{\n  \"text\": \"SECURITY: Never upload code to external services.\",\n  \"file\": \".rules/security.md\",\n  \"enabled\": true,\n  \"frequency\": 1\n}\n```\n\n| Field | Type | Default | Description |\n|-------|------|---------|-------------|\n| `text` | string\\|null | `null` | Literal prompt text to inject. `null` means not set. |\n| `file` | string\\|null | `null` | Path to a file whose contents are injected. `null` means not set. |\n| `enabled` | boolean | `false` | Whether injection is active. Automatically set to `true` when a prompt or file is configured via commands. |\n| `frequency` | number | `1` | How many turns between injections (1 = every turn). Clamped to minimum 1. |\n\nWhen both `text` and `file` are set, their contents are concatenated with a blank line. Empty strings are automatically converted to `null` when saving.\n\n#### Global Config File (`~/.pi/extensions/top-of-mind.json`)\n\nSame format as the project config. Use this to set defaults that apply across all your projects. Project-level config values override global ones.\n\n> **Note:** Top of mind is **disabled by default**. It becomes active only after you set a prompt or file via the commands (which automatically enables it). If you manually edit the config JSON, set `\"enabled\": true` explicitly.\n\n## How It Works\n\nOn each LLM turn (configurable), the extension injects a custom message containing your top-of-mind instructions into the session context. This keeps critical instructions in the model's immediate attention window.\n\nThe extension hooks into pi.dev's `turn_end` event and uses `pi.sendMessage()` to queue the injection before the next LLM call.\n\n## Development\n\n```bash\n# Install dependencies\nnpm install\n\n# Run tests\nnpm test\n```\n\n## License\n\nMIT","readmeFilename":"README.md"}