Inspiration
AI coding agents can generate code incredibly fast, but they often don't actually understand the structure of the codebase they're modifying. They can confidently invent fields, miss dependencies, break relationships, or modify the wrong files. We wanted to solve the structural hallucination problem by giving the model a deterministic source of truth instead of expecting it to remember the entire codebase.
What it does
Graphyti is an AI code-generation CLI for Next.js and Prisma. It builds a deterministic graph of the codebase using HydraDB, mapping models, fields, routes, components, imports, and relationships. When a developer requests a change, Graphyti identifies the relevant structure and blast radius, gives the LLM the necessary context, and then verifies the generated code against the actual graph before allowing it to modify the filesystem.
How we built it
We built Graphyti with TypeScript and Node.js, using HydraDB as the underlying code graph. The codebase is parsed into structured entities and relationships, which Graphyti queries when processing a request. The LLM handles reasoning and code generation, while HydraDB provides the structural ground truth. Generated changes are re-parsed locally and cross-checked against the graph before they are committed.
Challenges we ran into
The biggest challenge was separating what the code proves from what an LLM merely assumes. Static code analysis also becomes difficult with dynamic dispatch, runtime wiring, and indirect dependencies. Instead of pretending these cases can always be resolved deterministically, we designed Graphyti to distinguish verified relationships from uncertain ones and prevent the model from silently turning assumptions into facts.
Accomplishments that we're proud of
We're proud that Graphyti doesn't just use AI to generate codeāit puts a verification boundary around the AI. The LLM cannot directly decide what the codebase looks like or silently write an unverified change. HydraDB provides the structural source of truth, while Graphyti uses that information to calculate impact and verify changes before they touch the codebase.
What we learned
We learned that giving an LLM more context isn't necessarily enough. The important question is where that context comes from. If the model itself is responsible for reconstructing the structure of a codebase, structural hallucinations are almost inevitable. A deterministic representation of the codebase lets the model reason within known constraints instead of inventing them.
What's next for Graphyti
We want to expand Graphyti beyond Next.js and Prisma, improve its understanding of dynamic runtime relationships, and make the verification system more comprehensive. The longer-term goal is to make Graphyti a general verification layer for AI coding agents where models can generate freely, but structural changes are always grounded in and validated against the real codebase.
Built With
- atsparser
- hydradb
- nextjs
- prisma
- typescript
Log in or sign up for Devpost to join the conversation.