MCPcopy Create free account
hub / github.com/diillson/chatcli / RunScoreBased

Method RunScoreBased

cli/workspace/memory/compactor.go:187–208  ·  view source on GitHub ↗

RunScoreBased performs score-based compaction (no LLM needed).

()

Source from the content-addressed store, hash-verified

185
186// RunScoreBased performs score-based compaction (no LLM needed).
187func (c *Compactor) RunScoreBased() error {
188 c.logger.Info("Starting score-based memory compaction")
189
190 // Archive facts with very low scores
191 threshold := 0.1
192 candidates := c.facts.GetArchiveCandidates(threshold)
193
194 if len(candidates) > 0 {
195 archivePath := filepath.Join(c.memDir, "memory_archive.json")
196 if err := c.facts.ArchiveFacts(candidates, archivePath); err != nil {
197 c.logger.Warn("Failed to archive facts", zap.Error(err))
198 } else {
199 c.logger.Info("Archived low-score facts",
200 zap.Int("count", len(candidates)))
201 }
202 }
203
204 c.markCompacted()
205 c.writeMemoryMD()
206
207 return nil
208}
209
210// CleanupDailyNotes removes old daily notes.
211func (c *Compactor) CleanupDailyNotes() (int, error) {

Callers 3

RunWithLLMMethod · 0.95
RunCompactionMethod · 0.80

Calls 7

markCompactedMethod · 0.95
writeMemoryMDMethod · 0.95
GetArchiveCandidatesMethod · 0.80
ArchiveFactsMethod · 0.80
WarnMethod · 0.80
InfoMethod · 0.65
ErrorMethod · 0.65

Tested by 1