collective-memory

collective-memory is a skill for Claude Code, Codex from Songhonglei/better-agent-skills. It costs 145 tokens per session (1,857 once invoked), scanned B, original, MIT.

A file-based way to copy one memory note into several AI-agent workspaces. It updates Markdown files such as MEMORY.md, AGENTS.md, TOOLS.md, or USER.md across selected targets.

In plain words
What is it for?
Use it to add or update facts, rules, workflows, tool settings, or personal information in multiple agent memory files, while replacing an existing section when its lookup key matches.
Why use it?
It removes the need to repeat the same manual edit in each agent workspace. It works locally without a network connection or an AI model.

Skill for Claude CodeCodex

Which agent this was written for is unclear — built for openclaw. Also seen: reads .claude/ paths; mentions Claude Code; mentions AGENTS.md.

Not installable: its command points at a path on the author’s own machine, so it runs nowhere else. The line is /home/me/code/proj-a.

Good fit Use it to add or update facts, rules, workflows, tool settings, or personal information in multiple agent memory files, while replacing an existing section when its lookup key matches.

Compare 6 skills from other repositories ↓
Install

Getting it into your agent

There is no command for this one: it runs only inside a plugin, and the catalogue could not identify which plugin ships it. The source is linked below.

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

README.md
[![agentmods](https://agentmods.dev/badge/skills/songhonglei/better-agent-skills/collective-memory/github.svg)](https://agentmods.dev/skills/songhonglei/better-agent-skills/collective-memory)
Your own site
<a href="https://agentmods.dev/skills/songhonglei/better-agent-skills/collective-memory"><img src="https://agentmods.dev/badge/skills/songhonglei/better-agent-skills/collective-memory/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 collective-memory

Your own site · 80×15
<a href="https://agentmods.dev/skills/songhonglei/better-agent-skills/collective-memory"><img src="https://agentmods.dev/badge/skills/songhonglei/better-agent-skills/collective-memory.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 145 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,857 The whole file, excluding the scripts and references it only reads on demand.
Security scan B 1 finding. 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.00145 $0.01857
Opus 5 $0.00072 $0.00928
Sonnet 5 $0.00029 $0.00371
Haiku 4.5 $0.00015 $0.00186

Measured 10d ago against content hash 51dc09199f4f, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-11, from the pricing page.

Security

Grade B, and why

collective-memory scanned grade B with 1 finding 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 10d ago.

The scan reads SKILL.md. This mod also ships 1 executable file (scripts/update_memory.py), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

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.

Asks for rootmediumPrivilege escalation

A mod that escalates privileges can change anything on the machine, not only the project.

stored in .secrets/api-keys.env (chmod 600)"
skills/collective-memory/SKILL.md · 219 lines

How it starts

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

Collective Memory

Broadcast a single memory note to multiple agent workspaces in one shot — idempotent upsert into MEMORY.md, AGENTS.md, TOOLS.md, USER.md, or any Markdown file across all targets.

Pure file-ops, zero network, zero LLM. The calling agent decides what to write and which key to look up; this script does the file work atomically.


Execution Flow

Step 1 — Extract the memory

From the user's request, extract three things:

  • content: the full Markdown block (must include its own ## heading line)
  • key: 1–5 word lookup phrase used to find an existing heading to update
  • file: which file to write into (default MEMORY.md)

File routing rules:

Content type Target file
Facts, rules, lessons, tool paths, APIs MEMORY.md
Workflows, do/don't, dev conventions AGENTS.md
Tool commands, config params, account info TOOLS.md
Information about the user themselves USER.md

When unsure, default to MEMORY.md.


Step 2 — Resolve agent targets (hybrid: explicit > discovery > confirm)

Pick the first strategy that yields targets:

A. Explicit (preferred when known)

--target /path/to/ws1:MEMORY.md \
--target /path/to/ws2:MEMORY.md

Or via env: COLLECTIVE_MEMORY_TARGETS="/ws1:MEMORY.md,/ws2:MEMORY.md".

B. Auto-discover (when user says "all my agents")

--discover-under ~/.claude/projects --file MEMORY.md
--discover-under ~/.openclaw/agents --file MEMORY.md
--discover-under ~/code            --file AGENTS.md

Each --discover-under <parent> finds first-level subdirectories.

Discovery defaults to check (in order, stop at first non-empty):

  1. $COLLECTIVE_MEMORY_TARGETS env
  2. ~/.claude/projects/ (Claude Code)
  3. ~/.openclaw/agents/ (OpenClaw)
  4. CWD's immediate sibling directories
  5. Ask the user

Read the full file on GitHub · 219 lines

Files

What ships with it

4 files 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. 10d ago First seen · 219 lines · 145 tokens per session scan B 51dc09199f4f

Subscribe to this mod's changes

collective-memory is a skill published in the GitHub repository Songhonglei/better-agent-skills (3 stars, last pushed 3d ago), licensed MIT. It adds 145 tokens to every session and 1,857 once invoked, about $0.0007 per session on Opus 5. A static security scan graded it B with 1 finding (asks for root). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.