Guides and Sensors¶
What you build¶
lint_source: two habit-tracker rules using Python'sast, so comments and strings never match. HT001 flags.date()on a datetime; HT002 flags reading the clock without a time zone. Each finding renders as WHAT, WHY and FIX.post_edit_hook: runs lint and related tests after each edit. Silent on success, specific on failure.on_read_hook: delivers guidance when the agent opens a relevant file.
Why it matters¶
The same check can say HT001 violation or tell the agent exactly what to change. The second gets the problem fixed on the next step. This is the sensor half of the ratchet; the on-read hook is the guide half.
Steps¶
- Implement the three functions;
python -m pytest -q. - Open
harnesslab/harnesslab/presets.pyand compare itsdate_lint(regex) with yours (AST). Which false positives does the AST avoid?
Done when¶
All five tests pass.
Stretch goals¶
- Add HT003: week arithmetic with
weekday()outsidetimeutils.py. - Register your lint as a Claude Code PostToolUse hook using the settings template.