Skip to content

OptimizerService

Defined in: src/optimizer.ts:80

Operator-triggered LLM pass that rewrites flagged (“not working”) house rules using their failure evidence, applies the rewrites in place (clearing the flag), and opens a CLAUDE.md sync PR for any revised promoted rule. A faithful sibling of DistillerService — same inflight/queue/tick/finalize/health shape and the same hard-won read-only claude spawn contract. NEVER runs on a timer inside the service.

new OptimizerService(deps): OptimizerService

Defined in: src/optimizer.ts:92

OptimizerDeps

OptimizerService

health(): object

Defined in: src/optimizer.ts:100

object

consecutiveFailures: number

lastFailure: { at: number; reason: string; repoPath: string; } | null

ok: boolean


optimizeAllFlagged(repoPath): void

Defined in: src/optimizer.ts:142

Optimize every flagged (ineffectiveCount > 0) active/promoted rule in a repo.

string

void


optimizeOne(id): void

Defined in: src/optimizer.ts:133

Optimize a single flagged rule by id. No-op when missing, not active/promoted, or not actually flagged. Scopes the input + applied revisions to JUST this id.

string

void


tick(): Promise<void>

Defined in: src/optimizer.ts:271

Finalize any run whose output file is ready or that timed out, then drain queue.

Promise<void>