Logo vun Memory Consistency Model Selector

Memory Consistency Model Selector

Communautéit
AnthonyAlcaraz
memory-consistency-model-selector

Choose a memory consistency model PER agent-coordination operation — STRONG (linearizable), CAUSAL, READ-YOUR-WRITES, or EVENTUAL — by scoring the operation's requirements (shared authoritative state, conflict intolerance, staleness budget, collaboration, self-session continuity), per Ch4 "Memory consistency models for agent coordination". The chapter's rule: default to causal, escalate to strong only for irreversible decision points. Also flags cache-sharing divergence — an agent acting on a cached read older than a committed write it depends on. Use when designing shared memory for a multi-agent system, justifying a consistency choice, or auditing a stale- cache handoff. NOT for single-agent stateless systems (no coordination), NOT for picking a datastore product (this picks the model, not Redis-vs-etcd), NOT when the platform already mandates a consistency model (just adopt it).

Iwwersiicht

EditeurAnthonyAlcaraz
Repositoryagentic-graph-rag-skills
Skill-Nummmemory-consistency-model-selector
Stären
29
Forks
9
Matgeliwwert Fichieren
2
LizenzMIT
Linken
  • Instruktiounen am Markdown-Format

    Eng SKILL.md-Datei, déi de Modell bei Bedarf luet, soudatt nëmmen Token ufalen, wann eng Ufro tatsächlech dozou passt.

  • Funktionéiert mat all LLM

    KI-Skills si reng Markdown, keen ubidderspezifesche Code. Dofir funktionéiert dëse Skill mat GPT, Claude, Gemini, Grok oder engem lokale Modell.

  • 2 matgeliwwert Dateien

    Skripten, Virlagen a Referenzen, déi de Modell beim Schaffe liese kann. D'Dateie kënnen nëmme gelies ginn a ginn ni ausgeféiert.

  • Open Source

    Vum AnthonyAlcaraz op GitHub verëffentlecht. Liest de Quelltext, ier Dir de Skill installéiert.

Installatioun

Installéiert de KI-Skill Memory Consistency Model Selector an TypingMind, fir e mat all LLM ze benotzen, oder füügt en an en anere KI-Agent an, deen SKILL.md liest.

1

An TypingMind installéieren

TypingMind installéiert e Skill direkt aus sengem GitHub-Dossier — dobäi gëtt SKILL.md gelies, d'Ressourcedateie gi gebëndelt an d'Resultat gëtt lokal gespäichert.

  1. Maacht d'App op a gitt op Plugins → Skills.
  2. Wielt „Vun GitHub installéieren“.
  3. Pecht d'URL vum Skill-Dossier hei drënner an a bestätegt.
    https://github.com/AnthonyAlcaraz/agentic-graph-rag-skills/tree/main/skills/memory/memory-consistency-model-selector
  4. Aktivéiert de Skill an all Chat, an deem Dir e benotze wëllt.
Plugins → Skills → Skill afügen → Vu GitHub-URL, pecht dann d'URL vum Dossier an a klickt op Weider.
2

An engem anere KI-Agent installéieren

All KI-Agent, deen d'Format Agent Skills liest, kann dëse Skill benotzen — kopéiert den Dossier an de Skill-Verzeechnes vun deem KI-Agent.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/AnthonyAlcaraz/agentic-graph-rag-skills.git /tmp/agentic-graph-rag-skills
mkdir -p .claude/skills
cp -r /tmp/agentic-graph-rag-skills/skills/memory/memory-consistency-model-selector .claude/skills/memory-consistency-model-selector
Start Claude Code nom Kopéieren nei, fir datt den neie Skill erkannt gëtt.

An TypingMind benotzen

Aktivéiert Memory Consistency Model Selector an engem Chat vun TypingMind, an de Modell iwwerhëlt de Rescht. Den Numm an d'Beschreiwung stinn am System-Prompt. Soubal eng Ufro dozou passt, luet de Modell déi komplett Instruktioune selwer — Dir musst de Skill ni manuell opruffen, an et fale keng Token un, bis en tatsächlech benotzt gëtt.

De Modell luet Memory Consistency Model Selector automatesch, soubal eng Ufro dozou passt.

Funktionéiert mat all KI-Modell

KI-Skills si reng Markdown-Instruktiounen amplaz vun ubidderspezifeschem Code. Dofir ass Memory Consistency Model Selector net un de Modell gebonnen, fir deen de Skill geschriwwe gouf. Installéiert en eemol an TypingMind a benotzt e mat GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama oder engem lokale Modell, deen Dir selwer bedreift — alles mat Ären eegenen API-Keys.

  • Gëtt nëmme gelueden, wann et néideg ass

    De System-Prompt enthält nëmmen den Numm an d'Beschreiwung. D'Instruktioune gi bei der éischter passender Ufro gelueden, soudatt en onbenotzte Skill näischt kascht.

  • De Modell am lafende Chat wiesselen

    Well de Skill aus Instruktiounen amplaz vu Code besteet, funktionéiert en och no engem Modellwiessel — den nächste Modell liest déi selwecht SKILL.md-Datei.

Skill-Instruktiounen

Dëst ass den Inhalt vu SKILL.md, deen de Modell luet. Liest e virun der Installatioun — e Skill besteet aus Instruktiounen, déi Äre Modell befollegt.

Memory Consistency Model Selector

Overview

When Agent A writes a fact to shared memory, when does Agent B see it? Ch4 names this the memory consistency problem, and getting it wrong produces agents that contradict each other, overwrite each other's conclusions, or act on stale information. This is CAP — the classic consistency/availability trade-off — applied per coordination operation to shared agent memory, not decided once globally. Consistency is chosen per operation because most workflows mix safety-critical decision points with tolerant background work.

Four consistency models, each with a characteristic profile:

  • strong (linearizable): every agent sees the latest write before any proceeds. A synchronization barrier after every write — expensive, but required when agents act on shared authoritative state (locks, budgets, inventory) or make safety-critical irreversible decisions. The chapter's example: a drug-interaction finding every agent must see before recommending treatment.
  • causal: causally-related writes are ordered; unrelated updates may lag. If A's conclusion depends on B's finding, any reader of A also sees B. The practical default for collaborating agents.
  • read_your_writes: an agent always sees its own writes; other agents' writes may arrive later. Session memory for a single agent's continuity.
  • eventual: cheapest; all agents converge eventually, but not when. Fine when no single fact is safety-critical and a final synthesis reconciles disagreement (background enrichment, literature accumulation).

The selector scores each model across the operation's requirement axes and recommends one, surfacing escalate_to_strong when the default is not strong but the operation touches authoritative state — the chapter's rule: default to causal, escalate the irreversible decision points to strong.

The cache-divergence helper makes the failure concrete. Ch4's cache-sharing section warns that without a protocol, Agent B acts on a cached read that a newer committed write already superseded. detect_cache_divergence flags exactly that: any cached snapshot older than the latest committed write on the same key.

When to Use

  • Designing shared memory for a multi-agent system with concurrent writers
  • Justifying a consistency choice for one coordination operation in a design doc
  • Auditing a handoff where an agent may be acting on a stale cached value
  • Deciding whether a decision point needs a strong-consistency barrier

Phrases: "consistency model", "linearizable vs eventual", "causal consistency", "read your writes", "stale cache", "multi-agent memory coordination", "when does Agent B see Agent A's write", "CAP for agent memory".

When NOT to Use

  • Single-agent / stateless systems. No cross-agent coordination means no consistency problem to solve.
  • Picking a datastore product. This selects the consistency model, not Redis-vs-etcd-vs-Postgres. Product choice is downstream.
  • A platform-mandated model. If the framework fixes the consistency guarantee, adopt it; the scoring is moot.
  • A single global decision. The chapter's point is per-operation choice; do not collapse a whole system to one model to "keep it simple" (see the rationalizations).

Process

StepInputActionOutputVerification
1operation requirements (5 weights 0..3)lib.score_models(op)[(model, score), ...] sorted descweights * fitness, descending
2samelib.recommend_model(op){recommended, scores, rationale, profile, escalate_to_strong}strong on authoritative/conflict, eventual on staleness, causal on collaboration, ryw on self-session
3committed writes + per-agent cached readslib.detect_cache_divergence(writes, snaps)list of {agent, key, cached_at, latest_write_at, staleness_gap}stale snapshot flagged; current snapshot clean

CLI: recommend, score, cache-check, scenario (shared-budget-lock / background-enrichment / collaborative-research / session-assistant), benchmark.

Rationalizations

Agent rationalizationDocumented rebuttal
"Just use strong consistency everywhere, it's the safe default."Strong pays a synchronization barrier after every write. On a literature-accumulation or background-enrichment operation that cost buys nothing — no single fact is safety-critical. Ch4: default to causal, escalate to strong only for irreversible decision points. Blanket-strong is the availability tax the per-operation choice exists to avoid.
"Eventual is cheapest, use it globally."Eventual on a shared budget or inventory lock means two agents read different versions and both spend the same money. escalate_to_strong fires precisely because the workflow default and the individual authoritative decision point need different models.
"One consistency model per system keeps it simple."The chapter is explicit that consistency is chosen per operation: a pull-request review (strong) versus feature-branch tests (eventual) versus a merge queue (causal) coexist in one repo. Collapsing to one model either over-pays everywhere or under-protects the safety-critical points.
"Cache staleness is an edge case, skip the check."Ch4's cache-sharing section names it as the concrete failure surface: without a protocol, Agent B acts on a superseded cached read and produces a contradictory result. detect_cache_divergence is the cheap deterministic guard; a divergent decision downstream is not cheap.
"Causal is basically read-your-writes, they're interchangeable."No. Read-your-writes guarantees an agent sees only its OWN writes; causal orders writes across agents that are causally linked. A collaboration operation where A builds on B needs causal; a single agent's session continuity needs read-your-writes. The scoring separates them so the wrong one is not chosen by habit.

Red Flags

  • All five requirement weights set to 3. You have not prioritized the operation. Re-interview: if every axis is critical, the selector degenerates to raw fitness averages.
  • Recommended = eventual but the operation touches a budget/lock. Mismatch: authoritative state cannot ride on eventual consistency. Check escalate_to_strong.
  • One consistency model chosen for the entire system. The chapter mandates per-operation choice; a single global model is a design smell.
  • Cache-check returns divergences and they are ignored. Each stale agent is a contradictory-decision risk. Add a cache-sharing protocol (broadcast, pub-sub, or request-grant per Ch4) or force a re-read before the handoff.

Non-Negotiable Verification

  1. Run the benchmark battery. python cli.py benchmark must report 11/11:
    • strong wins on shared-authoritative-state and on conflict-intolerance
    • eventual wins on high staleness budget, causal on collaboration, read_your_writes on self-session-only
    • zero requirements score all models 0; all four are scored, descending
    • cache-check flags a stale read with the correct staleness gap and stays clean when the cache is current
    • escalate_to_strong fires when causal is the default but authoritative state is present
    • the requirement-axis set and the four-model set have not drifted
  2. Run a scenario. python cli.py scenario shared-budget-lock recommends strong; python cli.py scenario background-enrichment recommends eventual.
  3. Verify CLI help. python cli.py --help exits 0 and prints this SKILL.md description (so any harness can discover the skill from --help).

Security Posture

  • Prompt injection. Inputs are requirement weights and write/snapshot metadata - pure data scored against fixed fitness tables. Adversarial values can at most skew the recommendation (e.g. under-weighting authoritative state to dodge a strong barrier); nothing in the input is executed.
  • Data exfiltration. No network calls, no file writes. Write timestamps and cache snapshots may reveal coordination topology; they stay in-process and appear only in the stdout report the caller owns.
  • Privilege escalation. No shell invocation, no eval, no dynamic import. The recommendation is advisory: a mis-chosen eventual model on a shared budget is a correctness/safety hazard, which is why escalate_to_strong fires - but the actual synchronization barrier is enforced by the memory store, not by this selector.

Source Attribution

Distilled from Agentic GraphRAG (O'Reilly, by Anthony Alcaraz and Sam Julien) Ch4 — Memory, sections "Memory consistency models for agent coordination" (the strong / causal / eventual models and the default-causal-escalate-to-strong rule) and "Cache sharing in multi-agent systems" (broadcast / pub-sub / request-grant patterns and the stale-cache failure surface). The read-your-writes model is the standard session-consistency guarantee from distributed-systems practice, added as the fourth per-operation option. The consistency/availability framing is the CAP theorem (Brewer) applied per coordination operation.

Matgeliwwert Fichieren

De Modell liest dës Dateie bei Bedarf, wärend de Skill gelueden ass. Si ginn als liesbar Dateie bereetgestallt a ginn ni ausgeféiert.

Heefeg gestallte Froen

Wat mécht de KI-Skill Memory Consistency Model Selector?

Choose a memory consistency model PER agent-coordination operation — STRONG (linearizable), CAUSAL, READ-YOUR-WRITES, or EVENTUAL — by scoring the operation's requirements (shared authoritative state, conflict intolerance, staleness budget, collaboration, self-session continuity), per Ch4 "Memory consistency models for agent coordination". The chapter's rule: default to causal, escalate to strong only for irreversible decision points. Also flags cache-sharing divergence — an agent acting on a cached read older than a committed write it depends on. Use when designing shared memory for a mult...

Firwat Memory Consistency Model Selector op TypingMind benotzen?

Well Dir en eemol installéiert a mat all Modell benotze kënnt. Memory Consistency Model Selector besteet aus einfachem Markdown amplaz vun ubidderspezifeschem Code. Dee selwechte Skill funktionéiert also mat GPT-5, Claude, Gemini, Grok oder engem lokale Modell – an Dir kënnt de Modell matzen am Chat wiesselen, ouni datt de Skill ophält ze funktionéieren. TypingMind benotzt Är eegen API-Schlësselen, sou datt Dir d'Ubidder direkt bezuelt amplaz vun engem Abonnement pro Benotzerplaz. Är Skills a Chats bleiwen an Ärem eegene Späicher.

Wéi installéieren ech Memory Consistency Model Selector an TypingMind?

Maacht an TypingMind Plugins → Skills → Vu GitHub installéieren op a setzt https://github.com/AnthonyAlcaraz/agentic-graph-rag-skills/tree/main/skills/memory/memory-consistency-model-selector an. TypingMind liest d'Datei SKILL.md, bündelt déi zougehéiereg Dateien an installéiert dat Ganzt als Skill, deen Dir pro Chat aktivéiere kënnt.

Wéi eng KI-Modeller kënnen Memory Consistency Model Selector benotzen?

All Modell, deen Dir an TypingMind verbënnt. KI-Skills sinn einfach Markdown-Instruktiounen an net ubidderspezifesche Code. Dofir kënne GPT, Claude, Gemini, Grok a lokal Modeller dëse Skill lueden, wann eng Ufro dozou passt.

Wéi vill KI-Modeller kann ech mat Memory Consistency Model Selector benotzen?

Esou vill Dir wëllt. Soulaang e Modell Skills ënnerstëtzt, kënnt Dir Memory Consistency Model Selector domat benotzen – GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama a méi – alles op TypingMind mat Ären eegenen API-Schlësselen.

Ass de KI-Skill Memory Consistency Model Selector gratis?

Jo. De Skill gëtt vum AnthonyAlcaraz ënner der Lizenz MIT op GitHub publizéiert. Dir bezuelt nëmmen Ären eegene KI-Ubidder fir d'Token, déi Dir benotzt.

Wat si KI-Skills?

E KI-Skill ass e weiderverwendbaart Pak vun Instruktiounen, dat engem KI-Modell bäibréngt, wéi en eng bestëmmt Aufgab erfëllt. E follegt dem oppenen Agent Skills-Format: eng Datei SKILL.md mat engem Numm an enger Beschreiwung, plus all Scripten, Virlagen oder Referenzdateien, déi de Modell eventuell brauch. De Modell liest d'Instruktiounen eréischt, wann Är Ufro zum Skill passt. En installéierte Skill kascht also näischt, bis e benotzt gëtt.

Wéi ënnerscheede sech KI-Skills vu Plugins oder MCP-Serveren?

E Plugin oder MCP-Server gëtt engem Modell nei Tools, déi en opruffe kann – Code, deen iergendwou leeft an e Resultat zeréckgëtt. E KI-Skill gëtt dem Modell dogéint Wëssen an eng Virgoensweis: wéi en eng Aufgab ugeet, wéi eng Schrëtt en nokënnt a wéi eng gutt Ausgab ausgesäit. Skills bestinn aus einfachem Markdown, brauche kee Server, keen API-Schlëssel a keng Lafzäitëmfeld a funktionéiere mat all Modell.

All weisen

Elo Ären eegene KI-Workspace ariichten

Abonnéiert Iech op eisen Newsletter, fir iwwer nei Funktiounen an zukünfteg Gewënnspiller informéiert ze ginn 👇