Hacker News new | ask | show | jobs
by sysguru2046 26 days ago
I cloned your Spec-Driven-Development repo to my GitHub repo, use codex to generate a scraper checkpoint manager spec, then use codex prompt to implement the checkpoint logic. The new implementation has significant improvement on top of my original shape of checkpoint logic. It's strict implementation based on generated spec.
1 comments

First of all, Thank you so much for sharing your experimentation with it. Your checkpoint spec generation and implementation against it is a great usecase test to check if the requirements format is indeed useful and not just properly structured.

Would you be willing to share what the generated spec looked like and where it was most useful vs where it needed adjustment? That kind of usecase is really valuable to explore further improvements that could be made.

Generated spec is 542 lines including 7 sections: - Requirements - Event Schemas - Checkpoint File Schema - Resume Algorithm - Failure handling - Acceptance Tests - Implementation Tasks.

It inspects my existing repo, and identified existing logic, then imported my existing functions, and created a checkpoint_manager.py.

The new function adds additional functions like: - update_started - update_completed - update_failed - install_shutdown_handlers - restore_shutdown_handlers - persist_checkpoint

Below points are generated in Implementation Tasks:

3. Implement checkpoint model: - typed checkpoint structure; - schema version validation; - bounds validation for next_url_index. 4. Implement atomic checkpoint writer: <- "atomic" - write temporary file beside final checkpoint; - flush and fsync; - atomic rename; - preserve old checkpoint on failure. 5. Implement checkpoint loader: - handle missing file; - reject malformed JSON; - reject unsupported schema version; - reject URL fingerprint mismatch.

I don't fully understand what "atomic checkpoint writer" means, but the LLM understands what it means. The functions are likely to implement "atomic checkpoint writer".

The key takeaway is that tokens generated by human usually not restrict enough. When I thought about "checkpoint", I wasn't thinking of any "atomic" shape of checkpointing. I was using my casual language model to generate first version of implementation first. Then using Spec-Driven-Development model, the generated spec has better understanding of what it is. There could be many mutated forms of real life implementation of "checkpoint", the LLM generated code is mostly restrictive one that I will never know in my whole life experience. The LLM training must have undergone very restrictive learning process that I never experienced.