← Back to blog
Architecture Full mirror CC-BY 4.0

Marvis architecture: a 16-edge cross-project knowledge graph with audit-grade memory and Brain-style reflection

Emilio Martucci · Published 19 May 2026 · 28 min read
Aggiornato al · Updated

Last reviewed 27 May 2026. Defensive-publication mirror; the canonical prior-art record is on Zenodo (DOI 10.5281/zenodo.20341860).

In short

→ A 16-edge knowledge graph makes cross-project "if I change X, what breaks?" queries deterministic.
→ An append-only, FK-linked audit log answers "who approved this on date X?" in SQL, EU AI Act Art. 12 ready.
→ A five-layer Brain loop turns activity into ratifiable knowledge, never auto-writing.

Abstract

Marvis is an open-source Company Brain designed to serve as a shared substrate for human developers and AI agents working on the same codebase across multiple projects. The system addresses three operational queries underserved by existing platforms: cross-project impact analysis, immutable decision audit, and agent-native knowledge sharing without re-onboarding cost.

The architecture spans eight functional domains (capture, store, retrieve, reflect, execute, agent-native, trust, productization). The core is a knowledge graph with sixteen deterministic edge types, combined with an append-only foreign-key-linked audit log and a five-layer cognitive reflection loop. We release the architecture for defensive-publication purposes under CC-BY 4.0.

Introduction

AI agents lose context across sessions, human developers lose context across projects, and organisations cannot answer simple audit questions ("who approved this change on date X?") without manual archaeology through chat threads and wiki pages.

Across a survey of adjacent platforms (agent-memory, enterprise search, data-catalog, PM incumbents), two queries have no first-class primitive: cross-project deterministic impact analysis, and immutable decision audit. Marvis is positioned to answer both natively.

The 16-edge knowledge graph

The Marvis knowledge graph defines 16 deterministic edge types over a typed node space. Nodes carry the identifier format {prefix}:{kind}:{slug}, where prefix denotes the source domain (py, ts, task, pr, commit, handoff, learning, audit, and more) and kind denotes the role (function, file, module, artifact, sheet).

The edges fall into five categories:

A watcher daemon listens to filesystem events and replays tree-sitter parsers over modified files. Each edge insert is idempotent (UPSERT on the source, destination, and edge type) and time-stamped, enabling time-travel as_of queries.

The five knowledge forms

Organisational memory is heterogeneous, and a single "document" abstraction obscures critical lifecycle differences. Marvis defines five typed forms:

Brain reflection: a five-layer loop

The Brain layer is a periodic cognitive cycle over the substrate:

Audit-grade memory

Every state-changing tool call writes to audit_log with foreign-key links to the task, PR, actor, and project that originated the call. The table is append-only at the database level: the runtime user has no UPDATE or DELETE grants. Timestamps use the database transaction clock to prevent agent-side time skew.

This pattern aligns with EU AI Act Art. 12 (record-keeping) and DORA operational-resilience requirements, and it passes Series-B due-diligence audit asks in seconds.

Constitution hooks

Five immutable rules are enforced at the filesystem level via git hooks and pre-tool wrappers:

Hooks are deterministic, fail-closed, and apply identically to human and agent actors.

EU AI Act alignment

The architecture aligns with three Article 12 requirements out of the box: automatic logging of system events, FK-linked record provenance, and time-stamped retention with privacy controls. Self-host deployment satisfies the obligation that records stay under the operator's direct control, a pattern multi-tenant managed SaaS cannot trivially satisfy without per-tenant log isolation.

Frequently asked questions

What makes the Marvis knowledge graph different from a code graph?

A code graph captures calls, imports, and defines. Marvis adds thirteen more deterministic edges across the work chain, the knowledge chain, and cross-project links, plus a resolves_to bridge. That is what lets a chat thread, a PR, a learning note, and a function be queried together across project boundaries.

How does the audit log satisfy EU AI Act Article 12?

Every state-changing call writes to an append-only audit_log with foreign keys to the task, PR, actor, and project. The runtime role has no UPDATE or DELETE grants, and timestamps use the database transaction clock. That provides automatic logging, FK-linked provenance, and time-stamped retention under the operator's direct control.

Does the Brain reflection loop write to memory automatically?

No. The loop observes, journals, detects drift, proposes operations, and surfaces findings, but every promotion to a durable artefact is approval-gated. Findings carry a confidence tier and a severity tier and are never auto-applied.

Cite this work
@misc{martucci2026marvis, author = {Martucci, Emilio}, title = {Marvis architecture: a 16-edge cross-project knowledge graph with audit-grade memory and Brain-style reflection}, year = {2026}, doi = {10.5281/zenodo.20341860}, note = {Defensive publication, CC-BY 4.0} }