ralph-memory

ralph-memory is a skill for Claude Code, Codex from jmagly/aiwg. It costs 21 tokens per session (2,556 once invoked), scanned A, original, MIT.

A memory-management tool for an automated agent loop. It lists, searches, or clears lessons that the loop has stored from earlier attempts.

In plain words
What is it for?
Use it to review what the agent has learned, search lessons for a particular loop, or clear stored memory globally or for a selected loop.
Why use it?
It makes accumulated lessons and recurring failure patterns inspectable instead of leaving them hidden in the loop's history. You can also limit the operation to one loop.

Skill for Claude CodeCodex

Which agent this was written for is unclear — built for openclaw. Also seen: built for openclaw.

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/jmagly/aiwg/ralph-memory
Any agent
npx skills add jmagly/aiwg --skill ralph-memory
Clone the repo
git clone --depth 1 https://github.com/jmagly/aiwg

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for ralph-memory

README.md
[![agentmods](https://agentmods.dev/badge/skills/jmagly/aiwg/ralph-memory.svg)](https://agentmods.dev/skills/jmagly/aiwg/ralph-memory)
Your own site
<a href="https://agentmods.dev/skills/jmagly/aiwg/ralph-memory"><img src="https://agentmods.dev/badge/skills/jmagly/aiwg/ralph-memory.svg" alt="Measured on agentmods" height="20"></a>
Per session 21 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,556 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00021 $0.02556
Opus 5 $0.00010 $0.01278
Sonnet 5 $0.00004 $0.00511
Haiku 4.5 $0.00002 $0.00256

Measured 6d ago against content hash c7a19937a5eb, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-05, from the pricing page.

Security

Grade A, and why

ralph-memory scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 6d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

agentic/code/addons/agent-loop/skills/ralph-memory/SKILL.md · 298 lines

How it starts

The opening of the file, as written. The whole thing — 298 lines — stays where its author put it; the contents beside it link to each section on GitHub.

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:

aiwg discover "<capability>"
aiwg show skill <name>

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:

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

Read the full file on GitHub · 298 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 6d ago First seen · 298 lines · 21 tokens per session scan A c7a19937a5eb

Subscribe to this mod's changes

ralph-memory is a skill published in the GitHub repository jmagly/aiwg (209 stars, last pushed yesterday), licensed MIT. It adds 21 tokens to every session and 2,556 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.