All use cases

Engineering

Map the legacy repo before the agent edits a line

Agents love to skim old repos — that is where the guesses hide.

Share

What hurt

klöss (@kloss_xyz) shared a paste-before-you-edit prompt for Opus, Astra, or Grok Bot on legacy code: map the codebase, trace what the task will touch, flag dead code and hidden side effects, and make no edits until you approve the map. Not affiliated with xAI.

What to install or create

Paste his quoted prompt as the first message before any edit session. Approve the map, then allow edits.

Bots

  • Legacy coder

    Maps first. Edits only after you approve the map.

Plugins

  • GitHub

    Optional

Routines

  • None on the first run. Watch one manual pass first.

The prompt

Map before edit (author-quoted)

Quoted from @kloss_xyz — as published. Do not invent a second system prompt.

Before we change anything, map this entire codebase. Trace every piece of code this task and session will touch, what depends on it, and what breaks if it changes. Flag any dead code, hidden side effects, and literally anything you're guessing about that's not proven by code reads and specific lines. No code edits until I approve the map manually.

First run

  1. 1Read https://x.com/kloss_xyz/status/2109747284044824692 (credit @kloss_xyz).
  2. 2Open the legacy repo with your coding bot.
  3. 3Paste his map prompt as the first message — before any edit.
  4. 4Review the map: dependencies, break risks, guesses vs proven lines.
  5. 5Approve the map, then allow the bot to edit.

Approval fence

Do not merge or deploy without your yes after the map.

What to tweak

Steal the map-then-approve gate. No code edits until the map is proven.

Source

klöss @kloss_xyz · Original post

Not affiliated with xAI. We did not write this prompt. Third-party template terms still apply.

Browse templates

Browse team blueprints

Pro pack

Want the full setup, not just the idea?

Pro packs give you the job text, prompts, schedules and pitfalls for popular use-cases.

See Pro