

Also from Kynth Studios


Also from Kynth Studios


Also from Kynth Studios
1# AGENTS.md23## Project45XiaoZhi 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.67Use ESP-IDF v6.0.2 when possible. IDF 5.5.x is retained only for documented legacy boards.89## Architecture1011- `main/application.*`: main event loop, protocol lifecycle, and high-level behavior.12- `main/device_state_machine.*`: legal runtime state transitions.13- `main/boards/common/`: board interfaces and reusable hardware/network helpers.14- `main/boards/**/`: board-specific pins, initialization, and build variants.15- `main/audio/`: codecs, audio tasks, engines, wake words, and queues.16- `main/protocols/`: transport-neutral API plus WebSocket and MQTT/UDP.17- `main/display/` and `main/led/`: reusable UI implementations.18- `main/mcp_server.*`: common device-side MCP tools and dispatch.19- `main/Kconfig.projbuild`: board and feature configuration.20- `main/CMakeLists.txt`: source, board, locale, font, and asset selection.21- `scripts/build.py`: canonical board/variant build entry point.2223Read the closest existing implementation before adding a new one. Prefer the narrowest owning layer; do not put board-specific behavior into core modules.2425## Required Rules2627- Preserve unrelated worktree changes and keep patches focused.28- A build must export exactly one board factory through `DECLARE_BOARD(...)`.29- Never alter an existing board's pins to support different hardware. Add a uniquely named board or release variant; board identity affects OTA compatibility.30- Core code depends on `Board` interfaces, never a concrete board class or board `config.h`.31- Treat camera, backlight, display, LED, battery, and similar capabilities as optional.32- Change runtime state through `Application::SetDeviceState()` and the state machine.33- Callbacks may run outside the main task. Schedule application mutations with `Application::Schedule()` or event bits.34- Do not block the main event loop or audio tasks. Avoid unbounded queues and repeated large allocations in audio paths.35- Keep shared message semantics in `Protocol`; verify both transports when changing its contract.36- Validate network input and preserve `cJSON` ownership. NVS keys are persistent API and require migration when changed.37- Guard target-specific features with Kconfig/component rules. Do not assume every target has PSRAM or S3/P4 resources.38- Do not manually edit generated/vendor output: `build/`, `releases/`, `managed_components/`, `components/`, `sdkconfig*`, `main/assets/lang_config.h`, or generated mmap headers.39- Format only touched C/C++ files with the repository `.clang-format`; avoid unrelated mass formatting.4041## Boards and Configuration4243Board selection is a coupled chain:4445`config.json` -> `scripts/build.py` -> `main/Kconfig.projbuild` -> `main/CMakeLists.txt` -> board source and `config.h`.4647When adding a board or variant, update every relevant link in that chain. Include a unique board identity, correct chip target, flash/partition settings, exactly one `DECLARE_BOARD`, and board documentation. Follow `docs/custom-board.md`.4849## Commands5051Source the intended ESP-IDF environment first:5253```sh54source /path/to/esp-idf/export.sh55idf.py --version56```5758```sh59# Discover exact board and variant names60python3 scripts/build.py --list-boards6162# Canonical variant build63python3 scripts/build.py <board-directory> --name <variant-name>6465# Host-side build tests66python3 -m unittest discover -s scripts/tests -v6768# Format/check touched files69clang-format -i <files>70clang-format --dry-run -Werror <files>71```7273The build script changes local `sdkconfig` and build state. Do not assume the build directory still represents a previous target.7475## Validation7677- Board-only change: build affected variants and smoke-test changed hardware.78- Core, common-board, audio, protocol, display, dependency, Kconfig, or CMake change: run host tests and build representative affected chip/network paths.79- Protocol changes: verify WebSocket and MQTT/UDP when shared behavior changes.80- Audio changes: verify capture, playback, wake/VAD, interruption, reconnect, and applicable AEC modes.81- UI/assets changes: verify applicable no-display/OLED/LVGL paths and partition size.82- Always report what was tested and what still needs physical hardware. A successful build is not hardware validation.8384## Authoritative Documentation8586- Overview and SDK policy: `README.md`87- SDK compatibility: `docs/esp-idf-6-migration.md`88- Board guide: `docs/custom-board.md`89- Audio design: `main/audio/README.md`90- Code style: `docs/code_style.md`91- Protocols: `docs/websocket.md`, `docs/mqtt-udp.md`, `docs/mcp-protocol.md`92- CI matrix: `.github/workflows/build.yml`9394Keep detailed or fast-changing information in those files, not here. Add a nested `AGENTS.md` only when a subsystem needs specialized instructions.95
Same format, overlapping stack, ranked by quality.
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| vllm-project/vllmAGENTS.md · 89k | AGENTS.md | setuptestlint-formatstyle+5 | 100/100 | 14 days ago | |
| duckduckgo/content-scope-scriptsspecial-pages/AGENTS.md · 70 | AGENTS.md | buildteststylearch+3 | 100/100 | 14 days ago | |
| TryGhost/Ghoste2e/AGENTS.md · 55k | AGENTS.md | setupteststylearch+2 | 100/100 | today | |
| deepseek-ai/deepseek-harnessnative/landlock-run/AGENTS.md · 104k | AGENTS.md | setupteststylearch+3 | 100/100 | today | |
| aaif-goose/gooseAGENTS.md · 53k | AGENTS.md | setupbuildtestlint-format+7 | 100/100 | 8 days ago | |
| n8n-io/n8npackages/@n8n/agents/AGENTS.md · 201k | AGENTS.md | buildteststylearch+3 | 100/100 | 14 days ago | |
| code-yeongyu/oh-my-openagentpackages/web/AGENTS.md · 68k | AGENTS.md | setupbuildtestlint-format+6 | 100/100 | 13 days ago | |
| mui/material-uiAGENTS.md · 99k | AGENTS.md | setupbuildtestlint-format+9 | 100/100 | 14 days ago |
A badge carrying the measured quality of the strongest agent config file in this repository, out of 100. It reads from this index every time somebody loads your page, so it changes when the measurement changes and there is nothing to keep up to date. Free, no account, and the value is not something you or we can set by hand.
[](https://rulestack.kynth.studio/configs/78-xiaozhi-esp32-agents)Would rather not hotlink us? Every badge is also served in shields.io’s endpoint schema, so shields renders the image and your readers never talk to our domain:
Published by Toolproof, the masthead over this index and eight others. The method behind the number is at toolproof.kynth.studio/methodology, and the whole thing is readable as JSON with no key at /api.