Live — fork of opencode

LemonCode

LemonCode is a fork of opencode maintained by LemonCrow (lemoncrow-lab/lemoncode), vendored into the repository as a submodule.

As an MCP server inside Claude Code, Copilot, or stock opencode, LemonCrow's tools improve what context a turn sees — but the host's own model still answers every turn, at whatever tier the host chose, and the host's own loop decides when to stop. lc code reverses that: a token-authenticated loopback gateway owned by LemonCrow runs the agent loop itself, against LemonCode, Codex, or Claude as the frontend. That's what makes the rest of this page possible.

# provisions the host if needed, then launches it
$ lc code --engine lemoncode

There is no separate install step. If the host binary is missing, a checksummed release is downloaded to <store>/bin/lemoncode-host before the host starts. Selecting LemonCode in the installer wizard does the same.

lemoncode is also a console entry point for the same command, and bare lc with no subcommand dispatches to lc code.

What owning the loop gets you

lc code is a real V2 implementation, on by default in measurement-only shadow mode. Flip --optimization-mode enforce to apply it. Controlled quality/cost benchmark gates are still pending — see the savings roadmap for current status.

LemonScout skips the frontier model for lookups it doesn't need
LemonScout is a bounded local pass over LemonGraph's index that reads the real source and returns exact, hash-verified spans — zero calls to the planning model when it's confident, one local-model call when it isn't.
$ lc code --local-retrieval force --local-retrieval-model ollama/qwen2.5-coder:7b
LemonRoute sends each turn to the model it actually needs
Not every turn deserves the expensive model. LemonRoute scores tool, task text, and session state per turn, and can answer with a cheap tier, a mid tier, or a local Ollama / LM Studio model instead of paying frontier price for the whole session.
$ lc code --budget cheap --model openai/gpt-5.4
Holds cost and stopping guarantees for the whole session
A plugin can only shape what one tool call returns — it can't stop the host's own loop early. Because LemonCrow runs the loop here, the output governor trims narration and holds the loop open until a verified receipt exists, and enforce mode turns this from measurement into applied behavior (default shadow only measures; nothing changes until you opt in). --max-cost is a separate, blunter backstop: once projected spend would cross it, the loop stops before the next turn — no rollback, no cleanup, task possibly unfinished. Set it as a ceiling you never expect to hit, not a target.
$ lc code --max-cost 2.00 --optimization-mode enforce

None of this is exclusive to the LemonCode binary — --engine codex and --engine claude get the same loopback gateway. LemonCode is the one frontend LemonCrow also owns the source of, so it's where this lands cleanest: the host is auto-provisioned instead of bring-your-own, the telemetry panel below is builtin instead of an installed plugin, and prompt/tool stripping plus disabled duplicate compaction/update/model-fetch loops are built into the fork itself rather than intercepted at the gateway.

Telemetry panel

The LemonCrow sidebar panel is builtin. On stock opencode the same view comes from the lemoncrow-status plugin. It reports:

  • tokens in / cached / out
  • context size
  • cache efficiency
  • cost
  • savings
  • tool + MCP call counts

Configuration and sessions

Config lives in ~/.config/lemoncode and data in ~/.local/share/lemoncode, isolated from any stock opencode install. File names and the workspace directory are unchanged from opencode, so a project-local install with --workspace DIR uses the same opencode.json and .opencode/.

Sessions are stored in the same SQLite shape as opencode, so session import and session replay work identically.

Host binary
<store>/bin/lemoncode-host
MCP server config
~/.config/lemoncode/opencode.json
Agent profiles
~/.config/lemoncode/agents/lemoncrow.<role>.md
Nudge plugin
~/.config/lemoncode/plugins/lemoncrow-nudge.js

Managing the host binary

$ lc code host status
installed version, commit, resolved path, update policy
$ lc code host install
provision the binary on its own (not a prerequisite)
$ lc code host update
same, on demand
$ lc code host build --source opencode
build from the vendored checkout (requires bun)
$ lc code host remove
delete the managed binary

The default policy checks the release channel at most once every six hours. Set LEMONCODE_HOST_UPDATE=off to pin the installed build, or LEMONCODE_HOST_BIN=/path/to/lemoncode to use your own binary.

Known limitations

  • The sidebar panel reads a status file that lc code exports per run, so it stays blank until the first turn completes.
  • LemonCode does not expose a Codex-style hooks status screen.
  • Plugins load at startup, so the host needs a restart after installing or changing them.

Get started

With LemonCrow installed, lc code --engine lemoncode downloads the host if needed and launches it against the local gateway.