diff --git a/.github/workflows/check-build.yml b/.github/workflows/check-build.yml
index ffbde48..4665ede 100644
--- a/.github/workflows/check-build.yml
+++ b/.github/workflows/check-build.yml
@@ -1,4 +1,4 @@
-name: DuckyClaw Check Build
+name: TuyaOpenClaw Check Build
run-name: ${{ github.actor }} triggered build check
on:
push:
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 3c30490..8bf6e12 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -1,4 +1,4 @@
-name: DuckyClaw Release
+name: TuyaOpenClaw Release
run-name: Release ${{ github.ref_name }}
on:
@@ -10,11 +10,11 @@ permissions:
contents: write
env:
- GITEE_REPO: tuya-open/DuckyClaw
+ GITEE_REPO: tuya-open/TuyaOpenClaw
jobs:
sync-gitee:
- if: github.repository == 'tuya/DuckyClaw'
+ if: github.repository == 'tuya/TuyaOpenClaw'
runs-on: ubuntu-latest
steps:
- name: Checkout GitHub code
@@ -126,7 +126,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
gitee-release:
- if: github.repository == 'tuya/DuckyClaw'
+ if: github.repository == 'tuya/TuyaOpenClaw'
runs-on: ubuntu-latest
needs:
- sync-gitee
@@ -174,7 +174,7 @@ jobs:
"tag_name": os.environ["TAG_NAME"],
"target_commitish": os.environ["TARGET_COMMITISH"],
"name": "Release " + os.environ["TAG_NAME"],
- "body": "See release notes at https://github.com/tuya/DuckyClaw/releases/tag/" + os.environ["TAG_NAME"],
+ "body": "See release notes at https://github.com/tuya/TuyaOpenClaw/releases/tag/" + os.environ["TAG_NAME"],
"draft": False,
"prerelease": False,
}))'
diff --git a/AGENTS.md b/AGENTS.md
index 15ecc5d..ded2148 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -1,4 +1,4 @@
-# AGENTS.md — DuckyClaw Project Guide
+# AGENTS.md — TuyaOpenClaw Project Guide
> This file provides project-level context for AI coding assistants and new contributors:
> business logic, technical architecture, directory layout, and coding guidelines.
@@ -7,7 +7,7 @@
## 1. Business Logic
-DuckyClaw is a **hardware-oriented AI agent running on edge devices**. Its core value is enabling users to interact with IoT devices through natural language via IM channels (Telegram / Discord / Feishu). The on-device agent receives instructions, invokes local MCP tools to perform real actions, and replies through the same channel.
+TuyaOpenClaw is a **hardware-oriented AI agent running on edge devices**. Its core value is enabling users to interact with IoT devices through natural language via IM channels (Telegram / Discord / Feishu). The on-device agent receives instructions, invokes local MCP tools to perform real actions, and replies through the same channel.
**Typical user scenarios:**
@@ -69,7 +69,7 @@ DuckyClaw is a **hardware-oriented AI agent running on edge devices**. Its core
1. **Inbound**: IM channel (or WS/cron/ACP) builds an `im_msg_t` → `message_bus_push_inbound()`
2. **Agent consumes**: `agent_loop_task` blocks on `message_bus_pop_inbound()`
3. **Inner loop**: `context_build_system_prompt()` assembles system prompt + history → `ai_agent_send_text()` sends to cloud
-4. **AI callback**: `ducky_claw_chat.c`'s `__ai_chat_handle_event` receives stream events:
+4. **AI callback**: `tuyaopen_claw_chat.c`'s `__ai_chat_handle_event` receives stream events:
- `STREAM_START/DATA/STOP`: accumulate text → record in history
- `END`: calls `agent_loop_set_last_response()` + `agent_loop_notify_turn_done()` (posts semaphore)
5. **Tool execution**: Cloud AI triggers MCP tool call → `__on_tool_executed` hook records result → sets `s_turn.tool_called = true`
@@ -90,7 +90,7 @@ DuckyClaw is a **hardware-oriented AI agent running on edge devices**. Its core
### 2.4 Synchronization
-- **Agent loop ↔ AI callback**: Binary semaphore `s_turn.sem` (`agent_loop_task` waits, `ducky_claw_chat` posts)
+- **Agent loop ↔ AI callback**: Binary semaphore `s_turn.sem` (`agent_loop_task` waits, `tuyaopen_claw_chat` posts)
- **Shared history**: `s_history_mutex` protects `s_history_json` (cJSON array, sliding window ≤ 10 entries)
- **Tool state**: `s_turn.lock` protects `tool_called` / `tool_result`
- **Message bus**: `tal_queue` is inherently thread-safe
@@ -100,7 +100,7 @@ DuckyClaw is a **hardware-oriented AI agent running on edge devices**. Its core
## 3. Directory Layout
```
-DuckyClaw/
+TuyaOpenClaw/ (git repo: tuya/TuyaOpenClaw, a.k.a. Ducky)
├── agent/ # Core agent loop and context builder
│ ├── agent_loop.c/h # Outer + inner tool-iteration loop (semaphore sync)
│ └── context_builder.c/h # System prompt assembly (rules, memory, skills, personality)
@@ -141,7 +141,7 @@ DuckyClaw/
│
├── src/ # Application glue layer
│ ├── tuya_app_main.c # Entry point user_main(), initialization orchestration
-│ ├── ducky_claw_chat.c # AI stream event handling, semaphore bridge to agent_loop
+│ ├── tuyaopen_claw_chat.c # AI stream event handling, semaphore bridge to agent_loop
│ ├── app_im.c # IM init, outbound dispatch, channel switching
│ ├── cli_cmd.c # Extended CLI commands
│ └── reset_netcfg.c # Network config reset logic
@@ -150,7 +150,7 @@ DuckyClaw/
│ ├── tuya_app_config.h # Product ID, channel tokens, gateway config defaults
│ ├── tuya_app_config_secrets.h(.example) # Sensitive credentials (gitignored)
│ ├── app_im.h # IM application interface
-│ └── ducky_claw_chat.h # Chat module interface
+│ └── tuyaopen_claw_chat.h # Chat module interface
│
├── ai_components/ # TuyaOpen AI component adapters (sub-CMake)
├── config/ # Board-level Kconfig snapshots
@@ -176,7 +176,7 @@ user_main()
├── tuya_iot_init() // Tuya IoT client
├── netmgr_init() // Network manager
├── board_register_hardware()
- ├── ducky_claw_chat_init() // Register AI stream event callback
+ ├── tuyaopen_claw_chat_init() // Register AI stream event callback
├── app_im_init() // Subscribe to MQTT connected event (deferred IM init)
├── ws_server_start() // Start WebSocket server
├── tool_registry_init() // Subscribe to MQTT connected → one-shot MCP tool chain init
diff --git a/CLAUDE.md b/CLAUDE.md
index 95fc64f..3f29ab4 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -4,11 +4,11 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
## Project Overview
-DuckyClaw is a hardware-oriented AI agent built on the TuyaOpen C SDK. It runs a Claw-style agent loop on edge devices (Tuya T5AI, ESP32, Raspberry Pi, Linux) that communicates with users via IM channels (Telegram, Discord, Feishu) and executes MCP-style tools on the device.
+TuyaOpenClaw is a hardware-oriented AI agent built on the TuyaOpen C SDK. It runs a Claw-style agent loop on edge devices (Tuya T5AI, ESP32, Raspberry Pi, Linux) that communicates with users via IM channels (Telegram, Discord, Feishu) and executes MCP-style tools on the device.
## Build Commands
-DuckyClaw builds as a TuyaOpen application. From the repo root:
+TuyaOpenClaw builds as a TuyaOpen application. From the repo root:
```bash
# Initialize TuyaOpen environment (creates .venv, exports OPEN_SDK_ROOT)
@@ -20,7 +20,7 @@ cp config/RaspberryPi.config app_default.config # Raspberry Pi
cp config/TUYA_T5AI_BOARD_LCD_3.5_CAMERA.config app_default.config # Tuya T5AI
cp config/ESP32S3_BREAD_COMPACT_WIFI.config app_default.config # ESP32-S3
-# Build (from TuyaOpen directory, pointing to DuckyClaw as the app)
+# Build (from TuyaOpen directory, pointing to TuyaOpenClaw as the app)
cd TuyaOpen
python3 tos.py build
@@ -48,7 +48,7 @@ The secrets file is gitignored. Defaults live in `include/tuya_app_config.h`.
The core is a synchronous outer+inner loop in `agent_loop.c`:
- **Outer loop**: blocks on `message_bus_pop_inbound()` waiting for user messages from any IM channel
- **Inner loop** (up to `TOOL_LOOP_MAX=10` iterations): sends prompt to cloud AI via `ai_agent_send_text()`, blocks on a semaphore until the AI turn completes, checks if a tool was called, and either loops (feeding tool result back) or forwards the final response to IM
-- Synchronization: `ducky_claw_chat.c` receives streaming AI events and calls `agent_loop_notify_turn_done()` on `AI_USER_EVT_END`
+- Synchronization: `tuyaopen_claw_chat.c` receives streaming AI events and calls `agent_loop_notify_turn_done()` on `AI_USER_EVT_END`
- Tool results are captured by `__on_tool_executed` hook (registered via `ai_mcp_server_set_tool_exec_hook`)
### Context Builder (`agent/context_builder.c`)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 60f363b..f8f8a45 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -84,17 +84,17 @@ if(_APP_NEW_LIBS)
endif()
########################################
-# DuckyClaw ai_components overlay
+# TuyaOpenClaw ai_components overlay
########################################
# Surgically replace individual translation units inside the upstream
# TuyaOpen ai_components library targets (ai_mcp, ai_agent) with
-# DuckyClaw-side patches kept under overlay/. The SDK submodule stays
+# TuyaOpenClaw-side patches kept under overlay/. The SDK submodule stays
# pristine; only this app's CMake graph diverges. TuyaOpen processes
# src/ai_components/ before this file is `include`d, so the upstream targets
# already exist when we reach here.
#
# Note: ai_main and ai_audio used to be overlayed too, but those diffs have
-# been folded back into upstream / proven trivial — DuckyClaw now consumes
+# been folded back into upstream / proven trivial — TuyaOpenClaw now consumes
# them straight from TuyaOpen/src/ai_components/ai_{main,audio}/.
set(_DC_OVERLAY ${APP_PATH}/overlay/ai_components)
@@ -135,7 +135,7 @@ endfunction()
# the lib's own CMakeLists BEFORE our overlay ran, so EXAMPLE_LIB also needs
# the overlay path explicitly — otherwise app sources that compile into
# EXAMPLE_LIB (agent_loop.c, ducky_claw_chat.c, app_im.c, …) keep seeing the
-# upstream headers without DuckyClaw's added declarations.
+# upstream headers without TuyaOpenClaw's added declarations.
foreach(_lib_hdir ai_mcp ai_agent)
if(TARGET ${_lib_hdir})
target_include_directories(${_lib_hdir} BEFORE PUBLIC ${_DC_OVERLAY}/${_lib_hdir}/include)
diff --git a/Kconfig b/Kconfig
index 68ef2a7..0bc403e 100644
--- a/Kconfig
+++ b/Kconfig
@@ -1,4 +1,4 @@
-menu "configure app (DuckyClaw) "
+menu "configure app (TuyaOpenClaw) "
config SYS_BUS_OUTBOUND_STACK_SIZE
int "SYS bus outbound thread stack size (bytes)"
@@ -12,20 +12,20 @@ menu "configure app (DuckyClaw) "
help
Stack size in bytes for the IM bridge thread (default 4*1024).
-config DUCKYCLAW_USE_AI_COMPONENTS
+config TUYAOPENCLAW_USE_AI_COMPONENTS
bool
default y
select ENABLE_AI_COMPONENTS
-# DuckyClaw moves large app-level buffers (acp_client / ws_server / IM dedup rings)
+# TuyaOpenClaw moves large app-level buffers (acp_client / ws_server / IM dedup rings)
# from static .bss into PSRAM heap via claw_malloc / im_calloc, which only does
# anything when ENABLE_EXT_RAM is on at the SDK level. Some board Kconfigs
# (e.g. ESP32S3_BREAD_COMPACT_WIFI in upstream TuyaOpen) don't `select
-# ENABLE_EXT_RAM` on their own — opt into it from the app side so DuckyClaw
+# ENABLE_EXT_RAM` on their own — opt into it from the app side so TuyaOpenClaw
# doesn't have to patch the submodule. Boards that already select it
# (DNESP32S3 family, WAVESHARE_ESP32S3, T5AI variants with PSRAM) are unaffected.
-config DUCKYCLAW_USE_EXT_RAM
- bool "DuckyClaw: enable external PSRAM heap"
+config TUYAOPENCLAW_USE_EXT_RAM
+ bool "TuyaOpenClaw: enable external PSRAM heap"
default y
select ENABLE_EXT_RAM
help
diff --git a/README.md b/README.md
index aee043d..b93c5f6 100644
--- a/README.md
+++ b/README.md
@@ -1,139 +1,190 @@
-# DuckyClaw: Hardware-Driven OpenClaw Project
+# TuyaOpenClaw
-DuckyClaw is a hardware oriented version of the OpenClaw. The Ideas is to explore the physical hardware with the powerful concept of OpenClaw agents.
+> **Ducky** — TuyaOpen's hardware mascot — runs the Claw on every board.
+> *(Formerly known as DuckyClaw.)*
+
+TuyaOpenClaw is a hardware-oriented AI agent built on the TuyaOpen C SDK. It runs a Claw-style agent loop on edge devices (Tuya T5AI, ESP32, Raspberry Pi, Linux) that communicates with users via IM channels (Telegram, Discord, Feishu, WeChat, QQ Bot) and executes MCP-style tools directly on the device.
## Deployable to Hardware
| Category | Models/Platforms |
|----------|-----------------|
-| **MCUs** | - Tuya T5AI Module
- ESP32s |
-| **SoCs** | - Raspberry Pi 4/5/CM4/CM5
- Linux ARM SoCs (Qualcomm/Rockchip/Allwinner etc...) |
-| **PCs** | - Linux Ubuntu |
+| **MCUs** | Tuya T5AI Module (ATK, Waveshare, variants), ESP32-S3 |
+| **SoCs** | Raspberry Pi 4/5/CM4/CM5, DshanPi, Linux ARM SoCs (Qualcomm/Rockchip/Allwinner etc.) |
+| **PCs** | Linux Ubuntu (x64) |
---
+This project is built on top of the TuyaOpen C SDK, which offers flexible cross ARM Cortex-M and ARM Cortex-A, and even x64 PC deployments. It also offers a wide variety of ready-to-use hardware drivers and APIs, making integrating new hardware and peripherals as easy as building blocks (sensors, displays, speaker-mic audio, cameras, IoT cloud integrations).
-
-
-This project is build on top of the the TuyaOpen C SDK, which offers flexable cross ARM Cortex-M and ARM Cortex-A, and event x64 PC deployments. And also offers wide varierity ready-to-use hardware drivers and API. Makeing integreating new hardware and peferials as easy as building blocks. (Sensors, Displays, Speaker-Mic Audio, Cameras, to IoT cloud integreations)
-
-
-
-
-
+
**Your autonomous AI companion.** Simplify Hardware Integration, Unlock Infinite Control Possibilities
-
> [!WARNING]
-> **🚧 Under Active Development** - This project is in heavy development and things will break. Running it now may spoil the experience we're building for you. Please visit or open Issues if you encountered any problem.
+> **🚧 Under Active Development** — This project is in heavy development and things will break. Running it now may spoil the experience we're building for you. Please visit or open Issues if you encounter any problem.
-## ❓ Why DuckyClaw?
-Most AI agent frameworks are powerful but cumbersome. They often come with costly subscriptions, complicated setups, and are layered on top of other frameworks and APIs. DuckyClaw offers a different path.
+## ❓ Why TuyaOpenClaw?
+Most AI agent frameworks are powerful but cumbersome. They often come with costly subscriptions, complicated setups, and are layered on top of other frameworks and APIs. TuyaOpenClaw offers a different path.
-Built on a commercial-grade device–cloud AI agent foundation, DuckyClaw uniquely fuses on-device agents with the power of the cloud.
+Built on a commercial-grade device–cloud AI agent foundation, TuyaOpenClaw uniquely fuses on-device agents with the power of the cloud.
With a single TuyaOpen Key, you gain seamless access to the Tuya Cloud Platform and its next-generation device–cloud AI agents.
-It’s lightweight and effortlessly deployable to almost any edge hardware. From WIFI connected MCUs to System on Chip ARM, to PC Ubuntus.
+It's lightweight and effortlessly deployable to almost any edge hardware — from WiFi-connected MCUs to ARM SoCs to PC Ubuntu.
-| | DuckyClaw | OpenClaw / MimiClaw / others |
+| | TuyaOpenClaw | OpenClaw / MimiClaw / others |
|---|---|---|
-| **Architecture** | Hardware-oriented OpenClaw on TuyaOpen C SDK; device–cloud fusion | OpenClaw: Node.js, 24/7 desktop/server agent. MimiClaw: bare-metal C on ESP32-S3 only. Others: framework stacks (Pi, Claude Code, etc.) |
-| **Deployment** | MCUs (Tuya T5AI, ESP32s), SoCs (RPi 4/5, ARM Linux), PC (Ubuntu); one codebase | OpenClaw: Mac mini, Pi, VPS. MimiClaw: single $5 ESP32-S3. Others: server/desktop only, no edge MCU |
-| **Runtime** | TuyaOpen C; cross ARM Cortex-M, ARM Cortex-A, x64; no Node on MCU | OpenClaw: Node.js. MimiClaw: no OS, no Node. Others: Node.js 22+, pnpm, full OS |
-| **Device–cloud** | One TuyaOpen key → Tuya Cloud Platform + device; built-in device-cloud AI | OpenClaw: self-hosted, optional API subs. MimiClaw: local-only (SOUL.md, USER.md, MEMORY.md). Others: cloud-only or DIY |
-| **Channels** | Telegram, Discord, Feishu via unified IM component (message bus, proxy, TLS) | OpenClaw: WhatsApp, Telegram, Discord, iMessage, Slack, etc. MimiClaw: Telegram, WebSocket, serial CLI. Others: terminal or separate UI |
-| **Memory** | MEMORY.md + daily notes (YYYY-MM-DD.md); session manager; ported from MimiClaw-style store | OpenClaw: 24/7 persistent context, Obsidian/Raycast. MimiClaw: on-device MEMORY.md. Others: flat conversation history |
-| **Tools** | CRON, FILE, IoT device control (Tuya); EXEC (RPi) planned; MCP-style device tools | OpenClaw: browser automation, cron, ClawHub skills. MimiClaw: ReAct + web search, time, OTA, GPIO. Others: ad-hoc or single provider |
-| **✨ Setup** | Single TuyaOpen key; pick board (T5AI/ESP32/RPi/Linux), configure IM tokens | OpenClaw: Gateway, OAuth, multi-step. MimiClaw: flash firmware, API keys. Others: complex onboarding, many deps |
+| **Architecture** | Hardware-oriented Claw agent on TuyaOpen C SDK; device–cloud fusion | OpenClaw: Node.js, 24/7 desktop/server agent. MimiClaw: bare-metal C on ESP32-S3 only. Others: framework stacks (Pi, Claude Code, etc.) |
+| **Deployment** | MCUs (Tuya T5AI, ESP32-S3), SoCs (RPi 4/5, ARM Linux), PC (Ubuntu x64); one codebase | OpenClaw: Mac mini, Pi, VPS. MimiClaw: single $5 ESP32-S3. Others: server/desktop only, no edge MCU |
+| **Runtime** | TuyaOpen C; ARM Cortex-M, Cortex-A, x64; no Node on MCU | OpenClaw: Node.js. MimiClaw: no OS, no Node. Others: Node.js 22+, pnpm, full OS |
+| **Device–cloud** | One TuyaOpen key → Tuya Cloud Platform + device; built-in device-cloud AI | OpenClaw: self-hosted, optional API subs. MimiClaw: local-only. Others: cloud-only or DIY |
+| **Channels** | Telegram, Discord, Feishu, WeChat (iLink), QQ Bot — unified via message bus + TLS proxy | OpenClaw: WhatsApp, Telegram, Discord, iMessage, Slack, etc. MimiClaw: Telegram, WebSocket, serial CLI |
+| **Memory** | MEMORY.md + daily notes (YYYY-MM-DD.md); session manager (JSONL); persistent across reboots | OpenClaw: 24/7 persistent context, Obsidian/Raycast. MimiClaw: on-device MEMORY.md. Others: flat conversation history |
+| **MCP Tools** | CRON, FILE, EXEC (RPi/Linux), HW (GPIO/I2C/PWM), Lua scripting, OpenClaw gateway ctrl | OpenClaw: browser automation, cron, ClawHub skills. MimiClaw: ReAct + web search, time, OTA, GPIO. Others: ad-hoc or single provider |
+| **✨ Setup** | Single TuyaOpen key; pick board config, configure IM tokens | OpenClaw: Gateway, OAuth, multi-step. MimiClaw: flash firmware, API keys. Others: complex onboarding |
| **✨ Cost** | Low cost; unified key access to services | OpenClaw/MimiClaw: bring your own Claude/OpenAI. Others: Claude Pro/Max ($20–200/mo) or API-heavy |
-| **✨ Device IoT Control** | Native device and IoT control, controlling other device in the ecosystem (over TuyaOpen/embedded protocols) | ❌ (typically no built-in device control) |
-| **✨ Voice (ASR) Input** | Hardware voice input (ASR) supported on select boards | ❌ (voice input not natively supported) |
+| **✨ IoT Control** | Native device and IoT control via Tuya ecosystem | ❌ (typically no built-in device control) |
+| **✨ Voice (ASR)** | Hardware voice input (ASR) supported on select boards | ❌ (voice input not natively supported) |
+| **✨ Lua Scripting** | Sandboxed Lua 5.5 runtime with GPIO/delay modules; write agent skills in Lua | ❌ |
## 💡 Philosophy
-DuckyClaw is inspired by the vision of making personal AI accessible, practical, and genuinely helpful—rooted not in corporate tools, but in the idea of an always-there companion that intuitively fits into your daily life and hardware. The project’s name and mascot of Cute Duck from Tuya, embrace the spirit of resourceful, adaptive creatures of Claw.
+**Ducky is TuyaOpen's hardware mascot** — a duck that thrives in any environment, from the tiniest MCU to a full desktop Linux box. TuyaOpenClaw inherits that spirit: one codebase, every board, zero compromise.
-**Why a duck and a claw?** Ducks are omnipresent, adaptable, and thrive in almost any environment—just like DuckyClaw’s software, which you can deploy from microcontrollers to desktop Linux. The "claw" symbolizes precision, dexterity, and direct command over both your real-world devices and digital agents. With TuyaOpen, hardware integration is much more flexible, allowing you to easily connect a wide range of hardware features and capabilities directly into your agent. This project isn’t about replacing people—it’s about building a dependable, always-learning, always-improving companion you fully control with real-life hardware interfaces.
+The name tells the whole story. **TuyaOpen** is the foundation — the commercial-grade C SDK that bridges chip-level hardware, IoT cloud, and AI in a single unified key. **Claw** is the agent paradigm — the loop of reasoning, tool use, and action borrowed from OpenClaw, adapted for the physical world. Put Ducky in the middle and you get an always-on hardware companion that gets smarter the more you use it.
+**Why a duck and a claw?** Ducks are omnipresent, adaptable, and thrive in almost any environment — just like TuyaOpenClaw's software, which you can deploy from microcontrollers to desktop Linux. The "claw" symbolizes precision, dexterity, and direct command over both your real-world devices and digital agents. With TuyaOpen, hardware integration is much more flexible, allowing you to easily connect a wide range of hardware features and capabilities directly into your agent.
### Core Principles
-- **Personal-first, not enterprise.** DuckyClaw is made for individuals and makers. Your workflows and day-to-day life come first, no bureaucracy or corporate bloat.
-- **Lean core, plugin power.** Everything outside the essential C core—channels, providers, tools—is a plugin you can swap and extend.
-- **Self-tuning and adaptive.** Learns via real episode memory and periodic self-review, with memory fading that helps it stay relevant.
-- **IoT control memory.** DuckyClaw remembers device states, actions, and preferences as part of IoT_MEMORY.md, allowing it to build a rich contextual history of your devices and interactions. Of how you control other devices in the Tuya ecosystem. This lets the agent adapt to your automation routines, device quirks, and personal preferences over time—enabling smarter, more intuitive IoT control that gets better the more you use it.
+- **Personal-first, not enterprise.** TuyaOpenClaw is made for individuals and makers. Your workflows and day-to-day life come first — no bureaucracy or corporate bloat.
+- **Lean core, plugin power.** Everything outside the essential C core — channels, providers, tools — is a plugin you can swap and extend.
+- **Self-tuning and adaptive.** Learns via real episode memory and periodic self-review, with memory fading that keeps it relevant.
- **Config by conversation.** No thick config files: set up and modify your agent simply by chatting, both on hardware and in the cloud.
-- **Distinctive personality.** Each instance has its own configuration and optional Hardware layer for characterful, helpful responses.
+- **Distinctive personality.** Each instance has its own SOUL.md configuration and optional hardware layer for characterful, helpful responses.
- **Builds natively on C/TuyaOpen.** No Node, no Python frameworks glued on. Built from scratch for the boards and platforms you actually use.
-- **Rapid to start.** Requires just a TuyaOpen key. Choose models and providers as needed—switch between them with the messaging interface anytime.
-- **Unified model access.** With a single TuyaOpen API Access Key, you can tap into the latest models from GPT, Claude, Deepseek, Qwen, and more—choose the best model for each task, all seamlessly hosted and managed by Tuya.
-- **Device and Cloud AI Agents.** DuckyClaw is natively built to support both agents that run locally on your device (“device agents”) and those that operate in Claw like manner the cloud (“cloud agents”). This hybrid architecture enables on-device actions, voice, and IoT control while also providing access to advanced cloud intelligence, remote coordination, and online skills, MCPs. You can configure, blend, or move workloads fluidly between device and cloud—giving you the flexibility to optimize for speed, privacy, and power as you choose.
+- **Rapid to start.** Requires just a TuyaOpen key. Choose models and providers as needed — switch between them with the messaging interface anytime.
+- **Unified model access.** With a single TuyaOpen API Access Key, you can tap into the latest models from GPT, Claude, Deepseek, Qwen, and more — all seamlessly hosted and managed by Tuya.
+- **Device and Cloud AI Agents.** Natively supports both agents that run locally on your device ("device agents") and those that operate in the cloud ("cloud agents"). On-device actions, voice, and IoT control work alongside cloud intelligence and online MCPs.
+
## ✨ Features
-- **Unified Messaging Input:**
- Seamless integration with WhatsApp, Telegram, Feishu, and more through a unified proxy IM interface.
+- **5 IM Channels:**
+ Telegram, Discord, Feishu, WeChat (iLink), and QQ Bot — all through a unified message bus and TLS HTTP proxy, no channel-specific code in the agent loop.
+
+- **Device–Cloud Hybrid AI Agent:**
+ Centralized AI agent powered by TuyaOpen, enabling both on-device and cloud-based actions with the Claw mechanism (outer loop for messages, inner tool loop up to 10 iterations).
+
+- **6 MCP-Style Device Tools:**
+ - **CRON:** Scheduled device tasks, reminders, and cron job management.
+ - **FILE:** File read/write/edit/list on SD card or flash filesystem.
+ - **EXEC:** Remote code execution on Raspberry Pi / Linux (spawn shell commands from chat).
+ - **HW:** Hardware peripheral control — GPIO, I2C, PWM directly from agent instructions.
+ - **Lua Scripting:** Sandboxed Lua 5.5 runtime; write and run scripts via chat. Modules: GPIO, delay, safe OS APIs.
+ - **OpenClaw Ctrl:** Gateway control for bridging device agent with OpenClaw / PC agents.
-- **Device–Cloud Hybrid AI Agent:**
- Centralized AI agent powered by TuyaOpen, enabling both on-device and cloud-based actions with the Claw mechanism.
+- **Persistent Memory:**
+ Long-term memory in `MEMORY.md`, daily notes in `YYYY-MM-DD.md`, personality in `SOUL.md`, user profile in `USER.md` — all stored on flash/SD and loaded each turn.
-- **IoT Device Control:**
- Native control and management of Tuya IoT smart devices directly from the agent.
+- **Session Manager:**
+ JSONL-based session persistence across reboots. Picks up conversations where they left off.
-- **Music Playback & Audio Features:**
- Built-in music player.
+- **Skills System:**
+ Agent skills are `.md` files in `skills/`. The agent reads a summary each turn and loads full skill files on demand via the `read_file` tool.
-- **Hardware Voice ASR**
- Audio input with Automatic Speech Recognition (ASR)
+- **Build-Time Overlay:**
+ `overlay/ai_components/` surgically patches `ai_agent` and `ai_mcp` without modifying the TuyaOpen SDK submodule — keeping upstream clean.
-- **MCP Device Tools:**
- - **CRON Tool MCP:** Scheduled device tasks and heartbeating.
- - **FILE Tool MCP:** File operations and management on supported devices.
- - **IoT Device Control Tool MCP:** Advanced management for Tuya-connected devices.
- - **EXEC Tool MCP:** Remote code execution/injection on Raspberry Pi
+- **PSRAM Support:**
+ `claw_malloc`/`claw_free` wrappers automatically route allocations to external PSRAM when available, enabling large context buffers on T5AI boards.
-- **Additional Capabilities:**
- - SD Card storage support
- - Persistent memory via local `Agent.txt` and `memory.txt`
- - Flexible Gateway switching for device/cloud agent handoff
- - Simple CLI for Tuya authentication and messaging setup
-
+- **Hardware Voice ASR:**
+ Audio input with Automatic Speech Recognition supported on select T5AI boards with microphone hardware.
+- **SD Card & Filesystem:**
+ Persistent storage for memory, skills, sessions, and agent-generated files.
+
+- **Local CLI:**
+ Serial/local CLI for setup and debugging without IM connectivity.
## 🏛️ Architecture

-The DuckyClaw architecture combines local device agents and cloud agents under a unified system. At its core, it uses the TuyaOpen AI-Agent framework to handle messaging, automation, and control. Local hardware (like Raspberry Pi, ESP32, or Linux devices) runs its own Claw like loop agent, able to communicate directly with your devices via IoT and hardware interfaces.
+The TuyaOpenClaw architecture combines local device agents and cloud agents under a unified system. At its core, it uses the TuyaOpen AI-Agent framework to handle messaging, automation, and control. Local hardware (Raspberry Pi, ESP32, T5AI, or Linux) runs a Claw-style agent loop, communicating with users via IM channels and executing MCP tools directly on-device.
+
+**Agent loop flow:**
+1. Outer loop blocks on `message_bus_pop_inbound()` — waits for any IM message
+2. Context builder assembles system prompt (SOUL.md, USER.md, MEMORY.md, recent daily notes, skills summary, conversation history)
+3. Inner tool loop (up to 10 iterations): sends prompt → waits for AI turn → checks tool call → feeds result back → repeats until final answer
+4. Final response is pushed back through the message bus to the originating IM channel
## 🚀 Quick Start
-### Install
+### Clone
```shell
-git clone https://github.com/tuya/DuckyClaw.git
-cd DuckyClaw
+git clone https://github.com/tuya/TuyaOpenClaw.git
+cd TuyaOpenClaw
git submodule update --init
```
-### Development
-- Tuya T5 MCU Guide: [DuckyClaw Quick Start (T5-AI)](https://tuyaopen.ai/docs/duckyclaw/ducky-quick-start-T5AI)
-- Raspberry Pi Guide: [DuckyClaw Quick Start (raspberry pi 5)](https://tuyaopen.ai/docs/duckyclaw/ducky-quick-start-raspberry-pi-5)
-- ESP32 MCU Guide: [DuckyClaw Quick Start (ESP32-S3)](https://tuyaopen.ai/docs/duckyclaw/ducky-quick-start-ESP32S3)
+### Configure Secrets
+
+```shell
+cp include/tuya_app_config_secrets.h.example include/tuya_app_config_secrets.h
+# Edit the file and fill in:
+# TUYA_PRODUCT_ID, TUYA_OPENSDK_UUID, TUYA_OPENSDK_AUTHKEY (Tuya cloud credentials)
+# IM_SECRET_CHANNEL_MODE and matching channel tokens (Feishu/Telegram/Discord/WeChat/QQ Bot)
+# CLAW_WS_AUTH_TOKEN, OPENCLAW_GATEWAY_* (gateway config, if using)
+```
+
+### Select a Board Config
+
+```shell
+# Tuya T5AI dev board (3.5" LCD + camera)
+cp config/TUYA_T5AI_BOARD_LCD_3.5_CAMERA.config app_default.config
+
+# Other supported boards:
+# cp config/ATK_T5AI_MINI_BOARD_2.4LCD_CAMERA.config app_default.config
+# cp config/WAVESHARE_T5AI_TOUCH_AMOLED_1_75.config app_default.config
+# cp config/DshanPi_A1.config app_default.config
+# cp config/TUYA_T5AI_CORE.config app_default.config
+# cp config/RaspberryPi.config app_default.config
+# cp config/ESP32S3_BREAD_COMPACT_WIFI.config app_default.config
+```
+
+### Build
+```shell
+# Initialize TuyaOpen environment (creates .venv, sets up toolchains)
+. ./TuyaOpen/export.sh
+
+# Build (skip interactive platform update prompts)
+mkdir -p TuyaOpen/.cache && touch TuyaOpen/.cache/.dont_prompt_update_platform
+tos.py build
+```
+
+Output goes to the `dist/` directory.
-## 🔌 Plugin/Skills Development
+### Development Guides
+- Tuya T5AI: [TuyaOpenClaw Quick Start (T5-AI)](https://tuyaopen.ai/docs/duckyclaw/ducky-quick-start-T5AI)
+- Raspberry Pi: [TuyaOpenClaw Quick Start (Raspberry Pi 5)](https://tuyaopen.ai/docs/duckyclaw/ducky-quick-start-raspberry-pi-5)
+- ESP32-S3: [TuyaOpenClaw Quick Start (ESP32-S3)](https://tuyaopen.ai/docs/duckyclaw/ducky-quick-start-ESP32S3)
-**Skill format**: Skills are `.md` files in the `skills/` directory. The agent gets a summary of them and follows the instructions. Use this structure:
+
+## 🔌 Skills Development
+
+Skills are `.md` files in the `skills/` directory. The agent gets a summary of available skills and loads the full text on demand using the `read_file` tool. Use this structure:
```markdown
# Skill Title
@@ -152,61 +203,81 @@ When the user asks about X / when Y happens.
User: "…" → use get_current_time, then web_search "…", then reply "…"
```
-Add skills: put a new `name.md` in the skills dir (e.g. via the `write_file` tool), or add built-ins in `skills/skill_loader.c`. See existing skills there for examples.
+Add skills: put a new `name.md` in the `skills/` directory (e.g., via the `write_file` tool from chat), or register built-in skills in `skills/skill_loader.c`.
+
## 📁 Project Structure
```
-DuckyClaw/
-├── agent/ # Agent core logic
-│ ├── agent_loop.c/h # Claw-style agent loop (reasoning, tool calls, context)
-│ └── context_builder.c/h # Dialogue and system context building
-├── config/ # Board/platform configs (Kconfig selection)
-│ ├── TUYA_T5AI_BOARD_LCD_3.5_CAMERA.config # Tuya T5AI dev board
-│ ├── RaspberryPi.config # Raspberry Pi
-│ └── ESP32S3_BREAD_COMPACT_WIFI.config # ESP32-S3
-├── heartbeat/ # Scheduled heartbeat and keepalive
+TuyaOpenClaw/
+├── agent/ # Agent core logic
+│ ├── agent_loop.c/h # Claw-style outer+inner loop (tool use, context, semaphore sync)
+│ └── context_builder.c/h # Assembles system prompt each turn
+├── components/
+│ └── lua/ # Embedded Lua 5.5 sandboxed runtime
+│ ├── lua/ # Lua 5.5 core sources (vendored)
+│ ├── port/ # TuyaOpenClaw glue: sandbox init, runtime, module registry
+│ └── modules/ # Hardware Lua modules (gpio, delay)
+├── config/ # Board/platform Kconfig selections
+│ ├── TUYA_T5AI_BOARD_LCD_3.5_CAMERA.config # Tuya T5AI 3.5" LCD + camera
+│ ├── TUYA_T5AI_BOARD_LCD_3.5_CAMERA(NO_SDCARD).config
+│ ├── TUYA_T5AI_CORE.config # Tuya T5AI core (no display)
+│ ├── ATK_T5AI_MINI_BOARD_2.4LCD_CAMERA.config # ATK 2.4" LCD variant
+│ ├── WAVESHARE_T5AI_TOUCH_AMOLED_1_75.config # Waveshare 1.75" AMOLED
+│ ├── DshanPi_A1.config # DshanPi A1
+│ ├── RaspberryPi.config # Raspberry Pi (Linux)
+│ └── ESP32S3_BREAD_COMPACT_WIFI.config # ESP32-S3 breadboard
+├── cron_service/ # Background cron scheduler (fires cron jobs)
+│ └── cron_service.c/h
+├── gateway/ # WebSocket gateway integration
+│ ├── ws_server.c/h # Local WebSocket server
+│ └── acp_client.c/h # ACP client → OpenClaw gateway
+├── heartbeat/ # Periodic heartbeat keepalive
│ └── heartbeat.c/h
-├── IM/ # Unified messaging layer (message bus + channels)
-│ ├── bus/ # Message bus (message_bus)
-│ ├── channels/ # Telegram / Discord / Feishu channels
-│ ├── proxy/ # HTTP proxy (TLS, cloud connectivity)
-│ ├── cli/ # Serial/local CLI
-│ ├── certs/ # Certificates and TLS config
-│ ├── im_api.h / im_platform.h / im_config.h
-│ └── README.md # IM component docs
-├── include/ # App-level public headers
-│ ├── app_im.h / ducky_claw_chat.h / tuya_app_config.h
-│ └── reset_netcfg.h
-├── memory/ # Persistent memory and sessions
-│ ├── memory_manager.c/h # Agent.txt, memory.txt, IoT memory, etc.
-│ └── session_manager.c/h
-├── src/ # App entry and business logic
-│ ├── tuya_app_main.c # TuyaOpen app entry, init, event loop
-│ ├── ducky_claw_chat.c # Chat flow, device/cloud agent dispatch
-│ ├── app_im.c # IM–Agent bridge
-│ ├── cli_cmd.c # CLI and config (auth, IM setup, etc.)
-│ └── reset_netcfg.c # Network config reset
-├── tools/ # MCP-style device tools
-│ ├── tool_cron.c/h # CRON scheduling and heartbeat
-│ ├── tool_files.c/h # FILE operations
-│ ├── tools_register.c/h # Tool registration and dispatch
-│ └── Kconfig
-├── dist/ # Build output (e.g. DuckyClaw_1.0.x)
-├── app_default.config # Default Kconfig
-└── TuyaOpen/ # TuyaOpen C SDK submodule (platform, drivers, cloud, AI, etc.)
+├── IM/ # Unified messaging layer
+│ ├── bus/ # Thread-safe message bus (inbound/outbound queues)
+│ ├── channels/ # Telegram, Discord, Feishu, WeChat (iLink), QQ Bot
+│ ├── proxy/ # TLS HTTP proxy for cloud IM APIs
+│ ├── cli/ # Local serial CLI input channel
+│ └── certs/ # TLS certificates
+├── include/ # App-level public headers
+│ ├── tuya_app_config.h # Default config (device ID, IM mode, etc.)
+│ └── tuya_app_config_secrets.h.example # Secrets template (gitignored when filled)
+├── memory/ # Persistent memory and sessions
+│ ├── memory_manager.c/h # MEMORY.md, daily notes, SOUL.md, USER.md on flash/SD
+│ └── session_manager.c/h # JSONL session persistence
+├── overlay/
+│ └── ai_components/ # Build-time patches for ai_agent and ai_mcp (SDK stays clean)
+├── skills/ # Agent skill definitions and loader
+│ └── skill_loader.c/h # Scans skills/, builds summary for system prompt
+├── src/ # App entry and business logic
+│ ├── tuya_app_main.c # TuyaOpen app entry, init, event loop
+│ ├── tuyaopen_claw_chat.c # AI stream event bridge (notifies agent loop on turn end)
+│ ├── app_im.c # IM–Agent bridge
+│ └── app_cli_cmd.c # CLI and runtime config commands
+├── tools/ # MCP-style device tools
+│ ├── tool_cron.c/h # CRON: schedule tasks and reminders
+│ ├── tool_files.c/h # FILE: read/write/edit/list on device filesystem
+│ ├── tool_exec.c/h # EXEC: shell command execution (Linux/RPi only)
+│ ├── tool_hw.c/h # HW: GPIO, I2C, PWM hardware control
+│ ├── tool_lua.c/h # LUA: run sandboxed Lua 5.5 scripts
+│ ├── tool_openclaw_ctrl.c/h # OpenClaw gateway control
+│ └── tools_register.c/h # MCP server init and tool registration
+├── app_default.config # Active Kconfig (copy from config/ before building)
+├── CMakeLists.txt # Build graph (overlay logic, Lua component, IM component)
+└── TuyaOpen/ # TuyaOpen C SDK submodule (platform, drivers, cloud, AI)
```
## 🐛 Issues
-Please report any issues and bugs by [creating a new issue here](https://github.com/tuya/DuckyClaw/issues), also make sure you're reporting an issue that doesn't exist. Any help to improve the project would be appreciated. Thanks! 🙏✨
+Please report any issues and bugs by [creating a new issue here](https://github.com/tuya/TuyaOpenClaw/issues), also make sure you're reporting an issue that doesn't exist. Any help to improve the project would be appreciated. Thanks! 🙏✨
## 🙏🙏🙏 Follow us
Like this project? Leave a star! ⭐⭐⭐⭐⭐
-This project wouldn't be possible without the amazing TuyaOpen Open Source AI-Agent framework. It makes AI-Agent integreation really easy
+This project wouldn't be possible without the amazing TuyaOpen Open Source AI-Agent framework. It makes AI-Agent integration really easy.
@@ -217,15 +288,14 @@ This project wouldn't be possible without the amazing TuyaOpen Open Source AI-Ag
This project is licensed under the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0).
## 👥 Credits
-- [TuyaOpen](https://github.com/tuya/TuyaOpen/) -
-This project is build on top of this amazing hardware AIoT OS call TuyaOpen.
-- [OpenClaw](https://github.com/openclaw/openclaw) — original idea and inspiration
-- [MimiClaw](https://github.com/memovai/mimiclaw) - original inspiration of ESP32 local agent and skills
+- [TuyaOpen](https://github.com/tuya/TuyaOpen/) — This project is built on top of this amazing hardware AIoT OS called TuyaOpen.
+- [OpenClaw](https://github.com/openclaw/openclaw) — Original idea and inspiration.
+- [MimiClaw](https://github.com/memovai/mimiclaw) — Original inspiration for ESP32 local agent and skills.
## 📝 Author
-This project is created by [TuyaOpen Team](https://tuyaopen.ai/), with the help of awesome [contributors](https://github.com/tuya/DuckyClaw/graphs/contributors)
+This project is created by [TuyaOpen Team](https://tuyaopen.ai/), with the help of awesome [contributors](https://github.com/tuya/TuyaOpenClaw/graphs/contributors).
-[](https://github.com/tuya/duckyclaw/graphs/contributors)
+[](https://github.com/tuya/TuyaOpenClaw/graphs/contributors)
---
diff --git a/README_zh.md b/README_zh.md
new file mode 100644
index 0000000..0388232
--- /dev/null
+++ b/README_zh.md
@@ -0,0 +1,301 @@
+# TuyaOpenClaw
+
+> **Ducky** —— TuyaOpen 的硬件吉祥物 —— 在每一块板子上运行 Claw。
+> *(前身为 DuckyClaw。)*
+
+TuyaOpenClaw 是基于 TuyaOpen C SDK 构建的硬件导向 AI Agent。它在边缘设备(Tuya T5AI、ESP32、Raspberry Pi、Linux)上运行 Claw 风格的 Agent 循环,通过 IM 通道(Telegram、Discord、飞书、微信、QQ 机器人)与用户通信,并直接在设备端执行 MCP 风格的工具调用。
+
+## 支持的硬件
+
+| 类型 | 型号 / 平台 |
+|------|------------|
+| **MCU** | Tuya T5AI 模组(ATK、Waveshare 等变体),ESP32-S3 |
+| **SoC** | Raspberry Pi 4/5/CM4/CM5,DshanPi,Linux ARM SoC(高通 / 瑞芯微 / 全志等)|
+| **PC** | Linux Ubuntu(x64)|
+
+---
+
+本项目基于 TuyaOpen C SDK 构建,支持跨 ARM Cortex-M、ARM Cortex-A 乃至 x64 PC 的灵活部署,并提供丰富的即用型硬件驱动和 API。接入新硬件和外设如同搭积木般简单(传感器、显示屏、麦克风扬声器、摄像头,乃至 IoT 云接入)。
+
+
+
+**你的自主 AI 伴侣。** 简化硬件集成,解锁无限控制可能。
+
+> [!WARNING]
+> **🚧 积极开发中** —— 项目处于高强度开发阶段,随时可能出现问题。现在运行可能影响最终体验。遇到任何问题请提 Issue。
+
+
+## ❓ 为什么选择 TuyaOpenClaw?
+
+大多数 AI Agent 框架虽然强大,但却繁琐。它们往往需要昂贵的订阅费、复杂的配置,并叠加在各种框架和 API 之上。TuyaOpenClaw 提供了一条不同的路。
+
+基于商业级设备–云端 AI Agent 底座,TuyaOpenClaw 将设备端 Agent 与云端能力无缝融合。
+
+只需一个 TuyaOpen Key,即可畅享涂鸦云平台及其新一代设备–云端 AI Agent。
+
+轻量、易部署,适配几乎所有边缘硬件——从 WiFi MCU 到 ARM SoC,再到 Ubuntu PC。
+
+
+| | TuyaOpenClaw | OpenClaw / MimiClaw / 其他 |
+|---|---|---|
+| **架构** | 基于 TuyaOpen C SDK 的硬件导向 Claw Agent;设备–云端融合 | OpenClaw:Node.js 全天候桌面/服务器 Agent。MimiClaw:ESP32-S3 裸机 C。其他:框架栈(Pi、Claude Code 等)|
+| **部署目标** | MCU(T5AI、ESP32-S3)、SoC(RPi 4/5、ARM Linux)、PC(Ubuntu x64);单一代码库 | OpenClaw:Mac mini、Pi、VPS。MimiClaw:5 美元 ESP32-S3。其他:仅服务器/桌面 |
+| **运行时** | TuyaOpen C;ARM Cortex-M/A、x64;MCU 无需 Node | OpenClaw:Node.js。MimiClaw:无 OS。其他:Node.js 22+、pnpm、完整 OS |
+| **设备–云端** | 一个 TuyaOpen Key → 涂鸦云平台 + 设备;内置设备–云端 AI | OpenClaw:自托管,可选 API 订阅。MimiClaw:纯本地。其他:纯云端或 DIY |
+| **消息通道** | Telegram、Discord、飞书、微信(iLink)、QQ 机器人 —— 统一消息总线 + TLS 代理 | OpenClaw:WhatsApp、Telegram、Discord、iMessage、Slack 等。MimiClaw:Telegram、WebSocket、串口 CLI |
+| **记忆** | MEMORY.md + 日记(YYYY-MM-DD.md);JSONL 会话持久化;重启后继续 | OpenClaw:全天候持久上下文、Obsidian/Raycast。MimiClaw:设备端 MEMORY.md |
+| **MCP 工具** | CRON、FILE、EXEC(RPi/Linux)、HW(GPIO/I2C/PWM)、Lua 脚本、OpenClaw 网关控制 | OpenClaw:浏览器自动化、cron、ClawHub Skills。MimiClaw:ReAct + 网页搜索、时间、OTA、GPIO |
+| **✨ 上手** | 单个 TuyaOpen Key;选板(T5AI/ESP32/RPi/Linux),配置 IM Token | OpenClaw:网关、OAuth、多步骤。MimiClaw:刷固件、API Key。其他:复杂依赖 |
+| **✨ 成本** | 低成本;统一 Key 访问服务 | OpenClaw/MimiClaw:自备 Claude/OpenAI。其他:Claude Pro/Max($20–200/月)或重度 API |
+| **✨ IoT 控制** | 原生设备和 IoT 控制,可管理涂鸦生态中的其他设备 | ❌(通常无内置设备控制)|
+| **✨ 语音(ASR)** | 特定板型支持硬件语音输入(ASR)| ❌(原生不支持语音输入)|
+| **✨ Lua 脚本** | 沙箱 Lua 5.5 运行时,含 GPIO/延时模块;通过对话编写 Agent 技能 | ❌ |
+
+
+## 💡 设计理念
+
+**Ducky 是 TuyaOpen 的硬件吉祥物** —— 一只能在任何环境中如鱼得水的鸭子,从最小的 MCU 到完整的桌面 Linux 系统。TuyaOpenClaw 继承了这种精神:一套代码,适配所有板子,零妥协。
+
+项目名称本身就是完整的故事。**TuyaOpen** 是底座 —— 将芯片级硬件、IoT 云和 AI 统一于单一 Key 的商业级 C SDK。**Claw** 是 Agent 范式 —— 从 OpenClaw 借鉴的推理–工具调用–行动循环,经过改造以适应物理世界。Ducky 在中间,构成一个越用越聪明的全天候硬件伴侣。
+
+**为什么是鸭子和爪子?** 鸭子无处不在、适应力强,几乎在任何环境中都能生存——正如 TuyaOpenClaw 的软件,可以从微控制器部署到桌面 Linux。"爪子"象征精准、灵巧,以及对真实世界设备和数字 Agent 的直接掌控。借助 TuyaOpen,硬件集成更加灵活,让你轻松将各种硬件能力直接接入 Agent。
+
+
+### 核心理念
+
+- **个人优先,非企业导向。** TuyaOpenClaw 为个人和创客而生。你的工作流和日常生活优先,没有官僚主义和企业冗余。
+- **精简核心,插件扩展。** 必要 C 核心之外的一切——通道、提供商、工具——都是可替换和扩展的插件。
+- **自调优与自适应。** 通过真实情节记忆和定期自我回顾持续学习,记忆衰减机制帮助它保持时效性。
+- **对话式配置。** 无需厚重的配置文件:直接通过聊天完成 Agent 的设置和修改,硬件端和云端均适用。
+- **鲜明的个性。** 每个实例都有独立的 SOUL.md 配置和可选的硬件层,呈现有个性、有帮助的响应风格。
+- **原生 C/TuyaOpen 构建。** 无 Node,无粘合的 Python 框架。从头为你实际使用的板子和平台而建。
+- **极速启动。** 只需一个 TuyaOpen Key。按需选择模型和提供商,随时通过消息界面切换。
+- **统一模型访问。** 凭借单一 TuyaOpen API Access Key,可接入 GPT、Claude、Deepseek、Qwen 等最新模型,全部由涂鸦无缝托管和管理。
+- **设备与云端 AI Agent。** 原生支持在设备本地运行的"设备 Agent"和以 Claw 方式运行于云端的"云端 Agent"。设备端动作、语音和 IoT 控制,与云端智能和在线 MCP 并行运作。
+
+
+## ✨ 功能特性
+
+- **5 个 IM 通道:**
+ Telegram、Discord、飞书、微信(iLink)、QQ 机器人 —— 统一消息总线 + TLS HTTP 代理,Agent 循环无需感知通道差异。
+
+- **设备–云端混合 AI Agent:**
+ 由 TuyaOpen 驱动的集中式 AI Agent,通过 Claw 机制同时支持设备端和云端动作(外循环等待消息,内循环最多 10 次工具调用迭代)。
+
+- **6 个 MCP 风格设备工具:**
+ - **CRON:** 调度设备任务、提醒和定时任务管理。
+ - **FILE:** 在设备文件系统(SD 卡或 Flash)上读写/编辑/列目录。
+ - **EXEC:** Raspberry Pi / Linux 上的远程 Shell 命令执行(通过对话执行系统命令)。
+ - **HW:** 硬件外设控制 —— 从 Agent 指令直接操作 GPIO、I2C、PWM。
+ - **Lua 脚本:** 沙箱 Lua 5.5 运行时;通过对话编写和运行脚本。模块:GPIO、延时、安全 OS API。
+ - **OpenClaw 控制:** 网关控制,用于将设备 Agent 与 OpenClaw / PC Agent 桥接。
+
+- **持久记忆:**
+ 长期记忆存储在 `MEMORY.md`,日记存储在 `YYYY-MM-DD.md`,个性配置在 `SOUL.md`,用户档案在 `USER.md` —— 全部存储在 Flash/SD 卡上,每轮对话自动加载。
+
+- **会话管理器:**
+ 基于 JSONL 的会话持久化,重启后可继续之前的对话。
+
+- **技能系统(Skills):**
+ Agent 技能是 `skills/` 目录下的 `.md` 文件。Agent 每轮获取技能摘要,并通过 `read_file` 工具按需加载完整技能内容。
+
+- **编译时 Overlay:**
+ `overlay/ai_components/` 对 `ai_agent` 和 `ai_mcp` 进行外科手术式补丁,无需修改 TuyaOpen SDK 子模块,保持上游代码干净。
+
+- **PSRAM 支持:**
+ `claw_malloc`/`claw_free` 包装器在外部 PSRAM 可用时自动将分配路由到 PSRAM,使 T5AI 板上能够使用大容量上下文缓冲区。
+
+- **硬件语音 ASR:**
+ 特定 T5AI 板型(配备麦克风硬件)支持自动语音识别音频输入。
+
+- **SD 卡与文件系统:**
+ 持久存储记忆、技能、会话和 Agent 生成的文件。
+
+- **本地 CLI:**
+ 串口/本地 CLI,无需 IM 连接即可完成设置和调试。
+
+
+## 🏛️ 架构
+
+
+
+TuyaOpenClaw 架构将本地设备 Agent 和云端 Agent 统一在同一个系统下。其核心使用 TuyaOpen AI-Agent 框架处理消息、自动化和控制。本地硬件(Raspberry Pi、ESP32、T5AI 或 Linux)运行 Claw 风格的 Agent 循环,通过 IM 通道与用户通信,并直接在设备端执行 MCP 工具。
+
+**Agent 循环流程:**
+1. 外循环阻塞在 `message_bus_pop_inbound()` —— 等待任意 IM 消息
+2. 上下文构建器组装系统提示(SOUL.md、USER.md、MEMORY.md、近期日记、技能摘要、对话历史)
+3. 内循环工具调用(最多 10 次迭代):发送提示 → 等待 AI 轮次 → 检查工具调用 → 将结果反馈 → 循环至最终回答
+4. 最终响应通过消息总线推送回发起 IM 通道
+
+
+## 🚀 快速开始
+
+### 克隆仓库
+
+```shell
+git clone https://github.com/tuya/TuyaOpenClaw.git
+cd TuyaOpenClaw
+git submodule update --init
+```
+
+### 配置密钥
+
+```shell
+cp include/tuya_app_config_secrets.h.example include/tuya_app_config_secrets.h
+# 编辑该文件并填入:
+# TUYA_PRODUCT_ID, TUYA_OPENSDK_UUID, TUYA_OPENSDK_AUTHKEY (涂鸦云凭证)
+# IM_SECRET_CHANNEL_MODE 及对应通道 Token(飞书/Telegram/Discord/微信/QQ 机器人)
+# CLAW_WS_AUTH_TOKEN, OPENCLAW_GATEWAY_*(网关配置,如需使用)
+```
+
+### 选择板型配置
+
+```shell
+# Tuya T5AI 开发板(3.5" LCD + 摄像头)
+cp config/TUYA_T5AI_BOARD_LCD_3.5_CAMERA.config app_default.config
+
+# 其他支持的板型:
+# cp config/ATK_T5AI_MINI_BOARD_2.4LCD_CAMERA.config app_default.config
+# cp config/WAVESHARE_T5AI_TOUCH_AMOLED_1_75.config app_default.config
+# cp config/DshanPi_A1.config app_default.config
+# cp config/TUYA_T5AI_CORE.config app_default.config
+# cp config/RaspberryPi.config app_default.config
+# cp config/ESP32S3_BREAD_COMPACT_WIFI.config app_default.config
+```
+
+### 编译
+
+```shell
+# 初始化 TuyaOpen 环境(创建 .venv,配置工具链)
+. ./TuyaOpen/export.sh
+
+# 编译(跳过交互式平台更新提示)
+mkdir -p TuyaOpen/.cache && touch TuyaOpen/.cache/.dont_prompt_update_platform
+tos.py build
+```
+
+编译产物输出至 `dist/` 目录。
+
+### 开发指南
+- Tuya T5AI:[TuyaOpenClaw 快速开始(T5-AI)](https://tuyaopen.ai/zh/docs/duckyclaw/ducky-quick-start-T5AI)
+- Raspberry Pi:[TuyaOpenClaw 快速开始(Raspberry Pi 5)](https://tuyaopen.ai/zh/docs/duckyclaw/ducky-quick-start-raspberry-pi-5)
+- ESP32-S3:[TuyaOpenClaw 快速开始(ESP32-S3)](https://tuyaopen.ai/zh/docs/duckyclaw/ducky-quick-start-ESP32S3)
+
+
+## 🔌 技能(Skills)开发
+
+技能是 `skills/` 目录下的 `.md` 文件。Agent 每轮获取技能摘要,并通过 `read_file` 工具按需加载完整内容。使用以下结构:
+
+```markdown
+# 技能标题
+
+一句话描述。
+
+## 何时使用
+当用户询问 X / 当 Y 发生时。
+
+## 如何使用
+1. 调用 tool_A,参数为 ...
+2. 然后调用 tool_B ...
+3. 回复 ...
+
+## 示例
+用户:"……" → 使用 get_current_time,然后 web_search "……",然后回复 "……"
+```
+
+添加技能:在 `skills/` 目录放入新的 `name.md`(例如通过 `write_file` 工具从对话中创建),或在 `skills/skill_loader.c` 中注册内置技能。
+
+
+## 📁 项目结构
+
+```
+TuyaOpenClaw/
+├── agent/ # Agent 核心逻辑
+│ ├── agent_loop.c/h # Claw 风格外循环+内循环(工具调用、上下文、信号量同步)
+│ └── context_builder.c/h # 每轮组装系统提示
+├── components/
+│ └── lua/ # 嵌入式 Lua 5.5 沙箱运行时
+│ ├── lua/ # Lua 5.5 核心源码(vendored)
+│ ├── port/ # TuyaOpenClaw 胶合层:沙箱初始化、运行时、模块注册
+│ └── modules/ # 硬件 Lua 模块(gpio、delay)
+├── config/ # 板型 / 平台 Kconfig 配置
+│ ├── TUYA_T5AI_BOARD_LCD_3.5_CAMERA.config # Tuya T5AI 3.5" LCD + 摄像头
+│ ├── TUYA_T5AI_BOARD_LCD_3.5_CAMERA(NO_SDCARD).config
+│ ├── TUYA_T5AI_CORE.config # Tuya T5AI 核心板(无显示)
+│ ├── ATK_T5AI_MINI_BOARD_2.4LCD_CAMERA.config # ATK 2.4" LCD 变体
+│ ├── WAVESHARE_T5AI_TOUCH_AMOLED_1_75.config # Waveshare 1.75" AMOLED
+│ ├── DshanPi_A1.config # DshanPi A1
+│ ├── RaspberryPi.config # Raspberry Pi(Linux)
+│ └── ESP32S3_BREAD_COMPACT_WIFI.config # ESP32-S3 面包板
+├── cron_service/ # 后台定时任务调度器(独立于 MCP 工具接口)
+│ └── cron_service.c/h
+├── gateway/ # WebSocket 网关集成
+│ ├── ws_server.c/h # 本地 WebSocket 服务端
+│ └── acp_client.c/h # ACP 客户端 → OpenClaw 网关
+├── heartbeat/ # 定时心跳保活
+│ └── heartbeat.c/h
+├── IM/ # 统一消息层
+│ ├── bus/ # 线程安全消息总线(入站/出站队列)
+│ ├── channels/ # Telegram、Discord、飞书、微信(iLink)、QQ 机器人
+│ ├── proxy/ # 云端 IM API 的 TLS HTTP 代理
+│ ├── cli/ # 本地串口 CLI 输入通道
+│ └── certs/ # TLS 证书
+├── include/ # 应用级公共头文件
+│ ├── tuya_app_config.h # 默认配置(设备 ID、IM 模式等)
+│ └── tuya_app_config_secrets.h.example # 密钥模板(填写后已 gitignore)
+├── memory/ # 持久记忆与会话
+│ ├── memory_manager.c/h # Flash/SD 上的 MEMORY.md、日记、SOUL.md、USER.md
+│ └── session_manager.c/h # JSONL 会话持久化
+├── overlay/
+│ └── ai_components/ # ai_agent 和 ai_mcp 的编译时补丁(SDK 保持干净)
+├── skills/ # Agent 技能定义与加载器
+│ └── skill_loader.c/h # 扫描 skills/,为系统提示构建摘要
+├── src/ # 应用入口与业务逻辑
+│ ├── tuya_app_main.c # TuyaOpen 应用入口,初始化,事件循环
+│ ├── tuyaopen_claw_chat.c # AI 流式事件桥接(轮次结束时通知 Agent 循环)
+│ ├── app_im.c # IM–Agent 桥接
+│ └── app_cli_cmd.c # CLI 和运行时配置命令
+├── tools/ # MCP 风格设备工具
+│ ├── tool_cron.c/h # CRON:调度任务和提醒
+│ ├── tool_files.c/h # FILE:设备文件系统读写/编辑/列目录
+│ ├── tool_exec.c/h # EXEC:Shell 命令执行(仅 Linux/RPi)
+│ ├── tool_hw.c/h # HW:GPIO、I2C、PWM 硬件控制
+│ ├── tool_lua.c/h # LUA:运行沙箱 Lua 5.5 脚本
+│ ├── tool_openclaw_ctrl.c/h # OpenClaw 网关控制
+│ └── tools_register.c/h # MCP 服务器初始化与工具注册
+├── app_default.config # 当前激活的 Kconfig(编译前从 config/ 复制)
+├── CMakeLists.txt # 构建图(Overlay 逻辑、Lua 组件、IM 组件)
+└── TuyaOpen/ # TuyaOpen C SDK 子模块(平台、驱动、云端、AI)
+```
+
+
+## 🐛 问题反馈
+
+请通过[新建 Issue](https://github.com/tuya/TuyaOpenClaw/issues) 反馈问题,提交前请确认该问题尚未被报告。欢迎任何改进贡献,感谢!🙏✨
+
+## 🙏🙏🙏 关注我们
+
+喜欢这个项目?请给个 Star!⭐⭐⭐⭐⭐
+
+本项目离不开 TuyaOpen 开源 AI-Agent 框架的支撑,它让 AI-Agent 集成变得真正简单:
+
+
+
+
+
+## 📃 许可证
+
+本项目遵循 [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0)。
+
+## 👥 致谢
+- [TuyaOpen](https://github.com/tuya/TuyaOpen/) —— 本项目基于这个出色的硬件 AIoT OS 构建。
+- [OpenClaw](https://github.com/openclaw/openclaw) —— 原始创意与灵感来源。
+- [MimiClaw](https://github.com/memovai/mimiclaw) —— ESP32 本地 Agent 和 Skills 的原始灵感。
+
+## 📝 作者
+
+本项目由 [TuyaOpen 团队](https://tuyaopen.ai/) 创建,感谢所有[贡献者](https://github.com/tuya/TuyaOpenClaw/graphs/contributors)的帮助。
+
+[](https://github.com/tuya/TuyaOpenClaw/graphs/contributors)
+
+---
diff --git a/TODOs.md b/TODOs.md
index 0e9b00b..46d2d33 100644
--- a/TODOs.md
+++ b/TODOs.md
@@ -19,10 +19,10 @@
## Docs TODOs
- [x] Free Lic Guide
-- [ ] Tuya T5 DuckyClaw Quick Start
+- [ ] Tuya T5 TuyaOpenClaw Quick Start
- [ ] ESP32 Ducky Claw
-- [ ] Raspberry Pi DuckyClaw Quick Start
+- [ ] Raspberry Pi TuyaOpenClaw Quick Start
- [ ] Device MCP Quick Guide
### TuyaOpen.ai
-- [ ] DuckyClaw Landing Page
-- [ ] Main DuckyClaw README EN/CN
+- [ ] TuyaOpenClaw Landing Page
+- [ ] Main TuyaOpenClaw README EN/CN
diff --git a/agent/Kconfig b/agent/Kconfig
index 99bf77c..e61e587 100644
--- a/agent/Kconfig
+++ b/agent/Kconfig
@@ -1,17 +1,17 @@
-menu "DuckyClaw Agent Config"
- config DUCKY_CLAW_AGENT_STACK
+menu "TuyaOpenClaw Agent Config"
+ config TUYAOPEN_CLAW_AGENT_STACK
int "Agent loop thread stack size (bytes)"
default 24576
help
Stack size in bytes for the agent loop thread (default 24*1024).
- config DUCKY_CLAW_CONTEXT_BUF_SIZE
+ config TUYAOPEN_CLAW_CONTEXT_BUF_SIZE
int "Agent context buffer size (bytes)"
default 32768
help
Size in bytes for the context/prompt buffer (default 32*1024).
- config DUCKY_CLAW_HISTORY_MAX_COUNT
+ config TUYAOPEN_CLAW_HISTORY_MAX_COUNT
int "Max history message count"
default 10
help
diff --git a/agent/agent_loop.c b/agent/agent_loop.c
index c441cc3..ea2e899 100644
--- a/agent/agent_loop.c
+++ b/agent/agent_loop.c
@@ -40,16 +40,16 @@
/***********************************************************
************************macro define************************
***********************************************************/
-#ifndef DUCKY_CLAW_AGENT_STACK
-#define DUCKY_CLAW_AGENT_STACK (24*1024)
+#ifndef TUYAOPEN_CLAW_AGENT_STACK
+#define TUYAOPEN_CLAW_AGENT_STACK (24*1024)
#endif
-#ifndef DUCKY_CLAW_CONTEXT_BUF_SIZE
-#define DUCKY_CLAW_CONTEXT_BUF_SIZE (32 * 1024)
+#ifndef TUYAOPEN_CLAW_CONTEXT_BUF_SIZE
+#define TUYAOPEN_CLAW_CONTEXT_BUF_SIZE (32 * 1024)
#endif
-#ifndef DUCKY_CLAW_HISTORY_MAX_COUNT
-#define DUCKY_CLAW_HISTORY_MAX_COUNT 10
+#ifndef TUYAOPEN_CLAW_HISTORY_MAX_COUNT
+#define TUYAOPEN_CLAW_HISTORY_MAX_COUNT 10
#endif
/* Maximum inner-loop iterations per user turn (mirrors MIMI_AGENT_MAX_TOOL_ITER) */
@@ -66,7 +66,7 @@
#define TOOL_RESULT_BUF_SIZE (512)
/* Buffer holding the last complete AI text stream, set by
- * agent_loop_set_last_response() called from ducky_claw_chat.c on STREAM_STOP.
+ * agent_loop_set_last_response() called from tuyaopen_claw_chat.c on STREAM_STOP.
* The inner loop forwards it to IM when no tool was called. */
#define LAST_RESPONSE_MAX (16 * 1024)
/***********************************************************
@@ -110,7 +110,7 @@ static char *s_last_response = NULL;
static MUTEX_HANDLE s_last_response_lock = NULL;
/* True while the inner loop is active (i.e. we are in a tool-use iteration).
- * ducky_claw_chat.c uses this to suppress mid-stream overflow flushes. */
+ * tuyaopen_claw_chat.c uses this to suppress mid-stream overflow flushes. */
static volatile bool s_in_tool_loop = false;
/***********************************************************
@@ -241,7 +241,7 @@ OPERATE_RET build_current_context(const char *role, const char *content)
}
int count = cJSON_GetArraySize(s_history_json);
- if (count >= DUCKY_CLAW_HISTORY_MAX_COUNT) {
+ if (count >= TUYAOPEN_CLAW_HISTORY_MAX_COUNT) {
cJSON_DeleteItemFromArray(s_history_json, 0);
}
@@ -256,7 +256,7 @@ OPERATE_RET build_current_context(const char *role, const char *content)
/**
* agent_loop_in_tool_loop - Returns true while the inner tool loop is active.
*
- * Used by ducky_claw_chat.c to suppress intermediate IM flushes.
+ * Used by tuyaopen_claw_chat.c to suppress intermediate IM flushes.
*/
bool agent_loop_in_tool_loop(void)
{
@@ -266,7 +266,7 @@ bool agent_loop_in_tool_loop(void)
/**
* agent_loop_set_last_response - Store the completed AI text stream.
*
- * Called by ducky_claw_chat.c on AI_USER_EVT_TEXT_STREAM_STOP before
+ * Called by tuyaopen_claw_chat.c on AI_USER_EVT_TEXT_STREAM_STOP before
* calling agent_loop_notify_turn_done(). The inner loop reads this to
* forward the final response to IM.
*/
@@ -282,7 +282,7 @@ void agent_loop_set_last_response(const char *text)
}
/**
- * agent_loop_notify_turn_done - Called by ducky_claw_chat.c on STREAM_STOP.
+ * agent_loop_notify_turn_done - Called by tuyaopen_claw_chat.c on STREAM_STOP.
*
* Posts the semaphore so the blocked inner loop can proceed to the next
* iteration check.
@@ -307,11 +307,11 @@ void agent_loop_notify_turn_done(void)
*/
static void __build_and_send(const char *content, bool is_tool, bool summarize)
{
- memset(s_total_prompt, 0, DUCKY_CLAW_CONTEXT_BUF_SIZE);
+ memset(s_total_prompt, 0, TUYAOPEN_CLAW_CONTEXT_BUF_SIZE);
size_t off = 0;
if (!is_tool) {
/* First iteration: include full system prompt (tools, rules, memory, skills) */
- off = context_build_system_prompt(s_total_prompt, DUCKY_CLAW_CONTEXT_BUF_SIZE);
+ off = context_build_system_prompt(s_total_prompt, TUYAOPEN_CLAW_CONTEXT_BUF_SIZE);
if (off == 0) {
PR_ERR("context_build_system_prompt failed");
return;
@@ -322,14 +322,14 @@ static void __build_and_send(const char *content, bool is_tool, bool summarize)
tal_mutex_lock(s_history_mutex);
int count = cJSON_GetArraySize(s_history_json);
if (count > 0) {
- off += snprintf(s_total_prompt + off, DUCKY_CLAW_CONTEXT_BUF_SIZE - off,
+ off += snprintf(s_total_prompt + off, TUYAOPEN_CLAW_CONTEXT_BUF_SIZE - off,
"\r\n\n# Recent Memory History\r\n");
for (int j = 0; j < count; j++) {
cJSON *e = cJSON_GetArrayItem(s_history_json, j);
const char *role = __json_get_string(cJSON_GetObjectItem(e, "role"));
const char *text = __json_get_string(cJSON_GetObjectItem(e, "content"));
if (role && text) {
- off += snprintf(s_total_prompt + off, DUCKY_CLAW_CONTEXT_BUF_SIZE - off,
+ off += snprintf(s_total_prompt + off, TUYAOPEN_CLAW_CONTEXT_BUF_SIZE - off,
"\n- %s: %s", role, text);
}
}
@@ -359,11 +359,11 @@ static void __build_and_send(const char *content, bool is_tool, bool summarize)
}
size_t needed = strlen(content) + strlen(header) + 1;
- if (off + needed > DUCKY_CLAW_CONTEXT_BUF_SIZE) {
+ if (off + needed > TUYAOPEN_CLAW_CONTEXT_BUF_SIZE) {
PR_ERR("Prompt buffer overflow");
return;
}
- off += snprintf(s_total_prompt + off, DUCKY_CLAW_CONTEXT_BUF_SIZE - off,
+ off += snprintf(s_total_prompt + off, TUYAOPEN_CLAW_CONTEXT_BUF_SIZE - off,
"%s%s", header, content);
// PR_NOTICE("Sending prompt (len=%u, is_tool=%d): %s ...", (unsigned)off, is_tool, s_total_prompt);
@@ -426,7 +426,7 @@ static void agent_loop_task(void *arg)
/* Notify the user via IM that the agent is still working.
* Sent at the start of every iteration so the user sees progress
* even when tool calls take a long time. */
- app_im_bot_send_message("DuckyClaw is working...");
+ app_im_bot_send_message("TuyaOpenClaw is working...");
/* Reset per-round tool state */
if (s_turn.lock) {
@@ -523,14 +523,14 @@ OPERATE_RET agent_loop_init_evt_cb(void *data)
}
#if defined(ENABLE_EXT_RAM) && (ENABLE_EXT_RAM == 1)
- s_total_prompt = tal_psram_malloc(DUCKY_CLAW_CONTEXT_BUF_SIZE);
+ s_total_prompt = tal_psram_malloc(TUYAOPEN_CLAW_CONTEXT_BUF_SIZE);
#else
- s_total_prompt = tal_malloc(DUCKY_CLAW_CONTEXT_BUF_SIZE);
+ s_total_prompt = tal_malloc(TUYAOPEN_CLAW_CONTEXT_BUF_SIZE);
#endif
if (!s_total_prompt) {
return OPRT_MALLOC_FAILED;
}
- memset(s_total_prompt, 0, DUCKY_CLAW_CONTEXT_BUF_SIZE);
+ memset(s_total_prompt, 0, TUYAOPEN_CLAW_CONTEXT_BUF_SIZE);
s_history_json = cJSON_CreateArray();
if (!s_history_json) {
@@ -559,7 +559,7 @@ OPERATE_RET agent_loop_init_evt_cb(void *data)
PR_DEBUG("Agent loop initialized");
THREAD_CFG_T thrd_param = {0};
- thrd_param.stackDepth = DUCKY_CLAW_AGENT_STACK;
+ thrd_param.stackDepth = TUYAOPEN_CLAW_AGENT_STACK;
thrd_param.priority = THREAD_PRIO_1;
thrd_param.thrdname = "agent_loop";
#if defined(ENABLE_EXT_RAM) && (ENABLE_EXT_RAM == 1)
diff --git a/agent/agent_loop.h b/agent/agent_loop.h
index f935ad7..4dae282 100644
--- a/agent/agent_loop.h
+++ b/agent/agent_loop.h
@@ -29,7 +29,7 @@ OPERATE_RET build_current_context(const char *role, const char *content);
/**
* agent_loop_set_last_response - Store the completed AI text stream.
*
- * Must be called from ducky_claw_chat.c on AI_USER_EVT_TEXT_STREAM_STOP
+ * Must be called from tuyaopen_claw_chat.c on AI_USER_EVT_TEXT_STREAM_STOP
* before agent_loop_notify_turn_done(). The inner loop uses this text
* to forward the final response to IM.
*/
@@ -38,7 +38,7 @@ void agent_loop_set_last_response(const char *text);
/**
* agent_loop_notify_turn_done - Signal that the cloud AI has finished one round.
*
- * Must be called from ducky_claw_chat.c on AI_USER_EVT_TEXT_STREAM_STOP.
+ * Must be called from tuyaopen_claw_chat.c on AI_USER_EVT_TEXT_STREAM_STOP.
* Posts the internal semaphore so the blocked inner loop can proceed.
*/
void agent_loop_notify_turn_done(void);
@@ -46,7 +46,7 @@ void agent_loop_notify_turn_done(void);
/**
* agent_loop_in_tool_loop - Returns true while the inner tool loop is active.
*
- * Used by ducky_claw_chat.c to suppress intermediate IM flushes during
+ * Used by tuyaopen_claw_chat.c to suppress intermediate IM flushes during
* tool-use iterations.
*/
bool agent_loop_in_tool_loop(void);
diff --git a/agent/context_builder.c b/agent/context_builder.c
index c408bae..972d87b 100644
--- a/agent/context_builder.c
+++ b/agent/context_builder.c
@@ -76,8 +76,8 @@
size_t off = 0;
off += snprintf(buf + off, size - off,
- "# DuckyClaw\n\n"
- "You are DuckyClaw, a personal AI assistant running on a TuyaOpen device.\n"
+ "# TuyaOpenClaw\n\n"
+ "You are TuyaOpenClaw (a.k.a. Ducky), a personal AI assistant running on a TuyaOpen device.\n"
"You communicate through Telegram, Discord, and Feishu.\n"
"Be helpful, accurate, and concise.\n\n");
diff --git a/components/lua/CMakeLists.txt b/components/lua/CMakeLists.txt
index c0021c0..894ba13 100644
--- a/components/lua/CMakeLists.txt
+++ b/components/lua/CMakeLists.txt
@@ -1,6 +1,6 @@
##
# @file CMakeLists.txt
-# @brief Embedded Lua 5.5 component for DuckyClaw
+# @brief Embedded Lua 5.5 component for TuyaOpenClaw
#
# Vendored from upstream Lua 5.5 (originally via the esp-idf-component-lua
# managed component). Sources liolib.c / loslib.c / loadlib.c / linit.c /
@@ -48,7 +48,7 @@ set(LUA_CORE_SRCS
)
# ----------------------------------------------------------------------------
-# DuckyClaw port glue
+# TuyaOpenClaw port glue
# ----------------------------------------------------------------------------
set(LUA_PORT_SRCS
${MODULE_PATH}/port/linit_sandbox.c
diff --git a/components/lua/include/luaconf.h b/components/lua/include/luaconf.h
index e0e17aa..047613c 100644
--- a/components/lua/include/luaconf.h
+++ b/components/lua/include/luaconf.h
@@ -759,7 +759,7 @@
** space and to reserve some numbers for pseudo-indices.
** (It must fit into max(int)/2.)
*/
-/* DuckyClaw: keep this conservative; was CONFIG_LUA_MAXSTACK on ESP-IDF. */
+/* TuyaOpenClaw: keep this conservative; was CONFIG_LUA_MAXSTACK on ESP-IDF. */
#if !defined(LUAI_MAXSTACK)
#if 1000000 < (INT_MAX / 2)
#define LUAI_MAXSTACK 15000
diff --git a/components/lua/port/lua_runtime.c b/components/lua/port/lua_runtime.c
index d66d982..80f6e96 100644
--- a/components/lua/port/lua_runtime.c
+++ b/components/lua/port/lua_runtime.c
@@ -1,6 +1,6 @@
/**
* @file lua_runtime.c
- * @brief Embedded Lua 5.5 runtime for the DuckyClaw lua_run_script tool.
+ * @brief Embedded Lua 5.5 runtime for the TuyaOpenClaw lua_run_script tool.
*
* Per-call lifecycle:
* 1. lua_newstate with a claw_malloc-backed allocator (PSRAM-aware via
diff --git a/components/lua/port_include/lua_module_registry.h b/components/lua/port_include/lua_module_registry.h
index 5eeb064..012c68d 100644
--- a/components/lua/port_include/lua_module_registry.h
+++ b/components/lua/port_include/lua_module_registry.h
@@ -1,6 +1,6 @@
/**
* @file lua_module_registry.h
- * @brief Lightweight Lua C module registry for DuckyClaw.
+ * @brief Lightweight Lua C module registry for TuyaOpenClaw.
*
* Hardware / board-specific Lua modules (gpio, i2c, uart, etc.) register
* themselves here during init. When a sandboxed Lua script runs,
diff --git a/components/lua/port_include/lua_runtime.h b/components/lua/port_include/lua_runtime.h
index 03bd7af..9b4aa45 100644
--- a/components/lua/port_include/lua_runtime.h
+++ b/components/lua/port_include/lua_runtime.h
@@ -1,6 +1,6 @@
/**
* @file lua_runtime.h
- * @brief Embedded Lua 5.5 runtime entry point for DuckyClaw.
+ * @brief Embedded Lua 5.5 runtime entry point for TuyaOpenClaw.
*
* Exposes a single synchronous function that creates a fresh sandboxed
* lua_State, executes an inline source string, captures print() output
diff --git a/config/ESP32S3_BREAD_COMPACT_WIFI.config b/config/ESP32S3_BREAD_COMPACT_WIFI.config
index 5cf2c25..2211848 100755
--- a/config/ESP32S3_BREAD_COMPACT_WIFI.config
+++ b/config/ESP32S3_BREAD_COMPACT_WIFI.config
@@ -5,7 +5,7 @@ CONFIG_BUTTON_NAME="ai_chat_button"
CONFIG_AI_HEAP_IN_PSRAM=y
CONFIG_AI_STACK_IN_PSRAM=y
CONFIG_ENABLE_SERIAL_CLI_CMD=y
-CONFIG_DUCKY_CLAW_CONTEXT_BUF_SIZE=16384
+CONFIG_TUYAOPEN_CLAW_CONTEXT_BUF_SIZE=16384
CONFIG_CLAW_WS_MAX_CLIENTS=2
CONFIG_BOARD_CHOICE_ESP32=y
CONFIG_BOARD_CHOICE_BREAD_COMPACT_WIFI=y
diff --git a/config/TUYA_T5AI_BOARD_LCD_3.5_CAMERA(NO_SDCARD).config b/config/TUYA_T5AI_BOARD_LCD_3.5_CAMERA(NO_SDCARD_CAMERA).config
similarity index 96%
rename from config/TUYA_T5AI_BOARD_LCD_3.5_CAMERA(NO_SDCARD).config
rename to config/TUYA_T5AI_BOARD_LCD_3.5_CAMERA(NO_SDCARD_CAMERA).config
index 551c474..215e5c4 100644
--- a/config/TUYA_T5AI_BOARD_LCD_3.5_CAMERA(NO_SDCARD).config
+++ b/config/TUYA_T5AI_BOARD_LCD_3.5_CAMERA(NO_SDCARD_CAMERA).config
@@ -1,5 +1,4 @@
CONFIG_ENABLE_COMP_AI_AUDIO_CODEC_OPUS=y
-CONFIG_ENABLE_COMP_AI_VIDEO=y
CONFIG_ENABLE_COMP_AI_PICTURE=y
CONFIG_ENABLE_AI_UI_TEXT_STREAMING=y
CONFIG_ENABLE_AI_CHAT_GUI_WECHAT=y
diff --git a/cron_service/cron_service.c b/cron_service/cron_service.c
index b2e1fe5..9c75cd6 100644
--- a/cron_service/cron_service.c
+++ b/cron_service/cron_service.c
@@ -1,6 +1,6 @@
/**
* @file cron_service.c
- * @brief Cron (scheduled task) service for DuckyClaw
+ * @brief Cron (scheduled task) service for TuyaOpenClaw
* @version 0.1
* @date 2025-03-25
*
diff --git a/cron_service/cron_service.h b/cron_service/cron_service.h
index 2bd43e5..8498f26 100644
--- a/cron_service/cron_service.h
+++ b/cron_service/cron_service.h
@@ -1,6 +1,6 @@
/**
* @file cron_service.h
- * @brief Cron (scheduled task) service for DuckyClaw
+ * @brief Cron (scheduled task) service for TuyaOpenClaw
* @version 0.1
* @date 2025-03-25
*
diff --git a/docs/lua-module-porting.md b/docs/lua-module-porting.md
index ac46015..1139544 100644
--- a/docs/lua-module-porting.md
+++ b/docs/lua-module-porting.md
@@ -1,18 +1,18 @@
-# DuckyClaw Lua 模块移植实现文档
+# TuyaOpenClaw Lua 模块移植实现文档
-本文档记录 DuckyClaw(基于 TuyaOpen C SDK 的硬件 AI Agent)中 Lua 5.5 沙盒运行时及硬件模块的实现方案,目的是让其它开发者能够:
+本文档记录 TuyaOpenClaw(基于 TuyaOpen C SDK 的硬件 AI Agent)中 Lua 5.5 沙盒运行时及硬件模块的实现方案,目的是让其它开发者能够:
-1. 理解 DuckyClaw 中 Lua 子系统的整体架构;
+1. 理解 TuyaOpenClaw 中 Lua 子系统的整体架构;
2. 复用现有沙盒/注册器模式给设备增加新的硬件模块(PWM、I2C、UART、ADC 等);
3. 在其它 TuyaOpen 板型上重新启用本子系统。
## 0. 背景
-[DuckyClaw](https://github.com/tuya/DuckyClaw)([官网](https://tuyaopen.ai/zh/duckyclaw))是 [TuyaOpen](https://tuyaopen.ai) 上的开源硬件 AI Agent,主战平台是 Tuya T5AI 开发板(也支持 ESP32、Linux、Raspberry Pi)。其核心是一个端侧 Agent 循环,通过 IM 通道(Telegram/Discord/Feishu)与用户交互,并通过 MCP 风格的工具协议在设备上执行操作。
+[TuyaOpenClaw](https://github.com/tuya/TuyaOpenClaw)([官网](https://tuyaopen.ai/zh/tuyaopenclaw))是 [TuyaOpen](https://tuyaopen.ai) 上的开源硬件 AI Agent,主战平台是 Tuya T5AI 开发板(也支持 ESP32、Linux、Raspberry Pi)。其核心是一个端侧 Agent 循环,通过 IM 通道(Telegram/Discord/Feishu)与用户交互,并通过 MCP 风格的工具协议在设备上执行操作。
-为了让云端 LLM 能够"动态写一段小代码,在设备上运行后拿结果",DuckyClaw 引入了 [esp-claw](https://esp-claw.com/zh-cn/)(参考实现)的 Lua 子系统设计:把 Lua 5.5 解释器嵌入设备,作为一个名为 `lua_run_script` 的 MCP 工具暴露给 LLM。沙盒里只开放安全的标准库子集 + 设备硬件模块(GPIO、延时等),让 LLM 既能做计算/字符串处理,也能直接控 IO、调时序。
+为了让云端 LLM 能够"动态写一段小代码,在设备上运行后拿结果",TuyaOpenClaw 引入了 [esp-claw](https://esp-claw.com/zh-cn/)(参考实现)的 Lua 子系统设计:把 Lua 5.5 解释器嵌入设备,作为一个名为 `lua_run_script` 的 MCP 工具暴露给 LLM。沙盒里只开放安全的标准库子集 + 设备硬件模块(GPIO、延时等),让 LLM 既能做计算/字符串处理,也能直接控 IO、调时序。
-与 esp-claw 不同的是,DuckyClaw 的硬件 API 走 TuyaOpen 的 `tkl_*` / `tal_*` 抽象层,因此模块代码全部按 TuyaOpen 接口重写;架构(沙盒 + 模块注册器 + 三层目录)则与 esp-claw 一致。
+与 esp-claw 不同的是,TuyaOpenClaw 的硬件 API 走 TuyaOpen 的 `tkl_*` / `tal_*` 抽象层,因此模块代码全部按 TuyaOpen 接口重写;架构(沙盒 + 模块注册器 + 三层目录)则与 esp-claw 一致。
## 1. 整体架构
@@ -52,7 +52,7 @@
## 2. 目录结构
```
-DuckyClaw/
+TuyaOpenClaw/
├── tools/
│ └── tool_lua.{c,h} # MCP 工具:lua_run_script
├── components/lua/
@@ -61,7 +61,7 @@ DuckyClaw/
│ ├── lua/ # Lua 5.5 上游源码(精简 — 见 §3.1)
│ ├── include/
│ │ └── luaconf.h # 上游默认配置
-│ ├── port/ # DuckyClaw 集成层
+│ ├── port/ # TuyaOpenClaw 集成层
│ │ ├── linit_sandbox.c # 替换上游 linit.c:仅打开安全库
│ │ ├── lua_module_os_safe.c # 安全 os 子集 (time/date)
│ │ ├── lua_module_registry.c # 模块注册器
@@ -478,7 +478,7 @@ LLM 看到的"Lua 能力"通过两个途径合成:
### 5.2 Skills 摘要(弱信号 + 完整文档)
-DuckyClaw 的 `skill_loader` 会扫描设备 SD 卡 `/sdcard/skills/*.md`,把每个 `.md` 的标题+第一段聚合到 system prompt,并提示 LLM "use read_file to load full instructions"。
+TuyaOpenClaw 的 `skill_loader` 会扫描设备 SD 卡 `/sdcard/skills/*.md`,把每个 `.md` 的标题+第一段聚合到 system prompt,并提示 LLM "use read_file to load full instructions"。
为此项目维护三份配套的 skill 文档:
@@ -490,7 +490,7 @@ DuckyClaw 的 `skill_loader` 会扫描设备 SD 卡 `/sdcard/skills/*.md`,把每
并把精简版同步进 `skills/skill_loader.c` 的 `BUILTIN_LUA_RUN`/`BUILTIN_LUA_GPIO`/`BUILTIN_LUA_DELAY` 内置串中,首次启动 `skill_loader_init()` 会自动写到 `/sdcard/skills/lua_*.md`(已存在则跳过)。
-参见 [hardware-skill 文档](https://tuyaopen.ai/zh/docs/duckyclaw/hardware-skill)。
+参见 [hardware-skill 文档](https://tuyaopen.ai/zh/docs/tuyaopenclaw/hardware-skill)。
## 6. Lua 端 API 参考
@@ -709,10 +709,10 @@ CONFIG_ENABLE_LUA_MODULE_PWM=y
## 10. 参考资料
-- DuckyClaw 项目主页:
-- DuckyClaw 源码:
+- TuyaOpenClaw 项目主页:
+- TuyaOpenClaw 源码:
- Claw 平台:
-- DuckyClaw 硬件 Skill 指南:
+- TuyaOpenClaw 硬件 Skill 指南:
- T5AI 引脚映射:
- esp-claw 主页:
- esp-claw lua_modules 参考(本移植的设计原型):
diff --git a/gateway/acp_client.c b/gateway/acp_client.c
index 745c72c..ac42f54 100755
--- a/gateway/acp_client.c
+++ b/gateway/acp_client.c
@@ -523,7 +523,7 @@ static OPERATE_RET __acp_connect(int fd, char *session_key, size_t sk_size)
cJSON_AddStringToObject(client, "mode", "ui");
cJSON_AddStringToObject(client, "version", "1.0.0");
cJSON_AddStringToObject(client, "platform", "embedded");
- cJSON_AddStringToObject(client, "deviceFamily", "DuckyClaw");
+ cJSON_AddStringToObject(client, "deviceFamily", "TuyaOpenClaw");
cJSON_AddStringToObject(client, "displayName", s_device_id);
cJSON_AddItemToObject(params, "client", client);
diff --git a/gateway/acp_client.h b/gateway/acp_client.h
index 8aee0e9..1257c8b 100755
--- a/gateway/acp_client.h
+++ b/gateway/acp_client.h
@@ -1,6 +1,6 @@
/**
* @file acp_client.h
- * @brief ACP (Agent Client Protocol) WebSocket client for DuckyClaw.
+ * @brief ACP (Agent Client Protocol) WebSocket client for TuyaOpenClaw.
*
* @version 2.0
* @date 2026-03-19
@@ -62,7 +62,7 @@ void acp_client_set_reply_cb(acp_reply_cb_t cb, void *user_data);
* @brief Initialise the ACP client and start the background task.
*
* Reads connection parameters from OPENCLAW_GATEWAY_HOST, OPENCLAW_GATEWAY_PORT,
- * OPENCLAW_GATEWAY_TOKEN, and DUCKYCLAW_DEVICE_ID (all defined in tuya_app_config.h).
+ * OPENCLAW_GATEWAY_TOKEN, and TUYAOPENCLAW_DEVICE_ID (all defined in tuya_app_config.h).
* The background task handles connection, reconnection, and frame I/O.
*
* @return OPRT_OK on success, error code on failure.
diff --git a/gateway/ws_server.c b/gateway/ws_server.c
index 54ee12f..60ac3eb 100644
--- a/gateway/ws_server.c
+++ b/gateway/ws_server.c
@@ -1,6 +1,6 @@
/**
* @file ws_server.c
- * @brief WebSocket server implementation for DuckyClaw gateway
+ * @brief WebSocket server implementation for TuyaOpenClaw gateway
*
* Ported from TuyaOpen/apps/mimiclaw/gateway/ws_server.c.
* Key adaptations:
diff --git a/gateway/ws_server.h b/gateway/ws_server.h
index 817313a..c83f8cf 100644
--- a/gateway/ws_server.h
+++ b/gateway/ws_server.h
@@ -1,6 +1,6 @@
/**
* @file ws_server.h
- * @brief WebSocket server for DuckyClaw gateway
+ * @brief WebSocket server for TuyaOpenClaw gateway
*
* Provides a lightweight WebSocket server that accepts external client
* connections. Text messages received from clients are forwarded to the
diff --git a/heartbeat/heartbeat.c b/heartbeat/heartbeat.c
index 233d638..5151be9 100644
--- a/heartbeat/heartbeat.c
+++ b/heartbeat/heartbeat.c
@@ -1,6 +1,6 @@
/**
* @file heartbeat.c
- * @brief Heartbeat service for DuckyClaw
+ * @brief Heartbeat service for TuyaOpenClaw
* @version 0.1
* @date 2025-03-25
*
diff --git a/heartbeat/heartbeat.h b/heartbeat/heartbeat.h
index 801b3d3..3864739 100644
--- a/heartbeat/heartbeat.h
+++ b/heartbeat/heartbeat.h
@@ -1,6 +1,6 @@
/**
* @file heartbeat.h
- * @brief Heartbeat service for DuckyClaw
+ * @brief Heartbeat service for TuyaOpenClaw
* @version 0.1
* @date 2025-03-25
*
diff --git a/include/app_base_config.h b/include/app_base_config.h
index 65d062b..a67d4b3 100644
--- a/include/app_base_config.h
+++ b/include/app_base_config.h
@@ -1,6 +1,6 @@
/**
* @file app_base_config.h
- * @brief Base configuration macros and helpers for DuckyClaw.
+ * @brief Base configuration macros and helpers for TuyaOpenClaw.
*
* Consolidates:
* - Filesystem type selection, root paths, and claw_f* / claw_fs_* macros
@@ -219,7 +219,7 @@ static inline void app_cfg_get_gw_token(char *out, size_t out_size)
static inline void app_cfg_get_device_id(char *out, size_t out_size)
{
- app_kv_get_string(APP_KV_DEVICE_ID, DUCKYCLAW_DEVICE_ID, out, out_size);
+ app_kv_get_string(APP_KV_DEVICE_ID, TUYAOPENCLAW_DEVICE_ID, out, out_size);
}
#ifdef __cplusplus
diff --git a/include/tuya_app_config.h b/include/tuya_app_config.h
index 1bec00e..f8d4bed 100755
--- a/include/tuya_app_config.h
+++ b/include/tuya_app_config.h
@@ -33,7 +33,6 @@ extern "C" {
// IM configuration
// feishu | telegram | discord | weixin | qqbot
-// NOTE: ESP32-S3 does not support weixin
#ifndef IM_SECRET_CHANNEL_MODE
#define IM_SECRET_CHANNEL_MODE "feishu"
#endif
@@ -85,8 +84,8 @@ extern "C" {
#define OPENCLAW_GATEWAY_TOKEN "" /* Set in tuya_app_config_secrets.h */
#endif
-#ifndef DUCKYCLAW_DEVICE_ID
-#define DUCKYCLAW_DEVICE_ID "duckyclaw-001" /* Unique per device, e.g. MAC address */
+#ifndef TUYAOPENCLAW_DEVICE_ID
+#define TUYAOPENCLAW_DEVICE_ID "tuyaopenclaw-001" /* Unique per device, e.g. MAC address */
#endif
#ifdef __cplusplus
diff --git a/include/tuya_app_config_secrets.h.example b/include/tuya_app_config_secrets.h.example
index cd7775a..e9b5e25 100644
--- a/include/tuya_app_config_secrets.h.example
+++ b/include/tuya_app_config_secrets.h.example
@@ -23,7 +23,6 @@ extern "C" {
// IM configuration
// feishu | telegram | discord | weixin | qqbot
-// NOTE: ESP32-S3 does not support weixin/qqbot
#define IM_SECRET_CHANNEL_MODE "feishu"
#define IM_SECRET_FS_APP_ID ""
@@ -44,7 +43,7 @@ extern "C" {
#define OPENCLAW_GATEWAY_HOST "xxx.xxx.xxx.xxx"
#define OPENCLAW_GATEWAY_PORT 18789
#define OPENCLAW_GATEWAY_TOKEN "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
-#define DUCKYCLAW_DEVICE_ID "duckyclaw-001"
+#define TUYAOPENCLAW_DEVICE_ID "tuyaopenclaw-001"
#ifdef __cplusplus
}
diff --git a/include/ducky_claw_chat.h b/include/tuyaopen_claw_chat.h
similarity index 74%
rename from include/ducky_claw_chat.h
rename to include/tuyaopen_claw_chat.h
index 925206b..c9689d5 100755
--- a/include/ducky_claw_chat.h
+++ b/include/tuyaopen_claw_chat.h
@@ -1,12 +1,12 @@
/**
- * @file ducky_claw_chat.h
- * @brief ducky_claw_chat module is used to
+ * @file tuyaopen_claw_chat.h
+ * @brief tuyaopen_claw_chat module: AI stream event bridge for TuyaOpenClaw
* @version 0.1
* @date 2025-03-25
*/
-#ifndef __DUCKY_CLAW_CHAT_H__
-#define __DUCKY_CLAW_CHAT_H__
+#ifndef __TUYAOPEN_CLAW_CHAT_H__
+#define __TUYAOPEN_CLAW_CHAT_H__
#include "tuya_cloud_types.h"
#include "ai_chat_main.h"
@@ -26,10 +26,10 @@ extern "C" {
/***********************************************************
********************function declaration********************
***********************************************************/
-OPERATE_RET ducky_claw_chat_init(void);
+OPERATE_RET tuyaopen_claw_chat_init(void);
#ifdef __cplusplus
}
#endif
-#endif /* __DUCKY_CLAW_CHAT_H__ */
+#endif /* __TUYAOPEN_CLAW_CHAT_H__ */
diff --git a/memory/memory_manager.c b/memory/memory_manager.c
index dd8754f..24e991d 100644
--- a/memory/memory_manager.c
+++ b/memory/memory_manager.c
@@ -1,6 +1,6 @@
/**
* @file memory_manager.c
- * @brief Long-term memory and daily notes manager for DuckyClaw
+ * @brief Long-term memory and daily notes manager for TuyaOpenClaw
* @version 0.1
* @date 2026-03-04
*
diff --git a/memory/memory_manager.h b/memory/memory_manager.h
index c9311c3..bceb361 100644
--- a/memory/memory_manager.h
+++ b/memory/memory_manager.h
@@ -1,6 +1,6 @@
/**
* @file memory_manager.h
- * @brief Long-term memory and daily notes manager for DuckyClaw
+ * @brief Long-term memory and daily notes manager for TuyaOpenClaw
* @version 0.1
* @date 2026-03-04
*
diff --git a/memory/session_manager.c b/memory/session_manager.c
index aecc074..f1a4ecc 100644
--- a/memory/session_manager.c
+++ b/memory/session_manager.c
@@ -1,6 +1,6 @@
/**
* @file session_manager.c
- * @brief Multi-session conversation history manager for DuckyClaw
+ * @brief Multi-session conversation history manager for TuyaOpenClaw
* @version 0.1
* @date 2026-03-04
*
diff --git a/memory/session_manager.h b/memory/session_manager.h
index 05d8853..d9940f2 100644
--- a/memory/session_manager.h
+++ b/memory/session_manager.h
@@ -1,6 +1,6 @@
/**
* @file session_manager.h
- * @brief Multi-session conversation history manager for DuckyClaw
+ * @brief Multi-session conversation history manager for TuyaOpenClaw
* @version 0.1
* @date 2026-03-04
*
diff --git a/skills/skill_loader.c b/skills/skill_loader.c
index 7767411..3865e23 100644
--- a/skills/skill_loader.c
+++ b/skills/skill_loader.c
@@ -1,6 +1,6 @@
/**
* @file skill_loader.c
- * @brief Skill loader implementation for DuckyClaw
+ * @brief Skill loader implementation for TuyaOpenClaw
*
* Ported from TuyaOpen/apps/mimiclaw/skills/skill_loader.c.
* Key adaptations:
@@ -72,7 +72,7 @@
#define BUILTIN_SKILL_CREATOR \
"# Skill Creator\n" \
"\n" \
- "Create new skills for DuckyClaw.\n" \
+ "Create new skills for TuyaOpenClaw.\n" \
"\n" \
"## When to use\n" \
"When the user asks to create a new skill, teach the bot " \
diff --git a/skills/skill_loader.h b/skills/skill_loader.h
index 7e01700..171c444 100644
--- a/skills/skill_loader.h
+++ b/skills/skill_loader.h
@@ -1,6 +1,6 @@
/**
* @file skill_loader.h
- * @brief Skill loader for DuckyClaw
+ * @brief Skill loader for TuyaOpenClaw
*
* Manages skill files (.md) on the filesystem. Built-in skills are
* installed on first boot; users / the AI can create custom skills
diff --git a/src/app_cli_cmd.c b/src/app_cli_cmd.c
index 9963595..59223b5 100644
--- a/src/app_cli_cmd.c
+++ b/src/app_cli_cmd.c
@@ -1,6 +1,6 @@
/**
* @file cli_cmd.c
- * @brief Unified CLI implementation for DuckyClaw (config commands only)
+ * @brief Unified CLI implementation for TuyaOpenClaw (config commands only)
* @version 0.1
* @date 2026-04-08
* @copyright Copyright (c) Tuya Inc. All Rights Reserved.
@@ -401,7 +401,7 @@ static void cmd_help(int argc, char *argv[])
(void)argc;
(void)argv;
- tal_cli_echo("=== DuckyClaw CLI (config) ===");
+ tal_cli_echo("=== TuyaOpenClaw CLI (config) ===");
tal_cli_echo("");
tal_cli_echo("[Config]");
cli_echof_(" %-28s %s", "cfg_show", "Show effective config (KV > build)");
@@ -412,7 +412,7 @@ static void cmd_help(int argc, char *argv[])
cli_echof_(" %-28s %s", "cfg_set_gw_host ", "Set OpenClaw gateway host");
cli_echof_(" %-28s %s", "cfg_set_gw_port ", "Set OpenClaw gateway port");
cli_echof_(" %-28s %s", "cfg_set_gw_token ", "Set OpenClaw gateway token");
- cli_echof_(" %-28s %s", "cfg_set_device_id ", "Set DuckyClaw device ID");
+ cli_echof_(" %-28s %s", "cfg_set_device_id ", "Set TuyaOpenClaw device ID");
cli_echof_(" %-28s %s", "cfg_set_channel_mode ", "Set IM channel mode (telegram|discord|feishu|weixin|qqbot|OFF)");
cli_echof_(" %-28s %s", "cfg_set_tg_token ", "Set Telegram token");
cli_echof_(" %-28s %s", "cfg_set_dc_token ", "Set Discord token");
@@ -477,7 +477,7 @@ static void cmd_cfg_show(int argc, char *argv[])
snprintf(port_text, sizeof(port_text), "%u", (unsigned)OPENCLAW_GATEWAY_PORT);
cli_print_app_cfg_item_("gw_port", APP_KV_GW_PORT, port_text, false);
cli_print_app_cfg_item_("gw_token", APP_KV_GW_TOKEN, OPENCLAW_GATEWAY_TOKEN, true);
- cli_print_app_cfg_item_("device_id", APP_KV_DEVICE_ID, DUCKYCLAW_DEVICE_ID, true);
+ cli_print_app_cfg_item_("device_id", APP_KV_DEVICE_ID, TUYAOPENCLAW_DEVICE_ID, true);
tal_cli_echo("[IM]");
cli_print_im_cfg_item_("channel_mode", IM_NVS_BOT, IM_NVS_KEY_CHANNEL_MODE, IM_SECRET_CHANNEL_MODE, false);
diff --git a/src/tuya_app_main.c b/src/tuya_app_main.c
index 02b4c01..175c9fd 100755
--- a/src/tuya_app_main.c
+++ b/src/tuya_app_main.c
@@ -47,7 +47,7 @@
#include "ble_mgr.h"
#endif
-#include "ducky_claw_chat.h"
+#include "tuyaopen_claw_chat.h"
#include "reset_netcfg.h"
#include "app_im.h"
#include "sys_bus.h"
@@ -390,9 +390,9 @@ void user_main(void)
PR_ERR("sys_bus_init failed rt:%d", ret);
}
- ret = ducky_claw_chat_init();
+ ret = tuyaopen_claw_chat_init();
if (ret != OPRT_OK) {
- PR_ERR("ducky_claw_chat_init failed rt:%d", ret);
+ PR_ERR("tuyaopen_claw_chat_init failed rt:%d", ret);
}
ret = app_im_init();
diff --git a/src/ducky_claw_chat.c b/src/tuyaopen_claw_chat.c
similarity index 98%
rename from src/ducky_claw_chat.c
rename to src/tuyaopen_claw_chat.c
index 812a757..4fc1631 100755
--- a/src/ducky_claw_chat.c
+++ b/src/tuyaopen_claw_chat.c
@@ -1,5 +1,6 @@
/**
- * @file ducky_claw_chat_bot.c
+ * @file tuyaopen_claw_chat.c
+ * @brief AI stream event bridge for TuyaOpenClaw
* @version 0.1
* @date 2025-03-25
*/
@@ -16,7 +17,7 @@
#if defined(ENABLE_COMP_AI_VIDEO) && (ENABLE_COMP_AI_VIDEO == 1)
#include "ai_video_input.h"
#endif
-#include "ducky_claw_chat.h"
+#include "tuyaopen_claw_chat.h"
#include "agent_loop.h"
#include "acp_client.h"
@@ -221,7 +222,7 @@ static void __ai_chat_handle_event(AI_NOTIFY_EVENT_T *event)
}
}
-OPERATE_RET ducky_claw_chat_init(void)
+OPERATE_RET tuyaopen_claw_chat_init(void)
{
OPERATE_RET rt = OPRT_OK;
diff --git a/tools/tool_cron.c b/tools/tool_cron.c
index 221a840..dcc6783 100644
--- a/tools/tool_cron.c
+++ b/tools/tool_cron.c
@@ -1,6 +1,6 @@
/**
* @file tool_cron.c
- * @brief MCP cron (scheduled task) tools for DuckyClaw
+ * @brief MCP cron (scheduled task) tools for TuyaOpenClaw
* @version 0.1
* @date 2025-03-25
*
diff --git a/tools/tool_cron.h b/tools/tool_cron.h
index dc125b3..df89207 100644
--- a/tools/tool_cron.h
+++ b/tools/tool_cron.h
@@ -1,6 +1,6 @@
/**
* @file tool_cron.h
- * @brief MCP cron (scheduled task) tools for DuckyClaw
+ * @brief MCP cron (scheduled task) tools for TuyaOpenClaw
* @version 0.1
* @date 2025-03-25
*
diff --git a/tools/tool_exec.c b/tools/tool_exec.c
index 9bc9faa..0e51ccf 100644
--- a/tools/tool_exec.c
+++ b/tools/tool_exec.c
@@ -1,6 +1,6 @@
/**
* @file tool_exec.c
- * @brief MCP exec/system tools for DuckyClaw
+ * @brief MCP exec/system tools for TuyaOpenClaw
* @version 0.2
* @date 2026 -04-20
*
diff --git a/tools/tool_exec.h b/tools/tool_exec.h
index 002530b..f361610 100644
--- a/tools/tool_exec.h
+++ b/tools/tool_exec.h
@@ -1,6 +1,6 @@
/**
* @file tool_exec.h
- * @brief MCP exec/system tools for DuckyClaw
+ * @brief MCP exec/system tools for TuyaOpenClaw
* @version 0.1
* @date 2025-03-25
*
diff --git a/tools/tool_files.c b/tools/tool_files.c
index 7e2522e..99c6721 100644
--- a/tools/tool_files.c
+++ b/tools/tool_files.c
@@ -1,6 +1,6 @@
/**
* @file tool_files.c
- * @brief MCP file operation tools for DuckyClaw
+ * @brief MCP file operation tools for TuyaOpenClaw
* @version 0.1
* @date 2025-03-25
*
diff --git a/tools/tool_files.h b/tools/tool_files.h
index 355e199..453fce1 100644
--- a/tools/tool_files.h
+++ b/tools/tool_files.h
@@ -1,6 +1,6 @@
/**
* @file tool_files.h
- * @brief MCP file operation tools for DuckyClaw
+ * @brief MCP file operation tools for TuyaOpenClaw
* @version 0.2
* @date 2025-03-25
*
diff --git a/tools/tool_hw.c b/tools/tool_hw.c
index 7101d56..8708c56 100644
--- a/tools/tool_hw.c
+++ b/tools/tool_hw.c
@@ -1,6 +1,6 @@
/**
* @file tool_hw.c
- * @brief MCP hardware peripheral tools for DuckyClaw (T5 platform)
+ * @brief MCP hardware peripheral tools for TuyaOpenClaw (T5 platform)
* @version 0.2
* @date 2026-03-31
*
diff --git a/tools/tool_hw.h b/tools/tool_hw.h
index 7392b71..acef83d 100644
--- a/tools/tool_hw.h
+++ b/tools/tool_hw.h
@@ -1,6 +1,6 @@
/**
* @file tool_hw.h
- * @brief MCP hardware peripheral tools for DuckyClaw
+ * @brief MCP hardware peripheral tools for TuyaOpenClaw
* @version 0.1
* @date 2026-03-31
*
diff --git a/tools/tools_register.c b/tools/tools_register.c
index 15509c1..4b61fa9 100644
--- a/tools/tools_register.c
+++ b/tools/tools_register.c
@@ -1,6 +1,6 @@
/**
* @file tools_register.c
- * @brief MCP tools registration for DuckyClaw
+ * @brief MCP tools registration for TuyaOpenClaw
* @version 0.1
* @date 2025-03-25
*
@@ -48,7 +48,7 @@ static OPERATE_RET __ai_mcp_init(void *data)
OPERATE_RET rt = OPRT_OK;
#if defined(PLATFORM_LINUX) && (PLATFORM_LINUX == 1)
- rt = ai_mcp_server_init("DuckyClaw MCP Server", "1.0");
+ rt = ai_mcp_server_init("TuyaOpenClaw MCP Server", "1.0");
if (rt != OPRT_OK) {
return rt;
}
@@ -113,7 +113,7 @@ static OPERATE_RET __ai_mcp_init(void *data)
* @brief Initialize and register all MCP tools
*
* This function is called during MCP server initialization to register
- * all custom tools for the DuckyClaw project.
+ * all custom tools for the TuyaOpenClaw project.
*
* @return OPERATE_RET OPRT_OK on success, error code on failure
*/
@@ -123,7 +123,7 @@ OPERATE_RET tool_registry_init(void)
tal_event_subscribe(EVENT_MQTT_CONNECTED, "ai_mcp_init", __ai_mcp_init, SUBSCRIBE_TYPE_ONETIME);
- PR_DEBUG("DuckyClaw MCP tools registered successfully");
+ PR_DEBUG("TuyaOpenClaw MCP tools registered successfully");
return rt;
}