MC midnight-coder local coding agent

Midnight Coder

Midnight Coder

A local-first coding agent built for explicit control over model selection, sandboxing, approvals, and conversation history. It keeps the runtime close to the workspace instead of hiding it behind a thin chat shell.

  • Local-firstRuns in your workspace
  • Model controlProvider probe + model selection
  • Context controlResume, fork, compact
  • InterfacesTerminal, app-server, SDKs
Midnight Coder terminal interface preview
The product ships with a terminal-first workflow and a structured runtime surface for richer clients.

Explicit runtime

Provider, model, sandbox, and approvals are all chosen deliberately through the product's own settings and command flow.

Local model setup

Use /provider_conf to probe a local provider from an ip:port address, detect available models, and save the provider and model that were found.

Bounded context

Conversations persist as threads and turns, can be resumed or forked, and can be compacted when history needs trimming.

Integration surface

The terminal workflow powers the app-server, Python SDK, TypeScript SDK, and release packaging that keeps binary artifacts reproducible.

Guides and technical answers

Explore local AI coding workflows

Practical, source-backed guides for choosing a local coding agent, connecting Ollama, managing context, and embedding the runtime.

Overview What is a local AI coding agent?

Understand the runtime, privacy boundary, model control, and workspace workflow.

AI agents AI coding agents for developers

Compare repository agents, terminal workflows, Codex-style tools, Cursor-style tools, and Claude Code-style CLIs.

Developer AI tools AI tools for software development

Map AI code assistants, coding agents, local LLMs, SDKs, security controls, and integrations.

Codex OpenAI Codex alternative

Evaluate local-first Codex-style coding-agent requirements with explicit provider and sandbox controls.

Cursor Cursor alternative for local AI coding

Use Midnight Coder when the requirement is terminal-first execution instead of an editor clone.

Claude Code Claude Code alternative

Evaluate terminal AI coding-agent workflows with local model control, context, and approvals.

Local models Use Midnight Coder with Ollama

Connect a provider, select a model, and enable native smart context sizing.

Getting started Install Midnight Coder

Check requirements, install from npm, launch the CLI, and verify the setup.

Long sessions Manage AI coding context

Control context windows, compaction, resume strategy, and fresh conversations.

Build with it App server and SDK integrations

Choose between terminal, JSON-RPC, Python, and TypeScript interfaces.

Inference Run LLM inference locally

Understand providers, endpoints, quantization, hardware, context, and privacy.

Security Sandbox an AI coding agent

Separate model decisions from enforced workspace, network, and approval controls.

Terminology AI coding and LLM glossary

Definitions for agents, models, inference, tokens, context, tools, and APIs.

Developer tools Choose an AI code assistant

Compare completion, generation, pair programming, and agentic workflows.

Private AI Open source and self-hosted coding

Separate local-first, offline, self-hosted, and privacy-first architecture.

Code models Connect local code LLMs

Understand provider boundaries for GGUF, llama.cpp, Qwen, and DeepSeek models.

Hardware Plan local AI on limited GPUs

Evaluate AMD, RX 580, old-GPU, low-VRAM, and quantized-model workflows.

Evaluation Compare coding-agent alternatives

Use verified requirements without unsupported feature-parity claims.

Agent workflow Run repository-level coding tasks

Connect workspace inspection, edits, tool results, SmartContext, and compaction.

Developer stacks Use AI across software stacks

Apply the workspace runtime to Python, JavaScript, TypeScript, backend, and DevOps.

Enterprise evaluation Assess controlled AI coding

Map verified controls to security and operations requirements without overclaiming.

Local model control

Point Midnight Coder at the model you actually want to run

Open /provider_conf and enter an address like 127.0.0.1:11434. Midnight Coder probes the endpoint, checks /api/tags and /v1/models, and stores the detected provider and model.

After that, use /model to pick the model exposed by the server and choose the reasoning effort for the current run.

/provider_conf 127.0.0.1:11434

/model

The app probes the endpoint, detects available models,
and persists the provider and model.
Start a new chat to use the saved provider for the whole session.
Prompt /provider_conf or /provider-conf
Probe targets ip:port or http://host:port
Detection /api/tags and /v1/models

Context control

Keep history explicit, bounded, and easy to recover

Context is not an opaque pile of tokens. Midnight Coder stores threads and turns, lets you resume a previous session, fork from an earlier state, and compact history when the conversation gets long.

The runtime also records diagnostics in a bounded local log store. When you need more visibility, you can enable a plaintext log directory for a run from inside the product.

Use /clear to start a fresh chat, /new to open another chat during a conversation, and /compact when you want the history trimmed.

/context
/mini-model
/resume-type
/new
/clear
/compact
Thread Persistent conversation container
Turn One run of input, reasoning, tools, and output
Item Atomic history entries used to rebuild context

Install

Install once from npm

npm install -g midnight-coder

Midnight Coder is published to npm for straightforward installation and team-wide version pinning.

The terminal workflow, app-server, and SDKs all share the same workspace runtime, so the same session, sandbox, and approval rules apply everywhere.

Integration surface

One core runtime, several interfaces

Terminal workflow

The terminal app stays close to the workspace and exposes the agent directly.

Terminal preview
App server

JSON-RPC transport for rich clients, including editor integrations.

Protocol notes
Python and TypeScript SDKs

Embed the agent into scripts, services, notebooks, or application code.

Python

Support Midnight Coder

If this project saved you time, consider backing it

Your support helps keep Midnight Coder moving forward with new features, bug fixes, documentation, and infrastructure.

Ways to contribute

  • Buy Me a Coffee
  • Pix: 38e0af8d-9f56-45cf-8bc8-688dbea4405a

Buy Me a Coffee