Documentation
AI Code Stitcher is an AST-aware bridge between LLM-generated code and a local codebase. It accepts clipboard copies or terminal input, resolves file and scope, reconciles truncated code, normalizes formatting and writes local rollback snapshots.
The three parts: Code Stitcher is the desktop engine, Stitch Viewer is the side-by-side diff inspector, and stitch is the command-line companion for shells, local models and coding agents.
This guide follows the latest GitHub release notes. Release page documentation is more recent than the repository's main README.
Installation
The desktop runtime is Windows-focused. Download the current build from the official GitHub release assets, rather than using an old version-specific installer URL.
- Open the latest release and select the installation asset appropriate to your machine.
- Install and run Code Stitcher. Configure the project folders you want monitored using its settings interface / generated configuration.
- Leave the engine running for clipboard use. The CLI companion talks to that running engine over localhost IPC.
Platform note: The release describes the CLI as cross-platform, but it relies on a running desktop runtime for most patching workflows. Check the release assets for supported installers.
Clipboard quick start
Every committed write saves a local .bak snapshot for rollback using Ctrl+Z; Ctrl+Y redoes a reverted write.
Want to see the real app? See the three-screen workflow →
Terminal bridge & AI agents
In v3.54 and later, the stitch CLI uses subcommands. The companion script (stitch_cli.py) communicates with the running Stitcher engine through localhost IPC.
Attach context to the F7 composer
stitch attach src/player.gd src/combat/hitbox.gdshell
Analyze a source file's AST
stitch analyze src/core/engine.pyshell
Returns a JSON structure of classes and functions with their boundaries, useful for autonomous agents choosing precise patch targets.
Pipe an edit directly to a target
cat my_patch.txt | stitch patch src/core/engine.pyshell
Here, patch bypasses the normal file auto-router for the specified path, while the engine still handles patch placement.
Monitor runtime activity
stitch streamshell
CLI note: For full argument details and platform specifics, consult the release CLI documentation.
Accordion stitching & multi-file input
LLMs frequently omit existing code using markers like // ... existing code .... Accordion stitching anchors the emitted sections against local source so the omitted material can be preserved instead of overwritten.
Recent releases accept Aider SEARCH/REPLACE hunks, unified diffs, markdown blocks, and conversational multi-file patches—even when a reply uses plain file headings instead of fenced code. v3.59 also resolves embedded # File: path/to/file hints inside Aider hunks, and tolerates trailing prose on file boundary headers.
When a multi-file Aider or unified patch targets brand-new files, v3.59 resolves the path against the active workspace, creates any missing parent folders, writes the file and applies the patch without prompts or folder pickers. Duplicated project-root prefixes in a path are stripped so they don't collide with a monitored folder.
File routing & HintScourer
The engine indexes the monitored codebase and uses structure, identifiers and trustworthy path clues to locate potential targets. In v3.59, the multi-pass HintScourer checks prose, markdown headers, Aider pre-lines and comments, while filtering improbable file names and language-inconsistent hints. Python code will not match stray .c or .h hallucinations, and entropy filters reject keyboard-mash file names.
If a match is uncertain, the interactive adjuster presents candidate locations. F8 Filelock and stitch patch <file> can constrain the destination explicitly.
Syntax healing & pre-write safeguards
Stitcher matches indentation to the target (including tabs for Godot GDScript), strips common formatting artifacts and checks the syntax or structural seams before committing edits.
- Grammar checks: Guards for bracket parity, multiline data structures, and branch keywords. v3.59 improves Python ternary handling.
- Seam guards: Detect suspicious cuts, deleted control-flow statements and indentation cliffs.
- Path safeguards: Hardened target containment against directory traversal outside the monitored workspace.
- Rollback snapshots: Saved under hidden
.ep_backups/directories for review and undo.
Tactical routing & interactive adjuster
Press Shift+F9 to intercept copied code and confirm where it should go. Use the adjuster when an automatic match needs human confirmation.
- and + for the end seam.Esc skips it and 0 cancels the operation.Full-file replacement confirmations default to No rather than Yes, according to the release history.
See the manual alignment interface used to inspect an uncertain patch.
Stitch Viewer & rollback
Use F10 to open the SDL2 side-by-side visual comparison of the original snapshot and current file. Review the session timeline, revert a line, block, or hunk, or open the inline editor (Esc while in the viewer).
Snapshots live locally in .ep_backups/. The viewer does not require Git commits for diff inspection.
See Stitch Viewer editing mode and the side-by-side comparison screenshot.
Hotkey reference
Workspace configuration
Configure one or more project directories in the application's generated cs_settings.ini / settings interface. Free Personal Edition supports recursive directory monitoring according to the GitHub release notes; it is not limited to a single folder level.
Use the settings generated by the installed version as the authority for exact option names and paths, because these can change between builds.
What's new in v3.59
- Zero-prompt multi-file auto-creation: patches that target new files resolve the workspace root, create missing parent folders and apply without prompts or folder pickers.
- Project root prefix normalization: duplicated workspace-root prefixes are stripped to avoid path collisions with monitored folders.
- Deep HintScourer: a unified multi-pass hint engine scours prose, markdown headers, Aider pre-lines and comments, with entropy filters against hallucinated file names.
- Language-consistent validation: code syntax is cross-checked against file extensions, so Python code won't match stray
.cor.hhints. - In-hunk file resolution:
# File:directives inside Aider and unified diff bodies re-route hunks to other files mid-stream. - Plain-text multi-file slicing: conversational file headings are detected with or without code fences, and trailing prose on boundary headers is tolerated.
- Ternary-expression grammar protection: branch keywords only count when followed by a colon, avoiding false rejections on Python inline ternaries.
- Clean-slate arming:
F9andShift+F9wipe the clipboard and internal memory so old code can't retrigger a patch.
Read the complete GitHub release notes and changelog for authoritative details.