XP Vibes Logo XPVibes.com
9:00 PM

v2.8.12 — the sticky XP Vibes OS taskbar is now injected automatically by the child theme (wp_body_open) and renders the live xpvibes_primary WordPress menu (Appearance -> Menus). This FSE header part is intentionally an empty hidden placeholder.

📄 AI Coding with File and Context Management Using Context Courier
Address: https://xpvibes.com/workflows/context-courier-ai-coding/
Last modified: November 22, 2026

AI Coding with File and Context Management Using Context Courier

● TRACK 01.2 — TRI-AGENT AI CODING WORKFLOW

I build real software projects completely solo — a WordPress theme, a Linux automation server, a Windows desktop tool — without ever copy-pasting an entire codebase into a chat window. My secret is that no single AI does the whole job. A Tri-Agent Workflow splits the work between an architect that plans, a builder that edits files on my disk, and a memory layer that keeps both of them honest, glued together by my own tool, Context Courier. This page explains exactly how the loop runs.


What This Workflow Solves (The “Context Tax”)

Every AI chat has a fixed attention budget — the number of words it can hold “in mind” at once. When I paste huge raw source files into a conversation, I pay what I call the Context Tax:

  • The upload eats the context budget, so responses slow down and earlier instructions silently fall off the edge of the model’s memory.
  • The model starts guessing — inventing function names that do not exist in my real files, or “fixing” code it never actually saw.
  • Working features get overwritten, because a chat that only saw half my project happily rewrites the other half.
  • Browser chats truncate long code blocks — a 500-line file comes back chopped in the middle, and the missing tail silently breaks the build.

My fix is to separate planning from file editing. The browser chat never edits files and never receives full-file dumps — it plans, reviews compact diffs, and writes precise instructions. A local builder applies those instructions directly to disk. The Context Tax is only ever paid in small, deliberate doses.

Tools I Use

  • Gemini (Web Architect) — designs the plan, reviews compact diffs, and outputs Compiler-Mode Prompts: self-contained instruction blocks that say exactly which file, which exact text to replace, and what to replace it with. Never raw full-file dumps.
  • Context Courier (local Python / FastAPI + ChromaDB) — my offline-first desktop utility. It scans my project folder and builds a CODE_CONTEXT map from an AST (Abstract Syntax Tree — basically a clean outline of every file, class, and function in the project, with the boilerplate stripped out). From that map it pulls focused Micro-Context Pills: roughly 5,000–6,000 tokens containing the top 10 most relevant code chunks, sorted in their real file order, with .md documents excluded from the code index so prose never dilutes the signal.
  • OpenCode Desktop / OpenCode TUI (with Qwen3.8 Flash) — my local builder. It takes Gemini’s Compiler-Mode Prompt and edits the files on my Windows 11 drive directly, under Silent-Write rules: edit on disk, then return only a short bulleted summary of files touched and checks run — no giant code dumps back into the conversation.

Step-by-Step Process (The Hybrid Handoff Loop)

Here is the whole loop as I actually run it, one lap at a time:

 +--------------------------------------------------+
 |  1. CONTEXT COURIER (local, Windows 11)          |
 |     AST scan -> CODE_CONTEXT map                 |
 |     pulls the Session Diff Pill / Micro-Context  |
 +------------------------+-------------------------+
                          v
 +------------------------+-------------------------+
 |  2. GEMINI WEB (the Architect)                   |
 |     reads the pill, plans the change,            |
 |     writes a Compiler-Mode Prompt (diffs only)   |
 +------------------------+-------------------------+
                          v
 +------------------------+-------------------------+
 |  3. OPENCODE + QWEN3.8 FLASH (the Builder)       |
 |     Silent-Write: edits files directly on disk,  |
 |     returns a short bulleted summary             |
 +------------------------+-------------------------+
                          v
 +------------------------+-------------------------+
 |  4. TEST LOCALLY, then "Generate New Context"    |
 |     Courier bumps the version, recompiles        |
 |     CODE_CONTEXT, copies the Session Diff Pill   |
 +------------------------+-------------------------+
                          v
 +------------------------+-------------------------+
 |  5. GEMINI NOTEBOOK (the Memory)                 |
 |     PROJECT_CONTEXT + CODE_CONTEXT uploaded,     |
 |     superseded versions pruned — loop repeats    |
 +--------------------------------------------------+
  1. Plan in Gemini. I open a fresh chat, paste the handoff prompt pointing at the current context files, and describe the change. Gemini produces the plan and the exact Compiler-Mode Prompt.
  2. Pull a Micro-Context Pill when Gemini needs exact code. Instead of pasting whole files, I ask Context Courier for a pill — the ~5,000–6,000 tokens of real, ordered code chunks relevant to the task — and drop that into the chat.
  3. Run the Compiler-Mode Prompt in OpenCode. I paste the same prompt into OpenCode (Desktop or TUI) with Qwen3.8 Flash as the builder. It edits on disk under Silent-Write rules and answers with only a summary.
  4. Test locally. I run the site or program myself. If something fails, the error text (not the whole file) goes back to Gemini for a follow-up prompt.
  5. Re-compile in Context Courier. I click “Generate New Context”: the version number bumps, a fresh CODE_CONTEXT_vX.X.X.md is compiled from the AST, and the Session Diff Pill — a summary of exactly what changed — is copied for the next chat.
  6. Close the lap in Gemini Notebook. Gemini and Qwen finalize PROJECT_CONTEXT together, and I drop both versioned files into the project notebook, deleting the superseded copies. The next fresh chat starts fully grounded in seconds.

Where This Connects Next

🟢 WordPress Gutenberg Page Content 🔒 Google OAuth HP-AI-Server-App Compliant