ide-im
Ide-IM-Skill
You are managing the Ide-IM-Skill bridge (IM → AI 桥接,可在 Cursor 内启动与管理).
User data path is controlled by CTI_HOME (default ~/.ide-im/). 配哪个就用哪个路径。
The skill directory (SKILL_DIR) is the directory containing this SKILL.md.
Resolve it by: Glob for **/Ide-IM-Skill/SKILL.md or **/ide-im-skill/SKILL.md and use the parent of the file's directory.
Command parsing
Parse the user's intent into one of these subcommands:
| User says (examples) | Subcommand |
|---|---|
setup, configure, 配置, 我想在飞书上用 Cursor, 帮我连接 Telegram |
setup |
start, start bridge, 启动, 启动桥接 |
start |
stop, stop bridge, 停止, 停止桥接 |
stop |
status, bridge status, 状态, 运行状态 |
status |
logs, logs 200, 查看日志 |
logs |
reconfigure, 修改配置, 帮我改一下 token |
reconfigure |
doctor, diagnose, 诊断, 挂了, 没反应了, 出问题了 |
doctor |
Disambiguation: status vs doctor — Use status for "is it running?". Use doctor when the user reports a problem.
Extract optional numeric argument for logs (default 50).
Before asking for platform credentials, read SKILL_DIR/references/setup-guides.md and present the relevant guide to the user.
Installation
Install via skills.sh (no git clone needed):
npx skills add chovizzz/Ide-IM-Skill
Dependencies are auto-installed on first start — no manual npm install required.
Runtime detection (Cursor vs others)
- Cursor — You are in Cursor.
AskUserQuestionmay be available for interactive setup. SKILL_DIR is the folder containing this SKILL.md (e.g. Ide-IM-Skill or ide-im-skill). - No AskUserQuestion — Show
SKILL_DIR/config.env.exampleand instruct the user to create$CTI_HOME/config.env(default~/.ide-im/config.env) manually.
Config check (for start, stop, status, logs, reconfigure, doctor)
If config.env does NOT exist (under CTI_HOME, default ~/.ide-im):
- With AskUserQuestion: start the
setupwizard. - Without: show
SKILL_DIR/config.env.exampleand ask the user to create the file; do not start the daemon.
If it exists, proceed with the requested subcommand.
Subcommands
setup
Run an interactive setup wizard when AskUserQuestion is available. Otherwise show SKILL_DIR/config.env.example with field-by-field explanations.
When interactive, collect one field at a time, confirm each value (mask secrets to last 4 chars).
Step 1 — Choose channels
Ask which channels to enable: telegram, discord, feishu, qq (comma-separated). Briefly:
- telegram — Personal use, streaming, inline permission buttons.
- discord — Team use, server/channel access control.
- feishu (Lark) — Feishu/Lark teams, event-based.
- qq — QQ C2C only, text
/permfor permissions.
Step 2 — Collect tokens per channel
For each enabled channel, use SKILL_DIR/references/setup-guides.md. Collect:
- Telegram: Bot Token → Chat ID → Allowed User IDs (optional). At least Chat ID or Allowed Users required.
- Discord: Bot Token → Allowed User IDs → Allowed Channel IDs / Guild IDs (optional). At least one of Allowed Users or Allowed Channels required.
- Important: In the Discord Developer Portal → Bot → Privileged Gateway Intents, enable MESSAGE CONTENT INTENT. Without it, guild messages have empty content and will be silently dropped.
- Require Mention (
CTI_DISCORD_REQUIRE_MENTION): settrueto only respond when the bot is @mentioned in guild channels (defaultfalse). - Group Policy (
CTI_DISCORD_GROUP_POLICY):open(default, respond to guild messages) ordisabled(completely ignore guild messages).
- Feishu: App ID → App Secret → Domain (optional) → Allowed User IDs (optional). Guide through permissions, bot, events (long connection), publish.
- Require Mention (
CTI_FEISHU_REQUIRE_MENTION): defaulttruefor Feishu — group messages need @mention; setfalseto respond to all messages. - Group Policy (
CTI_FEISHU_GROUP_POLICY):open(default) ordisabled(ignore all group messages).
- Require Mention (
- QQ: App ID → App Secret → Allowed User OpenIDs (optional) → Image Enabled / Max Image Size (optional). Remind: C2C only, no inline buttons.
Step 3 — General settings
- Runtime:
claude,codex,auto, orcursorclaude— Claude Code CLI + Claude Agent SDKcodex— OpenAI Codex SDKauto— Try Claude first, fall back to Codexcursor— Use Cursor CLI (agent); install: curl https://cursor.com/install -fsS | bash
Step 3a — CLI check & auto-install (immediately after runtime selection)
After the user picks a runtime, check whether the required CLI exists and auto-install if missing.
| Runtime | CLI to check | Detection | Install command |
|---|---|---|---|
claude |
claude |
which claude (macOS/Linux) / where claude (Windows). Prefer native 2.x (run claude --version; if < 2 or npm-based, warn). |
curl -fsSL https://claude.ai/install.sh | sh (macOS/Linux) or irm https://claude.ai/install.ps1 | iex (Windows) |
codex |
codex |
which codex / where codex |
npm install -g @openai/codex |
cursor |
agent or cursor |
which agent / which cursor / check ~/.cursor/bin/agent, ~/.local/bin/agent |
curl -fsSL https://cursor.com/install | sh (macOS/Linux) or irm https://cursor.com/install.ps1 | iex (Windows) |
auto |
check both claude and codex |
see above | install whichever is missing |
Flow (use SKILL_DIR/scripts/check-cli.sh):
- Run:
bash "SKILL_DIR/scripts/check-cli.sh" <runtime>— outputsfound: /path (version: x)ornot_found. - If found → show path and version, proceed.
- If NOT found → tell the user the CLI is missing and ask "是否自动安装?(Y/n)".
- If yes → run:
bash "SKILL_DIR/scripts/check-cli.sh" <runtime> --install— attempts install then re-checks. - If no → show manual install instructions and continue (the daemon will fail at start if CLI is still missing).
- If yes → run:
- For
auto: the script checks both claude and codex; at least one must succeed.
- Working Directory:
- If
CTI_DEFAULT_WORKDIRis set inconfig.env,始终优先使用它。 - 如果未设置:
- Runtime =
cursor时,默认~/.workspace(每个 Cursor 工程共享的全局工作区目录)。 - 其它 runtime(
claude/codex/auto)保持上游行为:使用当前进程的工作目录$CWD。
- Runtime =
- If
- Identity/Memory 目录(SOUL.md、AGENTS.md、MEMORY.md 等):
- 若设置
CTI_IDENTITY_DIR则使用该路径。 - Runtime =
cursor且未设置时,默认使用~/.workspace;首次启动会从templates/identity-default/自动填充。会话出生时会在 system prompt 里写明「Workspace (identity root): <路径>」,和 OpenClaw 一样让 agent 知道工作区在哪。 - 其它 runtime 未设置时,使用各会话的 working directory 作为 identity root。
- 若设置
- Model (optional): leave blank to use runtime default
- Mode:
code,plan,ask
Step 3b — Workspace & identity initialisation (auto, immediately after CLI check)
After CLI is verified, automatically create workspace directories and seed identity templates.
Run: bash "SKILL_DIR/scripts/init-workspace.sh" <runtime>
This creates:
- CTI_HOME dirs (
~/.ide-im/{data,logs,runtime,data/messages}) - Working directory (
~/.workspacefor cursor,$CWDfor others) - Identity directory (cursor only:
~/.workspace/+memory/) — seeds OpenClaw templates (AGENTS.md,SOUL.md,IDENTITY.md,USER.md,TOOLS.md,MEMORY.md) fromtemplates/identity-default/if not already present
If the user set custom CTI_DEFAULT_WORKDIR or CTI_IDENTITY_DIR, pass them:
bash "SKILL_DIR/scripts/init-workspace.sh" <runtime> --work-dir <path> --identity-dir <path>
After init, remind the user they can personalise USER.md and MEMORY.md in the identity directory.
Long session memory + Discord streaming (optional)
CTI_MEMORY_COMPRESS_AFTER_MESSAGES(default24): when the bridge has stored this many messages for a channel session, it runs a background summarization intoMEMORY.mdunder the identity dir, then truncates stored messages toCTI_MEMORY_KEEP_AFTER_COMPRESS(default4). The next user turn still sees long-term facts via the normal MEMORY.md injection in system prompt. Set to0to disable.CTI_DISCORD_STREAM_ENABLED(defaulttrue): Discord streams partial replies while the model runs. Setfalseif you ever see duplicate final messages.
Step 4 — Write config and validate
- Summary table (secrets masked).
- Confirm, then:
mkdir -p "$CTI_HOME"/{data,logs,runtime,data/messages}(CTI_HOME 未设时用 ~/.ide-im) - Write
$CTI_HOME/config.env(KEY=VALUE). chmod 600 $CTI_HOME/config.env- Validate tokens per
SKILL_DIR/references/token-validation.md - On success: "Setup complete! Run ide-im start (or say «启动桥接») to start the bridge."
start
Ensure config.env exists under CTI_HOME. Then:
bash "SKILL_DIR/scripts/daemon.sh" start
On failure, suggest ide-im doctor and ide-im logs.
stop
bash "SKILL_DIR/scripts/daemon.sh" stop
status
bash "SKILL_DIR/scripts/daemon.sh" status
logs
Optional line count N (default 50): bash "SKILL_DIR/scripts/daemon.sh" logs N
reconfigure
- Read config from CTI_HOME/config.env, show table (secrets masked).
- Ask what to change, update config atomically (tmp + rename).
- Re-validate changed tokens.
- Remind: "Run ide-im stop then ide-im start to apply."
doctor
bash "SKILL_DIR/scripts/doctor.sh"
Suggest fixes; for details see SKILL_DIR/references/troubleshooting.md.
Notes
- Mask secrets (last 4 chars only) in all output.
- Always check config.env exists before starting the daemon.
- Config path: CTI_HOME/config.env(未设 CTI_HOME 时为 ~/.ide-im/config.env)。配哪个就用哪个。