포스트

Before RAG: Building a Durable Archive of AI Conversations

Part 1: preserving conversations across AI tools with stable identities, revision history, replayable imports, and verified NAS backups.

Before RAG: Building a Durable Archive of AI Conversations

Personal Session Memory · Part 1 of 4

1. Archive · 2. Retrieval · 3. Operations · 4. Recall

I Wanted to Remember Why, Not Just What

When I return to an old optimization, finding the final patch is often the easy part. The harder questions are:

What did I try before? Which measurements mattered? Why did I reject the other approach?

Those answers were scattered across ChatGPT conversations, Codex sessions, Claude Code transcripts, and OpenClaw agent histories. Some lived in ordinary messages; others were in tool output, experiments, or corrections made several turns after an apparently reasonable answer.

I wanted two ways to use that history. The first was straightforward recall: ask a question and find the relevant old conversation. The second was more interesting: give a coding agent a new task, let it identify the decisions involved, and have it search for evidence of how I handled similar trade-offs before.

Since graduate school, I have often left experiments and benchmarks running overnight. Coding agents expanded what I could delegate to research and implementation, but the next morning I sometimes found a question waiting for my decision rather than a finished task. The missing piece was often personal context: the reasoning behind a choice I had already made elsewhere.

But before an agent could use that context, I needed to stop treating conversation history as something each application’s interface would preserve and expose forever.

This series describes the system I built with Codex: a permanent archive, replaceable local retrieval, an operations dashboard, and a skill named recall. This first part is about the foundation: what should survive when the tools, models, and search indexes change?

My first requirement was not a particular vector database. It was the ability to replace the vector database, embedding model, or optimization strategy without losing the conversations or rewriting the entire system.

I separated three responsibilities:

ComponentResponsibilityOutside its scope
Session ArchivePreserve artifacts, normalize records, track revisions, publish recoverable backupsEmbedding inference and preference inference
Session SearchBuild derived indexes and return passages with provenanceModifying the archive or generating final answers
Recall skillGuide Codex through retrieval, verification, and appropriate confirmationStoring another copy of the corpus or granting permissions

The dashboard observes these components. It is not another ingestion pipeline.

flowchart TD
    Sources["Codex / Claude Code / OpenClaw<br/>ChatGPT exports / one-time imports"] --> Archive["Session Archive<br/>local SQLite: records, revisions, provenance"]
    Archive --> NAS["NAS<br/>preserved artifacts + recovery snapshots"]
    Archive -->|"published checkpoint, read-only"| Search["Session Search"]
    Search --> Catalog["SQLite catalog + FTS5"]
    Search --> Ollama["Ollama<br/>embedding inference"]
    Search --> Vectors["LanceDB<br/>vectors + search index"]
    Agent["Codex + Recall skill"] -->|"query + task context"| Search
    Search -->|"passages + source references"| Agent
    Archive -->|"metrics"| Dashboard["Private read-only dashboard"]
    Search -->|"metrics"| Dashboard

The archive is the durable foundation. The search catalog, embeddings, and vector index are derived data. Expensive to rebuild does not mean irreplaceable.

I chose a small custom retrieval layer because I already had an archive and wanted explicit control over these boundaries. This was a scope decision, not a benchmark proving that existing RAG frameworks were unsuitable.

Collecting Sessions Is a Data-Modeling Problem

“Copy all my sessions” sounds simple until two tools represent the same activity differently—or one tool changes how it stores its own history.

My adapters handle the formats present in my installation:

SourceInput to the archiveImportant boundary
CodexSession JSONL and selected SQLite conversation tables where presentA rollout file is not always the complete history representation
Claude CodeProject transcripts, subagent transcripts, and allowlisted supporting artifactsA subagent is not automatically the same logical session as its parent
OpenClawAgent transcript databases, historical logs, and internal Codex runtime recordsUser-facing transcripts and engine records can overlap
ChatGPTManually downloaded export ZIPsCoverage extends only through supplied exports
AntigravityOne-time import of preserved historical dataRecoverable content is imported; missing bodies are not invented

These are version-specific adapters, not a promise about every release of these products. Missing required tables or columns must surface as incomplete collection, rather than quietly producing a successful-looking empty result.

Preservation and interpretation are separate. A raw record can be preserved even when the current parser cannot turn it into a searchable message. A better parser later is only useful if the original evidence still exists.

Stable Identity Beats a Daily Cutoff

My initial intuition was to collect each day’s conversations without overlap. That is insufficient: an old session can receive new messages, an export can repeat its entire history, and an existing record can be revised.

The archive instead uses stable identities and content versions. Conceptually:

1
2
3
session identity = hash(source, namespace, native session ID)
event identity   = hash(session identity, native event ID)
event revision   = hash(canonical normalized record)

When a source has no usable native event ID, the adapter records a synthetic identity rather than pretending the source supplied one. Original timestamps are retained and converted to KST for date views. The date I import a file does not become the date of its conversations.

The working SQLite database contains more than filenames:

  • Normalized event bodies and current-version pointers.
  • Historical revisions and compressed raw records.
  • Source provenance and session relationships.
  • Collection runs, issues, and publication receipts.

Deduplication is deliberately scoped. Proven copies of a native thread can be related or presented canonically. Two conversations with similar titles or identical sentences are not automatically the same conversation. Search-result text deduplication, discussed in Part 2, is a presentation choice—not permission to delete archival records.

This makes repeat imports an ordinary operation rather than a special recovery procedure. Revisions are retained, while unchanged records do not create another logical copy.

ChatGPT: Automate the Import, Not the Request

I originally considered requesting a ChatGPT export through a scheduled browser workflow every day. In practice, requesting an export and receiving a downloadable ZIP were separate, asynchronous steps. Login state and email delivery made that a poor foundation for a daily ingestion guarantee.

I settled on a simpler boundary:

  1. Request and download an export manually when appropriate.
  2. Copy the complete ZIP into a designated NAS inbox.
  3. Let the existing collector validate and import it.

The importer checks that the file has stopped changing, validates the ZIP, and detects already imported archives by content hash. Conversation and message identities handle overlap between different exports. A new ZIP does not mean another copy of every old message.

There is also an important distinction between indexed locally and safely published to the NAS. Parsing success is not enough for an import acknowledgment. The durable receipt follows verified publication.

This design is less ambitious than browser automation, but its failure modes are easier to understand. It also makes the freshness limit explicit: I cannot search ChatGPT conversations that I have not yet exported and supplied.

What Lives on the Mac, and What Lives on the NAS?

Storage placement became important as the archive grew.

LocationData
NASPreserved source artifacts, imported ZIPs, compressed archival bundles, recoverable archive database snapshots, private code backups
Mac miniWorking archive.sqlite, search catalogs and FTS tables, embedding cache, LanceDB files, Ollama models, running services

The Mac does not hold just a tiny metadata cache. Its working archive database includes conversation text. Conversely, the NAS does not host a live network-mounted vector service.

Keeping active SQLite files local was intentional. SQLite’s WAL mode relies on same-host shared-memory coordination and is not supported over a network filesystem. My NAS stores backup artifacts rather than serving the live WAL database. See SQLite’s WAL documentation.

Source databases need similar care. Reading a live .sqlite file while ignoring its WAL can miss committed data. The collector uses read-only transactions; imported database copies are handled as database-and-sidecar sets in disposable local copies. A stable copied set still cannot prove that nothing was omitted before the copy reached the NAS.

The NAS destination is checked before publication. If it is unavailable, the collector must not silently write into a same-named local folder and call that a successful backup.

Preservation Does Not Guarantee Completeness or Privacy

Two examples keep the coverage claims grounded. In the September 28 snapshot, the earliest dated ChatGPT record was from November 2023, but the latest supplied export only covered conversations through early September 2026. Recent indexing did not make that export current.

The one-time Antigravity import preserved 32 session entries and 14,368 normalized records. Some source steps already had cleared bodies, however. Retaining their metadata was not recovering the lost text.

Privacy has a similar boundary. Excluding credential-store files does not automatically redact secrets previously pasted into a conversation or tool output. An import namespace is not an access-control mechanism. Data from another machine or work context still needs an appropriate permission boundary.

Nor is this a complete disaster-recovery strategy. RAID does not replace an independent backup. Durable retention also means data does not disappear merely because it is later removed from an upstream application’s interface.

What This Layer Gives Me

The outcome of this first stage is not semantic search. It is a recoverable, versioned foundation on which search can safely change.

The choices I would keep are straightforward: preserve originals, make repeated imports safe, retain provenance, and distinguish local processing from verified publication. That turns history from a collection of application-specific files into data I can reason about.

Next: Building Replaceable Local RAG with Ollama and LanceDB—turning the archive into searchable evidence without making the vector database the source of truth.

이 기사는 저작권자의 CC BY 4.0 라이센스를 따릅니다.