Skip to content

fix: enforce lex_audit --calls discipline in refactor agent prompt #29

Description

@alpibrupa

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions