feat(journal): ProjectMemoryDistiller — pure repo-scoped decision distillation

This commit is contained in:
2026-06-04 01:00:49 +04:00
parent 440c96659d
commit d552148048
2 changed files with 50 additions and 0 deletions
@@ -0,0 +1,15 @@
package com.correx.core.journal
import com.correx.core.journal.model.DecisionJournalState
/**
* Distils a decision journal into durable, repo-scoped memory lines for persistence to the
* cross-session L3 store. Pure transform (no I/O) so `core:journal` stays dependent only on
* `core:events`; the actual L3 upsert/retrieve lives in the wiring layer that owns the store.
*
* Each line is namespaced by [repoRoot] so retrieval can attribute a decision to its project.
*/
class ProjectMemoryDistiller(private val keepLast: Int = 40) {
fun distill(state: DecisionJournalState, repoRoot: String): List<String> =
state.records.takeLast(keepLast).map { "[$repoRoot] [${it.kind}] ${it.summary}" }
}