Functions§
- normalize_
namespace - Normalize a namespace input to the canonical form accepted by
validate_namespace. Not called by write paths (would lowercase existing flat namespaces and break their lookup keys); instead exposed as a helper that callers opt into, and used by Task 1.5+ when accepting user-typed hierarchical paths. - validate_
agent_ id - Validate an agent identifier (NHI-hardened).
- validate_
agent_ type - Validate an agent type. Accepts any value matching one of these forms (red-team #235 — the original closed whitelist blocked future agents):
- validate_
capabilities - Validate a list of capability strings. Shares
validate_tagsrules (non-empty, <=128 bytes each, clean chars, <=50 entries). - validate_
confidence - validate_
consolidate - Validate consolidation request.
- validate_
content - validate_
create - Validate a full
CreateMemorybefore insert. - validate_
expires_ at - validate_
expires_ at_ format - Validate
expires_atformat only (no past-date check). Used by update path. - validate_
governance_ policy - Validate a [
GovernancePolicy] (Task 1.8). Closed-set tag checks are already handled by serde on deserialization; this adds semantic bounds: consensus quorum must be ≥ 1, Agent references must passvalidate_agent_id, and the policy as a whole must not useGovernanceLevel::Approvewithout a meaningful approver. - validate_
id - validate_
link - Validate link creation.
- validate_
memory - Validate a full Memory (used for import).
- validate_
metadata - validate_
namespace - Validate a namespace (flat or hierarchical, Task 1.4).
- validate_
priority - validate_
relation - validate_
scope - Validate a visibility scope against the closed
VALID_SCOPESset (Task 1.5). Enforced on write paths that accept an explicitscopeparameter. Memories with noscopemetadata are treated asprivateby the query layer without needing explicit validation here. - validate_
source - validate_
tags - validate_
title - validate_
ttl_ secs - validate_
update - Validate update fields (only validates present fields).
Note:
expires_atallows past dates in updates for programmatic TTL management and GC testing — only format is validated, not chronological ordering.