opencode-openloop
v0.1.6
Published
OpenCode plugin that watches file changes and triggers AI comment prompts
Maintainers
Readme
openloop
openloop is an OpenCode plugin (TypeScript) that watches file changes and
automatically sends a prompt into the currently active OpenCode session when it
finds actionable AI comments.
What it does
- Watches workspace files with
chokidar(add,change, andrawevents). - Skips ignored paths from
.gitignoreand internal/system folders (.git,.opencode,node_modules,dist,bin). - Reads changed files and ignores non-files/binary-like content (NUL byte check).
- Detects two trigger types:
AI:comments -> action mode (apply changes).AI?comments -> question mode (answer only).
- Batches matched files with a 3s debounce and sends one prompt via
client.session.promptAsync.
If any file in the batch has AI:, batch mode becomes action mode. Otherwise,
the batch is sent as question mode.
Prompt behavior
Action mode (AI:)
Generated prompt instructs OpenCode to:
- Load changed files as context (
@path/to/file). - Execute only
AI:instructions. - Remove only processed
AI:comments after implementation.
Question mode (AI?)
Generated prompt instructs OpenCode to:
- Load changed files as context (
@path/to/file). - Answer only
AI?questions in strict format:
question:
answer:- Remove only answered
AI?lines. - Do not modify source code and do not touch
AI:comments.
Session behavior
- Plugin captures active session ID from incoming OpenCode events
(
sessionID/sessionId). - Prompts are sent only when an active session is known.
- On
session.idle, pending files are scheduled for flush.
Local development
task install
task buildLoad locally from project config:
{
"plugin": ["./dist/index.js"]
}Publish to npm
task release VERSION=0.1.0Then install globally with:
opencode plugin -g opencode-openloop