Ralph Memory logo

Ralph Memory

Community
jmagly
ralph-memory

Manage Al semantic memory entries — list, query, and clear lessons learned across loop iterations

Overview

Publisherjmagly
Repositoryaiwg
Skill nameralph-memory
Stars
225
Forks
34
Bundled files
Instructions only
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by jmagly on GitHub. Read the source before you install it.

Installation

Install the Ralph Memory AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/jmagly/aiwg/tree/main/agentic/code/addons/agent-loop/skills/ralph-memory
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/jmagly/aiwg.git /tmp/aiwg
mkdir -p .claude/skills
cp -r /tmp/aiwg/agentic/code/addons/agent-loop/skills/ralph-memory .claude/skills/ralph-memory
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Ralph Memory in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Ralph Memory on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Ralph Memory is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Skill access pattern (post-kernel-pivot, 2026.5+)

Skill names referenced in this document are AIWG skills, not slash commands. Most are not kernel-listed and cannot be invoked as /skill-name by the platform. Reach them via:

bash
aiwg discover "<capability>"
aiwg show skill <name> --body

Only kernel-listed skills (aiwg-doctor, aiwg-refresh, aiwg-status, aiwg-help, use, steward) are directly invokable as slash commands. See skill-discovery rule.

Al Memory

Inspect and manage the semantic memory that Al accumulates across loop iterations. Memory entries record lessons learned, failure patterns, and success patterns so that later iterations — and future loops on similar tasks — benefit from what earlier attempts discovered.

Natural Language Triggers

Users may say:

  • "ralph memory"
  • "ralph memories"
  • "list ralph memory"
  • "query ralph memory"
  • "what has ralph learned"
  • "show ralph lessons"
  • "clear ralph memory"

Parameters

Subcommand (required)

One of list, query, or clear.

--loop-id (optional)

Scope the operation to a specific loop's memory. If omitted, operates on the global memory store (.aiwg/ralph/memory.json).

/ralph-memory list --loop-id abc123

--query (optional, used with query subcommand)

Text to search for in memory entries. Matches against lesson, pattern, context, and tags fields.

/ralph-memory query --query "auth mocks"

--since (optional)

Filter entries created on or after this date. Accepts ISO 8601 date (2026-04-01) or relative expressions (7d, 2w).

/ralph-memory list --since 7d

Memory Entry Schema

Each entry in .aiwg/ralph/memory.json follows this structure:

json
{
  "id": "mem_a1b2c3",
  "loopId": "abc123",
  "iteration": 2,
  "createdAt": "2026-04-01T10:42:00Z",
  "type": "failure_pattern",
  "lesson": "Auth mocks must be initialized inside beforeEach, not at module scope",
  "context": "src/auth/auth.test.ts iteration 2 failure",
  "tags": ["auth", "mocks", "jest"],
  "confidence": 0.9
}

Entry types:

  • lesson_learned — General insight extracted from an iteration
  • failure_pattern — Recurring error pattern to avoid
  • success_pattern — Approach that worked and should be repeated

Behavior

list Subcommand

  1. Read the memory store (scoped to --loop-id if provided, otherwise global)
  2. Apply --since filter if provided
  3. Display a formatted table of all entries, sorted by createdAt descending

Output:

Al Memory — 8 entries

| ID       | Type            | Loop   | Iter | Lesson                                              | Date       |
|----------|-----------------|--------|------|-----------------------------------------------------|------------|
| mem_a1b2 | failure_pattern | abc123 | 2    | Auth mocks must be in beforeEach, not module scope  | 2026-04-01 |
| mem_c3d4 | lesson_learned  | abc123 | 3    | Use jest.resetAllMocks() in afterEach               | 2026-04-01 |
| mem_e5f6 | success_pattern | def456 | 5    | ESM imports require .js extension in TypeScript     | 2026-03-28 |
| mem_g7h8 | failure_pattern | def456 | 2    | ts-node does not support isolatedModules by default | 2026-03-28 |
...

Use /ralph-memory query --query "<text>" to search.

If no entries exist:

No memory entries found.

Al accumulates memory as it runs loops. Start a loop:
  /ralph "your task" --completion "criteria"

query Subcommand

  1. Read all memory entries (filtered by --loop-id and --since if provided)
  2. Score each entry against the --query text using substring and tag matching
  3. Return the top matches, ranked by relevance score descending

Output:

Al Memory — query: "auth mocks"

3 matching entries (ranked by relevance):

1. [mem_a1b2] failure_pattern — confidence 0.90
   Lesson: Auth mocks must be initialized inside beforeEach, not at module scope
   Context: src/auth/auth.test.ts iteration 2
   Tags: auth, mocks, jest
   Loop: abc123, Iter: 2, Date: 2026-04-01

2. [mem_c3d4] lesson_learned — confidence 0.80
   Lesson: Use jest.resetAllMocks() in afterEach to prevent mock state leakage
   Context: src/auth/auth.test.ts iteration 3
   Tags: auth, jest, cleanup
   Loop: abc123, Iter: 3, Date: 2026-04-01

3. [mem_x9y0] failure_pattern — confidence 0.60
   Lesson: Passport mock must stub req.user before middleware chain
   Context: src/auth/middleware.test.ts
   Tags: auth, passport, mocks
   Loop: ghi789, Iter: 1, Date: 2026-03-25

No matches:

No memory entries match "auth mocks".

Try broader terms or list all entries:
  /ralph-memory list

clear Subcommand

  1. If --loop-id is provided, delete only entries belonging to that loop
  2. Otherwise, prepare to clear the entire memory store
  3. Show a confirmation prompt before deleting

Confirmation prompt:

This will permanently delete 8 memory entries.

Entries by loop:
  abc123 — 3 entries (Fix auth tests, 2026-04-01)
  def456 — 4 entries (ESM migration, 2026-03-28)
  ghi789 — 1 entry  (Middleware fix, 2026-03-25)

Type 'yes' to confirm:

After clearing:

Al memory cleared. 8 entries deleted.

Memory file reset: .aiwg/ralph/memory.json

Loop-scoped clear:

Cleared 3 memory entries for loop abc123.

Remaining entries: 5 (in other loops)

Memory File Locations

ScopePath
Global (all loops).aiwg/ralph/memory.json
External loop global.aiwg/ralph-external/memory.json
Per-loop (external).aiwg/ralph-external/loops/<id>.json (embedded learnings field)

Error Handling

Memory file missing:

No Al memory found at .aiwg/ralph/memory.json.

Al has not accumulated any memory yet. Run a loop first:
  /ralph "your task" --completion "criteria"

Corrupted memory file:

Memory file is not valid JSON: .aiwg/ralph/memory.json

Options:
1. Delete and start fresh: rm .aiwg/ralph/memory.json
2. Inspect manually to repair

Missing --query for query subcommand:

Error: --query is required for the 'query' subcommand.

Usage:
  /ralph-memory query --query "auth mocks"
  /ralph-memory query --query "typescript" --since 7d

Examples

Example 1: List all memory entries

/ralph-memory list

Response: Table of all accumulated Al memory entries, newest first.

Example 2: List entries from the last week

/ralph-memory list --since 7d

Response: Only entries created in the last 7 days.

Example 3: Query for relevant memories before starting a task

/ralph-memory query --query "typescript esm"

Response: Top matching entries about TypeScript ESM, ranked by relevance.

Example 4: List memories from a specific loop

/ralph-memory list --loop-id abc123

Response: Only entries generated during loop abc123.

Example 5: Clear memories from a completed loop

/ralph-memory clear --loop-id abc123

Response: Prompts confirmation, then deletes the 3 entries for loop abc123.

Example 6: Full reset

/ralph-memory clear

Response: Prompts confirmation listing all entries by loop, then deletes everything.

Related

  • ralph — Loop that generates memory entries
  • ralph-external — External loop with its own memory layer
  • ralph-status — Check loop status and iteration history
  • ralph-reflect — Deeper reflection and memory promotion

References

  • @$AIWG_ROOT/src/cli/handlers/ralph.ts — Al CLI handler
  • @$AIWG_ROOT/tools/ralph-external/memory-manager.mjs — Memory storage and retrieval
  • @$AIWG_ROOT/tools/ralph-external/lib/semantic-memory.mjs — Semantic memory layer
  • @$AIWG_ROOT/tools/ralph-external/lib/memory-retrieval.mjs — Memory query logic
  • @$AIWG_ROOT/tools/ralph-external/lib/memory-promotion.mjs — Cross-task memory promotion
  • @$AIWG_ROOT/agentic/code/addons/agent-loop/README.md — Al documentation

Storage Routing (#934, #967)

This skill's persistence flows through resolveStorage('memory'). On the default fs backend the agent-loop memory lives at .aiwg/ralph/memory.json (and .aiwg/ralph-external/memory.json for external loops). To redirect into Obsidian, Logseq, Fortemi, or another backend without changing this skill, configure roots.memory or backends.memory in .aiwg/storage.config (#934).

When this skill needs to read/write loop memory from a Bash step, prefer the storage-routed CLI:

bash
aiwg memory get ralph/memory.json                # read global ralph memory
echo '{"loop_id":"x","learnings":[]}' | aiwg memory put ralph/memory.json
echo '{"event":"learned","ts":"..."}' | aiwg memory append-log ralph/learning.jsonl

The legacy direct-fs paths (.aiwg/ralph/memory.json) continue to work on the default fs backend — they're byte-identical to what the adapter writes — but only the adapter route honors storage.config redirection.

Frequently asked questions

What does the Ralph Memory AI skill do?

Manage Al semantic memory entries — list, query, and clear lessons learned across loop iterations

Why use Ralph Memory on TypingMind?

Because you install it once and use it with any model. Ralph Memory is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Ralph Memory in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/jmagly/aiwg/tree/main/agentic/code/addons/agent-loop/skills/ralph-memory. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Ralph Memory?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Ralph Memory?

As many as you like. As long as a model supports skills, you can use Ralph Memory with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Ralph Memory AI skill free?

Yes. It is published on GitHub by jmagly under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇