open-xiaoai-bridge AGENTS.md

open-xiaoai-bridge AGENTS.md is an instructions file for Codex, OpenCode from coderzc/open-xiaoai-bridge. It costs 5,359 tokens per session, scanned A, original, MIT.

A set of project instructions for a bridge that connects Xiaomi smart speakers to outside AI services. The bridge handles audio input and output, conversations, wake words, speech processing, and connections to services such as Xiaozhi AI and OpenClaw.

In plain words
What is it for?
Use it when changing the bridge's main controller, speaker integration, audio pipeline, conversation flow, HTTP API, or AI-service connections.
Why use it?
It gives coding agents a map of the system and its parts, so changes are made in the right place. This reduces confusion in a project where hardware, audio processing, network services, and conversation state work together.

Instructions file for CodexOpenCode

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add instructions/coderzc/open-xiaoai-bridge/agents-md
Clone the repo
git clone --depth 1 https://github.com/coderzc/open-xiaoai-bridge

Made for: Codex, OpenCode.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for open-xiaoai-bridge AGENTS.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/coderzc/open-xiaoai-bridge/agents-md.svg)](https://agentmods.dev/instructions/coderzc/open-xiaoai-bridge/agents-md)
Your own site
<a href="https://agentmods.dev/instructions/coderzc/open-xiaoai-bridge/agents-md"><img src="https://agentmods.dev/badge/instructions/coderzc/open-xiaoai-bridge/agents-md.svg" alt="Measured on agentmods" height="20"></a>
Per session 5,359 This file is loaded in full into every session.
When invoked 5,359 The same file — it is already loaded in full.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.05359 $0.05359
Opus 5 $0.02679 $0.02679
Sonnet 5 $0.01072 $0.01072
Haiku 4.5 $0.00536 $0.00536

Measured 5d ago against content hash 90e352404dc3, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

open-xiaoai-bridge AGENTS.md scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 5d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

AGENTS.md · 386 lines

How it starts

The opening of the file, as written. The whole thing — 386 lines — stays where its author put it; the contents beside it link to each section on GitHub.

AGENTS.md

小爱音箱与外部 AI 服务(小智 AI、OpenClaw)的桥接器。 接管音箱音频输入输出,实现与第三方 AI 的对话。

系统架构

详见 README.md 系统架构(含 Mermaid 流程图和各模块工作流程)。

项目结构

open-xiaoai-bridge/
├── main.py                        # 入口:解析环境变量,启动 MainApp
├── config.py                      # 用户配置(唤醒词、路由钩子、TTS、OpenClaw 等)
├── core/
│   ├── app.py                     # MainApp 主控制器(单例,管理生命周期)
│   ├── xiaoai.py                  # XiaoAI 设备接入 / 事件桥接
│   ├── xiaoai_conversation.py     # 小爱连续对话策略
│   ├── xiaozhi.py                 # 小智 AI WebSocket 协议客户端
│   ├── openclaw.py                # OpenClaw 网关客户端(连接、消息、TTS 播放)
│   ├── openclaw_conversation.py   # OpenClaw 连续对话循环(VAD → ASR → Agent → TTS)
│   ├── wakeup_session.py          # 小智唤醒会话状态机
│   ├── ref.py                     # 全局引用注册表(get/set 依赖注入)
│   ├── models/                    # 模型文件(KWS/VAD/ASR,.gitignore 排除)
│   ├── assets/sounds/             # 音效(tts_notify.mp3 等)
│   ├── services/
│   │   ├── speaker.py             # SpeakerManager 音箱硬件控制
│   │   ├── api_server.py          # HTTP REST API(aiohttp)
│   │   ├── audio/
│   │   │   ├── stream.py          # GlobalStream 全局音频流(多路输入广播)
│   │   │   ├── codec.py           # 音频编解码
│   │   │   ├── vad/silero.py      # Silero VAD 语音活动检测(ONNX)
│   │   │   ├── kws/sherpa.py      # Sherpa KWS 关键词唤醒
│   │   │   └── asr/sherpa.py      # Sherpa ASR 离线语音识别(SenseVoice)
│   │   ├── tts/doubao.py          # 豆包 TTS 客户端(火山引擎)
│   │   └── protocols/
│   │       ├── websocket_protocol.py  # 小智 WebSocket 协议实现
│   │       └── typing.py              # 协议类型定义
│   └── utils/
│       ├── logger.py              # 彩色日志(XiaozhiLogger 单例)
│       ├── config.py              # ConfigManager(嵌套路径查询、热重载)
│       ├── config_loader.py       # config.py 动态导入
│       ├── base.py                # 基础工具
│       └── file.py                # 文件工具
├── native/                        # Rust PyO3 扩展(maturin 编译)
│   └── src/
│       ├── lib.rs                 # 模块入口:on_output_data, start_server, stop/start_recording, stop/start_playing
│       ├── server.rs              # WebSocket 音频服务器(TCP :4399)
│       ├── python.rs              # Python 回调注册中心(HashMap)
│       ├── macros.rs              # 辅助宏
│       └── tts/                   # TTS 音频处理(流式、PCM 直通、MP3 解码)
├── app/openclaw/                  # OpenClaw 设备身份存储(Ed25519 密钥)
├── skills/xiaoai-tts/             # Agent 工具:通过 HTTP API 控制小爱播放
└── tests/                         # 测试脚本

Read the full file on GitHub · 386 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 5d ago First seen · 386 lines · 5,359 tokens per session scan A 90e352404dc3

Subscribe to this mod's changes

open-xiaoai-bridge AGENTS.md is an instructions file published in the GitHub repository coderzc/open-xiaoai-bridge (347 stars, last pushed 1mo ago), licensed MIT. It adds 5,359 tokens to every session, about $0.0268 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.