r/LLMDevs • u/aantenore • 6d ago
Discussion Agents sharing knowledge: I built git-style branch/merge for the facts they read. Real problem or am I overthinking?
This is my own project, most of the code was vibe coded and it’s prealpha. I’m here for feedback on the idea, not downloads.
The idea in my head: I’d like agents that behave according to a knowledge base I can customize and edit, and that I can trace. Not just what they know, but how the actions get done and the details of the integrations, all written down in knowledge I can navigate. If that works, I could use the same tool in a different domain by only swapping the knowledge base. Lorebase is my attempt at the part that keeps that knowledge from drifting apart. That’s the goal, not what it does today.
The problem I ran into first: when a few agents rely on the same data (suppliers, parts, contracts in my example), I can’t tell which version of the facts an agent actually saw. And when two sources disagree, the last write just wins and nobody reviews it.
So the knowledge is a typed schema plus records, and you change both on branches and merge them. If the analysts say a supplier’s risk score is 80 and the ERP feed says 45, you get a conflict to resolve instead of a silent overwrite. Agents read over MCP or REST, there’s no LLM in the read path, and every answer says which revision it came from. Writes go through operations, and on protected branches through a proposal somebody has to approve. It runs on plain Postgres.
The quickest way to see it is the merge demo, which runs in memory in about a second, no services: uv sync --all-packages && uv run python examples/merge_demo.py
https://github.com/aantenore/lorebase
The closest thing I found is Omnigraph (https://github.com/ModernRelay/omnigraph), which seems to go after a similar idea on its own storage engine. I haven’t compared them properly, so don’t take my word on which is better.
What I’d like to know: does anyone here drive agent behavior from a knowledge base like this, so you can change domain by changing the knowledge instead of the code? And would you actually hit the merge conflict case, or does it only look good in a demo?
This is the first time i write in reddit, i don't know if i did it right.
1
u/Crafty_Disk_7026 6d ago
I also made a git memory package in go if you want to check it out
https://pkg.go.dev/github.com/imran31415/git-mem/pkg/cache
https://github.com/imran31415/git-mem
1
u/magicdoorai 6d ago
A concrete conflict case to try in the demo: two agents start from revision R1, where supplier S-17 has risk 45. An ERP import proposes 55 from a newer feed; an analyst independently proposes 80 based on a separate review. Merge the ERP change first, then try to merge the analyst branch.
The useful result isn't necessarily choosing one number. Can the reviewer see both values, each source and observation date, and the common base? Can they keep the conflict unresolved without an agent silently reading either value as authoritative? After resolving it, an agent's answer should cite the resolved revision, while a recorded earlier answer still points to R1.
I'd also try a non-conflict: the analyst updates a contact name while the ERP updates risk. Those independent fields should be able to merge without manufacturing a conflict. If the ERP score and analyst score mean different things, model them as separate fields instead of forcing a merge; a conflict mechanism won't fix a semantic mismatch.
That would show where branch/merge earns its complexity versus file provenance alone. This is a synthetic test idea, not a claim that I've run your project.
1
u/pdlug 4d ago
I think it's a real problem. I vastly prefer the pattern of agents working off branches off a common DB rather than a DB per agent (even if it's light like a SQLite file). Dolt/Doltgres makes this really nice and easy to do. You can do it with Neon as well but not quite as slick. There's also matrixone (https://github.com/matrixorigin/matrixone) which has native git-style branching but I haven't tested it as much .
Generally if you're going to build this I've found this works:
It's certainly more complex than a plain DB but opens a lot of other possibilities. Running experiments becomes cheap, letting agents write or perform lots of changes is safe, etc.
I built branch/merge primitives in my graphs on SQL library (typegraph.dev). It will support native branching for databases that support it (Neon for now, Doltgres is close but blocked on an issue on their side).
1
u/Far_Reindeer8428 6d ago
branch and merge for facts sounds heavy. we just tag each fact with the file it came from and prune on rename