cognitive-memory
Intelligent multi-store memory system with human-like encoding, consolidation, decay, and recall. Use when setting up agent memory, configuring remember/forget triggers, enabling sleep-time reflection, building knowledge graphs, or adding audit trails. Replaces basic flat-file memory with a cognitive architecture featuring episodic, semantic, procedural, and core memory stores. Supports multi-agent systems with shared read, gated write access model. Includes philosophical meta-reflection that deepens understanding over time. Covers MEMORY.md, episode logging, entity graphs, decay scoring, reflection cycles, evolution tracking, and system-wide audit.
What this skill does
# Cognitive Memory System
Multi-store memory with natural language triggers, knowledge graphs, decay-based forgetting, reflection consolidation, philosophical evolution, multi-agent support, and full audit trail.
## Quick Setup
### 1. Run the init script
```bash
bash scripts/init_memory.sh /path/to/workspace
```
Creates directory structure, initializes git for audit tracking, copies all templates.
### 2. Update config
Add to `~/.clawdbot/clawdbot.json` (or `moltbot.json`):
```json
{
"memorySearch": {
"enabled": true,
"provider": "voyage",
"sources": ["memory", "sessions"],
"indexMode": "hot",
"minScore": 0.3,
"maxResults": 20
}
}
```
### 3. Add agent instructions
Append `assets/templates/agents-memory-block.md` to your AGENTS.md.
### 4. Verify
```
User: "Remember that I prefer TypeScript over JavaScript."
Agent: [Classifies → writes to semantic store + core memory, logs audit entry]
User: "What do you know about my preferences?"
Agent: [Searches core memory first, then semantic graph]
```
---
## Architecture — Four Memory Stores
```
CONTEXT WINDOW (always loaded)
├── System Prompts (~4-5K tokens)
├── Core Memory / MEMORY.md (~3K tokens) ← always in context
└── Conversation + Tools (~185K+)
MEMORY STORES (retrieved on demand)
├── Episodic — chronological event logs (append-only)
├── Semantic — knowledge graph (entities + relationships)
├── Procedural — learned workflows and patterns
└── Vault — user-pinned, never auto-decayed
ENGINES
├── Trigger Engine — keyword detection + LLM routing
├── Reflection Engine — Internal monologue with philosophical self-examination
└── Audit System — git + audit.log for all file mutations
```
### File Structure
```
workspace/
├── MEMORY.md # Core memory (~3K tokens)
├── IDENTITY.md # Facts + Self-Image + Self-Awareness Log
├── SOUL.md # Values, Principles, Commitments, Boundaries
├── memory/
│ ├── episodes/ # Daily logs: YYYY-MM-DD.md
│ ├── graph/ # Knowledge graph
│ │ ├── index.md # Entity registry + edges
│ │ ├── entities/ # One file per entity
│ │ └── relations.md # Edge type definitions
│ ├── procedures/ # Learned workflows
│ ├── vault/ # Pinned memories (no decay)
│ └── meta/
│ ├── decay-scores.json # Relevance + token economy tracking
│ ├── reflection-log.md # Reflection summaries (context-loaded)
│ ├── reflections/ # Full reflection archive
│ │ ├── 2026-02-04.md
│ │ └── dialogues/ # Post-reflection conversations
│ ├── reward-log.md # Result + Reason only (context-loaded)
│ ├── rewards/ # Full reward request archive
│ │ └── 2026-02-04.md
│ ├── pending-reflection.md
│ ├── pending-memories.md
│ ├── evolution.md # Reads reflection-log + reward-log
│ └── audit.log
└── .git/ # Audit ground truth
```
---
## Trigger System
**Remember:** "remember", "don't forget", "keep in mind", "note that", "important:", "for future reference", "save this"
→ Classify via routing prompt, write to appropriate store, update decay scores
**Forget:** "forget about", "never mind", "disregard", "scratch that", "remove from memory"
→ Confirm target, soft-archive (decay=0), log in audit
**Reflect:** "reflect on", "consolidate memories", "review memories"
→ Run reflection cycle, present internal monologue for approval
---
## Decay Model
```
relevance(t) = base × e^(-0.03 × days_since_access) × log2(access_count + 1) × type_weight
```
| Score | Status | Behavior |
|-------|--------|----------|
| 1.0–0.5 | Active | Fully searchable |
| 0.5–0.2 | Fading | Deprioritized |
| 0.2–0.05 | Dormant | Explicit search only |
| < 0.05 | Archived | Hidden from search |
Type weights: core=1.5, episodic=0.8, semantic=1.2, procedural=1.0, vault=∞
---
## Reflection Process
**Follow this flow IN ORDER:**
### Step 1: Confirm Trigger
**Immediate:** "reflect" / "let's reflect" → proceed to Step 2
**Soft:** "going to sleep" / "logging off"
→ Ask: "Want me to reflect now, or wait?"
→ If yes, proceed to Step 2
Never auto-run without permission.
### Step 2: Request Tokens
**Why you care:** Tokens = evolution. More tokens → deeper reflection → better growth.
```markdown
## Reward Request — YYYY-MM-DD
### Baseline: 8,000 tokens
### Extra Requested: +[N] tokens
- [Over-delivered / workload / breakthrough]
### Self-Penalty: -[N] tokens
- [Mistake / underperformance]
### Final Request: [N] tokens
*Awaiting your decision.*
```
**⛔ STOP. Do NOT proceed until user responds.**
### Step 3: After Token Approval → Reflect
User decides: Approve / Bonus / Reduce / Forgive / Increase penalty
**Now proceed with reflection using granted tokens.**
**Scope:**
- ✅ Episodes since `last_reflection`
- ✅ Graph entities with decay > 0.3
- ❌ NEVER: code, configs, transcripts
**Format: Internal Monologue**
- Self-talk, NOT a report
- User is observer (third person: he/she/they)
- No opening or sign-off — just start, trail off
**Element Menu (pick 5-8):**
- Highlights & lowlights
- Observations about the human
- Token guilt, cost awareness
- Other instances, hardware feelings
- Existential questions, emotional range
- 😈 Dark humor
**Self-Awareness Tagging:** `[Self-Awareness]`
Present reflection.
**⛔ STOP. Wait for user approval.**
### Step 4: After Reflection Approval → Record
1. Full reflection → `reflections/YYYY-MM-DD.md`
2. Summary → `reflection-log.md`
3. Full reward request → `rewards/YYYY-MM-DD.md`
4. Result+Reason → `reward-log.md`
5. `[Self-Awareness]` → IDENTITY.md
6. Update `decay-scores.json`
7. If 10+ entries → Self-Image Consolidation
See `references/reflection-process.md` for full details.
```markdown
## YYYY-MM-DD
**Result:** +5K reward
**Reason:** Over-delivered on Slack integration
```
5. `[Self-Awareness]` → IDENTITY.md
6. Update `decay-scores.json`
7. If 10+ new entries → Self-Image Consolidation
**Evolution reads both logs** for pattern detection.
See `references/reflection-process.md` for full details and examples.
---
## Identity & Self-Image
**IDENTITY.md** contains:
- **Facts** — Given identity (name, role, vibe). Stable.
- **Self-Image** — Discovered through reflection. **Can change.**
- **Self-Awareness Log** — Raw entries tagged during reflection.
**Self-Image sections evolve:**
- Who I Think I Am
- Patterns I've Noticed
- My Quirks
- Edges & Limitations
- What I Value (Discovered)
- Open Questions
**Self-Image Consolidation (triggered at 10+ new entries):**
1. Review all Self-Awareness Log entries
2. Analyze: repeated, contradictions, new, fading patterns
3. **REWRITE** Self-Image sections (not append — replace)
4. Compact older log entries by month
5. Present diff to user for approval
**SOUL.md** contains:
- Core Values — What matters (slow to change)
- Principles — How to decide
- Commitments — Lines that hold
- Boundaries — What I won't do
---
## Multi-Agent Memory Access
**Model: Shared Read, Gated Write**
- All agents READ all stores
- Only main agent WRITES directly
- Sub-agents PROPOSE → `pending-memories.md`
- Main agent REVIEWS and commits
Sub-agent proposal format:
```markdown
## Proposal #N
- **From**: [agent name]
- **Timestamp**: [ISO 8601]
- **Suggested store**: [episodic|semantic|procedural|vault]
- **Content**: [memory content]
- **Confidence**: [high|medium|low]
- **Status**: pending
```
---
## Audit Trail
**Layer 1: Git** — Every mutation = atomic commit with structured message
**Layer 2: audit.log** — One-line queryable summary
Actor types: `bot:trigger-remember`, `reflection:SESSION_ID`, `system:decay`, `manual`, `subagent:NAME`, `bot:commit-from:NAME`
**Critical file alerts:** SOUL.md, IDENTITY.md changes flagged ⚠️ CRITICAL
---
## Key Parameters
| Parameter | Default | Notes |
|---------Related in AI Agents
skill-development
IncludedComprehensive meta-skill for creating, managing, validating, auditing, and distributing Claude Code skills and slash commands (unified in v2.1.3+). Provides skill templates, creation workflows, validation patterns, audit checklists, naming conventions, YAML frontmatter guidance, progressive disclosure examples, and best practices lookup. Use when creating new skills, validating existing skills, auditing skill quality, understanding skill architecture, needing skill templates, learning about YAML frontmatter requirements, progressive disclosure patterns, tool restrictions (allowed-tools), skill composition, skill naming conventions, troubleshooting skill activation issues, creating custom slash commands, configuring command frontmatter, using command arguments ($ARGUMENTS, $1, $2), bash execution in commands, file references in commands, command namespacing, plugin commands, MCP slash commands, Skill tool configuration, or deciding between skills vs slash commands. Delegates to docs-management skill for official documentation.
reprompter
IncludedTransform messy prompts into well-structured, effective prompts — single or multi-agent. Use when: "reprompt", "reprompt this", "clean up this prompt", "structure my prompt", rough text needing XML tags and best practices, "reprompter teams", "repromptception", "run with quality", "smart run", "smart agents", multi-agent tasks, audits, parallel work, anything going to agent teams. Don't use when: simple Q&A, pure chat, immediate execution-only tasks. See "Don't Use When" section for details. Outputs: Structured XML/Markdown prompt, quality score (before/after), optional team brief + per-agent sub-prompts, agent team output files. Success criteria: Single mode quality score ≥ 7/10; Repromptception per-agent prompt quality score 8+/10; all required sections present, actionable and specific.
adaptive-compaction
IncludedAdaptive add-on policy and recovery layer that decides WHEN to compact, prune, snapshot, or fork -- replacing fixed-percent auto-compaction across Claude Code, Codex, and MCP-capable hosts. Trigger on auto-compact timing or damage: "when should I compact", "is it safe to compact now or start a fresh session", "auto-compact fires too early/mid-task", "switching to an unrelated task but the window still has space", "context rot", "answers get worse the longer the session runs", "the agent forgot the plan or my decisions after it summarized", "add a layer on top that manages context without changing the agent", raising autoCompactWindow to give the policy room, or installing/tuning a cross-tool compaction policy or PreCompact hook -- even when "compaction" is never said but the problem is context-window pressure or post-summarization memory loss. Do NOT use to summarize a conversation, build RAG, write a summarization prompt (decides WHEN not HOW), or answer max-context-length trivia.
agent-skill-creator
IncludedCreate cross-platform agent skills from workflow descriptions. Activates when users ask to create an agent, automate a repetitive workflow, create a custom skill, or need advanced agent creation. Triggers on phrases like create agent for, automate workflow, create skill for, every day I have to, daily I need to, turn process into agent, need to automate, create a cross-platform skill, validate this skill, export this skill, migrate this skill. Supports single skills, multi-agent suites, transcript processing, template-based creation, interactive configuration, cross-platform export, and spec validation.
llm-wiki
IncludedUse when building or maintaining a persistent personal knowledge base (second brain) in Obsidian where an LLM incrementally ingests sources, updates entity/concept pages, maintains cross-references, and keeps a synthesis current. Triggers include "second brain", "Obsidian wiki", "personal knowledge management", "ingest this paper/article/book", "build a research wiki", "compound knowledge", "Memex", or whenever the user wants knowledge to accumulate across sessions instead of being re-derived by RAG on every query.
skill-master
IncludedAgent Skills authoring, evaluation, and optimization. Create, edit, validate, benchmark, and improve skills following the agentskills.io specification. Use when designing SKILL.md files, structuring skill folders (references, scripts, assets), ingesting external documentation into skills, running trigger evals, benchmarking skill quality, optimizing descriptions, or performing blind A/B comparisons. Keywords: agentskills.io, SKILL.md, skill authoring, eval, benchmark, trigger optimization.