crux-skill-memory-reference-tracker
Skill8 starsChanged 2 months agoMITView on GitHub
Track which memories are referenced in agent output, manage .refs.yml tracker files, and keep strength counters in sync with memory frontmatter. Use when recording a memory reference, cleaning up orphaned trackers during REM sleep, or checking whether a memory should be promoted to a permanent rule.
In this repository35 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .cursor/rules/crux-memories-integration.crux.mdcCursor rule
- .cursor/rules/crux-memories-integration.mdCursor rule
- .cursor/rules/_CRUX-RULE.mdcCursor rule
- .cursor/rules/docs-sync.crux.mdCursor rule
- .cursor/rules/docs-sync.crux.mdcCursor rule
- .cursor/rules/docs-sync.mdCursor rule
- .cursor/rules/example/coding-standards-demo.crux.mdcCursor rule
- .cursor/rules/example/coding-standards-demo.mdCursor rule
- .cursor/rules/ignore-example-rules.crux.mdCursor rule
- .cursor/rules/ignore-example-rules.crux.mdcCursor rule
- .cursor/rules/ignore-example-rules.mdCursor rule
- .cursor/rules/skill-and-agent-references.mdcCursor rule
- .cursor/rules/spec-agent-allocation.crux.mdCursor rule
- .cursor/rules/spec-agent-allocation.crux.mdcCursor rule
- .cursor/rules/spec-agent-allocation.mdCursor rule
- .cursor/rules/spec-implementation-hygiene.mdcCursor rule
- .cursor/rules/version-bump.crux.mdCursor rule
- .cursor/rules/version-bump.crux.mdcCursor rule
- .cursor/rules/version-bump.mdCursor rule
- .cursor/rules/zip-contents-protection.crux.mdCursor rule
- .cursor/rules/zip-contents-protection.crux.mdcCursor rule
- .cursor/rules/zip-contents-protection.mdCursor rule
- crux-skill-memory-compressSkill
- crux-skill-memory-crudSkill
- crux-skill-memory-extractSkill
- crux-skill-memory-indexSkill
- crux-skill-memory-meditation-coordinationSkill
- crux-skill-memory-meditation-ensembleSkill
- crux-skill-memory-meditation-quickSkill
- crux-skill-memory-meditation-reportSkill
- crux-skill-memory-meditation-researchSkill
- crux-skill-memory-meditation-reviewSkill
- crux-skill-memory-rebalanceSkill
- crux-utilsSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
20 rules. About 0 are common, 4 are distinctive, and 16 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈4
Distinctive · estimate
This author's own choices. Worth a look.
16
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 20
Read config from .crux/crux-memories.json.
- Very specific: line 27
Update recent_references (see Manage Recent References).
- Distinctive: line 29
Write the updated tracker file.
- Very specific: line 30
Check whether references now exceeds promotionToRuleThreshold (see Promotion Flag).
- Very specific: line 36
Instruction to agents: When your response is influenced by a loaded memory, include the configured indicator in your output.
- Very specific: line 46
When indicateInOutput is false, do not add any annotation — still record the reference via the tracker, but omit the visible indicator.
- Very specific: line 54
Read the memory file's frontmatter to get the current strength value.
- Very specific: line 56
If operating within a unit of work (e.g.
- Very specific: line 57
If in a standalone conversation, use conversation_id: "{id}".
- Very specific: line 58
Write the new .refs.yml file:
- Very specific: line 72
If the agent has context about how the memory was used, add context: "brief description" to the entry.
- Very specific: line 83
Search recent_references for an existing entry matching the source.
- Very specific: line 87
If the list exceeds maxReferencesStored, remove entries from the tail (lowest count).
- Very specific: line 113
Read the memory file's frontmatter strength value.
- Very specific: line 114
Write that value into the tracker file's strength field.
- Very specific: line 126
Search the memory directories (configured memoriesDir and agentMemoriesDir, recursively) for a matching {slug}.memory.md or …
- Distinctive: line 127
If no matching memory file exists, the tracker is orphaned — recommend it for deletion.
- Distinctive: line 129
Delete confirmed orphaned tracker files.
- Very specific: line 133
When: After updating a tracker, references exceeds promotionToRuleThreshold.
- Distinctive: line 149
Every tracker file follows this exact structure:
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
CRUX Skill: Memory Reference Tracker
Manages per-memory reference tracking files (.refs.yml) in the configured trackingDir. Tracker files are the single source of truth for how often, how recently, and by whom a memory was referenced. Memory frontmatter stays clean — it stores what a memory is, not how often it is used.
Config keys and defaults: see
.cursor/skills/_memory-shared.md#config-referenceand.crux/crux-memories.json(authoritative). This skill reads keys undercruxMemories.referenceTracking.*pluscruxMemories.unitOfWork(which determines the key name used inrecent_references[]source entries).
Operations
1. Record Reference
When: An agent's output is influenced by a memory.
Steps:
- Read config from
.crux/crux-memories.json. IfreferenceTracking.enabledisfalse, skip all tracking. - Determine the memory slug from the memory filename (strip
.memory.mdor.memory.crux.mdsuffix and any path prefix). - Look for
{trackingDir}/{slug}.refs.yml.- If it does not exist — create it (see Lazy Creation).
- If it exists — read and update it.
- Increment the
referencescounter by 1. - Set
last_referencedto today's date (YYYY-MM-DD). - Update
recent_references(see Manage Recent References). - Sync
strengthfrom the memory file's frontmatter into the tracker (see Sync Strength). - Write the updated tracker file.
- Check whether
referencesnow exceedspromotionToRuleThreshold(see Promotion Flag).
2. Indicate in Output
When: referenceTracking.indicateInOutput is true and an agent's output is influenced by a memory.
Instruction to agents: When your response is influenced by a loaded memory, include the configured indicator in your output. The default format is [memory:{title}], where {title} is replaced with the memory's title frontmatter field.
Example with default format:
The list component should use React.memo with a custom comparator
that checks item ID and version rather than deep-equaling props.
[memory:React.memo on list item components prevents full re-render on data changes]When indicateInOutput is false, do not add any annotation — still record the reference via the tracker, but omit the visible indicator.
3. Lazy Creation
Tracker files are created on first reference. Unreferenced memories have no tracker file and incur zero overhead.
When creating a new tracker file:
- Read the memory file's frontmatter to get the current
strengthvalue. - Determine the source identifier:
- If operating within a unit of work (e.g. a spec), use
{unitOfWork}: "{id}"(e.g.spec: "20260403-crux-memories"). - If in a standalone conversation, use
conversation_id: "{id}".
- If operating within a unit of work (e.g. a spec), use
- Write the new
.refs.ymlfile:
# Managed by crux-skill-memory-reference-tracker — do not edit manually
slug: {slug}
references: 1
last_referenced: {YYYY-MM-DD}
strength: {strength from memory frontmatter}
recent_references:
- {unitOfWork}: "{source-id}"
count: 1
last: {YYYY-MM-DD}If the agent has context about how the memory was used, add context: "brief description" to the entry.
4. Manage Recent References
The recent_references list is a capped, sorted list of the top referrers for this memory.
Update logic:
- Determine the current source:
- Within a unit of work → key is the configured
unitOfWorkvalue (e.g.spec), value is the work ID. - Standalone conversation → key is
conversation_id, value is the conversation ID.
- Within a unit of work → key is the configured
- Search
recent_referencesfor an existing entry matching the source.- If found: increment its
count, update itslastdate. If context is available and the entry lacks one, add it. - If not found: append a new entry with
count: 1,last: {today}, and optionalcontext.
- If found: increment its
- Sort the list by
countdescending (highest referrer first). - If the list exceeds
maxReferencesStored, remove entries from the tail (lowest count).
Entry format:
- spec: "20260403-component-library" # key matches unitOfWork config
count: 5
last: 2026-04-03
context: "Applied memoization pattern to data grid component"Or for standalone conversations:
- conversation_id: "a3f7b2c"
count: 3
last: 2026-03-30
context: "Discussed memoization strategy for data table components"5. Sync Strength
The tracker file's strength field must stay in sync with the memory frontmatter's strength field. The memory frontmatter is the authoritative source.
When recording a reference:
- Read the memory file's frontmatter
strengthvalue. - Write that value into the tracker file's
strengthfield.
This ensures the tracker always reflects the current strength, even if another skill (e.g. crux-skill-memory-rebalance) has modified the memory's strength since the last reference.
6. Cleanup (REM Sleep)
When: Called during REM sleep (/crux-dream --rem).
Steps:
- List all
*.refs.ymlfiles intrackingDir. - For each tracker file, extract the
slug. - Search the memory directories (configured
memoriesDirandagentMemoriesDir, recursively) for a matching{slug}.memory.mdor{slug}.memory.crux.mdfile. - If no matching memory file exists, the tracker is orphaned — recommend it for deletion.
- Present orphaned trackers to the user (or auto-delete in
--yolomode). - Delete confirmed orphaned tracker files.
7. Promotion to Rule Flag
When: After updating a tracker, references exceeds promotionToRuleThreshold.
Action: Flag the memory for potential promotion to a permanent Cursor rule (.cursor/rules/*.mdc).
Report to the user:
⚡ Memory "{title}" has been referenced {references} times
(threshold: {promotionToRuleThreshold}).
Consider promoting it to a permanent rule in .cursor/rules/This flag is advisory — the user decides whether to promote. The skill does not automatically create rules.
.refs.yml File Format
Every tracker file follows this exact structure:
# Managed by crux-skill-memory-reference-tracker — do not edit manually
slug: react-memo-list-rendering
references: 12
last_referenced: 2026-04-03
strength: 3
recent_references:
- spec: "20260403-component-library"
count: 5
last: 2026-04-03
- spec: "20260401-dashboard-performance"
count: 4
last: 2026-04-01
- conversation_id: "a3f7b2c"
count: 3
last: 2026-03-30
context: "Discussed memoization strategy for data table components"| Field | Type | Description |
slug | string | Memory slug — matches the filename stem, stable identifier |
references | integer | Total reference count across all sessions and sources |
last_referenced | date | Date of most recent reference (YYYY-MM-DD) |
strength | integer | Current strength score, synced from memory frontmatter |
recent_references | list | Top N referrers sorted by count descending (capped by maxReferencesStored) |
recent_references entry fields:
| Field | Type | Required | Description |
{unitOfWork} or conversation_id | string | Yes | Source identifier — key name matches config unitOfWork (e.g. spec) or conversation_id for standalone sessions |
count | integer | Yes | Number of references from this source |
last | date | Yes | Date of most recent reference from this source |
context | string | No | Brief description of how the memory was used |
Out-of-scope and cross-skill delegation: see
.cursor/skills/_memory-shared.md#cross-skill-boundariesand the agent table inAGENTS.md.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

