Verification & rollbacks
Compiler gates, fast LSP diagnostics, and automatic rollback on broken builds.
The defining architectural feature of Rescriptum is **deterministic verification**. While other AI editors guess whether their edits work, Rescriptum verifies every change against real compilers and test runners.
1. Fast LSP Pass (Sub-Second)
Immediately after a file is modified via patch_file or write_file, Rescriptum triggers a fast background LSP diagnostic pass (~1.5s). If syntax errors or invalid imports are introduced, the agent receives structured compiler diagnostics on the very next round.
2. The Verification Gate (verify_gate.rs)
At the conclusion of a turn or when the agent calls the verify tool, the full verification gate executes:
- Executes project-specific verification commands (
cargo test,npm run build,pytest, etc.). - Evaluates compiler exit codes, stderr traces, and test summary assertions.
- Assigns an outcome-anchored session health score (85–100 tier for clean turns with passing tests).
3. Deterministic Auto-Revert (auto_revert_workspace_to_last_green)
If verification fails and auto_revert is active (enabled by default):
1. The engine immediately loads the reverse diffs or shadow git checkpoint created prior to the turn.
2. All modified, created, or deleted files are restored to their last verified green state.
3. Rescriptum emits an explicit revert telemetry event detailing the restored files and recovery mechanism.
4. Verification is re-run on the restored tree to confirm clean state.
This guarantees that an agent never leaves your repository in a broken, half-edited state if a hypothesis fails.
4. Subshell CWD Confinement
In standard IDE terminals, if an agent runs cd subdir, the directory change leaks into the terminal session, causing subsequent commands to run in unexpected locations. Rescriptum's native_run_command resets the session working directory to the workspace root on every single tool call. Subshell directory changes are strictly confined to their child process.