DRILLS.ai · Chapter 04
Phase 1: agents that make exercises
The first DRILLS was for learning and practice. A job posting fed a SkillAn instruction sheet the assistant loads only when the task matches. It's judged by the difference it makes, with evidence.See in the glossary → analysis, then a roadmap, then a targeted Python exercise. There was progress tracking, code in the browser and a companion.
The concept
An exercise that looks right can be wrong, or test nothing. A validator has to separate what it checked from what it did not prove.
The phase 1 pipeline
DrillOrchestrator.generate() is the OrchestratorIn a multi-agent system, the agent that never answers itself: it routes the work to specialist agents.See in the glossary →: it runs these steps deterministically: always the same order, without the model choosing what comes next. Each AgentA program that uses a language model to decide what to do (search, call a tool, answer, refuse), in a loop, with stopping rules.See in the glossary → is specialised by its instructions and its output contract. No graph framework was needed for this chain.
The creator produced, among other things, broken_code, fixed_solution and hidden_test_harness. The risk: an exercise that looks right, but whose solution is wrong or whose test tells nothing apart.
Hardening the validator
- astThe Python module that turns source code into a syntax tree you can analyse without running the code.See in the glossary → parsing of the broken code, the solution and the Test harnessThe code that runs a function on cases and checks the result. A good test harness fails on the broken version and passes on the fixed one.See in the glossary →, without running them.
- A real assertion in the harness, not just the word “assert” in a string or a comment.
- Rejecting broken code identical to the solution.
- A non-empty roadmap.
- A roadmap that uses skills from the posting, and a last step that targets an analysed skill.
- Errors kept apart from warnings.
- An instruction to the model: never claim to have run the code.
Here is the assertion check, taken from the repository (code written with the help of ChatGPT and Codex):
def _has_test_assertion(tree: ast.Module | None) -> bool:
"""Require a real assert statement or a pytest-style assert call in the AST."""
if tree is None:
return False
for node in ast.walk(tree):
if isinstance(node, ast.Assert):
return True
...
return False
ast.walk goes through the code’s tree without running it. An assert written in a comment is not an ast.Assert node: it does not pass.
The limit. Passing these static checks does not prove the solution works. The validator says so itself, with a warning: the harness still has to run against both versions of the code.
The discriminating harness
The behaviour tests then used fixed, trusted FixtureA function pytest runs before a test to prepare the ground (a throwaway folder, the network cut off).See in the glossary →. The same harness must fail on a version known to be broken, and pass on the fixed version.
| Harness | Broken code | Fixed code | What it proves |
|---|---|---|---|
| Discriminating | Fails | Passes | The test sees the bug |
| Happy path only | Passes | Passes | Nothing about the bug |
The subprocessThe Python module that launches another program (git, a CLI) and gets back its exit code and output.See in the glossary → that runs these fixtures is not a production sandbox for generated code. The final MVP runs no candidate code.
The companion and the teaching MCP pilot
This phase also explored progress with local resume, quizzes, feedback and lessons, a contextual companion (MentorAgent), a teaching MCPModel Context Protocol: a standard for exposing tools and data sources to any agent. An MCP tool is discovered by its name, description and schema.See in the glossary → pilot (including a calculator), and many display tweaks.
That teaching MCP is not the opportunities MCP server added later. A technology explored for learning does not automatically become an integration of the candidate product.
What this phase brought to the pivot
Mostly method: explicit contracts, validation before display, the difference between a static check and proof of execution, offline tests, a separate backend, error handling. Exercise generation left the public journey: POST /api/drills now returns 410 for a valid request.
What I keep
- A green test can prove nothing: you have to see it fail on the bug.
- The validator says what it did not check, instead of letting you believe.
- A fixed chain of agents is enough when the order of steps is known.
The Python mechanisms
- My Python for AI 101, chapter 11 · Deploying and tooling: card 55, reading code without running it with
ast; card 53,subprocessto run the fixtures with a TimeoutA maximum waiting time. Past it, you abandon the call and return a readable refusal, instead of waiting forever.See in the glossary →. - My Python for AI 101, chapter 12 · Testing and evaluating: card 60, testing the structure, then evaluating the behaviour.
The defense question
Can a green test prove nothing about the bug?
Yes. A harness limited to the happy path passes on the broken version and on the fixed one. I check that the same harness fails on one and passes on the other.
Why doesn’t static validation replace running the code?
It reads the code’s shape: syntax, presence of an assertion, difference between the two versions. It does not say whether the solution gives the right result.