Auto Continue
OpenCode plugin: automatically continues responses that were cut off by the model's output limit.
3
近 30 天 +1
56
近 7 天 4
36.1
生态多维模型
1 个月前
2026-08-28
快速安装与配置
opencode.json写入当前项目的 opencode.json,只对这个仓库生效。
opencode.json
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["@fazaboa/opencode-auto-continue@0.1.0"]
}写入 ~/.config/opencode/opencode.json,对所有项目生效。
~/.config/opencode/opencode.json
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["@fazaboa/opencode-auto-continue@0.1.0"]
}若你要在本地改造这个插件,先装到项目里再从本地路径引用。
shell
pnpm add -D @fazaboa/opencode-auto-continueOpenCode 启动时会通过内嵌运行时自动加载 npm 依赖并缓存至本地目录,无需手动在全局环境执行安装。
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
同类生态推荐
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