Logo Memory Architecture

Memory Architecture

Cộng đồng
d-padmanabhan
memory-architecture

Design and review persistent memory and knowledge systems for AI agents, including durable project knowledge, team knowledge bases, retrieval, provenance, conflict handling, retention, and tenant isolation. Use when architecting agent memory across sessions, deciding where knowledge should persist, or reviewing memory quality and security. Do not use for ordinary note-taking or short-lived task context.

Tổng quan

Nhà phát hànhd-padmanabhan
Kho mãagent-engineering-handbook
Tên kỹ năngmemory-architecture
Sao
20
Bản fork
3
Tệp đi kèm
5
Giấy phépMIT
Liên kết
  • Hướng dẫn bằng Markdown

    Tệp SKILL.md được mô hình tải khi cần, nên chỉ tốn token khi có yêu cầu thực sự phù hợp.

  • Dùng được với mọi LLM

    Kỹ năng AI dùng hướng dẫn viết bằng Markdown thay vì mã dành riêng cho một nhà cung cấp, nên dùng được với GPT, Claude, Gemini, Grok hoặc mô hình cục bộ.

  • 5 tệp đi kèm

    Các tập lệnh, mẫu và tài liệu tham khảo mà mô hình có thể đọc khi làm việc. Các tệp chỉ cho phép đọc và không bao giờ được thực thi.

  • Mã nguồn mở

    Được d-padmanabhan công bố trên GitHub. Hãy đọc các tệp nguồn trước khi cài đặt.

Cài đặt

Cài đặt kỹ năng AI Memory Architecture trong TypingMind để dùng với bất kỳ LLM nào, hoặc thêm vào một tác nhân AI khác có thể đọc SKILL.md.

1

Cài đặt trong TypingMind

TypingMind cài đặt kỹ năng trực tiếp từ thư mục GitHub — đọc SKILL.md, đóng gói các tệp tài nguyên và lưu kết quả trên máy.

  1. Mở ứng dụng và vào Plugin → Kỹ năng.
  2. Chọn "Cài đặt từ GitHub".
  3. Dán URL của thư mục kỹ năng được hiển thị bên dưới rồi xác nhận.
    https://github.com/d-padmanabhan/agent-engineering-handbook/tree/main/skills/memory-architecture
  4. Bật kỹ năng trong từng cuộc trò chuyện mà bạn muốn sử dụng kỹ năng đó.
Plugin → Kỹ năng → Thêm kỹ năng → Từ URL GitHub, sau đó dán URL thư mục và nhấn Tiếp tục.
2

Cài đặt trong tác nhân AI khác

Bất kỳ tác nhân AI nào đọc được định dạng Agent Skills đều có thể dùng kỹ năng này — hãy sao chép thư mục vào thư mục kỹ năng của tác nhân AI đó.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/d-padmanabhan/agent-engineering-handbook.git /tmp/agent-engineering-handbook
mkdir -p .claude/skills
cp -r /tmp/agent-engineering-handbook/skills/memory-architecture .claude/skills/memory-architecture
Khởi động lại Claude Code sau khi sao chép để ứng dụng nhận kỹ năng mới.

Sử dụng trong TypingMind

Bật Memory Architecture trong bất kỳ cuộc trò chuyện nào trên TypingMind, mô hình sẽ tự xử lý phần còn lại. Tên và mô tả của kỹ năng nằm trong prompt hệ thống. Ngay khi có yêu cầu phù hợp, mô hình tự tải toàn bộ hướng dẫn — bạn không cần gọi thủ công và kỹ năng không tốn token cho đến khi thực sự được dùng.

Mô hình tự nạp Memory Architecture ngay khi có yêu cầu phù hợp.

Dùng được với mọi mô hình AI

Kỹ năng AI là các hướng dẫn Markdown thuần túy, không phải mã dành riêng cho một nhà cung cấp, nên bạn có thể dùng Memory Architecture với cả những mô hình khác ngoài mô hình ban đầu. Chỉ cần cài đặt một lần trong TypingMind rồi dùng với GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama hoặc mô hình cục bộ do bạn tự chạy — tất cả đều dùng khóa API của riêng bạn.

  • Chỉ tải khi cần

    Prompt hệ thống chỉ chứa tên và mô tả. Hướng dẫn được tải khi có yêu cầu phù hợp đầu tiên, nên khi kỹ năng chưa được dùng, bạn không tốn token cho phần hướng dẫn.

  • Đổi mô hình ngay trong cuộc trò chuyện

    Vì kỹ năng là hướng dẫn chứ không phải mã, việc đổi mô hình không làm kỹ năng ngừng hoạt động — mô hình tiếp theo vẫn đọc cùng tệp SKILL.md.

Hướng dẫn của kỹ năng

Đây là nội dung SKILL.md mà mô hình tải. Hãy đọc trước khi cài đặt — kỹ năng là những hướng dẫn mà mô hình của bạn sẽ làm theo.

Memory Architecture

Design persistent memory as a governed knowledge system, not as a larger prompt. Separate evidence from claims, choose storage from durability and trust requirements, filter before retrieval, cite what is used, and measure whether memory improves outcomes.

When to Use

Use this skill for:

  • Agent or assistant memory that persists across sessions
  • Durable project or team knowledge bases
  • Retrieval pipelines that assemble context automatically
  • Note deduplication, contradiction handling, supersession, or retention
  • Security and privacy reviews of persistent AI memory

Do not use it for:

  • One-off questions or ordinary documentation
  • Current-task handoff files such as tmp/active-context.md
  • Web research refreshes whose storage architecture is already defined
  • Model-provider API syntax without a memory-system design decision

For temporary coding-agent context, use agent workflow context management. For bounded web refreshes, use web-research-kb-refresh. For trust-boundary reviews, compose with zero-trust.

Non-Negotiables

  1. Raw input is untrusted evidence, not ground truth. Preserve its provenance and scan it for prompt injection, sensitive data, and malformed content.
  2. Ephemeral context is not durable memory. A gitignored tmp/ directory is appropriate for replaceable session state, not the only copy of team knowledge.
  3. Evidence and claims are separate records. A claim cites evidence; changing a claim does not rewrite the source.
  4. Trust never escalates automatically. Models and background jobs may propose claims or flag conflicts, but only an authorized human or deterministic policy may approve higher-trust states.
  5. Tenant and authorization filters run before semantic retrieval. Similarity does not grant access.
  6. Similarity is a candidate signal. It does not prove duplication, agreement, or contradiction.
  7. Supersession preserves lineage. Do not move or delete records in a way that breaks stable identifiers and citations.
  8. Every retrieved claim is attributable. Return stable claim IDs and source citations with generated context.
  9. Deletion is a designed operation. Remove the canonical record, derived chunks, embeddings, caches, and replicas according to policy.
  10. Quality is measured. Evaluate retrieval relevance, groundedness, freshness, conflict handling, and isolation before calling the system reliable.

Architecture Decision Workflow

1. Classify the Memory Need

Choose one primary class before selecting technology:

ClassLifetimeTypical storageExamples
Session contextHours or days; replaceableGitignored local files or session storeCurrent task, handoff, temporary plan
Durable local knowledgeMonths; single operator or repositoryVersioned files or local database with backupDecisions, project facts, curated notes
Shared or production memoryPolicy-defined; multi-user or multi-agentAuthorized database, object store, and search indexTeam KB, customer memory, operational knowledge

If the requested persistence, recovery, sharing, or access controls do not match the proposed store, stop and redesign the storage layer.

2. Define the Trust and Data Boundaries

Record:

  • Principals: writers, reviewers, retrievers, administrators, and downstream agents
  • Tenants and authorization scopes
  • Data classifications, including personal data, secrets, and regulated data
  • Evidence sources and external processing, including embedding providers
  • Retention, deletion, legal hold, backup, and recovery requirements
  • Worst-case outcomes from poisoned, stale, leaked, or cross-tenant memory

See security and privacy for the threat model and control checklist.

3. Separate the Planes

  • Evidence plane: original content plus source identity, hash, acquisition time, and classification
  • Knowledge plane: atomic claims, review state, confidence rationale, validity, and evidence links
  • Index plane: replaceable chunks, keywords, and embeddings derived from authorized records
  • Context plane: request-specific, token-bounded, attributed material assembled after policy checks
  • Lifecycle plane: review, conflict resolution, supersession, retention, deletion, and reindexing

4. Define the Record Contract

Require stable IDs and enough metadata to answer:

  • What is the claim?
  • Which evidence supports it?
  • Who or what created and approved it?
  • Which tenant and classification own it?
  • When was it valid, reviewed, and retrieved?
  • What supersedes or conflicts with it?
  • When must it be reviewed or deleted?

Use the data model as a starting contract. Extend it for the domain instead of weakening its provenance or isolation fields.

5. Design Retrieval

Apply the retrieval sequence in this order:

  1. Authenticate the caller and resolve tenant, purpose, and policy.
  2. Apply authorization, classification, validity, retention, and deletion filters.
  3. Generate candidates with keyword, metadata, graph, or embedding retrieval.
  4. Rerank using relevance, evidence authority, freshness requirements, and review state.
  5. Detect incompatible claims and surface unresolved conflicts.
  6. Enforce a context token budget and diversity limits.
  7. Return claim IDs, source citations, and ranking reasons with the selected context.

Do not use a universal ranking such as human_confirmed > inferred > raw. Authority and freshness depend on the claim, source, domain, and request. See retrieval and evaluation.

6. Design Writes and Lifecycle

  • Validate and classify before storing.
  • Make ingestion idempotent with stable source IDs and content hashes.
  • Treat similarity matches as review candidates.
  • Keep conflict state separate from supersession state.
  • Use optimistic concurrency or version checks for reviewed records.
  • Rebuild derived indexes after approval, supersession, deletion, or policy changes.
  • Archive only when policy permits; never use archival to evade deletion.
  • Audit writes, approvals, retrievals, conflicts, exports, and deletions.

For a lightweight repository implementation, use the local-file pattern.

7. Define Evaluation and Exit Criteria

Before rollout, create a representative query set with expected claims and prohibited results. Measure:

  • Retrieval precision and recall at the configured context budget
  • Citation and claim groundedness
  • Stale or superseded claim retrieval rate
  • Conflict detection and surfacing rate
  • Cross-tenant and unauthorized retrieval rate, which must be zero
  • Deletion propagation across canonical and derived stores
  • Latency, index freshness, token use, and cost

Test poisoning, malicious source instructions, ambiguous identity, stale claims, conflicting approved claims, index lag, provider outage, and deletion failure.

Design Review Output

Produce:

  1. Memory class and storage decision with rejected alternatives
  2. Principals, tenants, data classifications, and trust boundaries
  3. Evidence and claim schemas
  4. Ingestion, retrieval, write, conflict, and deletion flows
  5. Security and privacy controls
  6. Evaluation dataset, metrics, thresholds, and rollback criteria
  7. Open risks, owners, and reversal conditions

References

Related Handbook Guidance

Tệp đi kèm

Khi kỹ năng đã được tải, mô hình có thể đọc các tệp này nếu cần. Các tệp này chỉ dùng để đọc và không bao giờ được thực thi.

Câu hỏi thường gặp

Kỹ năng AI Memory Architecture làm được gì?

Design and review persistent memory and knowledge systems for AI agents, including durable project knowledge, team knowledge bases, retrieval, provenance, conflict handling, retention, and tenant isolation. Use when architecting agent memory across sessions, deciding where knowledge should persist, or reviewing memory quality and security. Do not use for ordinary note-taking or short-lived task context.

Vì sao nên dùng Memory Architecture trên TypingMind?

Vì bạn chỉ cần cài một lần rồi dùng với bất kỳ mô hình nào. Memory Architecture là nội dung Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên cùng một kỹ năng có thể chạy trên GPT-5, Claude, Gemini, Grok hoặc mô hình trên thiết bị — và bạn có thể đổi mô hình ngay trong cuộc trò chuyện mà kỹ năng vẫn hoạt động. TypingMind dùng khóa API riêng của bạn, nên bạn thanh toán trực tiếp cho nhà cung cấp thay vì trả phí thuê bao theo suất người dùng, đồng thời kỹ năng và các cuộc trò chuyện vẫn nằm trong bộ lưu trữ của bạn.

Làm thế nào để cài Memory Architecture trong TypingMind?

Mở Plugin → Kỹ năng → Cài đặt từ GitHub trong TypingMind rồi dán https://github.com/d-padmanabhan/agent-engineering-handbook/tree/main/skills/memory-architecture. TypingMind đọc tệp SKILL.md, đóng gói các tệp đi kèm rồi cài đặt cả gói dưới dạng một kỹ năng mà bạn có thể bật cho từng cuộc trò chuyện.

Những mô hình AI nào có thể dùng Memory Architecture?

Bất kỳ mô hình nào bạn kết nối trong TypingMind. Kỹ năng AI là các hướng dẫn bằng Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên GPT, Claude, Gemini, Grok và các mô hình chạy trên thiết bị đều có thể tải kỹ năng này khi có yêu cầu phù hợp.

Có thể dùng Memory Architecture với bao nhiêu mô hình AI?

Bao nhiêu cũng được. Miễn là mô hình hỗ trợ kỹ năng, bạn có thể dùng Memory Architecture với mô hình đó — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama và nhiều mô hình khác — tất cả đều trên TypingMind với khóa API riêng của bạn.

Kỹ năng AI Memory Architecture có miễn phí không?

Có. Kỹ năng này được d-padmanabhan phát hành trên GitHub theo giấy phép MIT. Bạn chỉ trả tiền cho nhà cung cấp AI của mình theo số token đã dùng.

Kỹ năng AI là gì?

Kỹ năng AI là một gói hướng dẫn có thể tái sử dụng, chỉ cho mô hình AI cách thực hiện một tác vụ cụ thể. Kỹ năng tuân theo định dạng mở Agent Skills: một tệp SKILL.md chứa tên và mô tả, cùng các tập lệnh, mẫu hoặc tệp tham khảo mà mô hình có thể cần. Mô hình chỉ đọc hướng dẫn khi yêu cầu của bạn phù hợp với kỹ năng, nên kỹ năng đã cài đặt không phát sinh chi phí cho đến khi được sử dụng.

Kỹ năng AI khác gì với plugin hoặc máy chủ MCP?

Plugin hoặc máy chủ MCP cung cấp các công cụ mới mà mô hình có thể gọi. Khi mô hình gọi một công cụ, mã của công cụ đó chạy ở đâu đó và trả về kết quả. Còn kỹ năng AI cung cấp kiến thức và quy trình: cách tiếp cận tác vụ, các bước cần thực hiện và những tiêu chí mà kết quả cần đáp ứng. Kỹ năng chỉ là nội dung Markdown, nên không cần máy chủ, khóa API hay môi trường thực thi và hoạt động với mọi mô hình.

Xem tất cả

Tạo ngay không gian làm việc AI riêng

Đăng ký bản tin của chúng tôi để nhận thông báo về tính năng mới và các đợt tặng quà sắp tới 👇