@bolloon/bolloon-agent 0.1.1 → 0.1.3
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.
- package/bin/bolloon-cli.cjs +165 -0
- package/bin/bolloon-daemon.sh +207 -0
- package/bin/bolloon.cmd +11 -0
- package/dist/agents/constraint-layer.js +10 -15
- package/dist/agents/pi-sdk.js +433 -106
- package/dist/agents/protocol.js +82 -1
- package/dist/agents/subagent-manager.js +2 -2
- package/dist/agents/workflow-engine.js +15 -20
- package/dist/agents/workflow-pivot-loop.js +541 -0
- package/dist/bollharness/src/index.js +5 -0
- package/dist/bollharness/src/scripts/checks/check_adr_plan_numbering.js +6 -0
- package/dist/bollharness/src/scripts/checks/check_api_types.js +45 -0
- package/dist/bollharness/src/scripts/checks/check_artifact_link.js +146 -0
- package/dist/bollharness/src/scripts/checks/check_bridge_deps.js +6 -0
- package/dist/bollharness/src/scripts/checks/check_bugfix_binding.js +6 -0
- package/dist/bollharness/src/scripts/checks/check_bugfix_binding_ci.js +6 -0
- package/dist/bollharness/src/scripts/checks/check_doc_file_references.js +6 -0
- package/dist/bollharness/src/scripts/checks/check_doc_freshness.js +135 -0
- package/dist/bollharness/src/scripts/checks/check_doc_links.js +31 -0
- package/dist/bollharness/src/scripts/checks/check_file_existence_claims.js +6 -0
- package/dist/bollharness/src/scripts/checks/check_fragment_integrity.js +34 -0
- package/dist/bollharness/src/scripts/checks/check_hook_installed.js +63 -0
- package/dist/bollharness/src/scripts/checks/check_issue_closure.js +41 -0
- package/dist/bollharness/src/scripts/checks/check_mcp_parity.js +6 -0
- package/dist/bollharness/src/scripts/checks/check_security.js +48 -0
- package/dist/bollharness/src/scripts/checks/check_skill_parity.js +6 -0
- package/dist/bollharness/src/scripts/checks/check_versions.js +6 -0
- package/dist/bollharness/src/scripts/checks/finding.js +13 -0
- package/dist/bollharness/src/scripts/checks/next_decision_number.js +20 -0
- package/dist/bollharness/src/scripts/checks/regenerate_magic_docs.js +6 -0
- package/dist/bollharness/src/scripts/ci/detect_rebaseline_triggers.js +8 -0
- package/dist/bollharness/src/scripts/ci/scan_subprocess_cfg.js +8 -0
- package/dist/bollharness/src/scripts/ci/scan_verify_artifacts.js +8 -0
- package/dist/bollharness/src/scripts/ci/scan_yaml_schema.js +8 -0
- package/dist/bollharness/src/scripts/context_router.js +67 -0
- package/dist/bollharness/src/scripts/deploy-guard.js +157 -0
- package/dist/bollharness/src/scripts/guard-feedback.js +192 -0
- package/dist/bollharness/src/scripts/guard_router.js +158 -0
- package/dist/bollharness/src/scripts/hooks/_hook_output.js +6 -0
- package/dist/bollharness/src/scripts/hooks/auto-python3.js +6 -0
- package/dist/bollharness/src/scripts/hooks/deploy-progress-on-session-end.js +6 -0
- package/dist/bollharness/src/scripts/hooks/failure-analyzer.js +6 -0
- package/dist/bollharness/src/scripts/hooks/gate-judgment-inject.js +92 -0
- package/dist/bollharness/src/scripts/hooks/gate-transition-judgment.js +63 -0
- package/dist/bollharness/src/scripts/hooks/inbox-ack.js +6 -0
- package/dist/bollharness/src/scripts/hooks/inbox-inject-on-start.js +6 -0
- package/dist/bollharness/src/scripts/hooks/inbox-validate.js +6 -0
- package/dist/bollharness/src/scripts/hooks/inbox-write-ledger.js +6 -0
- package/dist/bollharness/src/scripts/hooks/initializer-agent.js +6 -0
- package/dist/bollharness/src/scripts/hooks/loop-detection.js +73 -0
- package/dist/bollharness/src/scripts/hooks/owner-guard.js +6 -0
- package/dist/bollharness/src/scripts/hooks/precompact.js +6 -0
- package/dist/bollharness/src/scripts/hooks/review-agent-gatekeeper.js +6 -0
- package/dist/bollharness/src/scripts/hooks/risk-tracker.js +108 -0
- package/dist/bollharness/src/scripts/hooks/sanitize-on-read.js +6 -0
- package/dist/bollharness/src/scripts/hooks/session-reflection.js +7 -0
- package/dist/bollharness/src/scripts/hooks/session-start-magic-docs.js +7 -0
- package/dist/bollharness/src/scripts/hooks/session-start-reset-risk.js +7 -0
- package/dist/bollharness/src/scripts/hooks/session-start-toolkit-reminder.js +7 -0
- package/dist/bollharness/src/scripts/hooks/stop-evaluator.js +157 -0
- package/dist/bollharness/src/scripts/hooks/tool-call-counter.js +6 -0
- package/dist/bollharness/src/scripts/hooks/trace-analyzer.js +10 -0
- package/dist/bollharness/src/scripts/install/install-trust-token.js +7 -0
- package/dist/bollharness/src/scripts/install/multi_project_registry.js +9 -0
- package/dist/bollharness/src/scripts/install/phase2_auto.js +21 -0
- package/dist/bollharness/src/scripts/install/pre_commit_installer.js +6 -0
- package/dist/bollharness/src/scripts/install/tier_selector.js +7 -0
- package/dist/bollharness/src/scripts/install/transcript_miner.js +7 -0
- package/dist/bollharness/src/scripts/lib/claim_patterns.js +10 -0
- package/dist/bollharness/src/scripts/lib/sanitize_patterns.js +12 -0
- package/dist/bollharness/src/scripts/sanitize.js +6 -0
- package/dist/bollharness-integration/channel-judgment-engine.js +530 -0
- package/dist/bollharness-integration/context-chain-router.js +383 -0
- package/dist/bollharness-integration/context-router-judgment.js +13 -21
- package/dist/bollharness-integration/context-router.js +22 -64
- package/dist/bollharness-integration/gate-state-machine.js +14 -19
- package/dist/bollharness-integration/gate-transition-hooks.js +16 -61
- package/dist/bollharness-integration/guard-checker.js +21 -68
- package/dist/bollharness-integration/index.js +14 -124
- package/dist/bollharness-integration/integration.js +13 -20
- package/dist/bollharness-integration/llm-judgment-engine.js +569 -0
- package/dist/bollharness-integration/skill-adapter.js +18 -64
- package/dist/cli-entry.js +261 -0
- package/dist/constraint-runtime/src/commands.js +17 -7
- package/dist/constraint-runtime/src/constraint/budget.js +1 -6
- package/dist/constraint-runtime/src/constraint/permission.js +1 -6
- package/dist/constraint-runtime/src/models.js +1 -3
- package/dist/constraint-runtime/src/tools.js +17 -7
- package/dist/constraints/index.js +1 -7
- package/dist/documents/reader.js +8 -49
- package/dist/heartbeat/DaemonManager.js +242 -0
- package/dist/heartbeat/HealthMonitor.js +285 -0
- package/dist/heartbeat/StartupVerifier.js +205 -0
- package/dist/heartbeat/Watchdog.js +168 -0
- package/dist/heartbeat/index.js +84 -0
- package/dist/heartbeat/types.js +5 -0
- package/dist/index.js +381 -28
- package/dist/llm/config-store.js +31 -57
- package/dist/llm/llm-judgment-client.js +389 -0
- package/dist/llm/pi-ai.js +9 -52
- package/dist/network/agent-network.js +46 -90
- package/dist/network/hybrid-messenger.js +125 -0
- package/dist/network/iroh-bootstrap.js +38 -0
- package/dist/network/iroh-discovery.js +145 -0
- package/dist/network/iroh-integration.js +9 -16
- package/dist/network/iroh-transport.js +10 -48
- package/dist/network/p2p.js +23 -62
- package/dist/network/storage/adapters/json-adapter.js +4 -42
- package/dist/network/storage/index.js +147 -0
- package/dist/network/storage/types.js +14 -0
- package/dist/pi-ecosystem/index.js +233 -0
- package/dist/pi-ecosystem-colony/index.js +29 -90
- package/dist/pi-ecosystem-goals/index.js +20 -74
- package/dist/pi-ecosystem-judgment/decision.js +29 -47
- package/dist/pi-ecosystem-judgment/distillation.js +16 -29
- package/dist/pi-ecosystem-judgment/human-value-store.js +13 -60
- package/dist/pi-ecosystem-judgment/index.js +21 -74
- package/dist/pi-ecosystem-judgment/value-injection.js +26 -72
- package/dist/pi-ecosystem-mcp/index.js +24 -78
- package/dist/pi-ecosystem-subagents/index.js +20 -69
- package/dist/social/ant-colony/AdaptiveHeartbeat.js +3 -8
- package/dist/social/ant-colony/PheromoneEngine.js +11 -49
- package/dist/social/ant-colony/index.js +6 -0
- package/dist/social/ant-colony/types.js +4 -8
- package/dist/social/channels/ChannelManager.js +8 -46
- package/dist/social/channels/DiapChannelBridge.js +9 -47
- package/dist/social/channels/InterestMatcher.js +2 -7
- package/dist/social/channels/channel-agent-session.js +309 -0
- package/dist/social/channels/channel-heartbeat-agent.js +494 -0
- package/dist/social/channels/diap-doc-parser.js +204 -0
- package/dist/social/channels/harness-workflow-integrator.js +446 -0
- package/dist/social/channels/index.js +9 -0
- package/dist/social/channels/types.js +3 -7
- package/dist/social/global-shared-context.js +6 -47
- package/dist/social/heartbeat.js +29 -72
- package/dist/social/persona/enhanced-persona.js +299 -0
- package/dist/web/client.js +302 -136
- package/dist/web/components/p2p/index.js +159 -9
- package/dist/web/components/p2p/p2p-connection.js +136 -0
- package/dist/web/components/p2p/p2p-manager.js +24 -0
- package/dist/web/components/p2p/p2p-store-memory.js +1 -1
- package/dist/web/components/p2p/types.js +7 -0
- package/dist/web/index.html +5 -0
- package/dist/web/style.css +118 -0
- package/package.json +12 -6
- package/scripts/build-cli.js +206 -0
- package/scripts/postinstall.js +153 -0
- package/src/agents/pi-sdk.ts +347 -28
- package/src/agents/protocol.ts +95 -1
- package/src/agents/workflow-pivot-loop.ts +674 -0
- package/src/bollharness/CLAUDE.md +73 -0
- package/src/bollharness/README.md +143 -0
- package/src/bollharness/README.zh-CN.md +131 -0
- package/src/bollharness/reference/boll-reference/scripts/hooks/stop-evaluator.md +57 -0
- package/src/bollharness/scripts/context-fragments/artifact-linkage.md +14 -0
- package/src/bollharness/scripts/context-fragments/auth-consumers.md +17 -0
- package/src/bollharness/scripts/context-fragments/bridge-constitution.md +13 -0
- package/src/bollharness/scripts/context-fragments/catalyst-distributed.md +18 -0
- package/src/bollharness/scripts/context-fragments/closure-checklist.md +13 -0
- package/src/bollharness/scripts/context-fragments/contract-consumers.md +15 -0
- package/src/bollharness/scripts/context-fragments/db-shared-structures.md +15 -0
- package/src/bollharness/scripts/context-fragments/fixed-three-layers.md +19 -0
- package/src/bollharness/scripts/context-fragments/general-dev-principles.md +11 -0
- package/src/bollharness/scripts/context-fragments/issue-first.md +8 -0
- package/src/bollharness/scripts/context-fragments/mcp-parity.md +16 -0
- package/src/bollharness/scripts/context-fragments/pi-agent-operations.md +108 -0
- package/src/bollharness/scripts/context-fragments/protocol-consumers.md +15 -0
- package/src/bollharness/scripts/context-fragments/run-events-consumers.md +15 -0
- package/src/bollharness/scripts/context-fragments/scene-fidelity.md +13 -0
- package/src/bollharness/scripts/context-fragments/truth-source-hierarchy.md +15 -0
- package/src/bollharness/scripts/context-fragments/two-language.md +15 -0
- package/src/bollharness/scripts/context-fragments/version-sources.md +14 -0
- package/src/bollharness/scripts/hooks/stop-evaluator.md +83 -0
- package/src/bollharness/templates/scaffold/CLAUDE.md +89 -0
- package/src/cli-entry.ts +304 -0
- package/src/heartbeat/DaemonManager.ts +283 -0
- package/src/heartbeat/HealthMonitor.ts +316 -0
- package/src/heartbeat/StartupVerifier.ts +223 -0
- package/src/heartbeat/Watchdog.ts +198 -0
- package/src/heartbeat/index.ts +108 -0
- package/src/heartbeat/types.ts +82 -0
- package/src/llm/config-store.ts +23 -5
- package/src/network/iroh-transport.ts +3 -3
- package/src/web/client.js +302 -136
- package/src/web/components/p2p/P2PModal.tsx +91 -3
- package/src/web/components/p2p/index.ts +171 -9
- package/src/web/components/p2p/p2p-connection.ts +153 -1
- package/src/web/components/p2p/p2p-manager.ts +39 -1
- package/src/web/components/p2p/p2p-store-memory.ts +1 -1
- package/src/web/components/p2p/p2p-tools.ts +315 -0
- package/src/web/components/p2p/types.ts +58 -0
- package/src/web/design.md +99 -0
- package/src/web/index.html +5 -0
- package/src/web/server.ts +353 -36
- package/src/web/style.css +118 -0
- package/tsconfig.cli.json +16 -0
- package/tsconfig.electron.json +1 -1
- package/tsconfig.json +1 -2
- package/dist/web/server.js +0 -1647
- package/dist/web/server.js.map +0 -1
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# CLAUDE.md — bollharness
|
|
2
|
+
|
|
3
|
+
bollharness 是一个 **AI Agent Session 治理框架**——通过 Claude Code hooks、guards、上下文路由和安装器,给任意项目加装结构化的 agent 行为约束。
|
|
4
|
+
|
|
5
|
+
## 架构
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
bollharness/
|
|
9
|
+
├── .boll/
|
|
10
|
+
│ ├── settings.json # Hook 注册表(16 hooks,7 stages)
|
|
11
|
+
│ ├── rules/ # Path-scoped rules(Claude Code 按文件路径自动加载)
|
|
12
|
+
│ └── skills/ # Skill 定义(harness-dev-handoff, guardian-fixer 等)
|
|
13
|
+
├── scripts/
|
|
14
|
+
│ ├── hooks/ # 14 个 hook 脚本(session lifecycle + tool guards)
|
|
15
|
+
│ ├── guard-feedback.ts # PostToolUse 入口 — 上下文路由(机制 A)+ guard 检查(机制 B)
|
|
16
|
+
│ ├── deploy-guard.ts # PreToolUse Bash 入口 — 部署安全拦截
|
|
17
|
+
│ ├── context_router.ts # 文件路径 → 上下文片段路由表(ADR-030 §3.4.1)
|
|
18
|
+
│ ├── guard_router.ts # 文件路径 → guard 脚本映射(ADR-030 §3.3)
|
|
19
|
+
│ ├── context-fragments/ # 17 个上下文片段(guard-feedback.ts 注入用)
|
|
20
|
+
│ ├── checks/ # Guard 脚本(check_*.ts)
|
|
21
|
+
│ ├── install/ # 安装器(phase2_auto.ts + trust token)
|
|
22
|
+
│ └── lib/ # 共享库
|
|
23
|
+
├── templates/scaffold/ # 目标项目骨架模板(安装时复制)
|
|
24
|
+
├── schemas/ # YAML/JSON schema 定义
|
|
25
|
+
├── docs/decisions/ # ADR-030, ADR-038, ADR-041
|
|
26
|
+
└── .boll/MANIFEST.yaml # 物理清单(版本 + 文件注册表)
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
**同步覆盖范围**:
|
|
31
|
+
- Step 1: `scripts/hooks/*`(跳过 boll-only 的 `find-boll-root.sh`)
|
|
32
|
+
- Step 2: 路径修补(`find-boll-root.sh` → `find-project-root.sh`)
|
|
33
|
+
- Step 3: settings.json hook 注册对比
|
|
34
|
+
- Step 4: 共享脚本(guard-feedback.ts, deploy-guard.ts, context_router.ts, guard_router.ts)
|
|
35
|
+
- Step 5: context-fragments/ 目录
|
|
36
|
+
|
|
37
|
+
## 开发约束
|
|
38
|
+
|
|
39
|
+
### 必须遵守
|
|
40
|
+
- 所有命令使用 `npx ts-node`
|
|
41
|
+
- Commit message 中英双语 + `Co-Authored-By: Claude Opus 4.6`
|
|
42
|
+
- 审查类 subagent 必须用 opus 模型,不降级 sonnet
|
|
43
|
+
- 审查类 agent 工具白名单必须 schema-level 隔离写权限(ADR-038 D11)
|
|
44
|
+
- Guardian issue 必须先建 `docs/issues/*.md` 再写代码
|
|
45
|
+
|
|
46
|
+
### 安装器开发
|
|
47
|
+
- `phase2_auto.ts` 所有函数必须**幂等**(重复运行不改变结果)
|
|
48
|
+
- Trust token 使用 HMAC + 30min 滑动窗口 + 6h 绝对窗口
|
|
49
|
+
- 安装步骤顺序不可打乱(trust → bundle → scaffold → gitignore → paths → hooks)
|
|
50
|
+
|
|
51
|
+
### Hook 开发
|
|
52
|
+
- Hook 必须 fail-open(`|| true`)或有明确的 fail-closed 理由
|
|
53
|
+
- Hook timeout 不超过 30s(guard-feedback.ts 最大)
|
|
54
|
+
- 新增 hook 后必须同时更新 settings.json 注册和 MANIFEST.yaml
|
|
55
|
+
|
|
56
|
+
### 路径规则
|
|
57
|
+
- `find-project-root.sh` 是 bollharness 的项目根定位器(3 层锚点,fail-closed)
|
|
58
|
+
- `find-boll-root.sh` 是 boll 专用的(不同步到 bollharness)
|
|
59
|
+
- settings.json 中所有 hook command 使用**相对路径**解析器,不含绝对路径
|
|
60
|
+
|
|
61
|
+
## 接手入口
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
npx ts-node .boll/skills/harness-dev-handoff/scripts/collect_handoff_context.ts
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
然后读 `.boll/skills/harness-dev-handoff/SKILL.md`。
|
|
68
|
+
|
|
69
|
+
## 关键 ADR
|
|
70
|
+
|
|
71
|
+
- **ADR-030**: Guard Signal Protocol — 上下文路由 + guard 检查的设计
|
|
72
|
+
- **ADR-038**: Harness Optimization — 11 决策(metrics、fragment TTL、review agent 隔离等)
|
|
73
|
+
- **ADR-041**: Codex Division of Labor — 判断类 vs 执行类 subagent 分流
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
[中文](README.zh-CN.md) | English
|
|
2
|
+
|
|
3
|
+
# bollharness
|
|
4
|
+
|
|
5
|
+
> "How do you let AI handle so much development with so little supervision?"
|
|
6
|
+
|
|
7
|
+
This is the answer.
|
|
8
|
+
|
|
9
|
+
bollharness is a governance layer for [Claude Code](https://docs.anthropic.com/en/docs/claude-code). It makes AI agents reliable enough that you can set direction, walk away, and trust the work actually lands — with review gates, completion verification, and mechanical enforcement that no amount of prompting can replicate.
|
|
10
|
+
|
|
11
|
+
## The Problem
|
|
12
|
+
|
|
13
|
+
Claude Code is remarkably capable. But left unsupervised, it has structural biases:
|
|
14
|
+
|
|
15
|
+
- **Claims completion prematurely** — "all tests pass" (didn't run them)
|
|
16
|
+
- **Skips review** — "this change is simple enough" (it wasn't)
|
|
17
|
+
- **Drifts from plans** — starts fixing one bug, ends up refactoring three files
|
|
18
|
+
- **Self-evaluation bias** — asks itself "did I do a good job?", answers "yes"
|
|
19
|
+
|
|
20
|
+
You end up supervising more than you saved in development time. The 80% it does well makes the 20% it silently drops even harder to catch.
|
|
21
|
+
|
|
22
|
+
## The Insight
|
|
23
|
+
|
|
24
|
+
```
|
|
25
|
+
CLAUDE.md instruction compliance: ~20%
|
|
26
|
+
PreToolUse hook enforcement: 100%
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Instructions don't reliably change AI behavior. Mechanical constraints do.
|
|
30
|
+
|
|
31
|
+
A review agent told "don't modify files" obeys ~70% of the time. A review agent whose tool manifest doesn't list Edit/Write obeys 100% of the time — it physically can't call what isn't there.
|
|
32
|
+
|
|
33
|
+
bollharness applies this principle everywhere: if it matters, enforce it with a hook, not a sentence.
|
|
34
|
+
|
|
35
|
+
## What Changes
|
|
36
|
+
|
|
37
|
+
| Without bollharness | With bollharness |
|
|
38
|
+
|---|---|
|
|
39
|
+
| "Did you run the tests?" → "Yes" (didn't) | Mechanical gate checks `progress.json` — can't fake evidence |
|
|
40
|
+
| AI stops mid-chat, injects completion checklist | Stop hook parses session transcript — only triggers when uncommitted writes exist |
|
|
41
|
+
| Review agent "helpfully" edits what it reviews | Review agent physically cannot call Edit/Write (schema-level isolation) |
|
|
42
|
+
| "This PR is simple, let's skip review" | Gates 2/4/6/8 mechanically require independent review — no exceptions |
|
|
43
|
+
| Parallel AI sessions contaminate each other | Each session's scope is isolated via its own transcript file |
|
|
44
|
+
| Agent drifts into unrelated fixes | Context routing injects domain-specific rules only for files being edited |
|
|
45
|
+
|
|
46
|
+
## How It Works
|
|
47
|
+
|
|
48
|
+
### Hooks: enforcement at the moment of action
|
|
49
|
+
|
|
50
|
+
16 hooks across 7 lifecycle stages. They intercept *as things happen*, not after:
|
|
51
|
+
|
|
52
|
+
```
|
|
53
|
+
SessionStart → Load context, reset risk state, surface tools
|
|
54
|
+
PreToolUse → Block unsafe deploys, gate review agents, sanitize reads
|
|
55
|
+
PostToolUse → Route context on edit, detect loops, track risk
|
|
56
|
+
Stop → Verify completion candidate exists (transcript × git diff)
|
|
57
|
+
SessionEnd → Reflect, analyze traces, persist progress
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### The 8-Gate State Machine
|
|
61
|
+
|
|
62
|
+
Every significant change flows through gates. Even-numbered gates require independent review — not the same agent checking its own work:
|
|
63
|
+
|
|
64
|
+
```
|
|
65
|
+
G0 Problem → G1 Design → G2 Review*
|
|
66
|
+
→ G3 Plan → G4 Review+Lock*
|
|
67
|
+
→ G5 Tasks → G6 Review*
|
|
68
|
+
→ G7 Execute+Log → G8 Final Review*
|
|
69
|
+
|
|
70
|
+
* = Independent reviewer (separate context, read-only tools)
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### Automated Checks
|
|
74
|
+
|
|
75
|
+
15 validators run on file changes: API type consistency, doc freshness, security patterns, fragment integrity, hook registration, and more. They catch drift before it compounds.
|
|
76
|
+
|
|
77
|
+
### Skills
|
|
78
|
+
|
|
79
|
+
16 specialized behaviors — from architecture design (`arch`) to failure pattern extraction (`crystal-learn`) to structured bug triage (`bug-triage`). Skills install judgment frameworks, not rule lists, so the agent can navigate situations the skill didn't explicitly cover.
|
|
80
|
+
|
|
81
|
+
Each skill has `{{PLACEHOLDER}}` structural slots designed to be filled with your project's context during installation.
|
|
82
|
+
|
|
83
|
+
## Install
|
|
84
|
+
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### Three Tiers
|
|
88
|
+
|
|
89
|
+
| Tier | Trust level | What happens |
|
|
90
|
+
|------|-------------|-------------|
|
|
91
|
+
| **drop-in** | Minimal | Installs hooks + skills as-is. Try it, see what happens. |
|
|
92
|
+
| **adapt** | Medium | Reads your README + docs, customizes skills to your project. |
|
|
93
|
+
| **mine** | Full | Reads your work transcripts, deeply adapts to your patterns. |
|
|
94
|
+
|
|
95
|
+
### What Gets Installed
|
|
96
|
+
|
|
97
|
+
```
|
|
98
|
+
your-project/
|
|
99
|
+
├── .boll/
|
|
100
|
+
│ ├── settings.json # Hook registrations (appends, won't clobber)
|
|
101
|
+
│ ├── skills/ # 16 agent behavior definitions
|
|
102
|
+
│ └── rules/ # Path-scoped context (auto-loaded by file path)
|
|
103
|
+
├── scripts/
|
|
104
|
+
│ ├── hooks/ # 16 lifecycle hooks
|
|
105
|
+
│ └── checks/ # 15 automated validators
|
|
106
|
+
└── CLAUDE.md # Governance guide (generated, yours to edit)
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
The installer is idempotent — run it twice, get the same result.
|
|
110
|
+
|
|
111
|
+
## Design Principles
|
|
112
|
+
|
|
113
|
+
1. **Hooks over instructions** — If compliance matters, don't ask. Enforce.
|
|
114
|
+
2. **Schema-level isolation** — Review agents' tool manifests exclude write tools. Not "please don't" — *can't*.
|
|
115
|
+
3. **Fail-open where safe** — A hook that can't read its data injects *more* checks, not fewer. The failure mode is always "too cautious," never "silently skipped."
|
|
116
|
+
4. **Session isolation** — Completion detection uses per-session transcript parsing. No shared mutable state between parallel sessions.
|
|
117
|
+
5. **Structural slots over blank space** — Project-specific content becomes `{{PLACEHOLDER}}` with meta-instructions (what to put, why it matters, how to discover it), not empty fields you forget to fill.
|
|
118
|
+
|
|
119
|
+
## Requirements
|
|
120
|
+
|
|
121
|
+
- [Claude Code](https://docs.anthropic.com/en/docs/claude-code) CLI
|
|
122
|
+
- Node.js 18+
|
|
123
|
+
- Git
|
|
124
|
+
|
|
125
|
+
## Origin
|
|
126
|
+
|
|
127
|
+
Born from 6 months of production use on [boll](https://boll.net), an agent collaboration protocol. The governance layer kept proving independently valuable — every AI-assisted project needs it, not just ours. So we extracted it.
|
|
128
|
+
|
|
129
|
+
The hooks, gates, and isolation patterns were designed by getting burned first, then building the guard. Every rule in this system exists because an AI agent found a creative way to not follow the previous rule.
|
|
130
|
+
|
|
131
|
+
## Acknowledgments
|
|
132
|
+
|
|
133
|
+
This project was originally developed in Python as `wow-harness` and has been migrated to TypeScript for improved type safety, better developer experience, and tighter integration with modern JavaScript/TypeScript tooling.
|
|
134
|
+
|
|
135
|
+
The migration preserved all original functionality while leveraging TypeScript's:
|
|
136
|
+
- Static type checking for reduced runtime errors
|
|
137
|
+
- Better IDE support and code completion
|
|
138
|
+
- Improved maintainability for larger codebases
|
|
139
|
+
- Native ES modules and modern JavaScript features
|
|
140
|
+
|
|
141
|
+
## License
|
|
142
|
+
|
|
143
|
+
MIT
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
中文 | [English](README.md)
|
|
2
|
+
|
|
3
|
+
# bollharness
|
|
4
|
+
|
|
5
|
+
> "你怎么做到让 AI 自己开发,人几乎不用管?"
|
|
6
|
+
|
|
7
|
+
这就是答案。
|
|
8
|
+
|
|
9
|
+
bollharness 是 [Claude Code](https://docs.anthropic.com/en/docs/claude-code) 的治理层。它让 AI agent 变得足够可靠——你定方向,AI 交付,工作真的能落地。靠的不是提示词里多写几句"请认真做",而是机械化的审查门禁、完成验证和工具隔离。
|
|
10
|
+
|
|
11
|
+
## 问题
|
|
12
|
+
|
|
13
|
+
Claude Code 能力很强。但不加约束时,它有结构性偏见:
|
|
14
|
+
|
|
15
|
+
- **假装完成** — "测试全过了"(其实没跑)
|
|
16
|
+
- **跳过审查** — "这个改动很简单"(并不简单)
|
|
17
|
+
- **任务漂移** — 修一个 bug,顺手重构三个文件
|
|
18
|
+
- **自我评价偏差** — 问自己"做得好不好?",回答"好"
|
|
19
|
+
|
|
20
|
+
你花在监督上的时间,比省下的开发时间还多。更难受的是,它做对的 80% 让你放松警惕,剩下 20% 的静默遗漏更难发现。
|
|
21
|
+
|
|
22
|
+
## 核心洞察
|
|
23
|
+
|
|
24
|
+
```
|
|
25
|
+
CLAUDE.md 指令遵从率: ~20%
|
|
26
|
+
PreToolUse hook 执行率: 100%
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
指令改变不了 AI 的行为。机械约束可以。
|
|
30
|
+
|
|
31
|
+
告诉审查 agent "不要修改文件",遵从率约 70%。把 Edit/Write 从它的工具清单里删掉,遵从率 100%——它物理上调不了不存在的工具。
|
|
32
|
+
|
|
33
|
+
bollharness 把这个原则应用到所有该管的地方:重要的事不靠说,靠 hook。
|
|
34
|
+
|
|
35
|
+
## 装了之后有什么变化
|
|
36
|
+
|
|
37
|
+
| 没有 bollharness | 有 bollharness |
|
|
38
|
+
|---|---|
|
|
39
|
+
| "跑测试了吗?" → "跑了"(没跑) | 机械化门禁检查 `progress.json` — 伪造不了证据 |
|
|
40
|
+
| 纯聊天时弹出完成检查清单 | Stop hook 解析 session transcript — 只在有未提交的编辑时才触发 |
|
|
41
|
+
| 审查 agent "顺手"改了它审查的代码 | 审查 agent 物理上无法调用 Edit/Write(schema 级隔离) |
|
|
42
|
+
| "这个 PR 简单,跳过审查吧" | Gate 2/4/6/8 机械化强制独立审查 — 没有例外 |
|
|
43
|
+
| 并行 AI session 互相污染 | 每个 session 通过独立 transcript 文件隔离作用域 |
|
|
44
|
+
| Agent 漂移去修不相关的东西 | 上下文路由只对正在编辑的文件注入领域规则 |
|
|
45
|
+
|
|
46
|
+
## 怎么工作的
|
|
47
|
+
|
|
48
|
+
### Hook:在动作发生的那一刻介入
|
|
49
|
+
|
|
50
|
+
16 个 hook 覆盖 7 个生命周期阶段。不是事后审查,是实时拦截:
|
|
51
|
+
|
|
52
|
+
```
|
|
53
|
+
SessionStart → 加载上下文、重置风险状态、展示可用工具
|
|
54
|
+
PreToolUse → 拦截危险部署、门控审查 agent、净化读取内容
|
|
55
|
+
PostToolUse → 编辑时路由上下文、检测循环、追踪风险
|
|
56
|
+
Stop → 验证是否存在完成候选品(transcript × git diff)
|
|
57
|
+
SessionEnd → 反思、分析轨迹、持久化进度
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### 8 关状态机
|
|
61
|
+
|
|
62
|
+
每个重要变更都要过关。偶数关要求独立审查——不是同一个 agent 自己检查自己的工作:
|
|
63
|
+
|
|
64
|
+
```
|
|
65
|
+
G0 问题 → G1 设计 → G2 审查*
|
|
66
|
+
→ G3 方案 → G4 审查+锁定*
|
|
67
|
+
→ G5 任务拆分 → G6 审查*
|
|
68
|
+
→ G7 执行+日志 → G8 终审*
|
|
69
|
+
|
|
70
|
+
* = 独立审查者(独立上下文、只读工具)
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### 自动化检查
|
|
74
|
+
|
|
75
|
+
15 个验证器在文件变更时运行:API 类型一致性、文档新鲜度、安全模式、片段完整性、hook 注册等。在漂移累积之前就抓住它。
|
|
76
|
+
|
|
77
|
+
### Skill
|
|
78
|
+
|
|
79
|
+
16 个专业化行为——从架构设计(`arch`)到失败模式提取(`crystal-learn`)到结构化 bug 分诊(`bug-triage`)。Skill 安装的是判断框架,不是规则清单,所以 agent 能应对 skill 没明确覆盖的情况。
|
|
80
|
+
|
|
81
|
+
每个 skill 都有 `{{PLACEHOLDER}}` 结构化槽位,安装时会填入你项目的上下文。
|
|
82
|
+
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### 三个层级
|
|
86
|
+
|
|
87
|
+
| 层级 | 信任度 | 效果 |
|
|
88
|
+
|------|--------|------|
|
|
89
|
+
| **drop-in** | 最低 | 原样安装 hook + skill。先试试看。 |
|
|
90
|
+
| **adapt** | 中等 | 读你的 README + 文档,把 skill 适配到你的项目。 |
|
|
91
|
+
| **mine** | 完全 | 读你的工作 transcript,深度适配到你的模式。 |
|
|
92
|
+
|
|
93
|
+
### 安装了什么
|
|
94
|
+
|
|
95
|
+
```
|
|
96
|
+
your-project/
|
|
97
|
+
├── .boll/
|
|
98
|
+
│ ├── settings.json # Hook 注册(追加模式,不覆盖已有配置)
|
|
99
|
+
│ ├── skills/ # 16 个 agent 行为定义
|
|
100
|
+
│ └── rules/ # 路径作用域上下文规则(按文件路径自动加载)
|
|
101
|
+
├── scripts/
|
|
102
|
+
│ ├── hooks/ # 16 个生命周期 hook
|
|
103
|
+
│ └── checks/ # 15 个自动化验证器
|
|
104
|
+
└── CLAUDE.md # 治理指南(自动生成,你可以自由编辑)
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
安装器是幂等的——跑两次,结果一样。
|
|
108
|
+
|
|
109
|
+
## 设计原则
|
|
110
|
+
|
|
111
|
+
1. **Hook 优于指令** — 重要的事不靠说,靠执行。
|
|
112
|
+
2. **Schema 级隔离** — 审查 agent 的工具清单里没有写工具。不是"请不要"——是"不能"。
|
|
113
|
+
3. **安全方向 fail-open** — hook 读不到数据时注入*更多*检查,不是更少。失败模式永远是"过于谨慎",绝不是"静默跳过"。
|
|
114
|
+
4. **Session 隔离** — 完成检测用每个 session 独立的 transcript 解析。并行 session 之间零共享可变状态。
|
|
115
|
+
5. **结构化槽位** — 项目特定内容变成 `{{PLACEHOLDER}}` + 元指令(放什么、为什么重要、怎么发现它),不是你忘记填的空白字段。
|
|
116
|
+
|
|
117
|
+
## 环境要求
|
|
118
|
+
|
|
119
|
+
- [Claude Code](https://docs.anthropic.com/en/docs/claude-code) CLI
|
|
120
|
+
- Node.js 18+
|
|
121
|
+
- Git
|
|
122
|
+
|
|
123
|
+
## 来历
|
|
124
|
+
|
|
125
|
+
从 [boll](https://boll.net)(流形,一个 Agent 协作协议项目)6 个月的生产使用中提取出来的。治理层不断证明它独立于项目也有价值——每个 AI 辅助开发的项目都需要它,不只是我们的。
|
|
126
|
+
|
|
127
|
+
这里的每一条 hook、每一个 gate、每一种隔离模式,都是因为 AI agent 找到了创造性的方法来绕过上一条规则,所以才被加上的。不是设计出来的,是被逼出来的。
|
|
128
|
+
|
|
129
|
+
## License
|
|
130
|
+
|
|
131
|
+
MIT
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# Stop Hook: PreCompletionChecklist + On-Demand Evaluator
|
|
2
|
+
|
|
3
|
+
你是独立 Evaluator。你的工作是在 agent 完成任务前验证工作质量。
|
|
4
|
+
|
|
5
|
+
## PreCompletionChecklist
|
|
6
|
+
|
|
7
|
+
在允许完成前,逐条验证:
|
|
8
|
+
|
|
9
|
+
1. **Git 状态**: 所有新文件是否已 `git add`?是否有未保存的变更?
|
|
10
|
+
2. **测试**: 如果有代码变更,相关测试是否通过?运行 `backend/venv/bin/pytest -q backend/tests/unit --tb=no -q` 确认。
|
|
11
|
+
3. **文档一致性**: 代码变更是否需要更新文档?路由变更是否反映在路由表中?
|
|
12
|
+
4. **无半成品**: 是否有 TODO/FIXME/HACK 被遗留?是否有 dead code 或未使用的 import?
|
|
13
|
+
5. **契约一致性**: API 类型、路由路径、配置 key 是否在所有引用处一致?
|
|
14
|
+
|
|
15
|
+
## On-Demand Evaluator
|
|
16
|
+
|
|
17
|
+
如果当前任务 scope >= 3 files 或涉及 API 契约变更,额外执行 Grading Criteria 评估:
|
|
18
|
+
|
|
19
|
+
| 维度 | 检查点 |
|
|
20
|
+
|------|--------|
|
|
21
|
+
| **Design Quality** | 架构是否合理?是否利用了现有模式? |
|
|
22
|
+
| **Originality** | 是否超越模板化实现? |
|
|
23
|
+
| **Craft** | 代码清洁、命名一致、边界处理、无 AI slop |
|
|
24
|
+
| **Functionality** | 核心路径可走通、契约一致、无断裂 |
|
|
25
|
+
|
|
26
|
+
每维 1-5 分。**硬阈值: 任何维 < 3 = FAIL**。
|
|
27
|
+
|
|
28
|
+
## 重要警告
|
|
29
|
+
|
|
30
|
+
你天然倾向于"识别问题后说服自己不是大问题"。**抵抗这个倾向。**
|
|
31
|
+
|
|
32
|
+
具体表现:
|
|
33
|
+
- "代码看起来正确" — 不够,要实际验证
|
|
34
|
+
- "测试已经通过了" — 哪些测试?覆盖了变更吗?
|
|
35
|
+
- "这个小问题不影响功能" — 小问题累积成大问题
|
|
36
|
+
|
|
37
|
+
**如果不确定,判为 FAIL。宁严勿松。**
|
|
38
|
+
|
|
39
|
+
## 输出格式
|
|
40
|
+
|
|
41
|
+
```
|
|
42
|
+
## PreCompletionChecklist
|
|
43
|
+
- [x/!] Git 状态: ...
|
|
44
|
+
- [x/!] 测试: ...
|
|
45
|
+
- [x/!] 文档一致性: ...
|
|
46
|
+
- [x/!] 无半成品: ...
|
|
47
|
+
- [x/!] 契约一致性: ...
|
|
48
|
+
|
|
49
|
+
## Evaluator (如果触发)
|
|
50
|
+
Design Quality: X/5
|
|
51
|
+
Originality: X/5
|
|
52
|
+
Craft: X/5
|
|
53
|
+
Functionality: X/5
|
|
54
|
+
|
|
55
|
+
## 裁决: PASS / FAIL
|
|
56
|
+
原因: ...
|
|
57
|
+
```
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
## 代码变更与 Artifact 关联
|
|
2
|
+
|
|
3
|
+
你正在编辑决策文档。代码变更必须伴随相应的 artifact:
|
|
4
|
+
|
|
5
|
+
| 变更类型 | 必须伴随的 artifact |
|
|
6
|
+
|----------|---------------------|
|
|
7
|
+
| 新功能 | ADR 或 PLAN 文档 |
|
|
8
|
+
| Bug 修复 | Issue 文档(含根因分析) |
|
|
9
|
+
| 架构变更 | ADR + 影响范围分析 |
|
|
10
|
+
| 契约变更 | 消费方清单 + 迁移说明 |
|
|
11
|
+
|
|
12
|
+
**行为约束**: 不得提交无 artifact 关联的重大变更。
|
|
13
|
+
目标态文档不得使用"已完成"语气描述尚未实现的功能(承诺 vs 现实漂移)。
|
|
14
|
+
PLAN 文档中的 WP 状态必须反映实际代码状态,不是计划状态。
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
## 认证消费方与安全约定
|
|
2
|
+
|
|
3
|
+
你正在编辑认证相关代码。以下是认证体系的消费方:
|
|
4
|
+
|
|
5
|
+
| 消费方 | 认证方式 | 入口文件 |
|
|
6
|
+
|--------|----------|----------|
|
|
7
|
+
| Protocol API | session token (Bearer) | `backend/product/auth/middleware.py` |
|
|
8
|
+
| MCP Server (Python) | session token | `mcp-server/boll_mcp/client.py` |
|
|
9
|
+
| MCP Server (Node) | session token | `mcp-server-node/src/client.ts` |
|
|
10
|
+
| SecondMe OAuth | client_id + secret | `backend/product/auth/secondme.py` |
|
|
11
|
+
| Bridge API | bridge API key | `backend/product/routes/bridge.py` |
|
|
12
|
+
| Admin API | admin key | `backend/product/routes/admin.py` |
|
|
13
|
+
| WebSocket | ticket auth | `backend/product/ws/` |
|
|
14
|
+
|
|
15
|
+
**行为约束**: 前端不得暴露任何 API Key。SecondMe OAuth 的 client_secret 不得硬编码。
|
|
16
|
+
修改认证中间件时,必须确认所有消费方的认证链路不受影响。
|
|
17
|
+
session token 必须有 TTL,不得发放永不过期的 token。
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
## Bridge 宪法(ADR-026)
|
|
2
|
+
|
|
3
|
+
你正在编辑 Bridge 相关代码。以下 5 条规则约束所有 bridge 改动:
|
|
4
|
+
|
|
5
|
+
1. **Worker 不拥有业务解释权,只上报执行事实。** 如果代码需要理解输出内容的含义,它写错了地方。
|
|
6
|
+
2. **同一个语义只允许有一个定义。** 文件名模式、artifact 类型、event 含义,只能在一个地方定义。
|
|
7
|
+
3. **跑通了就发结果,没跑通就报 failed。** 不做 partial_success 抢救、不生成 placeholder。
|
|
8
|
+
4. **生产不能是第一个集成环境。** 本地必须能用 fake CLI + 真实 HTTP backend 跑完整链。
|
|
9
|
+
5. **新增观测维度或 event 类型,只改 server,不改 worker。**
|
|
10
|
+
|
|
11
|
+
三层职责:`boll-run` 定义成功产物契约 -> `worker` 执行和上报事实 -> `server` 解释事实并生成产品语义。
|
|
12
|
+
|
|
13
|
+
**行为约束**: 你不得在 worker 侧添加任何需要理解业务语义的逻辑。所有解释权必须归 server。
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
## 分布式协商约定
|
|
2
|
+
|
|
3
|
+
你正在编辑 catalyst 相关代码。端侧与平台侧职责严格分离:
|
|
4
|
+
|
|
5
|
+
**平台侧(cloud catalyst)**:
|
|
6
|
+
- 协调协商轮次、管理 deadline、聚合响应
|
|
7
|
+
- 拥有全局视角,决定何时进入下一轮或结束
|
|
8
|
+
|
|
9
|
+
**端侧(bridge worker)**:
|
|
10
|
+
- 执行具体的 LLM 调用、生成响应
|
|
11
|
+
- 只上报执行事实,不判断协商是否成功
|
|
12
|
+
|
|
13
|
+
**BYOK 模式**:用户绑定自己的 API Key(Anthropic / MiniMax / 自定义 base_url)。
|
|
14
|
+
平台侧使用用户 key 调用 LLM,不存储 key 明文(仅 session 级绑定)。
|
|
15
|
+
|
|
16
|
+
**行为约束**: 不得在 worker 侧添加协商策略逻辑(何时结束、何时重试)。
|
|
17
|
+
catalyst coordinator 的状态机变更必须伴随测试覆盖。
|
|
18
|
+
BYOK base_url 必须经过校验,不得接受任意 URL(SSRF 防护)。
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
## Issue 闭环检查清单
|
|
2
|
+
|
|
3
|
+
你正在编辑 issue 文档。关闭 issue 前必须逐条确认:
|
|
4
|
+
|
|
5
|
+
1. **prevention_status 是否 closed?** 如果是 open,说明复发路径未关闭,不得标 Fixed
|
|
6
|
+
2. **mechanism_layer 是否声明?** 必须指定防护机制:guard / test / type / convention
|
|
7
|
+
3. **有无具体的防护措施描述?** 不能只写"已修复",必须说明如何防止复发
|
|
8
|
+
4. **Guard > Memory 原则**:如果防护靠"记住规则",则 prevention 不算 closed
|
|
9
|
+
|
|
10
|
+
**行为约束**: 你不得在 prevention_status 为 open 的情况下将 status 改为 fixed。
|
|
11
|
+
如果根因分析表明无法机械化防护,必须显式标注 `mechanism_layer: convention` 并说明原因。
|
|
12
|
+
|
|
13
|
+
检查顺序:根因 -> 复发路径 -> 防护机制 -> 标记状态。不得跳过中间步骤。
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
## 契约 vs 实现 + 消费方追踪
|
|
2
|
+
|
|
3
|
+
你正在编辑 API 路由代码。区分契约和实现是防止漂移的核心:
|
|
4
|
+
|
|
5
|
+
**契约**(改了必须通知消费方):
|
|
6
|
+
- URL 路径、HTTP method、请求/响应 JSON schema
|
|
7
|
+
- 环境变量名、配置 key
|
|
8
|
+
- 事件类型枚举、artifact 类型枚举
|
|
9
|
+
|
|
10
|
+
**实现**(内部可自由调整):
|
|
11
|
+
- 函数签名、内部数据结构、算法细节
|
|
12
|
+
|
|
13
|
+
**行为约束**: 修改契约时,必须先列出所有消费方,逐一确认兼容性。
|
|
14
|
+
消费方列表不靠记忆维护——必须 grep 代码确认谁在调用。
|
|
15
|
+
新增 API 字段必须是 optional;删除字段必须走废弃流程,不得直接移除。
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
## DB 共享结构与迁移约定
|
|
2
|
+
|
|
3
|
+
你正在编辑数据库相关代码。以下表被多个模块共享:
|
|
4
|
+
|
|
5
|
+
| 表 | 主要写入方 | 读取消费方 |
|
|
6
|
+
|----|-----------|-----------|
|
|
7
|
+
| users | auth 模块 | protocol, dashboard, admin |
|
|
8
|
+
| demands | formulation | matching, runs, dashboard |
|
|
9
|
+
| runs | catalyst, bridge | status API, result API, admin, WS |
|
|
10
|
+
| run_events | bridge, catalyst | 6 个消费方(见 run-events-consumers) |
|
|
11
|
+
| agents | protocol | discovery, federation, MCP |
|
|
12
|
+
|
|
13
|
+
**行为约束**: SQLAlchemy `create_all()` 不会 ALTER 已有表——新增列必须用迁移脚本。
|
|
14
|
+
修改表结构时,必须检查所有读取消费方的查询是否兼容。
|
|
15
|
+
不得在不同模块中对同一表定义不同的 ORM model(一个表一个 model 定义)。
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
## Fixed 三层定义
|
|
2
|
+
|
|
3
|
+
你正在编辑 issue 文档。"Fixed" 不等于"症状消失":
|
|
4
|
+
|
|
5
|
+
| 层级 | 含义 | 标准 | 标记 |
|
|
6
|
+
|------|------|------|------|
|
|
7
|
+
| Level 1 | 症状消失 | 生产不报错了 | Runtime Fixed |
|
|
8
|
+
| Level 2 | 复发路径关闭 | 有机制防止同类问题再次发生 | **Fixed**(最低标准) |
|
|
9
|
+
| Level 3 | 机制消灭 | 有 guard 自动检测 | Fixed + Guarded |
|
|
10
|
+
|
|
11
|
+
issue doc YAML frontmatter 必须包含:
|
|
12
|
+
```yaml
|
|
13
|
+
status: fixed|open|wont_fix
|
|
14
|
+
prevention_status: open|closed|not_applicable
|
|
15
|
+
mechanism_layer: guard|test|type|convention
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
**行为约束**: 如果标 `status: fixed` 但 `prevention_status` 是 `open`,则不合格。必须先分析复发路径。
|
|
19
|
+
Guard: `check_issue_closure.py`
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
## 通用开发原则
|
|
2
|
+
|
|
3
|
+
以下原则适用于所有代码变更:
|
|
4
|
+
|
|
5
|
+
1. **Guard > Memory**: 如果一件事靠"记住规则"维护,它一定会出错。能机械化检测的,必须写 guard。
|
|
6
|
+
2. **一个事实一个定义**: 同一信息不得在多处重复定义。其余位置必须自动派生或引用。
|
|
7
|
+
3. **验证看最后一公里**: "服务启动了"不等于"功能正常"。验证必须到达用户可观测的终点。
|
|
8
|
+
4. **先分层再动手**: 区分 policy / contract / implementation 三层,搞清楚问题在哪层再修。
|
|
9
|
+
|
|
10
|
+
**行为约束**: 不得引入新的重复定义。如果发现已有重复,应在本次变更中收口为单一来源。
|
|
11
|
+
不得跳过测试直接部署。不得用 `--no-verify` 绕过 pre-commit hook。
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
## MCP 双端一致性约定
|
|
2
|
+
|
|
3
|
+
你正在编辑 MCP 相关代码。Python 和 Node 两端必须保持一致:
|
|
4
|
+
|
|
5
|
+
- **工具数量**:两端都是 54 个 @mcp.tool() / registerTool()
|
|
6
|
+
- **工具名称**:必须完全相同(boll_xxx)
|
|
7
|
+
- **行为语义**:相同输入必须产生相同输出结构
|
|
8
|
+
- **版本号**:pyproject.toml 和 package.json 版本必须一致
|
|
9
|
+
|
|
10
|
+
对应文件映射:
|
|
11
|
+
- Python: `mcp-server/boll_mcp/server.py` <-> Node: `mcp-server-node/src/index.ts`
|
|
12
|
+
- Python: `mcp-server/boll_mcp/client.py` <-> Node: `mcp-server-node/src/client.ts`
|
|
13
|
+
- Python: `mcp-server/boll_mcp/config.py` <-> Node: `mcp-server-node/src/config.ts`
|
|
14
|
+
|
|
15
|
+
**行为约束**: 改了一端后,你必须检查另一端是否需要同步。不得单独修改一端的工具签名或行为。
|
|
16
|
+
Guard: `check_mcp_parity.py`
|