PkuClaw
使用指南

配置说明

区分启动期 TOML 配置与可热加载 runtime 文件。

PkuClaw 的配置分两层:

  1. 启动期配置configs/config.toml,用于 daemon 启动时确定数据目录、渠道凭据、provider 默认值等。
  2. 运行时配置configs/runtime/**,由 AgentWrapper、LoopManager 等组件热读取,Agent 也可以在任务需要时直接读写。

启动期配置

从示例文件开始:

cp configs/config.example.toml configs/config.toml

核心字段:

[app]
name = "PKU Course Bot"
data_dir = "data"
runtime_config_dir = "configs/runtime"
timezone = "Asia/Shanghai"

[agent]
provider = "codex"

[codex]
bin = "codex"
sandbox = "danger-full-access"
model = "gpt-5.5"
timeout_seconds = 1800
max_concurrent_runs = 1

:::caution danger-full-access 会让 Codex provider 使用 full-access/bypass 模式,适合可信本地 daemon。不要在不可信仓库、共享机器或未审计任务中随意启用;如改为更严格 sandbox,请预期部分 pku3b、文件读取或后台 loop 行为需要额外处理权限。 :::

:::caution 不要提交真实的 configs/config.toml、飞书 secret、用户 open id、token 或登录凭据。 :::

Runtime 配置

configs/runtime/runtime.example.json 是可提交模板;复制为本地 configs/runtime/runtime.json 后,daemon 会热加载其中的 agent、Codex、loop 和通知策略:

{
  "schema_version": 1,
  "agent": {
    "provider": "codex",
    "mode": "fixed",
    "model": "gpt-5.5",
    "reasoning_effort": "xhigh"
  },
  "codex": {
    "sandbox": "danger-full-access",
    "timeout_seconds": 1800
  },
  "loops": [
    {
      "id": "sync_notices",
      "enabled": true,
      "interval_seconds": 1800,
      "suggested_skills": ["tasks/sync-notices.md"],
      "sink_mode": "silent"
    }
  ],
  "notifications": {
    "policy": "important_only",
    "default_channel": "feishu",
    "default_target_type": "open_id",
    "default_target_id": "ou_xxx"
  }
}

Quick actions

configs/runtime/events.json 定义用户主动触发的实时快捷任务。每个 event 会变成普通 source = realtime run。

Prompt 模板

configs/runtime/prompts.json 定义 realtime 和 loop prompt 的文案。修改身份、规则、Objective、通知规则时优先改这个文件,而不是改 Python wrapper 代码。

Skill Catalog

configs/runtime/skills.json 是技能目录的 source of truth。Prompt 只注入目录元数据,不默认注入完整 skill markdown。

配置边界

类型示例是否热加载Agent 是否应直接修改
启动期配置configs/config.toml通常不应修改
Runtime 配置模板configs/runtime/runtime.example.json可以作为模板更新
Runtime 本地配置configs/runtime/runtime.json任务明确要求时可以,但不要提交
Quick actionsconfigs/runtime/events.json可以
Prompt 模板configs/runtime/prompts.json可以,但要谨慎
Skill Catalogconfigs/runtime/skills.jsonskills/**可以

继续阅读 Runtime 设计

On this page