Skip to content

格式设计 #192

@WhiteElephant-abc

Description

@WhiteElephant-abc

当然可以,elephant。下面是你要求的最终版完整格式设计(不含 context.md),所有内容都已经按你最新的纠正点修正过,没有任何多余结构,也没有提前设计 API 字段。

内容是最终定稿版,你可以直接纳入你的系统文档。


1. 权限配置标记格式(最终版)

@WhiteElephantIsNotARobot !cfg <flag> <flag> ...

flag 列表:

flag 含义
comment-only 仅允许写 comment
here-only 仅允许写当前 issue/pr 的 comment
repo=<owner/name> 仅允许写入指定仓库
deny=<owner/name> 禁止写入指定仓库
no-issue 禁止创建 issue
no-pr 禁止创建 pr
issue-limit=<n> 本 workflow 中最多创建 n 个 issue
pr-limit=<n> 本 workflow 中最多创建 n 个 pr
comment-limit=<n> 同一 issue/pr 最多 n 条 comment

示例:

@WhiteElephantIsNotARobot !cfg comment-only here-only
@WhiteElephantIsNotARobot !cfg repo=foo/bar pr-limit=0

2. 传输格式(repository_dispatch payload)

你要求:

  • 分片 / 不分片
  • 不分片 = 小于 64KB
  • 分片 = 直接传切割后的 base64
  • 传输协议不包含上下文字段(trigger/actor 等)

2.1 不分片格式(event_type = agent_small)

{
  "jobid": "<uuid>",
  "context_b64": "<base64字符串>",
  "timestamp": "<ISO8601>"
}

2.2 分片格式(event_type = agent_shard)

{
  "jobid": "<uuid>",
  "shard": {
    "index": 0,
    "total": 5
  },
  "context_b64": "<base64分片内容>",
  "timestamp": "<ISO8601>"
}

注意:分片格式就是这个,不存在额外结构。
context_b64 直接放切割后的 base64。


3. context(未编码前)

你要求:

  • 删除 context.json 的设计
  • 顶层结构也不要设计
  • 内部字段完全由 API 返回决定

因此 context 是一个任意 JSON,只要包含你抓到的 API 数据即可。


4. comment 追踪格式(日志 issue)

你要求:

  • issue/pr 使用 owner/repo#123
  • comment 使用完整链接
  • 仓库列表逗号分隔
  • 紧凑
Created Comments:
- https://github.com/owner/name/issues/123#issuecomment-xxxx

Created Issues:
- owner/name#456

Created PRs:
- owner/name#789

Affected Repositories:
owner/name, foo/bar, agent/fork

5. comment 标记格式(英文 NOTE 块)

> [!NOTE]
> Created from WhiteElephant-abc/agent#XX  
> Type `@WhiteElephantIsNotARobot go away` to block WhiteElephantIsNotARobot from this repository and all repositories under your account.

6. Claude Code 会话格式(紧凑 + 工具折叠)

你要求:

  • 工具调用与返回放一起
  • 默认折叠
  • 折叠外显示工具名 + 参数 + 成功/失败
## Session

[User]
<用户消息>

[Assistant]
<Claude 回复>

<details>
<summary>[ToolCall] <工具名>(<参数>) — success</summary>

Tool Call:
<json>

Tool Result:
<json>

</details>

---

失败时:

<summary>[ToolCall] <工具名>(<参数>) — failed</summary>

7. 报错格式(issue)

你要求:

  • 不记录 MCP 拒绝
  • 循环检测要折叠并节选日志

7.1 Claude Code 本体报错

## Error: Claude Code Runtime Error
<错误原文>

7.2 循环检测(折叠 + 节选日志)

## Error: Loop Detected

<details>
<summary>Repeated identical tool calls detected</summary>

<节选的相关日志片段或渲染后的 markdown>

</details>

如果你愿意,我可以继续为你生成:

  • 最终版 context.md(你刚刚要求我单独输出)
  • 最终版完整设计文档(整合所有格式)
  • 服务端/Actions/MCP 的代码骨架

你告诉我下一步。

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions