Exploring a more deterministic approach to AI-assisted code generation
Source: Dev.to
Introduction
AI coding agents are getting surprisingly good. In small projects you can ask them to add features, fix bugs, and even write tests—and they often succeed. However, as a project grows, things start to break down. In my experience, the issue is not model capability but prompt instability.
Most coding agents construct prompts dynamically using:
- chat history
- parts of the codebase
- internal heuristics
Because the final prompt is not fully under your control, the same request can produce different outputs, changes can appear in unexpected parts of the codebase, and behavior becomes harder to reason about. In small projects this is manageable, but it does not scale.
Deterministic Prompting
Instead of relying on dynamically constructed prompts, I experimented with treating prompts like source code:
- prompts are explicit
- prompts are reusable
- prompts can be composed from other prompts
- prompt construction is deterministic
- prompts are the source of truth, not the generated code
This shifts the workflow from “chatting with an agent” to something closer to designing system architecture.
The SVI Tool
To explore deterministic prompting I built a small tool called SVI. SVI generates source code from structured specification files (.svi) written in a Markdown‑like format.
Key ideas
- Each
.svifile defines how a specific source file should be generated. - Prompts can import and reuse other prompts.
- The final prompt is constructed in a fully controlled and predictable way.
- Unlike typical coding agents, SVI does not depend on chat history or implicit context.
Example .svi File
# Destination File
hello.js
# Output
function hello()
# Options
ProgrammingLanguage=Node.js
Active=True
# Prompt
Create a function that prints "Hello World", and call this function
Generate the code with:
svi run
The output is produced by an LLM based on the specification.
Practical Benefits
- Predictable results – you know exactly which prompt generated which file.
- Reusability – prompts can be shared and composed across projects.
- Lower model requirements – smaller, deterministic prompts let you use cheaper or even free models; you can adjust prompt size and complexity to match the LLM you’re using.
Limitations
- Requires more upfront structure.
- Less flexible than free‑form prompting.
- Changes the workflow from interactive to more declarative.
For larger projects, these trade‑offs can be worthwhile because AI coding agents become much easier to control at scale.
Conclusion
AI coding agents are powerful, but their current design makes them hard to manage in big codebases. Treating prompts as deterministic, reusable specifications—exemplified by the SVI tool—offers a more controllable alternative.
GitHub repository: