Skip to main content

minimal-cli-agent

Language: English | 中文

A terminal-first AI coding agent with persistent sessions, structured tools, permissions, local skills, MCP/plugin loading, workflow state, and model routing. It keeps the core loop small: ask the model for explicit actions, execute those actions through a harness, append observations, and continue until the model exits or the user interrupts.

minimal-cli-agent Codex profile demo

Quick Start

python3 -m venv .venv
source .venv/bin/activate
pip install -e .
minimal-agent

To install a published release instead of a checkout:

python -m pip install minimal-cli-agent
minimal-agent --show-config --permission plan --no-session

The same wheel and source archive are attached to each GitHub Release.

The default run starts an interactive session, loads local config, persists transcript state in .agent/session.json, and uses unlimited loop steps until exit.

With Ollama:

ollama pull qwen3:4b
ollama serve
minimal-agent

Read-only inspection:

minimal-agent --permission plan "Inspect this repository and summarize risks"

OpenAI-compatible endpoint:

AGENT_PROVIDER=openai-compatible \
AGENT_BASE_URL=https://api.openai.com/v1 \
AGENT_API_KEY=... \
AGENT_MODEL=gpt-4.1-mini \
minimal-agent "Check the tests and summarize failures"

Daily Commands

Run without arguments to enter the REPL:

minimal-agent

Useful slash commands:

/help
/model qwen3:4b
/provider ollama
/base-url http://localhost:11434
/permission autoEdit
/config
/config explain
/config capabilities
/config save
/context status
/context compact
/history 20
/events
/session stats
/session export .agent/session-export.json
/session import .agent/session-export.json
/memory alpha
/doctor
/debug bundle .agent/debug-bundle.zip
/policy
/skills
/skills load all
/mcp examples/mcp/my-coffee.json
/plugin my-plugin
/plan improve test coverage
/workflow create improve test coverage
/delegate inspect README risks
/review src/minimal_cli_agent

Session files are enabled by default. Use --session path/to/session.json for JSON persistence, --session-db path/to/session.sqlite for SQLite transcript/event storage and retrieval memory, or --no-session to run without persistence.

Configuration

Startup defaults are read in this order:

  1. Built-in defaults.
  2. User config: ~/.minimal-agent/config.json.
  3. Project config: .minimal-agent.json.
  4. Environment variables.
  5. CLI flags.
  6. REPL changes saved with /config save.

Common options:

--profile        ollama, codex, claude, or gemini
--provider       ollama, openai-compatible, anthropic, gemini, or codex
--model          model name
--base-url       provider base URL
--api-key        API key for OpenAI-compatible endpoints
--permission     default, autoEdit, plan, or yolo
--cwd            workspace directory
--max-steps      maximum loop iterations; 0 means unlimited
--timeout        command timeout in seconds
--model-timeout  model request timeout in seconds
--session        JSON session path
--session-db     SQLite session database path
--no-session     disable persistence
--policy-file    shell and write-scope policy JSON
--mcp-config     MCP server config JSON
--plugin         plugin manifest name or path
--skill          local SKILL.md name or path
--verbose        enable debug logs for diagnostics
--quiet          only show error logs

Profiles:

  • ollama: local Ollama defaults from OLLAMA_MODEL and OLLAMA_BASE_URL.
  • codex: reads ~/.codex/config.toml and can use Codex CLI login as a model adapter.
  • claude: reads Claude local settings plus Anthropic environment variables.
  • gemini: reads Gemini model, base URL, and API key environment variables.

Action Format

The model must request tools explicitly:

```bash-action
ls -la
```

```tool-action
{"tool":"read_file","path":"README.md"}
```

```tool-action
{"tool":"edit_file","path":"notes.txt","start_line":2,"end_line":3,"content":"replacement"}
```

Built-in structured tools include read_file, read_tail, read_forward, file_info, search, write_file, and edit_file. Read tools can run in parallel when safe; write tools remain ordered behind write barriers.

Safety Model

Permission modes:

  • plan: read-only. Shell and file writes are skipped as observations.
  • default: asks before shell commands and writes.
  • autoEdit: allows file writer tools, while shell commands still pass policy checks.
  • yolo: executes approved tool classes without interactive confirmation.

Policy files can add command allow prefixes, deny tokens, workspace write allow/deny globs, sensitive path tokens, and network command tokens. Built-in hard gates remain active.

MCP, Skills, And Plugins

MCP config uses the common mcpServers JSON shape:

{
  "mcpServers": {
    "my-coffee": {
      "type": "streamablehttp",
      "url": "https://example.com/mcp",
      "headers": {
        "Authorization": "Bearer ${TOKEN}"
      }
    }
  }
}

Load it at startup or in the REPL:

minimal-agent --mcp-config examples/mcp/my-coffee.json --skill my-coffee
/mcp examples/mcp/my-coffee.json
/skill my-coffee
/plugin my-plugin

Skills are local SKILL.md instruction bundles. Plugins can contribute skills and MCP server configs through manifests.

Architecture

Core modules:

agent.py          loop and event stream
harness.py        model, tools, memory, context, and policy boundary
cli.py            REPL and command orchestration
cli_config.py     argument and config resolution
cli_format.py     compact terminal formatting
parser.py         action block parsing and sequence validation
tool_registry.py  tool specs and schemas
tool_pipeline.py  validation, policy, retries, and execution events
file_tools.py     structured workspace file tools
memory.py         JSON and SQLite transcript/event stores
model_gateway.py  model routing, fallback, quotas, and usage ledger
mcp_tools.py      streamable HTTP MCP adapter
plugins.py        manifest loading and discovery
workflow.py       typed workflow state
subagent.py       scoped sub-agent execution

More detail:

Development

Run tests:

python -m unittest discover tests

Run type checks:

pyright

CI runs both unit tests and Pyright through GitHub Actions.

Metadata

Release files for minimal-cli-agent 0.1.0

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

Source distribution (sdist)

Source distribution for minimal-cli-agent 0.1.0
File Size Uploaded Provenance Actions
minimal_cli_agent-0.1.0.tar.gz 144.5 kB With provenance Details for minimal_cli_agent-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for minimal-cli-agent 0.1.0
File Interpreter ABI Platform Actions
minimal_cli_agent-0.1.0-py3-none-any.whl Python 3 none any Details for minimal_cli_agent-0.1.0-py3-none-any.whl

Total release size: 265.8 kB

Release files / minimal_cli_agent-0.1.0.tar.gz

Download URL minimal_cli_agent-0.1.0.tar.gz
Size 144.5 kB
Tags Source
SHA-256 checksum
How to use checksums
7adb27140fb47383f1126875677b71f2e4027b493b988abae4533e3b18400fe0
BLAKE2b-256 checksum
How to use checksums
6c26cc1fc2716f637a364a6a0abcb025ecd3e9c02b90787f3eeaffde3b91bcd5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 12, 2026.

Transparency log

Release files / minimal_cli_agent-0.1.0-py3-none-any.whl

Download URL minimal_cli_agent-0.1.0-py3-none-any.whl
Size 121.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a0e8d59b9f626d03e46cd4abff7769f5dff4c8973f03af787c5999b90475a0e7
BLAKE2b-256 checksum
How to use checksums
008951b8e2532fe6e8cc3864c5f5ab381811b1cddd62af85dc4b0979bc750406
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 12, 2026.

Transparency log

Security for minimal-cli-agent 0.1.0

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.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for minimal_cli_agent-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 12, 2026.

Transparency log

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.1.0 This release

2 release files Full 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