Trellis
Local-first · Updated

Why agent memory needs both a graph store and a vector store

Vector-only misses multi-hop links; graph-only misses fuzzy meaning. For connected and semantic recall on your machine, dual local stores are the floor.

By Trellis

Ask an agent “something like the auth flow” and a vector store will surface similar prose. Ask which open tickets touch modules that import a utility, and similarity is the wrong tool: the answer lives on edges — ticket to module, module to import, import to that utility. Flip it and the other failure shows up. A clean relationship graph can walk those hops, then stall when the question is only a rephrase of meaning with no exact node name to start from.

The choice is not which chat model to pick. It is how many memory shapes you keep on the machine, and when one of them is no longer enough.

What one store is actually enough for

A single store is a legitimate start. Vector databases are strong at unstructured semantic search: fuzzy recall over prose, notes, and documentation when you do not yet have a modeled map of entities and links. Teams often begin there for simple grounding and add structure only when the questions demand it.

Local storage boxes and a laptop on a home-office shelf
Dual stores are an architecture choice with a placement: graph and vector engines on the machine you already trust.

Graph-only memory is also a coherent design when the corpus is already modeled and the work is path-heavy. If the questions are almost always “what connects to what,” “what depends on this,” or “walk three hops from this service,” relationship storage carries the load without a separate embedding index for every lookup.

Industry write-ups of agent memory make the same split: start with vectors when similarity is the whole job; introduce a graph when reasoning needs multi-hop and hierarchical structure that cosine neighbors do not encode. The decision is a when, not a ban on either shape.

Where vector-only memory stops for agents

Cosine neighbors answer “what looks like this.” They do not follow A→B→C. Once the agent must chain facts — a ticket that references a service that owns a module that imports a shared util — pure similarity stops being a map and becomes a bag of near matches.

That gap shows up hard on codebases. Dependency and ownership questions are graph questions. A comparison of vector databases and graph RAG for agent memory puts multi-hop, hierarchical, and high-precision relationship work — including codebase dependencies — on the graph side of the ledger, and treats vectors as the right tool for fuzzy semantic recall over unstructured text. You can keep pushing more text into embeddings; you still will not get an edge traversal out of a neighbor list.

Architecture surveys make the same trade explicit: vector stores excel at unstructured semantic search and lack hierarchy and relationships between data; knowledge graphs improve relationship-aware retrieval and lineage, at the cost of modeling and maintenance. Neither side claims the other is useless. Each claims a different failure mode.

A cloud of nearby semantic points with no path through a multi-hop dependency chain an agent needs to walk
Semantic neighbors can cluster related text. They do not walk A→B→C.

Where graph-only memory stops

Graphs model connections and multi-hop paths. They can explain why two entities sit on the same trail. What they do not do by themselves is infer pure semantic closeness across rephrased prose — the jump from “neural networks” to “machine learning” when those phrases never shared an authored edge.

Agents still need a fuzzy front door into the map. Production questions arrive as half-remembered titles, paraphrased error strings, and “the thing we did last quarter for billing.” If the only memory is a relationship lattice, every useful query needs a precise seed node. Miss the label and the walk never starts.

HybridRAG framing is blunt about the split: vectors find semantically similar content but do not explain why entities connect; graphs model those connections but do not invent semantic nearness on their own. Choose the dual path when you need both broad meaning-based retrieval and graph-backed traversal — not because one store is fashionable, but because each half is blind to the other half’s strength.

A clean lattice of related entities with no semantic entry path for a rephrased question
Relationships explain the walk. They do not invent a fuzzy starting point.

When dual local stores become the minimum

The floor is not “always run two databases.” The floor is connected and semantic together. When the job needs multi-hop structure and meaning-based recall, a single shape leaves a permanent hole: either you cannot walk the path, or you cannot find the door.

The common industry pattern is dual representation, not clever fusion trivia. Vector search finds entry nodes; graph traversal expands relational context around them. Shared identifiers link the two views of the same entity so a semantic hit can hand off to a walk. GraphRAG-style dual-database setups ingest into both a graph database (entities and relationships) and a vector database (embeddings), interlink by shared IDs, retrieve by semantic search, then expand from the graph — precisely to address completeness and multi-hop limits of vector-only RAG.

That is the decision rule in product language as well. Trellis does not store “a pile of embeddings.” It stores a connected graph, and the configured model adds to it: it summarizes code symbols, narrates tours through the call graph, and extracts decisions, their reasons, and how they connect. So retrieval is both connected and semantic. Hybrid search — search by meaning over prose and code, plus search of code by name — is the retrieval surface that dual stores make possible. How scores are fused is a different article; the topology question is whether both memory shapes exist at all.

If your agents only need fuzzy document grounding, stay on one store. The moment tickets, modules, imports, owners, and rephrased questions share a session, dual path is the minimum that matches the work.

Two engines on the machine, not one distant index

Dual stores are also a packaging choice. Trellis runs a graph database and a vector store on your hardware — Neo4j for the graph, Qdrant for the vectors — in Docker, with the configured model’s code summaries, tours, and decision findings written alongside. Pricing and feature copy say the same thing in shorter form: local graph plus vector store; Neo4j and Qdrant as named stack pieces; the index on your hardware because those engines run locally and secrets are scrubbed.

That pairing is not a Trellis-only idea. Neo4j’s own developer guidance for enriching a RAG pipeline with Qdrant describes spinning both up together (including via Docker Compose) and joining Qdrant top-k hits back to Neo4j nodes by shared id — embeddings for scale and update patterns, the graph for relational enrichment. The dual-engine local setup is a real industry pattern. Trellis’s claim is that this is the floor for connected and semantic agent memory on the machine, not a remote index you query for every hop.

Where the engines sit: the graph, the vector store, and the summaries all run locally. You choose if anything ever syncs. Two shapes of memory sit co-located with the code they describe, so an agent can enter by meaning and leave by path without shipping the map elsewhere to do either.

A graph engine and a vector engine co-located inside one local boundary for connected and semantic recall
Connected and semantic: two local engines, one machine, shared identifiers between them.

One store is enough when the questions stay inside that store’s strength. Dual local stores become the floor when the same session needs fuzzy entry and multi-hop truth. If you are choosing agent memory for a real codebase, count the shapes before you count the models.

Want this for your team?

Trellis builds local-first knowledge graphs for coding agents, and the Free plan runs on your own machine.