Give OpenCode a soul — personality injection and long-term memory for your AI agent.
npm install -g @neomei/agentsoul如果安装后提示 command not found: agentsoul,说明 npm 全局 bin 目录不在 PATH 中。请配置 npm 全局路径:
mkdir -p ~/.npm-global
npm config set prefix '~/.npm-global'
echo 'export PATH=~/.npm-global/bin:$PATH' >> ~/.bashrc
source ~/.bashrc或使用 npx 直接运行(无需全局安装):
npx @neomei/agentsoul setup
npx @neomei/agentsoul chat# 1. Configure your agent's personality (auto-registers plugin)
agentsoul setup
# 2. Launch OpenCode with soul injection
agentsoul chat| Command | Description |
|---|---|
agentsoul setup |
Interactive configuration wizard (auto-registers plugin) |
agentsoul uninstall |
Remove plugin from opencode config |
agentsoul chat |
Launch OpenCode TUI with soul injection |
agentsoul run <message> |
Single-shot with soul injection |
agentsoul serve [port] |
Headless server with soul injection |
agentsoul memory list |
Show recent conversations |
agentsoul memory search <query> |
Search conversation history |
agentsoul memory clear |
Clear all memories |
AgentSoul injects personality files into every OpenCode session:
-
Soul Files (
~/.agentsoul/soul/)IDENTITY.md— Who your agent isSOUL.md— Core principles and speaking styleUSER.md— Who you are and your relationship
-
Memory (
~/.agentsoul/memory.db)- SQLite storage for conversation history
- Recent memories are automatically injected into new sessions
-
OpenCode Plugin — Registered in
~/.config/opencode/opencode.json- Hooks into
experimental.chat.system.transformto inject soul before every LLM call - Hooks into
chat.messageto persist user messages - Survives context compaction automatically
- Hooks into
After agentsoul setup, edit the files directly:
~/.agentsoul/soul/IDENTITY.md # Name, age, personality
~/.agentsoul/soul/SOUL.md # Core principles, speaking style
~/.agentsoul/soul/USER.md # User relationshipAgentSoul works with @neomei/opencode-feishu to give your Feishu bot a soul.
Prerequisite: Both plugins must be registered in ~/.config/opencode/opencode.json:
{
"plugin": [
"@neomei/agentsoul",
"@neomei/opencode-feishu"
]
}Setup:
# 1. Configure AgentSoul personality
agentsoul setup
# 2. Configure Feishu connection
npx @neomei/opencode-feishu setup
# 3. Start OpenCode serve with both plugins loaded
opencode serve --port 19876When a Feishu user sends a message, OpenCode processes it through both plugins:
- AgentSoul injects personality into the system prompt
- opencode-feishu handles the Feishu WebSocket and message formatting
Memory (conversation history) is persisted automatically.
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ agentsoul │────▶│ soul/*.md │────▶│ stdin inject │
│ CLI / Plugin │ │ (personality) │ │ (opencode run) │
└─────────────────┘ └─────────────────┘ └─────────────────┘
│ │
▼ ▼
┌─────────────────┐ ┌─────────────────┐
│ memory.db │◀───────────────────────────│ opencode TUI │
│ (SQLite) │ save conversations │ / serve │
└─────────────────┘ └─────────────────┘
MIT