Case Study: A Free Model Wrote a C++ TODO Expiry Checker
Description and use
Case study on building a C++17 tool to check for expired TODO comments. The author used the MonkeyCode AI model, going through three iterations: from compiling but logically incorrect code to a solution that handles string literals and invalid dates. Key takeaway: successful compilation does not guarantee correct behavior.
Problem
TODO comments in codebases accumulate without dates or owners, becoming technical debt. There is a need for a tool to scan C++ repositories, extract ISO dates from TODO/FIXME comments, and fail CI builds if deadlines have passed, while correctly ignoring string literals and handling invalid dates.
Outcome
After three iterations, a C++17 tool was successfully created that accurately identifies expired TODOs while ignoring false positives in string literals and handling invalid dates. The key lesson was that compilation success does not guarantee logical correctness, and AI models may default to newer language standards (C++20) unless constrained.
Workflow
- Define the problem: Scan .cpp/.hpp/.h/.cc files for TODO/FIXME with ISO dates.
- Create a test fixture: 23 source files with 47 tokens including expired, active, undated, string-literal, block-comment, and malformed date cases.
- Round 1: Generate code with AI. Result: Compiled but failed fixture (false positives in strings, accepted invalid dates).
- Round 2: Fix string literal issue. Result: Failed compilation due to C++20 dependencies in C++17 project.
- Round 3: Implement C++17-compatible date logic (days_from_civil) and a state machine for parsing. Result: Passed fixture.
- Integrate tool into CI to fail builds on expired TODOs.
Evidence
The first draft compiled on the first try. That was the only thing it did correctly.
The second draft... used std::chrono::year_month_day... which are C++20 types. The project toolchain is C++17.
- Record date: 2026-09-05T18:29:50.121Z