Building a self-corrective coding assistant from scratch