Skip to main content

Lovelaice

A sovereign, local-first coding agent for the terminal. A native tool-calling ReAct loop (read/bash/write/edit/glob/list_dir), yolo by default. Three ways to run it:

  • One-shot — streams to stdout and exits: lovelaice "<prompt>" (piped stdin works too).
  • ACP server — lovelaice-acp speaks the official Agent Client Protocol v1 over stdio, so any ACP client (e.g. aegis, Zed) can drive lovelaice as a native, harness-free agent — local or direct-API models, no external CLI. Supports streaming, per-session MCP tools, token usage, and load_session resume. See know-how/acp-v1-server.md.
  • Library — lovelaice.agent.Agent / lovelaice.coding.create_coding_agent embed the engine directly.

Install

pipx install lovelaice

Configure

lovelaice --init writes a .lovelaice.py in the current directory. This file grounds the workspace: when you run lovelaice from any subdirectory, it walks up to the nearest .lovelaice.py and chdirs to its directory before running. Exactly one config grounds the workspace — there is no stacking.

Set OPENROUTER_API_KEY in your environment before running.

export OPENROUTER_API_KEY=sk-or-...
lovelaice

Commands and tools

The .lovelaice.py registers tools and commands as decorators on a Config object. Built-in tools: bash, read, write, edit, list, glob, grep, fetch. Add your own with @config.tool. See know-how/writing-a-tool.md and know-how/writing-a-command.md.

Thinking mode

Add thinking="high" (or "low"/"medium", or an integer token budget) on a model entry to enable OpenRouter's reasoning passthrough. Reasoning chunks render in a separate dim-italic panel above the agent's reply. Non-OpenRouter base URLs silently ignore the knob — v1 does not translate reasoning protocols across providers.

MCP

Pass mcp=[...] to Config(...) to spawn stdio MCP servers and register their tools. Tool names are prefixed mcp:<server>:<tool>.

config = Config(
    models=MODELS,
    prompt=PROMPT,
    mcp=[
        {"name": "filesystem", "command": "npx",
         "args": ["@modelcontextprotocol/server-filesystem", "."]},
    ],
)

Context compaction for embedding hosts

Set AgentConfig.context_window for proactive compaction. A lovelaice.agent.CompactionPolicy supplied as AgentConfig.compaction_policy sets thresholds and the ordered operations:

from lovelaice.agent import AgentConfig, CompactionPolicy

config = AgentConfig(
    model="my-model",
    context_window=8192,
    compaction_policy=CompactionPolicy.model_validate({
        "trigger_percent": 75,
        "target_percent": 50,
        "protected_turns": 2,
        "steps": ["finished_results", "summarize_old_turns", "read_results"],
    }),
)

These defaults measure the space left for conversation after reserving room for the output, system instructions, and tool schemas. Add finished_tool_batches to replace complete closed-turn tool exchanges or truncate_old_text to clip old dialogue when there is still an overflow. Only listed operations run, in their listed order. The current user message and the unread tool batch are protected. Conversation storage retains the original messages. Reopening under a different policy rebuilds their projection. Existing fractional AgentConfig.compaction_trigger and compaction_target still apply when no explicit policy is supplied.

On the legacy ACP session stream, context adds a compaction_detail event with an ordered list of operations (each has step and count), estimated before_tokens and after_tokens, estimated, window, usable, and fixed_tokens. Counts refer to results, turns, batches, or messages as appropriate to the step. The additive overflow_detail event reports the limit and size when available, estimated, and the ordered attempted step names. Keep reading measured for the provider-reported prompt count.

License

MIT.

Metadata

Release files for lovelaice 2.17.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 lovelaice 2.17.0
File Size Uploaded Provenance Actions
lovelaice-2.17.0.tar.gz 252.3 kB Without provenance Details for lovelaice-2.17.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for lovelaice 2.17.0
File Interpreter ABI Platform Actions
lovelaice-2.17.0-py3-none-any.whl Python 3 none any Details for lovelaice-2.17.0-py3-none-any.whl

Total release size: 332.7 kB

Release files / lovelaice-2.17.0.tar.gz

Download URL lovelaice-2.17.0.tar.gz
Size 252.3 kB
Tags Source
SHA-256 checksum
How to use checksums
3ebaec1002deafd2de547b3f6bd9ccc223274021643f1bb80c7e4f6d6ba9417a
BLAKE2b-256 checksum
How to use checksums
f5b083148acaeea9a2f7ffeffdbae2f2e4f6fbca79f1b94cdcaa787adadf14be
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.10 {"installer":{"name":"uv","version":"0.13.10","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 / lovelaice-2.17.0-py3-none-any.whl

Download URL lovelaice-2.17.0-py3-none-any.whl
Size 80.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b99297d55b583b4390d85e8324c57a5b431e08ab972a09a2d7020c0dee74dbc0
BLAKE2b-256 checksum
How to use checksums
cf3dbdf7e1c62bcbc74f2ee89116e157cbf117a0c06f5610d70a8bfacdfb236f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.10 {"installer":{"name":"uv","version":"0.13.10","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 lovelaice 2.17.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.

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

2.17.0 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