{"_id":"@amadshobi/oh-my-hook","_rev":"5-132a427f37b275b0094e2fe2a9c1b214","name":"@amadshobi/oh-my-hook","dist-tags":{"latest":"0.9.1"},"versions":{"0.8.0":{"name":"@amadshobi/oh-my-hook","version":"0.8.0","keywords":["opencode","opencode-plugin","ai-agent","coding-agent","agent-framework","guardrails","developer-tools","workflow-automation","context-management","hooks"],"license":"MIT","_id":"@amadshobi/oh-my-hook@0.8.0","maintainers":[{"name":"amadshobi","email":"shobiahmad16@gmail.com"}],"homepage":"https://github.com/amadshobi/oh-my-hook#readme","bugs":{"url":"https://github.com/amadshobi/oh-my-hook/issues"},"dist":{"shasum":"afe5db8c77078c4aecfca17a5efbfad32effe457","tarball":"https://registry.npmjs.org/@amadshobi/oh-my-hook/-/oh-my-hook-0.8.0.tgz","fileCount":87,"integrity":"sha512-Zhg247hf1rOXXjSkLDCbA+Ei39IDewT6UAX4IuDG9Tnd6jMRbBW0tlHvy41rdypqBhMOLuWTLG9KLOZmtsRzsQ==","signatures":[{"sig":"MEYCIQDHT3kmGxe4Nh4kBYF+LT4wjVtfHx8iUFbVDNr+hnsG2wIhAMTDW/KcxWeAhTe/4wzNXmky26wa9lvytOEJGjMWc05S","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@amadshobi%2foh-my-hook@0.8.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":490302},"main":"index.js","type":"module","engines":{"node":">=18.0.0"},"exports":{".":"./index.js","./tui":"./tui/dist/tui.js","./server":"./index.js"},"gitHead":"bb10ab77228f8037b22a414176466a78227154e3","scripts":{"test":"node --test tests/*.test.js","verify":"bash scripts/verify-all.sh","prepare":"git config core.hooksPath .githooks || true","test:all":"npm test && npm run test:e2e:hooks","test:e2e":"npm run test:e2e:hooks && npm run test:e2e:read-guard","build:tui":"node tui/scripts/build.mjs","test:e2e:mode":"node tests/e2e/mode-intent.hook.e2e.js","test:e2e:hooks":"node tests/e2e/stale-write.hook.e2e.js && node tests/e2e/read-guard-session.hook.e2e.js && node tests/e2e/mode-intent.hook.e2e.js && node tests/e2e/security.hook.e2e.js && node tests/e2e/plans-commands.hook.e2e.js && node tests/e2e/compress.hook.e2e.js && node tests/e2e/memory.hook.e2e.js","test:e2e:plans":"node tests/e2e/plans-commands.hook.e2e.js","test:e2e:compress":"node tests/e2e/compress.hook.e2e.js","test:e2e:security":"node tests/e2e/security.hook.e2e.js","test:e2e:read-guard":"node tests/e2e/read-guard.e2e.js","test:e2e:stale-write":"node tests/e2e/stale-write.hook.e2e.js"},"_npmUser":{"name":"amadshobi","email":"shobiahmad16@gmail.com"},"oc-plugin":["server","tui"],"repository":{"url":"git+https://github.com/amadshobi/oh-my-hook.git","type":"git"},"_npmVersion":"10.8.2","description":"The ultimate power-tools, guardrails, and runtime enhancement suite for OpenCode coding agents.","directories":{},"_nodeVersion":"20.20.2","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/oh-my-hook_0.8.0_1788494942553_0.19486526636292534","host":"s3://npm-registry-packages-npm-production"}},"0.8.1":{"name":"@amadshobi/oh-my-hook","version":"0.8.1","keywords":["opencode","opencode-plugin","ai-agent","coding-agent","agent-framework","guardrails","developer-tools","workflow-automation","context-management","hooks"],"license":"MIT","_id":"@amadshobi/oh-my-hook@0.8.1","maintainers":[{"name":"amadshobi","email":"shobiahmad16@gmail.com"}],"homepage":"https://github.com/amadshobi/oh-my-hook#readme","bugs":{"url":"https://github.com/amadshobi/oh-my-hook/issues"},"dist":{"shasum":"d8464580c4c657679895030bac6e3bdde9ed6e9d","tarball":"https://registry.npmjs.org/@amadshobi/oh-my-hook/-/oh-my-hook-0.8.1.tgz","fileCount":87,"integrity":"sha512-Khi279+SW/cge1tZqa+eqNsVKR6itO67mINxP3QO68cZOI5w7lqSOerixZnKo9d/6TZcvU/JbxjrVSxjedf6mg==","signatures":[{"sig":"MEUCIQCFBya1SbxVNQeCRsOZXkvizIpdZRS+wX79+sqLxk9ynwIgTZZURZTZCwK0dMH0NI+YbXs3ULURY4jwdr1B9nTpitM=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"sig":"MEQCIF/hhhFaFLzcKPIFx+s+lqitzzn/w5+J5yFEaQS6ZEpeAiBRM2hN51u4GIDXK6u7HcnGDxGTRsEtab9COkeuq70PZA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@amadshobi%2foh-my-hook@0.8.1","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":493781},"main":"index.js","type":"module","engines":{"node":">=18.0.0"},"exports":{".":"./index.js","./tui":"./tui/dist/tui.js","./server":"./index.js"},"gitHead":"1eb3153320b11d0a837ae0677e6f07dfc47e58c2","scripts":{"test":"node --test tests/*.test.js","verify":"bash scripts/verify-all.sh","prepare":"git config core.hooksPath .githooks || true","test:all":"npm test && npm run test:e2e:hooks","test:e2e":"npm run test:e2e:hooks && npm run test:e2e:read-guard","build:tui":"node tui/scripts/build.mjs","test:e2e:mode":"node tests/e2e/mode-intent.hook.e2e.js","test:e2e:hooks":"node tests/e2e/stale-write.hook.e2e.js && node tests/e2e/read-guard-session.hook.e2e.js && node tests/e2e/mode-intent.hook.e2e.js && node tests/e2e/security.hook.e2e.js && node tests/e2e/plans-commands.hook.e2e.js && node tests/e2e/compress.hook.e2e.js && node tests/e2e/memory.hook.e2e.js","test:e2e:plans":"node tests/e2e/plans-commands.hook.e2e.js","test:e2e:compress":"node tests/e2e/compress.hook.e2e.js","test:e2e:security":"node tests/e2e/security.hook.e2e.js","test:e2e:read-guard":"node tests/e2e/read-guard.e2e.js","test:e2e:stale-write":"node tests/e2e/stale-write.hook.e2e.js"},"_npmUser":{"name":"amadshobi","email":"shobiahmad16@gmail.com"},"oc-plugin":["server","tui"],"repository":{"url":"git+https://github.com/amadshobi/oh-my-hook.git","type":"git"},"_npmVersion":"10.8.2","description":"The ultimate power-tools, guardrails, and runtime enhancement suite for OpenCode coding agents.","directories":{},"_nodeVersion":"20.20.2","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/oh-my-hook_0.8.1_1788842486913_0.4329409017179833","host":"s3://npm-registry-packages-npm-production"}},"0.8.2":{"name":"@amadshobi/oh-my-hook","version":"0.8.2","keywords":["opencode","opencode-plugin","ai-agent","coding-agent","agent-framework","guardrails","developer-tools","workflow-automation","context-management","hooks"],"license":"MIT","_id":"@amadshobi/oh-my-hook@0.8.2","maintainers":[{"name":"amadshobi","email":"shobiahmad16@gmail.com"}],"homepage":"https://github.com/amadshobi/oh-my-hook#readme","bugs":{"url":"https://github.com/amadshobi/oh-my-hook/issues"},"dist":{"shasum":"88877718477084c5247f1cea95ab4a8af27a8b0f","tarball":"https://registry.npmjs.org/@amadshobi/oh-my-hook/-/oh-my-hook-0.8.2.tgz","fileCount":87,"integrity":"sha512-FIUAD/yuh0L8/GWIVLiTzPbuOewMNu18r7zjbIZV1QjUeDXaRZaGw6fIOpyYzc/s8uAb7w4FpMTZkeKNUIeXpg==","signatures":[{"sig":"MEUCIQD6uq8n7/u1lQx1P9ikvGoTMWK+NeCkjozs/YExUsAwMAIgOg5Nl0SAAvP6jGIC3A+08o0xujIMBmwjattpaO7MrhA=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"sig":"MEUCIQDz9Zn/0CrkvpfihNtmXMBMW7PaZIqYeU0i9mZQjT2dsgIgEkc3diz3unxhQ/o8hSxuwPnQQZ715uU/irLjmIc4G7o=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@amadshobi%2foh-my-hook@0.8.2","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":494840},"main":"index.js","type":"module","engines":{"node":">=18.0.0"},"exports":{".":"./index.js","./tui":"./tui/dist/tui.js","./server":"./index.js"},"gitHead":"67b09abbeb0c2a72fee06c27fa1ae63e88b121df","scripts":{"test":"node --test tests/*.test.js","verify":"bash scripts/verify-all.sh","prepare":"git config core.hooksPath .githooks || true","test:all":"npm test && npm run test:e2e:hooks","test:e2e":"npm run test:e2e:hooks && npm run test:e2e:read-guard","build:tui":"node tui/scripts/build.mjs","test:e2e:mode":"node tests/e2e/mode-intent.hook.e2e.js","test:e2e:hooks":"node tests/e2e/stale-write.hook.e2e.js && node tests/e2e/read-guard-session.hook.e2e.js && node tests/e2e/mode-intent.hook.e2e.js && node tests/e2e/security.hook.e2e.js && node tests/e2e/plans-commands.hook.e2e.js && node tests/e2e/compress.hook.e2e.js && node tests/e2e/memory.hook.e2e.js","test:e2e:plans":"node tests/e2e/plans-commands.hook.e2e.js","test:e2e:compress":"node tests/e2e/compress.hook.e2e.js","test:e2e:security":"node tests/e2e/security.hook.e2e.js","test:e2e:read-guard":"node tests/e2e/read-guard.e2e.js","test:e2e:stale-write":"node tests/e2e/stale-write.hook.e2e.js"},"_npmUser":{"name":"amadshobi","email":"shobiahmad16@gmail.com"},"oc-plugin":["server","tui"],"repository":{"url":"git+https://github.com/amadshobi/oh-my-hook.git","type":"git"},"_npmVersion":"10.8.2","description":"The ultimate power-tools, guardrails, and runtime enhancement suite for OpenCode coding agents.","directories":{},"_nodeVersion":"20.20.2","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/oh-my-hook_0.8.2_1788855392523_0.22971019742556664","host":"s3://npm-registry-packages-npm-production"}},"0.9.0":{"name":"@amadshobi/oh-my-hook","version":"0.9.0","keywords":["opencode","opencode-plugin","ai-agent","coding-agent","agent-framework","guardrails","developer-tools","workflow-automation","context-management","hooks"],"license":"MIT","_id":"@amadshobi/oh-my-hook@0.9.0","maintainers":[{"name":"amadshobi","email":"shobiahmad16@gmail.com"}],"homepage":"https://github.com/amadshobi/oh-my-hook#readme","bugs":{"url":"https://github.com/amadshobi/oh-my-hook/issues"},"dist":{"shasum":"97b69ee244caa7285b59a796804ac9d833d0cfc3","tarball":"https://registry.npmjs.org/@amadshobi/oh-my-hook/-/oh-my-hook-0.9.0.tgz","fileCount":91,"integrity":"sha512-wPpIrixWzteQpUY6tu3j7fKspk38CPyrp1PsvoQ9nh3/3nJU/cWXBJlHtieo5mYwrzdJkQPciwfYBbqs+Qir5A==","signatures":[{"sig":"MEQCIAcO6qVHtgOV72p2CAg++hNdTMytzcmo7cDpx6MQ1Lg5AiBIX3mhlAwBQmdJZRfCEHUKh0brscHEM+SCMHG+5Fxhtw==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"sig":"MEYCIQDklrzpVbNBoO84CfuLZtmV8mxo897niitjj9wUztQFXwIhAKihjpGVQM9kMItCNenDNQnWMJXz4pcf79qKbl8sz3GC","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@amadshobi%2foh-my-hook@0.9.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":517032},"main":"index.js","type":"module","engines":{"node":">=18.0.0"},"exports":{".":"./index.js","./tui":"./tui/dist/tui.js","./server":"./index.js"},"gitHead":"addbdfbc589c6e9443e3e0946c48124a3c2ffd90","scripts":{"test":"node --test tests/*.test.js","verify":"bash scripts/verify-all.sh","prepare":"git config core.hooksPath .githooks || true","test:all":"npm test && npm run test:e2e:hooks","test:e2e":"npm run test:e2e:hooks && npm run test:e2e:read-guard","build:tui":"node tui/scripts/build.mjs","test:e2e:mode":"node tests/e2e/mode-intent.hook.e2e.js","test:e2e:hooks":"node tests/e2e/stale-write.hook.e2e.js && node tests/e2e/read-guard-session.hook.e2e.js && node tests/e2e/mode-intent.hook.e2e.js && node tests/e2e/security.hook.e2e.js && node tests/e2e/plans-commands.hook.e2e.js && node tests/e2e/compress.hook.e2e.js && node tests/e2e/memory.hook.e2e.js","test:e2e:plans":"node tests/e2e/plans-commands.hook.e2e.js","test:e2e:compress":"node tests/e2e/compress.hook.e2e.js","test:e2e:security":"node tests/e2e/security.hook.e2e.js","test:e2e:read-guard":"node tests/e2e/read-guard.e2e.js","test:e2e:stale-write":"node tests/e2e/stale-write.hook.e2e.js"},"_npmUser":{"name":"amadshobi","email":"shobiahmad16@gmail.com"},"oc-plugin":["server","tui"],"repository":{"url":"git+https://github.com/amadshobi/oh-my-hook.git","type":"git"},"_npmVersion":"10.8.2","description":"The ultimate power-tools, guardrails, and runtime enhancement suite for OpenCode coding agents.","directories":{},"_nodeVersion":"20.20.2","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/oh-my-hook_0.9.0_1788857392816_0.47564764365638523","host":"s3://npm-registry-packages-npm-production"}},"0.9.1":{"_id":"@amadshobi/oh-my-hook@0.9.1","bugs":{"url":"https://github.com/amadshobi/oh-my-hook/issues"},"dist":{"shasum":"476dbb0de86e7f7a5393458b15e8257ca73d163a","tarball":"https://registry.npmjs.org/@amadshobi/oh-my-hook/-/oh-my-hook-0.9.1.tgz","fileCount":91,"integrity":"sha512-i3tYPy5M4RZRkVmFEObT3rbGJRNDJZ7cGaBdtj8wf92egXAsylfNkq67KeT0/9pB3kaibCLTVPH5yvSSD936Cw==","signatures":[{"sig":"MEQCIBW9yrybkp7O5L6AjhpvPwTrr4ioLkm5Fkdh9BfCte0iAiBN7/2g3eyaHdRDcJPcd/FhsQqv6SaaZIx7xNbMBKuvOw==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIC4fZjKkx6ecW5gTeg5xkSmTQ72IZO6RALXB6ERPKZr6AiBqCc7+WJyRVlHqNkpND3omj6AUhgkUbZ/2g/CX/9NSJg=="}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@amadshobi%2foh-my-hook@0.9.1","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":517086},"main":"index.js","name":"@amadshobi/oh-my-hook","type":"module","engines":{"node":">=18.0.0"},"exports":{".":"./index.js","./tui":"./tui/dist/tui.js","./server":"./index.js"},"gitHead":"85c2863c322e0a6f7cb8fa0aeb419030c2b3ddfb","license":"MIT","scripts":{"test":"node --test tests/*.test.js","verify":"bash scripts/verify-all.sh","prepare":"git config core.hooksPath .githooks || true","test:all":"npm test && npm run test:e2e:hooks","test:e2e":"npm run test:e2e:hooks && npm run test:e2e:read-guard","build:tui":"node tui/scripts/build.mjs","test:e2e:mode":"node tests/e2e/mode-intent.hook.e2e.js","test:e2e:hooks":"node tests/e2e/stale-write.hook.e2e.js && node tests/e2e/read-guard-session.hook.e2e.js && node tests/e2e/mode-intent.hook.e2e.js && node tests/e2e/security.hook.e2e.js && node tests/e2e/plans-commands.hook.e2e.js && node tests/e2e/compress.hook.e2e.js && node tests/e2e/memory.hook.e2e.js","test:e2e:plans":"node tests/e2e/plans-commands.hook.e2e.js","test:e2e:compress":"node tests/e2e/compress.hook.e2e.js","test:e2e:security":"node tests/e2e/security.hook.e2e.js","test:e2e:read-guard":"node tests/e2e/read-guard.e2e.js","test:e2e:stale-write":"node tests/e2e/stale-write.hook.e2e.js"},"version":"0.9.1","_npmUser":{"name":"amadshobi","email":"shobiahmad16@gmail.com"},"homepage":"https://github.com/amadshobi/oh-my-hook#readme","keywords":["opencode","opencode-plugin","ai-agent","coding-agent","agent-framework","guardrails","developer-tools","workflow-automation","context-management","hooks"],"oc-plugin":["server","tui"],"repository":{"url":"git+https://github.com/amadshobi/oh-my-hook.git","type":"git"},"_npmVersion":"10.8.2","description":"The ultimate power-tools, guardrails, and runtime enhancement suite for OpenCode coding agents.","directories":{},"maintainers":[{"name":"amadshobi","email":"shobiahmad16@gmail.com"}],"_nodeVersion":"20.20.2","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/oh-my-hook_0.9.1_1788921687026_0.606504847975202"}}},"time":{"created":"2026-09-04T04:09:02.370Z","modified":"2026-09-09T02:41:27.532Z","0.8.0":"2026-09-04T04:09:02.684Z","0.8.1":"2026-09-08T04:41:27.027Z","0.8.2":"2026-09-08T08:16:32.603Z","0.9.0":"2026-09-08T08:49:52.924Z","0.9.1":"2026-09-09T02:41:27.157Z"},"bugs":{"url":"https://github.com/amadshobi/oh-my-hook/issues"},"license":"MIT","homepage":"https://github.com/amadshobi/oh-my-hook#readme","keywords":["opencode","opencode-plugin","ai-agent","coding-agent","agent-framework","guardrails","developer-tools","workflow-automation","context-management","hooks"],"repository":{"url":"git+https://github.com/amadshobi/oh-my-hook.git","type":"git"},"description":"The ultimate power-tools, guardrails, and runtime enhancement suite for OpenCode coding agents.","maintainers":[{"name":"amadshobi","email":"shobiahmad16@gmail.com"}],"readme":"<div align=\"center\">\n\n# 🪝 oh-my-hook\n\n**Production-grade guardrails, execution discipline, curated memory, and native TUI widgets for OpenCode agents.**\n\n<br />\n\n<a href=\"https://github.com/amadshobi/oh-my-hook/actions/workflows/ci.yml\">\n  <img src=\"https://img.shields.io/github/actions/workflow/status/amadshobi/oh-my-hook/ci.yml?branch=main&style=for-the-badge&logo=github&label=CI&color=10B981&labelColor=1F2937&logoColor=white\" alt=\"CI Status\" />\n</a>\n<img src=\"https://img.shields.io/badge/Node-%E2%89%A5%2018.0.0-22C55E?style=for-the-badge&logo=nodedotjs&logoColor=white&labelColor=1F2937\" alt=\"Node Version\" />\n<img src=\"https://img.shields.io/badge/Dependencies-Zero-3B82F6?style=for-the-badge&logo=buffer&logoColor=white&labelColor=1F2937\" alt=\"Zero Dependencies\" />\n<img src=\"https://img.shields.io/badge/License-MIT-00E5FF?style=for-the-badge&logo=open-source-initiative&logoColor=black&labelColor=1F2937\" alt=\"License MIT\" />\n<img src=\"https://img.shields.io/badge/Ecosystem-OpenCode-A855F7?style=for-the-badge&logo=target&logoColor=white&labelColor=1F2937\" alt=\"OpenCode Plugin\" />\n\n<br /><br />\n\n_Stop AI agents from hallucinating file writes, leaking credentials, executing destructive bash, or losing memory after context compaction._\n\n---\n\n[📚 Documentation Portal](docs/index.md) •\n[⚡ Key Pillars](#-key-pillars) •\n[🥊 Why oh-my-hook?](#-why-oh-my-hook) •\n[📐 Architecture Flow](#-architecture-flow) •\n[🖥️ TUI Experience](#-opencode-tui-experience) •\n[🗺️ Planning Suite](#-dual-mode-planning-suite) •\n[👁️ Multimodal Vision](#-multimodal-vision-engine-imgsee) •\n[📦 Installation](#-installation) •\n[⚙️ Configuration](#-configuration-omhjsonc) •\n[🔒 Guardrail Suite](#-guardrail-suite) •\n[🧠 Curated Memory](#-curated-memory-engine) •\n[🧪 Testing](#-testing--development)\n\n</div>\n\n---\n\n## 📚 Complete Documentation Suite\n\nComprehensive architectural deep dives, developer manuals, and per-module configuration references are available in the **[`docs/`](docs/index.md)** directory:\n\n- [**Introduction & Philosophy**](docs/intro.md) — The problem space of AI agents, core engineering pillars, and before/after comparisons.\n- [**System Architecture & Internals**](docs/architecture/index.md) — Hook lifecycle flow, [Boundary Contracts](docs/architecture/boundary-contract.md), and [TUI Reactive Runtime](docs/architecture/tui-runtime.md).\n- [**Showcase & Products**](docs/showcase/sandbox/index.md):\n  - 🛡️ **[Sandbox Safety Suite](docs/showcase/sandbox/index.md)** — [Read/Stale Guard](docs/showcase/sandbox/read-stale-guard.md), [Secret Scanner](docs/showcase/sandbox/secret-scanner.md), [Dangerous Bash Guard](docs/showcase/sandbox/dangerous-bash.md), [Commit Guard](docs/showcase/sandbox/commit-guard.md).\n  - 🗺️ **[Planning Suite](docs/showcase/plans/index.md)** — [Plan Mode Barrier](docs/showcase/plans/plan-mode.md), [Interactive Plan Reviewer](docs/showcase/plans/interactive-review.md), [Prompt Templates](docs/showcase/plans/templates.md).\n  - 🧠 **[Curated Memory](docs/showcase/memory/index.md)** — [Agent Tool](docs/showcase/memory/agent-tool.md), [AI Distillation](docs/showcase/memory/distillation.md), [TUI Inspector](docs/showcase/memory/tui-inspector.md).\n  - 🗜️ **[Context Compression](docs/showcase/compress/index.md)** — [Dynamic Pruning](docs/showcase/compress/dynamic-pruning.md), [Milestones Compaction](docs/showcase/compress/milestones.md).\n  - 📊 **[Live Quota & Tokens](docs/showcase/usage/index.md)** — [Cloud Quota Tracker](docs/showcase/usage/cloud-quota.md), [Session Token Tree](docs/showcase/usage/session-tokens.md).\n  - 👁️ **[Multimodal Vision](docs/showcase/imgsee/index.md)** — Out-of-band image analysis & OCR.\n  - 🧭 **[System Prompt Router](docs/showcase/prompts/index.md)** — Dynamic model family prompt routing.\n  - 🔌 **[Gateway Bridge](docs/showcase/gateway/index.md)** — Local daemon integration & Antigravity CCA armor.\n- ⚙️ [**Configuration Reference**](docs/config/overview.md) — Multi-file precedence and per-module settings ([Sandbox](docs/config/sandbox.md), [Plans](docs/config/plans.md), [Memory](docs/config/memory.md), [Compress](docs/config/compress.md), [Usage](docs/config/usage.md), [Imgsee](docs/config/imgsee.md), [Prompts](docs/config/prompts.md), [Gateway](docs/config/gateway.md)).\n- 🛠️ [**Developer Guides**](docs/guides/custom-hooks.md) — [Authoring Custom Hooks](docs/guides/custom-hooks.md) and [Headless Testing](docs/guides/headless-testing.md).\n- 🚨 [**Troubleshooting & Runbook**](docs/troubleshooting.md) — Common error messages, resolution workflows, and state ledger reset procedures.\n\n---\n\n## ⚡ Key Pillars\n\n- 🛡️ **Sandbox Enforcement (`sandbox/`)**: Strict pre-execution gates that reject destructive bash commands, unread file overrides, stale concurrent mutations, and credential leaks. Native `permission.ask` and `shell.env` integration.\n- 🗺️ **Dual-Mode Planning Suite (`plans/`)**: In-chat brainstorming or durable RFC file creation (`~/.opencode/plans/`) with auto-versioning, plan mode write boundaries, 3-level prompt templates, and explicit intent detection (no conversational false-positive mode locking).\n- 👁️ **Multimodal Vision Engine (`imgsee/`)**: Native visual inspection tool delegating one-shot image analysis (OCR, UI layout, diagrams, and debugging) to local vision gateways (`:4010` / `:4000`) without context poisoning or session errors.\n- 🖥️ **Native TUI Integration**: Real-time ` [plan mode]` prompt badges and collapsible sidebar metrics rendered natively in OpenCode TUI via `@opentui/solid`.\n- 🧠 **Curated Distilled Memory (`/capture`)**: Zero-noise memory engine. Only loads curated bullets into the primary agent, keeping subagent contexts clean and compaction snapshots lossless.\n- 🔁 **Autonomous Verification Loop**: Runs typechecking, linter auto-fixes, and tests immediately after edits while automatically refreshing ledger state.\n- 📦 **Zero Dependencies Core**: 100% pure Node.js ESM built-ins (`node:fs`, `node:path`, `node:child_process`). Lightweight, instant startup, zero supply-chain risk.\n- 📊 **Live Quota & Token Monitor (`usage/`)**: Deterministic `/usage` slash command (0-token LLM) showing multi-provider quota — Google Antigravity, Ollama Cloud (multi-key aggregate), OpenRouter balance — straight from `agent.db`, plus session/subagent token breakdown from `opencode.db`.\n\n---\n\n## 🥊 Why oh-my-hook?\n\n| Risk / Scenario | Raw OpenCode Agent | With `oh-my-hook` |\n| :----------------------------- | :--------------------------------------------------------------- | :---------------------------------------------------------------------------- |\n| **Overwriting Unread Files** | Model guesses structure and rewrites entire files blindly. | 🛡️ **Blocked**: `readBeforeWrite` forces `read` before `edit`/`write`. |\n| **Concurrent File Mutation** | Overwrites changes made by user or external scripts. | 🛡️ **Blocked**: `staleWrite` checks `mtime` & byte size before mutation. |\n| **Accidental Secret Leaks** | API keys, JWTs, and AWS tokens written to public code. | 🛡️ **Blocked**: `secretScanner` scans payloads with regex AST patterns. |\n| **Plan Phase Runaway** | Agent starts editing codebase while asked to brainstorm. | 🛡️ **Blocked**: `planMode` disables mutating tools until `/approve`. |\n| **Destructive Terminal Ops** | Commands like `rm -rf /`, `curl \\| sh`, or detached dev servers. | 🛡️ **Blocked**: `dangerousBash` & `devServerGuard` stop dangerous ops. |\n| **Context Loss on Compaction** | Agent forgets git state, active tasks, and project rules. | 🗜️ **Injected**: `compactionSnapshot` injects git state + todos into summary. |\n| **Session Memory Drift** | Auto-memory logs conversational spam and hallucinates. | 🧠 **Curated**: Markdown storage + AI session distillation via `/capture`. |\n\n---\n\n## 📐 Architecture Flow\n\n```\n ┌────────────────────────────────────────────────────────┐\n │ User Prompt / Slash Command │\n └───────────────────────────┬────────────────────────────┘\n │\n [Intent & Command Router]\n (/plan, /design, /approve, /mode)\n │\n ┌────────────────────────────┼────────────────────────────┐\n │ │ │\n [system.transform] [tool.execute.before] [OpenCode TUI]\n │ │ │\n • Inject Curated Memory • Read-Before-Write Guard • [plan mode] Prompt Badge\n • Session Compaction Snapshot • Stale-Write Checker • ▼ oh-my-hook Sidebar Widget\n • Agent Boundary Isolation • Secret AST Scanner • Reactive State Watcher\n • Plans Whitelist Gate\n • Dangerous Bash Barrier\n │\n [Tool Runs]\n │\n [tool.execute.after]\n │\n • Typecheck (TS/TSX)\n • Lint & Auto-fixer\n • Ledger State Sync\n```\n\n---\n\n## 🖥️ OpenCode TUI Experience\n\n`oh-my-hook` integrates directly into the OpenCode TUI surface using `@opentui/solid`:\n\n```text\n Context\n 191,368 tokens (48% used)\n\n ▼ Quota\n [OpenRouter] 22% used\n\n ┌──► ▼ oh-my-hook ● PLAN\n │ • Mode : plan (read-only)\n │ • Shields: 7 active\n │ • Memory: 3 notes\n │\n ▼ MCP\n • github Connected\n ▣ Assistant · Gemini 3.7 Flash · 9.3s\n┃\n┃\n┃\n┃ Assistant · Gemini 3.7 Flash gateway PLAN (feature-auth) /~ ◄── [PROMPT BADGE]\n╹▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀\n```\n\n1. **`session_prompt_right` Slot**: Renders a dynamic warning badge `PLAN` (alongside plan name) when the active session is in plan mode. Hides automatically during execute mode to keep your input bar clean.\n2. **`sidebar_content` Slot**: A compact collapsible widget showing active mode status (`● ACTIVE` / `● PLAN` / `● EXEC`), active shields count, and curated memory notes.\n3. **Resilient Reactive Watcher**: Debounced (50ms) directory watcher tracks session state without IPC or polling overhead.\n\n---\n\n## 🗺️ Dual-Mode Planning Suite\n\n```jsonc\n// Quick config snippet (~/.config/opencode/omh.jsonc)\n\"plans\": {\n\t\"enabled\": true,\n\t\"planMode\": true,\n\t\"autoDetectIntent\": true,\n\t\"directory\": \"~/.opencode/plans\"\n}\n```\n\n> 📖 For plan mode templates, directory overrides, and version limits, see [docs/config/plans.md](docs/config/plans.md).\n\nSeamlessly switch between quick conversational brainstorming, durable RFC file generation, and interactive terminal review:\n\n| Command | Mode | Behavior |\n| :--------------------------------- | :------------------------ | :-------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| **`/plan [topic]`** | **In-Chat (Ephemeral)** | Locks file mutations, loads `plan.md`, and brainstorms directly in the chat transcript with zero disk footprint. |\n| **`/plan to-file <name> [notes]`** | **File-Based (Durable)** | Targets `~/.opencode/plans/<name>.md`. Auto-archives previous drafts to `plans/versions/<name>-v<N>.md` and whitelists **only** the plan file for writes. |\n| **`/plan review [name]`** | **Interactive TUI Modal** | Opens the terminal-native line-by-line review modal to dispute or annotate specific lines with keyboard shortcuts. |\n| **`/plan list`** | **Listing** | Lists all stored plan and design documents in `~/.opencode/plans/`. |\n| **`/plan switch <name>`** | **Context Switch** | Switches active roadmap context to another existing plan file. |\n| **`/design [topic]`** | **In-Chat (UI/UX)** | Dedicated UI/UX design workflow loaded from `design.md`. |\n| **`/design to-file <name>`** | **File-Based (UI/UX)** | Generates structured UI/UX component specs in `~/.opencode/plans/designs/<name>.md`. |\n| **`/approve`** _(alias: `/exec`)_ | **Execution Transition** | Injects `approve.md` with active plan file reference, unlocks all project mutations, and readies the agent to build. |\n| **`/mode`** | **Status Check** | Inspect active mode and active plan file in the current session. |\n\n### ‍️ Goblin Plan Protocol & Interactive Review\n\n- **Autonomous Agent Gate**: When assigned a complex, multi-file task (≥3 files), the agent prompts for user permission (`[Yes, blin] | [Nope, proceed directly!]`) before entering Plan Mode.\n- **Explicit Intent Detection**: Plan Mode activates only via explicit triggers — slash commands (`/plan`, `/design`, `/mode plan`) or unambiguous verbal instructions (`enter plan mode`, `masuk mode plan`, `switch to plan mode`). Conversational phrases like \"bahas dulu\" or \"mikir dulu\" no longer accidentally lock the session. Disable text detection entirely with `plans.autoDetectIntent: false` for 100% slash-command-driven switching.\n- **Line-Level Reviewer**: Keyboard-navigable (`[↓]/[↑]`, `[Enter]` to correct, `[Ctrl+A]` to approve) modal directly in the OpenCode TUI interface.\n\n### 3-Level Prompt Template Precedence\n\nPrompt templates support custom overrides and dynamic macros (`{plan_file}`, `{plan_name}`, `{topic}`, `{session_id}`, `{target_dir}`):\n\n1. **Project-level**: `<workspace>/.opencode/prompts/<cmd>.md`\n2. **Global-level**: `~/.config/opencode/prompts/<cmd>.md`\n3. **Built-in default**: `plans/prompts/<cmd>.md`\n\n---\n\n## 📦 Installation & Platform Support\n\n### Supported Platforms\n\n| Platform | Support | Details |\n| :--- | :---: | :--- |\n| **Linux** (Ubuntu, Debian, Arch, Fedora) | ✅ Native | First-class citizen & primary target runtime. |\n| **macOS** (Apple Silicon / Intel) | ✅ Native | Fully compatible (POSIX compliant, verified in CI matrix). |\n| **Windows** | 🟡 via WSL2 | Native PowerShell/CMD is **not supported**. Run inside **WSL2** (Ubuntu/Debian) for seamless POSIX guardrails. |\n\n---\n\n### Method 1: Automatic Plugin Registration (Recommended via Bun / NPM)\n\nOpenCode automatically installs and resolves plugins declared in your config via its embedded Bun/npm engine. Simply declare `@amadshobi/oh-my-hook`:\n\n#### 1. Server Guardrails (`~/.config/opencode/opencode.jsonc`)\n\n```jsonc\n{\n\t\"$schema\": \"https://opencode.ai/config.json\",\n\t\"plugin\": [\n\t\t\"@amadshobi/oh-my-hook\"\n\t]\n}\n```\n\n#### 2. TUI Status Badge & Sidebar (`~/.config/opencode/tui.jsonc`)\n\n```jsonc\n{\n\t\"$schema\": \"https://opencode.ai/tui.json\",\n\t\"plugin\": [\n\t\t\"@amadshobi/oh-my-hook\"\n\t]\n}\n```\n\n---\n\n### Method 2: Local Git Clone (Development & Fast Hacking)\n\nIf you prefer installing from source or contributing locally:\n\n```bash\n# Clone the repository\ngit clone https://github.com/amadshobi/oh-my-hook.git ~/projects/oh-my-hook\n\n# Install dependencies via Bun or NPM\ncd ~/projects/oh-my-hook\nbun install   # or: npm install\n```\n\nThen register the local path in `opencode.jsonc` and `tui.jsonc`:\n\n```jsonc\n{\n\t\"plugin\": [\n\t\t\"file:///home/<user>/projects/oh-my-hook\"\n\t]\n}\n```\n\n---\n\n## ⚙️ Configuration (`omh.jsonc`)\n\n`oh-my-hook` is configured via `~/.config/opencode/omh.jsonc` (also supports `.json`, `.yaml`, or `.yml`). All settings are deep-merged on a per-section basis over built-in defaults.\n\n> 💡 **Default ON Philosophy**:\n> **Every guardrail, shield, and module is enabled (`true`) out of the box.** You do **not** need to declare properties unless you want to disable them (e.g. `\"commitGuard\": false`) or customize specific parameters (e.g. `\"maxChars\": 80`). If an empty config `{}` is provided or the file is missing, all protections remain fully active.\n\nInclude the official `$schema` header for instant validation, hover docs, and autocompletion in your editor:\n\n```jsonc\n{\n\t\"$schema\": \"https://amadshobi.github.io/oh-my-hook/schema.json\"\n\t// All protections are active by default (true).\n\t// Only declare what you want to disable or customize:\n\t// \"sandbox\": {\n\t//   \"commitGuard\": false\n\t// }\n}\n```\n\n### Module Configuration Reference\n\nEach module can be toggled and configured independently. Jump to the dedicated documentation for detailed schemas and examples:\n\n| Module | Description | Schema & Guide |\n| :--- | :--- | :--- |\n| **`sandbox`** | Pre-execution security, protected files shield, commit guard & bash barriers | [docs/config/sandbox.md](docs/config/sandbox.md) |\n| **`memory`** | Hermes-style curated memory, character budgets & background review | [docs/config/memory.md](docs/config/memory.md) |\n| **`plans`** | Dual-mode planning suite, intent detection & RFC whitelist gates | [docs/config/plans.md](docs/config/plans.md) |\n| **`compress`** | Dynamic tool-output pruning, post-push compaction & idle snapshots | [docs/config/compress.md](docs/config/compress.md) |\n| **`gateway`** | Local Gateway model discovery, thinking variants & Antigravity defense | [docs/config/gateway.md](docs/config/gateway.md) |\n| **`imgsee`** | Multimodal vision engine & ephemeral image analysis | [docs/config/imgsee.md](docs/config/imgsee.md) |\n| **`usage`** | Multi-provider live cloud quota & token consumption tracking | [docs/config/usage.md](docs/config/usage.md) |\n| **`prompts`** | Dynamic provider prompt router & custom persona overrides | [docs/config/prompts.md](docs/config/prompts.md) |\n| **`messages`** | Custom guardrail block and warning message template overrides | [docs/config/overview.md](docs/config/overview.md) |\n\n---\n\n## 🔒 Sandbox Suite\n\n```jsonc\n// Quick config snippet (~/.config/opencode/omh.jsonc)\n// All guards default to true — only declare what you want to disable or customize:\n\"sandbox\": {\n\t\"enabled\": true,\n\t\"commitGuard\": { \"maxChars\": 72 }, // customize limit\n\t\"dangerousBash\": { \"enabled\": true }\n}\n```\n\n> 📖 For full configuration options, ACL patterns, and regex tuning, see [docs/config/sandbox.md](docs/config/sandbox.md).\n\n### 1. Read-Before-Write, Stale-Write & Bash Mutation Guard\n\nForces the agent to read and understand existing files before modifying them, preserves read records across session reconnects, and intercepts bypass attempts via shell redirection (`cat >`, `echo >`, `tee`, `sed -i`):\n\n```\n🛑 BLOCKED: Read before you edit\nReason: File \"src/auth/token.js\" has not been read in this session.\nAction: Call `read` tool first. Shell bypass is forbidden.\n```\n\n### 2. Protected Sensitive Files Shield (`protectedFiles`)\n\nBlocks inspection of credential stores (`.env*`, `auth.json`, `settings.json`, `*.pem`, `id_rsa`) via native tools and terminal utilities (`cat`, `head`, `tail`, `grep`), while whitelisting schema templates (`.env.example`):\n\n```\n🛑 BLOCKED: Protected sensitive file\nReason: Direct access to \".env\" is blocked by security policy.\nAction: Inspect .env.example or ask user for non-secret schema.\n```\n\n### 3. Plan Mode Whitelist Gate\n\nWhen Plan Mode is active, all mutating tools (`edit`, `write`, `delete`, mutating `bash`) are blocked, **except** for files targeting `~/.opencode/plans/`:\n\n```\n🛑 BLOCKED: Plan Mode active\nReason: Cannot modify project code while session is in Plan Mode.\nAction: Run '/approve' or provide explicit execution trigger.\n```\n\n### 4. Secret Scanner (Tool Payloads & Terminal Commands)\n\nScans tool arguments and terminal commands against regex signatures for API keys, AWS credentials, private keys, database connection URIs, and JWTs:\n\n```\n🛑 BLOCKED: Secret detected in payload\nReason: Payload contains sensitive credentials:\n  - Line 12: GitHub Token\nAction: Remove credentials immediately. Use environment variables.\n```\n\n### 5. Conventional Commit Guard & Co-Author Attribution\n\nValidates commit messages with configurable length (`maxChars`, default 72), enforces Co-authored-by attribution trailers, blocks `--no-verify` / `-n` bypass flags, and intercepts PR merge subjects:\n\n```\n🛑 BLOCKED: Invalid commit format\nReason: Commit message issues:\n  - Subject line is 84 chars (max 72)\nAction: Use Conventional Commits: `type(scope): description`\n```\n\n### 6. Destructive Bash Command Barrier\n\nNeutralizes destructive commands before execution (`rm -rf ~`, `rm -rf .git`, `rm -rf .`, `git reset --hard`, `git clean -fdx`, block device overwrites, and fork bombs):\n\n```\n🛑 BLOCKED: Dangerous command blocked\nReason: Command \"rm -rf .git\" matches destructive wipe or system overwrite signature.\nAction: Action forbidden. Ask user for manual execution if needed.\n```\n\n### 7. Native OpenCode Integration (`permission.ask` & `shell.env`)\n\n- **`permission.ask`**: Automatically intercepts and denies risky actions at the core permission gate before modal popups appear.\n- **`shell.env`**: Injects `OMH_SANDBOX=1`, `OMH_SESSION_ID`, and `NO_COLOR=1` into all subshells.\n\n---\n\n## 🧠 Curated Memory & Agent Tool\n\n```jsonc\n// Quick config snippet (~/.config/opencode/omh.jsonc)\n\"memory\": {\n\t\"enabled\": true,\n\t\"baseURL\": \"http://127.0.0.1:4000/v1\",\n\t\"model\": \"google-antigravity/gemini-2.5-flash\",\n\t\"budgets\": { \"user\": 1500, \"global\": 2500, \"project\": 3500 },\n\t\"review\": { \"enabled\": true }\n}\n```\n\n> 📖 For character budget tuning, gateway endpoints, and review settings, see [docs/config/memory.md](docs/config/memory.md).\n\n> [!INFO]\n> **Hermes Agent Architecture Adoption**\n> The memory subsystem adopts the battle-tested multi-target layout from **Hermes Agent** (`tools/memory_tool.py`), featuring atomic batch operations, character budget boundaries, clean JSON schema overrides, and post-turn background self-improvement reviews.\n\n`oh-my-hook` features a **pure Markdown-backed, self-curating memory engine** with zero JSONL bloat and direct file storage across three distinct targets:\n\n```\n~/.config/opencode/memory/\n├── USER.md                  # User persona, communication style, developer identity\n├── MEMORY.md                # Global cross-project technical quirks & tool flags\n└── projects/\n    └── <project-slug>/\n        └── MEMORY.md        # Project-specific architecture & testing conventions\n```\n\n### Key Highlights:\n\n- **100% Pure Markdown & Flattened Tree**: Human-readable, zero-overhead storage directly editable with standard text editors. Project memories use a clean, flat slug structure (`projects/<slug>/MEMORY.md`) avoiding deep directory nesting.\n- **Fast Heuristic Gating & Anti-Redundancy**: In-process regex classifier drops casual banter before invoking background review, and bullet deduplication prevents duplicate memory accumulation.\n- **Autonomous Agent Tool (`memory`)**: Exposes a native OpenCode tool supporting single actions and **Hermes atomic batch operations** (`operations: [...]`):\n  - `add`: Saves a new memory bullet (guarded against credential leaks).\n  - `replace`: Updates existing memory via **substring matching** (`old_text`).\n  - `remove`: Deletes memory via substring matching.\n  - `list`: Inspects active memory bullets.\n  - `operations`: List of atomic mutations applied together with pre-validation rollback (zero dirty writes).\n- **Clean JSON Schema Override**: Injects an explicit schema via the `tool.definition` hook (`required: []`), resolving tool-call failures across strict schema models (Gemini, DeepSeek, Qwen, Llama).\n- **Hermes Visual Headers & Character Budgets**: Displays usage percentage counters (`[23% — 340/1,500 chars]`) in `experimental.chat.system.transform` with rejection protections when limits are reached.\n- **Hermes Background Self-Improvement Review**: Silently evaluates recent conversation turns in the background via local gateways and updates memory stores with a non-intrusive notification:\n  `💾 Self-improvement review: Memory updated`.\n- **Direct OpenAI-Compatible Gateway**: Distillation and background reviews query any OpenAI-compatible endpoint directly via native `fetch()` without CLI dependencies.\n- **Native TUI Modal Inspector**: Full keyboard-driven inspector using OpenCode's native `api.ui.DialogSelect` & `api.ui.DialogPrompt`:\n  - `Enter` → Edit / Replace text\n  - `Ctrl+A` → Add new memory\n  - `Ctrl+D` (2x) → Delete memory with red row confirmation\n  - `↓/↑ / j/k` → Scroll & fuzzy search\n\n### Interactive Slash Commands:\n\n- `/memory`: Display all active memory bullets across all targets.\n- `/memory user`: View user profile memory (`USER.md`).\n- `/memory global`: View global technical memory (`MEMORY.md`).\n- `/memory project`: View current project memory.\n- `/memory add [user|global|project] <note>`: Append note to specified target.\n- `/memory replace A -> B`: Replace note matching `A` with `B`.\n- `/memory remove <text>`: Remove note matching `text`.\n- `/memory capture`: Run AI distillation to summarize session lessons into memory bullets.\n\n---\n\n## 🧭 Dynamic System Prompt Router\n\n```jsonc\n// Quick config snippet (~/.config/opencode/omh.jsonc)\n\"prompts\": {\n\t\"enabled\": true,\n\t\"customDirectory\": \"~/.config/opencode/prompts\",\n\t\"routes\": {\n\t\t// \"kilo/tencent/hy3:free\": \"hy3.md\"\n\t}\n}\n```\n\n> 📖 For model routing rules and persona overrides, see [docs/config/prompts.md](docs/config/prompts.md).\n\nWhen using multi-provider models or local gateway proxies (like **Oh-My-Pi / OMP**), models outside OpenCode's hardcoded tier-1 list fall back to `PROMPT_DEFAULT`, leading to tool chatter and formatting mismatches.\n\n`prompts/` hooks into `experimental.chat.system.transform` to dynamically resolve and inject appropriate system prompts:\n\n- **Resolution Hierarchy**:\n 1. Explicit user routes in `omh.jsonc` (`prompts.routes`).\n 2. User custom files in `~/.config/opencode/prompts/` by **Exact Model ID** (`deepseek-v3.md`), **Family Name** (`deepseek.md`, `minimax.md`, `qwen.md`, `kimi.md`, `mistral.md`, `glm.md`), or **Provider Name** (`omp.md`).\n 3. User custom fallback: `default.md` / `default.txt` in `~/.config/opencode/prompts/`.\n 4. Built-in provider asset catalog fallback (`~/.opencode/assets/provider/`).\n- **Atomic System Transformation**: Replaces the generic base prompt with tailored guidelines while preserving 100% of session metadata (`<env>`, working directory, project `AGENTS.md`, MCP tools, and memory context).\n\n---\n\n## 🗜️ Context Compression & Dynamic Pruning Suite\n\n```jsonc\n// Quick config snippet (~/.config/opencode/omh.jsonc)\n\"compress\": {\n\t\"enabled\": true,\n\t\"pruning\": { \"enabled\": true, \"recentTurns\": 2, \"minOutputChars\": 2000 },\n\t\"milestones\": { \"pushAutoCompress\": true }\n}\n```\n\n> 📖 For advanced pruning strategies and milestone compact rules, see [docs/config/compress.md](docs/config/compress.md).\n\nLong coding sessions inevitably fill the LLM context window with bloated historical logs (`npm test`, `git commit`, `curl`, `gh`, `node`). `compress/` intelligently optimizes context usage:\n\n- **Generic Size-Based Dynamic Pruning (`experimental.chat.messages.transform`)**:\n - Automatically collapses **ANY eligible tool output** above `minOutputChars` (default 2000) into clean, deterministic markers (`── OMH-PRUNE ── X chars collapsed ──`) — no command whitelist needed.\n - **Selective Command Protection**: `commandPatterns.neverPrune` keeps critical outputs (`git diff`, `cat config`) fully intact; `commandPatterns.alwaysPrune` force-prunes noisy commands (`npm install`, `git commit`).\n - **Important Line Preservation**: Error/pass/summary lines from the middle of output are kept (`── IMPORTANT ──` block), so context survives collapse.\n - **Zero Database Modification**: Pruning operates in-memory per request turn, preserving full transcript integrity for OpenCode's undo/revert functionality.\n - **Failure Signal Protection**: Test failures and stack traces (`FAILED`, `panic:`, `Traceback`, `npm ERR!`) are **never pruned** so debugging context is never lost.\n - **Protected Window & Tools**: Last 2 conversational turns and critical tools (`read`, `write`, `edit`, `todowrite`, `grep`, `glob`) are strictly protected.\n - **Live TUI Toast**: When pruning fires, a toast notification appears in the TUI (`pruned <target>: ~X tok`) — anti-spam cooldown included.\n- **Post-Push Idle Auto-Compaction**:\n - Automatically captures git diffs and branch milestones when a successful `git push` is detected and triggers background compaction when the agent enters an idle state.\n- **Interactive Slash Commands**:\n - `/compress`: Trigger immediate session compaction with zero token overhead.\n - `/compress stats`: View live token savings, tool breakdown, and pruning metrics.\n\n---\n\n## 🔌 Local Gateway Bridge (`gateway/`)\n\n```jsonc\n// Quick config snippet (~/.config/opencode/omh.jsonc)\n\"gateway\": {\n\t\"enabled\": true\n}\n```\n\n> 📖 For port resolution and CCA sanitization details, see [docs/config/gateway.md](docs/config/gateway.md).\n\n`gateway/` acts as the native OpenCode bridge to your local AI daemon (`gn gw` on `:4010` or `:4000`), eliminating manual JSON configuration and protecting against Google CCA schema rejections.\n\n### Key Capabilities:\n\n- **Zero-Config Interactive Auth**: Connects seamlessly with `opencode auth -p local-gateway` (or TUI login).\n- **Dynamic Model Auto-Discovery**: Fetches all available upstream models from `:4010/v1/models` at runtime with offline snapshot caching.\n- **OMP Catalog Metadata Enrichment**: Enriches models with exact token pricing (`cost`), context window limits, and thinking tiers (`variants`) directly from Oh-My-Pi catalog (`models.json`).\n- **Antigravity CCA Armor**: Intercepts and normalizes tool definitions in-flight, stripping OpenAPI keywords (`$schema`, `title`, `additionalProperties`) to prevent HTTP 400 Malformed Argument errors from Google Cloud Code Assist.\n\n---\n\n## 👁️ Multimodal Vision Engine (`imgsee/`)\n\n```jsonc\n// Quick config snippet (~/.config/opencode/omh.jsonc)\n\"imgsee\": {\n\t\"enabled\": true,\n\t\"gatewayUrl\": \"http://127.0.0.1:4010/v1/chat/completions\",\n\t\"model\": \"google-antigravity/gemini-2.5-flash\",\n\t\"maxBytes\": 5242880\n}\n```\n\n> 📖 For image byte budgets and vision gateway timeouts, see [docs/config/imgsee.md](docs/config/imgsee.md).\n\nWhen coding agents need to inspect UI layouts, error screenshots, diagrams, or web pages, `imgsee/` provides out-of-band visual inspection by delegating directly to a vision-capable model (like `gemini-2.5-flash` or `gemini-3.7-flash` via local OMP gateway on `:4010` / `:4000`).\n\n### Key Capabilities:\n\n- **Zero Context-Poisoning**: Keeps primary text-only LLMs stable by executing one-shot vision analysis and returning clean, structured Markdown back to the session.\n- **Magic Bytes Sniffing**: Header sniffing support for PNG, JPEG, GIF, and WEBP with a 20 MiB safety cap.\n- **Diagnostic System Directives**: Evidence-first analysis, verbatim OCR extraction, spatial UI coordinates, and actionable root cause debugging.\n- **Dual Invocation**:\n - **Autonomous Tool (`imgsee`)**: Agents invoke `imgsee(path, question, mode)` when examining screenshots or visual artifacts.\n - **Deterministic Slash Command (`/imgsee`)**: Users can trigger `/imgsee <path> [question]` directly in chat with zero LLM overhead.\n\n---\n\n## 📊 Live Quota & Token Monitor (`usage/`)\n\n```jsonc\n// Quick config snippet (~/.config/opencode/omh.jsonc)\n\"usage\": {\n\t\"enabled\": true,\n\t\"tokens\": { \"showSubagents\": true, \"subagentsCollapsed\": true },\n\t\"quota\": {\n\t\t\"ollama\": { \"accounts\": { /* \"prefix\": \"Account Name\" */ } }\n\t}\n}\n```\n\n> 📖 For multi-key quota aggregation and custom labels, see [docs/config/usage.md](docs/config/usage.md).\n\nDeterministic `/usage` slash command (0-token LLM — output is `ignored` transcript, never read by the model):\n\n```text\n/usage → all providers\n/usage quota → all providers (alias)\n/usage ollama → Ollama Cloud only\n/usage agy → Google Antigravity only\n/usage openrouter → OpenRouter only\n/usage tokens → session token breakdown\n/usage help → list subcommands\n```\n\n- **Cloud Quota**: reads credentials read-only from `~/.omp/agent/agent.db` and fetches live limits (Antigravity weekly/5-hour, Ollama Cloud weekly with multi-key aggregation, OpenRouter balance).\n- **Ollama multi-key**: all keys fetched in parallel; weekly = `max(usage)`, requests summed. Labels from config `usage.quota.ollama.accounts` (key-prefix → name), fallback `key#<id>`.\n- **Session Tokens**: main + subagent token consumption from `~/.local/share/opencode/opencode.db` (input/output/reasoning/cache/cost).\n- **Zero-dependency**: dual-runtime SQLite adapter (`bun:sqlite` on Bun, `node:sqlite` on Node) — read-only, never touches live data.\n\n### TUI Sidebar Surfaces\n\n- **`Tokens` tree** (`sidebar_content`): collapsible accordion showing main agent + subagent token usage (input/output/reasoning/cache/cost), refreshed per session.\n- **`Last Turn` node** (inside `Tokens` tree): last completed assistant turn breakdown (input, cache, output, reasoning, duration, cost) — expanded by default for quick glance.\n\n---\n\n## 🧪 Testing & Development\n\n`oh-my-hook` includes **183 unit tests** and **7 deterministic E2E hook pipeline test suites**.\n\n```bash\n# Run unit tests\nnpm test\n\n# Run modular E2E hook pipelines\nnpm run test:e2e:hooks\n\n# Run all test suites\nnpm run test:all\n```\n\n---\n\n## 📄 License\n\nThis project is licensed under the **MIT License** — see the [LICENSE](LICENSE) file for details.\n\n<div align=\"center\">\n <sub>Built with precision for the OpenCode Agent Ecosystem.</sub>\n</div>\n","readmeFilename":"README.md"}