Guard System
The Guard is SharedMemory's quality control layer. Every memory entry passes through validation before being accepted.
Why a Guard?​
Without validation:
- The same fact gets stored 50 times
- Contradictory facts coexist
- Low-quality data pollutes the knowledge graph
Tiered Architecture​
Tier 1: Similarity Threshold (instant)​
| Similarity Score | Decision |
|---|---|
| < 0.55 | Auto-approve — New knowledge |
| > 0.97 | Auto-reject — Near-duplicate |
| 0.55 – 0.97 | Escalate to Tier 2 |
This fast path handles ~70% of entries without an LLM call.
Tier 2: LLM Guard​
For ambiguous cases, an LLM evaluates the new entry against existing knowledge.
| Decision | Action |
|---|---|
approved | New, non-conflicting → index it |
rejected | Contradicts existing → discard |
flagged | Potentially conflicting — needs review |
merged | Complementary — combined with existing |
duplicate | Semantically identical — skip |
Examples​
New: "John moved to Seattle in 2024"
Existing: "John lives in San Francisco"
Score: 0.72
Decision: flagged (potential conflict)
New: "John is a software engineer"
Existing: "John Smith works as a senior software engineer at Google"
Score: 0.89
Decision: duplicate (existing is more specific)
New: "John completed his AWS certification in March 2024"
Existing: "John has experience with cloud computing"
Score: 0.61
Decision: approved (new specific fact that complements existing)
Monitoring​
Guard decisions are logged in Postgres, broadcast via WebSocket, visible in the dashboard activity feed, and exposed through webhooks.