Surgical Edit Engine V1.2

Surgical Edit Engine

Stop accepting AI edits in the dark.

Every AI code change is tracked through an 8-stage Rust pipeline, backed up before it touches your file, and blocked if it looks destructive — because AI should be seen, not just trusted.

Try in Operator X02 See how it works ↓

AI Code Editing Is a Trust Problem

Most AI coding assistants operate without guardrails. Changes go in, but visibility, safety, and accountability don't come out.

Black Box Edits

You accept an AI edit. Three weeks later, something breaks. You think: "Wait… did the AI do that? Or did I?" With other IDEs, you'll never know.

🔌

Volatile Memory

AI edits live in browser memory. The IDE crashes, the tab closes, your machine restarts — and every AI change since your last manual save is gone. Permanently.

💀

Silent Destruction

AI returns 30 lines for a 250-line file. Auto-apply blindly replaces everything. 88% of your working code — deleted in milliseconds, with no warning and no undo.

Trust is not a debugging tool.
Don't trust your AI. Track it.
Blind trust in AI is blind faith in code you can't see.

8-Stage Surgical Pipeline

Every AI code change passes through a Rust-powered precision pipeline. Each stage is visible, timed, and auditable.

00🔍Detect
01🎯Select
02📊Analyze
03🔀Route
04💾Apply
05🔄Sync
06🎨Decorate
07Confirm

Real-time overlay tracks each stage with millisecond timing. Run counter persists across edits.

PIPELINE #1 0.0s ×
🔍Detect· —
🎯Select· —
📊Analyze· —
🔀Route· —
💾Apply· —
🔄Sync· —
🎨Decorate· —
Confirm· —

Pipeline #4 — Caught a 91% Deletion

Real capture from Operator X02. The AI returned 21 lines for a 240-line file. The Safety Guard blocked it in 35ms.

Operator X02 IDE — Surgical Edit Engine Pipeline #4 blocking 91% code deletion
🔬

Pipeline #4 — Stage 3 (Route) Blocked

Left: Pipeline Tracker showing ❌ at 35ms. Center: Monaco editor with App.tsx (13,721 chars). Right: AI assistant explaining the surgical edit. 240 lines preserved.

36ms Between You and Data Loss

The Safety Guard intercepts every edit before it reaches your filesystem. If the change looks destructive, it's blocked — automatically, silently, instantly.

SAFETY GUARD — BLOCKED PIPELINE #1
Analysis
Original 258 lines
Incoming 2 lines
Deletion 256 lines (99%)
Thresholds
max_deletion 50% actual 99%
min_size 40% actual 1%
min_lines 20 actual 258
Verdict
REJECTED — file untouched
📏

Deletion ratio > 50%

Blocks edits that would remove more than half the file. Catches truncated AI responses returning headers or snippets.

📐

Size ratio < 40%

Blocks when incoming code is less than 40% of the original. Prevents partial fragment replacement.

📝

Minimum 20 lines

Guard only activates on files with 20+ lines. Small configs and scripts pass through without false positives.

🦀

Rust disk write

Approved edits are written through Tauri/Rust directly to the filesystem. If the IDE crashes, your code is already on disk.

Every Edit Creates a Recovery Point

Timestamped .bak files are created via Rust before any AI edit touches your code. Full lifecycle management built in.

📁 ~/OperatorX02/backups/surgical_edits/
├── main.ts_1738123456789.bak
├── app.tsx_1738123400000.bak
├── auth.ts_1738123354321.bak
├── utils.ts_1738123300000.bak
└── config.json_1738123250000.bak
📋

Browse, diff, restore

Full Backup Manager UI panel — filter by file, preview content, compare against current version, one-click restore.

🧹

Auto-cleanup policies

Configurable limits: max age (default 7d), max per file (10), max total size (100MB). Runs automatically on IDE startup.

📊

Status bar indicator

Live backup count and total size displayed in the bottom bar. Click to open the Backup Manager. Refreshes every 30s.

⌨️

Console API

Full programmatic access via bm.restore(), bm.diff(), bm.cleanup(), and 7 more commands.

The AI Knows What It Can Undo

Three levels of context injection — keyword-triggered, automatic. The AI receives live backup data so it can answer "undo my last change" with an actual restore command.

L1Know

Knowledge Base

"How does surgical edit work?" → AI receives the full 3,500-word reference covering pipeline stages, edit operations, limitations, and architecture.

L2Live

Live Backup Data

"Undo my last change" → AI receives real-time stats from Rust: file counts, sizes, paths, timestamps, and the exact restore command to run.

L3Edit

Edit Awareness

"Fix line 42" → AI receives a brief reminder that backups are active and mentions automatic backup creation in its response.

Context Enhancement Pipeline
→ "Can you undo my last change to main.ts?"
Injected Context
editor main.ts open, line 42
terminal no errors
git main branch, clean
surgical Level 2 — live data
Backup Data from Rust
total 12 backups (45.6 KB)
main.ts 5 backups, newest 2m ago
AI Response
✓ bm.restore('main.ts', '...1738123456.bak')

What Developers Are Saying

The safety guard saved me twice last week. AI tried to replace my 500-line file with a single comment block.
— Senior Backend Engineer
I finally know exactly what the AI changed. The purple line indicators completely changed how I review AI-generated code.
— Full Stack Developer
Accidentally accepted a bad edit. Opened the Backup Manager, clicked restore, and was back in 2 seconds. No drama.
— Tech Lead

Under the Hood

Built on Rust/Tauri for performance and reliability. Zero configuration required — enabled by default on startup.

ComponentImplementation
Backend runtimeRust / Tauri v2 — disk writes, backup I/O, stats aggregation, diff engine
Backup storage~/OperatorX02/backups/surgical_edits/
Backup format{filename}_{unix_timestamp_ms}.bak
Safety thresholdsBlocks >50% line deletion OR <40% size ratio on files >20 lines
Pipeline8 stages — Detect → Select → Analyze → Route → Apply → Sync → Decorate → Confirm
Visual indicatorsPurple line highlights, gutter icons, status widget, file tree markers, toast alerts, pipeline overlay
AI context3 levels — knowledge base (L1), live backup data (L2), edit awareness (L3)
Backup manager10 Rust commands — list, preview, diff, restore, delete, batch delete, cleanup, export, stats, get_dir
Auto-cleanupConfigurable: max age (days), max per file (count), max total size (MB)
Console APIse.* (engine) + bm.* (backups) — full programmatic access
Editor syncDisk-first — Monaco synced FROM filesystem after Rust write completes
RAM overheadMinimal — UI overlay only; all heavy operations execute in Rust process

Stop Gambling with AI-Generated Code

Open source. MIT licensed. Surgical Mode is on by default — zero configuration.

Download Beta V1.2 View Source on GitHub