agentleFS
ycl-2004ycl-2004/ShareMemory/SKILL.md

share-memory

Skill3 starsChanged 3 months agoMITView on GitHub

Project-scoped shared memory for AI coding agents (Claude Code + Codex) via one AI_MEMORY/ per project. Use when the user says "init memory", "update memory", "sync memory", "memory status", "consolidate memory", "repair memory", "migrate memory", "更新记忆", "共享记忆", when AI_MEMORY/ is missing in a project that should have it, or to record completed work for the other agent. Do NOT use for: general chat memory, non-project shared state, one-off summaries, cross-project personal preferences, writing-materials archiving, or read-only audits. If the user forbids writing ("don't modify anything", "read-only audit", "only write the report"), auto-write is paused — do not write AI_MEMORY/ and say so at the end.

1 other project uses a version of this.

Adopted by

Most recently taken up by

  • Other versions1 project uses a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 1

    1. EllAchE/skill-observability★ 0same name

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

The file

We split this skill into the rules it gives an agent

4 rules. About 0 are common, 1 is distinctive, and 3 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    After init, the rules live in the project's MEMORY_PROTOCOL.md — that file (not this skill) is the source of truth for day-to-day behavior.

    line 17
  2. Very specific:

    Before ANY write inside AI_MEMORY/ (incl.

    line 23
  3. Very specific:

    Use the protocol's file-routing cadence before writing: prefer existing files, write only facts that help the next project agent, and …

    line 24
  4. Distinctive:

    Never plain-append: repeated runs must never produce a second block.

    line 67

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

ShareMemory Skill

Sets up and maintains a file-based shared memory (AI_MEMORY/) that Claude Code and Codex both read/write in the same project, so each agent sees the other's decisions and changes.

This skill is installable on both platforms (same folder, same SKILL.md):

  • Claude Code: ~/.claude/skills/share-memory/ (personal) or <project>/.claude/skills/share-memory/ (project)
  • Codex: ~/.agents/skills/share-memory/

AGENT_NAME: use Claude when running as Claude Code, Codex when running as Codex. After init, the rules live in the project's MEMORY_PROTOCOL.md — that file (not this skill) is the source of truth for day-to-day behavior.

Memory model:

  • SYNC_LOG.md + archive/ are daily handoff history, with at most one block per date.
  • PROJECT.md, DECISIONS.md, TASKS.md, and LEARNINGS.md are current views.
  • Boot layer: AGENTS.md carries the shared agent-neutral rules; CLAUDE.md imports it via @AGENTS.md and adds Claude-only notes. All skill-managed boot content lives inside <!-- SHAREMEMORY:START --> / <!-- SHAREMEMORY:END --> marker blocks.
  • Before ANY write inside AI_MEMORY/ (incl. creating or archiving files), acquire AI_MEMORY/.write.lock per the protocol.
  • Use the protocol's file-routing cadence before writing: prefer existing files, write only facts that help the next project agent, and refresh PROJECT.md / LEARNINGS.md when durable context would otherwise be missed.

Determine the operation from the user's intent: init, update, status, consolidate, repair, or migrate.

Intent routing (first-trigger decision table):

User says / situationOperationPre-check
"init memory", first time in project, AI_MEMORY/ missinginitIf AI_MEMORY/ already populated → status instead (idempotent)
"update memory", "sync memory", "更新记忆", "同步记忆", record progressupdateMust have AI_MEMORY/ initialized
"memory status", "状态", "what changed"statusRead-only — never writes
"consolidate memory", "压缩记忆"consolidateAcquire write lock first
"repair memory", boot files broken, lint failsrepairAcquire write lock; back up files before fixing
"migrate memory", protocol version mismatchmigrateUser must explicitly consent; acquire write lock

Mandatory stop points (halt and ask user before proceeding):

  • Creating or replacing boot files/marker blocks without an explicit init memory, repair memory, or consented migrate memory request
  • Enabling git or running git init
  • Removing a .write.lock that is NOT yet stale (younger than the TTL; stale locks past the TTL auto-reclaim — no stop needed)
  • Migrating protocol version
  • Any publishing-channel operation

Read-only vs auto-write rule: When the user imposes a write restriction (e.g. "only write this report", "don't modify anything", "read-only audit"), auto-write of decisions / task-completion log bullets is PAUSED for the entire session. At the end, state: "Per user restriction, memory was not updated." The user can later lift the restriction by saying "update memory" explicitly.

Project-helpfulness routing check (run before update, after significant task completion, and before long handoff):

If this changedWrite / refresh
Project goal, scope, architecture, workflow, install path, public contractPROJECT.md and/or DECISIONS.md
Skill behavior, memory protocol, rule/schema, boot template, lint gate, or install/publish contractDECISIONS.md; refresh PROJECT.md Long-Term Memory if startup would be stale
Active work now needs a next action, blocker, owner, continuation state, or completion markTASKS.md automatically if handoff would be incomplete; otherwise only on update memory
Confirmed bug cause, validation trap, release gotcha, repeated failure modeLEARNINGS.md automatically if reusable; otherwise skip
Long-Term Memory would be stale for a fresh agentrewrite PROJECT.md Long-Term Memory
Only today's handoff changedone compact SYNC_LOG.md bullet

Current protocol version shipped by this skill: v1.3.

Marker block rules (used by init, repair, migrate)

For each boot file (AGENTS.md, CLAUDE.md):

  • File doesn't exist → create it from this skill's templates/project/.
  • File exists, no SHAREMEMORY block → back it up (<file>.bak.YYYYMMDD-HHMMSS), then INSERT the template's block (top of CLAUDE.md so the import loads first; end of AGENTS.md).
  • File exists with a block → back it up, then REPLACE the block content with the template's. Never touch user content outside the markers.
  • Never plain-append: repeated runs must never produce a second block.

Operations

Full step-by-step for every operation lives in references/operations.md — read the relevant section there before executing. Quick map:

  • init — detect project state (skip if already initialized); ask language + git; bootstrap the lock helper, acquire the init lock, create the boot/memory files, lint/commit if enabled, then release.
  • update — run the helpfulness routing check; touch only files that truly changed; route accepted architecture / dependency / skill behavior / memory protocol / rule/schema / boot template / lint gate / install/publish contract decisions → DECISIONS.md; one SYNC_LOG.md bullet per file; lint; commit if Git: enabled.
  • status — read-only; report AGENT_NAME, last writer, project state, active tasks, latest 1-2 daily blocks, lock state + last boot receipt (scripts/memory_lock.sh status), lint result, and protocol-version drift.
  • consolidate — merge/dedup, rewrite PROJECT.md Long-Term (≤30 lines, re-read first), move overflow + old daily blocks to archive/, lint.
  • repair — fix missing @AGENTS.md import / broken marker blocks / missing files / stale lock; restore scripts from templates/project/; lint and report what was fixed.
  • migrate — version upgrade with user consent; rebuild marker blocks + restore protocol/scripts from templates/project/; carry forward all entries; bump CONFIG.md version; lint.

Failure modes

On any conflict — lock held, permission denied, git missing, protocol mismatch, missing template, lock race, or a user write-restriction — stop or degrade exactly per the table in references/operations.md. Never bypass the lock or write while a restriction is in effect.

Always

  • Sign entries ### [YYYY-MM-DD HH:MM] [AGENT_NAME] Title — timestamp from date "+%Y-%m-%d %H:%M", never guessed.
  • Telegraphic style, ≤3 lines per entry, language per CONFIG.md. Write only facts that change what a future agent should do. NEVER write secrets into memory.
  • Cross-agent state lives in AI_MEMORY/ only — never rely on Claude auto memory or any agent-private store for facts the other agent needs.
  • At the end of meaningful work, run the project-helpfulness routing check before deciding whether to update memory; avoid durable entries when a compact SYNC_LOG.md bullet is enough.
  • Decisions, dependency changes, rule/protocol contract changes, handoff-critical task state, confirmed reusable lessons, and task-completion log bullets are AUTO-written per protocol §5 even when this skill isn't invoked.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.