opencode-hindsight-lite
v0.1.1
Published
Minimal OpenCode plugin: auto-retain every N turns + LLM-generated reflect context on new sessions, via Hindsight.
Readme
opencode-hindsight-lite
Minimal OpenCode plugin for Hindsight memory. Does exactly two things:
- Auto-retain — every
minTurnsuser turns, saves the session transcript to Hindsight. - Auto-reflect — once per new session, asks Hindsight to generate an LLM-synthesized context summary and injects it into the system prompt.
No windowing, no compaction hooks, no custom tools — just retain + reflect. Use the full plugin if you need recall tools, tags, mental models, etc.
Install
// opencode.json
{
"plugin": [["opencode-hindsight-lite", {
"apiUrl": "https://your-hindsight-api.example.com",
"bankId": "my-project",
"autoRetain": true,
"autoReflect": true,
"minTurns": 3,
"debug": false
}]]
}All options can also be set via env vars instead:
| Option | Env var | Default |
|----------------|---------------------------|--------------------------|
| apiUrl | HINDSIGHT_API_URL | http://localhost:8000 |
| bankId | HINDSIGHT_BANK_ID | current directory name |
| autoRetain | HINDSIGHT_AUTO_RETAIN | true |
| autoReflect | HINDSIGHT_AUTO_REFLECT | true |
| minTurns | HINDSIGHT_MIN_TURNS | 3 |
| debug | HINDSIGHT_DEBUG | false |
Logging
Logs go through OpenCode's server log stream (--print-logs) under the hindsight-lite service, falling back to console.error if unavailable. info/warn/error are always emitted (init, auto-retain, auto-reflect, failures); debug only when debug: true.
Develop
npm install
npm run build
npm test