Skip to main content

OpenCode agent type plugin for mngr

Project description

imbue-mngr-opencode

Plugin that registers the opencode agent type for mngr.

OpenCode is an open-source terminal-based AI coding agent. This plugin runs it as a first-class mngr agent: an interactive TUI with RUNNING/WAITING lifecycle reporting, conversation resume across stop/start, mngr transcript support, and per-agent config/credential isolation.

Usage

mngr create my-agent opencode

Pass arguments straight through to the opencode command with --:

mngr create my-agent opencode -- --model anthropic/claude-sonnet-4-5

mngr stop then mngr start resumes the agent's conversation; mngr transcript <agent> prints the conversation; mngr list reports the agent as RUNNING while it works and WAITING when it is idle.

How it works

OpenCode is a client-server app (a server owns the sessions and event bus; TUI / CLI / HTTP clients talk to it) with SQLite-backed sessions and no POSIX-sh hook mechanism. mngr leans into that shape:

  • The agent runs as a server + an attached TUI. Each agent's tmux pane runs a launch script that starts a headless opencode serve plus an opencode attach TUI client. mngr connect shows the attached client; the server owns the session.
  • Messages are sent via the server's HTTP API, not by typing into the TUI: mngr message POSTs the prompt to the agent's server (prompt_async), and the attached client renders it — so the conversation is fully visible while sending stays robust (no keystroke races, no screen-scraping).
  • Isolation is via OPENCODE_CONFIG_DIR (a per-agent config dir holding opencode.json + an auto-loaded plugin) and XDG_DATA_HOME (a per-agent data dir holding the session db, auth.json, storage, and logs), injected only on the OpenCode processes. No $HOME relocation.
  • Lifecycle (RUNNING/WAITING) is maintained by a small in-process TypeScript plugin that watches the server's event bus and touches/removes the mngr active marker (it runs only in the server process). It is subagent-aware: the marker clears only when the root session goes idle, so spawning task-tool subagents keeps the agent RUNNING until the whole turn finishes.
  • Transcripts: the same plugin writes the raw transcript and, on session idle, rebuilds the common-format transcript mngr transcript reads — both in-process, no background converter or supervisor.
  • Auth: the per-agent auth.json symlinks to the user's shared ~/.local/share/opencode/auth.json, so one opencode auth login (in any agent) authenticates them all.

Configuration

Define a custom variant in your mngr config (mngr config edit):

[agent_types.my_opencode]
parent_type = "opencode"
auto_allow_permissions = true

[agent_types.my_opencode.config_overrides]
model = "anthropic/claude-sonnet-4-5"

Then create agents with your custom type:

mngr create my-agent my_opencode

Options

Option Default Meaning
cli_args () Extra arguments forwarded to the opencode attach (TUI) client.
config_overrides {} Key/value blob merged last into the per-agent opencode.json (e.g. model, the permission policy block).
sync_global_config true Base the per-agent opencode.json on a copy of the user's ~/.config/opencode/opencode.json.
symlink_auth true Symlink the per-agent auth.json to the shared one (one login authenticates all agents). Set false for full isolation.
auto_allow_permissions false Inject a wildcard allow into the per-agent permission policy (auto-approve everything not explicitly denied).
emit_common_transcript true Emit the common transcript that mngr transcript reads.

Choosing the model

The model is read by the agent's OpenCode server from its per-agent opencode.json, so it is set through config (format: provider/model; list options with opencode models). Three ways, highest precedence first:

  1. Per agent-type -- config_overrides.model on an opencode variant (the TOML example above). Applies to every agent of that type.

  2. On the mngr create command line -- mngr's generic per-invocation override reaches right into config_overrides:

    mngr create my-agent opencode -S agent_types.opencode.config_overrides.model=anthropic/claude-sonnet-4-5
    
  3. Globally -- the "model" in your ~/.config/opencode/opencode.json, inherited when sync_global_config is true (the default).

Notes:

  • If the model's provider isn't authenticated, OpenCode silently falls back to a free model -- so if you set, say, anthropic/claude-sonnet-4-5 but the agent shows a free "OpenCode Zen" model, run opencode auth login and create/restart the agent. (The free OpenCode-Zen models need no auth.)
  • Passing the model after -- (mngr create ... opencode -- --model X) does not work: -- args go to the opencode attach client, which has no --model flag; the model is used by the serve process, from opencode.json.

Not yet implemented

Carried gaps (shared with mngr_antigravity): session preservation on destroy, scheduled-deploy contributions, the waiting_reason listing field, the live streaming snapshot, and clone carrying the source conversation forward.

See the mngr agent types documentation for more details.

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

imbue_mngr_opencode-0.2.13.tar.gz (37.0 kB view details)

Uploaded Source

Built Distribution

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

imbue_mngr_opencode-0.2.13-py3-none-any.whl (23.5 kB view details)

Uploaded Python 3

File details

Details for the file imbue_mngr_opencode-0.2.13.tar.gz.

File metadata

  • Download URL: imbue_mngr_opencode-0.2.13.tar.gz
  • Upload date:
  • Size: 37.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for imbue_mngr_opencode-0.2.13.tar.gz
Algorithm Hash digest
SHA256 012f38ed63d89c5a27eee825f0c90eb7bc0a6b89312fe623f105453b61cbfad5
MD5 d79db4cb2fea2e71e182a3725dda55d9
BLAKE2b-256 69df4d57de6593313c7701311e4bb118481dd14c537e76a255ef533e3b9d038e

See more details on using hashes here.

Provenance

The following attestation bundles were made for imbue_mngr_opencode-0.2.13.tar.gz:

Publisher: publish.yml on imbue-ai/mngr

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file imbue_mngr_opencode-0.2.13-py3-none-any.whl.

File metadata

File hashes

Hashes for imbue_mngr_opencode-0.2.13-py3-none-any.whl
Algorithm Hash digest
SHA256 f50daf2710f30440581114a7a3578ad38d5ecfd37d1e1ea46ffb4fb88ffc2a1d
MD5 1721a168d80e2f1774cdb9ce73f48db1
BLAKE2b-256 d27cb90a1c866b6903d94325de83257af9f1faae13411b22583175755cb3b526

See more details on using hashes here.

Provenance

The following attestation bundles were made for imbue_mngr_opencode-0.2.13-py3-none-any.whl:

Publisher: publish.yml on imbue-ai/mngr

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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