codegate undo can restore the previous state at any time.
Remediation flags
Enter guided remediation mode after the scan completes. CodeGate lists fixable findings and asks for confirmation before making changes. Use
--force to skip the confirmation prompt.Automatically apply fixes for unambiguous critical findings without interactive prompts. Combine with
--dry-run to preview what would be changed before committing.Show proposed remediation changes without writing anything to disk. No backup session is created in dry-run mode.
Write the proposed changes as patch-style diff output instead of modifying files directly. Use this flag to review or share changes in a standard diff format.
Remediation workflow
Preview changes (optional)
Use
--dry-run and --patch to see what remediation would do without writing anything.Apply fixes
Run with Before any file is modified, CodeGate writes a backup session to
--remediate to apply guided fixes, or --fix-safe to auto-apply unambiguous critical fixes..codegate-backup/ in the scan target directory.Backup sessions
Every remediation run that modifies files creates a timestamped backup session under.codegate-backup/ in the scan target directory. Each session captures the original content of every file that was modified.
codegate undo [dir] restores the most recent backup session. If no [dir] argument is given, it defaults to the current directory (.).
codegate undo restores only the latest session. To restore an earlier session, inspect the .codegate-backup/ directory manually and copy the files you need.Scan-state baseline and --reset-state
CodeGate maintains a persistent baseline of MCP server identifiers and config hashes to support rug-pull detection across scans.
Default state file location:
scan_state_path in your config file. Paths beginning with ~ resolve to the current user’s home directory.
What state tracks:
| Entry | Meaning |
|---|---|
NEW_SERVER | An MCP server identifier seen for the first time in this scan. |
CONFIG_CHANGE | An MCP server whose config hash changed since the previous scan. |
--reset-state clears the baseline file and exits immediately. No scan is performed. Use this when you want to start tracking MCP servers from a clean baseline — for example, after deliberately adding new servers that you have reviewed.