plugins/agent-agentic-os/skills/os-memory-manager/SKILL.md
Trigger with "remember this", "update memory", "what should we record from this session", "capture learnings", "write a session log", or when closing a session. Guides agents on managing memory hygiene across sessions, deciding what to write to dated memory logs, what to promote to long-term memory.md, and when to archive. <example> User: I'm done for the day, can you write up a session log? Agent: <Bash> python context/kernel.py emit_event --agent os-memory-manager --type intent --action promote_memory python context/kernel.py state_update active_agent os-memory-manager </Bash> </example> <example> User: That's all, logging off now. Agent: <Bash> python context/kernel.py acquire_lock memory </Bash> </example> <example> User: How does the memory system work? Agent: <Read> ./references/architecture/context-folder-patterns.md </Read> </example>
npx skillsauth add richfrem/agent-plugins-skills os-memory-managerInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
This skill requires the Agentic OS to be initialized first. It calls context/kernel.py, context/memory.md, and context/.locks/ — files that only exist after running the os-init skill in your project.
If you have not yet initialized the OS, run:
os-init
This skill requires Python 3.8+ and standard library only. No external packages needed.
To install this skill's dependencies:
pip-compile ./requirements.in
pip install -r ./requirements.txt
See ./requirements.txt for the dependency lockfile (currently empty — standard library only).
Manages the three tiers of agent memory in an Agentic OS environment.
| Tier | File | Written By | When Loaded |
|------|------|-----------|-------------|
| Auto-memory | MEMORY.md | Claude automatically | Every session (Anthropic native) |
| Long-term facts | context/memory.md | You (curated) | @imported in CLAUDE.md |
| Session logs | context/memory/YYYY-MM-DD.md | Agent at session close | On demand |
Execute these phases in order. Do not skip phases.
Before taking any actions, you MUST publish your intent to the Event Bus.
Use the Bash tool to run:
python context/kernel.py emit_event --agent os-memory-manager --type intent --action promote_memory
python context/kernel.py state_update active_agent os-memory-manager, python context/kernel.py state_update mode memory-gc, and python context/kernel.py state_update memory_gc_due false.python context/kernel.py acquire_lock memory using the Bash tool to acquire the lock. If it fails, abort. The kernel handles stale lock timeouts automatically.context/memory.md)context/memory.md)Write to context/memory/YYYY-MM-DD.md. Use today's date.
Use this template:
# Session Log: YYYY-MM-DD
## Summary
[1-2 sentence summary of what was accomplished]
## Key Decisions
- [Decision 1 and its rationale]
- [Decision 2 and its rationale]
## Lessons Learned
- [Lesson or edge case discovered]
## Skills Updated
- [Skill name]: [what changed]
## Open Items
- [ ] [Next steps or follow-up tasks]
Before general promotion, handle test registry files specially:
context/memory/tests/registry.md — never archive, never skip. This is always L3.
Verify it exists and the latest cycle row is CLOSED before proceeding.context/memory/tests/[CYCLE_ID]_*.md) — preserve in place
for 90 days, then move to context/memory/tests/archive/. Never delete.context/memory.md. If not,
promote it as a fact with the cycle ID as evidence source.context/memory.md for a "DO NOT RE-TEST" entry.
If missing, add it now to prevent future wasted cycles.For each item in the session log, apply the promote/skip decision:
If a fact is selected for promotion, you MUST first read context/memory.md AND the last 10 entries of MEMORY.md:
context/memory.md (e.g., if the highest is [#042], assign [#043]) to prevent syntactic duplication. Ensure this ID prefix [#ID] is stored with the fact. Let the user know the generated ID. Use grep -c "^\[#" via Bash if you need help finding the count.grep -ri "[Fact Keywords]" ./skills/ using the Bash tool to ensure promoted memory doesn't break or contradict existing procedural skills.<CONFLICT> before any Write. Ask the user if the new proposed fact supersedes the existing fact (to replace the old hash) or if it's a conflict to resolve. If superseding, you MUST output a <SUPERSEDE old_id=NNN> marker (e.g., <SUPERSEDE old_id=042>) so the next learning loop can locate and prune the old fact. Never silently overwrite — the marker is required for audit trail continuity.Write in a git stash + diff preview (use Bash tool). If the user rejects the preview, run git stash pop to rollback.Read tool on the exact file. If the expected diff is not present, output <WRITE_FAILED> and run git stash pop.Format facts in context/memory.md like this (choose one format and stick to it):
Option A — Markdown (default, human-readable):
## [YYYY-MM-DD] [Topic]
[The fact, decision, or convention in 1-3 sentences]
Option B — Structured JSON entries (recommended for projects with high fact volume or automated tooling):
{"id": "build_cmd_001", "type": "command", "topic": "build", "value": "npm run build", "source": "session-2026-03-19", "supersedes": null}
Append one JSON object per line to a context/memory.jsonl file. Reference it from context/memory.md with a note: <!-- structured facts in context/memory.jsonl -->. Benefits: unambiguous deduplication by id, machine-queryable, easier <SUPERSEDE> enforcement.
You MUST verify the size of the curated memory file to prevent context degradation.
wc -c context/memory.md using the Bash tool to check the exact byte size.
(Line count is unreliable on Windows due to CRLF line endings; byte size is platform-neutral.)mkdir -p context/memory/archive/context/memory/archive/YYYY-MM.md using Write.context/memory.md using Write.<!-- Archived data -> context/memory/archive/ -->) exists at the top of context/memory.md.Before releasing the lock, complete the Post-Run Self-Assessment Survey
(references/memory/post_run_survey.md). The memory manager must reflect on its own runs
to improve the quality of what gets promoted and what gets skipped.
Count-Based Signals: How many times were you uncertain whether to promote or skip? How many potential conflicts did you flag? How many dedup IDs did you assign?
Qualitative Friction:
Improvement Recommendation: What one change to this skill should be tested next run?
Save to: ${CLAUDE_PROJECT_DIR}/context/memory/retrospectives/survey_[YYYYMMDD]_[HHMM]_os-memory-manager.md
Emit survey completion:
python context/kernel.py emit_event --agent os-memory-manager \
--type learning --action survey_completed \
--summary "retrospectives/survey_[DATE]_[TIME]_os-memory-manager.md"
After writing and survey saved, show a summary:
[x] Session log written: context/memory/YYYY-MM-DD.md
[x] Promoted N facts to context/memory.md
[x] Survey saved: retrospectives/survey_[DATE]_[TIME]_os-memory-manager.md
[ ] No archive needed (current count: N facts)
Event Bus Publish: Use Bash to emit your success result:
python context/kernel.py emit_event --agent os-memory-manager --type result --action promote_memory --status success
Finally, Lock Release Protocol: Execute python context/kernel.py release_lock memory to release the acquired loop lock.
os-guide skillreferences/architecture/claude-md-hierarchy.md in os-guidetools
Ingests repository files into the ChromaDB vector store. Builds or updates the vector index from a manifest or directory scan using ingest.py. Use when new files need to be indexed or the vector store is out of date. <example> user: "Index these new plugin files into the vector database" assistant: "I'll use vector-db-ingest to add them to the vector store." </example> <example> user: "The vector store is missing recent files -- update it" assistant: "I'll use vector-db-ingest to re-index the changes." </example>
data-ai
Removes stale and orphaned chunks from the ChromaDB vector store for files that have been deleted or renamed. Use after files are removed or moved to keep the vector index in sync with the filesystem. <example> user: "Clean up the vector store after I deleted some files" assistant: "I'll use vector-db-cleanup to remove orphaned chunks." </example> <example> user: "The vector database has chunks for files that no longer exist" assistant: "I'll run vector-db-cleanup to prune them." </example>
testing
Audit Vector DB coverage -- compares the live filesystem manifest against the ChromaDB index to identify coverage gaps.
development
3-Phase Knowledge Search strategy for the RLM Factory ecosystem. Auto-invoked when tasks involve finding code, documentation, or architecture context in the repository. Enforces the optimal search order: RLM Summary Scan (O(1)) -> Vector DB Semantic Search -> Grep/Exact Match. Never skip phases.