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}" }
}
