Skip to content
← Back to projects

Polymorphic

An agent harness whose behavior learns over time and rewrites it's own behavior

#polymorphic

A polymorphic agent harness. Behavior is code. Memory is code. The next run is shaped by what previous runs wrote down.

#What this is

Most agent harnesses wrap a model around CLI tools: shell, files, grep, browsers, subprocesses. That works, but it couples the agent to a host machine and a pile of system dependencies.

polymorphic does not do that.

The agent lives in a virtualized execution layer. It writes Python. That Python is the workflow, the memory, and the behavior. Monty runs it in a sandboxed interpreter — no host filesystem, no env, no network unless we explicitly grant a host function.

The loop:

  1. The agent writes code that does the work.
  2. Useful workflows, habits, and facts are kept as code.
  3. That code is fed back into later runs, so the agent changes shape over time.

Not a transcript of what happened. Executable memory.

#Layout

  • crates/db — SQLite for settings and providers
  • crates/llm — OpenAI-compatible client and /v1/models
  • crates/polymorphic — Monty harness (needs rustc 1.95)
  • src-tauri — desktop shell
  • frontend — Vite / React / MUI / Tailwind UI (same stack as acuitysync)
  • crates/tui — terminal interface; profiles, settings, providers, and conversations are slash commands (/help)

Settings live in polymorphic.db under the app data dir. Change them in the Settings and Providers screens — no file editing.

#LLM providers

Two provider kinds:

  • OpenCode — used automatically when opencode is on PATH. Isolated passthrough agent, no tools. Completions go through opencode serve.
  • OpenAI-compatible — API key + base URL, GET /v1/models, POST /v1/chat/completions.

Presets:

Kind Base URL Key
OpenAI https://api.openai.com/v1 platform.openai.com
OpenRouter https://openrouter.ai/api/v1 openrouter.ai
xAI https://api.x.ai/v1 console.x.ai
Custom whatever you type whatever that host uses
OpenCode local CLI opencode auth / /connect

#SuperGrok

A SuperGrok subscription on grok.com is not an API credential. xAI bills API usage separately at console.x.ai. Create a key there and add an xAI provider. Same models, different product.

#Run

Frontend registry is the Harness mirror (see frontend/.npmrc).

make install
make dev
make dev-tui
make test
make lint

make dev-tui opens the same SQLite store as the desktop app. Manage profiles, settings, providers, and conversations with slash commands (/profiles, /settings, /providers, /conversations).

Monty is excluded from default workspace members until rustc 1.95 is available.

#Why Monty

Monty is a minimal, secure Python interpreter written in Rust, built to run code written by agents.

  • Startup in microseconds, not container cold-starts
  • Host access only through functions we expose
  • Sessions can be snapshotted and resumed
  • Enough Python for an agent to express itself (json, re, datetime, asyncio, …)
  • No CPython, no Docker, no third-party Python packages

CLI tools become unnecessary when the same work can be expressed as code calling granted host functions.

#What it is not

  • Not a CLI-tool agent (no bash, no local grep, no "just run this on the box")
  • Not a general Python runtime (no CPython stdlib, no PyPI)
  • Not a prompt-only memory store (memories that cannot run are not memories here)
  • Not SuperGrok-session reuse (use an xAI API key)

New version available.