Skip to main content

mycode-cli

Interactive coding agent CLI and web server, built on mycode-sdk.

Quick Start

Requires Python 3.12+. Install via uv:

uv tool install mycode-cli

Set a provider API key, then start:

export ANTHROPIC_API_KEY=...
mycode

Web UI (default at http://localhost:8000):

mycode web [--port <port>] [--host <host>]

Single message, non-interactive:

mycode run "explain how the session store works"

Providers

Provider id Env var
Anthropic anthropic ANTHROPIC_API_KEY
OpenAI openai OPENAI_API_KEY
Google Gemini google GEMINI_API_KEY
Moonshot moonshotai MOONSHOT_API_KEY
MiniMax minimax MINIMAX_API_KEY
DeepSeek deepseek DEEPSEEK_API_KEY
Z.AI zai ZAI_API_KEY
OpenRouter openrouter OPENROUTER_API_KEY
Alibaba Cloud alibaba DASHSCOPE_API_KEY
xAI xai XAI_API_KEY
OpenAI-compatible openai_chat -

Run /model in the TUI to see available models. --model takes a listed model id or provider/model (for example --model deepseek/deepseek-v4-pro); see docs/cli.md.

Configuration

A config file is optional — API keys from the environment are usually enough. Create ~/.mycode/config.json (global) or .mycode/config.json in a project to customize further.

Expose additional models on an existing provider, or register a custom endpoint such as a private or regional deployment:

{
  "providers": {
    "openrouter": {
      "models": {"deepseek/deepseek-v4-pro": {}}
    },
    "my-endpoint": {
      "type": "openai_chat",
      "base_url": "https://example.com/v1",
      "api_key": "${MY_API_KEY}",
      "models": {"my-model": {}}
    }
  }
}

A providers key matching a built-in provider id overrides it; other names are custom providers and must declare a type (one of the ids in the table above). api_key accepts a literal value or a ${ENV_VAR} reference. {} is enough for models covered by the bundled models.dev metadata; add fields only for models it doesn't list.

Built-in Moonshot, MiniMax, and Z.AI providers default to international endpoints. Override base_url for China endpoints.

See docs/config.md for the full schema — permission levels, web providers, and resolution rules.

Skills and instructions

The CLI assembles the system prompt from instructions files and discovered skills.

  • AGENTS.md files are injected as project instructions: ~/.mycode/AGENTS.md (fallback ~/.agents/AGENTS.md), then every AGENTS.md from the project root down to the current directory. Later files take precedence.
  • A skill is a directory containing a SKILL.md, up to three levels below a scan root, or a .md file directly in a scan root. Scan roots, lowest to highest priority: ~/.agents/skills/, ~/.mycode/skills/, then .agents/skills/ and .mycode/skills/ from the project root down to the current directory. Later roots override earlier ones by skill name. The file needs YAML frontmatter with a description; name defaults to the directory or file name and may contain only letters, digits, -, and _ (at most 64 characters).
  • A standalone /<skill-name> token in a message loads the matching skill, e.g. Use /fastapi to review this route. Names matching built-in slash commands are reserved.

Subagents

The main agent can hand a self-contained task to a subagent. Subagents follow the session's permission settings, but one running in the background cannot ask for approval, so its calls that need approval are denied.

The built-in general subagent has the same tools as the main agent. Add your own as markdown files in ~/.mycode/agents/ or in .mycode/agents/ of the project. A file named general.md replaces the built-in.

---
description: Reviews a diff for correctness bugs
model: anthropic/claude-sonnet-5
permission: readonly
max_turns: 30
---
You review code changes. Report bugs with file and line.

description is required: it tells the model what the subagent is for. The body is added to the subagent's system prompt. permission takes the same values as the config permission and can only restrict the session's.

To run subagents on other models, list them in the config. The first is the default for subagents whose definition names no model, and the model can pick any of them for each subagent:

{"subagent": {"models": ["deepseek/deepseek-v4-flash", "anthropic/claude-opus-5"]}}

Reference: docs/subagents.md.

Terminal UI

Key Action
Enter Send the message (steer while a reply runs); with a completion menu open, accept it
Ctrl+Q Queue the message for after the reply; otherwise send it
Alt+Up Take back pending steers and queued messages into the input
Shift+Enter or Alt+Enter Insert a newline (Esc then Enter also works)
Esc Take back pending messages and interrupt the reply; close a selection list
Ctrl+C Take back pending messages and interrupt the reply; otherwise clear the input
Ctrl+D Exit (empty input only)
Ctrl+L Clear the screen
Up / Down Move between lines; on the first or last line, browse input history

While a reply runs, Enter steers it: the model sees the message at its next step, after the running tools finish. Ctrl+Q queues the message instead; queued messages are sent together as the next turn when the reply finishes. Pending messages show above the input. Commands are unavailable until the reply ends.

A bash call with background=true keeps running after the reply ends (docs/tools.md). Its result is steered into the running reply, or wakes the idle session as a new turn, printed as a Background finished card with the command, its exit code, and the output tail. Esc, Ctrl+C, or denying a tool call holds wakes until the next message, which then carries the waiting results. /new, /rewind, a completed /resume, and exit stop the session's background commands and agents.

/agents lists the session's subagents. Choosing one prints its transcript; a running one can also be stopped.

@path attaches a file to the message: text files as snapshots, images and PDFs as image or document input. A large image is scaled down. A file the message cannot hold (an image or PDF over 20MB, a PDF over 20 pages, any other binary file) is passed as its path for the agent to inspect. Pasted file paths become @path references.

Slash commands: /new (alias /clear) /resume /rewind /model /effort /compact /agents /quit (alias /exit). exit and quit also exit.

CLI Reference

mycode                            start interactive session (new)
mycode --continue                 resume the most recent session
mycode --session <id>             resume a specific session
mycode --effort high              set effort for this session
mycode run "..."                  send one prompt, print the reply, exit
git diff | mycode run "review"    piped stdin is appended to the prompt
mycode run --format json "..."    machine-readable result (also: jsonl)
mycode web                        start web server (default port 8000, or $PORT)
mycode web --dev                  API only, with hot reload
mycode session list [--all]       list saved sessions
mycode -h                         help; also works on every subcommand

Options before a subcommand configure the interactive session only; pass run options after run. Full reference, output formats, and exit codes: docs/cli.md.

License

MIT

Metadata

Release files for mycode-cli 0.22.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mycode-cli 0.22.1
File Size Uploaded Provenance Actions
mycode_cli-0.22.1.tar.gz 2.8 MB Without provenance Details for mycode_cli-0.22.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for mycode-cli 0.22.1
File Interpreter ABI Platform Actions
mycode_cli-0.22.1-py3-none-any.whl Python 3 none any Details for mycode_cli-0.22.1-py3-none-any.whl

Total release size: 5.8 MB

Release files / mycode_cli-0.22.1.tar.gz

Download URL mycode_cli-0.22.1.tar.gz
Size 2.8 MB
Tags Source
SHA-256 checksum
How to use checksums
38ff6269bdcc60ef612692d8e1a977f6f0b1710877feead436ad29a19be6c349
BLAKE2b-256 checksum
How to use checksums
ecc542f6709bf776d4d70bb9b94835bb38823065a876b4002e14baf04801487c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / mycode_cli-0.22.1-py3-none-any.whl

Download URL mycode_cli-0.22.1-py3-none-any.whl
Size 3.0 MB
Tags Python 3
SHA-256 checksum
How to use checksums
9577c17f7da98eeb15f6935174f4f4851d2689423d548e06277294d745927688
BLAKE2b-256 checksum
How to use checksums
c9d9362bebc6b0fa141108d52f9ed7cd502f649d64a622aea24b6aee836b3415
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for mycode-cli 0.22.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.22.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page