name: agent-memory-schema-design
description: Design typed memory schemas with explicit fields, retention rules, and provenance slots before storage, and reject writes that do not conform to the declared schema.
metadata:
source: skills/03-memory/agent-memory-schema-design.md
category: 03-memory
version: "v1"
Agent Memory Schema Design
Description
Design typed memory schemas with explicit fields, retention rules, and provenance slots before storage, and reject writes that do not conform to the declared schema. The procedure is constrained by explicit inputs and acceptance criteria rather than best-effort judgment alone.
When to Use
- a memory store needs a declared schema before the first write; downstream steps cannot proceed safely without one.
- Ambiguity or missing evidence would change the outcome.
- The result must be recorded with reasons and evidence for later verification.
Inputs / Outputs
| Area |
Contract |
| Inputs |
Task context, candidate inputs, and explicit acceptance criteria for agent memory schema design work. |
| Outputs |
A decision or artifact with recorded reasons, rejected alternatives, and verification evidence. |
| Safety |
Failures must fail closed and be reported with evidence rather than retried silently. |
Procedure
- Define the goal, the constraints, and the boundary of what this procedure may change.
- Inventory the available inputs and flag gaps or ambiguities that block progress.
- Execute the agent memory schema design steps in a bounded, checkpointed way.
- Compare the actual outcome against the expected outcome and record deviations.
- On failure, apply the declared fallback path, and never widen permissions to recover.
- Emit a structured result with evidence and provenance for downstream consumers.
Runnable Example
SCHEMA = {"fact", "source", "ts"}
def validate_write(record):
missing = SCHEMA - set(record)
extra = set(record) - SCHEMA
if missing or extra:
return False, (sorted(missing), sorted(extra))
return True, None
assert validate_write({"fact": "a", "source": "u", "ts": 1})[0] is True
ok, err = validate_write({"fact": "a"})
assert ok is False and "source" in err[0]
Failure Modes
- Storing free-form text with no typed fields.
- Changing the schema without a migration plan for old records.
- Omitting provenance slots that later audits need.
- Allowing silent field overloading.
- Retaining records past the declared retention rule.
Boundary
This skill operates inside the declared task boundary. It does not grant permissions, bypass approval gates, or widen access to achieve its result.
Evidence
Memory governance for agents is a recurring 2026 concern as long-term memory adoption grows in public coverage; this is a dated signal, not an adoption metric.
Related
- memory-indexing.md
- hierarchical-memory-organization.md
- memory-ttl.md
1---2name: agent-memory-schema-design-23description: Design typed memory schemas with explicit fields, retention rules, and provenance slots before storage, and reject writes that do not conform to the declared sc4---5---6name: agent-memory-schema-design7description: Design typed memory schemas with explicit fields, retention rules, and provenance slots before storage, and reject writes that do not conform to the declared schema.8metadata:9 source: skills/03-memory/agent-memory-schema-design.md10 category: 03-memory11 version: "v1"12---1314# Agent Memory Schema Design1516## Description17Design typed memory schemas with explicit fields, retention rules, and provenance slots before storage, and reject writes that do not conform to the declared schema. The procedure is constrained by explicit inputs and acceptance criteria rather than best-effort judgment alone.1819## When to Use20- a memory store needs a declared schema before the first write; downstream steps cannot proceed safely without one.21- Ambiguity or missing evidence would change the outcome.22- The result must be recorded with reasons and evidence for later verification.2324## Inputs / Outputs25| Area | Contract |26|---|---|27| Inputs | Task context, candidate inputs, and explicit acceptance criteria for agent memory schema design work. |28| Outputs | A decision or artifact with recorded reasons, rejected alternatives, and verification evidence. |29| Safety | Failures must fail closed and be reported with evidence rather than retried silently. |3031## Procedure321. Define the goal, the constraints, and the boundary of what this procedure may change.332. Inventory the available inputs and flag gaps or ambiguities that block progress.343. Execute the agent memory schema design steps in a bounded, checkpointed way.354. Compare the actual outcome against the expected outcome and record deviations.365. On failure, apply the declared fallback path, and never widen permissions to recover.376. Emit a structured result with evidence and provenance for downstream consumers.3839## Runnable Example40```python41SCHEMA = {"fact", "source", "ts"}4243def validate_write(record):44 missing = SCHEMA - set(record)45 extra = set(record) - SCHEMA46 if missing or extra:47 return False, (sorted(missing), sorted(extra))48 return True, None4950assert validate_write({"fact": "a", "source": "u", "ts": 1})[0] is True51ok, err = validate_write({"fact": "a"})52assert ok is False and "source" in err[0]53```5455## Failure Modes56- Storing free-form text with no typed fields.57- Changing the schema without a migration plan for old records.58- Omitting provenance slots that later audits need.59- Allowing silent field overloading.60- Retaining records past the declared retention rule.6162## Boundary63This skill operates inside the declared task boundary. It does not grant permissions, bypass approval gates, or widen access to achieve its result.6465## Evidence66Memory governance for agents is a recurring 2026 concern as long-term memory adoption grows in public coverage; this is a dated signal, not an adoption metric.6768## Related69- memory-indexing.md70- hierarchical-memory-organization.md71- memory-ttl.md