DTLarchive — Reference Manual v2.2-5
Functional and technical reference for the local ChatGPT archive indexing, search, and knowledge-reuse engine.
Preface
This manual describes the structure, formats, invariants, and internal interfaces of DTLarchive 2.2-5. It is an architecture and data reference. It deliberately contains no user journey, launch procedure, or step-by-step scenario.
DTLarchive transforms ChatGPT conversation exports into a locally indexed corpus. Its purpose is to make the knowledge contained in these archives searchable, contextual, and reusable by downstream processing, without any remote-service dependency.
Intended audience
This document is intended for developers, maintainers, data owners, and integrators who need to understand engine behavior, validate its outputs, or connect its results to other knowledge-management tools.
Design principles
- Locality: archives, queries, index, and reports remain on the computer.
- Determinism: selection and ranking use explicit lexical rules.
- Traceability: each result retains its source file, identifier, and contexts.
- Incrementality: unchanged sources are not parsed again.
- Bilingual design: the interface and generated outputs are available in French and English.
- No external AI: no language model, embedding, or semantic service is involved.
Architecture
Overview
The architecture separates persistent import, full-text candidate selection, and exact analysis of candidate conversations. This avoids reading and recalculating the complete corpus for every search.
Components
| Component | Responsibility |
|---|---|
| DTLarchive.py | Orchestration, export parsing, lexical analysis, relevance scoring, output generation, and console interface. |
| dtlarchive_index.py | SQLite schema, incremental import, deduplication, message storage, and FTS5 queries. |
| dtlarchive_search.py | Candidate-conversation selection facade and examined-corpus counting. |
| dtlarchive_i18n.py | French/English catalog, active language, interpolation, and plurals. |
| DTLarchive.spec | Standalone executable build description. |
Processing pipeline
| Phase | Input | Output | Invariant |
|---|---|---|---|
| Resolution | Files or directories | Unique absolute paths | Stable path ordering. |
| Import | ChatGPT JSON | Sources, conversations, messages, FTS | One transaction per source. |
| Selection | Terms, roles, dates | Candidate identifiers | FTS reduces the corpus without producing final results. |
| Analysis | Candidate conversations | MiningResult | Exact validation of groups and exclusions. |
| Publication | Sorted results | JSON and HTML | Archived messages remain unchanged. |
File organization
Sources
DTLarchive.pydtlarchive_index.pydtlarchive_search.pydtlarchive_i18n.pyEngine, index, selection, and language-catalog implementation.
Persistent data
DTLarchive-index.sqliteLocal database for fingerprints, provenance, conversations, messages, and the FTS5 index.
Outputs
DTLarchive-output/logs/Structured results, main report, HTML conversation copies, and diagnostic log.
Data and index
ChatGPT source format
The reader accepts an array of conversations or a single conversation object. Each usable conversation contains a mapping dictionary. The active branch is reconstructed backwards from current_node through parent links, then reversed into chronological order.
Only non-empty user and assistant messages are retained. Text comes from content.parts or, as a fallback, content.text. If the active branch produces no messages, a fallback traversal sorts usable messages by date.
Internal models
| Type | Fields | Purpose |
|---|---|---|
| Message | id, role, text, create_time | A message extracted from a conversation. |
| Conversation | source_file, id, title, create_time, update_time, messages | Complete analysis unit. |
| QueryTerm | text, excluded, group | Lexical term and alternative-group membership. |
| MiningResult | source, identifiers, date, keywords, counts, score, roles, contexts, URL | Serializable and displayable result. |
| IndexUpdate | imported_files, unchanged_files, imported_conversations | Index synchronization summary. |
| SearchSelection | conversations, examined_count, candidate_count | Selection result before exact analysis. |
SQLite schema
| Object | Key | Contents |
|---|---|---|
| metadata | key | Index-schema version. |
| sources | id / unique path | Size, modification time, SHA-256, and indexing time. |
| conversations | id | Title, dates, content timestamp, and message count. |
| messages | id / conversation + ordinal | External identifier, role, date, and text in original order. |
| source_conversations | source + conversation | Many-to-many provenance relationship. |
| search_fts | FTS5 | Identifier, role, and text indexed with unicode61 remove_diacritics 2. |
Foreign keys are enabled and SQLite uses WAL journaling. Relational indexes cover message order and conversation dates.
Incremental import and deduplication
A source is unchanged when its size and modification timestamp match the stored state. If those metadata differ while the SHA-256 fingerprint remains identical, only metadata are refreshed. A genuinely modified source is parsed inside a transaction.
The ChatGPT identifier is the deduplication key. When absent, a deterministic SHA-256 is computed from path, title, and dates. Existing content is replaced when the incoming (content timestamp, message count) pair is greater than or equal to the stored pair. Provenance links allow one conversation to belong to several exports.
Search engine
Lexical grammar
| Construct | Internal semantics |
|---|---|
| comma, semicolon, OU, OR | Creates alternative groups. |
| ET, AND | Requires every term in one group. |
| -term | Globally excludes a conversation. |
| "phrase" | Removes external quotes while preserving the phrase. |
| prefix* | Lexical extension by alphanumeric, hyphen, or underscore characters. |
Duplicates are removed by normalized text, exclusion status, and group number.
Normalization and counting
Normalization applies Unicode NFKD, removes diacritics, lowercases text, replaces typographic apostrophes, and compacts whitespace. Searches are case- and accent-insensitive. Without a wildcard, simple forms accept an s or x plural suffix unless the term already ends in either character.
Indexed candidate selection
For each positive term, FTS5 produces an identifier set constrained by source, role, and date. Terms in one group are intersected; alternative groups are united. The title role is always added to the scope. This phase produces candidates, not final results.
Exact analysis
The title and in-scope messages are combined and normalized. Any excluded-term occurrence rejects the conversation. A positive group is valid only when all its terms occur. Counts, matching roles, and message positions are then calculated against exact text.
Relevance calculation
The score is capped at 100 and follows this deterministic formula:
| Range | Label |
|---|---|
| 80 to 100 | Highly relevant |
| 45 to 79 | Relevant |
| 0 to 44 | Secondary mention |
Final ordering is descending by score and then conversation date. The score is not a probability and does not come from statistical learning.
Context windows
Each matching message generates a window of up to two messages before and two after. Adjacent or overlapping windows are merged. At most six windows are retained per conversation. Context-message text is compacted to 1,200 characters.
Structured outputs
mining_results.json
The root document contains metadata and results. Metadata describe the application, version, logical schema, UTC time, sources, index, dates, query, and scope. Each result is a complete serialization of MiningResult.
| Family | Main fields |
|---|---|
| Identification | source_file, conversation_id, conversation_title, conversation_url |
| Measures | occurrence_count, message_count, relevance_score, relevance_label |
| Matches | matched_keywords, matched_roles, contexts |
| Processing context | source_files, index_path, period, search terms, role_scope |
HTML reports
DTLarchive-report.html presents metrics, term distribution, the first ranked unique conversation titles, the result table, and context windows. Displayed titles are not a semantic summary. Each conversation-<fingerprint>.html page reproduces the complete branch and places an anchor on the first matching message.
The documents contain their own CSS, use UTF-8, and follow the active interface language. Conversation content remains in its original language.
HTML diagnostic log
The daily logs/DTLarchive_YYYYMMDD.html log receives timestamped information, action, and error entries. It records major phases, summarized parameters, import counters, and exceptions. Log write failures do not interrupt the engine.
Internal reference
Project modules
| Module | Main dependencies | Held state |
|---|---|---|
| DTLarchive | argparse, pathlib, sqlite3, tkinter, webbrowser | Process language, arguments, selected corpus, and results. |
| dtlarchive_index | sqlite3, hashlib | SQLite connection and persistent schema. |
| dtlarchive_search | ArchiveIndex | Sources authorized for a selection. |
| dtlarchive_i18n | os.environ | Catalog and DTLARCHIVE_LANG variable. |
Function groups
| Group | Representative functions | Contract |
|---|---|---|
| Text | normalize, compact, unique, keyword_pattern, count_term | Deterministic lexical normalization and measurement. |
| Parsing | text_from_content, current_branch_messages, iter_conversations | Tolerant conversion from ChatGPT JSON to internal models. |
| Time | parse_french_date, period_overlaps_archive, archive_period_label | Inclusive bounds and overlap validation. |
| Analysis | mine_conversation, build_contexts, relevance_label | Produces an exact result or None. |
| Publication | write_json, write_html_report, write_conversation_page | UTF-8 structured and navigable output. |
Internationalization
The TRANSLATIONS catalog maps each key to fr and en values. current_language() reads DTLARCHIVE_LANG and falls back to French for unsupported values. t() selects and interpolates a template; plural_key() selects singular and plural variants.
Language coverage includes the console, dialogs, help, errors, reports, and log. It does not translate source conversation content.
Errors, transactions, and integrity
- An unreadable archive may be skipped in tolerant mode or raise an error in strict mode.
- Modified-source import is transactional; a parse failure preserves previously indexed content.
- An incompatible index version raises an explicit error before any search.
- Invalid, reversed, or out-of-corpus periods are rejected before analysis.
- HTML text is escaped before insertion into reports.
- HTML and JSON files use UTF-8; the Windows console is configured for code page 65001.
Appendices
Known limitations
- Search is lexical; it detects neither synonyms, paraphrases, nor semantic proximity.
- FTS candidate selection uses the first significant token of a phrase, after which exact analysis confirms the complete phrase.
- Summary titles are the first five unique titles in ranking order, not topics inferred from the corpus.
- The active branch is preferred; fallback traversal is used only when it yields no usable messages.
- Contexts are limited to six windows and their messages to 1,200 characters.
- The reader reflects the observed ChatGPT export format; source-format changes may require parser adaptation.
Versions and schemas
| Identifier | Value | Scope |
|---|---|---|
| Application | v2.2-5 | Distributed features and interface. |
| Logical schema | 2.1 | Value published in result metadata. |
| Index schema | 1 | Persistent SQLite database compatibility. |
Glossary
| Term | Definition |
|---|---|
| Corpus | All conversations linked to selected archives. |
| Candidate | A conversation selected by FTS5 before exact lexical validation. |
| Context | A message window surrounding a match. |
| Provenance | The relation between a deduplicated conversation and its source files. |
| FTS5 | SQLite's integrated full-text search engine. |
| WAL | SQLite journal mode supporting robust writes and concurrent reads. |