Loading...
Loading...
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.
npx skill4agent add cjhfff/cjh-skills cognitive-memorybash scripts/init_memory.sh /path/to/workspace~/.clawdbot/clawdbot.jsonmoltbot.json{
"memorySearch": {
"enabled": true,
"provider": "voyage",
"sources": ["memory", "sessions"],
"indexMode": "hot",
"minScore": 0.3,
"maxResults": 20
}
}assets/templates/agents-memory-block.mdUser: "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]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 mutationsworkspace/
├── 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 truthrelevance(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 |
## 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.*last_reflection[Self-Awareness]reflections/YYYY-MM-DD.mdreflection-log.mdrewards/YYYY-MM-DD.mdreward-log.md[Self-Awareness]decay-scores.jsonreferences/reflection-process.md## YYYY-MM-DD
**Result:** +5K reward
**Reason:** Over-delivered on Slack integration[Self-Awareness]decay-scores.jsonreferences/reflection-process.mdpending-memories.md## Proposal #N
- **From**: [agent name]
- **Timestamp**: [ISO 8601]
- **Suggested store**: [episodic|semantic|procedural|vault]
- **Content**: [memory content]
- **Confidence**: [high|medium|low]
- **Status**: pendingbot:trigger-rememberreflection:SESSION_IDsystem:decaymanualsubagent:NAMEbot:commit-from:NAME| Parameter | Default | Notes |
|---|---|---|
| Core memory cap | 3,000 tokens | Always in context |
| Evolution.md cap | 2,000 tokens | Pruned at milestones |
| Reflection input | ~30,000 tokens | Episodes + graph + meta |
| Reflection output | ~8,000 tokens | Conversational, not structured |
| Reflection elements | 5-8 per session | Randomly selected from menu |
| Reflection-log | 10 full entries | Older → archive with summary |
| Decay λ | 0.03 | ~23 day half-life |
| Archive threshold | 0.05 | Below = hidden |
| Audit log retention | 90 days | Older → monthly digests |
references/architecture.mdreferences/routing-prompt.mdreferences/reflection-process.mdmemorySearch.enabled: true.git/audit.log