George HuRULES & BEYONDLEARNING NOTE 03 / 2026

AI AGENT / MEMORY & RAG

Help an agent remember correctly, retrieve correctly, and forget when needed.

Memory answers what happened to this user before. A knowledge base answers what verifiable information exists in the outside world. Mixing them loses control of personalization, facts and privacy.

A context window keeps only the present working set. A real agent must know a user across sessions and find evidence among many external materials: user memory and the knowledge base are two distinct long-term paths.

Memory provides continuity; a knowledge base provides factual grounds. Both need source, time and a way to withdraw.

01 / PRACTICESeparate memory from knowledge first

User preferences, past choices and long-term goals are memory. Legal provisions, product documents, case materials and research reports are knowledge. The first needs continuity for an individual; the second needs reliable sources. For user memory record who said it, when it happened, whether it is still valid and whether it can be deleted. For a knowledge base record source file, version date, scope and citation position. Current context should contain only the few memories and evidence needed now.

02 / PRACTICEMake memory governable data

Memory may be a natural-language summary, structured fields, an event timeline or executable rules. Stronger structure makes retrieval and updates more stable; freer expression is richer but conflicts more easily. A production system must handle duplication, expiry, contradiction and privacy. Redact logs before long-term storage, and let people view, correct or delete their own memory.

03 / RAG PIPELINERAG is an evidence pipeline

RAG splits documents into retrievable units, builds an index, retrieves candidate passages for a question, then gives passages and sources to the model. Chunks that are too large bury relevant content in noise; chunks that are too small cut relationships apart. Choose chunking together with document structure, question granularity and citation requirements. Retrieval output is not a fact: it is candidate evidence that still needs source, version and context review.

04 / PRACTICECombine semantic similarity with exact keyword matching

Dense vectors understand similar meaning; sparse retrieval hits precise terms such as legal article numbers, names and product models. Hybrid retrieval with reranking is usually steadier than vector search alone. Retain title, chapter, date and author as filterable metadata. Extract tables, images and scans structurally instead of retaining one OCR block. Keep page or paragraph positions for reopening originals. Build a small evaluation set from real questions, not only a few impressive demo searches.

05 / PRACTICEKnowledge need not become flat text

File systems, structured indexes and knowledge graphs each help. Folders naturally express project and material boundaries; structured fields fit dates, money and parties; graphs fit relationships between entities. The point is not the most complicated database. It is matching the route of a query to the structure of the knowledge itself.

06 / AGENTIC RAGLet the agent decide when to search, where to search and when to stop

Agentic RAG turns retrieval into a tool: the model identifies an information gap, selects a source, compares results and may rewrite the question to search again. More flexibility needs a budget, source allowlist and stopping conditions. For case material, require every conclusion to return file name, page, date and confidence status. When evidence is absent, mark it pending verification instead of completing a plausible answer. First exercise: build a three-layer index for a new case—folder structure, structured timeline and citeable original passages—then test recall with ten real questions.

Source book and chapter references

Next: tools, MCP and safety boundaries.

Continue to tools and MCP

READER COMMENTS

Leave the thought this article gave you.

0 / 300

No comments yet. You can leave the first one.