{"id":44504,"library":"cache-timer","title":"cache-timer: prompt-cache countdown & refresh for OpenCode","description":"A TUI plugin for OpenCode that displays a live countdown timer until the prompt-cache expires, letting you know when your cache is hot, warning, cold, or busy-cold. It provides one-click buttons to refresh the cache (keeps it hot) or fork a new session (when cache is cold), reducing costly cold-write operations. Version 1.2.0, actively maintained. Differentiators: pre-emptive cache saving, smart cost-based button logic, minimal configuration.","status":"active","version":"1.2.0","language":"javascript","source_language":"en","source_url":"https://github.com/ncejda-g2/opencode-cache-timer","tags":["javascript","opencode","opencode-plugin","cache","claude","gemini","gpt","prompt-cache","tui"],"install":[{"cmd":"npm install cache-timer","lang":"bash","label":"npm"},{"cmd":"yarn add cache-timer","lang":"bash","label":"yarn"},{"cmd":"pnpm add cache-timer","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Runtime peer dependency; plugin is a TUI extension for OpenCode.","package":"opencode","optional":true}],"imports":[{"note":"The package is ESM-only; CommonJS require will fail.","wrong":"const cacheTimerPlugin = require('cache-timer')","symbol":"default","correct":"import cacheTimerPlugin from 'cache-timer'"},{"note":"Named export available for TypeScript users; can be used as the plugin class.","wrong":"const { CacheTimerPlugin } = require('cache-timer')","symbol":"CacheTimerPlugin","correct":"import { CacheTimerPlugin } from 'cache-timer'"},{"note":"Type import for configuration object. Only needed in TypeScript.","wrong":"","symbol":"CacheTimerConfig","correct":"import type { CacheTimerConfig } from 'cache-timer'"}],"quickstart":{"code":"// file: opencode.config.js\nimport cacheTimerPlugin from 'cache-timer'\n\nexport default {\n  plugins: [\n    cacheTimerPlugin({\n      hotThreshold: 300,    // cache considered hot if >300 seconds remaining (default: 300)\n      warningThreshold: 60, // warning color when <=60 seconds (default: 60)\n      refreshMargin: 120,   // auto-refresh when <=120 seconds left (default: 0, disabled)\n      seedContext: {\n        lastMessages: 2,    // include last 2 user/assistant messages in new session (default: 1)\n        recentFiles: 5,     // include up to 5 recent read file paths (default: 3)\n      },\n      summarizeContext: false, // experimental: summarize context before forking (default: false)\n    }),\n  ],\n}","lang":"typescript","description":"Configure and enable the cache-timer plugin in an OpenCode config file, showing all options with defaults."},"warnings":[{"fix":"Update your config: replace `cacheTimerPlugin` with `cacheTimerPlugin({ ... })`.","message":"Version 1.0.0 changed the plugin interface from a plain object to a function that must be called with config.","severity":"breaking","affected_versions":"<1.0.0"},{"fix":"Ensure you're running OpenCode with TUI enabled (opencode --tui).","message":"The plugin only works with OpenCode's TUI mode; it will not function in headless or CLI-only mode.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Set refreshMargin to 0 (default) and rely on manual refresh to avoid accidental cold writes.","message":"Auto-refresh (refreshMargin) may incur costs if the cache is already cold; the plugin does not check cache status before sending a no-op prompt.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Leave summarizeContext disabled unless you have tested its impact on your workflows.","message":"The 'summarizeContext' option is experimental and may produce long summaries that negate cost savings.","severity":"gotcha","affected_versions":">=1.2.0"},{"fix":"Ensure the model from the source session is still supported before forking.","message":"Seeding a new session may fail if the source session has a model that is no longer available.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"search_vec":"'1.2.0':71 'activ':72 'base':83 'busi':40 'busy-cold':39 'button':47,84 'cach':2,6,26,33,51,61,78,93,99 'cache-tim':1 'claud':94 'click':46 'cold':37,41,63,67 'cold-writ':66 'configur':87 'cost':65,82 'cost-bas':81 'countdown':7,20 'differenti':74 'display':17 'emptiv':77 'expir':27 'fork':56 'gemini':95 'gpt':96 'hot':35,54 'javascript':88 'keep':52 'know':30 'let':28 'live':19 'logic':85 'maintain':73 'minim':86 'new':58 'one':45 'one-click':44 'opencod':10,15,89,91 'opencode-plugin':90 'oper':69 'plugin':13,92 'pre':76 'pre-empt':75 'prompt':5,25,98 'prompt-cach':4,24,97 'provid':43 'reduc':64 'refresh':8,49 'save':79 'session':59 'smart':80 'timer':3,21 'tui':12,100 'version':70 'warn':36 'write':68","created_at":"2026-06-07T12:50:28.135972+00:00","updated_at":"2026-06-07T12:50:28.135972+00:00","problems":[{"fix":"Run `npm install cache-timer --save-dev` in your OpenCode plugin directory.","cause":"Package not installed or installed in wrong location.","error":"ERR_MODULE_NOT_FOUND: Cannot find package 'cache-timer'"},{"fix":"Use `import cacheTimerPlugin from 'cache-timer'` in an ESM context.","cause":"CommonJS require() used instead of ESM import, or mismatch between package exports.","error":"TypeError: cacheTimerPlugin is not a function"},{"fix":"Start OpenCode with `opencode --tui` or without the --cli flag.","cause":"Running OpenCode without TUI (e.g., --cli flag).","error":"Plugin 'cache-timer' requires OpenCode TUI mode."}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/ncejda-g2/opencode-cache-timer#readme","github":"https://github.com/ncejda-g2/opencode-cache-timer","docs":null,"changelog":null,"pypi":null,"npm":"cache-timer","openapi_spec":null,"status_page":null,"smithery":null,"categories":["productivity"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-07","next_check":"2026-09-05","install_tag":null}}