Agent skill

Matrix Channel for NanoClaw

by nanocoai in nanocoai/nanoclaw

Adds a Matrix channel to NanoClaw for any homeserver through the Chat SDK bridge, including a pnpm patch that fixes ESM imports in the published adapter.

MITAuto-check: notesProductivity & Automation

Install Matrix Channel for NanoClaw

skills CLI
$ npx skills add nanocoai/nanoclaw --skill add-matrix -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install nanocoai/nanoclaw add-matrix --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/nanocoai/nanoclaw.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.claude/skills/add-matrix .claude/skills/add-matrix && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
add-matrix
GitHub stars
31k
Token cost
~2.1k tokens
SKILL.md length
909 words
Files
4
Skills in repo
59
Repo updated
First seen
Licence
MIT

At a glance

Adds a Matrix channel to NanoClaw for any homeserver through the Chat SDK bridge, including a pnpm patch that fixes ESM imports in the published adapter.

  • Works in 5 steps: Copy the adapter → Register the adapter → Configure the ESM patch → …
  • Connecting a NanoClaw agent to a Matrix room on any homeserver
  • SKILL.md covers Apply, Credentials, Next Steps and Channel Info, plus 1 more section
  • Calls pnpm and curl; reaches matrix.org; needs MATRIX_PASSWORD and MATRIX_ACCESS_TOKEN

What it does

Matrix support comes through the Chat SDK bridge and works with any Matrix homeserver. The adapter lives in the `@beeper/` namespace and is pinned on its own track, apart from the `@chat-adapter` packages. The published package imports `matrix-js-sdk` paths without `.js` extensions, which fails under Node 22 strict ESM resolution, so the skill ships a pnpm patch that is registered before installation and reapplied on every install.

After the adapter and its registration test are copied from the `channels` branch and the import is appended to the barrel, the skill builds, checks that the package loads through a direct Node ESM import, and runs the registration test. The patch file, a fixtures file and `REMOVE.md` are bundled with it.

When your agent uses it

  • Connecting a NanoClaw agent to a Matrix room on any homeserver
  • Fixing a Matrix adapter that fails to load under strict ESM resolution
  • Reapplying the Matrix adapter patch after a dependency reinstall

Example prompts

  • “Add Matrix to NanoClaw so the agent can join rooms on our homeserver.”
  • “The Matrix adapter throws an ESM resolution error on Node 22. Apply the patch.”
  • “Run the Matrix registration test and the direct import check.”

Requirements

  • A NanoClaw installation with pnpm
  • A Matrix homeserver account for the bot

Workflow steps

5 steps, taken from the step headings in SKILL.md.

  1. Copy the adapter
  2. Register the adapter
  3. Configure the ESM patch
  4. Install the adapter package
  5. Verify and build

What it can do on your machine

Read from SKILL.md and the folder at commit 66f0823. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • pnpm
    • curl

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Hosts in commands or code, which the agent is likely to contact:

    • matrix.org

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names these keys or tokens, usually read from environment variables:

    • MATRIX_PASSWORD
    • MATRIX_ACCESS_TOKEN
    • MATRIX_RECOVERY_KEY

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Matrix Channel for NanoClaw loads about 2.1k tokens when it runs. Until then it costs about 22 tokens; SKILL.md has 909 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~22
When it runs · the whole SKILL.md, loaded when a task matches
~2.1k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check: notes

The automated check noted patterns worth knowing about, such as sudo or a known installer.

  • NoteMentions a .env fileSKILL.md:141
    ed `ncl` or the OneCLI vault instead of `.env` by swapping

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from nanocoai/nanoclaw at commit 66f0823, republished under its MIT licence (© nanocoai). 909 words, ~2,137 tokens.

Download SKILL.mdSave it as .claude/skills/add-matrix/SKILL.md (or your agent's skills folder). This skill also uses 3 other files; get the full folder from GitHub.
name
add-matrix
description
Add Matrix channel integration via Chat SDK. Works with any Matrix homeserver.

Add Matrix Channel

Adds Matrix support via the Chat SDK bridge. NanoClaw doesn't ship channels in trunk — this skill copies the Matrix adapter in from the channels branch.

The mechanical steps under Apply carry nc: directive fences: an agent reads the prose and applies them, and a parser can apply them deterministically from the same document. Every directive is idempotent, so the whole skill is safe to re-run; anything a parser can't apply falls back to the prose beside it.

Apply

1. Copy the adapter

Fetch the channels branch and copy the Matrix adapter into src/channels/ (overwrite — the branch is canonical):

nccopy
src/channels/matrix.ts
src/channels/matrix-registration.test.ts
2. Register the adapter

Append the self-registration import to the channel barrel (skipped if the line is already present). This one line is the skill's only reach-in into core:

ncappend
import './matrix.js';
3. Configure the ESM patch

The published adapter references matrix-js-sdk/lib/... without .js extensions, which fails under Node 22 strict ESM resolution. Register the committed pnpm patch before installing the package. pnpm reapplies it after every install and fails if the pinned package drifts away from the patch:

nccopy
patches/@beeper__chat-adapter-matrix@0.2.0.patch
ncrun
pnpm pkg set 'pnpm.patchedDependencies[@beeper/chat-adapter-matrix@0.2.0]=patches/@beeper__chat-adapter-matrix@0.2.0.patch'
4. Install the adapter package

Pinned to an exact version — the supply-chain policy rejects ranges and latest. The Matrix adapter lives in the @beeper/ namespace and versions on its own track (not the @chat-adapter/* family), so it carries its own pin:

ncdep
@beeper/chat-adapter-matrix@0.2.0
5. Verify and build

Build guards the typed createChatSdkBridge(...) core call the adapter makes and fails if the import './matrix.js'; line is missing. The direct Node import checks the published ESM entrypoint using the real runtime resolver:

ncrun
pnpm run build
ncrun
node --input-type=module -e 'await import("@beeper/chat-adapter-matrix")'
ncrun
pnpm exec vitest run src/channels/matrix-registration.test.ts

matrix-registration.test.ts imports the real channel barrel and asserts the registry contains matrix. It goes red if the import line is deleted or drifts, if the barrel fails to evaluate, or if @beeper/chat-adapter-matrix isn't installed (the import throws) — so it also covers the dependency from step 3.

End-to-end message delivery against a real Matrix homeserver is verified manually once the service is running — see Next Steps.

Credentials

The bot needs its own Matrix account — separate from the user's account. This is required because Matrix cannot send DMs to yourself. These steps are human and interactive (no parser can click through Element), so they stay prose.

Create a bot account
  1. Open app.element.io in a private/incognito window (or sign out first)
  2. Register a new account for the bot (e.g. andybot on matrix.org)
  3. Note the bot's user ID (e.g. @andybot:matrix.org)
Choose an auth method

Option A: Username + Password (simpler)

No extra steps — just use the bot account's credentials directly. The adapter logs in automatically.

bash
MATRIX_BASE_URL=https://matrix.org
MATRIX_USERNAME=andybot
MATRIX_PASSWORD=your-bot-password
MATRIX_USER_ID=@andybot:matrix.org
MATRIX_BOT_USERNAME=Andy

Option B: Access Token (recommended for production)

Get an access token from Element: sign into the bot account → Settings > Help & About > Access Token (under Advanced). Or via API:

bash
curl -XPOST 'https://matrix.org/_matrix/client/r0/login' \
  -d '{"type":"m.login.password","user":"andybot","password":"..."}'
bash
MATRIX_BASE_URL=https://matrix.org
MATRIX_ACCESS_TOKEN=your-access-token
MATRIX_USER_ID=@andybot:matrix.org
MATRIX_BOT_USERNAME=Andy
Optional settings
bash
MATRIX_INVITE_AUTOJOIN=true                    # Auto-accept room invites (default: true)
MATRIX_INVITE_AUTOJOIN_ALLOWLIST=@you:matrix.org  # Only accept invites from these users
MATRIX_RECOVERY_KEY=your-recovery-key          # Enable E2EE cross-signing
MATRIX_DEVICE_ID=NANOCLAW01                    # Stable device ID across restarts
Store the credentials

Capture the values for the auth method you chose, then write them. prompt only asks and binds the answer to a name; a separate directive consumes it — so the same prompts could feed ncl or the OneCLI vault instead of .env by swapping only the consumer. The homeserver URL, the bot's user ID, and a display name are shared across both auth methods:

ncprompt
Paste the homeserver base URL, e.g. `https://matrix.org`.
ncprompt
Paste the bot's full Matrix user ID, e.g. `@andybot:matrix.org`.
ncprompt
Paste a display name for the bot, e.g. `Andy`.
ncenv-set
MATRIX_BASE_URL={{base_url}}
MATRIX_USER_ID={{user_id}}
MATRIX_BOT_USERNAME={{bot_username}}

For Option A capture the bot login, for Option B capture the access token — set only the block matching your chosen method:

ncprompt
Option A only — the bot's login username (the localpart, e.g. `andybot`).
ncprompt
Option A only — the bot account's password.
ncenv-set
MATRIX_USERNAME={{username}}
MATRIX_PASSWORD={{password}}
ncprompt
Option B only — the access token from Element Settings > Help & About, or from the login API.
ncenv-set
MATRIX_ACCESS_TOKEN={{access_token}}
Show full SKILL.md (373 more words)Show less

Next Steps

If you're in the middle of /setup, return to the setup flow now.

Otherwise, run /manage-channels to wire this channel to an agent group.

Channel Info

  • type: matrix
  • terminology: Matrix has "rooms." A room can be a group chat or a direct message. Rooms have internal IDs (like !abc123:matrix.org) and optional aliases (like #general:matrix.org).
  • how-to-find-id: For DMs, use the bot's openDM to resolve the room automatically. For group rooms, in Element click the room name > Settings > Advanced — the "Internal room ID" is the platform ID (starts with !). Or use a room alias like #general:matrix.org.
  • supports-threads: partial (some clients support threads, but not all — treat as no for reliability)
  • typical-use: Interactive chat — rooms or direct messages. Requires a separate bot account (the agent cannot DM users from their own account).
  • default-isolation: Same agent group for rooms where you're the primary user. Separate agent group for rooms with different communities or sensitive contexts.

Troubleshooting

Build fails with ERR_MODULE_NOT_FOUND for matrix-js-sdk/lib/.... The ESM extension patch (step 4) hasn't been applied — or a later pnpm install reinstalled the adapter and wiped it. Re-run the patch, then pnpm run build; the patch is idempotent, so re-running is always safe.

Login fails with M_FORBIDDEN. The username/user-ID split is the usual trip: MATRIX_USERNAME is the bare localpart (andybot), while MATRIX_USER_ID is the full ID (@andybot:matrix.org) — swapping them fails auth. With Option B, an access token dies the moment that Element session signs out; grab a fresh one from Settings → Help & About → Access Token, or via the login API.

The bot never joins your room. Auto-join is on by default (MATRIX_INVITE_AUTOJOIN=true), but an allowlist (MATRIX_INVITE_AUTOJOIN_ALLOWLIST) that doesn't include your user ID makes it ignore your invites. Invite the bot from your own account and watch the service log for the join.

Messages to yourself never arrive. Matrix cannot DM your own account — the bot must be its own account, separate from yours. If you configured the adapter with your personal credentials, register a dedicated bot account and redo the credential steps.

Registered but silent. Run pnpm exec vitest run src/channels/matrix-registration.test.ts — red means the barrel import or the @beeper/chat-adapter-matrix install drifted, so re-run the Apply steps. If green, restart the service (see Next Steps) and check logs/nanoclaw.error.log for login errors.

© nanocoai, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 3 other files in .claude/skills/add-matrix of nanocoai/nanoclaw.

  • SKILL.md
  • REMOVE.md
  • apply-fixtures.json
  • patches/@beeper__chat-adapter-matrix@0.2.0.patch

Open the folder on GitHubat commit 66f0823

Compare with similar skills

Matrix Channel for NanoClaw next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Matrix Channel for NanoClaw compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Matrix Channel for NanoClaw this skillnanocoai/nanoclaw31k—~2.1kAutomated safety check: NotesMIT
Wechat 2D Rendervibe-motion/skills1.3k—~773Automated safety check: PassNone
Slack Browser Automationvercel-labs/agent-browser44k1 repos~2.1kAutomated safety check: PassApache-2.0
Feishu Docopenclaw/openclaw392k—~516Automated safety check: PassMIT
She Love Me863401402/she-love-me9191 repos~1.3kAutomated safety check: PassMIT
Claude To Imop7418/Claude-to-IM-skill2.9k—~3.4kAutomated safety check: NotesMIT

Similar skills

  • Wechat 2D Render

    vibe-motion/skills

    Clone or update https://github.com/sxhzju/wechat-2d and render the default WeChat-style 2D chat motion video with Remotion.

    1.3k GitHub stars~773 tokensUpdated 3 days ago
    Productivity & AutomationAuto-check passed
  • Slack Browser Automation

    vercel-labs/agent-browser

    Official

    Drives the Slack web app with the agent-browser CLI to check unread channels, search, read channel details and extract information, with screenshots as evidence.

    44k GitHub starsUsed in 1 repo~2.1k tokens
    Productivity & AutomationAuto-check passed
  • Feishu Doc

    openclaw/openclaw

    Feishu document read/write workflows. An agent skill from openclaw/openclaw.

    392k GitHub stars~516 tokensUpdated today
    Productivity & AutomationAuto-check passed
  • She Love Me

    863401402/she-love-me

    Acquire, import, and analyze WeChat or QQ chat histories, including installing supported exporters, guiding required login or contact selection, converting exports, assessing relationship dynamics…

    919 GitHub starsUsed in 1 repo~1.3k tokens
    Productivity & AutomationAuto-check passed
  • Claude To Im

    op7418/Claude-to-IM-skill

    Bridge THIS Claude Code or Codex session to Telegram, Discord, Feishu/Lark, QQ, or WeChat so the user can chat with Claude from their phone.

    2.9k GitHub stars~3.4k tokensUpdated 6 mo ago
    Productivity & AutomationAuto-check: notes
  • Last30days Cn

    Jesseovo/last30days-skill-cn

    Research what Chinese internet users actually said in the last 30 days across Weibo, Xiaohongshu (RED), Bilibili, Zhihu, Douyin, WeChat public accounts, Baidu and Toutiao: engagement-weighted…

    1.9k GitHub stars~2.4k tokensUpdated 2 days ago
    Productivity & AutomationAuto-check: notes

More from nanocoai/nanoclaw

All 59 skills in this repo
  • Installs or refreshes Iron Proxy and its Iron Control web console for NanoClaw, with a local Docker setup, database, credentials and a human approval bridge.

    31k GitHub stars~4.6k tokensUpdated 2 days ago
    Auto-check: notes
  • Agent Browser

    nanocoai/nanoclaw

    Drives a web browser from the shell with the agent-browser CLI: open pages, read an element snapshot, click and fill by reference, grab text and screenshots.

    31k GitHub starsUsed in 3 repos~1.6k tokens
    Auto-check passed
  • Installs or refreshes OneCLI as the gateway provider for NanoClaw, copying the adapter files, registering the provider and running the setup script.

    31k GitHub stars~1.1k tokensUpdated 2 days ago
    Auto-check: notes
  • Guides a conversational migration from an OpenClaw install to NanoClaw v2, carrying over identity, channel credentials, scheduled tasks and workspace files.

    31k GitHub stars~6k tokensUpdated 2 days ago
    Auto-check: notes
  • Wires up an additional phone number onto an already-installed Dial channel, so one NanoClaw install answers SMS and AI voice calls on more than one line.

    31k GitHub starsUsed in 1 repo~1.5k tokens
    Auto-check passed
  • NanoClaw LLM Wiki Setup

    nanocoai/nanoclaw

    Adds a persistent wiki knowledge base to a NanoClaw group following Karpathy's LLM Wiki pattern, with folders, a tailored container skill and a CLAUDE.md section.

    31k GitHub starsUsed in 1 repo~1.3k tokens
    Auto-check passed

Works with

Questions about Matrix Channel for NanoClaw

What does Matrix Channel for NanoClaw do?

Adds a Matrix channel to NanoClaw for any homeserver through the Chat SDK bridge, including a pnpm patch that fixes ESM imports in the published adapter. Matrix support comes through the Chat SDK bridge and works with any Matrix homeserver. The adapter lives in the `@beeper/` namespace and is pinned on its own track, apart from the `@chat-adapter` packages.

When should I use Matrix Channel for NanoClaw?

Matrix Channel for NanoClaw fits situations like: connecting a NanoClaw agent to a Matrix room on any homeserver; fixing a Matrix adapter that fails to load under strict ESM resolution; reapplying the Matrix adapter patch after a dependency reinstall.

How do I install Matrix Channel for NanoClaw in Claude Code?

Run `npx skills add nanocoai/nanoclaw --skill add-matrix -a claude-code`. Or copy the skill folder (.claude/skills/add-matrix in nanocoai/nanoclaw) into .claude/skills/add-matrix in your project. Claude Code loads it when a task matches its description.

How do I install Matrix Channel for NanoClaw in Codex?

Run `npx skills add nanocoai/nanoclaw --skill add-matrix -a codex`. Or copy the skill folder (.claude/skills/add-matrix in nanocoai/nanoclaw) into .agents/skills/add-matrix in your project. Codex loads it when a task matches its description.

Can I use Matrix Channel for NanoClaw in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add nanocoai/nanoclaw --skill add-matrix -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/add-matrix, .gemini/skills/add-matrix, .github/skills/add-matrix and .opencode/skills/add-matrix in your project.

What does Matrix Channel for NanoClaw need to run?

Going by SKILL.md and its folder, Matrix Channel for NanoClaw needs the command-line tools its instructions call (pnpm and curl) and credentials named MATRIX_PASSWORD, MATRIX_ACCESS_TOKEN and MATRIX_RECOVERY_KEY. Our summary lists: A NanoClaw installation with pnpm; A Matrix homeserver account for the bot.

Does Matrix Channel for NanoClaw access the network?

SKILL.md names 1 domain. In commands or code: matrix.org; the agent is likely to contact it when it follows the instructions. This is read from the text; nothing was executed.

Is Matrix Channel for NanoClaw safe to install?

Our automated static check of SKILL.md found notes only (mentions a .env file), nothing it rates as a warning. It is not a guarantee. Review the folder before installing.

What licence does Matrix Channel for NanoClaw use?

Matrix Channel for NanoClaw is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Matrix Channel for NanoClaw use?

About 2.1k tokens (SKILL.md is roughly 8.5k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Matrix Channel for NanoClaw?

Skills that share tags, products or a category with Matrix Channel for NanoClaw: Wechat 2D Render (vibe-motion/skills, 1.3k stars), Slack Browser Automation (vercel-labs/agent-browser, 44k stars), Feishu Doc (openclaw/openclaw, 392k stars) and She Love Me (863401402/she-love-me, 919 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Matrix Channel for NanoClaw?

nanocoai (a GitHub organization) maintains it in nanocoai/nanoclaw, which has 30,897 GitHub stars. The repository holds 59 skills in this directory. The repository was last updated on October 6, 2026.

Source: nanocoai/nanoclaw on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.