Problem
The refactor agent prompt warns "run lex_audit --calls before touching any function" but nothing enforces this. The agent will sometimes skip directly to edits, producing incomplete refactors where callers are missed.
Fix
Restructure the refactor system prompt to make lex_audit --calls <fn> a mandatory first step before any write/edit/lex_store_apply call, not advisory text. Use imperative language:
Before editing any function: call lex_audit --calls <fn>. Do not proceed to write or edit until you have the full caller list. This is not optional.
Also consider adding it to the pre-tool hook mechanism (if lex-llm supports pre-tool hooks) so the constraint is enforced at runtime rather than prompt level.
File a companion lex-llm ticket for pre-tool hooks if the prompt approach is insufficient.
Acceptance
- Refactor prompt uses mandatory language for the lex_audit step
lex check --strict src/ passes (prompt files are not compiled, but verify no broken imports)
Problem
The refactor agent prompt warns "run
lex_audit --callsbefore touching any function" but nothing enforces this. The agent will sometimes skip directly to edits, producing incomplete refactors where callers are missed.Fix
Restructure the refactor system prompt to make
lex_audit --calls <fn>a mandatory first step before any write/edit/lex_store_apply call, not advisory text. Use imperative language:Also consider adding it to the pre-tool hook mechanism (if lex-llm supports pre-tool hooks) so the constraint is enforced at runtime rather than prompt level.
File a companion lex-llm ticket for pre-tool hooks if the prompt approach is insufficient.
Acceptance
lex check --strict src/passes (prompt files are not compiled, but verify no broken imports)