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.
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new OptimizerService(
deps):OptimizerService
Defined in: src/optimizer.ts:92
Parameters
Section titled “Parameters”Returns
Section titled “Returns”OptimizerService
Methods
Section titled “Methods”health()
Section titled “health()”health():
object
Defined in: src/optimizer.ts:100
Returns
Section titled “Returns”object
consecutiveFailures
Section titled “consecutiveFailures”consecutiveFailures:
number
lastFailure
Section titled “lastFailure”lastFailure: {
at:number;reason:string;repoPath:string; } |null
ok:
boolean
optimizeAllFlagged()
Section titled “optimizeAllFlagged()”optimizeAllFlagged(
repoPath):void
Defined in: src/optimizer.ts:142
Optimize every flagged (ineffectiveCount > 0) active/promoted rule in a repo.
Parameters
Section titled “Parameters”repoPath
Section titled “repoPath”string
Returns
Section titled “Returns”void
optimizeOne()
Section titled “optimizeOne()”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.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”void
tick()
Section titled “tick()”tick():
Promise<void>
Defined in: src/optimizer.ts:271
Finalize any run whose output file is ready or that timed out, then drain queue.
Returns
Section titled “Returns”Promise<void>