{"_id":"@capybearista/opencode-agent-prompt-inheritance","_rev":"2-ee3dc24b93df1d1e30efeb071bd60bb7","name":"@capybearista/opencode-agent-prompt-inheritance","dist-tags":{"latest":"1.0.0"},"versions":{"0.0.0":{"name":"@capybearista/opencode-agent-prompt-inheritance","version":"0.0.0","author":{"name":"capyBearista","email":"capybearista@github.com"},"license":"MPL-2.0","_id":"@capybearista/opencode-agent-prompt-inheritance@0.0.0","maintainers":[{"name":"capybearista","email":"capybearista@gmail.com"}],"homepage":"https://github.com/capyBearista/opencode-plugins#readme","bugs":{"url":"https://github.com/capyBearista/opencode-plugins/issues"},"dist":{"shasum":"2f0ffb78719b5b8e3d5634655783ffc89902610d","tarball":"https://registry.npmjs.org/@capybearista/opencode-agent-prompt-inheritance/-/opencode-agent-prompt-inheritance-0.0.0.tgz","fileCount":24,"integrity":"sha512-ndCb3viBRFl9vuFn8TQmHyVxzpB04w0z1L8rz9zWefeukiOOcpzG95KkwsTEuhWEspm1lSkHpntj72+OLQOgtw==","signatures":[{"sig":"MEUCIEcnjXmwyuOjqxBxmDvR2mkPfBwRx1SenKWSlVX7aBS8AiEAwF6QrcCFKVYx13K054yJ7Juo1CZ0YSrXfJ/YM0SdlPc=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":108437},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.js"}},"gitHead":"cf2e89dc7fd5dbb5a20d6eb51543993a7e3a5e3e","scripts":{"ci":"bunx @biomejs/biome ci .","lint":"bunx @biomejs/biome check .","test":"bun test","build":"rm -rf dist && tsc && mkdir -p dist/prompt && cp src/prompt/*.txt dist/prompt/","check":"bunx @biomejs/biome check --write .","typecheck":"tsc --noEmit","sync:prompts":"bun scripts/sync-upstream-prompts.ts"},"_npmUser":{"name":"capybearista","email":"capybearista@gmail.com"},"repository":{"url":"git+https://github.com/capyBearista/opencode-plugins.git","type":"git","directory":"packages/opencode-agent-prompt-inheritance"},"_npmVersion":"11.13.0","description":"Preserve OpenCode provider system prompts when custom agents add their own instructions","directories":{},"_nodeVersion":"22.18.0","_hasShrinkwrap":false,"devDependencies":{"@opencode-ai/plugin":">=1.14.0"},"peerDependencies":{"@opencode-ai/plugin":">=1.14.0"},"_npmOperationalInternal":{"tmp":"tmp/opencode-agent-prompt-inheritance_0.0.0_1778981083615_0.8322204661279755","host":"s3://npm-registry-packages-npm-production"}},"1.0.0":{"name":"@capybearista/opencode-agent-prompt-inheritance","version":"1.0.0","description":"Preserve OpenCode provider system prompts when custom agents add their own instructions","author":{"name":"capyBearista","email":"capybearista@github.com"},"repository":{"type":"git","url":"git+https://github.com/capyBearista/opencode-plugins.git","directory":"packages/opencode-agent-prompt-inheritance"},"type":"module","license":"MPL-2.0","main":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.js"}},"scripts":{"build":"rm -rf dist && tsc && mkdir -p dist/prompt && cp src/prompt/*.txt dist/prompt/","typecheck":"tsc --noEmit","lint":"bunx @biomejs/biome check .","check":"bunx @biomejs/biome check --write .","ci":"bunx @biomejs/biome ci .","test":"bun test","sync:prompts":"bun scripts/sync-upstream-prompts.ts"},"peerDependencies":{"@opencode-ai/plugin":">=1.14.0"},"devDependencies":{"@opencode-ai/plugin":">=1.14.0"},"gitHead":"33a5b366b0e233dcaef7996b734e679f98e73446","_id":"@capybearista/opencode-agent-prompt-inheritance@1.0.0","bugs":{"url":"https://github.com/capyBearista/opencode-plugins/issues"},"homepage":"https://github.com/capyBearista/opencode-plugins#readme","_nodeVersion":"24.15.0","_npmVersion":"11.12.1","dist":{"integrity":"sha512-GnCer1FBrxzWfb0IgTEzfAT+mACVJJVUw1FH+zEsgudSskd7OJ4Nyj4HBH8vUBufy85YhoxsJwnKBJ2Z2ZoSnw==","shasum":"b0cf5abcd95a140c10adf72dfe82af4b80de33cc","tarball":"https://registry.npmjs.org/@capybearista/opencode-agent-prompt-inheritance/-/opencode-agent-prompt-inheritance-1.0.0.tgz","fileCount":24,"unpackedSize":108437,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@capybearista%2fopencode-agent-prompt-inheritance@1.0.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDnObLIPS1AxMDRSklIORB1MOefee/kR5YPL1AABQ7gHAIgJW7gqyKGl2j/aBPrEvv022noKzAmKIu9PZceQazWTII="}]},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:2de631b4-d717-4ec5-bf93-877d0fed5047"}},"directories":{},"maintainers":[{"name":"capybearista","email":"capybearista@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/opencode-agent-prompt-inheritance_1.0.0_1778981515908_0.5671171733186744"},"_hasShrinkwrap":false}},"time":{"created":"2026-05-17T01:24:43.484Z","modified":"2026-05-17T01:31:56.345Z","0.0.0":"2026-05-17T01:24:43.755Z","1.0.0":"2026-05-17T01:31:56.073Z"},"bugs":{"url":"https://github.com/capyBearista/opencode-plugins/issues"},"author":{"name":"capyBearista","email":"capybearista@github.com"},"license":"MPL-2.0","homepage":"https://github.com/capyBearista/opencode-plugins#readme","repository":{"type":"git","url":"git+https://github.com/capyBearista/opencode-plugins.git","directory":"packages/opencode-agent-prompt-inheritance"},"description":"Preserve OpenCode provider system prompts when custom agents add their own instructions","maintainers":[{"name":"capybearista","email":"capybearista@gmail.com"}],"readme":"# opencode-agent-prompt-inheritance\n\n<p align=\"center\">Keep model rules when custom agents add guidance</p>\n<p align=\"center\">\n  <a href=\"https://www.npmjs.com/package/@capybearista/opencode-agent-prompt-inheritance\"><img alt=\"npm\" src=\"https://img.shields.io/npm/v/@capybearista/opencode-agent-prompt-inheritance?style=flat-square&color=8d60e6\" /></a>\n  <a href=\"https://www.npmjs.com/package/@capybearista/opencode-agent-prompt-inheritance\"><img alt=\"npm\" src=\"https://img.shields.io/npm/dm/@capybearista/opencode-agent-prompt-inheritance?style=flat-square&color=6067e6\" /></a>\n  <a href=\"https://opencode.ai\"><img alt=\"opencode\" src=\"https://img.shields.io/badge/OpenCode-Plugin-orange?style=flat-square&color=60a5e6\" /></a>\n  <a href=\"https://opensource.org/licenses/MPL-2.0\"><img alt=\"license\" src=\"https://img.shields.io/badge/License-MPL--2.0-blue.svg?style=flat-square&color=60dfe6\" /></a>\n</p>\n\n---\n\n## Why?\n\n> Custom agents are useful, but they should add task-specific guidance without throwing away the model-family rules OpenCode already provides. This plugin restores that inheritance so reviewer or specialist agents can keep the base prompt and still steer behavior.\n\n## Philosophy: Extending OpenCode\n\nThis plugin stays narrow: it only touches `experimental.chat.system.transform`, resolves the active agent from the current session, and stitches the active provider prompt back in when inheritance is enabled. It does not change OpenCode core or add new commands.\n\n### Architecture\n\n```text\nsrc/\n├── index.ts            # Hook entry point\n├── inheritance.ts      # Inheritance flag parsing + prompt stitching\n├── provider-prompt.ts  # Model-family prompt selection\n└── prompt/             # Vendored upstream prompt assets (.txt)\n```\n\n## Features\n\n- Reads custom agent frontmatter from the active session\n- Supports `inherit-base-prompt` and `inheritBasePrompt`\n- Accepts `false`, `true`, `prepend`, and `append`\n- Treats `true` as `prepend`\n- Keeps other system prompt parts intact\n- Uses vendored upstream prompt files to mirror OpenCode provider behavior\n- Supports optional env-gated JSONL prompt capture for debugging\n\n## Supported Model Families\n\nThe plugin selects the appropriate base prompt based on the model ID. All checks are case-insensitive.\n\n| Model ID pattern | Prompt used |\n| --- | --- |\n| `gpt-4*`, `o1*`, `o3*` | Beast prompt |\n| `*codex*` | Codex prompt |\n| `*copilot*` | Copilot GPT-5 prompt |\n| `*gpt*` | GPT prompt |\n| `*gemini-*` | Gemini prompt |\n| `*claude*` | Anthropic prompt |\n| `*trinity*` | Trinity prompt |\n| `*kimi*` | Kimi prompt |\n| (anything else) | Default prompt |\n\n## Install\n\nAdd the plugin to `opencode.json` or `opencode.jsonc`:\n\n```json\n{\n  \"plugin\": [\"@capybearista/opencode-agent-prompt-inheritance\"]\n}\n```\n\nYou can also install it through the CLI:\n\n```bash\nopencode plugin -g @capybearista/opencode-agent-prompt-inheritance\nopencode plugin @capybearista/opencode-agent-prompt-inheritance\n```\n\n## Updating\n\nClear the cached package before restarting OpenCode:\n\n```bash\nrm -rf ~/.cache/opencode/packages/'opencode-agent-prompt-inheritance@latest'/\n```\n\n## Usage\n\nCreate an agent file with inheritance enabled:\n\n```md\n---\nname: reviewer\nmode: subagent\ninherit-base-prompt: prepend\n---\n\nReview code for correctness, risk, and missing tests.\n```\n\n`prepend` and `true` both place the provider prompt before the current system prompt. `append` places it after.\n\n## Configuration\n\n| Frontmatter key | Type | Meaning |\n| --- | --- | --- |\n| `inherit-base-prompt` | `false \\| true \\| prepend \\| append` | Controls provider prompt inheritance |\n| `inheritBasePrompt` | `false \\| true \\| prepend \\| append` | CamelCase alias for the same setting |\n\n## Debug Capture\n\nIf you want to inspect the transformed `system` prompt after this plugin runs, set:\n\n```bash\nexport OPENCODE_AGENT_PROMPT_INHERITANCE_CAPTURE_FILE=/tmp/opencode-agent-prompt-inheritance.jsonl\n```\n\nWhen this variable is set, the plugin appends one JSON line per transformed session containing:\n\n- `timestamp`\n- `sessionID`\n- `agentName`\n- `modelID`\n- `mode`\n- `inherited`\n- `system`\n\nIf the variable is unset, no capture file is written.\n\n## Troubleshooting\n\n- If nothing changes, confirm the active agent has one of the inheritance keys and the value is valid.\n- If the active agent cannot be resolved, the hook leaves the system prompt untouched.\n- Prompt updates are synced from upstream OpenCode (`anomalyco/opencode`) via the `Sync OpenCode Prompts` workflow and opened as PRs.\n- If you are using debug capture, remember that `.jsonl` files are local artifacts and are ignored by git.\n\n## License\n\n[MPL-2.0](./LICENSE.txt)\n","readmeFilename":"README.md"}