bodybridge CLAUDE.md

bodybridge CLAUDE.md is an instructions file for coding agents from alice-jin-dev/bodybridge. It costs 932 tokens per session, scanned A, original, MIT.

Project instructions for Claude Code for BodyBridge, an open-source bridge between AI services and physical devices such as ESP32 boards and Raspberry Pi computers. They describe its architecture, technology choices, and rules for changing the code.

In plain words
What is it for?
Develop and maintain BodyBridge, including its MCP server, OAuth sign-in, device adapters, WebSocket connection, and ESP32 support.
Why use it?
They give Claude Code the project context and constraints needed to avoid breaking device connections, authentication, configuration, or migration compatibility.

Instructions file

Install

Getting it into your agent

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

agentmods
npx agentmods add instructions/alice-jin-dev/bodybridge/claude-md
Clone the repo
git clone --depth 1 https://github.com/alice-jin-dev/bodybridge

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 bodybridge CLAUDE.md

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

What it costs to keep this loaded

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

ModelPer sessionOnce invoked
Fable 5 $0.00932 $0.00932
Opus 5 $0.00466 $0.00466
Sonnet 5 $0.00186 $0.00186
Haiku 4.5 $0.00093 $0.00093

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

Security

Grade A, and why

bodybridge CLAUDE.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 4d 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.

CLAUDE.md · 52 lines

What it actually says

bodybridge — 项目须知(给 Claude Code)

这是什么

让具身设备(StackChan / 树莓派 / ESP32 等)经 claude.ai 自定义连接器接入 AI 的开源云端桥。 V1 的落地样本是 ESP32 基础学习套件(firmware/ 下只有 esp32-bodybridge);StackChan(小智固件) 是 V2 的样本,不是 V1 要接的设备。核心价值:零 API 费、零电脑依赖、全私有。

四层架构

  1. MCP Server 层:streamable-http 对外暴露,声明工具清单,接住 Claude 的工具调用。
  2. Auth 鉴权守门层:完整 OAuth 2.1 —— DCR 无状态注册 + PKCE + JWT 签发 + 中间件逐请求验 JWT。 密钥全走环境变量,绝不写死。 注:最初设计为静态 Token(理由:一人部署一份,不是多用户平台);后因 claude.ai 自定义 连接器只认 OAuth 入口、不接受静态 token,V1 落地为 OAuth 2.1。详见 MIGRATION.md。
  3. 设备 Adapter 插槽层(核心):标准接口 send_command / get_status / list_capabilities。 当前实例是 WebSocketAdapter(adapters/websocket.py);ESP32 参考固件是第一台用它的设备。 换设备=实现同一接口,桥身不动。 架构理念:依赖倒置 / 适配器模式,把变化关进插槽。
  4. Reflex 脊髓反射层(可选):设备端即时反应,不阻塞 V1。

技术栈

  • 语言:Python 3.10+
  • 项目管理:uv
  • MCP:官方 SDK(mcp),FastMCP,transport = streamable-http
  • 无状态优先(stateless_http)

六条血泪铁律(写代码时必须遵守)

  1. 环境变量向后兼容,绝不乱改名;改名要么保留旧名、要么给清晰迁移映射。
  2. 每个版本附"迁移必读"清单。
  3. 输入必须防御性处理,一个字符都不能崩掉服务;最坏结果只能是友好错误提示。
  4. 错误信息要说人话、暴露原因;不要用 raise_for_status 吞掉真实错误只甩状态码。
  5. 配置要有合理默认值 + 明确的必填提示。
  6. 别把 API 版本号等易变参数写死,要可配置。 附:给用户免费/低成本选项;密钥泄露即作废重发。

核心原则

  • 桥身求薄:不存业务数据、不做 AI 推理、不碰数据库。越轻越稳。
  • 手上只做 V1:只交付 V1 该有的东西,别提前造。
  • 一次一个变量:每层跑通了再动下一层,别几层一起改。

协作方式

  • 瑾儿 = 总军师(决策、审计、把关每一步)。
  • 你(Claude Code)= 施工队,负责执行。
  • 先给方案,不要擅自执行:任何改动先说清楚"打算怎么做",等瑾儿明确指令后再动手。改动先给 diff / 说明,确认后再落地。
  • 遇到以下情况必须上报、和瑾儿讨论,不要闷头处理:
    1. 发现和这份背景冲突,或有更好的做法;
    2. 指令或需求有模糊不清、可以有多种理解的地方;
    3. 执行中发现新的可行性、风险或坑。
  • 一次一个动作,一次一个变量。绝不硬编码密钥。

说明

  • 这份文件里的六条铁律、架构等,是当前阶段的约定,会随项目演进增删。以约定为准,但发现更优解随时提。
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. 4d ago First seen · 52 lines · 932 tokens per session scan A f76c14a2a76b

Subscribe to this mod's changes

bodybridge CLAUDE.md is an instructions file published in the GitHub repository alice-jin-dev/bodybridge (0 stars, last pushed 24d ago), licensed MIT. It adds 932 tokens to every session, about $0.0047 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.