r/opencodeCLI • u/feursteiner • 4d ago
opencode is kinda great at writing its own tests!!!
some of you might remember my post about learning rust with opencode lol... well I'm still living in it, and I found another thing it's weirdly good at
context: I've thrown everything at my agents, rules files, prompts, skills, a strict linter.. and it goes a long way tbh, but the fuzzy stuff still slips through. in my sveltekit projects I have patterns on file placement, when to break things into sub-components etc... and that's like most of the feedback I end up giving the agent
so I built a small CLI for agent testing (agentests in open source). you write the rule as a normal sentence, and the compile command is just a printed prompt, no model call
and opencode just... takes it from there!! it drafts the checks, writes a few Evals, and keeps rerunning them until everything agrees. I mostly sit there and watch
then the checks run on every commit (opencode's own commits included, which is kinda hilarious), and a tiny decision model does the answering, so it's CHEAP and FAST instead of burning tokens on the dumbest task
it'd be cool to see something like jev or clef on opencode tbh, it doesn't cost much to run and it's such an unlock... I haven't looked ath the model list in the go sub for a while, so my bad if that changed
anyone else making opencode write its own guardrails ?? what do you have it check ?
repo if you're curious, a star helps a ton https://github.com/feuersteiner/agentests
3
u/fadzlan 2d ago
So, its a githook?
2
u/squirrelscrush 3d ago
tbh it depends more on the underlying model
1
u/m-ritter 3d ago
Checks on every commit are cheap and fast, and I would add scenarios run on the real program after each risky slice. A scenario is a plain sentence about what a user does, and an agent that did not write the code runs it end to end and reports what actually happened. That catches things a commit check misses, like a flow that passes the linter but breaks in the running app. QualityLayer is what I built around that loop: https://github.com/maxritter/qualitylayer
1
u/Senior-Assumption864 3d ago
nice idea. do you let it rewrite the checks when they fail or are they locked once you approve them?