# Self-Archaeology

> Periodically distill the agent's past thought history into time-layered trajectory notes by topic — so it can articulate how its understanding evolved without recomputing the narrative each time.

- **Category**: Agentic AI
- **Subcategory**: Cognition & Introspection
- **Canonical URL**: https://designpattern.fyi/patterns/self_archaeology/

---

## Description
**Intent**: An unbounded append-only thought log leaves the agent two bad options: read the whole thing (expensive, flat) or retrieve by embedding similarity (fragmentary, no temporal structure). Trajectory notes are a third way.

**Context**: Agents with persistent thought logs that grow unbounded over weeks. Without distillation, there's no way to see how understanding of a topic evolved across time without reading everything, and what the agent holds on a topic can't be expressed concisely.

**Solution**: Periodically (every N ticks, or on demand) run a compaction pass that groups recent thoughts by topic, extracts the position held in each period, and writes a short trajectory note: "(period 1, dates) held position A; (period 2) revised to B because evidence Z; (period 3) now holds C." Store these in a dedicated topic-keyed surface (one note per topic), indexed by topic. On any topic-related query, surface the latest trajectory note before raw thoughts. Mark superseded positions explicitly so they don't compete with the current one for attention.



## Use Cases
- The agent runs long enough that its position on a topic genuinely changes across days or weeks.
- Humans need the agent to articulate how its understanding evolved, not just its current view.
- An append-only thought stream or comparable trajectory log already exists to mine.






## Trade-offs


### Advantages

- The agent can articulate its own learning path, not just its current stance

- Superseded positions stop competing with current ones for the model's attention

- Reduces context cost compared to reading the full thought log directly




### Considerations & Drawbacks

- Distillation may misrepresent nuance present in the original thoughts

- Periodic compaction adds compute cost and must be scheduled deliberately

- Risk of self-confirmation loops if trajectories are written by the same model that generated the original thoughts







---
**Reference**: [Original Source](https://www.agentpatternscatalog.org/patterns/self-archaeology/)

