MCPcopy Index your code
hub / github.com/FoundDream/miniclawd

github.com/FoundDream/miniclawd @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
322 symbols 645 edges 49 files 154 documented · 48%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

🦞 miniclawd

一个轻量级的个人 AI 助手,支持多渠道接入。
使用 TypeScript + Bun 构建,仅 ~5900 行代码

miniclawd

English

灵感来源于 openclawdnanobot

特性

  • 多 LLM 支持 — Anthropic、OpenAI、Google、OpenRouter、Groq、AWS Bedrock
  • 多渠道接入 — Telegram、飞书
  • 内置工具 — 文件读写、Shell 执行、网页抓取
  • 技能系统 — 通过 Markdown 扩展能力
  • 持久记忆 — 长期记忆 + 每日笔记
  • 定时任务 — Cron 调度 + 心跳检查
  • 子代理 — 后台任务派生

截图

股票查询 Product Hunt
case1 case2

安装

通过 npm:

npm install -g miniclawd@latest
# 或: pnpm add -g miniclawd@latest

从源码安装:

git clone https://github.com/FoundDream/miniclawd.git
cd miniclawd
bun install && bun run build && bun link

快速开始

# 1. 初始化
miniclawd onboard

# 2. 添加 API Key 到 ~/.miniclawd/config.json
# 3. 开始对话
miniclawd agent -m "你好!"

命令

命令 说明
miniclawd onboard 初始化配置和工作区
miniclawd agent 交互式对话
miniclawd agent -m "..." 单条消息模式
miniclawd gateway 启动网关(Telegram/飞书)
miniclawd status 查看系统状态
miniclawd cron list 列出定时任务

配置

配置文件:~/.miniclawd/config.json

提供商

{
  "providers": {
    "anthropic": { "api_key": "sk-ant-..." },
    "openai": { "api_key": "sk-..." },
    "openrouter": { "api_key": "sk-or-..." },
    "google": { "api_key": "..." },
    "groq": { "api_key": "gsk_..." },
    "bedrock": { "region": "us-east-1" }
  }
}

模型

格式:provider/model

{
  "agents": {
    "defaults": {
      "model": "anthropic/claude-sonnet-4-20250514"
    }
  }
}

Telegram

  1. 通过 @BotFather 创建机器人 → /newbot
  2. 复制 Token,添加到配置:
{
  "channels": {
    "telegram": {
      "enabled": true,
      "token": "123456789:ABCdef...",
      "allow_from": []
    }
  }
}

飞书

  1. 飞书开放平台 创建应用
  2. 启用 WebSocket 模式,添加 im.message.receive_v1 事件
  3. 添加权限:im:messageim:message:send_as_bot
{
  "channels": {
    "feishu": {
      "enabled": true,
      "app_id": "cli_xxx",
      "app_secret": "xxx",
      "allow_from": []
    }
  }
}

配置完成后启动:miniclawd gateway

目录结构

~/.miniclawd/
├── config.json        # 配置文件
├── sessions/          # 会话存储 (JSONL)
├── media/             # 下载的媒体文件
├── cron/jobs.json     # 定时任务
└── workspace/
    ├── AGENTS.md      # Agent 指令
    ├── SOUL.md        # Agent 人设
    ├── USER.md        # 用户信息
    ├── HEARTBEAT.md   # 心跳任务
    ├── memory/        # 长期记忆
    └── skills/        # 自定义技能
src/
├── core/           # 类型和接口定义
├── application/    # 业务逻辑(Agent Loop、上下文、调度器)
├── infrastructure/ # LLM、存储、渠道、队列
├── tools/          # Agent 工具(fs、exec、web、message、spawn)
├── cli/            # 命令行界面
└── utils/          # 日志、路径工具

开发

bun run typecheck   # 类型检查
bun run dev -- ...  # 开发模式
bun run build       # 构建

License

MIT

Extension points exported contracts — how you extend this code

ITool (Interface)
(no doc) [10 implementers]
src/core/types/tool.ts
ISubagentManager (Interface)
(no doc) [2 implementers]
src/tools/spawn.ts
NanobotMetadata (Interface)
* Parsed nanobot metadata.
src/application/skills-loader.ts
AIProviderOptions (Interface)
(no doc)
src/infrastructure/llm/ai-sdk-provider.ts
IMessageBus (Interface)
(no doc) [2 implementers]
src/core/interfaces/message-bus.ts
SpawnOptions (Interface)
(no doc)
src/application/subagent.ts
ILLMProvider (Interface)
(no doc) [2 implementers]
src/core/interfaces/llm-provider.ts
SkillInfo (Interface)
(no doc)
src/application/skills-loader.ts

Core symbols most depended-on inside this repo

push
called by 74
src/infrastructure/queue/message-bus.ts
register
called by 16
src/tools/registry.ts
nowMs
called by 12
src/application/scheduler.ts
get
called by 11
src/tools/registry.ts
getWorkspacePath
called by 11
src/utils/paths.ts
loadConfig
called by 9
src/infrastructure/config/loader.ts
ensureDir
called by 9
src/utils/paths.ts
stripTags
called by 8
src/tools/web.ts

Shape

Method 178
Function 56
Class 48
Interface 40

Languages

TypeScript100%

Modules by API surface

src/application/scheduler.ts25 symbols
src/infrastructure/queue/message-bus.ts20 symbols
src/application/skills-loader.ts20 symbols
src/tools/web.ts16 symbols
src/infrastructure/storage/session-store.ts13 symbols
src/core/types/config.ts13 symbols
src/utils/paths.ts12 symbols
src/tools/fs.ts12 symbols
src/infrastructure/channels/telegram.ts12 symbols
src/core/interfaces/storage.ts12 symbols
src/tools/registry.ts11 symbols
src/infrastructure/storage/memory-store.ts11 symbols

For agents

$ claude mcp add miniclawd \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact