memory-persistence

memory-persistence is a skill for Claude Code from AdamBien/airails. It costs 124 tokens per session (1,579 once invoked), scanned A, original, MIT.

An in-memory storage pattern for Java records using standard Java collections. Records are compact data objects, and in-memory data is lost when the program restarts.

In plain words
What is it for?
Saving, finding, listing, and querying records in memory with a concurrent map, then replacing the storage class with JDBC when needed.
Why use it?
It provides a simple temporary store for development and lets a Java component use the same contract as a database-backed version before moving to JDBC, Java's database connection API.

Skill for Claude Code

Written for Claude Code: argument-hint in frontmatter.

Good fit Saving, finding, listing, and querying records in memory with a concurrent map, then replacing the storage class with JDBC when needed.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/adambien/airails/memory-persistence
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.

Any agent
npx skills add AdamBien/airails --skill memory-persistence
Clone the repo
git clone --depth 1 https://github.com/AdamBien/airails

Made for: Claude Code.

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 memory-persistence

README.md
[![agentmods](https://agentmods.dev/badge/skills/adambien/airails/memory-persistence/github.svg)](https://agentmods.dev/skills/adambien/airails/memory-persistence)
Your own site
<a href="https://agentmods.dev/skills/adambien/airails/memory-persistence"><img src="https://agentmods.dev/badge/skills/adambien/airails/memory-persistence/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for memory-persistence

Your own site · 80×15
<a href="https://agentmods.dev/skills/adambien/airails/memory-persistence"><img src="https://agentmods.dev/badge/skills/adambien/airails/memory-persistence.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 124 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,579 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.00124 $0.01579
Opus 5.5 $0.00050 $0.00632
Sonnet 5.5 $0.00025 $0.00316
Haiku 4.5 $0.00012 $0.00158

Measured 3d ago against content hash a1a05bddceed, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

memory-persistence 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 3d 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.

java/memory-persistence/SKILL.md · 109 lines

How it starts

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

Add in-memory persistence using $ARGUMENTS. Apply all rules below strictly; /bce, /java-conventions, and the stack skill hold wherever this skill is silent.

Principle

The store is a collection of immutable records. No entity lifecycle, no identity map, no change tracking: a write replaces a record, a read returns the record, a query is a stream.

  • records only — the stored value is the entity record itself, never a mutable copy or a wrapper
  • the control is the sole holder of state; no other class references the collection
  • the control's public contract is identical to the /jdbc-persistence control for the same BC: save returns the record with its id, findById returns Optional, all and queries return List; a BC migrates by swapping the control class and adding @Transactional (or the project's @Boundary stereotype) to the boundary
  • state lives for the process lifetime and is lost on restart; say so in the BC's package-info.java, not in the code

Placement (BCE)

  • entity — the records and sealed interfaces, unchanged from /jdbc-persistence
  • control — classes named after their responsibilities (Customers, OrderReports), never *Repository, *Store, *InMemory*; the storage technology does not appear in the name because the boundary must not know it; a control may hold more than one map when it owns more than one record type
  • boundary — injects or receives the control; no collection, no stream over stored data

Control

  • storage: Map<Long, Order> orders = new ConcurrentHashMap<>(); keyed by id; a Set or List only when the record has no identity and is never updated
  • ids: AtomicLong sequence = new AtomicLong(); — save assigns sequence.incrementAndGet() when the id is 0, returns order.withId(id), and stores the returned record
  • update: orders.replace(order.id(), order); a missing id is a NoSuchElementException from the control, never a silent insert
  • delete: orders.remove(id) returning whether something was removed
  • queries are pure streams over orders.values(): .filter(...), .sorted(...), .toList(); every predicate and comparator is a named method, never an inline lambda (/java-conventions)
  • all returns List.copyOf(orders.values()); no caller sees the live collection or an Iterator over it
  • constraints the schema would enforce are enforced here explicitly: a uniqueness rule is a putIfAbsent or a pre-check that throws the stack's integrity exception from the /jdbc-persistence contract, naming the rule — ClientErrorException(rule, Response.Status.CONFLICT) on /microprofile-server, IllegalArgumentException in a /java-cli-app
  • concurrency: rely on ConcurrentHashMap atomics (compute, putIfAbsent, replace); no synchronized, no Collections.synchronizedMap, no locks
  • no eviction, no size cap, no TTL unless the spec asks; then prefer the rule in the control over a caching library
  • /microprofile-server: the control is an @ApplicationScoped CDI bean; the collection is an instance field, so one store per application
  • /java-cli-app: the control is a class instantiated once in the entry point and handed to the boundaries; never a mutable static field (/java-conventions)

Read the full file on GitHub · 109 lines

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

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. 3d ago Changed · +124 tokens per session a1a05bddceed
  2. 5d ago Changed · -192 tokens per session 456205870f66
  3. 7d ago First seen · 109 lines · 192 tokens per session scan A 1c3b81d2c7a2

Subscribe to this mod's changes

memory-persistence is a skill published in the GitHub repository AdamBien/airails (62 stars, last pushed yesterday), licensed MIT. It adds 124 tokens to every session and 1,579 once invoked, about $0.0005 per session on Opus 5.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-10-31.

Related

memory-persistence compared with skills from other repositories

memory-persistence next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
memory-persistenceAdamBien/airailsSkill62yesterdayMITA124Claude Code
jpa-patternsaffaan-m/ECCSkill298k4d agoMITA33Claude Code, Kiro
azure-data-tables-javamicrosoft/skillsSkill3.2kyesterdayMITA47Claude Code
azure-cosmos-javamicrosoft/skillsSkill3.2kyesterdayMITA59Claude Code
authoring-java-sdk-tasksastronomer/agentsSkill4584d agoApache-2.0A152Claude Code
configuring-airflow-language-sdksastronomer/agentsSkill4584d agoApache-2.0A155Claude Code
database-orm-expertroedyrustam/vibes-plugSkill121yesterdayMITA40Cursor