Agent Memory

Модуль 13 · Урок 13.10

Урок 13.10. Semantica: graph-native context, provenance и accountable AI memory

На этой странице
  1. План лекции
  2. Цель лекции
  3. Ожидаемый результат
  4. Короткая карточка инструмента
  5. Почему accountable memory отличается от обычной памяти
  6. Context Graph
  7. Decision Intelligence
  8. Provenance
  9. Ontology and governance
  10. Deterministic reasoning
  11. Conflict detection and deduplication
  12. Polyglot graph storage
  13. End-to-end pipeline
  14. Enterprise data connectors
  15. Типы памяти из курса
  16. Мини-кейс: lending decision
  17. Мини-кейс: healthcare interaction warning
  18. Сравнение с Cognee
  19. Сравнение с Honcho
  20. Риски и ограничения
  21. Как тестировать Semantica
  22. Практический rollout
  23. Антипаттерны
  24. Чек-лист выбора Semantica
  25. Источники
  26. Краткое резюме
  27. Вопросы для самопроверки
  28. Что дальше

План лекции

Сначала мы разберем Semantica как graph-native infrastructure for context and accountable AI systems. В отличие от lightweight memory SDK, Semantica ориентирована на regulated and high-stakes domains, где нужно не просто вспомнить факт, а доказать, откуда он взялся and почему решение было принято.

Затем рассмотрим Context Graphs, Decision Intelligence, provenance, ontology governance, deterministic reasoning, conflict detection and polyglot graph storage. В конце сравним Semantica с Cognee and Honcho, разберем сценарии внедрения and checklist для enterprise memory systems.

Цель лекции

Понять Semantica как open-source graph-native memory/context infrastructure, которая добавляет к agent stack объяснимость, provenance, rules, ontology and decision audit trail.

Ожидаемый результат

После лекции читатель понимает:

  • почему vector RAG недостаточен для accountable AI;
  • что такое Context Graph;
  • зачем decisions делать first-class graph nodes;
  • как provenance and ontology governance помогают compliance;
  • какие reasoning engines используются в graph-native memory;
  • когда Semantica уместна, а когда она слишком тяжелая.

Короткая карточка инструмента

Поле Значение
Repository https://github.com/semantica-agi/semantica
Stars snapshot GitHub page показывает около 315 forks на 2026-08-08
Primary language Python
License MIT
Category Graph-native context and accountable AI infrastructure
Core objects Context Graphs, decisions, provenance, ontology, rules
Storage RDF stores, labeled property graphs, vector stores
Integrations CLI, REST API, MCP, Agno, enterprise data connectors

Semantica описывает себя как infrastructure layer under LLM, vector store and agent framework. Ее цель - structured, queryable context with provenance, reasoning and auditability.

Почему accountable memory отличается от обычной памяти

Обычная agent memory отвечает:

text
Что агент знает?

Accountable memory отвечает:

text
Что агент знает, откуда это известно, какие правила применялись, почему было принято решение, и можно ли это доказать аудитору?

В consumer assistant может быть достаточно remembered preference. В lending, healthcare, legal, government or defense этого мало. Если AI system принимает consequential decision, через месяцы может появиться вопрос:

text
Почему была одобрена заявка?
Какие источники использовались?
Какие правила применялись?
Какие альтернативы были похожи?
Что изменилось после решения?

Semantica строится именно вокруг таких вопросов.

Context Graph

Context Graph - structured memory layer, который отвечает не только "что похоже?", но и "что связано, почему and как?".

flowchart TD D[Documents and data] --> E[Entities] D --> F[Facts] D --> DEC[Decisions] E --> R[Relationships] F --> P[Provenance] DEC --> C[Causes and effects] R --> KG[(Context Graph)] P --> KG C --> KG KG --> Q[Graph traversal and reasoning]

В таком graph каждый entity, relationship, decision and fact becomes first-class node or edge. Это позволяет делать traversal, impact analysis and audit trail.

Decision Intelligence

Decision Intelligence - одна из центральных идей Semantica. Решение не остается ephemeral LLM output. Оно записывается как graph node:

  • category;
  • scenario;
  • reasoning;
  • outcome;
  • confidence;
  • metadata;
  • causal links;
  • downstream effects;
  • policy checks;
  • similar precedents.
flowchart LR A[Application data] --> D1[Decision 1] D1 -->|CAUSED| D2[Decision 2] D2 -->|INFLUENCED| D3[Decision 3] D1 --> P1[Provenance] D2 --> P2[Policy check] D3 --> IMP[Impact analysis]

Это превращает "LLM решил" в auditable object. Для regulated domains это не feature, а базовое требование.

Provenance

Semantica заявляет W3C PROV-O provenance on every fact. Это значит, что fact should carry lineage:

  • source;
  • extractor;
  • timestamp;
  • transformation;
  • confidence;
  • related decision;
  • exportable representation.

Provenance отвечает на вопрос:

text
Where did this claim come from?

Без provenance graph может быть красивым, но недостоверным. Агент будет делать confident answers based on untraceable memory.

Ontology and governance

Semantica включает ontology tooling: OWL generation, SHACL validation, SKOS vocabularies, compliance rules.

Зачем это memory layer?

Потому что enterprise memory needs schema discipline. Если один extractor пишет Customer, другой Client, третий Account, граф быстро загрязняется. Ontology задает vocabulary and constraints.

Tooling Зачем нужно
OWL Formal ontology and class relationships.
SHACL Validation constraints for graph data.
SKOS Controlled vocabularies and taxonomies.
Rule engine Policy gates and deterministic checks.

В regulated contexts memory cannot be just embeddings. Она должна соответствовать rules.

Deterministic reasoning

README Semantica перечисляет forward chaining, Rete network, Datalog and SPARQL. Это важно: часть reasoning должна быть deterministic, explainable and replayable.

LLM reasoning:

text
probabilistic, hard to audit, prompt-dependent

Graph/rule reasoning:

text
explicit, replayable, explainable path

Для agent memory это значит: LLM может формулировать ответ, но critical conclusions should be backed by graph reasoning or policy rules.

Conflict detection and deduplication

Semantica делает акцент на conflicting facts flagged instead of silently overwritten, and duplicates merged before they become noise.

Это прямо связано с memory quality:

  • два источника дают разные даты;
  • один клиент сменил статус;
  • два entity name variants refer to same organization;
  • old fact conflicts with new fact;
  • extractor creates duplicate nodes.

Плохая память silently overwrites or stores all facts without interpretation. Хорошая память flags conflict, preserves provenance and requires resolution.

Polyglot graph storage

Semantica поддерживает RDF and labeled property graph approaches:

Storage family Примеры
RDF triple stores Oxigraph, Blazegraph, Apache Jena, Eclipse RDF4J
Labeled property graphs Neo4j, FalkorDB, Apache AGE, AWS Neptune
Vector stores FAISS, Qdrant, Weaviate, Milvus, Pinecone, PgVector

Polyglot storage matters because enterprise stacks already differ. Some teams live in RDF and SPARQL. Others use Neo4j/Cypher. Others need vector search alongside graph.

Semantica tries to be swappable: storage backend should not force the memory model.

End-to-end pipeline

README описывает Semantica as pipeline:

text
Sources -> Ingest -> Parse -> Normalize -> Split -> Extract
-> Conflict Detection -> Deduplication -> Knowledge Graph
-> Ontology / Reasoning / Provenance / Decisions
-> Vector Store + Graph Store -> Export / Visualize / REST / MCP / CLI
flowchart TD S[Sources] --> I[Ingest] I --> P[Parse] P --> N[Normalize] N --> SPL[Entity-aware split] SPL --> X[Extract entities relations events] X --> C[Conflict detection] C --> D[Deduplication] D --> KG[Knowledge Graph] KG --> O[Ontology] KG --> R[Reasoning] KG --> PR[Provenance] KG --> DI[Decisions] DI --> OUT[Export Visualize API MCP CLI]

Это не lightweight memory SDK. Это data/knowledge infrastructure.

Enterprise data connectors

Semantica mentions enterprise platforms like Databricks and Snowflake, plus files, web, databases, APIs, streams, email, Git, MCP.

Для high-stakes memory source integration matters. Если данные уже живут in Snowflake or Databricks, экспортировать их в сторонний SaaS может быть impossible. Self-hosted graph-native pipeline solves governance concerns.

Но чем больше sources, тем важнее:

  • lineage;
  • access control;
  • retention;
  • schema mapping;
  • conflict handling;
  • incremental updates.

Типы памяти из курса

Тип памяти Как Semantica его закрывает
World memory / RAG Multi-source ingestion and searchable knowledge graph.
Semantic memory Entities, relationships, facts, ontology.
Episodic memory Events and decisions over time.
Reflection memory Decision analysis, impact analysis, precedents.
Shared memory Single graph context layer across agents.
Procedural memory Rules and policies encoded in deterministic engines.

Semantica особенно сильна в world/semantic/shared memory for enterprise.

Мини-кейс: lending decision

Underwriting agent approves loan. Через шесть месяцев regulator asks why.

Vector RAG может показать похожие documents, but that is not enough. Semantica-style memory should show:

  • application data;
  • policy rule applied;
  • decision node;
  • causal chain;
  • source provenance;
  • confidence;
  • similar precedents;
  • downstream rate assignment;
  • exportable audit trail.
sequenceDiagram participant Agent participant Graph as Context Graph participant Rules participant Auditor Agent->>Graph: record_decision underwriting Agent->>Rules: check policy Rules-->>Graph: compliance result Graph->>Graph: link causes and effects Auditor->>Graph: why was this approved? Graph-->>Auditor: decision chain with provenance

This is accountable memory.

Мини-кейс: healthcare interaction warning

Healthcare agent flags drug interaction. Memory must preserve:

  • patient medication source;
  • clinical rule;
  • detected interaction;
  • decision to flag;
  • dosage recommendation;
  • clinician review status;
  • export trail.

Здесь hallucinated memory is dangerous. Graph provenance and deterministic rules are more important than conversational convenience.

Сравнение с Cognee

Критерий Cognee Semantica
Основной фокус AI memory platform with knowledge graph and retrieval Accountable graph-native context and decision intelligence
Provenance Важна for documents and graph memory Центральный feature with PROV-O and audit export
Reasoning Graph reasoning and hybrid recall Deterministic rules, Datalog, SPARQL, Rete, policy gates
Сценарий Agents needing graph-RAG and long-term context Regulated domains needing auditability
Complexity Medium/high High

Cognee подходит шире for knowledge graph memory. Semantica сильнее там, где нужно prove and govern.

Сравнение с Honcho

Honcho peer-centric: models people, agents, sessions and evolving representations.

Semantica decision-centric and graph-governed: models entities, facts, decisions, provenance and rules.

Если задача social/companion/multi-peer, Honcho ближе. Если задача regulated decision audit, Semantica ближе.

Риски и ограничения

Первый риск - complexity. Semantica covers many layers; adopting all at once is risky.

Второй риск - ontology upfront cost. Formal governance requires domain modeling.

Третий риск - false determinism. Rule engine is deterministic only if input facts and mappings are correct.

Четвертый риск - data integration burden. Enterprise connectors need permissions, lineage and schema mapping.

Пятый риск - overengineering. For a simple assistant, Semantica can be far too heavy.

Как тестировать Semantica

Тест Что проверяет
Provenance completeness Every fact links to source.
Decision replay Decision chain can be reconstructed later.
Rule validation SHACL/policy gates catch invalid graph state.
Conflict handling Contradictory facts are flagged, not hidden.
Entity resolution Duplicates merge without losing provenance.
Time travel Point-in-time graph snapshot returns expected state.
Export Audit trail exports to required formats.
Backend swap Storage backend can change without model rewrite.

Для high-stakes systems тесты должны быть audit-oriented, not only retrieval-oriented.

Практический rollout

Не начинайте с full enterprise pipeline. Выберите один decision type:

text
vendor_selection
loan_underwriting
drug_interaction_check
contract_risk_review

Затем:

  1. Определите ontology for decision and evidence.
  2. Record decisions as graph nodes.
  3. Attach provenance to every input fact.
  4. Add simple policy checks.
  5. Export audit trail.
  6. Only then expand ingestion sources.

Semantica сильна, когда область хорошо смоделирована. Без domain model она превращается в complicated graph bucket.

Антипаттерны

Первый антипаттерн - использовать Semantica as vector DB wrapper. Тогда теряется value of provenance and reasoning.

Второй антипаттерн - записывать decisions без causal links.

Третий антипаттерн - считать LLM extraction sufficient for compliance without validation.

Четвертый антипаттерн - не хранить source lineage for derived facts.

Пятый антипаттерн - вводить ontology after graph already polluted.

Чек-лист выбора Semantica

Semantica стоит рассмотреть, если:

  • агент принимает consequential decisions;
  • нужен audit trail;
  • есть compliance/risk/legal requirements;
  • facts need provenance;
  • conflicts must be detected;
  • deterministic reasoning matters;
  • enterprise data sources need self-hosted processing;
  • graph traversal and impact analysis are core value.

Если нужна простая personalization memory, это слишком тяжелый выбор. Если нужна graph-RAG без full compliance stack, Cognee may be lighter.

Источники

  • GitHub repository: https://github.com/semantica-agi/semantica
  • README: https://github.com/semantica-agi/semantica/blob/main/README.md
  • Architecture file: https://github.com/semantica-agi/semantica/blob/main/ARCHITECTURE.md
  • W3C PROV-O overview: https://www.w3.org/TR/prov-o/

Краткое резюме

Semantica показывает accountable memory: память, которая хранит не только facts, но и provenance, causal links, decisions, policies and reasoning paths. Это особенно важно для domains, где AI decision must survive audit.

Главный урок: чем выше stakes, тем меньше можно полагаться на opaque embeddings. Нужны graph structure, source lineage, rule validation and explainable reasoning.

Вопросы для самопроверки

  1. Почему vector RAG недостаточен для regulated decision systems?
  2. Что такое Context Graph?
  3. Зачем decision делать first-class graph node?
  4. Как provenance меняет доверие к памяти?
  5. Зачем SHACL/OWL/SKOS в memory layer?
  6. Чем deterministic reasoning отличается от LLM reasoning?
  7. Когда Semantica лучше Honcho?
  8. Почему Semantica может быть overkill for consumer assistant?

Что дальше

В следующей лекции мы завершим deep-dive блока инструментом Deja-vu. Он позволит обсудить memory through repeated experience and recall in a more focused, agent-oriented package, а затем модуль можно будет закрывать финальной проверкой.

Обновлено 08.08.2026