cyberine
UsageRun recipes

LSP/compiler diagnostic feedback loop (T436)

Loop-adapter workers (loop-*-build) can now self-correct type errors within a single run, matching opencode's built-in edit-then-check loop. After each tool round that mutates a file the adapter runs a fast in-process syntax check (Phase 1: bundled TypeScript compiler, zero deps) and optionally a live LSP pull-diagnostic (Phase 2: LspClient.diagnostics() via typescript-language-server or CYBERINE_LSP_CMD) and injects any errors back as a user turn. Off by default — no behavior change unless you set the env var.

Enable per-edit mode (errors injected after every write round, opencode-equivalent behavior):

CYBERINE_DIAG_FEEDBACK=1 CYBERINE_BUILD_FLEET="loop-deepseek-build" \
  npm run wf -- src/engine/implementTaskWorkflow.ts

Enable end-of-loop mode (lowest cost: one diagnostic summary before the forced final answer turn, no mid-task self-correction):

CYBERINE_DIAG_FEEDBACK=end CYBERINE_BUILD_FLEET="loop-deepseek-build" \
  npm run wf -- src/engine/implementTaskWorkflow.ts

Tune for scaffold-heavy tasks (many rapid small file writes — fire diagnostics every 3 write rounds instead of every one, reducing noise from partially-written intermediates):

CYBERINE_DIAG_FEEDBACK=1 CYBERINE_DIAG_FEEDBACK_INTERVAL=3 \
  CYBERINE_BUILD_FLEET="loop-deepseek-build" npm run wf -- src/engine/implementTaskWorkflow.ts

Extend to non-TypeScript projects: point CYBERINE_LSP_CMD at any stdio LSP server and Phase 2 pull-diagnostics will fire for all file types that language server covers:

# Python (pyright)
CYBERINE_DIAG_FEEDBACK=1 CYBERINE_LSP_CMD="pyright --stdio" \
  CYBERINE_BUILD_FLEET="loop-deepseek-build" npm run wf -- <def>

# Go (gopls)
CYBERINE_DIAG_FEEDBACK=1 CYBERINE_LSP_CMD="gopls serve" \
  CYBERINE_BUILD_FLEET="loop-deepseek-build" npm run wf -- <def>

When typescript-language-server is not on PATH and CYBERINE_LSP_CMD is unset, Phase 2 is silently skipped and Phase 1 (syntax-only, TypeScript/JavaScript) still runs. Relevant env vars: CYBERINE_DIAG_FEEDBACK, CYBERINE_DIAG_FEEDBACK_INTERVAL, CYBERINE_DIAG_SEVERITY, CYBERINE_DIAG_FEEDBACK_MAX_ERRORS, CYBERINE_LSP_CMD — see the env-vars table for defaults and semantics.