cognitive-memory

cjhfff/cjh-skills · updated Apr 8, 2026

MDX-style export adds YAML metadata + attribution linking explainx.ai and this canonical listing URL.

$npx skills add https://github.com/cjhfff/cjh-skills --skill cognitive-memory
0 commentsdiscussion
summary

Multi-store memory with natural language triggers, knowledge graphs, decay-based forgetting, reflection consolidation, philosophical evolution, multi-agent support, and full audit trail.

skill.md

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 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):

{
  "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.

## 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.

## YYYY-MM-DD
**Result:** +5K reward
**Reason:** Over-delivered on Slack integration
  1. [Self-Awareness] → IDENTITY.md
  2. Update decay-scores.json
  3. 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:

## 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
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

Reference Materials

  • references/architecture.md — Full design document (1200+ lines)
  • references/routing-prompt.md — LLM memory classifier
  • references/reflection-process.md — Reflection philosophy and internal monologue format

Troubleshooting

Memory not persisting? Check memorySearch.enabled: true, verify MEMORY.md exists, restart gateway.

Reflection not running? Ensure previous reflection was approved/rejected.

Audit trail not working? Check .git/ exists, verify audit.log is writable.

how to use cognitive-memory

How to use cognitive-memory on Cursor

AI-first code editor with Composer

1

Prerequisites

Before installing skills in Cursor, ensure your development environment meets these requirements:

  • Cursor installed and configured on your development machine
  • Node.js version 16.0+ with npm package manager (verify with node --version)
  • Active project directory or workspace where you want to add cognitive-memory
2

Execute installation command

Execute the skills CLI command in your project's root directory to begin installation:

$npx skills add https://github.com/cjhfff/cjh-skills --skill cognitive-memory

The skills CLI fetches cognitive-memory from GitHub repository cjhfff/cjh-skills and configures it for Cursor.

3

Select Cursor when prompted

The CLI will show a list of available agents. Use arrow keys to navigate and space to select Cursor:

◆ Which agents do you want to install to?
│ ── Universal (.agents/skills) ── always included ────
│ • Amp
│ • Antigravity
│ • Cline
│ • Codex
│ ●Cursor(selected)
│ • Cursor
│ • Windsurf
4

Verify installation

Confirm successful installation by checking the skill directory location:

.cursor/skills/cognitive-memory

Reload or restart Cursor to activate cognitive-memory. Access the skill through slash commands (e.g., /cognitive-memory) or your agent's skill management interface.

Security & Verification Notice

We perform automated surface-level scans (Gen AI Scanner, Socket, Snyk) during installation. These checks detect common vulnerabilities but do not guarantee complete security. Always review skill source code and verify the publisher's reputation before production use.

Skills execute code in your development environment. Always verify the publisher's identity, review recent commits, and test in isolated environments before production deployment.

List & Monetize Your Skill

Submit your Claude Code skill and start earning

GET_STARTED →

Use Cases

User Story & Requirements Generation

Create detailed user stories, acceptance criteria, and feature specs

Example

Generate user stories for 'password reset feature' with acceptance criteria, edge cases, and test scenarios

Reduce spec writing time by 50%, ensure comprehensive coverage

Competitive Analysis

Research competitors, compare features, identify gaps

Example

Analyze 5 competitor products, create feature comparison matrix, suggest differentiation opportunities

Complete competitive research in 2 hours instead of 2 days

Roadmap Prioritization

Evaluate features using frameworks (RICE, ICE, Kano) and create prioritized backlogs

Example

Score 20 feature ideas using RICE framework, generate prioritized roadmap with rationale

Make data-driven prioritization decisions faster

Stakeholder Communication

Draft PRDs, status updates, and stakeholder presentations

Example

Create executive summary of Q3 roadmap, monthly progress report, feature launch announcement

Save 3-5 hours/week on communication overhead

Implementation Guide

Prerequisites

  • Claude Desktop or compatible AI client
  • Access to product documentation and roadmap tools (Jira, Notion, etc.)
  • Understanding of product management frameworks (RICE, Jobs-to-be-Done, etc.)
  • Stakeholder contact information and communication channels

Time Estimate

30-60 minutes to see productivity improvements

Installation Steps

  1. 1.Install product management skill
  2. 2.Start with user story generation for known feature
  3. 3.Progress to competitive analysis: research 2-3 competitors
  4. 4.Use for roadmap prioritization: apply RICE/ICE scoring
  5. 5.Draft stakeholder communications and refine based on feedback
  6. 6.Build template library for recurring PM tasks
  7. 7.Share effective prompts with product team

Common Pitfalls

  • Not validating competitive research—verify facts before sharing
  • Accepting user stories without involving engineering team
  • Over-relying on frameworks without qualitative judgment
  • Not customizing outputs to company culture and communication style
  • Skipping stakeholder validation of generated requirements

Best Practices

✓ Do

  • +Validate research and competitive analysis with real data
  • +Collaborate with engineering when generating technical requirements
  • +Customize frameworks and templates to your company context
  • +Use skill for first drafts, refine with stakeholder input
  • +Document successful prompt patterns for PM tasks
  • +Combine AI efficiency with human judgment and intuition

✗ Don't

  • Don't publish competitive analysis without fact-checking
  • Don't finalize user stories without engineering review
  • Don't make prioritization decisions solely on AI scoring
  • Don't skip customer validation of generated requirements
  • Don't ignore company-specific context and culture

💡 Pro Tips

  • Provide context: company goals, constraints, customer feedback
  • Ask for alternatives: 'Show 3 ways to prioritize this roadmap'
  • Request stakeholder-specific formatting: 'Executive summary vs. engineering spec'
  • Use skill for 70% generation + 30% customization to company needs

When to Use This

✓ Use When

Use for user story writing, competitive research, roadmap prioritization, stakeholder communication, and PRD drafting. Best for reducing repetitive documentation and research work.

✗ Avoid When

Avoid for strategic product vision (requires deep customer empathy), pricing decisions (needs market and financial expertise), or when face-to-face customer discovery is more valuable than speed.

Learning Path

  1. 1Basic: user stories, feature specs, status updates
  2. 2Intermediate: competitive analysis, prioritization frameworks, PRDs
  3. 3Advanced: product strategy, go-to-market planning, OKR setting
  4. 4Expert: product vision, market positioning, business model innovation

Discussion

Product Hunt–style comments (not star reviews)
  • No comments yet — start the thread.
general reviews

Ratings

4.569 reviews
  • Amelia Gill· Dec 24, 2024

    Keeps context tight: cognitive-memory is the kind of skill you can hand to a new teammate without a long onboarding doc.

  • Amelia Jain· Dec 20, 2024

    Solid pick for teams standardizing on skills: cognitive-memory is focused, and the summary matches what you get after install.

  • Noah Nasser· Dec 20, 2024

    We added cognitive-memory from the explainx registry; install was straightforward and the SKILL.md answered most questions upfront.

  • Jin Sanchez· Dec 12, 2024

    I recommend cognitive-memory for anyone iterating fast on agent tooling; clear intent and a small, reviewable surface area.

  • Amelia Rao· Nov 15, 2024

    cognitive-memory is among the better-maintained entries we tried; worth keeping pinned for repeat workflows.

  • Jin Ramirez· Nov 11, 2024

    cognitive-memory reduced setup friction for our internal harness; good balance of opinion and flexibility.

  • Naina Martin· Nov 11, 2024

    Registry listing for cognitive-memory matched our evaluation — installs cleanly and behaves as described in the markdown.

  • Min Ndlovu· Nov 11, 2024

    cognitive-memory fits our agent workflows well — practical, well scoped, and easy to wire into existing repos.

  • Sofia Desai· Oct 6, 2024

    Useful defaults in cognitive-memory — fewer surprises than typical one-off scripts, and it plays nicely with `npx skills` flows.

  • Noah Sethi· Oct 2, 2024

    I recommend cognitive-memory for anyone iterating fast on agent tooling; clear intent and a small, reviewable surface area.

showing 1-10 of 69

1 / 7