DEV Community

Ștefănescu Liviu
Ștefănescu Liviu

Posted on • Originally published at x.com

Designing a local ticket-to-PR workflow for AI software delivery

If you have tried using AI coding agents for large, multi-file tickets, you probably know the exact moment the run starts to derail.
It usually starts with a simple error. The agent tries to fix it, but introduces another bug. It tries to fix that one, and now the terminal logs are piling up. Within a few iterations, the conversation history is bloated. The model starts dropping files, ignoring imports, or repeating the same mistake.
I call this context rot. When an AI chat session gets too long, the model loses focus. This is a systems problem, not a prompting problem.
To get reliable code out of an AI on complex tasks, you need a structured workflow that manages context instead of accumulating it. I spent the last five months building a local GUI orchestrator called LoopTroop to solve this.
Here is how I structured the workflow to keep the AI focused.


Stop guessing: the interview phase
Before writing code or specs, the system generates targeted questions to clarify the requirements. It focuses on identifying edge cases, constraints, and dependencies.
You answer these questions in the interface. This step resolves ambiguities early, so the plan matches what you want.


Planning with a model council
Relying on a single model to plan a complex ticket is risky. Instead, LoopTroop uses a council of multiple models for the planning phases.
Several models generate independent drafts of the spec. They then score and vote on each other's work anonymously to remove brand bias. The winner refines their draft by incorporating the best ideas from the other drafts.
This is slower than a one-shot prompt, but a solid plan prevents hours of debugging loops later.
Small, atomic units
We split the approved plan into tiny, independent tasks. Each unit has a clear objective, target files, acceptance criteria, and verification commands.
Instead of asking the AI to build a whole feature in one go, we make it focus on one specific unit at a time. This keeps the working context minimal.


Recovering with fresh context: the Ralph loop
When a task fails or times out, the typical reaction is to keep prompting the same session. That just adds error logs to the context, making the model more confused.
Instead, LoopTroop uses a recovery cycle:
We capture the failure details in a short note.
We reset the workspace back to the start of the task.
We start a completely new session with the original task spec and the failure note.
This keeps the lesson but throws away the context pollution. We limit these retries to a set number of attempts.
Keeping the human in control
The workflow is not fully autonomous. It requires your approval at important boundaries, such as approving specs and reviewing final changes.
You can monitor the entire run, view logs in real time, and inspect the final diff from a single Kanban board.
This approach is deliberately slow. It is not meant for quick edits, but for complex work where correctness matters.


If you want to look at the code or see how the GUI works, you can check the project on GitHub: https://github.com/looptroop-ai/LoopTroop
Here is a short 2m 30s video showing the workflow in action: https://youtu.be/g1A2g-oOR3E
Any feedback is more than welcomed. If you tried the app and it worked or did not work, give me a sign. I am happy to talk about it.

Top comments (0)