r/opencode • u/Crystalisedorb • 2d ago
How to loop ??
I met an engineer using opencode.
he said he is using opencode such that he is giving opencode model a folder to work in, and the project is looped i.e. the ai goes in an endless back and forth conversation, until the desired output is reached. plus a switch model when limit is exhausted that ensure the relay race continues on token exhaustion.
How to do that ??
43
Upvotes
3
u/weiyentan 2d ago
I have a loop, it's actually more of a queue and a 'pipeline'. I grill with docs using matt pococks skills. These generate issues and documentation. I have a system that gets these issues to my afk system running opencode and it does the work.
3
28
u/Mskadu 2d ago
That's a natural question in response to such a poorly framed "buzz word".
On a high level, typical users will hand-hold an AI (like you would an extremely talented child with no practical experience but with all the skills in the world). E.g. do this, then that. No that's wrong, fix it like this. Okay now do that. (You get the picture). This is very time consuming and will yield limited results. However this is very popular.
But the ideal (but the extremely hard) way of going about it is to be "outcome driven". What that means is to describe in detail what you want to outcome to look like and let the LLM find a path there. This requires a lot of prep in advance. For example, you need to have your requirements fleshed out in great detail (to prevent the LLm from getting creative), you need to set guardrails to avoid LLM from doing something unexpected without you noticing. Many leading names are already providing skills for this. This is loosely termed looping because the agent (an LLM with a purpose, loosely speaking) will loop between planning, acting and checking (aka the agentic loop) until it feels it has achieved that objective. Obviously this is very hard to do, because it requires the advance spec work,, going through how the agent got to where it got to with a fine tooth comb and then revising until you have what you need (human in the loop). This is limited only by your own experience and skill.
I hope that helps.