Steve HutchinsonBig Pines

Autonomous Memory Management

Once an AI has memory, the next challenge is letting it manage that memory by itself - consolidating similar experiences, retiring stale knowledge, and strengthening what works, all without human input.

Once an AI has memory, the next challenge is letting it manage that memory by itself.

Right now, the Cognitive Substrate has consolidation workers, forgetting actions, and trust scoring. But these all run on parameters and schedules I configured. The system follows rules I set; it does not decide when those rules should apply or how aggressively.

What Autonomous Management Looks Like

Instead of me manually deciding what gets consolidated or forgotten, the system needs to make these decisions on its own - based on what it actually observes about its own memory quality.

In practice, autonomous memory management means the agent automatically:

  • Identifies clusters of similar experiences that have accumulated without being consolidated, and triggers consolidation before they become noise
  • Detects memories that are no longer being retrieved or that have falling trust scores, and schedules them for retirement
  • Strengthens memories that consistently contribute to good outcomes by raising their retention priority
  • Cleans up low-value memories without waiting for a human to adjust the forgetting threshold
  • Recognizes when a higher-level abstraction has become too general to be useful and breaks it back down

The DecayEngine already implements the cascading decision logic. Here is the full threshold cascade and the retention scoring formula:

// packages/decay-engine/src/engine.ts
//
// Cascading forgetting decisions:
//   1. contradiction >= 0.8 AND retention < 0.45  -> retire
//   2. retention <= 0.22                           -> prune
//   3. retention <= 0.28                           -> suppress
//   4. retention <= 0.45 AND ageDays > 30          -> compress
//   5. otherwise                                   -> retain

decide(candidate: ForgettingCandidate): ForgettingDecision {
  const retentionScore = scoreRetention(candidate);
  const contradiction = candidate.contradictionScore ?? 0;

  if (contradiction >= 0.8 && retentionScore < 0.45) {
    return decision(candidate, "retire", ...);
  }
  if (retentionScore <= this.retirementThreshold) {   // default 0.22
    return decision(candidate, "prune", ...);
  }
  if (retentionScore <= this.suppressionThreshold) {  // default 0.28
    return decision(candidate, "suppress", ...);
  }
  if (retentionScore <= this.compressionThreshold && (candidate.ageDays ?? 0) > this.compressAgeDays) {
    return decision(candidate, "compress", ...);      // threshold 0.45, age 30d
  }
  return decision(candidate, "retain", ...);
}

// Composite retention score:
//   importance  35% (dominant)
//   score       20%
//   usage/20    20% (capped at 20 retrievals)
//   recency     15% (linear decay over 90 days)
//   strategic   10%
//   contradiction penalty: -35%
export function scoreRetention(candidate: ForgettingCandidate): number {
  const recency = clamp(1 - (candidate.ageDays ?? 0) / 90);
  const use = clamp(candidate.retrievalCount / 20);
  const contradictionPenalty = (candidate.contradictionScore ?? 0) * 0.35;
  return clamp(
    candidate.memory.importanceScore * 0.35
      + candidate.memory.score * 0.2
      + use * 0.2
      + recency * 0.15
      + (candidate.strategicValue ?? 0.5) * 0.1
      - contradictionPenalty,
  );
}

What autonomous memory management adds on top of this is the decision about when to run planForgetting and which candidates to surface - currently a human-tuned schedule. The engine itself is already well-defined; the autonomy work is connecting it to quality signals the agent observes about its own memory.

Why This Is Different from What Exists Today

The consolidation and forgetting systems currently in place are reactive and schedule-driven. They run at configured intervals with configured thresholds. Autonomous management is proactive and quality-driven - the agent looks at the state of its own memory and decides what maintenance is needed.

This requires the agent to have a model of its own knowledge quality, not just a set of rules about what to do with that knowledge. That is a meaningfully harder problem.

The Real Test

This is the first real test of whether the Cognitive Substrate can genuinely run without constant supervision. Getting memory management right autonomously is the prerequisite for everything else in this series - without it, the agent cannot improve itself because it cannot keep its own knowledge base healthy.

Next up from memory

Ranked from series and tags, warmed by what the substrate is keeping salient across readers.

Accept to save reading progress, unlock continue-where-you-left-off, and allow a hosting-support ad at the end of posts. Anonymous session signals still help the live memory panels; we never publish reader IDs.