agentsclimarketplace

Memory management

Skill xiaolai/echo-sleuth-for-claude/skills/memory-management

Use when auditing, extracting, pruning, or writing Claude Code memory files. Covers memory file format, MEMORY.md index conventions, staleness scoring, claim extraction heuristics, destination routing, mutation rules, and archive conventions.From its SKILL.md

Install
npx -y skills add xiaolai/echo-sleuth-for-claude --skill memory-management

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 7 stars7 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

SKILL.md

4.0 KB, as published. Nobody here has run it

Memory Management

Memory File Format

Frontmatter schema (simple key: value, NOT general YAML):

---
name: <string, required>           # short identifier
description: <string, required>    # one-line summary for relevance matching
type: <enum, required>             # value | user | feedback | project | reference
---
  • All values are plain strings, no quoting needed unless value contains :
  • No nested structures, no lists, no multi-line values
  • Body follows after the closing --- delimiter as markdown

MEMORY.md Index Format

  • Plain markdown file, no frontmatter
  • Contains links to individual memory files with brief descriptions
  • Lines after 200 are truncated by Claude Code's loader — keep concise
  • Entry format: - [filename.md](filename.md) — brief description
  • When writing: create individual .md file first, then append entry

Staleness Scoring

Exponential decay: score = 100 * (1 - exp(-age_days * ln(2) / half_life))

TypeHalf-lifeScore 50 atScore 90 at
value365 days365d~1213d
user180 days180d~598d
feedback90 days90d~299d
reference60 days60d~199d
project14 days14d~47d
unknown30 days30d~100d

Score-to-action: 0-50 = keep, 50-75 = review, 75-100 = prune.

Deep verification modifiers (additive, capped at 100):

  • +20 if referenced file is missing
  • +30 if referenced function/class not found
  • +10 if URL returns non-200
  • +15 if referenced branch doesn't exist

Claim Extraction Heuristics (Deep Audit)

Claim TypeDetection PatternVerification
File pathContains /, ends with file extensionGlob for existence
Function/classBacktick identifier in camelCase/PascalCase/snake_caseGrep in project
URLStarts with http:// or https://curl HEAD request
BranchAfter "branch" keyword or git pattern in backticksgit branch -a
PackageIn dependency/package contextGrep in manifest files

Skip generic descriptions that aren't verifiable (e.g., "use a database" vs "uses PostgreSQL 15").

Destination Routing

DestinationWhen to UseTarget Path
Memory file (value)Learned value choices — "X is better than Y"Session's project memory/ dir, type=value
Memory fileKnowledge for Claude's future behaviorSession's project memory/ dir
CLAUDE.mdHigh-impact instructions for every conversationSession's project root CLAUDE.md
Knowledge fileHuman-readable notes, decision logsdocs/knowledge/ in project root
SkipSession-specific, not worth preserving—

Priority: Value choices are the most durable memories. When extracting, surface them first. Facts decay (files move, APIs change); values persist (readability > cleverness survives any rewrite).

Rule: Always target the session's originating project, not the current shell cwd.

Mutation Rules

LayoutHow to Write
Index + filesCreate .md file with frontmatter, append to MEMORY.md
Standalone MEMORY.mdConvert to index layout: create first .md file, rewrite MEMORY.md as index
No memory dirCreate memory/, create MEMORY.md, create .md file
Malformed frontmatterRead as type=unknown. Never corrupt existing files.

Archive Convention

  • Location: memory/archive/ subdirectory
  • Files preserved intact (frontmatter + content)
  • MEMORY.md entry removed on archive
  • iter_memories() skips archive/ — invisible to dashboard/audit/tokens
  • Standalone MEMORY.md: archiving not supported (offer delete or keep)
  • Restore: manual move from archive/ + re-add to MEMORY.md

Keep looking

Skills are one crate of 627,801. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.