Borrowing it
Nothing to install: this file belongs to riba2534/happyclaw. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.
curl -O https://raw.githubusercontent.com/riba2534/happyclaw/main/CLAUDE.mdgit clone --depth 1 https://github.com/riba2534/happyclawWrote 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.
[](https://agentmods.dev/instructions/riba2534/happyclaw/claude-md)<a href="https://agentmods.dev/instructions/riba2534/happyclaw/claude-md"><img src="https://agentmods.dev/badge/instructions/riba2534/happyclaw/claude-md/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/instructions/riba2534/happyclaw/claude-md"><img src="https://agentmods.dev/badge/instructions/riba2534/happyclaw/claude-md.svg" alt="Reviewed on agentmods" width="80" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.15547 | $0.15547 |
| Opus 5.5 | $0.06219 | $0.06219 |
| Sonnet 5.5 | $0.03109 | $0.03109 |
| Haiku 4.5 | $0.01555 | $0.01555 |
Grade A, and why
happyclaw 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 2d 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.
How it starts
The opening of the file, as written. The whole thing — 756 lines — stays where its author put it; the contents beside it link to each section on GitHub.
HappyClaw — 工程协作指南
本文档描述当前代码的工程约束和导航入口,供人类与 AI 协作者共同使用。
1. 文档与代码真相源
- 产品介绍、安装和常用操作:
README.md - 路由族与主要 Web API:
docs/API.md - 权限边界:
docs/ACL-MATRIX.md - 生产部署与回滚:
DEPLOYMENT.md - 运行时 Prompt:
container/agent-runner/prompts/ - 数据库 Schema:
src/db.ts中的CURRENT_SCHEMA_VERSION与建表/迁移代码 - Web 路由:
web/src/App.tsx - 系统设置及默认值:
src/runtime-config.ts - 渠道能力与会话路由:
src/im-channel-capabilities.ts、src/channel-mount-service.ts - StreamEvent:
shared/stream-event.ts - 模型连接预设、模型列表解析与上游错误分类:
shared/model-providers.ts - 第三方代码与许可:
THIRD_PARTY_NOTICES.md
docs/agent-first-architecture-plan.md 和
docs/claude-code-plugin-automation-design.md 是历史设计记录,不作为当前接口或数据结构的真相源。
2. 产品模型
HappyClaw 是基于 Claude Agent SDK 的自托管、多用户 Agent 工作台,支持 Web 与飞书、 Telegram、QQ、钉钉、微信、企业微信、Discord、WhatsApp。
当前产品层级:
Agent Profile(身份、四段 Prompt、能力策略)
└── Workspace(文件目录、执行模式、工作方式、环境变量、话题群绑定)
├── Runtime Session(独立 Claude 上下文,可绑定私聊或普通群;Host 工作区可选独立 git worktree)
├── Native Context Session(飞书话题等原生线程)
├── Automation(自动化:按计划把提示词作为真实的一轮发进会话)
└── Work Item(工作项:一件被授权的工作,由自己的执行会话完成;来自团队模式的群,
或多任务工作区里派出它的会话)
重要命名边界:
agent_profiles是产品级 Agent。registered_groups是当前兼容层中的工作区和渠道路由记录。agents表及/api/groups/:jid/agents是历史命名,实际表示工作区内的运行会话, 不是产品级 Agent Profile。- 工作区没有主会话,会话之间一视同仁:工作区 JID 不是任何会话的聊天地址,每个会话都是
agents行(kind='conversation'),地址为<工作区JID>#agent:<id>;工作区可以一个 会话都没有。会话列表的顺序(用户置顶的在前,然后按最近活跃)由shared/session-order.ts给出,Web 与 IM/list共用;置顶按用户记在user_pinned_sessions。旧库里每个工作区的 隐式主会话由 v88 迁移成普通会话(source_kind='legacy_main'),历史、Claude 上下文、 模型选择、渠道绑定和自动化随之迁移。 - 同一个 Workspace 内的会话共享工作区文件目录,但拥有独立 Claude Session; 工作区文件隔离与对话上下文隔离是两件事。
- 自动化(Automation)属于 Workspace,每次运行都是某个真实会话里的一轮:绑定已有会话
(Agent 在聊天里创建时默认绑定当前会话)、每次新建或持续会话。运行会话是普通
agents行(source_kind='automation'、automation_id),不是kind='task'。 - 例外是独立 worktree 的 Runtime Session:Host 工作区的工作目录是 git 仓库时,新建会话
可选它,宿主在
data/worktrees/{folder}/{sessionId}建分支happyclaw/<短 id>,该会话 每轮以它为 cwd,文件面板、项目 Skills 和 Review 面板也以它为根。worktree 缺失或损坏时 运行失败,不回退到主仓库;删除会话时移除 worktree、保留分支,有未提交改动或已初始化的 子模块时须确认。同一目录上的会话可以同时运行,界面不做提示。 - 团队模式(Team mode)按群开启(v1 只支持绑定到工作区某个会话的飞书普通群),关闭时
任何行为不变,群回到它绑定的会话。开启后,宿主为该群建一个路由会话
(
source_kind='team_router',不是群绑定的那个会话), 每个被接下的请求成为一个工作项(work_items),由它自己的执行会话 (source_kind='work_item';Host 工作区的 git 仓库用 worktree 会话)完成。只有路由会话在群里 说话;执行会话只能发一次确认,结果经work_report回流给路由会话。工作项的阶段 (等你回答、等你批准、受阻、失败、工作中、等待新消息)由记录派生,不存储。 - 工作区有工作方式
work_mode(存于workspace_agent_profiles):single(单任务,默认) 一条输入处理完再处理下一条,长任务在会话内完成,行为与没有这个设置时一致;multi(多任务) 下,普通会话可以用work_delegate把较大的任务派给 Worker,这一轮随即结束,会话继续接下一条 输入。派出的任务是派发型工作项(work_items.origin='delegated'),由它自己的执行会话 (source_kind='work_item',不建 worktree,与派出它的会话共用工作目录)完成;Worker 只用work_report(progress、ready、blocked、failed)。ready、blocked、failed,以及并非派出会话自己work_stop造成的停止(state="stopped"),以work_item_input注入派出它的会话,排在当前轮次 之后、不 steer,回复沿用派出那一轮所回答输入的来源路由;派出的会话转述给用户,用work_followup把用户的回答转给 Worker。派发、停止和跟进都只接受工作区主人亲自发起的轮次 (与install_skill同一闸门;派发请求不带inputTurnId时按非主人拒绝),每个会话最多 3 个、 每个工作区最多 5 个未结束,并受计费闸门约束;处理回报的那一轮不算主人亲自发起。独立 worktree 会话与自动化运行会话不能派发。Worker 的 summary 不超过 4000 字,更长的结果写进文件。Worker 一轮结束却没交回 ready、failed 或 blocked,或运行失败、被计费拒绝时,任务记为失败并告知派出的 会话;/break与停止不会取消排队中的派发回报(会话没有在跑的查询时立即交出处理),/clear、/fresh把它们排到重置之后照常处理。删除派出的会话会停止它未结束的任务。切回single后,还有未结束派发项的会话仍按多任务运行到它们结束(只是不能再派),切换不中断运行, 暖 Runner 在本轮结束后退役。团队模式的代码路径只处理origin='team'的工作项。
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.
- 2d ago Changed · +30 lines · +1,017 tokens per session 4d1931d61b3a
- 4d ago Changed · +38 lines · +1,157 tokens per session 1ad54891abd5
- 6d ago Changed · +36 lines · +1,057 tokens per session 14caff6bf2d6
- 7d ago Changed · +60 lines · +1,798 tokens per session 668f91747a69
- 8d ago Changed · +51 lines · +1,466 tokens per session bc8fe11baa9c
- 9d ago Changed · +39 lines · +1,035 tokens per session b8aaadf3d6a0
- 10d ago Changed · +25 lines · +701 tokens per session 555b8d5bc8e4
- 11d ago Changed · +9 lines · +261 tokens per session 4fb4ceb41075
- 25d ago Changed · +6 lines · +175 tokens per session 04be5b74ed1b
- 26d ago First seen · 462 lines · 6,880 tokens per session scan A 1287d6871fab
happyclaw CLAUDE.md is an instructions file published in the GitHub repository riba2534/happyclaw (845 stars, last pushed 2d ago), licensed MIT. It adds 15,547 tokens to every session, about $0.0622 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.
happyclaw CLAUDE.md compared with instructions from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| happyclaw CLAUDE.mdriba2534/happyclaw | Instructions file | 845 | 2d ago | MIT | A | 15,547 | Claude Code |
| vscode buildNext.instructions.mdmicrosoft/vscode | Instructions file | 195k | yesterday | MIT | A | 9,719 | GitHub Copilot |
| next.js AGENTS.mdvercel/next.js | Instructions file | 143k | yesterday | MIT | A | 7,461 | Codex, OpenCode |
| langchain AGENTS.mdlangchain-ai/langchain | Instructions file | 149k | yesterday | MIT | A | 4,680 | Codex, OpenCode |
| vscode oss-third-party-notices.instructions.mdmicrosoft/vscode | Instructions file | 195k | yesterday | MIT | A | 5,516 | GitHub Copilot |
| vscode copilot-instructions.mdmicrosoft/vscode | Instructions file | 195k | yesterday | MIT | A | 3,093 | GitHub Copilot |
| deepseek-harness AGENTS.mddeepseek-ai/deepseek-harness | Instructions file | 274k | 2d ago | MIT | A | 4,313 | Codex, OpenCode |