Two fronts this week. One worked out and the other did not, and the one that did not is still open as I write this.
The one that worked: an end-to-end project with Claude Code writing the code and me supervising. The one that did not: automatic invoicing in the Génesis ERP against the ARCA system (formerly AFIP), which got stuck somewhere that has nothing to do with invoicing.
The loop: generate, review, audit, find the bug, redo
The way I worked was not asking for code and then fixing it by hand. I gave it the initial code and set it up to run in a loop: generate code, review, audit, find the bug, redo. Round and round until it met the spec.
With a loop like that, the question that comes up immediately is: until when. A loop that fixes itself with no limit is a loop that can keep circling a bug it is never going to solve, burning tokens on every pass.
I capped it at 4 or 5 iterations. The concrete finding of the week is that it never hit the cap. It found the specific bugs quickly, well before the ceiling.
It burns more tokens than writing the code in one go. That is true and I am not going to argue it. But the efficiency was better: the time I do not spend reading code line by line looking for why it fails is worth more than the tokens the loop spends finding it on its own.
The cap still needs to be there, and I think it needs to be there precisely because it never gets used. It is what makes the worst case a number instead of a surprise. If it ever does reach 5 and still has not closed, that is no longer a bug the loop can fix, it is a sign the problem is somewhere else and I should be looking at it myself.
The ARCA side, which did not close
The other front was automatic invoicing in the Génesis ERP: having the system issue the receipts against ARCA's services without anyone keying them in.
What I ran into was not the invoicing logic. It was the VPS.
Two things, and both are about access, not code. One is cryptographic: signing against ARCA involves handling certificates and OpenSSL in a way that is considerably more complex to implement than it looks from outside. The other is purely network: IP blocks against external datacentres. And a VPS is, by definition, a datacentre IP.
Which means the same code that would work on another machine hits a closed door purely because of where it is running. That is what took me longest to get my head around this week: the problem was not what the system was doing, it was where it was doing it from.
The alternative on the table is running it on a local server or something along those lines, so it goes out from an IP that is not a datacentre. I have not tried it yet, so I cannot say it works. I am leaving it written down as what it is: a hypothesis.
What I took from it
From the agentic loop I do have something concrete to pass on: set the iteration cap. 4 or 5 is enough, and the fact that it never gets reached does not make it useless. It is what puts a floor under the worst case, and what turns "it hung" into a signal that you need to step in.
On ARCA I have no recommendation to give, and I would rather say that than invent one. I have not found a closed solution yet. The only thing I can note down, in case it saves someone an afternoon, is where it breaks: in the cryptography of the signature and in the IP you go out from, not in the ERP.