@brawnen/agent-harness-protocol 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,13 +1,34 @@
1
1
  {
2
- "$comment": "Claude Code hooks template for the future Node.js CLI. This file is an adapter example, not a final contract.",
2
+ "$comment": "Claude Code hooks template used by agent-harness init --host claude-code.",
3
3
  "hooks": {
4
+ "SessionStart": [
5
+ {
6
+ "matcher": "startup|resume|clear|compact",
7
+ "hooks": [
8
+ {
9
+ "type": "command",
10
+ "command": "npx @brawnen/agent-harness-cli hook claude session-start"
11
+ }
12
+ ]
13
+ }
14
+ ],
15
+ "UserPromptSubmit": [
16
+ {
17
+ "hooks": [
18
+ {
19
+ "type": "command",
20
+ "command": "npx @brawnen/agent-harness-cli hook claude user-prompt-submit"
21
+ }
22
+ ]
23
+ }
24
+ ],
4
25
  "PreToolUse": [
5
26
  {
6
27
  "matcher": "Write|Edit|Bash|NotebookEdit",
7
28
  "hooks": [
8
29
  {
9
30
  "type": "command",
10
- "command": "agent-harness gate before-tool --tool \"$TOOL_NAME\""
31
+ "command": "npx @brawnen/agent-harness-cli gate before-tool --tool \"$TOOL_NAME\""
11
32
  }
12
33
  ]
13
34
  }
@@ -18,7 +39,17 @@
18
39
  "hooks": [
19
40
  {
20
41
  "type": "command",
21
- "command": "agent-harness state update --tool \"$TOOL_NAME\" --exit-code \"$EXIT_CODE\""
42
+ "command": "npx @brawnen/agent-harness-cli state update --tool \"$TOOL_NAME\" --exit-code \"$EXIT_CODE\""
43
+ }
44
+ ]
45
+ }
46
+ ],
47
+ "Stop": [
48
+ {
49
+ "hooks": [
50
+ {
51
+ "type": "command",
52
+ "command": "npx @brawnen/agent-harness-cli hook claude stop"
22
53
  }
23
54
  ]
24
55
  }
@@ -10,5 +10,9 @@
10
10
 
11
11
  当前阶段说明:
12
12
 
13
- - 本目录只提供协议层接入示例
14
- - 未来正式命令以 `@brawnen/agent-harness-cli init` 为准
13
+ - `init --host claude-code` 当前已经会生成 `CLAUDE.md` 规则块并合并 `.claude/settings.json`
14
+ - `Claude Code` 当前已接入 `SessionStart / UserPromptSubmit / PreToolUse / PostToolUse / Stop`
15
+ - `SessionStart` 用于恢复 active task 摘要,`UserPromptSubmit` 用于 intake / continue / clarify / override
16
+ - `Stop` 当前承担最小完成门禁:当模型明显宣称任务完成时,要求先补齐 verify / report
17
+ - `PreToolUse / PostToolUse` 继续负责工具级 gate 与工具后状态更新
18
+ - 若要让 hooks 在目标项目里稳定可用,推荐在项目内安装 `@brawnen/agent-harness-cli`;模板中的 `npx @brawnen/agent-harness-cli ...` 也可作为零预装 fallback
@@ -0,0 +1,60 @@
1
+ {
2
+ "$comment": "Gemini CLI hooks template used by agent-harness init --host gemini-cli.",
3
+ "hooks": {
4
+ "SessionStart": [
5
+ {
6
+ "matcher": "*",
7
+ "hooks": [
8
+ {
9
+ "type": "command",
10
+ "command": "npx @brawnen/agent-harness-cli hook gemini session-start"
11
+ }
12
+ ]
13
+ }
14
+ ],
15
+ "BeforeAgent": [
16
+ {
17
+ "matcher": "*",
18
+ "hooks": [
19
+ {
20
+ "type": "command",
21
+ "command": "npx @brawnen/agent-harness-cli hook gemini before-agent"
22
+ }
23
+ ]
24
+ }
25
+ ],
26
+ "BeforeTool": [
27
+ {
28
+ "matcher": "run_shell_command|write_file|replace",
29
+ "hooks": [
30
+ {
31
+ "type": "command",
32
+ "command": "npx @brawnen/agent-harness-cli hook gemini before-tool"
33
+ }
34
+ ]
35
+ }
36
+ ],
37
+ "AfterTool": [
38
+ {
39
+ "matcher": "run_shell_command|write_file|replace",
40
+ "hooks": [
41
+ {
42
+ "type": "command",
43
+ "command": "npx @brawnen/agent-harness-cli hook gemini after-tool"
44
+ }
45
+ ]
46
+ }
47
+ ],
48
+ "AfterAgent": [
49
+ {
50
+ "matcher": "*",
51
+ "hooks": [
52
+ {
53
+ "type": "command",
54
+ "command": "npx @brawnen/agent-harness-cli hook gemini after-agent"
55
+ }
56
+ ]
57
+ }
58
+ ]
59
+ }
60
+ }
@@ -1,9 +1,28 @@
1
1
  # Gemini CLI Rules Injection
2
2
 
3
- 建议将 `rules/full.md` `rules/base.md` 注入项目根目录 `GEMINI.md`。
3
+ Gemini CLI 当前采用 `GEMINI.md` 规则注入 + `.gemini/settings.json` hooks 的接入方式。
4
4
 
5
- 当前阶段:
5
+ 推荐接入方式:
6
6
 
7
- - 以协议规则注入为主
8
- - CLI 初始化能力后续补齐
9
- - 本目录先保留最小适配说明,避免协议资源继续散落在历史目录中
7
+ 1. 在目标项目执行 `npx @brawnen/agent-harness-cli init --host gemini-cli`
8
+ 2. CLI 会生成:
9
+ - `harness.yaml`
10
+ - `.harness/tasks/`
11
+ - `.harness/state/`、`.harness/audit/`、`.harness/reports/`
12
+ - `GEMINI.md` 中的 agent-harness managed rules block
13
+ - `.gemini/settings.json` 中的 hook 配置
14
+ 3. Gemini CLI 在运行时通过 hooks 接入:
15
+ - `SessionStart`
16
+ - `BeforeAgent`
17
+ - `BeforeTool`
18
+ - `AfterTool`
19
+ - `AfterAgent`
20
+ 4. `GEMINI.md` 仍负责 L2 行为规则,状态持久化、验证、报告与交付收口继续通过 CLI 状态机承接
21
+
22
+ 当前支持边界:
23
+
24
+ - 有 `GEMINI.md` 规则注入
25
+ - 有 `.gemini/settings.json` hook 配置
26
+ - 有 `.harness` 运行时目录与 CLI 状态机
27
+ - 有 `SessionStart / BeforeAgent / BeforeTool / AfterTool / AfterAgent` 的最小 hook 闭环
28
+ - `gate / audit / verify / report / delivery` 仍由 CLI 核心逻辑提供
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brawnen/agent-harness-protocol",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Protocol assets for agent-harness: rules, schemas, templates, and adapter examples.",
5
5
  "license": "MIT",
6
6
  "files": [