Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Chapter 25: Beyond Conversations

Positioning: MemPalace's current validation focuses on conversational memory, but its architecture -- the Wing/Hall/Room/Closet/Drawer hierarchy, the AAAK compression dialect, the temporal knowledge graph -- doesn't depend on "conversation" as a specific data type. This chapter analyzes this architecture's adaptation potential in other domains, as well as the technical roadmap for AAAK entering the Closet layer.


A Structure Bigger Than Conversations

There's an easy-to-overlook sentence in MemPalace's README:

"It has been tested on conversations -- but it can be adapted for different types of datastores."

This isn't a casual aspiration. It's a statement about the architecture's essence.

Recall MemPalace's core structure: Wing is a domain boundary, Room is a concept node, Hall is a classification dimension, Closet is a compressed summary, Drawer is raw content. Among these five layers, none depends by definition on "conversation" as a data form. A Wing doesn't care whether it contains conversation records or code files -- it only cares that "these things belong to the same domain." A Room doesn't care whether it represents a discussion topic or a code module -- it only cares that "this is an independent conceptual unit."

This means MemPalace's spatial structure is data-type agnostic. The palace's retrieval effectiveness comes from the structure itself -- semantic partitioning reduces the search space, hierarchical filtering improves hit precision -- not from the specific format of stored content. The 34% retrieval precision improvement analyzed in Chapter 4 comes from Wing and Room structured filtering, independent of whether the filtered content is conversations or code.

Of course, there's distance between "theoretically possible" and "engineeringly feasible." Let's analyze several specific directions.


Codebase: Wing Is Project, Room Is Module

A mid-sized software team manages five microservices, two frontend applications, and a shared library. Six months later, no one remembers why payment-service's retry logic uses exponential backoff instead of fixed intervals, nor why shared-lib has that seemingly redundant abstraction layer or what specific problem it solved.

Code comments and commit messages should theoretically record this information. In practice, most commit messages are "fix bug" or "refactor auth module," and code comments either don't exist or are outdated. The real design reasoning is scattered across AI conversations, Slack discussions, and closed PR comments.

Adapting MemPalace to a codebase scenario, the mapping is natural:

Wing = project (payment-service, user-frontend, shared-lib)
Room = module or concern (retry-logic, auth-middleware, database-schema)
Hall = knowledge type (hall_facts: design decisions, hall_events: refactoring history, 
       hall_discoveries: performance findings, hall_advice: best practices)
Closet = module's compressed summary (design intent, key constraints, known limitations)
Drawer = raw content (related conversation records, PR descriptions, design document fragments)

The most valuable part of this mapping is Tunnel -- cross-Wing conceptual connections. When both payment-service and user-frontend have a Room named auth-middleware, Tunnel can tie them together at the graph layer. This means a deeper codebase-memory workflow could surface both backend and frontend perspectives on authentication-related design decisions, even if they were discussed at different times in different contexts.

Among MemPalace's three existing mining modes, the projects mode (mempalace mine <dir>) already supports ingestion of code and documentation files. More precisely, the current implementation gets wing from mempalace.yaml or a --wing override, and routes room through a mix of path hits, filename hints, and content keywords. That is already enough to support "ingest project files into one palace and retrieve them by room," but it is not well described as "maps code files to Wing and Room by directory structure." Building on this, deeper adaptations -- such as generating stronger cross-room structure from import relationships or extracting temporal change information from Git history -- remain engineerable extensions.


Document Library: Wing Is Knowledge Domain, Room Is Topic

The core problem facing enterprise document management isn't storage -- storage is never the problem. The problem is retrieval. When an organization has thousands of pages of product documentation, technical specifications, meeting minutes, and research reports, "find that document about GDPR-compliant data retention policies" becomes a non-trivial retrieval task.

Existing document management systems -- Confluence, Notion, SharePoint -- use folder hierarchies and tags to organize documents. The limitations of these organizational approaches were already analyzed in Chapter 4: they're categories from the administrator's perspective, not navigation structures from the searcher's perspective.

MemPalace's palace structure offers a different organizational approach:

Wing = knowledge domain (compliance, product-design, engineering-standards)
Room = specific topic (gdpr-data-retention, oauth-implementation, api-versioning)
Hall = document type (hall_facts: specifications and standards, hall_events: meeting resolutions, 
       hall_advice: implementation guidelines)

The key advantage of this structure is: when searching, you don't need to know the document's title or tags -- you only need to describe the information you're looking for, and the system can use Wing / Room structure to narrow the search space. If document-memory adaptation is pushed further, a natural-language query like "what special requirements does our data retention policy have for EU users" could be organized toward something like wing_compliance / gdpr-data-retention before semantic retrieval. What needs to stay separate from the current implementation is that the public searcher.py supports only explicit wing / room filtering; it does not yet auto-classify natural-language queries into hall_facts or a specific room at runtime.


Email and Communications: Wing Is Contact, Room Is Project

Another natural adaptation direction is email and communication records. MemPalace already supports ingestion of Slack exports. Extending this capability to email, the mapping is clear:

Wing = contact or team (wing_client_acme, wing_vendor_stripe, wing_team_infra)
Room = project or topic (contract-renewal, api-integration, incident-2026-03)

Tunnel is especially valuable in this scenario. When client Acme's contract renewal discussion (wing_client_acme / contract-renewal) and the internal infrastructure team's capacity planning discussion (wing_team_infra / capacity-planning) touch on the same topic -- such as "how many additional compute resources are needed for next year's SLA commitments" -- Tunnel automatically establishes the connection. When reviewing client negotiation history, you can automatically discover the internal team's related discussions, and vice versa.


Note Systems: Wing Is Domain, Room Is Concept

The core philosophy of personal knowledge management tools -- Obsidian, Logseq, Roam Research -- is bidirectional linking: connections between notes are as important as the notes themselves. MemPalace's Tunnel mechanism is essentially bidirectional linking -- when the same Room name appears in different Wings, connections are automatically created.

Wing = knowledge domain (distributed-systems, machine-learning, product-management)
Room = concept (consensus-algorithms, gradient-descent, user-retention)

An interesting possibility is: MemPalace's palace structure could serve as a retrieval acceleration layer for existing note tools. You continue writing notes in Obsidian, but MemPalace ingests note content into the palace structure in the background, providing cross-note semantic retrieval and automatic association discovery. Note tools excel at creation and browsing; MemPalace excels at retrieval and association. The combination of both may be more powerful than using either one alone.


AAAK Entering the Closet Layer

All the above extension directions can be implemented on MemPalace's current architecture -- they essentially change the ingestion pipeline and mapping rules, with no changes needed to the core storage and retrieval mechanisms. But there's a deeper technical evolution direction that will significantly change the system's performance characteristics: the AAAK dialect entering the Closet layer.

To understand the implications of this evolution, you first need to understand how the Closet layer currently works.

To understand the significance of this evolution, the conceptual layer and the current runtime have to be separated.

More accurately, the current public repository does not yet expose an explicit Closet storage layer. mempalace mine currently writes chunked raw text directly into mempalace_drawers; the main metadata fields are wing, room, source_file, and similar tags. searcher.py's default path also queries that drawers collection directly and returns verbatim text. In other words, Drawer is the runtime layer that is clearly implemented today; Closet is still much closer to the README and benchmark narrative of a navigational middle layer.

So when the README says "add AAAK directly to the closets," it is not describing a fully implemented subsystem waiting only for a new encoding. It is describing the next step: turn that conceptual / experimental middle layer into an explicit compressed navigation layer.

MemPalace's README explicitly mentions this evolution direction:

"In our next update, we'll add AAAK directly to the closets, which will be a real game changer -- the amount of info in the closets will be much bigger, but it will take up far less space and far less reading time for your agent."

Let's analyze the feasibility of this direction based on dialect.py's current capabilities.

The Dialect class's compress() method accepts plain text input and outputs AAAK format. It does several things:

First, entity detection and encoding. _detect_entities_in_text() scans text for known entities (via preconfigured entity mappings) and suspected entities (via capitalized-word heuristics), encoding "Kai" in "Kai recommended Clerk" as "KAI."

Second, topic extraction. _extract_topics() extracts key topic words through word frequency analysis and heuristic weighting (capitalized words, terms containing hyphens/underscores get bonus points), compressing lengthy descriptions into topic tags like auth_migration_clerk.

Third, key sentence extraction. _extract_key_sentence() scores each sentence -- sentences containing decision words ("decided," "because," "instead") score higher, shorter sentences are preferred -- extracting the most information-dense fragments.

Fourth, emotion and flag detection. _detect_emotions() and _detect_flags() detect the text's emotional tendency and importance markers (DECISION, ORIGIN, TECHNICAL, etc.) through keyword matching.

A 500-word conversation summary, after processing by compress(), might be compressed into two or three lines of AAAK format:

wing_kai|auth-migration|2026-01|session_042
0:KAI+PRI|auth_migration_clerk|"Chose Clerk over Auth0 pricing+dx"|determ+convict|DECISION+TECHNICAL

Approximately 30 tokens. The original summary might be 300 tokens. A compression ratio of roughly 10x.

When this compression is applied to the Closet layer, the effect is twofold.

Effect one: the same storage space can hold more information. If a Closet could previously store 10 summaries (3000 tokens), after AAAK conversion it can store 100 (same 3000 tokens). This means the AI gains ten times the contextual coverage when reading a single Closet.

Effect two: the AI reads faster. AAAK is designed as a format instantly comprehensible to AI -- it teaches the AI AAAK syntax in the mempalace_status response, and the AI directly parses AAAK in subsequent interactions. Reading a 30-token AAAK summary is much faster than reading a 300-token English summary, while the information content is equivalent. In scenarios requiring scanning many Closets to locate information, this speed difference is decisive.

From dialect.py's current implementation, this evolution is technically feasible. The compress() method can already handle arbitrary plain text input, independent of any specific data structure. Integrating it into the ingestion pipeline -- calling dialect.compress() for AAAK encoding after generating Closet summaries -- is an incremental engineering change that doesn't require restructuring the core architecture.

One technical consideration to note: AAAK-compressed text may behave differently in the semantic embedding space than original English. The embedding model used by ChromaDB (such as all-MiniLM-L6-v2) was trained on English text, and AAAK-formatted text -- like KAI+PRI|auth_migration_clerk -- may produce embedding vectors different from the English equivalent description. This means that after Closet layer AAAK conversion, semantic matching between search queries (typically English natural language) and Closet content (AAAK format) may need adjustment.

One possible solution is dual storage: Closet simultaneously retains the AAAK version (for AI reading) and the original English version (for embedding retrieval). This adds some storage overhead but maintains retrieval precision. Another approach is to also convert queries to AAAK format during search, so that queries and content match in the same representation space -- but this requires validating the embedding model's behavior on AAAK text.

Regardless of which approach is adopted, the direction of AAAK entering the Closet layer is clear, and feasibility is well-founded. It's not a feature that needs to be reinvented but an application of existing AAAK encoding capability to the existing Closet architecture.


The Open Source Community's Exploration Space

MemPalace is open-sourced under the MIT license, meaning all the above extension directions don't need to wait for the official team to implement. Any interested developer in the community can fork the project and implement their own ingestion pipeline adaptations.

Several specific exploration spaces worth highlighting:

Diversification of ingestion pipelines. The current convo_miner.py handles normalization of five conversation formats. The same pipeline pattern can be extended to more data types: ingestion of Git commits and PR comments, ingestion of Obsidian vaults, ingestion of browser bookmarks and highlights. Each data type needs a normalizer (converting raw format to standard structure); the rest of the palace logic can be reused.

Automatic discovery of Wing/Room. The current mempalace init is closer to "local scan + interactive confirmation": it detects candidate rooms from directories, filenames, and content, then lets the user accept, edit, or extend them. For large datasets, stronger automatic discovery may be more practical -- using clustering or other structure-learning methods to identify domain boundaries (Wings) and concept nodes (Rooms). This is especially valuable in document libraries and email archives.

Cross-source fusion of the knowledge graph. When different types of data are ingested into the same palace, the knowledge graph (knowledge_graph.py) provides a local triple store capable of holding cross-source entity relationships. A client name mentioned in email, the same name appearing in code comments, and the same client discussed in meeting minutes could, in principle, all be expressed as temporal triples inside the same graph. What must be clarified is that the public repository clearly implements the add_triple / query_entity layer, not a fully automatic cross-source extraction-and-fusion pipeline.

Domain extension of Specialist Agents. The README has used reviewer, architect, and ops as software-development specialist examples, but the current public repository actually implements a lower-level generic mechanism: any agent_name can own its own wing_<agent>/diary. Precisely because that base is simple, the same storage structure could be extended to other domains: a sales agent tracking client-relationship evolution, a research agent tracking papers and research directions, or a legal agent tracking changes in compliance requirements.


No Roadmap Commitments

This chapter deliberately uses wording like "could," "can," and "direction" rather than "will," "plans to," or "expected to." The reason is simple: MemPalace is an actively developing open-source project, and its future direction depends on community needs, contributor interests, and actual engineering validation. Drawing a polished product roadmap is easy; delivering on it is hard.

The more honest approach is to say: MemPalace's architecture -- Wing/Hall/Room spatial structure, AAAK compression capability, temporal knowledge graph -- is general by design. The domain they've been validated in is conversational memory, with validation results of 96.6% (zero API) and 100% (Haiku reranking). Whether they can achieve the same effectiveness in codebases, documents, email, and notes requires actual engineering attempts and benchmark validation.

This is also where open source's value lies. When a closed-source product says "we will support codebase memory," you can only wait. When an open-source project says "the architecture supports codebase memory," you can verify it yourself. Fork the code, write a code ingestion pipeline, run a benchmark -- the entire validation process is open to anyone.


The Palace's Boundaries

MemPalace's core insight is: structure matters more than algorithms. On the retrieval problem, a good spatial organization structure delivers precision improvements (34%) that exceed what most pure algorithm optimizations can achieve.

This insight isn't limited to conversations. It applies to any scenario requiring fast localization of specific knowledge within large volumes of information. Design decision retrieval in codebases, policy lookup in document libraries, historical discussion tracing in email, concept association discovery in notes -- all these scenarios face the same core problem: the search space is too large, and pure semantic matching lacks sufficient discrimination.

MemPalace's palace structure -- through the introduction of domain boundaries (Wing), classification dimensions (Hall), and concept nodes (Room) -- provides a solution to this problem that is agnostic to data type. It doesn't rely on larger models, better embeddings, or more computation -- it relies on better organization.

This is a simple but profound engineering judgment: rather than having AI search through 22,000 unstructured records, first build a palace for those records so the AI knows which room to look in.

Conversations are just the first domain where MemPalace validates this judgment. They won't be the last.