Skip to content

Repository files navigation

ABMI Bridge for OpenCode — 仿生心智内核桥接器

The soul is computed, not prompted. · 灵魂是算出来的,不是提示出来的。

This plugin lets OpenCode call the ABMI kernel for role-play. OpenCode is the mouth; ABMI is the brain. ABMI computes state (emotion, intoxication, trauma, affinity, cognition…) and constrains the LLM to speak within those states.

  • 中文 · Chinese
  • English · 英文

About / 这是什么

What is this plugin? · 用一句话理解:

OpenCode 是大脑的嘴,ABMI 是大脑的核。 ABMI 算好角色的情绪 / 醉酒 / 创伤 / 好感度等状态,约束 LLM 在这些状态内说话。

  • A deterministic, modular digital-mind engine (see the core repo).
  • Ships as an OpenCode plugin: TypeScript reads, Python runs.
  • Role-play voice is generated by an external LLM under ABMI's computed constraints (forced API mode).

Prerequisites / 使用前提

  • Node.js 18+ is required. This installer no longer bundles a single-file .exe.
  • Python 3: not required — the installer auto-detects your Python; if none is present it unpacks the bundled runtime automatically.
  • No network and no npm needed during install (precompiled dist is bundled).

Install / 怎么装

  1. Install Node.js 18+ (if not already installed). · 若未安装,先装 Node 18+(推荐 Node 24 LTS)。
  2. Double-click abmi-installer.bat, or run node abmi-installer.js. · 双击 abmi-installer.bat,或运行 node abmi-installer.js
  3. Wait for the automated install (no network, no npm, no manual Python). · 等待自动安装完成(无需联网 / npm / 手动装 Python)。
  4. Restart OpenCode — the ABMI tools become available automatically. · 重启 OpenCode,ABMI 工具自动可用。

What the installer does · 安装器做了什么

  • Detects the environment (uses your Python, or the bundled one). · 检测环境(有则用,无则用内置 Python)。
  • Deploys the abmi package to ~/.config/opencode/plugins/abmi/.
  • Deploys the bridge (Python + TypeScript) with precompiled dist (no npm). · 部署 bridge + 预编译 dist。
  • Runs a Python-kernel smoke test. · Python 内核冒烟测试。
  • Registers the OpenCode plugin entry. · 注册 OpenCode 插件入口。

Available Tools / 可用工具

Tool 工具 What it does 作用
abmi_initialize Start the kernel. Pass a persona to begin role-play; omit it for a blank start. Role-play requires an API key. · 启动内核。传 persona 启动角色扮演;不传 = 空白开局。角色扮演需 API Key。
abmi_dashboard Open the real-time dashboard. · 打开实时仪表盘。
abmi_status Query runtime status. · 查询运行状态。
abmi_shutdown Close the kernel. · 关闭内核。

Note: the manual step tools (abmi_tick, abmi_chat, abmi_snapshot, abmi_query) have been removed. The kernel now uses forced API mode: abmi_initialize orchestrates the state computation and line generation in one go, so there is no manual ticking. · 手动推进工具(abmi_tick / abmi_chat 等)已移除,内核强制 API 模式,abmi_initialize 一次性完成状态演算与台词生成,无需手动推进。

abmi_initialize usage · 用法

abmi_initialize({
  persona: {...},          // optional: start role-play with a persona / 传角色卡启动角色扮演
  mode: 'dialogue'|'server', // optional / 可选
  apiKey, baseURL, model   // required for role-play / 角色扮演必需
})
  • With persona → role-play. · 传卡 = 角色扮演。
  • Without persona → blank start / dialogue progression. · 不传卡 = 空白开局 / 对话推进。

LLM Configuration / LLM 配置(必需)

The installer no longer bundles an API key. Role-play requires the key. · 安装器不再内置 API Key,角色扮演必须有它。

Env var 环境变量 Default 默认 Meaning 含义
ABMI_LLM_API_KEY Your API key (also accepted via apiKey in abmi_initialize). · API Key
ABMI_LLM_MODEL deepseek-v4-flash Model name. · 模型名
ABMI_LLM_BASE_URL https://api.deepseek.com/v1 API base URL. · 接口地址
set ABMI_LLM_API_KEY=your-key-here
set ABMI_LLM_MODEL=deepseek-v4-flash
set ABMI_LLM_BASE_URL=https://api.deepseek.com/v1

Without a key you can still run abmi_initialize / abmi_status pure kernel computation, just no LLM-generated voice. · 不设 Key 也能用纯内核演算,只是没有 LLM 台词。


Modules / 模块

The plugin ships the M1–M15 base layer (14 modules) of ABMI — physiology, cognition, trauma, morality, and more. · 本插件包含 ABMI 的 M1–M15 基础层(14 个模块):生理、认知、创伤、道德等。

See the core repo for the full module breakdown and the Bastille demo. · 完整模块说明与设防巴士底狱 demo 见主仓库。


Uninstall / 卸载

Recommended / 推荐 — one-click: double-click abmi-uninstall.bat and confirm, or runabmi-uninstall.bat -y for silent removal. · 双击 abmi-uninstall.bat,按提示确认;或静默运行 abmi-uninstall.bat -y

It removes:

  • ~/.config/opencode/plugins/abmi/ (plugin directory · 插件目录)
  • ~/.config/opencode/plugins/abmi.ts (plugin entry · 插件入口)
  • ~/.abmi/python-3.14/ (bundled Python runtime · 内置 Python,若无则跳过)

Manual / 手动 — just delete ~/.config/opencode/plugins/abmi/ and ~/.config/opencode/plugins/abmi.ts.


License / 许可

Business Source License 1.1 (BSL-1.1). Changes to Apache License 2.0 on 2029-08-05.

  • Free for personal, educational, research, and testing use, and for non-commercial development.
  • Commercial / production use by any enterprise or institution with annual revenue > USD 100,000 or a team of more than 10 people requires a commercial license — contact palette1919@qq.com.

See LICENSE.md for the full text. · 完整条款见 LICENSE.md


Links / 相关链接

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages