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-design3description: 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.4metadata:5 source: https://skillmd.com/skills/samotech/agent-memory-schema-design6 upstream: skills/03-memory/agent-memory-schema-design.md7 category: 03-memory8 version: "v1"9---1011# Agent Memory Schema Design1213## Description14Design 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.1516## When to Use17- a memory store needs a declared schema before the first write; downstream steps cannot proceed safely without one.18- Ambiguity or missing evidence would change the outcome.19- The result must be recorded with reasons and evidence for later verification.2021## Inputs / Outputs22| Area | Contract |23|---|---|24| Inputs | Task context, candidate inputs, and explicit acceptance criteria for agent memory schema design work. |25| Outputs | A decision or artifact with recorded reasons, rejected alternatives, and verification evidence. |26| Safety | Failures must fail closed and be reported with evidence rather than retried silently. |2728## Procedure291. Define the goal, the constraints, and the boundary of what this procedure may change.302. Inventory the available inputs and flag gaps or ambiguities that block progress.313. Execute the agent memory schema design steps in a bounded, checkpointed way.324. Compare the actual outcome against the expected outcome and record deviations.335. On failure, apply the declared fallback path, and never widen permissions to recover.346. Emit a structured result with evidence and provenance for downstream consumers.3536## Runnable Example37```python38SCHEMA = {"fact", "source", "ts"}3940def validate_write(record):41 missing = SCHEMA - set(record)42 extra = set(record) - SCHEMA43 if missing or extra:44 return False, (sorted(missing), sorted(extra))45 return True, None4647assert validate_write({"fact": "a", "source": "u", "ts": 1})[0] is True48ok, err = validate_write({"fact": "a"})49assert ok is False and "source" in err[0]50```5152## Failure Modes53- Storing free-form text with no typed fields.54- Changing the schema without a migration plan for old records.55- Omitting provenance slots that later audits need.56- Allowing silent field overloading.57- Retaining records past the declared retention rule.5859## Boundary60This skill operates inside the declared task boundary. It does not grant permissions, bypass approval gates, or widen access to achieve its result.6162## Evidence63Memory 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.6465## Related66- memory-indexing.md67- hierarchical-memory-organization.md68- memory-ttl.md