xiaozhi-esp32: Instructions file for Codex

AGENTS.md

xiaozhi-esp32 AGENTS.md is an instructions file for Codex, OpenCode from 78/xiaozhi-esp32. It costs 1,075 tokens per session, scanned A, original, MIT.

Project instructions for XiaoZhi, an ESP-IDF C/C++ firmware project for voice-assistant devices. They describe its hardware boards, audio, displays, network connections, build choices, and main code areas.

In plain words
What is it for?
Use them when adding or changing device behavior, board support, audio or display features, network protocols, configuration, or firmware builds.
Why use it?
They give the coding agent the project's architecture and required development rules, reducing the risk of changing the wrong board implementation or using the wrong build setup.

Instructions file for CodexOpenCode

Written for Codex and OpenCode: the file is AGENTS.md. Also seen: mentions AGENTS.md.

This is 78/xiaozhi-esp32's own configuration. It tells Codex and OpenCode how to work on xiaozhi-esp32 itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything xiaozhi-esp32 configures →

About the project

XiaoZhi ESP32 is an MCP-based voice chatbot that runs on supported ESP32 devices and uses large language models for conversation and control across devices. It is intended for developers building voice interfaces with networking, audio streaming, wake-word detection, and MCP-based capabilities. The catalogue instruction supports work with this project.

78/xiaozhi-esp32 · 32,690 stars · on GitHub · xiaozhi.me

Reuse

Borrowing it

Nothing to install: this file belongs to 78/xiaozhi-esp32. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/78/xiaozhi-esp32/main/AGENTS.md
Clone the repo
git clone --depth 1 https://github.com/78/xiaozhi-esp32

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 xiaozhi-esp32 AGENTS.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/78/xiaozhi-esp32/agents-md/github.svg)](https://agentmods.dev/instructions/78/xiaozhi-esp32/agents-md)
Your own site
<a href="https://agentmods.dev/instructions/78/xiaozhi-esp32/agents-md"><img src="https://agentmods.dev/badge/instructions/78/xiaozhi-esp32/agents-md/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for xiaozhi-esp32 AGENTS.md

Your own site · 80×15
<a href="https://agentmods.dev/instructions/78/xiaozhi-esp32/agents-md"><img src="https://agentmods.dev/badge/instructions/78/xiaozhi-esp32/agents-md.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 1,075 This file is loaded in full into every session.
When invoked 1,075 The same file — it is already loaded in full.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.01075 $0.01075
Opus 5.5 $0.00430 $0.00430
Sonnet 5.5 $0.00215 $0.00215
Haiku 4.5 $0.00108 $0.00108

Measured 16d ago against content hash e4657b6bbf89, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

xiaozhi-esp32 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 16d 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 · 94 lines

How it starts

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

AGENTS.md

Project

XiaoZhi is an ESP-IDF C/C++ voice-assistant firmware supporting many chips, boards, displays, audio devices, and network transports. A build selects exactly one board implementation.

Use the ESP-IDF release/v6.1 branch when possible. The minimum supported SDK is ESP-IDF v6.0.1. IDF 5.x is not supported.

Architecture

  • main/application.*: main event loop, protocol lifecycle, and high-level behavior.
  • main/device_state_machine.*: legal runtime state transitions.
  • main/boards/common/: board interfaces and reusable hardware/network helpers.
  • main/boards/**/: board-specific pins, initialization, and build variants.
  • main/audio/: codecs, audio tasks, engines, wake words, and queues.
  • main/protocols/: transport-neutral API plus WebSocket and MQTT/UDP.
  • main/display/ and main/led/: reusable UI implementations.
  • main/mcp_server.*: common device-side MCP tools and dispatch.
  • main/Kconfig.projbuild: board and feature configuration.
  • main/CMakeLists.txt: source, board, locale, font, and asset selection.
  • scripts/build.py: canonical board/variant build entry point.

Read the closest existing implementation before adding a new one. Prefer the narrowest owning layer; do not put board-specific behavior into core modules.

Required Rules

  • Preserve unrelated worktree changes and keep patches focused.
  • A build must export exactly one board factory through DECLARE_BOARD(...).
  • Never alter an existing board's pins to support different hardware. Add a uniquely named board or release variant; board identity affects OTA compatibility.
  • Core code depends on Board interfaces, never a concrete board class or board config.h.
  • Treat camera, backlight, display, LED, battery, and similar capabilities as optional.
  • Change runtime state through Application::SetDeviceState() and the state machine.
  • Callbacks may run outside the main task. Schedule application mutations with Application::Schedule() or event bits.
  • Do not block the main event loop or audio tasks. Avoid unbounded queues and repeated large allocations in audio paths.
  • Keep shared message semantics in Protocol; verify both transports when changing its contract.
  • Validate network input and preserve cJSON ownership. NVS keys are persistent API and require migration when changed.
  • Guard target-specific features with Kconfig/component rules. Do not assume every target has PSRAM or S3/P4 resources.
  • Do not manually edit generated/vendor output: build/, releases/, managed_components/, components/, sdkconfig*, main/assets/lang_config.h, or generated mmap headers.
  • Format only touched C/C++ files with the repository .clang-format; avoid unrelated mass formatting.

Read the full file on GitHub · 94 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. 16d ago Changed · +5 tokens per session e4657b6bbf89
  2. 1mo ago Changed · -1 lines · -9 tokens per session bdc857442bd5
  3. 2mo ago First seen · 95 lines · 1,079 tokens per session scan A b8b4a28987b9

Subscribe to this mod's changes

xiaozhi-esp32 AGENTS.md is an instructions file published in the GitHub repository 78/xiaozhi-esp32 (32,690 stars, last pushed 2d ago), licensed MIT. It adds 1,075 tokens to every session, about $0.0043 per session on Opus 5.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.

Related

xiaozhi-esp32 AGENTS.md compared with instructions from other repositories

xiaozhi-esp32 AGENTS.md next to 6 instructions from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
xiaozhi-esp32 AGENTS.md78/xiaozhi-esp32Instructions file33k2d agoMITA1,075Codex, OpenCode
vscode buildNext.instructions.mdmicrosoft/vscodeInstructions file195ktodayMITA9,719GitHub Copilot
next.js AGENTS.mdvercel/next.jsInstructions file143ktodayMITA7,461Codex, OpenCode
vscode oss-third-party-notices.instructions.mdmicrosoft/vscodeInstructions file195ktodayMITA5,516GitHub Copilot
langchain AGENTS.mdlangchain-ai/langchainInstructions file149ktodayMITA4,680Codex, OpenCode
vscode copilot-instructions.mdmicrosoft/vscodeInstructions file195ktodayMITA3,093GitHub Copilot
deepseek-harness AGENTS.mddeepseek-ai/deepseek-harnessInstructions file274k2d agoMITA4,313Codex, OpenCode