happyclaw CLAUDE.md

happyclaw CLAUDE.md is an instructions file for Claude Code from riba2534/happyclaw. It costs 4,752 tokens per session, scanned A, original, MIT.

Project instructions for HappyClaw, a self-hosted workspace where multiple users manage AI agents and conversations across web and messaging channels.

In plain words
What is it for?
Use them when changing HappyClaw so work follows the project's current architecture, routes, database schema, settings, prompts, and channel rules.
Why use it?
They identify which documents and source files define the current product, interfaces, permissions, data structure, and session behavior.

Instructions file for Claude Code

Written for Claude Code: the file is CLAUDE.md. Also seen: reads .claude/ paths; mentions CLAUDE.md.

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/riba2534/happyclaw/claude-md
Clone the repo
git clone --depth 1 https://github.com/riba2534/happyclaw

Made for: Claude Code.

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

README.md
[![agentmods](https://agentmods.dev/badge/instructions/riba2534/happyclaw/claude-md.svg)](https://agentmods.dev/instructions/riba2534/happyclaw/claude-md)
Your own site
<a href="https://agentmods.dev/instructions/riba2534/happyclaw/claude-md"><img src="https://agentmods.dev/badge/instructions/riba2534/happyclaw/claude-md.svg" alt="Measured on agentmods" height="20"></a>
Per session 4,752 This file is loaded in full into every session.
When invoked 4,752 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.1 $0.04752 $0.04752
Opus 5 $0.02376 $0.02376
Sonnet 5 $0.00950 $0.00950
Haiku 4.5 $0.00475 $0.00475

Measured 6d ago against content hash 5e72e3daf4fd, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

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 6d 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 · 377 lines

How it starts

The opening of the file, as written. The whole thing — 377 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.tssrc/channel-mount-service.ts
  • StreamEvent:shared/stream-event.ts

docs/agent-first-architecture-plan.mddocs/claude-code-plugin-automation-design.md 是历史设计记录,不作为当前接口或数据结构的真相源。

2. 产品模型

HappyClaw 是基于 Claude Agent SDK 的自托管、多用户 Agent 工作台,支持 Web 与飞书、 Telegram、QQ、钉钉、微信、企业微信、Discord、WhatsApp。

当前产品层级:

Agent Profile(身份、四段 Prompt、能力策略)
└── Workspace(文件目录、执行模式、环境变量、渠道群聊绑定)
    ├── Main Session
    ├── Runtime Session(独立 Claude 上下文,可绑定私聊)
    ├── Native Context Session(飞书话题等原生线程)
    └── Scheduled Run(group 或 isolated)

重要命名边界:

  • agent_profiles 是产品级 Agent。
  • registered_groups 是当前兼容层中的工作区和渠道路由记录。
  • agents 表及 /api/groups/:jid/agents 是历史命名,实际表示工作区内的运行会话, 不是产品级 Agent Profile。
  • 同一个 Workspace 内的会话共享工作区文件目录,但拥有独立 Claude Session; 工作区文件隔离与对话上下文隔离是两件事。

3. 主要模块

3.1 主服务

文件/目录 职责
src/index.ts 启动、消息消费、渠道路由、IPC、调度与 Agent 运行编排
src/web.ts Hono 应用、路由挂载、Cookie 认证、WebSocket 与静态资源
src/db.ts SQLite Schema、迁移和持久化访问器
src/group-queue.ts Session 串行、Runner 生命周期、重试与容量控制
src/container-runner.ts Host/Container Runner、挂载、环境与能力快照
src/task-scheduler.ts Cron、interval、once 调度和重启恢复
src/channel-mount-service.ts 工作区/会话绑定和原生线程路由
src/channel-reliability-store.ts Inbox、Turn、Outbox、Streaming Card 的持久状态机
src/im-manager.ts 多用户、多账号渠道连接池
src/agent-capability-preview.ts Agent 最终上下文和能力预览
src/claude-context-resolver.ts Claude 上下文、Skills 与来源解析

Read the full file on GitHub · 377 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 6d ago First seen · 377 lines · 4,752 tokens per session scan A 5e72e3daf4fd

Subscribe to this mod's changes

happyclaw CLAUDE.md is an instructions file published in the GitHub repository riba2534/happyclaw (818 stars, last pushed 4d ago), licensed MIT. It adds 4,752 tokens to every session, about $0.0238 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-30.