@hunter-harness/workflow-harness 0.2.0 → 0.2.2
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/harness/bundles/general/claude-code/.harness-build.json +1 -1
- package/harness/bundles/general/claude-code/harness-archive/SKILL.md +1 -1
- package/harness/bundles/general/claude-code/harness-archive/reference.md +2 -8
- package/harness/bundles/general/claude-code/harness-codebase-map/SKILL.md +2 -1
- package/harness/bundles/general/claude-code/harness-knowledge-ingest/SKILL.md +35 -21
- package/harness/bundles/general/claude-code/harness-knowledge-ingest/reference.md +53 -7
- package/harness/bundles/general/claude-code/harness-knowledge-ingest/scripts/harness_knowledge.py +521 -125
- package/harness/bundles/general/claude-code/harness-knowledge-ingest/scripts/harness_knowledge_mcp.py +2 -2
- package/harness/bundles/general/claude-code/harness-knowledge-query/SKILL.md +1 -1
- package/harness/bundles/general/claude-code/harness-plan/SKILL.md +2 -1
- package/harness/bundles/general/claude-code/harness-review/SKILL.md +5 -1
- package/harness/bundles/general/claude-code/harness-run/SKILL.md +1 -1
- package/harness/bundles/general/claude-code/harness-run/checklist.md +1 -1
- package/harness/bundles/general/claude-code/harness-submit/SKILL.md +2 -2
- package/harness/bundles/general/claude-code/harness-submit/checklist.md +30 -6
- package/harness/bundles/general/claude-code/harness-sync/SKILL.md +2 -2
- package/harness/bundles/general/claude-code/harness-test/SKILL.md +2 -2
- package/harness/bundles/general/claude-code/harness-test/checklist.md +1 -1
- package/harness/bundles/general/claude-code/harness-test/pitfalls.md +16 -0
- package/harness/bundles/general/claude-code/harness-test/scripts/runtime-helpers.mjs +216 -0
- package/harness/bundles/general/claude-code/protocols/archive-report-protocol.md +1 -1
- package/harness/bundles/general/claude-code/protocols/ledger-protocol.md +55 -2
- package/harness/bundles/general/claude-code/protocols/report-pipeline-protocol.md +1 -8
- package/harness/bundles/general/claude-code/protocols/sensitive-info-protocol.md +13 -0
- package/harness/bundles/general/claude-code/protocols/state-layout-protocol.md +24 -0
- package/harness/bundles/general/claude-code/scripts/harness_archive.py +31 -14
- package/harness/bundles/general/claude-code/scripts/harness_check_gate.py +103 -0
- package/harness/bundles/general/claude-code/scripts/harness_deploy.py +179 -4
- package/harness/bundles/general/claude-code/scripts/harness_ledger.py +269 -3
- package/harness/bundles/general/claude-code/scripts/harness_preflight.py +72 -382
- package/harness/bundles/general/claude-code/scripts/harness_profile.py +742 -0
- package/harness/bundles/general/claude-code/scripts/harness_service.py +99 -2
- package/harness/bundles/general/claude-code/scripts/harness_state.py +179 -0
- package/harness/bundles/general/codebuddy/.harness-build.json +1 -1
- package/harness/bundles/general/codebuddy/harness-archive/SKILL.md +1 -1
- package/harness/bundles/general/codebuddy/harness-archive/reference.md +2 -8
- package/harness/bundles/general/codebuddy/harness-codebase-map/SKILL.md +2 -1
- package/harness/bundles/general/codebuddy/harness-knowledge-ingest/SKILL.md +35 -21
- package/harness/bundles/general/codebuddy/harness-knowledge-ingest/reference.md +53 -7
- package/harness/bundles/general/codebuddy/harness-knowledge-ingest/scripts/harness_knowledge.py +521 -125
- package/harness/bundles/general/codebuddy/harness-knowledge-ingest/scripts/harness_knowledge_mcp.py +2 -2
- package/harness/bundles/general/codebuddy/harness-knowledge-query/SKILL.md +1 -1
- package/harness/bundles/general/codebuddy/harness-plan/SKILL.md +2 -1
- package/harness/bundles/general/codebuddy/harness-review/SKILL.md +5 -1
- package/harness/bundles/general/codebuddy/harness-run/SKILL.md +1 -1
- package/harness/bundles/general/codebuddy/harness-run/checklist.md +1 -1
- package/harness/bundles/general/codebuddy/harness-submit/SKILL.md +2 -2
- package/harness/bundles/general/codebuddy/harness-submit/checklist.md +30 -6
- package/harness/bundles/general/codebuddy/harness-sync/SKILL.md +2 -2
- package/harness/bundles/general/codebuddy/harness-test/SKILL.md +2 -2
- package/harness/bundles/general/codebuddy/harness-test/checklist.md +1 -1
- package/harness/bundles/general/codebuddy/harness-test/pitfalls.md +16 -0
- package/harness/bundles/general/codebuddy/harness-test/scripts/runtime-helpers.mjs +216 -0
- package/harness/bundles/general/codebuddy/protocols/archive-report-protocol.md +1 -1
- package/harness/bundles/general/codebuddy/protocols/ledger-protocol.md +55 -2
- package/harness/bundles/general/codebuddy/protocols/report-pipeline-protocol.md +1 -8
- package/harness/bundles/general/codebuddy/protocols/sensitive-info-protocol.md +13 -0
- package/harness/bundles/general/codebuddy/protocols/state-layout-protocol.md +24 -0
- package/harness/bundles/general/codebuddy/scripts/harness_archive.py +31 -14
- package/harness/bundles/general/codebuddy/scripts/harness_check_gate.py +103 -0
- package/harness/bundles/general/codebuddy/scripts/harness_deploy.py +179 -4
- package/harness/bundles/general/codebuddy/scripts/harness_ledger.py +269 -3
- package/harness/bundles/general/codebuddy/scripts/harness_preflight.py +72 -382
- package/harness/bundles/general/codebuddy/scripts/harness_profile.py +742 -0
- package/harness/bundles/general/codebuddy/scripts/harness_service.py +99 -2
- package/harness/bundles/general/codebuddy/scripts/harness_state.py +179 -0
- package/harness/bundles/general/codex/.harness-build.json +1 -1
- package/harness/bundles/general/codex/harness-archive/SKILL.md +1 -1
- package/harness/bundles/general/codex/harness-archive/reference.md +2 -8
- package/harness/bundles/general/codex/harness-codebase-map/SKILL.md +2 -1
- package/harness/bundles/general/codex/harness-knowledge-ingest/SKILL.md +35 -21
- package/harness/bundles/general/codex/harness-knowledge-ingest/reference.md +53 -7
- package/harness/bundles/general/codex/harness-knowledge-ingest/scripts/harness_knowledge.py +521 -125
- package/harness/bundles/general/codex/harness-knowledge-ingest/scripts/harness_knowledge_mcp.py +2 -2
- package/harness/bundles/general/codex/harness-knowledge-query/SKILL.md +1 -1
- package/harness/bundles/general/codex/harness-plan/SKILL.md +2 -1
- package/harness/bundles/general/codex/harness-review/SKILL.md +5 -1
- package/harness/bundles/general/codex/harness-run/SKILL.md +1 -1
- package/harness/bundles/general/codex/harness-run/checklist.md +1 -1
- package/harness/bundles/general/codex/harness-submit/SKILL.md +2 -2
- package/harness/bundles/general/codex/harness-submit/checklist.md +30 -6
- package/harness/bundles/general/codex/harness-sync/SKILL.md +2 -2
- package/harness/bundles/general/codex/harness-test/SKILL.md +2 -2
- package/harness/bundles/general/codex/harness-test/checklist.md +1 -1
- package/harness/bundles/general/codex/harness-test/pitfalls.md +16 -0
- package/harness/bundles/general/codex/harness-test/scripts/runtime-helpers.mjs +216 -0
- package/harness/bundles/general/codex/protocols/archive-report-protocol.md +1 -1
- package/harness/bundles/general/codex/protocols/ledger-protocol.md +55 -2
- package/harness/bundles/general/codex/protocols/report-pipeline-protocol.md +1 -8
- package/harness/bundles/general/codex/protocols/sensitive-info-protocol.md +13 -0
- package/harness/bundles/general/codex/protocols/state-layout-protocol.md +24 -0
- package/harness/bundles/general/codex/scripts/harness_archive.py +31 -14
- package/harness/bundles/general/codex/scripts/harness_check_gate.py +103 -0
- package/harness/bundles/general/codex/scripts/harness_deploy.py +179 -4
- package/harness/bundles/general/codex/scripts/harness_ledger.py +269 -3
- package/harness/bundles/general/codex/scripts/harness_preflight.py +72 -382
- package/harness/bundles/general/codex/scripts/harness_profile.py +742 -0
- package/harness/bundles/general/codex/scripts/harness_service.py +99 -2
- package/harness/bundles/general/codex/scripts/harness_state.py +179 -0
- package/harness/bundles/general/cursor/.harness-build.json +1 -1
- package/harness/bundles/general/cursor/harness-archive/SKILL.md +1 -1
- package/harness/bundles/general/cursor/harness-archive/reference.md +2 -8
- package/harness/bundles/general/cursor/harness-codebase-map/SKILL.md +2 -1
- package/harness/bundles/general/cursor/harness-knowledge-ingest/SKILL.md +35 -21
- package/harness/bundles/general/cursor/harness-knowledge-ingest/reference.md +53 -7
- package/harness/bundles/general/cursor/harness-knowledge-ingest/scripts/harness_knowledge.py +521 -125
- package/harness/bundles/general/cursor/harness-knowledge-ingest/scripts/harness_knowledge_mcp.py +2 -2
- package/harness/bundles/general/cursor/harness-knowledge-query/SKILL.md +1 -1
- package/harness/bundles/general/cursor/harness-plan/SKILL.md +2 -1
- package/harness/bundles/general/cursor/harness-review/SKILL.md +5 -1
- package/harness/bundles/general/cursor/harness-run/SKILL.md +1 -1
- package/harness/bundles/general/cursor/harness-run/checklist.md +1 -1
- package/harness/bundles/general/cursor/harness-submit/SKILL.md +2 -2
- package/harness/bundles/general/cursor/harness-submit/checklist.md +30 -6
- package/harness/bundles/general/cursor/harness-sync/SKILL.md +2 -2
- package/harness/bundles/general/cursor/harness-test/SKILL.md +2 -2
- package/harness/bundles/general/cursor/harness-test/checklist.md +1 -1
- package/harness/bundles/general/cursor/harness-test/pitfalls.md +16 -0
- package/harness/bundles/general/cursor/harness-test/scripts/runtime-helpers.mjs +216 -0
- package/harness/bundles/general/cursor/protocols/archive-report-protocol.md +1 -1
- package/harness/bundles/general/cursor/protocols/ledger-protocol.md +55 -2
- package/harness/bundles/general/cursor/protocols/report-pipeline-protocol.md +1 -8
- package/harness/bundles/general/cursor/protocols/sensitive-info-protocol.md +13 -0
- package/harness/bundles/general/cursor/protocols/state-layout-protocol.md +24 -0
- package/harness/bundles/general/cursor/scripts/harness_archive.py +31 -14
- package/harness/bundles/general/cursor/scripts/harness_check_gate.py +103 -0
- package/harness/bundles/general/cursor/scripts/harness_deploy.py +179 -4
- package/harness/bundles/general/cursor/scripts/harness_ledger.py +269 -3
- package/harness/bundles/general/cursor/scripts/harness_preflight.py +72 -382
- package/harness/bundles/general/cursor/scripts/harness_profile.py +742 -0
- package/harness/bundles/general/cursor/scripts/harness_service.py +99 -2
- package/harness/bundles/general/cursor/scripts/harness_state.py +179 -0
- package/harness/bundles/java/claude-code/.harness-build.json +1 -1
- package/harness/bundles/java/claude-code/harness-apidoc/SKILL.md +1 -1
- package/harness/bundles/java/claude-code/harness-archive/SKILL.md +1 -1
- package/harness/bundles/java/claude-code/harness-archive/reference.md +2 -8
- package/harness/bundles/java/claude-code/harness-codebase-map/SKILL.md +2 -1
- package/harness/bundles/java/claude-code/harness-knowledge-ingest/SKILL.md +35 -21
- package/harness/bundles/java/claude-code/harness-knowledge-ingest/reference.md +53 -7
- package/harness/bundles/java/claude-code/harness-knowledge-ingest/scripts/harness_knowledge.py +521 -125
- package/harness/bundles/java/claude-code/harness-knowledge-ingest/scripts/harness_knowledge_mcp.py +2 -2
- package/harness/bundles/java/claude-code/harness-knowledge-query/SKILL.md +1 -1
- package/harness/bundles/java/claude-code/harness-package/SKILL.md +3 -3
- package/harness/bundles/java/claude-code/harness-plan/SKILL.md +2 -1
- package/harness/bundles/java/claude-code/harness-review/SKILL.md +5 -1
- package/harness/bundles/java/claude-code/harness-run/SKILL.md +4 -4
- package/harness/bundles/java/claude-code/harness-run/checklist.md +1 -1
- package/harness/bundles/java/claude-code/harness-submit/SKILL.md +3 -3
- package/harness/bundles/java/claude-code/harness-submit/checklist.md +30 -6
- package/harness/bundles/java/claude-code/harness-sync/SKILL.md +2 -2
- package/harness/bundles/java/claude-code/harness-test/SKILL.md +5 -5
- package/harness/bundles/java/claude-code/harness-test/pitfalls.md +16 -0
- package/harness/bundles/java/claude-code/harness-test/scripts/runtime-helpers.mjs +216 -0
- package/harness/bundles/java/claude-code/protocols/archive-report-protocol.md +1 -1
- package/harness/bundles/java/claude-code/protocols/ledger-protocol.md +55 -2
- package/harness/bundles/java/claude-code/protocols/report-pipeline-protocol.md +1 -8
- package/harness/bundles/java/claude-code/protocols/sensitive-info-protocol.md +13 -0
- package/harness/bundles/java/claude-code/protocols/state-layout-protocol.md +24 -0
- package/harness/bundles/java/claude-code/scripts/harness_archive.py +31 -14
- package/harness/bundles/java/claude-code/scripts/harness_check_gate.py +103 -0
- package/harness/bundles/java/claude-code/scripts/harness_deploy.py +179 -4
- package/harness/bundles/java/claude-code/scripts/harness_ledger.py +269 -3
- package/harness/bundles/java/claude-code/scripts/harness_preflight.py +72 -382
- package/harness/bundles/java/claude-code/scripts/harness_profile.py +742 -0
- package/harness/bundles/java/claude-code/scripts/harness_service.py +99 -2
- package/harness/bundles/java/claude-code/scripts/harness_state.py +179 -0
- package/harness/bundles/java/codebuddy/.harness-build.json +1 -1
- package/harness/bundles/java/codebuddy/harness-apidoc/SKILL.md +1 -1
- package/harness/bundles/java/codebuddy/harness-archive/SKILL.md +1 -1
- package/harness/bundles/java/codebuddy/harness-archive/reference.md +2 -8
- package/harness/bundles/java/codebuddy/harness-codebase-map/SKILL.md +2 -1
- package/harness/bundles/java/codebuddy/harness-knowledge-ingest/SKILL.md +35 -21
- package/harness/bundles/java/codebuddy/harness-knowledge-ingest/reference.md +53 -7
- package/harness/bundles/java/codebuddy/harness-knowledge-ingest/scripts/harness_knowledge.py +521 -125
- package/harness/bundles/java/codebuddy/harness-knowledge-ingest/scripts/harness_knowledge_mcp.py +2 -2
- package/harness/bundles/java/codebuddy/harness-knowledge-query/SKILL.md +1 -1
- package/harness/bundles/java/codebuddy/harness-package/SKILL.md +3 -3
- package/harness/bundles/java/codebuddy/harness-plan/SKILL.md +2 -1
- package/harness/bundles/java/codebuddy/harness-review/SKILL.md +5 -1
- package/harness/bundles/java/codebuddy/harness-run/SKILL.md +4 -4
- package/harness/bundles/java/codebuddy/harness-run/checklist.md +1 -1
- package/harness/bundles/java/codebuddy/harness-submit/SKILL.md +3 -3
- package/harness/bundles/java/codebuddy/harness-submit/checklist.md +30 -6
- package/harness/bundles/java/codebuddy/harness-sync/SKILL.md +2 -2
- package/harness/bundles/java/codebuddy/harness-test/SKILL.md +5 -5
- package/harness/bundles/java/codebuddy/harness-test/pitfalls.md +16 -0
- package/harness/bundles/java/codebuddy/harness-test/scripts/runtime-helpers.mjs +216 -0
- package/harness/bundles/java/codebuddy/protocols/archive-report-protocol.md +1 -1
- package/harness/bundles/java/codebuddy/protocols/ledger-protocol.md +55 -2
- package/harness/bundles/java/codebuddy/protocols/report-pipeline-protocol.md +1 -8
- package/harness/bundles/java/codebuddy/protocols/sensitive-info-protocol.md +13 -0
- package/harness/bundles/java/codebuddy/protocols/state-layout-protocol.md +24 -0
- package/harness/bundles/java/codebuddy/scripts/harness_archive.py +31 -14
- package/harness/bundles/java/codebuddy/scripts/harness_check_gate.py +103 -0
- package/harness/bundles/java/codebuddy/scripts/harness_deploy.py +179 -4
- package/harness/bundles/java/codebuddy/scripts/harness_ledger.py +269 -3
- package/harness/bundles/java/codebuddy/scripts/harness_preflight.py +72 -382
- package/harness/bundles/java/codebuddy/scripts/harness_profile.py +742 -0
- package/harness/bundles/java/codebuddy/scripts/harness_service.py +99 -2
- package/harness/bundles/java/codebuddy/scripts/harness_state.py +179 -0
- package/harness/bundles/java/codex/.harness-build.json +1 -1
- package/harness/bundles/java/codex/harness-apidoc/SKILL.md +1 -1
- package/harness/bundles/java/codex/harness-archive/SKILL.md +1 -1
- package/harness/bundles/java/codex/harness-archive/reference.md +2 -8
- package/harness/bundles/java/codex/harness-codebase-map/SKILL.md +2 -1
- package/harness/bundles/java/codex/harness-knowledge-ingest/SKILL.md +35 -21
- package/harness/bundles/java/codex/harness-knowledge-ingest/reference.md +53 -7
- package/harness/bundles/java/codex/harness-knowledge-ingest/scripts/harness_knowledge.py +521 -125
- package/harness/bundles/java/codex/harness-knowledge-ingest/scripts/harness_knowledge_mcp.py +2 -2
- package/harness/bundles/java/codex/harness-knowledge-query/SKILL.md +1 -1
- package/harness/bundles/java/codex/harness-package/SKILL.md +3 -3
- package/harness/bundles/java/codex/harness-plan/SKILL.md +2 -1
- package/harness/bundles/java/codex/harness-review/SKILL.md +5 -1
- package/harness/bundles/java/codex/harness-run/SKILL.md +4 -4
- package/harness/bundles/java/codex/harness-run/checklist.md +1 -1
- package/harness/bundles/java/codex/harness-submit/SKILL.md +3 -3
- package/harness/bundles/java/codex/harness-submit/checklist.md +30 -6
- package/harness/bundles/java/codex/harness-sync/SKILL.md +2 -2
- package/harness/bundles/java/codex/harness-test/SKILL.md +5 -5
- package/harness/bundles/java/codex/harness-test/pitfalls.md +16 -0
- package/harness/bundles/java/codex/harness-test/scripts/runtime-helpers.mjs +216 -0
- package/harness/bundles/java/codex/protocols/archive-report-protocol.md +1 -1
- package/harness/bundles/java/codex/protocols/ledger-protocol.md +55 -2
- package/harness/bundles/java/codex/protocols/report-pipeline-protocol.md +1 -8
- package/harness/bundles/java/codex/protocols/sensitive-info-protocol.md +13 -0
- package/harness/bundles/java/codex/protocols/state-layout-protocol.md +24 -0
- package/harness/bundles/java/codex/scripts/harness_archive.py +31 -14
- package/harness/bundles/java/codex/scripts/harness_check_gate.py +103 -0
- package/harness/bundles/java/codex/scripts/harness_deploy.py +179 -4
- package/harness/bundles/java/codex/scripts/harness_ledger.py +269 -3
- package/harness/bundles/java/codex/scripts/harness_preflight.py +72 -382
- package/harness/bundles/java/codex/scripts/harness_profile.py +742 -0
- package/harness/bundles/java/codex/scripts/harness_service.py +99 -2
- package/harness/bundles/java/codex/scripts/harness_state.py +179 -0
- package/harness/bundles/java/cursor/.harness-build.json +1 -1
- package/harness/bundles/java/cursor/harness-apidoc/SKILL.md +1 -1
- package/harness/bundles/java/cursor/harness-archive/SKILL.md +1 -1
- package/harness/bundles/java/cursor/harness-archive/reference.md +2 -8
- package/harness/bundles/java/cursor/harness-codebase-map/SKILL.md +2 -1
- package/harness/bundles/java/cursor/harness-knowledge-ingest/SKILL.md +35 -21
- package/harness/bundles/java/cursor/harness-knowledge-ingest/reference.md +53 -7
- package/harness/bundles/java/cursor/harness-knowledge-ingest/scripts/harness_knowledge.py +521 -125
- package/harness/bundles/java/cursor/harness-knowledge-ingest/scripts/harness_knowledge_mcp.py +2 -2
- package/harness/bundles/java/cursor/harness-knowledge-query/SKILL.md +1 -1
- package/harness/bundles/java/cursor/harness-package/SKILL.md +3 -3
- package/harness/bundles/java/cursor/harness-plan/SKILL.md +2 -1
- package/harness/bundles/java/cursor/harness-review/SKILL.md +5 -1
- package/harness/bundles/java/cursor/harness-run/SKILL.md +4 -4
- package/harness/bundles/java/cursor/harness-run/checklist.md +1 -1
- package/harness/bundles/java/cursor/harness-submit/SKILL.md +3 -3
- package/harness/bundles/java/cursor/harness-submit/checklist.md +30 -6
- package/harness/bundles/java/cursor/harness-sync/SKILL.md +2 -2
- package/harness/bundles/java/cursor/harness-test/SKILL.md +5 -5
- package/harness/bundles/java/cursor/harness-test/pitfalls.md +16 -0
- package/harness/bundles/java/cursor/harness-test/scripts/runtime-helpers.mjs +216 -0
- package/harness/bundles/java/cursor/protocols/archive-report-protocol.md +1 -1
- package/harness/bundles/java/cursor/protocols/ledger-protocol.md +55 -2
- package/harness/bundles/java/cursor/protocols/report-pipeline-protocol.md +1 -8
- package/harness/bundles/java/cursor/protocols/sensitive-info-protocol.md +13 -0
- package/harness/bundles/java/cursor/protocols/state-layout-protocol.md +24 -0
- package/harness/bundles/java/cursor/scripts/harness_archive.py +31 -14
- package/harness/bundles/java/cursor/scripts/harness_check_gate.py +103 -0
- package/harness/bundles/java/cursor/scripts/harness_deploy.py +179 -4
- package/harness/bundles/java/cursor/scripts/harness_ledger.py +269 -3
- package/harness/bundles/java/cursor/scripts/harness_preflight.py +72 -382
- package/harness/bundles/java/cursor/scripts/harness_profile.py +742 -0
- package/harness/bundles/java/cursor/scripts/harness_service.py +99 -2
- package/harness/bundles/java/cursor/scripts/harness_state.py +179 -0
- package/harness/manifests/general/claude-code.json +46 -30
- package/harness/manifests/general/codebuddy.json +46 -30
- package/harness/manifests/general/codex.json +46 -30
- package/harness/manifests/general/cursor.json +46 -30
- package/harness/manifests/java/claude-code.json +47 -31
- package/harness/manifests/java/codebuddy.json +47 -31
- package/harness/manifests/java/codex.json +47 -31
- package/harness/manifests/java/cursor.json +47 -31
- package/hunter-workflow-family.json +2 -2
- package/package.json +1 -1
|
@@ -125,7 +125,14 @@ def read_json(path: Path) -> Any:
|
|
|
125
125
|
def write_json(path: Path, data: Any) -> None:
|
|
126
126
|
path.parent.mkdir(parents=True, exist_ok=True)
|
|
127
127
|
text = json.dumps(data, ensure_ascii=False, indent=2) + "\n"
|
|
128
|
-
|
|
128
|
+
# 原子写 temp+os.replace:崩溃后不留半写文件(与 runtime-helpers.mjs writeJsonUtf8NoBom 一致)。
|
|
129
|
+
tmp = path.with_name(f".{path.name}.{os.getpid()}.tmp")
|
|
130
|
+
try:
|
|
131
|
+
tmp.write_text(text, encoding="utf-8", newline="\n")
|
|
132
|
+
os.replace(tmp, path)
|
|
133
|
+
except BaseException:
|
|
134
|
+
tmp.unlink(missing_ok=True)
|
|
135
|
+
raise
|
|
129
136
|
|
|
130
137
|
|
|
131
138
|
def load_build_profile(project: Path) -> dict[str, Any]:
|
|
@@ -153,6 +160,72 @@ def get_service_start(profile: dict[str, Any]) -> dict[str, Any]:
|
|
|
153
160
|
return svc
|
|
154
161
|
|
|
155
162
|
|
|
163
|
+
# Worktree/change 路径标记:持久 profile 的 serviceStart 不得含这些具体路径。
|
|
164
|
+
# runtime resolve 把具体 overlay/profile 注入到 session,不写回持久 profile
|
|
165
|
+
# (spec §3.1 持久 profile 只保存模板;§3.4 修复输入端陈旧 profile)。
|
|
166
|
+
STALE_WORKTREE_MARKERS: tuple[str, ...] = (
|
|
167
|
+
".claude/worktrees/",
|
|
168
|
+
".cursor/worktrees/",
|
|
169
|
+
".codeium/worktrees/",
|
|
170
|
+
)
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
def _detect_stale_persistent_values(service_start: dict[str, Any]) -> list[str]:
|
|
174
|
+
"""检测 serviceStart 是否含具体旧 worktree/change 持久路径。
|
|
175
|
+
|
|
176
|
+
持久 profile 只保存模板;command/overlayPath/profile 嵌入 worktree 路径
|
|
177
|
+
说明是 v1 残留或被错误写回的已解析 overlay,必须拒绝(spec §3.4)。
|
|
178
|
+
"""
|
|
179
|
+
stale: list[str] = []
|
|
180
|
+
for field in ("command", "overlayPath", "profile"):
|
|
181
|
+
val = service_start.get(field)
|
|
182
|
+
if not isinstance(val, str) or not val:
|
|
183
|
+
continue
|
|
184
|
+
for marker in STALE_WORKTREE_MARKERS:
|
|
185
|
+
if marker in val:
|
|
186
|
+
stale.append(f"{field} contains stale worktree path: {marker}")
|
|
187
|
+
break
|
|
188
|
+
return stale
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
def resolve_service_start(
|
|
192
|
+
profile: dict[str, Any],
|
|
193
|
+
*,
|
|
194
|
+
change_name: str | None = None,
|
|
195
|
+
worktree_root: Path | None = None,
|
|
196
|
+
overlay_path: str | None = None,
|
|
197
|
+
) -> dict[str, Any]:
|
|
198
|
+
"""从模板 serviceStart + runtime context 生成 resolved serviceStart。
|
|
199
|
+
|
|
200
|
+
spec §3.1:持久 profile 的 serviceStart 是模板(profile/overlayPath 留空);
|
|
201
|
+
runtime 注入具体 overlay/profile 到返回值,写入 session,**不写回持久 profile**。
|
|
202
|
+
spec §3.4:含 worktree/change 陈旧持久值时拒绝(修复输入端陈旧 profile)。
|
|
203
|
+
|
|
204
|
+
向后兼容:持久 profile.profile 非空(如 v1 残留 "local-dev")→ 保留;
|
|
205
|
+
overlay_path 未提供 → 保留持久 overlayPath(可能为空)。
|
|
206
|
+
"""
|
|
207
|
+
service_start = get_service_start(profile) # 校验 command 非空
|
|
208
|
+
|
|
209
|
+
stale = _detect_stale_persistent_values(service_start)
|
|
210
|
+
if stale:
|
|
211
|
+
raise ValueError(
|
|
212
|
+
"serviceStart contains stale persistent worktree/change values; "
|
|
213
|
+
"run harness_profile.py migrate to clear: " + "; ".join(stale)
|
|
214
|
+
)
|
|
215
|
+
|
|
216
|
+
resolved = dict(service_start)
|
|
217
|
+
# runtime overlay 注入:显式 overlay_path 覆盖;否则保留持久模板值
|
|
218
|
+
if overlay_path is not None:
|
|
219
|
+
resolved["overlayPath"] = overlay_path
|
|
220
|
+
# runtime profile 注入:持久 profile 留空时用 change_name;非空则保留
|
|
221
|
+
if not str(resolved.get("profile") or "").strip():
|
|
222
|
+
resolved["profile"] = change_name or "local-dev"
|
|
223
|
+
# worktree_root 预留给未来相对 overlay 路径解析(spec §3.6 state snapshot);
|
|
224
|
+
# 不写入返回值,避免污染 session。
|
|
225
|
+
_ = worktree_root
|
|
226
|
+
return resolved
|
|
227
|
+
|
|
228
|
+
|
|
156
229
|
def resolve_service_input_files(
|
|
157
230
|
project: Path,
|
|
158
231
|
service_start: dict[str, Any],
|
|
@@ -934,10 +1007,24 @@ def cmd_ensure(args: argparse.Namespace) -> int:
|
|
|
934
1007
|
|
|
935
1008
|
try:
|
|
936
1009
|
profile = load_build_profile(project)
|
|
937
|
-
service_start = get_service_start(profile)
|
|
938
1010
|
except (OSError, ValueError, FileNotFoundError, json.JSONDecodeError) as exc:
|
|
939
1011
|
return emit_error(str(exc), as_json=as_json)
|
|
940
1012
|
|
|
1013
|
+
# cluster 3 (spec §3.1/§3.4): resolve 模板 serviceStart + runtime context。
|
|
1014
|
+
# 持久 profile 只保存模板;runtime overlay/profile 注入到 session,不写回持久 profile。
|
|
1015
|
+
# 含 worktree/change 陈旧持久值时拒绝(修复输入端陈旧 profile)。
|
|
1016
|
+
change_name = getattr(args, "change_name", None) or change_dir.name
|
|
1017
|
+
overlay = getattr(args, "overlay", None)
|
|
1018
|
+
try:
|
|
1019
|
+
service_start = resolve_service_start(
|
|
1020
|
+
profile,
|
|
1021
|
+
change_name=change_name,
|
|
1022
|
+
worktree_root=project,
|
|
1023
|
+
overlay_path=overlay,
|
|
1024
|
+
)
|
|
1025
|
+
except ValueError as exc:
|
|
1026
|
+
return emit_error(str(exc), as_json=as_json)
|
|
1027
|
+
|
|
941
1028
|
command = str(service_start["command"]).strip()
|
|
942
1029
|
port = extract_port(service_start)
|
|
943
1030
|
|
|
@@ -1292,6 +1379,16 @@ def build_parser() -> argparse.ArgumentParser:
|
|
|
1292
1379
|
default=None,
|
|
1293
1380
|
help="comma-separated service module source files for inputsHash",
|
|
1294
1381
|
)
|
|
1382
|
+
p_ensure.add_argument(
|
|
1383
|
+
"--change-name",
|
|
1384
|
+
default=None,
|
|
1385
|
+
help="change-name for runtime profile resolve (default: change-dir name)",
|
|
1386
|
+
)
|
|
1387
|
+
p_ensure.add_argument(
|
|
1388
|
+
"--overlay",
|
|
1389
|
+
default=None,
|
|
1390
|
+
help="runtime overlay path injected into resolved serviceStart",
|
|
1391
|
+
)
|
|
1295
1392
|
p_ensure.add_argument("--json", action="store_true")
|
|
1296
1393
|
p_ensure.set_defaults(func=cmd_ensure)
|
|
1297
1394
|
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""Harness state/context snapshot (cluster 3, spec §3.6).
|
|
3
|
+
|
|
4
|
+
Per-segment fingerprints for project/worktree/git/profile/rules/map/knowledge/
|
|
5
|
+
diff. Each segment fails independently; cache miss re-captures only the affected
|
|
6
|
+
segment. plan/run/test/review/submit read this snapshot; stale segments are
|
|
7
|
+
re-captured by the script. Never skip code or verification gates on cache alone.
|
|
8
|
+
|
|
9
|
+
Python 3.10+ stdlib only. UTF-8 without BOM. Windows path friendly.
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
from __future__ import annotations
|
|
13
|
+
|
|
14
|
+
import datetime as dt
|
|
15
|
+
import hashlib
|
|
16
|
+
import json
|
|
17
|
+
import os
|
|
18
|
+
import sys
|
|
19
|
+
from pathlib import Path
|
|
20
|
+
from typing import Any
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
SCRIPTS_DIR = Path(__file__).resolve().parent
|
|
24
|
+
if str(SCRIPTS_DIR) not in sys.path:
|
|
25
|
+
sys.path.insert(0, str(SCRIPTS_DIR))
|
|
26
|
+
|
|
27
|
+
from harness_ledger import compute_inputs_hash # noqa: E402
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
if hasattr(sys.stdout, "reconfigure"):
|
|
31
|
+
sys.stdout.reconfigure(encoding="utf-8")
|
|
32
|
+
if hasattr(sys.stderr, "reconfigure"):
|
|
33
|
+
sys.stderr.reconfigure(encoding="utf-8")
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
SNAPSHOT_SCHEMA_VERSION = 1
|
|
37
|
+
SNAPSHOT_REL = Path("meta") / "state-snapshot.json"
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def now_iso() -> str:
|
|
41
|
+
return dt.datetime.now().astimezone().isoformat(timespec="seconds")
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def read_json(path: Path) -> Any:
|
|
45
|
+
# utf-8-sig 兼容可能残留的 BOM(与 harness_ledger.py 保持一致)。
|
|
46
|
+
return json.loads(path.read_text(encoding="utf-8-sig"))
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def write_json(path: Path, data: Any) -> None:
|
|
50
|
+
path.parent.mkdir(parents=True, exist_ok=True)
|
|
51
|
+
text = json.dumps(data, ensure_ascii=False, indent=2) + "\n"
|
|
52
|
+
# 强制 LF,UTF-8 无 BOM(与 harness_ledger/harness_profile 保持一致)。
|
|
53
|
+
# 原子写 temp+os.replace:崩溃后不留半写文件(与 runtime-helpers.mjs writeJsonUtf8NoBom 一致)。
|
|
54
|
+
tmp = path.with_name(f".{path.name}.{os.getpid()}.tmp")
|
|
55
|
+
try:
|
|
56
|
+
tmp.write_text(text, encoding="utf-8", newline="\n")
|
|
57
|
+
os.replace(tmp, path)
|
|
58
|
+
except BaseException:
|
|
59
|
+
tmp.unlink(missing_ok=True)
|
|
60
|
+
raise
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
def snapshot_path(change_dir: Path) -> Path:
|
|
64
|
+
return change_dir / SNAPSHOT_REL
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
def _empty_segment_fingerprint() -> str:
|
|
68
|
+
return "sha256:" + hashlib.sha256(b"").hexdigest()
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
def capture_file_segment(
|
|
72
|
+
files: list[str], *, captured_at: str | None = None
|
|
73
|
+
) -> dict[str, Any]:
|
|
74
|
+
"""对一组文件算指纹(compute_inputs_hash,order-independent),返回 segment dict。
|
|
75
|
+
|
|
76
|
+
空文件集 → 稳定空指纹 + 空 files(段存在但无输入,不算失效)。
|
|
77
|
+
缺失文件由 compute_inputs_hash 抛 FileNotFoundError(调用方应保证文件存在)。
|
|
78
|
+
"""
|
|
79
|
+
if files:
|
|
80
|
+
fp, resolved = compute_inputs_hash(files)
|
|
81
|
+
return {
|
|
82
|
+
"fingerprint": fp,
|
|
83
|
+
"files": resolved,
|
|
84
|
+
"capturedAt": captured_at or now_iso(),
|
|
85
|
+
}
|
|
86
|
+
return {
|
|
87
|
+
"fingerprint": _empty_segment_fingerprint(),
|
|
88
|
+
"files": [],
|
|
89
|
+
"capturedAt": captured_at or now_iso(),
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
def capture_snapshot(
|
|
94
|
+
change_dir: Path,
|
|
95
|
+
*,
|
|
96
|
+
change_name: str,
|
|
97
|
+
project: Path,
|
|
98
|
+
worktree_root: Path,
|
|
99
|
+
base: str | None = None,
|
|
100
|
+
head: str | None = None,
|
|
101
|
+
segment_files: dict[str, list[str]] | None = None,
|
|
102
|
+
) -> dict[str, Any]:
|
|
103
|
+
"""采集全段 state snapshot。
|
|
104
|
+
|
|
105
|
+
segment_files 指定每段(profile/rules/map/knowledge/...)的文件集;调用方
|
|
106
|
+
(各 skill)决定每段采什么文件,snapshot 只负责采集 + 比对 + 失效。
|
|
107
|
+
git 段记录 base/head;diff 指纹由调用方按需用 harness_ledger.compute_diff_hash
|
|
108
|
+
采后填入 segment_files(spec §3.6)。
|
|
109
|
+
"""
|
|
110
|
+
_ = change_dir # 预留给未来 write-back;当前 capture 只返回 dict
|
|
111
|
+
segment_files = segment_files or {}
|
|
112
|
+
segments: dict[str, Any] = {}
|
|
113
|
+
for name, files in segment_files.items():
|
|
114
|
+
segments[name] = capture_file_segment(files)
|
|
115
|
+
|
|
116
|
+
return {
|
|
117
|
+
"schemaVersion": SNAPSHOT_SCHEMA_VERSION,
|
|
118
|
+
"generatedAt": now_iso(),
|
|
119
|
+
"changeName": change_name,
|
|
120
|
+
"project": {"root": str(project.resolve())},
|
|
121
|
+
"worktree": {"root": str(Path(worktree_root).resolve())},
|
|
122
|
+
"git": {"base": base or "", "head": head or ""},
|
|
123
|
+
"segments": segments,
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
def write_snapshot(change_dir: Path, snapshot: dict[str, Any]) -> Path:
|
|
128
|
+
path = snapshot_path(change_dir)
|
|
129
|
+
write_json(path, snapshot)
|
|
130
|
+
return path
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
def load_snapshot(change_dir: Path) -> dict[str, Any] | None:
|
|
134
|
+
path = snapshot_path(change_dir)
|
|
135
|
+
if not path.is_file():
|
|
136
|
+
return None
|
|
137
|
+
try:
|
|
138
|
+
data = read_json(path)
|
|
139
|
+
except (OSError, json.JSONDecodeError):
|
|
140
|
+
return None
|
|
141
|
+
return data if isinstance(data, dict) else None
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
def is_segment_stale(
|
|
145
|
+
snapshot: dict[str, Any], segment: str, current_fingerprint: str
|
|
146
|
+
) -> bool:
|
|
147
|
+
"""某段指纹是否变化。段不存在 → True(需采集)。"""
|
|
148
|
+
segs = snapshot.get("segments") or {}
|
|
149
|
+
seg = segs.get(segment)
|
|
150
|
+
if not isinstance(seg, dict):
|
|
151
|
+
return True
|
|
152
|
+
return seg.get("fingerprint") != current_fingerprint
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
def refresh_segments(
|
|
156
|
+
change_dir: Path,
|
|
157
|
+
snapshot: dict[str, Any],
|
|
158
|
+
*,
|
|
159
|
+
project: Path,
|
|
160
|
+
worktree_root: Path,
|
|
161
|
+
segment_files: dict[str, list[str]],
|
|
162
|
+
segments: list[str],
|
|
163
|
+
) -> dict[str, Any]:
|
|
164
|
+
"""只重采指定段;其他段保留原 capturedAt/fingerprint。
|
|
165
|
+
|
|
166
|
+
spec §3.6:缓存失效只重采受影响段,不得仅凭缓存跳过代码或验证门禁。
|
|
167
|
+
返回 refreshed snapshot(不写盘;调用方按需 write_snapshot)。
|
|
168
|
+
"""
|
|
169
|
+
_ = change_dir # 预留给未来 write-back
|
|
170
|
+
refreshed = dict(snapshot)
|
|
171
|
+
refreshed["project"] = {"root": str(project.resolve())}
|
|
172
|
+
refreshed["worktree"] = {"root": str(Path(worktree_root).resolve())}
|
|
173
|
+
refreshed_segments = dict(snapshot.get("segments") or {})
|
|
174
|
+
for name in segments:
|
|
175
|
+
files = segment_files.get(name, [])
|
|
176
|
+
refreshed_segments[name] = capture_file_segment(files)
|
|
177
|
+
refreshed["segments"] = refreshed_segments
|
|
178
|
+
refreshed["generatedAt"] = now_iso()
|
|
179
|
+
return refreshed
|
|
@@ -3,7 +3,7 @@ name: harness-archive
|
|
|
3
3
|
description: 归档所有变更产出(计划/测试报告/审查/SQL/API文档)到
|
|
4
4
|
.harness/archive/,含归档元数据和可视化最终总结。使用场景:归档、完成归档、收尾、打包产出物
|
|
5
5
|
---
|
|
6
|
-
<!-- generated by harness_deploy.py; core=
|
|
6
|
+
<!-- generated by harness_deploy.py; core=507d66eba1aaf00e; overlay=none; agent=cursor; do not edit -->
|
|
7
7
|
# harness-archive — 变更归档
|
|
8
8
|
|
|
9
9
|
## Purpose
|
|
@@ -41,7 +41,7 @@ powershell.exe -NoProfile -ExecutionPolicy Bypass -File "harness-skills/harness-
|
|
|
41
41
|
|
|
42
42
|
## summary-data.json 与 harness_archive.py
|
|
43
43
|
|
|
44
|
-
|
|
44
|
+
`reports/final/summary-data.json` 只能由 `harness_archive.py finalize`(归档时)或 `replay`(回放时)生成/校验;**禁止 agent 临场手写或拼装等价数据**,也不存在独立的 `report collect`/`report validate` CLI(参见 `../protocols/report-pipeline-protocol.md` 与 `templates/summary-data-template.json` schemaVersion 2.2)。必须保留原 final report 维度。必须包含:
|
|
45
45
|
|
|
46
46
|
- `businessGoal`:本次变更为了做什么;
|
|
47
47
|
- `stageStatus`:plan/run/test/review/submit/archive;
|
|
@@ -68,13 +68,7 @@ powershell.exe -NoProfile -Command "& '<node-path>' 'harness-skills/harness-arch
|
|
|
68
68
|
|
|
69
69
|
禁止模型临场手写大段 HTML。确需临时修 HTML,只能修模板,不得让统计数字脱离 `summary-data.json`。
|
|
70
70
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
```powershell
|
|
74
|
-
powershell.exe -NoProfile -Command "npx hunter-harness report validate --change-id '<date-change>' --json"
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
存在 validate error 时,不得删除原 `.harness/changes/<change>` 目录。
|
|
71
|
+
`validate` 是 `harness_archive.py finalize` 的内嵌同进程步骤(不再作为独立 `report validate` CLI 调用)。finalize 在 validate error 存在时恢复原 `.harness/changes/<change>` 目录并 exit 非 0,绝不归档未通过校验的变更。
|
|
78
72
|
|
|
79
73
|
## archive-meta.md 模板
|
|
80
74
|
|
|
@@ -3,7 +3,7 @@ name: harness-codebase-map
|
|
|
3
3
|
description: 分析现有代码库并生成 .harness/codebase/map/
|
|
4
4
|
下的结构化代码库地图。用于陌生项目理解、重大改造前梳理、harness-sync 提示 map 过期后的人工刷新。
|
|
5
5
|
---
|
|
6
|
-
<!-- generated by harness_deploy.py; core=
|
|
6
|
+
<!-- generated by harness_deploy.py; core=507d66eba1aaf00e; overlay=none; agent=cursor; do not edit -->
|
|
7
7
|
# harness-codebase-map — 代码库地图
|
|
8
8
|
|
|
9
9
|
## Purpose
|
|
@@ -67,6 +67,7 @@ description: 分析现有代码库并生成 .harness/codebase/map/
|
|
|
67
67
|
| 4 | 不管理 CodeGraph |
|
|
68
68
|
| 5 | 敏感信息脱敏 → `sensitive-info-protocol` |
|
|
69
69
|
| 6 | 证据化输出 → `evidence-based-reporting-protocol` |
|
|
70
|
+
| 7 | 扫描复用 `harness_profile` 的 `excludedRoots`(`DEFAULT_EXCLUDED_ROOTS`:node_modules/target/build/dist/cache 等)与 state snapshot 输入,不重复定义排除集;sync 只建议刷新,不自动触发全量 map(design §3.7) |
|
|
70
71
|
|
|
71
72
|
## Output Format
|
|
72
73
|
|
|
@@ -3,7 +3,7 @@ name: harness-knowledge-ingest
|
|
|
3
3
|
description: 从 .harness/archive 归档整理、同步和维护项目知识索引。适用场景:ingest knowledge、sync
|
|
4
4
|
knowledge、rebuild knowledge index、promote knowledge、确认知识条目、检查知识库是否过期。
|
|
5
5
|
---
|
|
6
|
-
<!-- generated by harness_deploy.py; core=
|
|
6
|
+
<!-- generated by harness_deploy.py; core=507d66eba1aaf00e; overlay=none; agent=cursor; do not edit -->
|
|
7
7
|
# harness-knowledge-ingest
|
|
8
8
|
|
|
9
9
|
从 `.harness/archive/**/reports/final/summary-data.json` 抽取项目知识,生成并维护本地 `.harness/knowledge/` 索引。
|
|
@@ -34,7 +34,7 @@ description: 从 .harness/archive 归档整理、同步和维护项目知识索
|
|
|
34
34
|
解决两个问题:
|
|
35
35
|
|
|
36
36
|
1. **整理知识库内容**:把归档里的 `businessGoal`、`changedFiles`、`maintenanceNotes`、`knownRisks`、`manualActions`、`verification`、`reviewSummary` 抽成知识条目。
|
|
37
|
-
2. **维护知识生命周期**:检查索引是否过期,保留 active
|
|
37
|
+
2. **维护知识生命周期**:检查索引是否过期,保留 active 条目;高置信 candidate 由 `autoPromote` 自动提升;其余 candidate/conflicted 由 **Agent judge** 闭环裁决,不再默认输出人工待办清单。
|
|
38
38
|
|
|
39
39
|
## Outputs
|
|
40
40
|
|
|
@@ -67,11 +67,11 @@ description: 从 .harness/archive 归档整理、同步和维护项目知识索
|
|
|
67
67
|
|
|
68
68
|
| 命令 | 用途 |
|
|
69
69
|
|---|---|
|
|
70
|
-
| `auto` | 一键防腐:首建 config、sync --update
|
|
70
|
+
| `auto` | 一键防腐:首建 config、sync --update、**默认**写回 validator 建议、verify、audit;随后由 **Agent** 执行 judge 闭环 |
|
|
71
71
|
| `ingest` | 重建/刷新知识索引,抽取 candidate;`--no-incremental` 强制全量重抽取 |
|
|
72
72
|
| `sync` | 检查 index 与 archive/HEAD 一致性;`--update` 自动刷新 |
|
|
73
|
-
| `promote` | candidate→active
|
|
74
|
-
| `demote` | active→stale/candidate
|
|
73
|
+
| `promote` | candidate→active(显式 promote 或 autoPromote / judge 触发) |
|
|
74
|
+
| `demote` | active→stale/candidate(显式 demote 或自动降级策略触发) |
|
|
75
75
|
| `audit` | 生成 Candidate/Stale/Superseded/Conflict/Active Review 报告 |
|
|
76
76
|
| `verify` | 执行 entry validators,刷新 lifecycle.validation,生成 verification-report |
|
|
77
77
|
| `suggest-validators` | 生成 file_exists/file_contains validator 建议;`--apply` 写回 entry |
|
|
@@ -103,29 +103,40 @@ powershell.exe -Command "python '<skill-dir>\scripts\harness_knowledge.py' inges
|
|
|
103
103
|
- `views/`:Obsidian 友好的浏览视图。
|
|
104
104
|
- `reports/`:本次 ingest 报告。
|
|
105
105
|
|
|
106
|
-
### Phase 2
|
|
106
|
+
### Phase 2:一键 auto(推荐入口)
|
|
107
107
|
|
|
108
108
|
```powershell
|
|
109
|
-
powershell.exe -Command "python '<skill-dir>\scripts\harness_knowledge.py'
|
|
109
|
+
powershell.exe -Command "python '<skill-dir>\scripts\harness_knowledge.py' auto --project '<project-root>'"
|
|
110
110
|
```
|
|
111
111
|
|
|
112
|
-
|
|
112
|
+
`auto` 默认会写回确定性 validator 建议(`--no-apply-suggestions` 可关闭)。JSON 返回含 `lifecycle` 摘要(validatorsApplied、autoPromote、pendingAgentJudge 等)。
|
|
113
|
+
|
|
114
|
+
### Phase 3:Agent judge 闭环(auto 之后必须执行)
|
|
115
|
+
|
|
116
|
+
当 `lifecycle.pendingAgentJudge > 0`、存在 `pending-judge` outbox,或 `judge export` 的 `counts.pending > 0` 时:
|
|
117
|
+
|
|
118
|
+
1. `judge export`(或读 maintain 产出的 pending judgements)
|
|
119
|
+
2. Agent 读取 export JSON,按 `reference.md`「Agent judge 启发式」批量写 `reports/judge-decisions-<ts>.json`
|
|
120
|
+
3. `judge apply --apply <decisions.json>`(`knowledge.manualReview=true` 时需用户显式 `--force`)
|
|
121
|
+
4. 向用户输出 **已处理报告**(promoted/dropped/superseded/kept/skipped 计数 + 报告路径)
|
|
122
|
+
|
|
123
|
+
**禁止**默认输出「请人工确认 N 条 candidate」类五步待办清单。拿不准的 candidate 保持 `candidate` 状态留待下轮,记入 `skippedCandidates` 即可。
|
|
113
124
|
|
|
114
|
-
|
|
125
|
+
裁决体量:`config.judge.maxCandidatesPerRun`(默认 100);conflicted 优先全量裁决。
|
|
115
126
|
|
|
116
|
-
|
|
127
|
+
### Phase 4:同步检查(可选)
|
|
128
|
+
|
|
129
|
+
```powershell
|
|
130
|
+
powershell.exe -Command "python '<skill-dir>\scripts\harness_knowledge.py' sync --project '<project-root>'"
|
|
131
|
+
```
|
|
117
132
|
|
|
118
|
-
|
|
133
|
+
当 `upToDate=false` 时,运行 `sync --update` 或重新 `auto`,再交给 `harness-knowledge-query` 查询。
|
|
119
134
|
|
|
120
|
-
|
|
121
|
-
- 架构决策
|
|
122
|
-
- API contract
|
|
123
|
-
- 反复踩坑点
|
|
124
|
-
- 测试或发布前置条件
|
|
135
|
+
### Phase 5:显式 promote/demote(例外路径)
|
|
125
136
|
|
|
126
|
-
|
|
137
|
+
仅在用户点名单条、或 `manualReview=true` 需人工确认时使用 `promote` / `demote`。日常归档后不要逐条人工复核。
|
|
127
138
|
|
|
128
|
-
### Phase
|
|
139
|
+
### Phase 6:解释同步结果
|
|
129
140
|
|
|
130
141
|
回复用户或交给后续 skill 前,应说明:
|
|
131
142
|
|
|
@@ -146,8 +157,8 @@ active 条目适合保存:
|
|
|
146
157
|
|
|
147
158
|
## Lifecycle rules
|
|
148
159
|
|
|
149
|
-
- `candidate
|
|
150
|
-
- `active
|
|
160
|
+
- `candidate`:自动抽取;高置信 + 白名单类型可由 autoPromote 提升;其余由 Agent judge 裁决或保持 candidate。
|
|
161
|
+
- `active`:autoPromote、judge promote,或显式 promote 后可用。
|
|
151
162
|
- `stale`:来源 commit 缺失、来源 commit 后相关文件变化,或当前代码无法证明旧结论仍有效。
|
|
152
163
|
- `superseded`:被后续归档/决策取代。
|
|
153
164
|
- `conflicted`:与另一条 active/candidate 知识冲突。
|
|
@@ -169,6 +180,7 @@ active 条目适合保存:
|
|
|
169
180
|
- write_active_knowledge_after_manual_confirmation
|
|
170
181
|
- write_confidence_scores
|
|
171
182
|
- auto_promote_high_confidence_knowledge_when_configured
|
|
183
|
+
- agent_judge_knowledge_lifecycle
|
|
172
184
|
- write_knowledge_index
|
|
173
185
|
- write_obsidian_views
|
|
174
186
|
|
|
@@ -206,7 +218,9 @@ powershell.exe -Command "python '<skill-dir>\scripts\harness_knowledge.py' sync
|
|
|
206
218
|
- `upToDate` 及 `reasons`(sync)或新增/覆盖条目数(ingest/promote)。
|
|
207
219
|
- 当前 `active` / `candidate` / `stale` 数量统计。
|
|
208
220
|
- 产物路径(`index.json`、`index.sqlite`、`views/`、`reports/`)。
|
|
209
|
-
-
|
|
221
|
+
- `lifecycle` 摘要:`validatorsApplied`、`candidateAutoPromoted`、`pendingAgentJudge` 等。
|
|
222
|
+
- **已处理报告**(auto + judge 后):promoted/dropped/superseded/kept/skipped 计数与 `reports/judge-decisions-*.json`、`judgements-*.json` 路径。
|
|
223
|
+
- 仅当 `upToDate=false` 时建议 `sync --update`;查询历史 → `/harness-knowledge-query`。**禁止**默认列出「请人工确认 N 条 candidate」待办。
|
|
210
224
|
|
|
211
225
|
## 渐进披露
|
|
212
226
|
|
|
@@ -10,16 +10,36 @@ description: harness-knowledge-ingest 的命令详细示例、config.json 配置
|
|
|
10
10
|
|
|
11
11
|
### Auto maintenance
|
|
12
12
|
|
|
13
|
-
如果只是想让 skill 自己完成常规知识库防腐,优先跑 `auto
|
|
13
|
+
如果只是想让 skill 自己完成常规知识库防腐,优先跑 `auto`,再执行 **Agent judge 闭环**(见下文):
|
|
14
14
|
|
|
15
15
|
```powershell
|
|
16
16
|
powershell.exe -Command "python '<skill-dir>\scripts\harness_knowledge.py' auto --project '<project-root>'"
|
|
17
17
|
```
|
|
18
18
|
|
|
19
|
-
`auto` 会按默认维护顺序执行:首建 `config.json`(若缺失)、`sync --update
|
|
19
|
+
`auto` 会按默认维护顺序执行:首建 `config.json`(若缺失)、`sync --update`、**默认写回** validator 建议、`verify`、`audit`。首次发现 `.harness/knowledge/config.json` 不存在时,会写入启用版 `autoPromote` + `activeLifecycle.autoDemote` + `knowledgeValidation.autoDemoteActive` + `judge.maxCandidatesPerRun` 配置。
|
|
20
|
+
|
|
21
|
+
关闭 validator 写回:
|
|
22
|
+
|
|
23
|
+
```powershell
|
|
24
|
+
powershell.exe -Command "python '<skill-dir>\scripts\harness_knowledge.py' auto --project '<project-root>' --no-apply-suggestions"
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### Agent judge 闭环(auto 之后)
|
|
28
|
+
|
|
29
|
+
1. `judge export`(或 maintain 产出的 pending judgements)
|
|
30
|
+
2. Agent 读 export,写 `reports/judge-decisions-<ts>.json`(schema 对齐 `judge apply`)
|
|
31
|
+
3. `judge apply --apply <decisions.json>`
|
|
32
|
+
4. 输出已处理报告,不列人工待办
|
|
33
|
+
|
|
34
|
+
**启发式**(Agent 侧,非脚本硬编码):
|
|
35
|
+
|
|
36
|
+
- **conflicted**:优先 `supersede` 较旧/较弱证据方;对称难判 → `keep-conflict` + reason
|
|
37
|
+
- **candidate**:`decision|api-contract|requirement|pitfall` 且 confidence 高 → `promote`;`implementation|test-evidence` 倾向 `drop` 或保持 candidate
|
|
38
|
+
- 超过 `judge.maxCandidatesPerRun`(默认 100)的低分 candidate:跳过,记入 `skippedCandidates`
|
|
20
39
|
|
|
21
40
|
```powershell
|
|
22
|
-
powershell.exe -Command "python '<skill-dir>\scripts\harness_knowledge.py'
|
|
41
|
+
powershell.exe -Command "python '<skill-dir>\scripts\harness_knowledge.py' judge --project '<project-root>' --export '<export.json>'"
|
|
42
|
+
powershell.exe -Command "python '<skill-dir>\scripts\harness_knowledge.py' judge --project '<project-root>' --apply '<decisions.json>'"
|
|
23
43
|
```
|
|
24
44
|
|
|
25
45
|
常用参数:
|
|
@@ -147,20 +167,25 @@ powershell.exe -Command "python '<skill-dir>\scripts\harness_knowledge.py' demot
|
|
|
147
167
|
|
|
148
168
|
`demote` 只处理人工确认后的 `active` 条目,可降级到 `stale` 或 `candidate`。降级到 `stale` 时会写入 `manual demotion` stale reason,并在后续 ingest 中保留该人工维护条目。
|
|
149
169
|
|
|
150
|
-
###
|
|
170
|
+
### activeLifecycle 与 validator auto-demotion
|
|
151
171
|
|
|
152
|
-
|
|
172
|
+
`auto` 首建的 `config.json` **默认已启用** `activeLifecycle.autoDemote` 与 `knowledgeValidation.autoDemoteActive`。已有项目不会强制覆盖。手动启用示例:
|
|
153
173
|
|
|
154
174
|
```json
|
|
155
175
|
{
|
|
156
176
|
"activeLifecycle": {
|
|
157
177
|
"autoDemote": true,
|
|
158
178
|
"targetStatus": "stale"
|
|
179
|
+
},
|
|
180
|
+
"knowledgeValidation": {
|
|
181
|
+
"enabled": true,
|
|
182
|
+
"autoDemoteActive": true,
|
|
183
|
+
"defaultTargetStatus": "stale"
|
|
159
184
|
}
|
|
160
185
|
}
|
|
161
186
|
```
|
|
162
187
|
|
|
163
|
-
启用后,ingest
|
|
188
|
+
启用后,ingest/verify 会把需复核或 validator 失败的 active 自动降级,并写入 `lifecycle` 审计字段。
|
|
164
189
|
|
|
165
190
|
### Optional confidence scoring and autoPromote
|
|
166
191
|
|
|
@@ -199,13 +224,27 @@ confidence 不是“绝对正确率”,只表示当前证据强弱。分数会
|
|
|
199
224
|
"validatorFailPenalty": 0.5,
|
|
200
225
|
"supersededPenalty": 0.8,
|
|
201
226
|
"conflictPenalty": 0.8
|
|
227
|
+
},
|
|
228
|
+
"activeLifecycle": {
|
|
229
|
+
"autoDemote": true,
|
|
230
|
+
"targetStatus": "stale"
|
|
231
|
+
},
|
|
232
|
+
"knowledgeValidation": {
|
|
233
|
+
"enabled": true,
|
|
234
|
+
"autoDemoteActive": true,
|
|
235
|
+
"defaultTargetStatus": "stale",
|
|
236
|
+
"allowCommandValidators": false,
|
|
237
|
+
"commandTimeoutSeconds": 60
|
|
238
|
+
},
|
|
239
|
+
"judge": {
|
|
240
|
+
"maxCandidatesPerRun": 100
|
|
202
241
|
}
|
|
203
242
|
}
|
|
204
243
|
```
|
|
205
244
|
|
|
206
245
|
自动提升只处理配置允许的类型,默认排除 stale/conflicted/superseded,且会写入 `lifecycle.autoPromoted=true`、`promotionNote` 和 `promotedAt`。一次性实现细节、测试证据、风险提醒仍不应自动提升为长期事实。
|
|
207
246
|
|
|
208
|
-
### Optional validator auto-demotion
|
|
247
|
+
### Optional validator auto-demotion(旧文档兼容)
|
|
209
248
|
|
|
210
249
|
默认不会因为 validator 失败自动改写 `active`。如明确希望确定性 validator 失败时自动降级 active,可在 `.harness/knowledge/config.json` 中启用:
|
|
211
250
|
|
|
@@ -307,3 +346,10 @@ powershell.exe -Command "python '<skill-dir>\scripts\harness_knowledge_mcp.py'"
|
|
|
307
346
|
- `auto` JSON 输出新增 `config` 摘要:`path`、`created`、`autoPromoteEnabled`、`appliedBy`、`candidateAutoPromoted`。
|
|
308
347
|
- `ingest` 单独命令仍不首建 config;项目策略的自动首建只发生在 `auto` 维护入口。
|
|
309
348
|
- 单测扩展到 35 个,覆盖“已有最新 index 但缺 config 时,auto 首建启用配置并立即提升”的路径。
|
|
349
|
+
|
|
350
|
+
## v1.14 补充能力(knowledge-auto-close-loop)
|
|
351
|
+
|
|
352
|
+
- `auto` **默认写回** validator 建议(`--no-apply-suggestions` 可关闭);JSON 新增 `lifecycle` 摘要。
|
|
353
|
+
- 首建 `config.json` 默认含 `activeLifecycle.autoDemote`、`knowledgeValidation.autoDemoteActive`、`judge.maxCandidatesPerRun=100`。
|
|
354
|
+
- SKILL 工作流:`auto` 后由 **Agent** 执行 `judge export` → 裁决 → `judge apply`;禁止默认输出人工待办清单。
|
|
355
|
+
- `harness-sync` 明确知识闭环主入口为 `/harness-knowledge-ingest auto`。
|