Divide and Conquer AI Coding: Connect a Planning Model to Your Local Repo with MCP

    Many strong reasoning models can plan complex coding tasks but cannot touch your local repository, while coding agents can edit code and run tests but often lack deep planning ability — and their subscription quotas are billed separately. This article shows how to bridge the gap using the Model Context Protocol (MCP): expose your local repo to a planning model through a secure HTTPS tunnel, let it write structured plans into a dedicated directory, and have a coding agent execute and log results step by step. You'll learn a practical directory and file design, the "plan as contract" workflow, key security boundaries, and the scenarios where this division of labor saves the most quota and delivers the most value.

    Splitting Brains and Hands: Using MCP to Connect a Planning Model with Your Coding Agent

    The Problem: The Model That Thinks Can’t Act, and the Agent That Acts Doesn’t Think Deeply

    In AI-assisted programming, developers often run into an awkward disconnect. One class of models excels at planning and reasoning over complex tasks — understanding requirements, breaking down steps, and assessing risks — but it cannot directly access your local repository. Another class of tools (AI coding assistants, command-line agents, and the like) can read and write code, run tests, and commit changes, but their internal planning capabilities may not be strong enough for large, multi-stage tasks.

    This creates a typical tension: Pro-tier models “think well but can’t operate on your local project,” while coding agents “can modify code and run tests but may plan complex work poorly.” A practical constraint makes it worse: the subscription quotas for the two are usually tracked separately. Chat product quotas often have room to spare in daily use, while coding tool quotas are always the first to run out. If you could route idle “thinking quota” into project planning and let coding tools handle execution, you’d solve both the capability and the cost problems at once.

    The Approach: Let the Planning Model Touch Real Code via MCP

    The Model Context Protocol (MCP) is an open protocol that lets large language models access external tools and data sources in a standardized way. Building on it, you can set up a clear collaboration pipeline:

    1. Start an MCP service locally that exposes read-only or controlled read/write access to the repository;
    2. Forward that service securely to the conversational model through an HTTPS tunnel, giving it access to the local repo;
    3. The strong planning model on the chat side reads project context such as the file tree, source code, and Git status;
    4. After analyzing requirements and decomposing the task, the model writes the plan into an agreed directory in the repo (for example, .ai-bridge);
    5. The coding agent reads the plan file and executes it step by step: modifying code, running tests, and recording results;
    6. Execution records are written back to the same directory so the planning model can verify and adjust in the next round of conversation.

    The core of this workflow is “plan as contract”: the planning and execution roles exchange intent through files inside the repository rather than relying on fragile implicit context. This brings several benefits:

    • Traceable: every plan and every execution leaves a record on disk, making review and rollback easier;
    • Interruptible: if the conversation is cut off, the agent can continue working from the plan file;
    • Auditable: humans can review plans at any time and correct direction before execution begins.

    Suggested Directory and File Design

    Create a working directory like .ai-bridge/ at the repository root, with a structure along these lines:

    1. .ai-bridge/
    2. ├── plans/
    3. │ └── 2025-xx-xx-refactor-auth.md # Task plan: goals, steps, acceptance criteria
    4. ├── runs/
    5. │ └── run-003.log # Execution record: commands, diff summaries, test results
    6. └── state.json # Current task state machine

    A plan file should contain four parts: background and goals, task breakdown (each subtask with acceptance criteria), risks and dependencies, and a rollback strategy. On the execution side, the agent updates the status in state.json and appends to the execution log after completing each subtask. This way, when the planning model reads the directory in the next round, it can determine progress precisely instead of guessing from conversational memory.

    Security and Engineering Considerations

    Exposing a local repository to a remote model requires clear security boundaries:

    • Expose only the necessary directories, and exclude .env files, secrets, and build artifacts by default;
    • Use an authenticated HTTPS channel for the tunnel; never expose ports in plaintext;
    • Keep the planning side read-only by default, confining its writes to the .ai-bridge directory; route all code changes through the local agent;
    • Apply a whitelist or human-confirmation mechanism to the agent’s command execution, especially for operations involving deletion, commits, or pushes.

    Quota Optimization and Suitable Use Cases

    This architecture also has a practical economic benefit: planning consumes the chat product’s quota, while execution consumes the coding tool’s quota — the two pools are independent and don’t compete. For users whose coding quota is tight but chat quota is abundant, this effectively converts idle quota into productivity.

    The pattern fits scenarios such as multi-file refactoring, migrations that need a solid plan upfront, and feature development with complex dependencies. For small, single-point changes, just hand the task directly to the coding agent — the full pipeline isn’t worth the overhead.

    Conclusion

    “One model thinks clearly, the other does the work” is more than a quota-saving trick — it’s a robust paradigm for AI collaboration: use a protocol (MCP) to connect capabilities, use files (plans and logs) to persist intent, and use permission boundaries to guarantee safety. Let the planning model do what it does best — reasoning — and the coding agent do what it does best — execution — while humans retain final review and decision authority. That is the key to getting the most out of today’s AI coding tools.