Auto Continue
OpenCode plugin: automatically continues responses that were cut off by the model's output limit.
3
+1 in 30 days
56
4 in 7 days
36.1
Multi-signal model
1 month ago
2026-08-28
Install and configure
opencode.jsonWrites to this project's opencode.json — applies to this repository only.
opencode.json
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["@fazaboa/opencode-auto-continue@0.1.0"]
}Writes to ~/.config/opencode/opencode.json — applies to every project.
~/.config/opencode/opencode.json
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["@fazaboa/opencode-auto-continue@0.1.0"]
}If you want to modify the plugin locally, install it into the project and reference the local path.
shell
pnpm add -D @fazaboa/opencode-auto-continueOpenCode loads npm dependencies through its embedded runtime on startup and caches them locally — no manual global install needed.
OpenCode plugins for smarter AI sessions — thinking-guard (anti loop) and truncation detection.
Features
🛡️ Thinking Guard
Detects and interrupts reasoning loops using two strategies:
- Token count — aborts when output crosses the hard limit.
- Repetition detection — Jaccard similarity on bigrams catches repetitive reasoning.
When a loop is detected: aborts the step + injects "stop thinking and answer".
🔄 Truncation Detection
Detects responses cut off by the model's output limit and auto-injects a continuation prompt telling the model to pick up exactly where it left off.
Install
npm install @fazaboa/opencode-plugins
Then register it in your opencode.json:
{
"plugin": ["@fazaboa/opencode-plugins"]
}
Or drop the source file directly into .opencode/plugins/auto-continue.ts in your project:
export { default } from "../../opencode-plugins/src/index.ts"
Usage
Both features (default)
export { default } from "../../opencode-plugins/src/index.ts"
Individual features
import { createThinkingGuardPlugin } from "../../opencode-plugins/src/index.ts"
export default createThinkingGuardPlugin({
softLimit: 10_000,
hardLimit: 20_000,
})
import { createTruncationPlugin } from "../../opencode-plugins/src/index.ts"
export default createTruncationPlugin({
softLimit: 115_000,
maxAutoContinues: 3,
})
Configuration
All config lives in src/config.ts. Defaults:
thinking: {
softLimit: 10_000, // alert
hardLimit: 20_000, // abort
repetitionWindow: 4, // chunks in buffer
repetitionSimilarity: 0.6, // Jaccard threshold
repetitionConsecutive: 3, // high comparisons = loop
}
truncation: {
softLimit: 115_000, // ~88% of ~131k cap
maxAutoContinues: 3,
}
global: {
maxInterventionsPerTurn: 2,
cooldownMs: 5_000,
}
Project Structure
opencode-plugins/
├── src/
│ ├── index.ts # Entry point — registers all features
│ ├── config.ts # Centralized configuration
│ ├── features/
│ │ ├── thinking-guard.ts # Loop detection + abort
│ │ └── truncation.ts # Truncated response detection
│ └── utils/
│ ├── repetition.ts # Jaccard similarity on bigrams
│ └── tokens.ts # Per-session token counter
├── tests/ # Vitest unit tests
├── docs/ # Per-feature documentation
├── CHANGELOG.md
├── package.json
├── README.md
└── tsconfig.json
Guardrails
| Guardrail | Default |
|---|---|
| Max auto-continues per user turn (anti infinite-loop) | 3 |
| Counter resets when you send a new message | ✓ |
| Soft limit well below the cap (catches "finished but glued to the cap") | 115k tokens |
| Silent failure (never breaks your session) | ✓ |
| Thinking guard hard limit (abort reasoning loops) | 20k tokens |
License
Similar plugins
Personality
opencode-personality
Configurable personality and mood system plugin for OpenCode
Tps Meter
opencode-tps-meter
Live tokens-per-second meter for OpenCode (v1 and v2)
Better Compact
better-compact
OpenCode plugin that improves long-session context with boundary-time pruning