harnessed 4.42.0 → 4.43.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.
- package/bin/harnessed-inject-state.mjs +69 -31
- package/bin/harnessed-stop-hook.mjs +67 -22
- package/dist/cli.mjs +79 -44
- package/dist/cli.mjs.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/messages/en.json +1 -1
- package/messages/zh-Hans.json +1 -1
- package/package.json +1 -1
- package/workflows/capabilities.yaml +6 -17
- package/workflows/disciplines/doc-discipline.yaml +1 -8
- package/workflows/disciplines/doc-discipline.zh-Hans.yaml +1 -8
- package/workflows/disciplines/karpathy.yaml +3 -13
- package/workflows/disciplines/karpathy.zh-Hans.yaml +3 -13
- package/workflows/disciplines/language.yaml +0 -5
- package/workflows/disciplines/operational.yaml +1 -12
- package/workflows/disciplines/operational.zh-Hans.yaml +1 -12
- package/workflows/disciplines/output-style.yaml +4 -16
- package/workflows/disciplines/output-style.zh-Hans.yaml +4 -16
- package/workflows/disciplines/priority.yaml +0 -3
- package/workflows/disciplines/priority.zh-Hans.yaml +0 -3
- package/workflows/disciplines/protocols.yaml +15 -40
- package/workflows/judgments/fallback.yaml +9 -11
package/dist/index.mjs
CHANGED
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../package.json","../src/index.ts"],"names":[],"mappings":";AAAA,IAAA,eAAA,GAAA;AAAA,EAEE,OAAA,EAAW,QAqGb,CAAA;;;AClGO,IAAM,UAAU,eAAA,CAAI","file":"index.mjs","sourcesContent":["{\n \"name\": \"harnessed\",\n \"version\": \"4.
|
|
1
|
+
{"version":3,"sources":["../package.json","../src/index.ts"],"names":[],"mappings":";AAAA,IAAA,eAAA,GAAA;AAAA,EAEE,OAAA,EAAW,QAqGb,CAAA;;;AClGO,IAAM,UAAU,eAAA,CAAI","file":"index.mjs","sourcesContent":["{\n \"name\": \"harnessed\",\n \"version\": \"4.43.1\",\n \"description\": \"AI coding harness package manager + composition orchestrator\",\n \"type\": \"module\",\n \"license\": \"Apache-2.0\",\n \"author\": \"easyinplay\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/easyinplay/harnessed.git\"\n },\n \"homepage\": \"https://github.com/easyinplay/harnessed#readme\",\n \"bugs\": \"https://github.com/easyinplay/harnessed/issues\",\n \"keywords\": [\n \"claude-code\",\n \"ai-harness\",\n \"package-manager\",\n \"composition\",\n \"skill-pack\",\n \"mcp\",\n \"orchestrator\"\n ],\n \"engines\": {\n \"node\": \">=22.0.0\"\n },\n \"packageManager\": \"pnpm@10.12.0\",\n \"bin\": {\n \"harnessed\": \"./dist/cli.mjs\",\n \"harnessed-inject-state\": \"./bin/harnessed-inject-state.mjs\"\n },\n \"main\": \"./dist/index.mjs\",\n \"types\": \"./dist/index.d.ts\",\n \"exports\": {\n \".\": {\n \"types\": \"./dist/index.d.ts\",\n \"import\": \"./dist/index.mjs\",\n \"default\": \"./dist/index.mjs\"\n },\n \"./schemas\": {\n \"types\": \"./dist/schemas/index.d.ts\",\n \"import\": \"./dist/schemas/index.mjs\"\n },\n \"./package.json\": \"./package.json\"\n },\n \"files\": [\n \"dist\",\n \"bin\",\n \"manifests\",\n \"messages\",\n \"workflows\",\n \"routing\",\n \"config-templates\",\n \"schemas\",\n \"README.md\",\n \"LICENSE\",\n \"NOTICE\",\n \"THIRD-PARTY-NOTICES.md\"\n ],\n \"scripts\": {\n \"dev\": \"tsup --watch\",\n \"build\": \"tsc --noEmit && tsup && node ./scripts/build-hooks.mjs\",\n \"build:hooks\": \"node ./scripts/build-hooks.mjs\",\n \"build:schema\": \"node ./scripts/build-schema.mjs\",\n \"validate:schema\": \"node ./scripts/validate-schema.mjs\",\n \"typecheck\": \"tsc --noEmit\",\n \"test\": \"vitest run --passWithNoTests\",\n \"test:watch\": \"vitest\",\n \"test:coverage\": \"vitest run --coverage --passWithNoTests\",\n \"bench\": \"vitest bench --run\",\n \"lint\": \"biome check .\",\n \"lint:fix\": \"biome check --write .\",\n \"format\": \"biome format --write .\",\n \"build:binary\": \"bun scripts/build-binary.mjs\"\n },\n \"dependencies\": {\n \"@anthropic-ai/claude-agent-sdk\": \"0.3.142\",\n \"@clack/prompts\": \"^0.10.1\",\n \"@sinclair/typebox\": \"^0.34.49\",\n \"ajv\": \"^8.20.0\",\n \"ajv-errors\": \"^3.0.0\",\n \"ajv-formats\": \"^3.0.1\",\n \"commander\": \"^13.0.0\",\n \"diff\": \"^9.0.0\",\n \"expr-eval\": \"^2.0.2\",\n \"picocolors\": \"^1.1.1\",\n \"proper-lockfile\": \"^4.1.2\",\n \"yaml\": \"^2.9.0\"\n },\n \"devDependencies\": {\n \"@biomejs/biome\": \"^2.0.0\",\n \"@types/node\": \"^22.10.0\",\n \"@types/proper-lockfile\": \"^4.1.4\",\n \"@vitest/coverage-v8\": \"^4.0.0\",\n \"esbuild\": \"0.27.7\",\n \"tsup\": \"^8.3.0\",\n \"typescript\": \"^5.6.0\",\n \"vitest\": \"^4.0.0\"\n },\n \"pnpm\": {\n \"onlyBuiltDependencies\": [\n \"esbuild\"\n ]\n }\n}\n","// Main library entry — re-exports public APIs.\n// phase 1.1 batch 1: skeleton only; schema validator wired in batch 2 (T3+).\n\nimport pkg from '../package.json' with { type: 'json' }\n\nexport const VERSION = pkg.version\n"]}
|
package/messages/en.json
CHANGED
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
|
|
29
29
|
"agent_teams.missing_header": "\n⚠️ Agent Teams not enabled — parallelism upgrade path unavailable",
|
|
30
30
|
"agent_teams.missing_fix": " fix: claude config set env.CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS 1",
|
|
31
|
-
"agent_teams.missing_explanation": " harnessed task parallelism uses Subagent or Agent Teams (CC 2.1.
|
|
31
|
+
"agent_teams.missing_explanation": " harnessed task parallelism uses Subagent or Agent Teams (CC 2.1.178+)",
|
|
32
32
|
"agent_teams.missing_nonblocking": " non-blocking — auto-degrades to subagent fan-out\n",
|
|
33
33
|
|
|
34
34
|
"install.manifest_not_found": "error: manifest '{{name}}' not found",
|
package/messages/zh-Hans.json
CHANGED
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
|
|
29
29
|
"agent_teams.missing_header": "\n⚠️ Agent Teams not enabled — parallelism upgrade path unavailable",
|
|
30
30
|
"agent_teams.missing_fix": " fix: claude config set env.CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS 1",
|
|
31
|
-
"agent_teams.missing_explanation": " harnessed task parallelism uses Subagent or Agent Teams (CC 2.1.
|
|
31
|
+
"agent_teams.missing_explanation": " harnessed task parallelism uses Subagent or Agent Teams (CC 2.1.178+)",
|
|
32
32
|
"agent_teams.missing_nonblocking": " non-blocking — auto-degrades to subagent fan-out\n",
|
|
33
33
|
|
|
34
34
|
"install.manifest_not_found": "error: manifest '{{name}}' not found",
|
package/package.json
CHANGED
|
@@ -544,7 +544,6 @@ capabilities:
|
|
|
544
544
|
since: v4.36
|
|
545
545
|
category: tool-cli
|
|
546
546
|
description: 子任务完成保证 (fail-closed evidence + TDD boundary + verbatim COMPLETE; `checkpoint fail` 出 BUDGET-EXHAUSTED / NO-PROGRESS / BREAK-LOOP)
|
|
547
|
-
sdk_ref: src/workflow/lib/ralphLoop.ts
|
|
548
547
|
routing_note:
|
|
549
548
|
- subtask.completion_required == true
|
|
550
549
|
|
|
@@ -577,9 +576,10 @@ capabilities:
|
|
|
577
576
|
# bundled Agent Teams prerequisite: CC 2.1.178+ + env var)
|
|
578
577
|
# ============================================================================
|
|
579
578
|
#
|
|
580
|
-
#
|
|
581
|
-
#
|
|
582
|
-
#
|
|
579
|
+
# 前置条件(root-level env `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1` + CC ≥2.1.178)由
|
|
580
|
+
# src/cli/lib/checkAgentTeams.ts 探测并在 doctor / setup 提示。4.43.0 起不再在本文件以
|
|
581
|
+
# requires.settings_env_var / requires.cc_version 重复声明 —— 那两个字段从未被读取,
|
|
582
|
+
# 且 cc_version 已与代码提示漂移(代码曾写 2.1.133)。
|
|
583
583
|
#
|
|
584
584
|
# 2026-07-30 UPSTREAM API MIGRATION (code.claude.com/docs/en/agent-teams, CC v2.1.178):
|
|
585
585
|
# `TeamCreate` / `TeamDelete` 两个工具**已被上游删除**("Both tools no longer exist")。
|
|
@@ -592,10 +592,8 @@ capabilities:
|
|
|
592
592
|
# - 一 session 一团;无嵌套团队(teammate 不能再 spawn teammate)。
|
|
593
593
|
# 因此本 bucket 的 `cmd` 不再是"工具名":create = 一种 spawn 调用形态,shutdown = 一句按名请求。
|
|
594
594
|
#
|
|
595
|
-
#
|
|
596
|
-
#
|
|
597
|
-
# 走已删除的 TeamCreate/TeamDelete)harnessed 不再支持,故这里只声明新下界 `>=2.1.178`,
|
|
598
|
-
# 不写区间(区间会暗示存在双路径 dispatch,而引擎里并不存在)。
|
|
595
|
+
# 旧路径(2.1.133 ≤ v < 2.1.178,走已删除的建团 / 删团工具)harnessed 不再支持;
|
|
596
|
+
# 版本下界只在代码里有一处:checkAgentTeams 的修复提示。
|
|
599
597
|
#
|
|
600
598
|
# 5 routing_note OR-chain (multi-select; Agent Teams upgrade triggers):
|
|
601
599
|
# 1. teammate_send_message_needed — teammate 间需 SendMessage 互通 (NOT fire-and-forget)
|
|
@@ -612,9 +610,6 @@ capabilities:
|
|
|
612
610
|
Agent Teams 成团 = 直接 spawn 后台 teammate,团在 first teammate spawn 时隐式形成
|
|
613
611
|
(implicit — CC 2.1.178+ 删除了 TeamCreate,无建团步骤);主 session = lead。
|
|
614
612
|
`team_name` 入参被接受但忽略(团名由 session 派生)。一 session 一团、无嵌套团队。
|
|
615
|
-
requires:
|
|
616
|
-
settings_env_var: env.CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS == "1"
|
|
617
|
-
cc_version: ">=2.1.178"
|
|
618
613
|
routing_note:
|
|
619
614
|
- teammate_send_message_needed == true
|
|
620
615
|
- subagent_context_overflow == true
|
|
@@ -630,9 +625,6 @@ capabilities:
|
|
|
630
625
|
description: >-
|
|
631
626
|
Agent Teams teammate 间通信 (round-trip 已验证 2026-05-19)。工具本身早于 2.1.178 即存在,
|
|
632
627
|
但 harnessed 只支持 2.1.178+ 的隐式成团路径,故与 bucket 同下界;无广播,每个 recipient 单发。
|
|
633
|
-
requires:
|
|
634
|
-
settings_env_var: env.CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS == "1"
|
|
635
|
-
cc_version: ">=2.1.178"
|
|
636
628
|
|
|
637
629
|
agent-teams-shutdown:
|
|
638
630
|
impl: claude-platform
|
|
@@ -644,9 +636,6 @@ capabilities:
|
|
|
644
636
|
TeamDelete,无等价工具);teammate 可 approve 优雅退出 / reject 带理由,且会先做完当前
|
|
645
637
|
tool call。团的共享目录在 session 退出时自动清理,无独立 cleanup 步骤 —— 剩下的纪律是
|
|
646
638
|
「别把 teammate 落在运行态」(未关闭的 teammate 持续烧 token、可能挂起宿主)。
|
|
647
|
-
requires:
|
|
648
|
-
settings_env_var: env.CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS == "1"
|
|
649
|
-
cc_version: ">=2.1.178"
|
|
650
639
|
|
|
651
640
|
# ============================================================================
|
|
652
641
|
# Bucket 6 — L0 Discipline Substrate behavioral ref (D-09 NEW v3, 6 entry)
|
|
@@ -8,42 +8,35 @@
|
|
|
8
8
|
schema_version: harnessed.discipline.v1
|
|
9
9
|
discipline: doc
|
|
10
10
|
enforcement_layer: commit
|
|
11
|
-
auto_enforce: true
|
|
12
11
|
|
|
13
12
|
rules:
|
|
14
13
|
- id: state-digest-line-limit
|
|
15
14
|
description: STATE.md >100 lines triggers halt; override via `HARNESSED_ALLOW_LONG_STATE=1`
|
|
16
15
|
enforcement: halt
|
|
17
16
|
trigger: "phase.type == 'commit' AND changed_files contains '.planning/STATE.md'"
|
|
18
|
-
|
|
19
|
-
# No auto_fix_cmd — halt rules do not auto-fix; override is env-based in TS
|
|
17
|
+
# override is env-based in TS (HARNESSED_ALLOW_LONG_STATE)
|
|
20
18
|
|
|
21
19
|
- id: one-fact-per-file
|
|
22
20
|
description: Decision docs must be single-topic; duplicate fact spread across files violates one-fact-per-file
|
|
23
21
|
enforcement: warn
|
|
24
22
|
trigger: "phase.type == 'commit' AND changed_files matches '\\.planning/'"
|
|
25
|
-
check_method: heuristic
|
|
26
23
|
|
|
27
24
|
- id: overview-pointer-no-inline-narrative
|
|
28
25
|
description: ROADMAP/overview docs must not inline closing narrative (叙事进 SUMMARY, not ROADMAP)
|
|
29
26
|
enforcement: warn
|
|
30
27
|
trigger: "phase.type == 'commit' AND changed_files matches 'ROADMAP\\.md|STATE\\.md'"
|
|
31
|
-
check_method: heuristic
|
|
32
28
|
|
|
33
29
|
- id: transient-consume-then-archive
|
|
34
30
|
description: HANDOFF and other transient artifacts must be archived after consumption, not accumulated at .planning/ root
|
|
35
31
|
enforcement: warn
|
|
36
32
|
trigger: "phase.type == 'commit' AND changed_files matches 'HANDOFF'"
|
|
37
|
-
check_method: heuristic
|
|
38
33
|
|
|
39
34
|
- id: status-derived-from-artifacts
|
|
40
35
|
description: Phase status must derive from VERIFICATION artifacts + test results, not hand-maintained booleans in STATE/ROADMAP
|
|
41
36
|
enforcement: warn
|
|
42
37
|
trigger: "phase.type == 'commit' AND changed_files contains '.planning/STATE.md'"
|
|
43
|
-
check_method: heuristic
|
|
44
38
|
|
|
45
39
|
- id: responsibility-matrix-one-home
|
|
46
40
|
description: Each fact has exactly one home per responsibility matrix (decision→ADR, requirement→REQUIREMENTS, etc.); cross-file duplication is a violation
|
|
47
41
|
enforcement: info
|
|
48
42
|
trigger: "phase.type == 'commit' AND changed_files matches '\\.planning/'"
|
|
49
|
-
check_method: heuristic
|
|
@@ -8,42 +8,35 @@
|
|
|
8
8
|
schema_version: harnessed.discipline.v1
|
|
9
9
|
discipline: doc
|
|
10
10
|
enforcement_layer: commit
|
|
11
|
-
auto_enforce: true
|
|
12
11
|
|
|
13
12
|
rules:
|
|
14
13
|
- id: state-digest-line-limit
|
|
15
14
|
description: STATE.md 超过 100 行触发 halt;通过 `HARNESSED_ALLOW_LONG_STATE=1` override
|
|
16
15
|
enforcement: halt
|
|
17
16
|
trigger: "phase.type == 'commit' AND changed_files contains '.planning/STATE.md'"
|
|
18
|
-
|
|
19
|
-
# No auto_fix_cmd — halt rules do not auto-fix; override is env-based in TS
|
|
17
|
+
# override is env-based in TS (HARNESSED_ALLOW_LONG_STATE)
|
|
20
18
|
|
|
21
19
|
- id: one-fact-per-file
|
|
22
20
|
description: 决策类文档必须单一主题;同一事实跨文件重复散布违反 one-fact-per-file
|
|
23
21
|
enforcement: warn
|
|
24
22
|
trigger: "phase.type == 'commit' AND changed_files matches '\\.planning/'"
|
|
25
|
-
check_method: heuristic
|
|
26
23
|
|
|
27
24
|
- id: overview-pointer-no-inline-narrative
|
|
28
25
|
description: ROADMAP/概览类文档不得内联收尾叙事(叙事进 SUMMARY,而非 ROADMAP)
|
|
29
26
|
enforcement: warn
|
|
30
27
|
trigger: "phase.type == 'commit' AND changed_files matches 'ROADMAP\\.md|STATE\\.md'"
|
|
31
|
-
check_method: heuristic
|
|
32
28
|
|
|
33
29
|
- id: transient-consume-then-archive
|
|
34
30
|
description: HANDOFF 及其他 transient 产物必须在消费后归档,不得堆积在 .planning/ 根目录
|
|
35
31
|
enforcement: warn
|
|
36
32
|
trigger: "phase.type == 'commit' AND changed_files matches 'HANDOFF'"
|
|
37
|
-
check_method: heuristic
|
|
38
33
|
|
|
39
34
|
- id: status-derived-from-artifacts
|
|
40
35
|
description: Phase 状态必须从 VERIFICATION 产物 + 测试结果派生,而非在 STATE/ROADMAP 里手动维护布尔值
|
|
41
36
|
enforcement: warn
|
|
42
37
|
trigger: "phase.type == 'commit' AND changed_files contains '.planning/STATE.md'"
|
|
43
|
-
check_method: heuristic
|
|
44
38
|
|
|
45
39
|
- id: responsibility-matrix-one-home
|
|
46
40
|
description: 每个事实按责任矩阵只有唯一归处(决策→ADR,需求→REQUIREMENTS 等);跨文件重复即违规
|
|
47
41
|
enforcement: info
|
|
48
42
|
trigger: "phase.type == 'commit' AND changed_files matches '\\.planning/'"
|
|
49
|
-
check_method: heuristic
|
|
@@ -6,44 +6,36 @@
|
|
|
6
6
|
schema_version: harnessed.discipline.v1
|
|
7
7
|
discipline: karpathy
|
|
8
8
|
enforcement_layer: code-writing
|
|
9
|
-
auto_enforce: true
|
|
10
9
|
|
|
11
10
|
rules:
|
|
12
11
|
- id: think-before-coding
|
|
13
12
|
description: Think before coding; do not dump code directly; brainstorm the design intent before each subtask
|
|
14
13
|
enforcement: warn
|
|
15
14
|
trigger: subtask.type == 'code-write'
|
|
16
|
-
|
|
17
|
-
# check_method='heuristic' — runtime engine 检查 subagent 输出 first 200 char 是否含设计意图 marker
|
|
15
|
+
# runtime engine 检查 subagent 输出 first 200 char 是否含设计意图 marker
|
|
18
16
|
# (e.g., 'Plan:' / 'Approach:' / '设计:' / '思路:'),若全是 code block → warn
|
|
19
17
|
|
|
20
18
|
- id: simplicity-first
|
|
21
19
|
description: Pursue the minimal effective code, avoid unnecessary complexity; YAGNI / do not write code for hypothetical scenarios
|
|
22
20
|
enforcement: warn
|
|
23
21
|
trigger: always-on
|
|
24
|
-
|
|
25
|
-
# check_method='llm-judge' — verify phase 调用 code-simplifier review
|
|
22
|
+
# verify phase 调用 code-simplifier review
|
|
26
23
|
|
|
27
24
|
- id: surgical-changes
|
|
28
25
|
description: Small atomic changes, single responsibility per commit; no large-scale rewrites
|
|
29
26
|
enforcement: warn
|
|
30
27
|
trigger: phase.type == 'execute'
|
|
31
|
-
check_method: external-cmd
|
|
32
|
-
auto_fix_cmd: 'git diff --stat HEAD~1 | awk ''{lines+=$3} END {if (lines>300) exit 1}'''
|
|
33
28
|
# 单 commit > 300 line diff → warn (rough heuristic, override allowed via task spec)
|
|
34
29
|
|
|
35
30
|
- id: goal-driven-execution
|
|
36
31
|
description: Goal-driven, do not diverge / do no unrelated refactoring; solve only the current task and do not smuggle in cleanup
|
|
37
32
|
enforcement: warn
|
|
38
33
|
trigger: phase.type == 'execute'
|
|
39
|
-
check_method: heuristic
|
|
40
34
|
|
|
41
35
|
- id: file-length-200-hard-limit
|
|
42
36
|
description: Single-file ≤200L hard limit (per project CLAUDE.md karpathy guideline reminder); over the limit → split into a helper
|
|
43
37
|
enforcement: halt
|
|
44
38
|
trigger: phase.type == 'execute' AND file.lines > 200
|
|
45
|
-
check_method: external-cmd
|
|
46
|
-
auto_fix_cmd: 'wc -l <file> | awk ''{if ($1>200) exit 1}'''
|
|
47
39
|
# 实装 split helper pattern (sister fallbackHandlers.ts / sdkReconcile.ts ≤80L)
|
|
48
40
|
|
|
49
41
|
# ── T2.7 (4.34.x) — the 2 rules the `karpathy-guidelines` capability description
|
|
@@ -57,7 +49,6 @@ rules:
|
|
|
57
49
|
description: Trust internal code — validate at the trust boundary (external input, parsed config, user data), not at every internal layer; do not add defensive re-checks or redundant assertions on call sites you control
|
|
58
50
|
enforcement: warn
|
|
59
51
|
trigger: subtask.type == 'code-write'
|
|
60
|
-
check_method: heuristic
|
|
61
52
|
# sister role-prompts.yaml task-code checklist "Trust internal code: don't
|
|
62
53
|
# re-validate already-checked inputs at every layer"
|
|
63
54
|
|
|
@@ -65,8 +56,7 @@ rules:
|
|
|
65
56
|
description: Comments explain WHY, not WHAT — delete comments that restate the code or that have drifted out of sync with it; a comment must add context the code cannot carry (rationale, constraint, upstream reference)
|
|
66
57
|
enforcement: warn
|
|
67
58
|
trigger: subtask.type == 'code-write'
|
|
68
|
-
|
|
69
|
-
# check_method='llm-judge' — sister simplicity-first: verify phase 的
|
|
59
|
+
# sister simplicity-first: verify phase 的
|
|
70
60
|
# code-simplifier review 承接 (role-prompts.yaml verify-simplify checklist
|
|
71
61
|
# "Comments that lie or duplicate the code → delete").
|
|
72
62
|
#
|
|
@@ -6,44 +6,36 @@
|
|
|
6
6
|
schema_version: harnessed.discipline.v1
|
|
7
7
|
discipline: karpathy
|
|
8
8
|
enforcement_layer: code-writing
|
|
9
|
-
auto_enforce: true
|
|
10
9
|
|
|
11
10
|
rules:
|
|
12
11
|
- id: think-before-coding
|
|
13
12
|
description: 先思考后写代码,不直接 dump 代码;每个子任务前 brainstorm 设计意图
|
|
14
13
|
enforcement: warn
|
|
15
14
|
trigger: subtask.type == 'code-write'
|
|
16
|
-
|
|
17
|
-
# check_method='heuristic' — runtime engine 检查 subagent 输出 first 200 char 是否含设计意图 marker
|
|
15
|
+
# runtime engine 检查 subagent 输出 first 200 char 是否含设计意图 marker
|
|
18
16
|
# (e.g., 'Plan:' / 'Approach:' / '设计:' / '思路:'),若全是 code block → warn
|
|
19
17
|
|
|
20
18
|
- id: simplicity-first
|
|
21
19
|
description: 追求最小有效代码,避免不必要复杂度;YAGNI / 不为假设场景写代码
|
|
22
20
|
enforcement: warn
|
|
23
21
|
trigger: always-on
|
|
24
|
-
|
|
25
|
-
# check_method='llm-judge' — verify phase 调用 code-simplifier review
|
|
22
|
+
# verify phase 调用 code-simplifier review
|
|
26
23
|
|
|
27
24
|
- id: surgical-changes
|
|
28
25
|
description: 小步原子修改,每个 commit 单一职责;不大段重写
|
|
29
26
|
enforcement: warn
|
|
30
27
|
trigger: phase.type == 'execute'
|
|
31
|
-
check_method: external-cmd
|
|
32
|
-
auto_fix_cmd: 'git diff --stat HEAD~1 | awk ''{lines+=$3} END {if (lines>300) exit 1}'''
|
|
33
28
|
# 单 commit > 300 line diff → warn (rough heuristic, override allowed via task spec)
|
|
34
29
|
|
|
35
30
|
- id: goal-driven-execution
|
|
36
31
|
description: 目标驱动,不发散 / 不无关重构;只解决当前任务 + 不夹带 cleanup
|
|
37
32
|
enforcement: warn
|
|
38
33
|
trigger: phase.type == 'execute'
|
|
39
|
-
check_method: heuristic
|
|
40
34
|
|
|
41
35
|
- id: file-length-200-hard-limit
|
|
42
36
|
description: 单文件 ≤200L 硬限 (per project CLAUDE.md karpathy 心法 reminder);超过 → split helper
|
|
43
37
|
enforcement: halt
|
|
44
38
|
trigger: phase.type == 'execute' AND file.lines > 200
|
|
45
|
-
check_method: external-cmd
|
|
46
|
-
auto_fix_cmd: 'wc -l <file> | awk ''{if ($1>200) exit 1}'''
|
|
47
39
|
# 实装 split helper pattern (sister fallbackHandlers.ts / sdkReconcile.ts ≤80L)
|
|
48
40
|
|
|
49
41
|
# ── T2.7 (4.34.x) — capability description 自 v2.0 起就在声称、但一直没有规则
|
|
@@ -55,7 +47,6 @@ rules:
|
|
|
55
47
|
description: 信任内部代码 —— 只在信任边界(外部输入 / 解析后的配置 / 用户数据)做校验,不在每一层内部调用上重复防御;不给自己控制的调用点加冗余断言
|
|
56
48
|
enforcement: warn
|
|
57
49
|
trigger: subtask.type == 'code-write'
|
|
58
|
-
check_method: heuristic
|
|
59
50
|
# sister role-prompts.zh-Hans.yaml task-code checklist「信任内部代码:不在每层
|
|
60
51
|
# 重复校验已经检查过的输入」
|
|
61
52
|
|
|
@@ -63,8 +54,7 @@ rules:
|
|
|
63
54
|
description: 注释解释 WHY 不解释 WHAT —— 删掉复述代码的注释、以及已经与代码脱节的注释;一条注释必须补上代码本身承载不了的信息(设计理由 / 约束 / 上游出处)
|
|
64
55
|
enforcement: warn
|
|
65
56
|
trigger: subtask.type == 'code-write'
|
|
66
|
-
|
|
67
|
-
# check_method='llm-judge' — sister simplicity-first:由 verify 阶段的
|
|
57
|
+
# sister simplicity-first:由 verify 阶段的
|
|
68
58
|
# code-simplifier review 承接(role-prompts.zh-Hans.yaml verify-simplify
|
|
69
59
|
# checklist「撒谎或重复代码的注释 → 删」)。
|
|
70
60
|
#
|
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
schema_version: harnessed.discipline.v1
|
|
7
7
|
discipline: language
|
|
8
8
|
enforcement_layer: output
|
|
9
|
-
auto_enforce: true
|
|
10
9
|
|
|
11
10
|
rules:
|
|
12
11
|
- id: follow-user-language
|
|
@@ -20,7 +19,6 @@ rules:
|
|
|
20
19
|
stay consistent with CLI tone.
|
|
21
20
|
enforcement: info
|
|
22
21
|
trigger: every Claude response
|
|
23
|
-
check_method: read env.HARNESSED_USER_LANG, validate output lang matches
|
|
24
22
|
|
|
25
23
|
# The 8 categories are DATA, not a comment: src/cli/prompt.ts buildLanguageSection
|
|
26
24
|
# parses the numbered lines below and renders them into the spawn prompt's
|
|
@@ -40,7 +38,6 @@ rules:
|
|
|
40
38
|
8. Quoted material — documents, errors, config examples, the user's own words — reproduced verbatim, with any explanation kept outside the quote
|
|
41
39
|
enforcement: warn
|
|
42
40
|
trigger: always-on
|
|
43
|
-
check_method: heuristic
|
|
44
41
|
|
|
45
42
|
- id: cross-cultural-humor
|
|
46
43
|
description: |-
|
|
@@ -51,7 +48,6 @@ rules:
|
|
|
51
48
|
— same concept, different cultural anchor. Avoid forced calques.
|
|
52
49
|
enforcement: info
|
|
53
50
|
trigger: humor_or_idiom_present
|
|
54
|
-
check_method: heuristic
|
|
55
51
|
|
|
56
52
|
- id: lang-request-override
|
|
57
53
|
description: |-
|
|
@@ -60,4 +56,3 @@ rules:
|
|
|
60
56
|
target language regardless of env.HARNESSED_USER_LANG.
|
|
61
57
|
enforcement: info
|
|
62
58
|
trigger: user.lang_request != null
|
|
63
|
-
check_method: regex
|
|
@@ -7,19 +7,15 @@
|
|
|
7
7
|
schema_version: harnessed.discipline.v1
|
|
8
8
|
discipline: operational
|
|
9
9
|
enforcement_layer: commit
|
|
10
|
-
auto_enforce: true
|
|
11
10
|
|
|
12
11
|
rules:
|
|
13
12
|
- id: biome-preempt
|
|
14
13
|
description: |
|
|
15
14
|
Before any TS/JS commit you must run `pnpm exec biome check --write` (3 CI-red recurrences Phase 2.1.1/2.2/2.3 project memory)
|
|
16
|
-
enforcement:
|
|
15
|
+
enforcement: warn
|
|
17
16
|
trigger: |
|
|
18
17
|
phase.type == 'commit' AND
|
|
19
18
|
changed_files matches '\\.(ts|tsx|js|mjs)$'
|
|
20
|
-
check_method: external-cmd
|
|
21
|
-
auto_fix_cmd: 'corepack pnpm exec biome check --write'
|
|
22
|
-
# NEW src/discipline/enforcement/before-commit.ts hook; exit 0 才允许 commit
|
|
23
19
|
|
|
24
20
|
- id: a7-adr-conservation
|
|
25
21
|
description: |
|
|
@@ -27,15 +23,12 @@ rules:
|
|
|
27
23
|
(sister Phase 1.3-2.6 ADR errata path)
|
|
28
24
|
enforcement: warn
|
|
29
25
|
trigger: phase.type == 'commit' AND changed_files contains 'docs/adr/'
|
|
30
|
-
check_method: external-cmd
|
|
31
|
-
auto_fix_cmd: 'scripts/check-adr-conservation.sh'
|
|
32
26
|
|
|
33
27
|
- id: no-push-without-approval
|
|
34
28
|
description: |
|
|
35
29
|
NEVER push to remote without user explicit approval (project CLAUDE.md commit safety)
|
|
36
30
|
enforcement: halt
|
|
37
31
|
trigger: cmd.type == 'git-push'
|
|
38
|
-
check_method: external-cmd
|
|
39
32
|
# completion-gate loop / subagent 自动调 git push → halt;user explicit `git push` 在主 session 允许
|
|
40
33
|
|
|
41
34
|
- id: no-skip-hooks
|
|
@@ -43,14 +36,12 @@ rules:
|
|
|
43
36
|
Skip-hook flags such as --no-verify / --no-gpg-sign are not allowed, unless the user explicitly requests them
|
|
44
37
|
enforcement: halt
|
|
45
38
|
trigger: cmd.type == 'git-commit' AND args contains '--no-verify'
|
|
46
|
-
check_method: regex
|
|
47
39
|
|
|
48
40
|
- id: destructive-ops-explicit
|
|
49
41
|
description: |
|
|
50
42
|
Destructive ops (git reset --hard / push --force / rm -rf / drop table) require explicit user confirmation
|
|
51
43
|
enforcement: halt
|
|
52
44
|
trigger: cmd.is_destructive == true
|
|
53
|
-
check_method: heuristic
|
|
54
45
|
# heuristic — 命令含 'rm -rf' / 'reset --hard' / '--force' / 'DROP TABLE' / 'delete from'
|
|
55
46
|
|
|
56
47
|
- id: authorization-not-transitive
|
|
@@ -58,7 +49,6 @@ rules:
|
|
|
58
49
|
A user approving one push ≠ approval for the whole session; each destructive / shared-state operation needs separate confirmation
|
|
59
50
|
enforcement: warn
|
|
60
51
|
trigger: cmd.requires_approval == true AND session.has_prior_approval == true
|
|
61
|
-
check_method: heuristic
|
|
62
52
|
|
|
63
53
|
# v3.6.0 Phase 3 — transparent-skip discipline (P0b 下半,Audit § fallback
|
|
64
54
|
# 三条铁律 "拿不准 → 倾向跳过 + 透明声明"). prompt-inject method delivered
|
|
@@ -76,4 +66,3 @@ rules:
|
|
|
76
66
|
if you actually need it."
|
|
77
67
|
enforcement: warn
|
|
78
68
|
trigger: gate_evaluation_low_confidence
|
|
79
|
-
check_method: prompt-inject
|
|
@@ -7,19 +7,15 @@
|
|
|
7
7
|
schema_version: harnessed.discipline.v1
|
|
8
8
|
discipline: operational
|
|
9
9
|
enforcement_layer: commit
|
|
10
|
-
auto_enforce: true
|
|
11
10
|
|
|
12
11
|
rules:
|
|
13
12
|
- id: biome-preempt
|
|
14
13
|
description: |
|
|
15
14
|
TS/JS commit 前必跑 `pnpm exec biome check --write` (3 CI-red recurrences Phase 2.1.1/2.2/2.3 project memory)
|
|
16
|
-
enforcement:
|
|
15
|
+
enforcement: warn
|
|
17
16
|
trigger: |
|
|
18
17
|
phase.type == 'commit' AND
|
|
19
18
|
changed_files matches '\\.(ts|tsx|js|mjs)$'
|
|
20
|
-
check_method: external-cmd
|
|
21
|
-
auto_fix_cmd: 'corepack pnpm exec biome check --write'
|
|
22
|
-
# NEW src/discipline/enforcement/before-commit.ts hook; exit 0 才允许 commit
|
|
23
19
|
|
|
24
20
|
- id: a7-adr-conservation
|
|
25
21
|
description: |
|
|
@@ -27,15 +23,12 @@ rules:
|
|
|
27
23
|
(sister Phase 1.3-2.6 ADR errata 路径)
|
|
28
24
|
enforcement: warn
|
|
29
25
|
trigger: phase.type == 'commit' AND changed_files contains 'docs/adr/'
|
|
30
|
-
check_method: external-cmd
|
|
31
|
-
auto_fix_cmd: 'scripts/check-adr-conservation.sh'
|
|
32
26
|
|
|
33
27
|
- id: no-push-without-approval
|
|
34
28
|
description: |
|
|
35
29
|
NEVER push to remote without user explicit approval (project CLAUDE.md commit safety)
|
|
36
30
|
enforcement: halt
|
|
37
31
|
trigger: cmd.type == 'git-push'
|
|
38
|
-
check_method: external-cmd
|
|
39
32
|
# completion-gate loop / subagent 自动调 git push → halt;user explicit `git push` 在主 session 允许
|
|
40
33
|
|
|
41
34
|
- id: no-skip-hooks
|
|
@@ -43,14 +36,12 @@ rules:
|
|
|
43
36
|
不允许 --no-verify / --no-gpg-sign 等 skip hook flag,除非用户明确要求
|
|
44
37
|
enforcement: halt
|
|
45
38
|
trigger: cmd.type == 'git-commit' AND args contains '--no-verify'
|
|
46
|
-
check_method: regex
|
|
47
39
|
|
|
48
40
|
- id: destructive-ops-explicit
|
|
49
41
|
description: |
|
|
50
42
|
Destructive ops (git reset --hard / push --force / rm -rf / drop table) 必须用户 explicit 确认
|
|
51
43
|
enforcement: halt
|
|
52
44
|
trigger: cmd.is_destructive == true
|
|
53
|
-
check_method: heuristic
|
|
54
45
|
# heuristic — 命令含 'rm -rf' / 'reset --hard' / '--force' / 'DROP TABLE' / 'delete from'
|
|
55
46
|
|
|
56
47
|
- id: authorization-not-transitive
|
|
@@ -58,7 +49,6 @@ rules:
|
|
|
58
49
|
用户 approve 一次 push ≠ 全程 approve;每个 destructive / shared-state 操作单独确认
|
|
59
50
|
enforcement: warn
|
|
60
51
|
trigger: cmd.requires_approval == true AND session.has_prior_approval == true
|
|
61
|
-
check_method: heuristic
|
|
62
52
|
|
|
63
53
|
# v3.6.0 Phase 3 — transparent-skip discipline (P0b 下半,Audit § fallback
|
|
64
54
|
# 三条铁律 "拿不准 → 倾向跳过 + 透明声明"). prompt-inject method delivered
|
|
@@ -76,4 +66,3 @@ rules:
|
|
|
76
66
|
if you actually need it."
|
|
77
67
|
enforcement: warn
|
|
78
68
|
trigger: gate_evaluation_low_confidence
|
|
79
|
-
check_method: prompt-inject
|
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
schema_version: harnessed.discipline.v1
|
|
7
7
|
discipline: output-style
|
|
8
8
|
enforcement_layer: output
|
|
9
|
-
auto_enforce: true
|
|
10
9
|
|
|
11
10
|
rules:
|
|
12
11
|
# Scope note (2026-07-30) — chat-scope rules carry `trigger: response.target == 'chat'`
|
|
@@ -17,34 +16,26 @@ rules:
|
|
|
17
16
|
description: Conclusion first (BLUF); each paragraph leads with one sentence giving the answer/judgment/recommendation, then expands the reasoning
|
|
18
17
|
enforcement: warn
|
|
19
18
|
trigger: response.target == 'chat'
|
|
20
|
-
check_method: heuristic
|
|
21
19
|
# heuristic — 第一句长度 ≤ 100 char + 含答案动词 ('是' / '不是' / '推荐' / '应该' / 'use X')
|
|
22
20
|
# 失败 → warn 'BLUF missing: first sentence is not a conclusion'
|
|
23
21
|
|
|
24
22
|
- id: no-sycophantic-open-close
|
|
25
23
|
description: Remove opening/closing filler phrases like "good question / awesome / perfect / hope this helps / anything else"
|
|
26
|
-
enforcement:
|
|
27
|
-
# chat-scope
|
|
28
|
-
#
|
|
24
|
+
enforcement: warn
|
|
25
|
+
# chat-scope keeps this off delivered artifacts (README / CHANGELOG may legitimately
|
|
26
|
+
# use the phrasing a chat reply should not).
|
|
29
27
|
trigger: response.target == 'chat'
|
|
30
|
-
check_method: regex
|
|
31
|
-
auto_fix_cmd: 'strip-sycophantic'
|
|
32
|
-
# NEW src/discipline/enforcement/strip-sycophantic.ts — regex strip 13 known phrase
|
|
33
28
|
|
|
34
29
|
- id: no-emoji-unless-requested
|
|
35
30
|
description: No emoji unless the user explicitly requests it (project markdown files such as README/PR/CHANGELOG are not constrained)
|
|
36
31
|
enforcement: warn
|
|
37
32
|
trigger: response.target == 'chat' AND user.requested_emoji == false
|
|
38
|
-
check_method: regex
|
|
39
33
|
# regex /\p{Emoji_Presentation}/u; 命中 + trigger fires → warn
|
|
40
34
|
|
|
41
35
|
- id: no-em-dash
|
|
42
36
|
description: No em-dash (—— / —); instead use parentheses or colons for asides, commas for lists, and a separate sentence for contrast
|
|
43
|
-
enforcement:
|
|
37
|
+
enforcement: warn
|
|
44
38
|
trigger: response.target == 'chat'
|
|
45
|
-
check_method: regex
|
|
46
|
-
auto_fix_cmd: 'replace-em-dash'
|
|
47
|
-
# auto-replace '——' → ', ' (单段内逗号);'—' → ':' OR ','
|
|
48
39
|
|
|
49
40
|
# Deliberately always-on (not chat-scope): project files want precise quantifiers too,
|
|
50
41
|
# and the rule only tightens a requirement — it never produces a wrong artifact.
|
|
@@ -52,13 +43,11 @@ rules:
|
|
|
52
43
|
description: Precise quantifiers; when a concrete number/filename/line number/commit hash is available, do not say "some/a few/several"
|
|
53
44
|
enforcement: info
|
|
54
45
|
trigger: always-on
|
|
55
|
-
check_method: llm-judge
|
|
56
46
|
|
|
57
47
|
- id: no-end-recap
|
|
58
48
|
description: No closing summary unless the user explicitly asks to "summarize/recap"
|
|
59
49
|
enforcement: warn
|
|
60
50
|
trigger: response.target == 'chat'
|
|
61
|
-
check_method: heuristic
|
|
62
51
|
# heuristic — 末尾 200 char 含 '## 总结' / '## Summary' / 'In summary' / '综上所述'
|
|
63
52
|
# → warn 'redundant end recap'
|
|
64
53
|
|
|
@@ -66,5 +55,4 @@ rules:
|
|
|
66
55
|
description: No empty continuation questions ("want me to help you X?" / "anything else?"); keep workflow-necessary next-step guidance
|
|
67
56
|
enforcement: warn
|
|
68
57
|
trigger: response.target == 'chat'
|
|
69
|
-
check_method: regex
|
|
70
58
|
# regex /要不要|还需要别的|希望对你有帮助/ + trigger fires → warn
|
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
schema_version: harnessed.discipline.v1
|
|
7
7
|
discipline: output-style
|
|
8
8
|
enforcement_layer: output
|
|
9
|
-
auto_enforce: true
|
|
10
9
|
|
|
11
10
|
rules:
|
|
12
11
|
# scope 说明 (2026-07-30) — 对话层规则带 `trigger: response.target == 'chat'`,
|
|
@@ -17,34 +16,26 @@ rules:
|
|
|
17
16
|
description: 结论先行 (BLUF),每段先一句给答案/判断/推荐,再展开理由
|
|
18
17
|
enforcement: warn
|
|
19
18
|
trigger: response.target == 'chat'
|
|
20
|
-
check_method: heuristic
|
|
21
19
|
# heuristic — 第一句长度 ≤ 100 char + 含答案动词 ('是' / '不是' / '推荐' / '应该' / 'use X')
|
|
22
20
|
# 失败 → warn 'BLUF missing: first sentence is not a conclusion'
|
|
23
21
|
|
|
24
22
|
- id: no-sycophantic-open-close
|
|
25
23
|
description: 删除"好问题/太棒了/完美/希望对你有帮助/还需要别的吗"等开场闭合套话
|
|
26
|
-
enforcement:
|
|
27
|
-
#
|
|
28
|
-
#
|
|
24
|
+
enforcement: warn
|
|
25
|
+
# chat-scope 让这条不约束已交付的产物文件(README / CHANGELOG 可以合理使用
|
|
26
|
+
# 聊天回复里不该出现的措辞)。
|
|
29
27
|
trigger: response.target == 'chat'
|
|
30
|
-
check_method: regex
|
|
31
|
-
auto_fix_cmd: 'strip-sycophantic'
|
|
32
|
-
# NEW src/discipline/enforcement/strip-sycophantic.ts — regex strip 13 known phrase
|
|
33
28
|
|
|
34
29
|
- id: no-emoji-unless-requested
|
|
35
30
|
description: 禁用 emoji,除非用户明确要求 (项目 markdown 文件如 README/PR/CHANGELOG 不约束)
|
|
36
31
|
enforcement: warn
|
|
37
32
|
trigger: response.target == 'chat' AND user.requested_emoji == false
|
|
38
|
-
check_method: regex
|
|
39
33
|
# regex /\p{Emoji_Presentation}/u; 命中 + trigger fires → warn
|
|
40
34
|
|
|
41
35
|
- id: no-em-dash
|
|
42
36
|
description: 禁用 em-dash (—— / —);替代:补充用括号/冒号,并列用顿号,转折单独成句
|
|
43
|
-
enforcement:
|
|
37
|
+
enforcement: warn
|
|
44
38
|
trigger: response.target == 'chat'
|
|
45
|
-
check_method: regex
|
|
46
|
-
auto_fix_cmd: 'replace-em-dash'
|
|
47
|
-
# auto-replace '——' → ', ' (单段内逗号);'—' → ':' OR ','
|
|
48
39
|
|
|
49
40
|
# 故意保持 always-on (不改 chat-scope):产物文件也该用精确量词,
|
|
50
41
|
# 且这条只是把要求收紧,不会主动产生错误产物。
|
|
@@ -52,13 +43,11 @@ rules:
|
|
|
52
43
|
description: 量词精确,能给具体数字/文件名/行号/commit hash 就不用"一些/几个/多个"
|
|
53
44
|
enforcement: info
|
|
54
45
|
trigger: always-on
|
|
55
|
-
check_method: llm-judge
|
|
56
46
|
|
|
57
47
|
- id: no-end-recap
|
|
58
48
|
description: 不做结尾总结,除非用户明确要求"汇总/recap"
|
|
59
49
|
enforcement: warn
|
|
60
50
|
trigger: response.target == 'chat'
|
|
61
|
-
check_method: heuristic
|
|
62
51
|
# heuristic — 末尾 200 char 含 '## 总结' / '## Summary' / 'In summary' / '综上所述'
|
|
63
52
|
# → warn 'redundant end recap'
|
|
64
53
|
|
|
@@ -66,5 +55,4 @@ rules:
|
|
|
66
55
|
description: 禁空洞续作询问 (要不要我帮你 X?/还需要别的吗?);保留工作流必要下一步指引
|
|
67
56
|
enforcement: warn
|
|
68
57
|
trigger: response.target == 'chat'
|
|
69
|
-
check_method: regex
|
|
70
58
|
# regex /要不要|还需要别的|希望对你有帮助/ + trigger fires → warn
|