# coderover

A lightweight bot that bridges Feishu / Lark messenger with your local Claude Code, Codex CLI, or Feishu CodeM. Run one command, scan a QR code to bind a PersonalAgent app, and talk to your local coding agent from chat.

[中文 README](./README.md)

For a product walkthrough, see the [Feishu document](https://navinfo.feishu.cn/wiki/T9xawWviHilfqlkZ2RucMJ5Bnwf).

## What it does

- Forwards Feishu / Lark messages to local Claude Code, Codex CLI, or CodeM. Send a DM directly, or `@bot` in a group.
- **Streaming card**: text replies and tool calls update on one Lark card in real time.
- **COT process messages**: optionally send a process message with agent progress text and tool calls, then send the final answer separately.
- **Session continuity**: each chat, topic, or document comment thread keeps its own session.
- **Queueing and batching**: messages sent in quick succession are handled together; messages sent during a run are queued for the next turn, while commands like `/new`, `/cd`, `/ws use`, and `/stop` can interrupt the current task.
- **Multiple workspaces**: use `/cd` to switch the current project, and `/ws` to save and reuse common project directories.
- **Images and files**: send them to the bot directly, and the bridge downloads them locally for the agent.
- **Interactive cards**: `/help`, `/ws list`, and `/status` return cards with clickable buttons.

## Prerequisites

- Node.js **>= 20.12.0**
- At least one local agent installed and logged in:
  - Claude Code: `claude`, see https://docs.anthropic.com/en/docs/claude-code/quickstart
  - Codex CLI: `codex`, see https://developers.openai.com/codex/cli
  - CodeM: `codem`, see [Using CodeM as the backend](#using-codem-as-the-backend)
- A Feishu / Lark **PersonalAgent** app. The first-run QR wizard can create and bind one for you.

## Install

Install globally from npm (recommended, one command):

```bash
npm install -g coderover
```

You can then run `coderover` from anywhere. npm generates the correct launcher for each platform automatically (`.cmd` / `.ps1` shim on Windows, symlink on macOS / Linux), with no extra setup.

> If you get `command not found`: the npm global bin directory (`$(npm prefix -g)/bin`) is not on `PATH` — common with nvm, a self-compiled Node, or restricted-permission environments. Add it to your shell config:
>
> ```bash
> export PATH="$(npm prefix -g)/bin:$PATH"
> ```

Install from source (for development / contributing):

```bash
git clone git@codehub.devcloud.cn-north-4.huaweicloud.com:c3e1c6c19e4349979932380a4f652636/cv_develop/coderover.git
cd coderover
pnpm install
pnpm link --global
```

## First run

```bash
coderover run
```

The first run opens a QR-code wizard:

1. A QR code renders in your terminal.
2. Scan it with the Feishu / Lark app.
3. Pick or create a PersonalAgent app.
4. If prompted, choose which agent to initialize.
5. Config is written to `~/.lark-channel/config.json`.

You do not need to choose a project directory up front. The bridge creates a profile-managed default working directory; after startup, send `/cd <path>` in Feishu / Lark to switch to a real project.

If you already have a PersonalAgent app, pass `--app-id` during initialization to skip app creation. The command prompts for the App Secret.

```bash
coderover run --app-id cli_xxx
# or initialize and start the background service directly
coderover start --app-id cli_xxx
```

For Lark global apps, add `--tenant lark`.

## Background service

Use `run` for first-run setup and foreground debugging. After the bot can send and receive messages, stop the foreground process with `Ctrl-C`, then use an OS-managed service for background operation:

```bash
coderover start
coderover status
coderover stop
```

Install globally before using service commands. The daemon's launchd plist / systemd unit / Windows task records the bridge CLI path; if that path comes from an npm temp cache through `npx`, the daemon can break when the cache is cleaned. `run` is fine through `npx` as a one-shot foreground process.

Service commands install a per-profile service:

```bash
coderover start [--profile <name>]
coderover stop [--profile <name>]
coderover restart [--profile <name>]
coderover status [--profile <name>]
coderover unregister [--profile <name>]
```

Platform mapping:
- **macOS**: launchd user agent `ai.coderover.bot.<profile>`
- **Linux**: systemd user unit `coderover.bot.<profile>.service`
- **Windows**: Task Scheduler task `Coderover.Bot.<profile>`, launched through a `.cmd` wrapper

Daemon logs are under `~/.lark-channel/profiles/<profile>/logs/daemon/`.

### Multiple profiles: Claude, Codex, and CodeM

By default, the bridge starts with the currently selected profile. Use `profile use <name>` to change it. Each profile keeps its own app credentials, sessions, working directories, and logs. Create multiple profiles only when you need to connect multiple PersonalAgent apps, or run Claude, Codex, and CodeM as separate bots:

```bash
coderover start --profile claude --agent claude
coderover start --profile codex --agent codex
coderover start --profile codem --agent codem
```

For example, to restart only the Codex bot:

```bash
coderover restart --profile codex
coderover status --profile codex
```

## Using CodeM as the backend

CodeM is Feishu's native AI development agent. The bridge treats it as a third agent backend, and once wired up it behaves **exactly** like the other two: DMs, `/cd`, `/resume`, `/stop`, permission tiers, and interactive cards all work the same way.

### Install and log in

```bash
curl -fsSL https://codem-public.tos-cn-beijing.volces.com/codem/install.sh | bash
export PATH="$HOME/.codem/bin:$PATH"   # put this in ~/.bashrc or ~/.zshrc
codem login                            # once; binds the machine
```

The installer **refuses to run as root** by default. If you really need that, opt in explicitly with `CODEM_ALLOW_ROOT=1`.

Then create a profile and start it:

```bash
coderover profile create codem --agent codem
coderover start --profile codem
```

You can also pick CodeM directly in the first-run QR wizard.

### The daemon is not a prerequisite

The bridge spawns CodeM's launcher on every run, so `codem daemon` does **not** need to be running. If you separately want CodeM's own Feishu entry point or auto-update, run `nohup codem daemon &` yourself — the two don't interfere.

### Permission tiers

| Bridge access | Passed to CodeM | Behaviour |
|---|---|---|
| `full` | `--yolo` | Everything allowed, including writes outside the workspace |
| `workspace` | nothing | Default tier: file writes and bash inside the workspace are auto-approved |
| `read-only` | `--approval-policy ask` | CodeM asks for every write / execute tool call; the bridge always answers `deny` |

Under `read-only` the agent cannot touch your files, but **every step costs an extra round trip** (CodeM's permission requests have no timeout, so the bridge must answer each one).

### State directory and identity

CodeM keeps its own state under `$CODEM_HOME` (default `~/.codem`), **not** under `~/.lark-channel`. Once it has been logged in:

- **Run the bot as the user that owns `$CODEM_HOME`.** Running it as somebody else (root starting the bot while `~/.codem` belongs to another user, say) writes artefacts with the wrong owner and interferes with CodeM's own daemon. `/doctor` checks for this.
- CodeM's access token only lives an hour, but the **launcher renews it on every run**, so the bridge does nothing special. A near-expiry token in `/doctor` is just a warning; an expired *refresh* token is what means you have to run `codem login` again.
- The bridge writes `.codem-plugin/plugin.json` and `agents/bridge/AGENT.md` into the working directory to inject coderover's bridge identity as CodeM's system prompt. Both files are bridge-managed — don't edit them by hand.

### Verified version and licensing

The bridge has been verified end to end against CodeM **0.1.227**; `/doctor` warns when the installed version drifts from that.

CodeM is a Feishu product (`@lark-codem/*`). Its distribution is marked **All rights reserved** and use is subject to the [Feishu User Terms of Service](https://www.feishu.cn/terms) — it is **not** open source. Whether you may use it in your environment is yours to confirm.

## Commands

### Host CLI

```text
coderover run [--profile <name>] [--agent claude|codex|codem] [--workspace <path>] [-c <config>]
coderover migrate [--profile <name>] [--agent claude|codex|codem]
coderover ps
coderover kill <id|#>
coderover --help
```

`profile use <name>` changes the profile used by later default starts. Use these profile management commands when running separate Claude / Codex / CodeM bots, connecting multiple PersonalAgent apps, or doing scripted deployment:

```bash
coderover profile create claude --agent claude
coderover profile create codex --agent codex
coderover profile create codem --agent codem
coderover profile list
coderover profile use <name>
coderover profile remove <name>
coderover profile remove <name> --purge --yes
coderover profile export <name> [--output ./profile.json] [--force]
coderover profile export <name> --include-secrets --yes
```

`profile remove` archives local state by default, including the active profile. If other profiles remain, the bridge switches to the next one; if it was the last profile, the root config is cleared so the same name can be created again. `--purge --yes` permanently deletes local state. `profile export` redacts app secrets by default; `--include-secrets --yes` includes sensitive config.

If a profile was created with the wrong agent kind, stop or unregister any matching background service first, then run `profile remove <name>` and recreate it with the intended `--agent`.

### Slash commands inside Feishu / Lark

| Command | Effect |
|---|---|
| `/new`, `/reset` | Clear the current session |
| `/cd <path>` | Switch working directory and reset the session |
| `/ws list` | List named workspaces |
| `/ws save <name>` | Save the current working directory as a named workspace |
| `/ws use <name>` | Switch to a named workspace |
| `/ws remove <name>` | Delete a named workspace |
| `/resume` | Resume compatible history for the same agent, working directory, and permission mode |
| `/status` | Show profile, agent, working directory, session, lark-cli identity, and run state |
| `/config` | Adjust presentation preferences, access settings, and lark-cli identity policy |
| `/invite user @name` | Allow a user to use the bot in DMs |
| `/invite admin @name` | Add an access-control admin |
| `/invite group` | Allow the current group to use the bot |
| `/invite all group` | Allow all groups the bot has joined |
| `/remove user @name`, `/remove admin @name`, `/remove group` | Remove access entries |
| `/add-repo` | Open a card to fill in and register a code repo in the current workspace; appends to CLAUDE.md |
| `/grant @user [<repo>...\|--all]` | Grant a user access to specific repos in this chat |
| `/revoke @user [<repo>...]` | Revoke a user's repo access in this chat |
| `/permissions [@user\|--default open\|restricted]` | View / switch the repo access policy in this chat |
| `/stop` | Stop the current run, including the card stop button |
| `/timeout [N\|off\|default]` | Set or clear the current session idle watchdog |
| `/ps` | List local bridge processes |
| `/exit <id\|#>` | Stop a bridge process |
| `/reconnect` | Force a WebSocket reconnect |
| `/doctor [description]` | Run low-sensitive diagnostics |
| `/help` | Help card |

DMs do not require an @ mention. Groups and topic groups require `@bot` by default; `@all` is ignored. Cloud-doc comments in supported document types run when the bot is mentioned.

## Reply Display and COT

`/config` controls three presentation settings:

- **Message reply mode**: `message card` streams the final reply; `plain text` sends once after the run finishes.
- **Tool-call display**: controls whether tool blocks appear in the final card / markdown reply.
- **COT process message**: `off` sends only the final reply; `brief` first sends a COT message with agent progress text and tool summaries; `detailed` also includes tool args and truncated output.

When COT is enabled, the bridge splits the process view and final answer into two messages. The COT message is for tracing what the agent did; the final answer is still generated from the agent's raw text, without heuristic bridge-side filtering. If an agent emits final-answer text as ordinary stream text, that text can also appear in the COT process message.

## lark-cli identity policy

Each profile uses a profile-local lark-cli directory at `~/.lark-channel/profiles/<profile>/lark-cli`. The agent process receives `LARKSUITE_CLI_CONFIG_DIR` for that directory, so personal authorization in one profile is not shared with another profile.

The default policy is `bot-only`: lark-cli uses the app/bot identity and does not access personal resources. When a user authorizes personal resources such as calendar, mail, or drive, the current profile can switch to `user-default`, which keeps app identity available and also allows the authorized user identity. Owner/admin users can inspect or change this policy in `/config`; `/status` shows the current summary as `lark-cli: app` or `lark-cli: user-ready`.

## Working directories

Each profile may define a default working directory through `workspaces.default`. New profiles may be created with `--workspace <path>`; if omitted, the bridge creates a profile-managed default working directory.

This is a profile-field snippet. Do not replace the whole `config.json` with it; edit the matching profile's `workspaces` field.

```json
{
  "workspaces": {
    "default": "/Users/me/.lark-channel-workspaces/claude/default"
  }
}
```

The bridge checks that a selected directory exists, is a directory, and is not an overly broad location such as `/`, the home root, a system directory, or a temp root. The working directory is only the current directory for an agent run. It is not a filesystem sandbox; actual file access still depends on the local agent process and its permission mode.

## Multi-user workspaces

Enabled by default (since Phase 3). Each Feishu user (identified by `open_id`) gets an **isolated working directory** under `workspaceRoot`, named by the user's `open_id` (globally unique and immutable), so workspaces and sessions are not shared across users. The directory is registered and created automatically on the user's first message, and the bot greets them by their real name afterwards.

Each user directory maintains its own multi-user CLAUDE.md section (inside the `<!-- multi-user-managed-start/end -->` markers) with user info, working directory, and a long-term-memory convention (`CC-Memory/`). This section is independent from the `/add-repo` bridge-managed section.

To opt out of isolation and fall back to a shared workspace:

```json
{
  "multiUser": {
    "enabled": false
  }
}
```

## Repo management (/add-repo)

`/add-repo` registers a local path or Git repository into the current workspace. The entry is appended to the workspace's CLAUDE.md inside the bridge-managed section (`<!-- bridge-managed-start/end -->`), so the agent sees these repos when it reads CLAUDE.md. Content outside the marker block is user-authored and never touched.

- `/add-repo`: opens an interactive form card for filling in repo paths / Git URLs (optionally with a description), supporting batch adding of multiple rows (up to 5). A local path is mounted as a **symlink**; a Git URL is `git clone`d.
- `/add-repo list`: list repos registered in the workspace.
- `/add-repo remove`: open a card to remove repo entries from CLAUDE.md, and clean up the on-disk materialisation in the workspace — a symlink only gets its link removed (source stays intact), a `git clone` directory is deleted, so the same repo can be re-added later (a stale directory makes `git clone` fail with code 128).
- Adding is card-driven only: typing a path / URL right after `/add-repo` no longer quick-adds — it opens the card with your input pre-filled into the first row, taking effect only after you confirm.

## Permission modes

The recommended user-facing profile config is `permissions.defaultAccess` and `permissions.maxAccess`. New profiles default to `full` for both values so the bridge can keep local tools, authorization flows, file writes, and other agent features fully usable. To tighten a profile, set one or both values to `workspace` or `read-only`; stricter modes can limit local tool execution, login/authorization flows, file writes, and similar capabilities.

This is a profile-field snippet. Do not replace the whole `config.json` with it; edit the matching profile's `permissions` field.

```json
{
  "permissions": {
    "defaultAccess": "full",
    "maxAccess": "full"
  }
}
```

Mode mapping:

| Bridge access | Claude permission mode | Codex mode | CodeM |
|---|---|---|---|
| `full` | `bypassPermissions` | `danger-full-access` | `--yolo` |
| `workspace` | `acceptEdits` | `workspace-write` | default tier (auto-approves inside the workspace) |
| `read-only` | `plan` | `read-only` | `--approval-policy ask`, always denied by the bridge |

The legacy `sandbox` field is still readable for old configs. After the bridge saves the profile, it migrates that setting to canonical `permissions`.

## Sensitive information filtering

Enabled by default. Before the agent's final reply is sent to Feishu, the bridge runs a **secret redaction** pass over the text: values matching common secret patterns are replaced with `***REDACTED***`. This is a last line of defense — the local agent subprocess may read secrets from files / env / memory and echo them back in its reply.

Default rules cover Anthropic API keys (`sk-ant-*`), OpenAI keys, GitHub tokens, AWS Access Keys, `Bearer` / `Basic` auth headers, and more. Custom rules go under `filters.sensitive.rules` (`name` / `pattern` / `replacement?`); invalid regex patterns are dropped with a warning. To disable entirely:

```json
{
  "filters": {
    "sensitive": {
      "enabled": false
    }
  }
}
```

## Data directories

| Path | Content |
|---|---|
| `~/.lark-channel/config.json` | Root config with profiles and active profile |
| `~/.lark-channel/active-profile` | Last selected profile |
| `~/.lark-channel/profiles/<profile>/sessions.json` | Session state |
| `~/.lark-channel/profiles/<profile>/sessions.json.catalog.json` | Agent-aware session catalog |
| `~/.lark-channel/profiles/<profile>/workspaces.json` | Current and named workspace bindings |
| `~/.lark-channel/profiles/<profile>/repo-permissions.json` | Per-chat repo grants (/grant /revoke) |
| `~/.lark-channel/profiles/<profile>/secrets.enc` | Profile-local encrypted secrets |
| `~/.lark-channel/profiles/<profile>/lark-cli/` | Profile-local lark-cli directory |
| `~/.lark-channel/profiles/<profile>/media/` | Attachment cache |
| `~/.lark-channel/profiles/<profile>/logs/` | Structured run logs |
| `~/.lark-channel/registry/processes.json` | Local process registry |
| `~/.lark-channel/registry/locks/` | Profile and app locks |
| `$CODEM_HOME` (default `~/.codem`) | **CodeM backend only**: CodeM's own credentials, sessions (`sessions/<cwd hash>/<id>.jsonl`), and runtime. **Not** under `~/.lark-channel` — CodeM manages it |

Set `LARK_CHANNEL_HOME=/path/to/state` to move all local bridge state. `LARK_CHANNEL_LOG_DAYS` overrides log retention. `CODEM_HOME` works the same way but only affects the CodeM backend, and it must point at a CodeM directory **readable by the user running the bot**.

## Access control

**Chat access is private by default: out of the box, only *you* can use the bot in DMs and groups.** "You" = whoever created / owns the Feishu app (the person who scanned the QR to set it up). The bot figures out who the app owner is automatically from Feishu, so **solo chat use needs zero configuration** — you can DM it and `@`-mention it in any group, and everyone else's chat messages are silently ignored (no "permission denied" reply, which would only confirm the bot exists). Cloud-doc comments are document-scoped; see below.

To let other people or groups in, add them to one of three lists:

| List | Controls | Add | Remove |
|------|----------|-----|--------|
| **Allowed users** | who can DM the bot | `/invite user @them` | `/remove user @them` |
| **Allowed chats** | which groups the bot answers in (for **everyone** in them) | `/invite group` (current group) / `/invite all group` (every group the bot is in) | `/remove group` (current group) |
| **Admins** | who can change settings, and use the bot in any group | `/invite admin @them` | `/remove admin @them` |

> `/invite` and `/remove` can only be run by **you (the creator) and admins**. The `@` in the command points at the *target person* (not the bot) — the bot resolves the mention to their identity, so you never deal with raw IDs.

### Two identities that bypass everything

- **You (the creator)**: subject to no list at all — DMs, any group, every command. You **can never lock yourself out**: even if the lists get messed up, DM the bot and send `/config` to get back in. Transfer the app's ownership in the Feishu console and the bot follows the new owner automatically.
- **Admins**: can DM, run management commands like `/config`, and **bypass the allowed-chats list** — the bot answers them in any group, listed or not. Good for teammates who co-maintain the bot.

### Common setups

- **Just me** → nothing to do; this is the default.
- **Let a teammate DM the bot** → `/invite user @them`
- **Open a work group to everyone in it** → send `/invite group` inside that group
- **First-time setup, onboard every group the bot is already in** → `/invite all group` pulls them all into the list at once; trim with `/remove group` afterwards
- **Add a co-admin** → `/invite admin @them`

### Worth knowing

- Changes take effect on the **next message** — no restart needed.
- **In groups you must `@` the bot first** (DMs don't need it). That's a separate toggle (`/config` → "require @ in groups"), independent of the lists above.
- Strangers get pure silence — no reply at all. The one exception: if someone `@`-mentions the bot in a group that hasn't been opened up, the bot posts a friendly one-liner telling them an admin can run `/invite group` to enable it.
- Cloud-doc comments are document-scoped: anyone who can comment in a supported document and mention the bot can trigger a reply.

### Advanced: editing the config file directly

If you'd rather not do it inside Feishu, `/invite` and `/config` write the matching profile's `access` field in `~/.lark-channel/config.json`. Empty lists mean nobody from that list, not open access. This is a profile-field snippet; do not replace the whole `config.json` with it:

```json
{
  "schemaVersion": 2,
  "profiles": {
    "claude": {
      "agentKind": "claude",
      "access": {
        "allowedUsers": ["ou_xxxxxxxxxxxxx"],
        "allowedChats": ["oc_xxxxxxxxxxxxx"],
        "admins": ["ou_xxxxxxxxxxxxx"],
        "requireMentionInGroup": true
      }
    }
  }
}
```

`allowedUsers` / `admins` take user `open_id`s; `allowedChats` takes group `chat_id`s. The easiest way to find an ID by hand: have the person message the bot (or `@` it in the group), then check the active profile's log:

```bash
grep '"event":"enter"' ~/.lark-channel/profiles/<profile>/logs/bridge-$(date +%Y%m%d).jsonl | tail -5
```

Each line carries `chatId` (group / DM id) and `senderId` (user `open_id`). After a manual edit, **restart the bridge** or send `/reconnect` from an allowed admin context to apply it. For day-to-day tweaks `/invite` / `/config` are easier; direct edits are mainly for deployment scripts that pre-seed access.

#### Auto-grant when a trusted bot adds the bot to a group (on by default, can be disabled)

When a fixed bot (display name `AgentBuddy` by default) creates a group and adds this bot to it, the bridge adds that group to `allowedChats` automatically on the Feishu `im.chat.member.bot.added_v1` event — group members no longer need `/invite group`. This is **enabled by default**: a profile without `access.groupAutoGrant` uses the defaults below. Admins can toggle it directly under "受信任 bot 拉群自动授权" in the `/config` form; to tune the advanced fields or opt out, configure it under the profile's `access`:

```jsonc
"access": {
  "allowedChats": ["oc_xxxxxxxxxxxxx"],
  "groupAutoGrant": {
    "enabled": true,
    "botNames": ["AgentBuddy"],
    "allowExternal": false,
    "notifyInChat": true,
    "retryDelaysMs": [0, 300, 800]
  }
}
```

The decision uses runtime data only — there is no per-app `open_id` to pre-configure. The event's `operator_id.open_id` must be present in the chat's bot list as seen by this app (`getChatBots`), and that bot's display name must **exactly** match an entry in `botNames` (case-sensitive, no prefix matching).

- `enabled`: defaults to `true`; set it to `false` to opt out; reload with `/reconnect` or a process restart.
- `allowExternal`: external groups are rejected unless explicitly allowed.
- `notifyInChat`: post a short notice in the group after a grant.
- `retryDelaysMs`: the bot list lags the event by ~0.5s; these are the retry delays.

**Existing apps** must also subscribe to `im.chat.member.bot.added_v1` under "Events & Callbacks" in the Feishu developer console and have the `im:chat.members:bot_access` (or `im:chat.members:read`) scope. New apps get both from the QR wizard. To disable, set `enabled: false` and reload; already-granted groups stay in `allowedChats` until you remove them with `/remove group`.

## Cloud-doc comments

Cloud-doc comments do not need a separate workspace binding or document allowlist. In supported document comments, mention the bot and the bridge replies in the same thread. Comment runs reuse the document session key and fall back to the user home directory when no document cwd was previously recorded.

## FAQ

**The bot stays silent or the local CLI never replies.** Usually the local `claude`, `codex`, or `codem` CLI is not logged in, or the current session points to a working directory that no longer exists. Send `/status` to inspect; `/new` often fixes it by starting a fresh session.

**CodeM reports "local CodeM not found" or "not logged in".** Check that the user running the bot is the **same user** that ran `codem login`, and that `$CODEM_HOME` points at that user's CodeM directory (default `~/.codem`). Running as a different user is the most common trap — the bridge either can't read the credentials or writes artefacts with the wrong owner. Run `/doctor` to see which check failed.

**CodeM's token shows as near-expiry.** The one-hour access token is renewed by the launcher on every run, so a near-expiry warning needs no action. Only an expired *refresh* token means you have to run `codem login` again.

**The agent subprocess looks frozen (card stuck on the last frame).** The bridge supports an idle watchdog: if the agent emits nothing for N minutes, the process is killed and the card is annotated with the auto-termination reason. Disabled by default. Enable with `/config` globally, or `/timeout 10` for the current session; `/timeout off` disables it for the session; `/timeout default` clears the session override.

**The agent says it cannot see an image I sent.** Upgrade to the latest version. Releases before 0.1.0 had a filename-dedup bug.

## Testing and CI

Local checks:

```bash
pnpm test
pnpm typecheck
pnpm build
```

`pnpm test` includes unit, integration, and process-level adapter tests. CI runs on macOS, Ubuntu, and Windows with `pnpm install --frozen-lockfile`, `pnpm test`, `pnpm typecheck`, and `pnpm build`.

## Optional telemetry

By default the bridge reports **nothing**: no metrics, no logs leave your machine, and it pulls in zero telemetry dependencies. The hook below is inert unless you opt in.

To wire up your own monitoring, point an environment variable at a module that default-exports (or exports `createAdapter`) an `AdapterFactory`:

```bash
LARK_CHANNEL_TELEMETRY_MODULE=your-telemetry-package coderover start
```

That module receives every `log.*` event plus error/metric hooks and forwards them wherever you like. The interface is exported from the package root:

```ts
import type { AdapterFactory, TelemetryAdapter, TelemetryEvent } from 'coderover';

const createAdapter: AdapterFactory = (meta) => ({
  emit(event) {/* ship event */},
  recordError(err, ctx) {/* ship exception */},
  recordMetric(name, value, tags) {/* ship metric */},
  flush(timeoutMs) {/* drain buffered events */},
});
export default createAdapter;
```

A missing module, a bad factory, or a throwing adapter all degrade to noop — telemetry can never stop the bridge from starting or break logging.
