Agim · Universal IM-to-Agent Bridge
Agim connects IM channels to AI agents with one Node.js process. It is designed for production use: at-least-once persistent delivery, session continuity, human approval, and observable operations.
What matters
- Bridge first: WeChat / Feishu / DingTalk / Email to multiple agent backends. Telegram / Discord stay hidden unless
AGIM_ENABLE_GLOBAL_IM=1. - Agent flexibility: Claude Code, Codex, GitHub Copilot CLI, OpenCode, Cursor, Kimi Code, Qoder, PI, MiMo Code, Antigravity, and Agim Agent (in-process LLM).
- AI workflows built-in: memory, skills, Focus, Loop Engineering, Subagents (
call_agent/call_agents), heartbeat, reminders, memos, ask-user. - Reliable runtime: SQLite outbox (at-least-once delivery), restart recovery, job board, structured audit. Production requires native
better-sqlite3; without it the outbox is unavailable. - Safety by default: token auth, sensitive-path denylist. Tool auto-approve is off by default; opt in with
AGIM_AUTO_APPROVE=1(and a strict sender allowlist when IM is enabled).
Quick start
Requires Node.js ≥ 22.19. A C++ toolchain (gcc/g++, make, python3) is needed so better-sqlite3 can compile on install.
After install, run agim (or agim go). The first command starts the service and opens the browser wizard: pick a model, paste one API key, then chat.
npm install -g agim-cli
agim
First run will:
- Detect usable local agents such as Claude Code, Codex, GitHub Copilot CLI, Cursor, Kimi Code, Qoder, PI, MiMo Code, Antigravity, or Agim Agent.
- If none are ready, start Agim and open
http://localhost:3000/setupso you can pick DeepSeek / Kimi / GLM / MiMo / Ollama and paste one API key. - Print the Web console URL. On first boot a one-time token is written to
~/.agim/web-bootstrap-token(retrieve withagim token bootstrapif needed). Loopback (127.0.0.1) usually skips login.
Default Web console: http://localhost:3000 · first-run wizard: /setup
Skip writes setupSkipped and leaves /setup available. Details: docs/first-run-setup.md.
- Chat:
/ - Mobile Portal:
/m/chat(/Skills·Commands,@workspace refs, Focus / Loop docks — seedocs/portal-composer.md) - Native shells: iOS
apps/ios· macOSapps/macos(both wrap/m/chatwith host + web session cookie; seedocs/macos-shell.md) - Tasks:
/tasks(Loop audit at/tasks/loops) - Settings:
/settings
If you forget the URL or token path:
agim web
Local health check:
agim doctor
After the Web chat works, connect WeChat / Feishu / DingTalk from Settings.
agim quickstart is kept as a compatibility alias.
Common CLI entries:
| Command | When to use |
|---|---|
agim |
First run opens setup; later runs show the entry menu |
agim go |
Start the service and open the first-run wizard (or chat, if an agent is already ready) |
agim web |
Recover the console URL, service state, or token path |
agim web --open |
Open the Web console in your default browser |
agim web --start --open |
Start the background service and open Web in one step |
agim config |
Continue setup: Agent, IM, Web, admins |
agim doctor |
Explain what is not ready locally |
agim start --bg / status / restart / stop |
Service operations after setup |
Choose your AI backend
| Scenario | Recommended path |
|---|---|
| Strong coding agent loop | claude-code / codex / copilot / opencode / cursor / kimi-code / qoder / pi / mimo / antigravity |
| API-only, low-cost in-process mode | agim (alias native) + llmBackends |
Agim Agent setup details: docs/llm-backends.md (DeepSeek V4: §8.1 compat, §8.2 API protocol / beta, §8.3 RPC).
Supported agent details: docs/agents.md
Core AI workflows
| Capability | Description | Docs |
|---|---|---|
| Long-term memory | facts + persona, optional vector retrieval | docs/memory-and-vector.md |
| Skills | shared SKILL.md capability layer across agents |
docs/skills.md |
| Focus | per-thread attention anchor (/focus) |
docs/architecture/focus.md |
| Loop Engineering | align → dispatch → verify (/loop; Agim sticky parent; Portal docks) |
docs/architecture/loop-engineering.md |
| Subagent / A2A | nested call_agent / call_agents + specialty profiles |
docs/architecture/subagent.md, docs/architecture/agent-profiles.md |
| Heartbeat | periodic proactive loop (/heartbeat) |
docs/architecture/heartbeat.md |
| Ask user | structured agent→user choices | docs/ask-user.md |
| Reminders | one-shot / recurring reminders | docs/architecture/reminders.md |
| Memos | 5W1H persistent notes with optional location | docs/im-workspaces-guide.md |
Security defaults
- Web token auth enabled by default.
- Auto-approve disabled by default (
AGIM_AUTO_APPROVE=0): mutating tools go through IM/Web approval cards. SetAGIM_AUTO_APPROVE=1for single-operator convenience; with IM messengers configured, also set a strictAGIM_ALLOWED_USERS=platform:userId,...(or acknowledge open IM withAGIM_AUTO_APPROVE_OPEN_IM=1). - Sensitive files/paths are denied by policy (hard-deny, cannot be overridden).
- Self-protect prevents agents from killing/restarting agim.
- Chat
/restartis IM-admin only. Web console and Portal/m/chatrefuse it; use Settings → Service → Restart oragim restart(docs/runbook.md§4). - Telegram / Discord require
AGIM_ENABLE_GLOBAL_IM=1(domestic defaults keep them off).
Security reference: docs/security-hardening.md
Essential chat commands
| Command | Purpose |
|---|---|
/cc /oc /cx /co /cs /kimi /qd /pi /mimo /agy /na … |
Route to a target agent |
/new |
Start a new conversation session |
/focus /loop /plan |
Focus, Loop Engineering, Plan mode |
/skill /skills |
Skills |
/model /models |
Inspect/switch model (where supported) |
/abort |
Stop the running agent turn |
/btw ... |
Side question (bypass queue) |
/approval |
Session approval rules |
/heartbeat /remind /memo |
Schedulers & notes |
/job /cron /audit /stats /outbox /a2a |
Runtime / delivery / A2A visibility |
/agents /help /status |
Discovery & service status |
/restart /stop |
IM-admin service control (refused on Web//m/chat) |
Type /help in chat for the full list.
Minimal config shape
~/.agim/config.json
{
"messengers": [],
"agents": ["agim", "claude-code"],
"defaultAgent": "agim",
"llmBackends": [
{
"name": "default-agim",
"provider": "openai-compat",
"baseUrl": "https://api.openai.com/v1",
"model": "gpt-4o-mini"
}
],
"llmRoles": {
"cheap": "default-agim",
"finance": "default-agim"
}
}
IM is optional — leave messengers empty for web-console-only, then add WeChat / Feishu / DingTalk from Settings or agim config.
Secrets are stored separately from this file. Task dispatch (coding / finance / collect) can be configured via dropdowns under Settings → LLM → Task dispatch cheat sheet (see docs/llm-backends.md §6.1).
Operations
- Deployment guide:
docs/deployment.md - Runbook:
docs/runbook.md - Architecture stance:
docs/architecture-bridge-and-agim-agent.md - LLM backends & dispatch cheat sheet:
docs/llm-backends.md - Local Unix RPC (opt-in
llm_complete/ static token for same-host services): seeCHANGELOG.mdUnreleased - Full changelog:
CHANGELOG.md
Docs index
Start from: docs/README.md
Migration notes
Current public surfaces use the Agim naming consistently:
- executable:
agim - environment variables:
AGIM_* - data paths:
~/.agimand~/.agim-workspaces
/goal is retired — use Focus (/focus) and Loop (/loop) instead (docs/goals.md, docs/architecture/focus.md).
Development
git clone https://github.com/benking007/agim.git
cd agim
npm ci
npm --prefix src/web-app ci
npm run build
npm run lint
npm run typecheck
npm test
License
MIT