Skip to content

Commit d9620ed

Browse files
committed
chore: clean debug artifacts and enforce structured logging
- Replace 6 console.log in TurboQuant with structured Log calls - Replace console.log in Shield plugin with structured Log call - Remove src/util/scrap.ts dummy file (dead code) - Remove test-turboquant.ts and test-turboquant-audit.ts orphaned debug scripts from package root (should never have been committed) https://claude.ai/code/session_01A8LkdCir3TS3uCbx9L8CAb
1 parent f3cde2f commit d9620ed

5 files changed

Lines changed: 10 additions & 115 deletions

File tree

packages/opencode/src/memory/turboquant.ts

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,13 @@ import { Filesystem } from "../util/filesystem"
33
import { TurboQuantSchema } from "./schema"
44
import { Config } from "../config/config"
55
import { Cleaner } from "../util/cleaner"
6+
import { Log } from "../util/log"
67
import { Critic } from "../agent/critic"
78
import { GlobalBus } from "../bus/global"
89
import { Consolidator } from "../util/consolidator"
910

11+
const log = Log.create({ service: "turboquant" })
12+
1013
export namespace TurboQuant {
1114
export interface SearchResult extends TurboQuantSchema.SearchResult {}
1215
export type MemoryEntry = TurboQuantSchema.MemoryEntry
@@ -151,7 +154,7 @@ export namespace TurboQuant {
151154
yield* saveDb(dbPath, db)
152155

153156
if (manual) {
154-
console.log(`[TurboQuant] New memory staged for manual validation: ${key}`)
157+
log.info("memory staged for manual validation", { key })
155158
}
156159
}),
157160

@@ -183,11 +186,11 @@ export namespace TurboQuant {
183186
const dayMs = 24 * 60 * 60 * 1000
184187

185188
if (now - lastAudit < dayMs) {
186-
console.log("[TurboQuant] Daily audit already performed.")
189+
log.info("daily audit already performed")
187190
return
188191
}
189192

190-
console.log("[TurboQuant] Starting Daily Audit...")
193+
log.info("starting daily audit")
191194
const dbPath = cfg.turboquant?.dbPath ?? ".opencode/turboquant.json"
192195
const db = yield* getDb(dbPath)
193196

@@ -209,7 +212,7 @@ export namespace TurboQuant {
209212
// 3. Perform Memory Synthesis (Auto-Dream)
210213
const frequency = cfg.turboquant?.synthesisFrequencyMs ?? 24 * 60 * 60 * 1000
211214
if (now - lastAudit >= frequency) {
212-
console.log("[TurboQuant] Starting Memory Synthesis (Auto-Dream)...")
215+
log.info("starting memory synthesis (Auto-Dream)")
213216

214217
// Group memories by similarity for synthesis
215218
// Simplified logic: pick the first 3 verified entries that haven't been synthesized
@@ -240,13 +243,13 @@ export namespace TurboQuant {
240243
db[key].metadata.auditTrail.push({ event: `Synthesized into ${synthesisKey}`, timestamp: now })
241244
}
242245

243-
console.log(`[TurboQuant] Auto-Dream: Synthesized ${candidates.length} fragments into 1 mental model.`)
246+
log.info("auto-dream synthesized fragments", { count: candidates.length })
244247
}
245248
}
246249

247250
if (changes > 0) {
248251
yield* saveDb(dbPath, db)
249-
console.log(`[TurboQuant] Daily audit identified ${changes} candidates for review.`)
252+
log.info("daily audit complete", { changes })
250253
}
251254

252255
// Update last audit timestamp in config

packages/opencode/src/plugin/shield.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ export const ShieldPlugin: PluginModule = {
9898
}
9999

100100
if (redactedCount > 0) {
101-
console.log(`[Shield] Redacted ${redactedCount} sensitive patterns from outgoing message.`)
101+
log.info("redacted sensitive patterns", { count: redactedCount })
102102
}
103103
},
104104
}

packages/opencode/src/util/scrap.ts

Lines changed: 0 additions & 10 deletions
This file was deleted.

packages/opencode/test-turboquant-audit.ts

Lines changed: 0 additions & 68 deletions
This file was deleted.

packages/opencode/test-turboquant.ts

Lines changed: 0 additions & 30 deletions
This file was deleted.

0 commit comments

Comments
 (0)