Logo Memory Hygiene

Memory Hygiene

Cộng đồng
chrono-meta
memory-hygiene

Detects "stale-but-confident" memory entries — facts that were once verified but have silently drifted. Scans memory/*.md for entries past their staleness threshold and proposes re-verification or archival. Runs automatically as part of harvest-loop Step 0-c and on explicit invocation.

Tổng quan

Nhà phát hànhchrono-meta
Kho mãforge-harness
Tên kỹ năngmemory-hygiene
Sao
32
Bản fork
1
Tệp đi kèm
Chỉ có hướng dẫn
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ộ.

  • Hướng dẫn có đủ mọi thứ cần thiết

    Mọi thứ mô hình cần đều nằm trong hướng dẫn — không có tệp bổ sung cần đồng bộ.

  • Mã nguồn mở

    Được chrono-meta 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 Hygiene 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/chrono-meta/forge-harness/tree/main/plugins/fh-meta/skills/memory-hygiene
  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/chrono-meta/forge-harness.git /tmp/forge-harness
mkdir -p .claude/skills
cp -r /tmp/forge-harness/plugins/fh-meta/skills/memory-hygiene .claude/skills/memory-hygiene
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 Hygiene 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 Hygiene 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 Hygiene 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-hygiene — Stale Memory Detection and Re-Verification

Addresses the "stale-but-confident" failure mode: verified information that silently drifts while remaining highly ranked in retrieval — identified as a harness failure mode in Scaling the Harness in Agentic AI (arXiv:2605.26112).

Sister asset: arXiv:2607.01935 (A-TMA: Decoupling State-Aware Memory Failures in Long-Term Agent Memory, Shi/Tang/Tung 2026) names this exact class "ghost memory" — outdated / current / transitional facts intermixing during retrieval — and benchmarks it (LTP; conflict-accuracy +0.240, temporal-F1 0.03→0.17 on LoCoMo with a bank-maintenance layer). It is the tighter external frame for what memory-hygiene detects: this skill is the FH-native detection + archival pass over the same failure A-TMA formalizes at the retrieval layer. (Source-verified 2026-07-03; a broader bounded-memory testbed, arXiv:2607.02255 AgenticSTS, was considered and set aside — it targets context-assembly, not staleness, so it is not the sister here.)

FH is an online-first harness. Its memory entries point to live external resources (GitHub repos, arXiv records, Zenodo DOIs, monitoring routines). These drift faster than in offline systems — which makes hygiene both more necessary and more tractable (live re-verification is possible).

Trigger Conditions

Natural Language Triggers

PhraseIntent
"memory check", "check stale memories"Manual hygiene scan
"are my memories still accurate?"Full re-verification pass
"clean up memory", "memory audit"Propose archival candidates
"something in memory might be wrong"Targeted re-check

Automatic Trigger

  • harvest-loop Step 0-c: Runs automatically as the first step of every full harvest-loop
  • Cadence guard: Skip if memory-hygiene ran within the last 7 days (tracks/_meta/memory_hygiene_*.md mtime check)

Staleness Classification

TypeStaleness ThresholdRe-verification Method
project — status/milestone entries14 daysRe-read source file or live resource
reference — external URLs, DOIs, GitHub repos30 daysWebFetch or gh CLI check
feedback — operating rules90 daysGrep for contradicting evidence in recent sessions
user — user profile entries180 daysFlag only, no auto-verification

Execution Steps

Step 1 — Scan memory/*.md

Enumerate every root with a per-root state — an absent root and an empty root are different facts, and the Step-4 snapshot scope is bound to this enumeration:

bash
for ROOT in "$HOME"/.claude/projects/*/memory "$PWD/memory"; do
  if [ -d "$ROOT" ]; then
    n=$(ls "$ROOT"/*.md 2>/dev/null | wc -l | tr -d ' ')
    echo "EXISTS(n=$n) $ROOT"
  else
    echo "ABSENT       $ROOT"
  fi
done

ABSENT is never counted as 0 entries. Swallowing both into 2>/dev/null makes "this root does not exist here" indistinguishable from "this root is empty" — and the snapshot in Constraints below must cover every root reported EXISTS, so a root mis-rendered as empty silently narrows the snapshot scope.

For each file, extract:

  • metadata.type from frontmatter
  • Age source, in this order (measured over the live corpus, n=267): metadata.modified (ISO8601, present on 77/267) → else the file's filesystem mtime → else AGE-UNKNOWN. There is no top-level date: field in this corpus (measured 0/267) — do not look for one, and never treat AGE-UNKNOWN as fresh.
  • Key factual claims (GitHub URLs, status strings, version numbers, dates)

Step 2 — Classify by Staleness

Apply thresholds from the table above. Output a staleness roster:

STALE (>threshold):
  - api-migration-notes.md [feedback, 45d] — procedure may have changed
  - release-status.md [project, 16d] — status fields need live check
  - upstream-tracker.md [reference, 32d] — GitHub URL check needed

FRESH (<threshold):
  - user_role.md [user, 3d] — skip
  - fh-closed-loop-principle.md [feedback, 7d] — skip

Step 3 — Re-verify Stale Entries

For each stale entry, run the appropriate re-verification:

Reference type (URLs, DOIs, GitHub):

  • Use gh api for GitHub resources
  • Use WebFetch for DOIs and arXiv records
  • Mark metadata.verified_at: YYYY-MM-DD — nested under metadata:, the layer this corpus actually uses (metadata: present on 265/267; a top-level verified_at measured 0/267 and would be invisible to the Step-1 extractor)
  • Flag ⚠ DRIFTED if content has changed materially

Project type (status, milestones):

  • Cross-check against reference_next_session_starter.md and recent git log
  • Update or flag

Feedback type (rules):

  • Grep tracks/*/ for evidence contradicting the rule in last 30 days
  • If 2+ contradictions found → flag for human review (do not auto-modify)

Step 4 — Propose Actions (User Gate)

Present findings in this format:

memory-hygiene scan complete: N entries checked
  VERIFIED (no change needed): N
  UPDATED (refreshed verified_at): N
  ⚠ DRIFTED (content changed — needs human review): N
  📦 ARCHIVE CANDIDATE (no activity in Xd, superseded): N

Proposed changes:
  1. arxiv-submission-status.md — update status fields [auto-apply?]
  2. harness-federation-sync-plan.md — CLOSED flag still accurate? [confirm]
  ...

Apply updates? [y / N per item]

Step 5 — Record Run

Use printf, never echo "…\n…" — echo expands \n in zsh but writes it literally in bash (measured: 6 lines vs 1), which silently produces a one-line file with a broken frontmatter.

bash
mkdir -p tracks/_meta
printf '%s\n' \
  '---' \
  "date: $(date +%Y-%m-%d)" \
  "entries_checked: ${ENTRIES_CHECKED}" \
  "demoted_to_archive: ${DEMOTED}" \
  "orphans_indexed: ${ORPHANS}" \
  "merged: ${MERGED}" \
  "drifted: ${DRIFTED}" \
  "hard_deleted: ${HARD_DELETED}" \
  '---' \
  > "tracks/_meta/memory_hygiene_$(date +%Y-%m-%d).md"

Every count is a measured value from Steps 1–4. A log still containing a literal N (or an unexpanded ${…}) is an invalid log — treat that run as not-recorded, because the log's existence is what arms the 7-day cadence guard, so a placeholder log suppresses the next real run.

Constraints

  • No auto-deletion: Archive candidates are proposed, not deleted. Human confirmation required.

  • Snapshot before archive (Destructive-Op Gate for memory): before applying any confirmed archive/removal in Step 4, snapshot every memory root the entry could live in first — tar all roots Step 1 enumerated (~/.claude/projects/*/memory/ AND hub-local memory/), not just one: the snapshot must be gated on its own exit status — an unwritable or missing tracks/_meta makes tar exit 1 and produce no tarball (measured), and without a gate the irreversible archive proceeds anyway:

    bash
    SNAP="tracks/_meta/memory_snapshot_$(date +%Y%m%d-%H%M%S).tgz"
    mkdir -p tracks/_meta || { echo "SNAPSHOT FAILED (mkdir) — abort archive"; exit 1; }
    tar czf "$SNAP" <each Step-1 root reported EXISTS> || { echo "SNAPSHOT FAILED (tar) — abort archive"; exit 1; }
    [ -s "$SNAP" ] || { echo "SNAPSHOT FAILED (empty tarball) — abort archive"; exit 1; }
    echo "SNAPSHOT OK: $SNAP"

    Only on SNAPSHOT OK may the archive proceed — so a wrong archive in any scanned root is one-command recoverable (a single-root snapshot can pass while the archived entry lived in the other root — bind the scope to the entry, not to "a tarball exists"). Archive moves entries to a .archive/ sibling, never hard-deletes (mirrors the Curator's tar-before-pass + rollback discipline; the Step 2 staleness thresholds are already the mechanical no-LLM pre-pass that the judged Step 3 re-verify sits on top of — order preserved: mechanical roster first, judged re-verify second).

  • Feedback type: Never auto-modify feedback rules — flag only.

  • Simplification guard: If 0 stale entries found, output one line "memory-hygiene: all fresh" and exit.

  • FH online advantage: Unlike offline harnesses, FH can re-verify external references live. Use this — don't skip external checks.

Done When

ConditionCheck class
Step 1~5 complete, every memory root reported EXISTS(n=…) or ABSENTmandatory-pass
Staleness roster output (Step 2 = mechanical no-LLM pre-pass), with AGE-UNKNOWN entries listed separately and not as FRESHmeasured (age from metadata.modified / mtime, not recall)
Re-verification run for all STALE entriesmandatory-pass
Each re-verified entry's verdict (VERIFIED / DRIFTED) is correctjudged — adversarial pairing: fh-meta:fact-checker re-greps the hub for the same claim; any disagreement downgrades the entry to DRIFTED (no judge-only PASS)
User gate presented and responded to (y/N per item)mandatory-pass
If any archive confirmed: snapshot written and its exit status checked before the move (tracks/_meta/memory_snapshot_*.tgz, spanning every root reported EXISTS)mandatory-pass — snapshot must cover the archived entry's dir; SNAPSHOT OK printed, not merely "a tarball exists"
Hygiene log written to tracks/_meta/memory_hygiene_{date}.md with real counts (no literal N, no unexpanded ${…})measured

References

  • Theoretical basis: Scaling the Harness in Agentic AI (arXiv:2605.26112) §Memory Problems — "stale-but-confident" failure mode
  • Integrates with: harvest-loop Step 0-c · context-doctor (context layer hygiene)
  • Memory format: ~/.claude/projects/*/memory/MEMORY.md

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

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

Detects "stale-but-confident" memory entries — facts that were once verified but have silently drifted. Scans memory/*.md for entries past their staleness threshold and proposes re-verification or archival. Runs automatically as part of harvest-loop Step 0-c and on explicit invocation.

Vì sao nên dùng Memory Hygiene 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 Hygiene 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 Hygiene trong TypingMind?

Mở Plugin → Kỹ năng → Cài đặt từ GitHub trong TypingMind rồi dán https://github.com/chrono-meta/forge-harness/tree/main/plugins/fh-meta/skills/memory-hygiene. TypingMind đọc tệp SKILL.md rồi cài đặt kỹ năng để 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 Hygiene?

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 Hygiene 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 Hygiene 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 Hygiene có miễn phí không?

Có. Kỹ năng này được chrono-meta 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 👇