Chuyển đến nội dung
Skillpedia
Agent29k · #9567

memory-engineering

Skill này làm gì

Skill này giúp thiết kế bộ nhớ cho agent AI, so sánh các phương án và kiểm tra chi phí bộ nhớ cũng như những gì nên giữ hoặc bỏ. Dành cho kỹ sư xây dựng agent cần ghi nhớ thông tin theo thời gian.

Khi nào nên dùng

  • ✓Khi bạn đang thêm bộ nhớ cho một agent AI và muốn chọn một thiết kế.
  • ✓Khi kho nhớ của agent cứ phình to và bạn cần quy tắc để xác định những gì nên hết hạn.
  • ✓Khi bạn muốn ước tính chi phí của một thiết kế bộ nhớ trước khi xây dựng.

Liên kết skill

https://github.com/alirezarezvani/claude-skills/blob/main/engineering/memory-engineering/skills/memory-engineering/SKILL.md

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/alirezarezvani/claude-skills/blob/main/engineering/memory-engineering/skills/memory-engineering/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Tôi cần giúp đỡ để quyết định agent của tôi nên quên điều gì, vì bộ nhớ của nó cứ tăng mãi không ngừng.”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Agent đo chi phí của một thiết kế bộ nhớ, xem xét những gì đáng giữ lại và kiểm tra xem có chính sách quên hay không bằng các script hỗ trợ. Các script không gọi mạng hay mô hình AI.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

Memory Engineering — engineer the forgetting, not just the remembering

Portability: 4 stdlib scripts, no APIs/LLM calls/network. They measure and gate; you decide.

What this does

Anyone can give an agent memory: vector store, pipe in the history, retrieve top-k. That works until the history outgrows the context window, the write path costs more than every query it serves, and the store fills with stale state nobody removes. Memory is not a bucket — it is a system with a metabolism.

The shift: a storer optimizes what a system remembers; a memory engineer optimizes what it forgets. The problem was never that an agent forgets — it is that it never forgets on purpose.

The four lenses

Lens Question The finding that hurts
Stanford What does remembering cost? Construction energy exceeds total query energy across 300 queries. The tuned half is the smaller half.
Microsoft What is worth keeping? More raw memory can make an agent worse. Keep facts and skills; drop the events.
Anthropic Who controls what it keeps? A wrong memory does not fail once — it persists into every future session that reads it.
Nvidia Where does it hit hardware? It is all KV cache in HBM. Construction is prefill-heavy and stalls the query a user is waiting on.

Workflow

# 1 - Price it first. Never quote a quality number without a cost number.
python scripts/memory_cost_profiler.py --print-sample-spec > workload.json
python scripts/memory_cost_profiler.py --spec workload.json
# 2 - Pick which cost to pay. No "best" verdict; on a tie it asks, exit 2.
python scripts/memory_architecture_picker.py --constraints workload.json
# 3 - Audit what the store actually holds (skip if greenfield).
python scripts/memory_density_auditor.py --dir ~/.claude/memory
# 4 - Gate on forgetting. Exit 4 is a stop, not a suggestion.
python scripts/forgetting_policy_linter.py --policy design.json
# 5 - No command. Prove each pass by hand before scheduling it.

Step 1 reports the construction/query split, cost per correct answer, and amortization — if construction dominates, cut construction tokens before touching retrieval. Step 2 names the cost the winning family makes you pay. Step 3 classifies records FACT / SKILL / LOG / PROSE (LOG-HEAVY = archiving events; PROSE-HEAVY = docs, not memory).

Step 4 is the gate: F1 (explicit forgetting rule) and F4 (contradictions surfaced, never auto-merged) are blocking. Retrofitting forgetting onto two years of records is a migration nobody does; auto-merging disagreeing memories destroys the evidence the conflict existed.

Step 5 has no script — prove each pass by hand, then automate. Run it once against real history and ask whether it changed a decision. If not, scheduling it only makes noise. Ship order: forgetting_policy_design.md §7.

Hard rules

  1. Never quote accuracy without cost per correct answer.
  2. Never return a "best" memory system — name the cost the choice makes you pay.
  3. Never auto-merge contradictions. The system surfaces; the human decides.
  4. Never call a design done without a forgetting rule. No evaluated system provides one by default.
  5. Never schedule a pass not yet run by hand.
  6. Report findings as findings. A non-zero exit is a result to surface, not an error to swallow.
  7. Attribute every number with its confidence level. Vendor customer figures are testimonials, not benchmarks.

Scripts

Script Role Exit codes
scripts/memory_cost_profiler.py Construction vs query split, cost per correct answer, amortization, co-location warning 0 · 2 finding · 3 bad input
scripts/memory_architecture_picker.py Scores 4 families, disqualifies, names the cost, refuses to pick on a tie 0 · 2 ambiguous · 3 bad input · 4 none viable
scripts/memory_density_auditor.py FACT/SKILL/LOG/PROSE, duplicates, staleness, density (--dir or --jsonl) 0 dense · 2 finding · 3 bad input
scripts/forgetting_policy_linter.py The gate: 8 checks, F1 and F4 blocking 0 PASS · 2 CONDITIONAL · 4 FAIL

All support --output json and --sample (no input file needed).

References and assets

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

Tại sao agent nên quên?

Những ký ức cũ hoặc sai có thể kéo dài sang các phiên sau và làm agent kém đi, nên việc quên có chủ đích giúp agent đáng tin cậy hơn.

Nó có gọi mô hình AI không?

Không. Các script chỉ đo lường và kiểm tra, còn quyết định cuối cùng thuộc về bạn.

Nó so sánh những phương án nào?

Ngữ cảnh dài, truy xuất bằng vector store, bộ nhớ dạng đồ thị và bộ nhớ theo kiểu agent.

Chi tiết

Mô tả gốc của tác giả

Use before adding memory to an agent or when a memory store keeps growing (long context vs RAG vs graph vs agentic memory, what to expire). Prices the design with memory_cost_profiler.py and refuses one without a forgetting policy via forgetting_policy_linter.py.

repo: alirezarezvani/claude-skills

Độ phổ biến

Sao GitHub
29k
Vị trí xếp hạng
#9567
Giấy phép
MIT
Cập nhật
2/11/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự