Documentation

Welcome to the technical documentation for AI Code Stitcher. This manual details how to configure, control, and execute advanced codebase updates with extreme efficiency.

Core Concept: The Stitcher is a client-side utility built in Pygame/Python designed to act as the missing bridge between conversational AI (ChatGPT, Claude, Aider) and your local file system. It intercepts snippets copied directly to your system clipboard, processes them, and surgically targets code replacements.

Installation

The AI Code Stitcher runs as a lightweight native Windows executable. It uses low-level win32 API integration for a responsive user experience.

Prerequisites

  • Windows 10/11

Step-by-step Setup

  1. Download the compiled installer here.
  2. Run the setup wizard. Upon the first launch, the program will create your personalized cs_settings.ini config file inside your AppData directory.
  3. Notepad will automatically open to configure your workspace. Enter the path to your code repository under the monitored folder section and restart the app.

Quick Start Guide

Once your workspace directory has been specified in your settings, running the Stitcher is a fluid, three-step loop:

F9
Arm the Monitor: Press F9 to toggle the active monitoring state. The console will display ARMED and you'll hear the armed sound. It is now actively tracking system clipboard changes.
CTRL + C
Copy Output: Copy any code block directly out of your LLM interface. Markdown blocks (using triple backticks) are automatically resolved and sanitized on the fly.
Confirm Injection: The monitor will instantly scan your index and suggest target files. If you stick to the default LLM instructions, more often than not you won't be required to interact with the stitcher at all. If any user interaction is required, then simply follow the console prompts.

Accordion Stitching

Standard text patchers fail when code outputs are truncated. Large language models often use comments like # ... rest of code unchanged ... to avoid emitting massive files.

The Accordion Stitcher uses Edge Anchor Mapping to solve this. It recursively pairs the non-truncated segments with your local source file while identifying the boundaries of the gap. Once the gap boundaries are secured, it cleanly stretches and inserts the correct logic without wiping adjacent lines.

Note: Standalone ellipses (...) or comment lines signaling omissions are dynamically processed and stripped to ensure no leftover placeholder debris is written into production scripts.

Tactical Routing (Shift+F9)

For high-risk files or highly sensitive structural changes, toggle Tactical Arm using Shift+F9. This forces the engine out of automatic routing and exposes the manual prompt pipelines:

  • Smart Drop-In: Directly updates existing code blocks and methods inside matching targets.
  • Full Class Overwrite: Eradicates the local class definition and drops in the complete, new definition.
  • Full File Overwrite: Overwrites the full active target buffer with safety drop safeguards.
  • Interactive Headless Overlay: Drops you into a manual alignment console where you can manually offset and overlay your patch block with your arrow keys before executing.

Syntax Healing

Web interfaces and copy-paste buffers can sometimes inject formatting bugs into otherwise valid code. AI Code Stitcher applies multiple active correction sweeps on every clipboard write:

Active Corrections:

  • Fracture Repair: Reconnects lines that were illegally wrapped by UI wrappers while respecting multiline docstrings.
  • Tab Normalization: Automatically converts hard tab/space hybrid indents to perfect 4-space indentations.
  • Garbage Scrubbing: Vaporizes hidden Unicode characters, Non-Breaking Spaces (NBSP), and zero-width characters.
  • Import Hoisting: Locates newly introduced, deeply buried imports and systematically promotes them to the top-level header space of the module, ensuring zero duplication.

cs_settings.ini

Your local configuration file controls window placement, transparency levels, system audio behaviors, and monitor affinities.

[DEFAULT]
# Enter absolute paths to folders you want to monitor here
# Append --no-recursive to a folder path to prevent scanning subdirectories
C:\your_codebase\your_project

CONF_SOUND_ENABLED = True
CONF_ALWAYS_ON_TOP = True
CONF_VIEWER_ALWAYS_ON_TOP = True
CONF_INACTIVITY_SCREENSAVER = 30     # (MINS)  0 = off.
CONF_GLOBAL_HOTKEY = True            # excluding F9 and Shift-F9

# UI Dimensions
CONF_TOTAL_CHARS = 68
CONF_WINDOW_HEIGHT = 880
CONF_WINDOW_TRANSPARENCY = 0.90
CONF_WINDOW_WIDTH = 440
CONF_FONT_NAME = lucida console
CONF_FONT_SIZE = 10
ini

Hotkey Cheat Sheet

Use these dedicated hotkeys while the monitor window is focused to command operations:

F9
Toggles standard Arm/Clipboard Monitoring state.
Shift + F9
Toggles Tactical Arm (Interactive manual confirmation mode).
F8
Toggles manual filelock target configurations.
F7
Launches LLM Compose prompt composition panel.
F6
Clears console history and buffers.
F11
Spawns Stitch Viewer application window.
Shift + F11
Opens cs_settings.ini directly in Notepad.
Ctrl + Z
Executes undo rollback on last committed file write.
Ctrl + Y
Executes redo check on last reverted rollback.