Skip to main content

Minimal coding agent CLI and web UI built on mycode-sdk.

Project description

mycode

There are many coding agents, but this one is mine.

A minimal coding agent. Inspired by pi.

  • Minimal core (under 5k lines of code).
  • Unified message format and robust cross-provider replay.
  • 4 built-in tools: read, write, edit, bash, expanded via skills.
  • Inspectable runtime, append-only JSONL sessions.
  • Native image and pdf input support.
  • Mobile-friendly web UI.
  • Lightweight mycode-sdk for embedding the agent in other Python apps.

Quick Start

Requires Python 3.12+. Install via uv:

uv tool install mycode-cli

Interactive terminal session:

mycode

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

mycode web (--port <port> --hostname <hostname>)

Single message, non-interactive:

mycode run "explain how the session store works"

API keys are discovered automatically from environment variables (see Providers & Models).

Providers & Models

Provider id Env var Default models
Anthropic anthropic ANTHROPIC_API_KEY claude-sonnet-4-6, claude-opus-4-7
OpenAI openai OPENAI_API_KEY gpt-5.4, gpt-5.4-mini
Google Gemini google GEMINI_API_KEY gemini-3.1-pro-preview, gemini-3-flash-preview
Moonshot moonshotai MOONSHOT_API_KEY kimi-k2.5
MiniMax minimax MINIMAX_API_KEY MiniMax-M2.7, MiniMax-M2.7-highspeed
DeepSeek deepseek DEEPSEEK_API_KEY deepseek-chat, deepseek-reasoner
Z.AI zai ZAI_API_KEY glm-5.1, glm-5-turbo
OpenRouter openrouter OPENROUTER_API_KEY openrouter/auto
OpenAI-compatible openai_chat (configured per provider)

Configuration

No config file is required. It is only used for:

  1. Setting default provider, model, and other options
  2. Overriding built-in provider settings (e.g. changing the available model list)
  3. Adding custom providers with any built-in provider type.
  4. Customize model metadata for built-in and custom models.

Config is loaded from ~/.mycode/config.json (global) and <workspace>/.mycode/config.json (project-specific, takes precedence).

{
  "default": {
    "provider": "anthropic",
    "model": "claude-sonnet-4-6",
    "reasoning_effort": "medium"
  },
  "providers": {
    "openrouter": {
      "models": {
        "deepseek/deepseek-v3.2": {},
        "xiaomi/mimo-v2-pro": {}
      }
    },
    "zhipu-coding-plan": {
      "type": "zai",
      "base_url": "https://open.bigmodel.cn/api/coding/paas/v4",
      "api_key": "${ZHIPU_API_KEY}"
    },
    "custom-provider": {
      "type": "openai_chat",
      "base_url": "https://custom-endpoint.com/v1",
      "api_key": "${CUSTOM_API_KEY}",
      "models": {
        "custom-model": {
          "context_window": 128000,
          "max_output_tokens": 16384,
          "supports_reasoning": true,
          "supports_image_input": false
        }
      }
    }
  }
}
  • Built-in provider ids can be overridden by key without specifying type. Custom providers must set type.
  • reasoning_effort controls extended thinking for supported models: auto (default) · none · low · medium · high · xhigh.
  • API keys in config accept ${ENV_VAR} references.
  • Model metadata is sourced from models.dev and bundled — no manual config needed for built-in models.

Built-in Moonshot, MiniMax, and Z.AI defaults use international endpoints. Override base_url in config for China endpoints.

CLI Reference

mycode                            start interactive session (new)
mycode --continue                 resume the most recent session
mycode --session <id>             resume a specific session
mycode run "..."                  send one message, non-interactive
mycode web                        start web server (default port 8000)
mycode web --dev                  API only, no static files
mycode session list               list saved sessions

Interactive slash commands: /new /resume /provider /model /effort /clear /q

Development

git clone <repo> && cd mycode
uv sync --dev
uv run mycode

Web development (backend + Vite dev server):

uv run mycode web --dev
pnpm --dir web install && pnpm --dir web dev

Build distributable artifacts:

uv build --package mycode-sdk
uv build --package mycode-cli

mycode-sdk

import asyncio
from mycode import Agent, bash_tool, read_tool

async def main() -> None:
    agent = Agent(
        model="claude-sonnet-4-6",
        api_key="...",
        cwd=".",
        system="You are a concise coding assistant.",
        tools=[read_tool, bash_tool],
    )
    async for event in agent.achat("Read pyproject.toml and tell me the project name."):
        if event.type == "text":
            print(event.data["delta"], end="")

asyncio.run(main())

See mycode/README.md for details.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mycode_cli-0.4.2.tar.gz (2.8 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mycode_cli-0.4.2-py3-none-any.whl (3.1 MB view details)

Uploaded Python 3

File details

Details for the file mycode_cli-0.4.2.tar.gz.

File metadata

  • Download URL: mycode_cli-0.4.2.tar.gz
  • Upload date:
  • Size: 2.8 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for mycode_cli-0.4.2.tar.gz
Algorithm Hash digest
SHA256 294eddcddd9bd7cf67b4a74be4dd7e0e1a50f8f8e335e0cbe2bf903fd0b11c91
MD5 16ddf35a12e03a9a0528d377934bb7bf
BLAKE2b-256 741a58e69c0a59e52218db5fdbf05e1c8afc90f205094dd567820222ee40222e

See more details on using hashes here.

File details

Details for the file mycode_cli-0.4.2-py3-none-any.whl.

File metadata

  • Download URL: mycode_cli-0.4.2-py3-none-any.whl
  • Upload date:
  • Size: 3.1 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for mycode_cli-0.4.2-py3-none-any.whl
Algorithm Hash digest
SHA256 ab26004c1f06595c289a70f4e3be282b354e9532e37d228e9f84613c149d480b
MD5 127e46cf5e05b5c17b6fa5218c7a643d
BLAKE2b-256 3f1b7d7a26c4d1dfa64a68366b1f4b2c256225109c51fc88aea219e4f5d9cbe1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page