shared-memory is an Agent Skill for deliberate, auditable cross-agent memory.
It gives agents a narrow, explicit way to assess, retrieve, validate, write, and deprecate durable knowledge that should be reused across multiple agents, skills, or repositories. It is intentionally not a general memory system, a task scratchpad, or a place to hide project-local facts.
This repository implements the shared layer in a three-layer memory model:
| Layer | Scope | Persistence | Managed Here |
|---|---|---|---|
| Runtime memory | Current task or thread | Ephemeral | No |
| Project / skill memory | One repository, project, or skill | Persistent but local | No |
| Shared memory | Multiple agents, skills, or repositories | Persistent and cross-agent | Yes |
The skill exists to keep that boundary crisp. Shared memory should stay trustworthy, sparse, and reusable.
This skill does not manage:
- task-local notes or plans
- project-local persistent memory
- secrets or private operational data
- autonomous self-modifying memory behavior
- broad enterprise knowledge infrastructure beyond the shared-store contract
Those are related concerns, but they remain outside the scope of this repository by design.
Agent work often spans long threads, multiple sessions, and more than one repository. Without a durable shared layer, agents repeatedly rediscover the same cross-cutting conventions and preferences.
This skill solves that specific problem by providing:
- a clear promotion boundary
- a deterministic CLI for interacting with the store
- a versioned schema with validation
- an auditable deprecation model instead of deletion
- tests and evaluation artifacts for maintainers
SKILL.md: agent-facing contract and workflowagents/openai.yaml: UI-facing metadata for skill catalogsscripts/manage_memory.py: supported CLI for assessment, reads, writes, deprecations, and validationreferences/promotion-guide.md: guidance for deciding what belongs in shared memoryreferences/schema.md: canonical schema and CLI response contractassets/shared-memory-template.json: example storeevals/shared-memory-cases.json: boundary evaluation casestests/: CLI and repository contract tests
- Place this folder in your skill directory.
- Ensure Python 3.9+ is available.
- Optionally set
AGENT_SHARED_MEMORY_PATHif you do not want to use the default store path~/.agent_shared_memory.json.
The skill is self-contained. SKILL.md is the agent entry point, and scripts/manage_memory.py is the only supported interface for modifying the store.
The intended workflow is deliberate promotion, not indiscriminate retention:
- Assess whether a candidate belongs in shared memory at all.
- Search and read existing topics before writing.
- Write only stable, context-independent knowledge with a meaningful confidence score.
- Deprecate outdated guidance instead of deleting it.
- Validate the store when in doubt.
This keeps the shared layer useful instead of turning it into a noisy second wiki.
Assess whether a candidate belongs in shared memory:
python scripts/manage_memory.py assess \
--candidate "Use Conventional Commits across shared repositories unless a local guide overrides them." \
--scope cross-agent \
--stability stable \
--sensitivity internal \
--context-independent yes \
--format jsonList existing topics:
python scripts/manage_memory.py list-topics --format jsonSearch for a relevant topic before writing:
python scripts/manage_memory.py search --query "commit convention" --format jsonRead a topic:
python scripts/manage_memory.py read --topic "CommitConventions" --format jsonWrite a durable cross-agent convention:
python scripts/manage_memory.py write \
--topic "CommitConventions" \
--content "Use Conventional Commits across shared repositories unless a repository-specific guide overrides them." \
--source "Codex" \
--confidence 0.95 \
--tags "git,conventions" \
--evidence "Observed across shared engineering guidance and multiple repositories." \
--format jsonDeprecate an outdated entry:
python scripts/manage_memory.py deprecate \
--topic "CommitConventions" \
--id 3 \
--reason "Superseded by the updated shared engineering standard." \
--format jsonValidate the store:
python scripts/manage_memory.py validate --format jsonSupported commands:
assesslist-topicssearchreadwritedeprecatevalidate
The CLI is designed for agentic use first:
- JSON is the default stdout format.
- Diagnostics go to stderr.
- Writes are atomic.
- Legacy flat stores are normalized on read.
- Deprecated entries remain in the audit trail.
- Exact active duplicates within a topic are blocked by default.
Run python scripts/manage_memory.py <command> --help for full flags.
Promote information into shared memory only when all of the following are true:
- It is useful beyond the current task.
- It applies across multiple agents, skills, or repositories.
- Another agent can use it without hidden local context.
- It is stable enough to survive beyond the current task.
- It contains no secrets, credentials, private data, or customer data.
If the candidate is:
- task-local, keep it in runtime memory
- persistent but repo-local, keep it in project / skill memory
- sensitive, unstable, or speculative, reject it
The store uses a versioned JSON schema:
{
"schema_version": "2.0",
"topics": {
"CommitConventions": [
{
"id": 1,
"status": "active",
"created_at": "2026-03-18T10:00:00Z",
"source": "Codex",
"confidence": 0.95,
"content": "Use Conventional Commits across shared repositories unless a repository-specific guide overrides them.",
"tags": ["git", "conventions"],
"evidence": "Observed in shared engineering guidance."
}
]
}
}See references/schema.md for field definitions, validation rules, and the command output contract.
- Cross-repository engineering conventions
- Shared documentation or review preferences
- Reusable prompt patterns that apply beyond one codebase
- Organization-wide defaults and guardrails
- Current task notes
- Intermediate reasoning
- Repository-specific paths or setup facts
- Secrets, credentials, or private data
- Guesses, rumors, or low-confidence observations
The diagram below shows the relationship between task context, local persistence, and the shared-memory layer managed by this skill.
This repository includes two validation layers:
tests/test_manage_memory.py: CLI regression coveragetests/test_repository_contract.py: packaging and contract checks forSKILL.md,agents/openai.yaml, and eval artifacts
It also includes prompt-style boundary cases in evals/shared-memory-cases.json.
Recommended maintenance loop:
- Update the skill or CLI.
- Run
python -m unittest discover -s tests. - Review and extend
evals/shared-memory-cases.jsonwhen boundaries or workflows change. - Update the docs and changelog for any externally visible behavior change.
The following are compatible with this repository but intentionally out of scope for the current implementation:
- a janitor or curator workflow for periodic cleanup
- alternate backing stores such as SQLite or a service layer
- organization-specific approval workflows around promotion
Those should remain integrations around the core skill, not coupled into the minimal shared-memory contract.
Favor changes that improve clarity, boundary safety, and deterministic behavior without expanding scope unnecessarily.
When contributing:
- keep
SKILL.mdconcise and agent-first - keep cross-agent and repo-local memory concerns separate
- prefer auditable CLI behavior over fuzzy implicit logic
- add or update tests when CLI behavior or repository contracts change
MIT. See LICENSE.
