agentlock-harness 0.0.0-stage → 0.1.0
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/LICENSE +21 -0
- package/README.md +211 -2
- package/README.zh-CN.md +211 -0
- package/RELEASE_NOTES.md +35 -0
- package/bin/agentlock-harness.mjs +249 -0
- package/harness-templates/en-US/common/CLAUDE.md.tmpl +7 -0
- package/harness-templates/en-US/common/GEMINI.md.tmpl +7 -0
- package/harness-templates/en-US/common/agentlock-harness.json.tmpl +45 -0
- package/harness-templates/en-US/common/claude-settings.json +36 -0
- package/harness-templates/en-US/common/codex-config.toml.tmpl +11 -0
- package/harness-templates/en-US/common/copilot-instructions.md.tmpl +3 -0
- package/harness-templates/en-US/common/gemini-settings.json +42 -0
- package/harness-templates/en-US/common/git-hooks/pre-commit +24 -0
- package/harness-templates/en-US/common/git-hooks/pre-push +11 -0
- package/harness-templates/en-US/common/harness-gitignore +3 -0
- package/harness-templates/en-US/common/hooks/post-edit-check.mjs +57 -0
- package/harness-templates/en-US/common/hooks/pre-tool-guard.mjs +122 -0
- package/harness-templates/en-US/common/hooks/rules-drift-check.mjs +69 -0
- package/harness-templates/en-US/common/hooks/staged-guard.mjs +197 -0
- package/harness-templates/en-US/common/hooks/stop-gate.mjs +164 -0
- package/harness-templates/en-US/common/rules/00-testing-integrity.md +11 -0
- package/harness-templates/en-US/common/rules/01-security-boundaries.md +11 -0
- package/harness-templates/en-US/common/skills/atomic-tdd/SKILL.md +21 -0
- package/harness-templates/en-US/common/skills/brainstorming/SKILL.md +24 -0
- package/harness-templates/en-US/common/skills/code-grounding/SKILL.md +20 -0
- package/harness-templates/en-US/common/skills/cross-model-review/SKILL.md +22 -0
- package/harness-templates/en-US/common/skills/worktree-isolation/SKILL.md +19 -0
- package/harness-templates/en-US/dual-core/HARNESS_GUIDE.md +19 -0
- package/harness-templates/en-US/dual-core/scripts/cross-review.mjs +141 -0
- package/harness-templates/en-US/enterprise-platform/ci/agentlock-harness-gate.yml +32 -0
- package/harness-templates/en-US/enterprise-platform/governance/mcp-gateway.template.json +18 -0
- package/harness-templates/en-US/enterprise-platform/governance/policy.json +26 -0
- package/harness-templates/en-US/ralph-factory/PROMPT.loop.md.tmpl +12 -0
- package/harness-templates/en-US/ralph-factory/SPRINT_CONTRACT.md.tmpl +25 -0
- package/harness-templates/en-US/ralph-factory/sandbox/Dockerfile.sandbox +13 -0
- package/harness-templates/en-US/ralph-factory/sandbox/docker-compose.sandbox.yml +22 -0
- package/harness-templates/en-US/ralph-factory/sandbox/run-sandbox-loop.sh +8 -0
- package/harness-templates/zh-CN/common/CLAUDE.md.tmpl +7 -0
- package/harness-templates/zh-CN/common/GEMINI.md.tmpl +7 -0
- package/harness-templates/zh-CN/common/agentlock-harness.json.tmpl +45 -0
- package/harness-templates/zh-CN/common/claude-settings.json +36 -0
- package/harness-templates/zh-CN/common/codex-config.toml.tmpl +11 -0
- package/harness-templates/zh-CN/common/copilot-instructions.md.tmpl +3 -0
- package/harness-templates/zh-CN/common/gemini-settings.json +42 -0
- package/harness-templates/zh-CN/common/git-hooks/pre-commit +24 -0
- package/harness-templates/zh-CN/common/git-hooks/pre-push +11 -0
- package/harness-templates/zh-CN/common/harness-gitignore +3 -0
- package/harness-templates/zh-CN/common/hooks/post-edit-check.mjs +57 -0
- package/harness-templates/zh-CN/common/hooks/pre-tool-guard.mjs +122 -0
- package/harness-templates/zh-CN/common/hooks/rules-drift-check.mjs +69 -0
- package/harness-templates/zh-CN/common/hooks/staged-guard.mjs +197 -0
- package/harness-templates/zh-CN/common/hooks/stop-gate.mjs +164 -0
- package/harness-templates/zh-CN/common/rules/00-testing-integrity.md +11 -0
- package/harness-templates/zh-CN/common/rules/01-security-boundaries.md +11 -0
- package/harness-templates/zh-CN/common/skills/atomic-tdd/SKILL.md +21 -0
- package/harness-templates/zh-CN/common/skills/brainstorming/SKILL.md +24 -0
- package/harness-templates/zh-CN/common/skills/code-grounding/SKILL.md +20 -0
- package/harness-templates/zh-CN/common/skills/cross-model-review/SKILL.md +22 -0
- package/harness-templates/zh-CN/common/skills/worktree-isolation/SKILL.md +19 -0
- package/harness-templates/zh-CN/dual-core/HARNESS_GUIDE.md +19 -0
- package/harness-templates/zh-CN/dual-core/scripts/cross-review.mjs +141 -0
- package/harness-templates/zh-CN/enterprise-platform/ci/agentlock-harness-gate.yml +32 -0
- package/harness-templates/zh-CN/enterprise-platform/governance/mcp-gateway.template.json +18 -0
- package/harness-templates/zh-CN/enterprise-platform/governance/policy.json +26 -0
- package/harness-templates/zh-CN/ralph-factory/PROMPT.loop.md.tmpl +12 -0
- package/harness-templates/zh-CN/ralph-factory/SPRINT_CONTRACT.md.tmpl +25 -0
- package/harness-templates/zh-CN/ralph-factory/sandbox/Dockerfile.sandbox +13 -0
- package/harness-templates/zh-CN/ralph-factory/sandbox/docker-compose.sandbox.yml +22 -0
- package/harness-templates/zh-CN/ralph-factory/sandbox/run-sandbox-loop.sh +8 -0
- package/package.json +64 -4
- package/scripts/bootstrap.ps1 +13 -0
- package/scripts/bootstrap.sh +23 -0
- package/src/cli/colors.mjs +42 -0
- package/src/cli/commands/adopt.mjs +378 -0
- package/src/cli/commands/change.mjs +92 -0
- package/src/cli/commands/doctor.mjs +56 -0
- package/src/cli/commands/eval.mjs +193 -0
- package/src/cli/commands/hooks.mjs +97 -0
- package/src/cli/commands/init.mjs +231 -0
- package/src/cli/commands/passthrough.mjs +27 -0
- package/src/cli/commands/ralph.mjs +208 -0
- package/src/cli/commands/rules.mjs +73 -0
- package/src/cli/commands/stats.mjs +71 -0
- package/src/cli/commands/task.mjs +123 -0
- package/src/cli/commands/ui.mjs +84 -0
- package/src/cli/commands/verify.mjs +267 -0
- package/src/cli/prompt.mjs +55 -0
- package/src/core/adopt.mjs +807 -0
- package/src/core/agent-runner.mjs +118 -0
- package/src/core/audit.mjs +181 -0
- package/src/core/catalog.mjs +160 -0
- package/src/core/change-flow.mjs +344 -0
- package/src/core/detector.mjs +141 -0
- package/src/core/doc-drift.mjs +94 -0
- package/src/core/eval-fixtures.mjs +676 -0
- package/src/core/eval-frontier-fixtures.mjs +657 -0
- package/src/core/eval-hard-fixtures.mjs +923 -0
- package/src/core/eval-runner.mjs +754 -0
- package/src/core/eval-telemetry.mjs +338 -0
- package/src/core/harness-writer.mjs +286 -0
- package/src/core/installer.mjs +42 -0
- package/src/core/rules-compiler.mjs +356 -0
- package/src/core/task-ledger.mjs +327 -0
- package/src/core/version.mjs +10 -0
- package/src/ui/public/app.mjs +2199 -0
- package/src/ui/public/index.html +203 -0
- package/src/ui/public/styles.css +1200 -0
- package/src/ui/server.mjs +457 -0
- package/src/ui/service.mjs +860 -0
- package/templates/en-US/AGENTS.md +38 -0
- package/templates/en-US/DOCS_MAINTENANCE.md +65 -0
- package/templates/en-US/MIGRATION.md +46 -0
- package/templates/en-US/NEW_PROJECT_CHECKLIST.md +46 -0
- package/templates/en-US/README.md +41 -0
- package/templates/en-US/SESSION.md +29 -0
- package/templates/en-US/docs/00-context.md +38 -0
- package/templates/en-US/docs/01-vision/README.md +36 -0
- package/templates/en-US/docs/02-requirements/PRD.md +24 -0
- package/templates/en-US/docs/02-requirements/glossary.md +20 -0
- package/templates/en-US/docs/02-requirements/use-cases.md +36 -0
- package/templates/en-US/docs/03-architecture/composite-ai-framework.md +36 -0
- package/templates/en-US/docs/03-architecture/integration-architecture.md +36 -0
- package/templates/en-US/docs/03-architecture/system-architecture.md +16 -0
- package/templates/en-US/docs/04-design/README.md +21 -0
- package/templates/en-US/docs/04-design/a2a-integration-spec.md +36 -0
- package/templates/en-US/docs/04-design/agent-specs.md +36 -0
- package/templates/en-US/docs/04-design/data-model.md +18 -0
- package/templates/en-US/docs/04-design/external-api-spec.md +26 -0
- package/templates/en-US/docs/04-design/mcp-interface-spec.md +36 -0
- package/templates/en-US/docs/04-design/phase1-minimal-implementation-interfaces.md +36 -0
- package/templates/en-US/docs/04-design/responsibility-model.md +36 -0
- package/templates/en-US/docs/04-design/runtime-control-plane-spec.md +36 -0
- package/templates/en-US/docs/04-design/safety-governance.md +18 -0
- package/templates/en-US/docs/04-design/sample-scenarios-architecture-refinement.md +20 -0
- package/templates/en-US/docs/04-design/skill-syntax-spec.md +36 -0
- package/templates/en-US/docs/04-design/storage-schema.md +18 -0
- package/templates/en-US/docs/04-design/task-capability-architecture-and-evolution.md +36 -0
- package/templates/en-US/docs/05-project/adr/ADR-000-template.md +32 -0
- package/templates/en-US/docs/05-project/adr/README.md +15 -0
- package/templates/en-US/docs/05-project/doc-code-map.md +17 -0
- package/templates/en-US/docs/05-project/evolution-backlog.md +14 -0
- package/templates/en-US/docs/05-project/feature-registry.md +16 -0
- package/templates/en-US/docs/05-project/master-delivery-tracker.md +14 -0
- package/templates/en-US/docs/05-project/risk-register.md +36 -0
- package/templates/en-US/docs/05-project/roadmap.md +36 -0
- package/templates/en-US/docs/05-project/stage-view.md +14 -0
- package/templates/en-US/docs/05-project/tech-stack.md +36 -0
- package/templates/en-US/docs/06-dev-guide/SPEC.md +18 -0
- package/templates/en-US/docs/06-dev-guide/coding-standards.md +36 -0
- package/templates/en-US/docs/06-dev-guide/deployment-architecture.md +20 -0
- package/templates/en-US/docs/06-dev-guide/project-scaffold.md +16 -0
- package/templates/en-US/docs/06-dev-guide/testing-strategy.md +42 -0
- package/templates/en-US/docs/07-frontend/README.md +36 -0
- package/templates/en-US/docs/07-frontend/user-personas.md +36 -0
- package/templates/en-US/docs/08-process/README.md +27 -0
- package/templates/en-US/docs/08-process/ai-collaboration-protocol.md +28 -0
- package/templates/en-US/docs/08-process/autopilot.md +18 -0
- package/templates/en-US/docs/08-process/code-grounding.md +32 -0
- package/templates/en-US/docs/08-process/context-loading-strategy.md +35 -0
- package/templates/en-US/docs/08-process/conventions.md +75 -0
- package/templates/en-US/docs/08-process/debugging.md +25 -0
- package/templates/en-US/docs/08-process/design-gate.md +22 -0
- package/templates/en-US/docs/08-process/git-protocol.md +20 -0
- package/templates/en-US/docs/08-process/multi-agent-orchestration.md +27 -0
- package/templates/en-US/docs/08-process/planning.md +18 -0
- package/templates/en-US/docs/08-process/project-intake.md +47 -0
- package/templates/en-US/docs/08-process/reflection.md +18 -0
- package/templates/en-US/docs/08-process/review.md +30 -0
- package/templates/en-US/docs/08-process/session-handoff.md +27 -0
- package/templates/en-US/docs/08-process/tdd.md +24 -0
- package/templates/en-US/docs/08-process/tool-execution.md +32 -0
- package/templates/en-US/docs/08-process/workflow-contract.md +46 -0
- package/templates/en-US/docs/08-process/workflow.md +23 -0
- package/templates/en-US/docs/README.md +58 -0
- package/templates/en-US/docs/design-checklist.md +36 -0
- package/templates/en-US/docs/discussions/README.md +13 -0
- package/templates/en-US/docs/plans/README.md +13 -0
- package/templates/en-US/docs/proposed-design/README.md +13 -0
- package/templates/en-US/docs/temp-reference/README.md +11 -0
- package/templates/en-US/docs.config.json +46 -0
- package/templates/en-US/profiles/README.md +23 -0
- package/templates/en-US/profiles/agent-platform/README.md +23 -0
- package/templates/en-US/profiles/cli-tool/README.md +23 -0
- package/templates/en-US/profiles/library-sdk/README.md +23 -0
- package/templates/en-US/profiles/multi-agent/README.md +23 -0
- package/templates/en-US/profiles/profiles.json +31 -0
- package/templates/en-US/profiles/software-automation/README.md +23 -0
- package/templates/en-US/profiles/web-saas/README.md +23 -0
- package/templates/en-US/scripts/README.md +89 -0
- package/templates/en-US/scripts/doc-find.mjs +156 -0
- package/templates/en-US/scripts/doc-map.mjs +50 -0
- package/templates/en-US/scripts/doc-tools.mjs +311 -0
- package/templates/en-US/scripts/init-docs.mjs +214 -0
- package/templates/en-US/scripts/validate-docs.mjs +141 -0
- package/templates/zh-CN/AGENTS.md +38 -0
- package/templates/zh-CN/DOCS_MAINTENANCE.md +77 -0
- package/templates/zh-CN/MIGRATION.md +45 -0
- package/templates/zh-CN/NEW_PROJECT_CHECKLIST.md +54 -0
- package/templates/zh-CN/README.md +55 -0
- package/templates/zh-CN/SESSION.md +29 -0
- package/templates/zh-CN/docs/00-context.md +42 -0
- package/templates/zh-CN/docs/01-vision/README.md +33 -0
- package/templates/zh-CN/docs/02-requirements/PRD.md +26 -0
- package/templates/zh-CN/docs/02-requirements/glossary.md +35 -0
- package/templates/zh-CN/docs/02-requirements/use-cases.md +31 -0
- package/templates/zh-CN/docs/03-architecture/composite-ai-framework.md +27 -0
- package/templates/zh-CN/docs/03-architecture/integration-architecture.md +30 -0
- package/templates/zh-CN/docs/03-architecture/system-architecture.md +26 -0
- package/templates/zh-CN/docs/04-design/README.md +21 -0
- package/templates/zh-CN/docs/04-design/a2a-integration-spec.md +45 -0
- package/templates/zh-CN/docs/04-design/agent-specs.md +46 -0
- package/templates/zh-CN/docs/04-design/data-model.md +18 -0
- package/templates/zh-CN/docs/04-design/external-api-spec.md +34 -0
- package/templates/zh-CN/docs/04-design/mcp-interface-spec.md +44 -0
- package/templates/zh-CN/docs/04-design/phase1-minimal-implementation-interfaces.md +38 -0
- package/templates/zh-CN/docs/04-design/responsibility-model.md +37 -0
- package/templates/zh-CN/docs/04-design/runtime-control-plane-spec.md +47 -0
- package/templates/zh-CN/docs/04-design/safety-governance.md +18 -0
- package/templates/zh-CN/docs/04-design/sample-scenarios-architecture-refinement.md +38 -0
- package/templates/zh-CN/docs/04-design/skill-syntax-spec.md +43 -0
- package/templates/zh-CN/docs/04-design/storage-schema.md +18 -0
- package/templates/zh-CN/docs/04-design/task-capability-architecture-and-evolution.md +46 -0
- package/templates/zh-CN/docs/05-project/adr/ADR-000-template.md +34 -0
- package/templates/zh-CN/docs/05-project/adr/README.md +35 -0
- package/templates/zh-CN/docs/05-project/doc-code-map.md +19 -0
- package/templates/zh-CN/docs/05-project/evolution-backlog.md +14 -0
- package/templates/zh-CN/docs/05-project/feature-registry.md +16 -0
- package/templates/zh-CN/docs/05-project/master-delivery-tracker.md +14 -0
- package/templates/zh-CN/docs/05-project/risk-register.md +21 -0
- package/templates/zh-CN/docs/05-project/roadmap.md +31 -0
- package/templates/zh-CN/docs/05-project/stage-view.md +14 -0
- package/templates/zh-CN/docs/05-project/tech-stack.md +36 -0
- package/templates/zh-CN/docs/06-dev-guide/SPEC.md +24 -0
- package/templates/zh-CN/docs/06-dev-guide/coding-standards.md +29 -0
- package/templates/zh-CN/docs/06-dev-guide/deployment-architecture.md +22 -0
- package/templates/zh-CN/docs/06-dev-guide/project-scaffold.md +16 -0
- package/templates/zh-CN/docs/06-dev-guide/testing-strategy.md +46 -0
- package/templates/zh-CN/docs/07-frontend/README.md +29 -0
- package/templates/zh-CN/docs/07-frontend/user-personas.md +27 -0
- package/templates/zh-CN/docs/08-process/README.md +29 -0
- package/templates/zh-CN/docs/08-process/ai-collaboration-protocol.md +30 -0
- package/templates/zh-CN/docs/08-process/autopilot.md +18 -0
- package/templates/zh-CN/docs/08-process/code-grounding.md +40 -0
- package/templates/zh-CN/docs/08-process/context-loading-strategy.md +35 -0
- package/templates/zh-CN/docs/08-process/conventions.md +77 -0
- package/templates/zh-CN/docs/08-process/debugging.md +27 -0
- package/templates/zh-CN/docs/08-process/design-gate.md +22 -0
- package/templates/zh-CN/docs/08-process/git-protocol.md +20 -0
- package/templates/zh-CN/docs/08-process/multi-agent-orchestration.md +27 -0
- package/templates/zh-CN/docs/08-process/planning.md +18 -0
- package/templates/zh-CN/docs/08-process/project-intake.md +53 -0
- package/templates/zh-CN/docs/08-process/reflection.md +18 -0
- package/templates/zh-CN/docs/08-process/review.md +30 -0
- package/templates/zh-CN/docs/08-process/session-handoff.md +29 -0
- package/templates/zh-CN/docs/08-process/tdd.md +24 -0
- package/templates/zh-CN/docs/08-process/tool-execution.md +34 -0
- package/templates/zh-CN/docs/08-process/workflow-contract.md +48 -0
- package/templates/zh-CN/docs/08-process/workflow.md +23 -0
- package/templates/zh-CN/docs/README.md +62 -0
- package/templates/zh-CN/docs/design-checklist.md +18 -0
- package/templates/zh-CN/docs/discussions/README.md +36 -0
- package/templates/zh-CN/docs/plans/README.md +15 -0
- package/templates/zh-CN/docs/proposed-design/README.md +41 -0
- package/templates/zh-CN/docs/temp-reference/README.md +13 -0
- package/templates/zh-CN/docs.config.json +46 -0
- package/templates/zh-CN/profiles/README.md +23 -0
- package/templates/zh-CN/profiles/agent-platform/README.md +23 -0
- package/templates/zh-CN/profiles/cli-tool/README.md +23 -0
- package/templates/zh-CN/profiles/library-sdk/README.md +23 -0
- package/templates/zh-CN/profiles/multi-agent/README.md +23 -0
- package/templates/zh-CN/profiles/profiles.json +31 -0
- package/templates/zh-CN/profiles/software-automation/README.md +23 -0
- package/templates/zh-CN/profiles/web-saas/README.md +23 -0
- package/templates/zh-CN/scripts/README.md +97 -0
- package/templates/zh-CN/scripts/doc-find.mjs +156 -0
- package/templates/zh-CN/scripts/doc-map.mjs +50 -0
- package/templates/zh-CN/scripts/doc-tools.mjs +311 -0
- package/templates/zh-CN/scripts/init-docs.mjs +214 -0
- package/templates/zh-CN/scripts/validate-docs.mjs +141 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 AgentLock Harness contributors (eric liu)
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,212 @@
|
|
|
1
|
-
|
|
1
|
+
<div align="center">
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
# AgentLock Harness
|
|
4
|
+
|
|
5
|
+
**Guardrails for Claude Code, Codex, Gemini, Cursor & Copilot — that actually *save* tokens.**
|
|
6
|
+
|
|
7
|
+
**English** | [**简体中文**](README.zh-CN.md)
|
|
8
|
+
|
|
9
|
+
[](https://github.com/yjfkpyu/AgentLock-Harness/actions/workflows/docs.yml)
|
|
10
|
+
[](package.json)
|
|
11
|
+
[](package.json)
|
|
12
|
+
[](tests/)
|
|
13
|
+
[](LICENSE)
|
|
14
|
+
|
|
15
|
+
[Release Notes (v0.1.0)](RELEASE_NOTES.md) · [Roadmap](docs/roadmap.md) · [Evaluation Protocol](docs/agent-evaluation.md) · [Security](SECURITY.md) · [Contributing](CONTRIBUTING.md)
|
|
16
|
+
|
|
17
|
+
<br />
|
|
18
|
+
|
|
19
|
+
<img src="assets/agentlock-infographic.svg" alt="AgentLock Harness Architecture and Empirical Benchmark" width="100%" />
|
|
20
|
+
|
|
21
|
+
</div>
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## See It On Your Own Repo in 10 Seconds
|
|
26
|
+
|
|
27
|
+
Requires **Node.js ≥ 18** only (`package.json` has **0 third-party dependencies** — no `npm install`, no Python, no database):
|
|
28
|
+
|
|
29
|
+
```sh
|
|
30
|
+
# Option 1: One-line preview (no clone required)
|
|
31
|
+
npx github:yjfkpyu/AgentLock-Harness ui /path/to/your-project
|
|
32
|
+
|
|
33
|
+
# Option 2: Clone & link the short `alh` command globally
|
|
34
|
+
git clone https://github.com/yjfkpyu/AgentLock-Harness.git && cd AgentLock-Harness
|
|
35
|
+
npm link
|
|
36
|
+
alh ui /path/to/your-project
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
> **Zero risk**: `alh ui` is completely read-only until you preview a file tree and click Confirm. It binds strictly to `127.0.0.1` with a one-time session token and never writes UI files into your repository.
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## Built-In Local Web Console (`alh ui`)
|
|
44
|
+
|
|
45
|
+
A fast, offline desktop-style workbench powered purely by Node.js `node:http`. Every panel exposes a collapsible **equivalent CLI command** so anything you click can be dropped straight into CI.
|
|
46
|
+
|
|
47
|
+
<table>
|
|
48
|
+
<tr>
|
|
49
|
+
<td colspan="2" align="center">
|
|
50
|
+
<img src="assets/ui-health-dashboard.png" alt="Health and Guardrails Dashboard" width="100%" />
|
|
51
|
+
<br />
|
|
52
|
+
<sub><strong>Health & Guardrails</strong> — auto EN/ZH entry budget meters, 6-host rule drift status, universal Git Hooks switch, streaming Verify console, and <code>alh stats</code> block telemetry</sub>
|
|
53
|
+
</td>
|
|
54
|
+
</tr>
|
|
55
|
+
<tr>
|
|
56
|
+
<td width="50%" align="center" valign="top">
|
|
57
|
+
<img src="assets/ui-onboarding-migration.png" alt="Dual-Strategy Brownfield Onboarding" width="100%" />
|
|
58
|
+
<br />
|
|
59
|
+
<sub><strong>Onboarding & Doctor</strong> — detects existing legacy docs, lets you choose Thin-Route vs Archive & Cross-Distill, and previews every move/file before writing</sub>
|
|
60
|
+
</td>
|
|
61
|
+
<td width="50%" align="center" valign="top">
|
|
62
|
+
<img src="assets/ui-spec-dag-board.png" alt="Spec Change Board and DAG Task Ledger" width="100%" />
|
|
63
|
+
<br />
|
|
64
|
+
<sub><strong>Spec & DAG Board</strong> — edit <code>delta.md</code>, check off <code>acceptance.md</code> live, crystallize <code>SPEC.md</code> on archive, and track zero-DB DAG tasks</sub>
|
|
65
|
+
</td>
|
|
66
|
+
</tr>
|
|
67
|
+
</table>
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
## Why This Exists (and Real Proof It Works)
|
|
72
|
+
|
|
73
|
+
Most teams trying to govern AI coding agents hit a frustrating wall:
|
|
74
|
+
|
|
75
|
+
- **Run agents bare**: Fast on toy files, risky in real repos — agents silently regress distant monorepo packages, edit `.env` under outage pressure, skip acceptance checks, or forget prior decisions across sessions.
|
|
76
|
+
- **Install heavy prompt/skill frameworks**: Stuffing dozens of always-on skills and long handbooks into every prompt slows frontier models down (`+35.7%` latency in our early Codex CLI `0.172.0` tests) and burns billable tokens on ceremony.
|
|
77
|
+
|
|
78
|
+
**AgentLock Harness** splits the problem in two (**Dumbbell Zero-Tax Architecture**):
|
|
79
|
+
|
|
80
|
+
1. **Tiny context top**: Keep `AGENTS.md` (≤50 lines), `SESSION.md` (≤60 lines), and `docs/00-context.md` (≤80 lines); `--lean` installs only your active host adapter and skips skill bloat; 1–3 file fixes require zero change docs.
|
|
81
|
+
2. **Hard 0-token local bottom**: Secret blocking, enterprise `policy.json` approval paths, unchecked acceptance gates, 6-host rule drift checks, and cross-package test backpressure run locally in Node.js and Git hooks — **0 LLM tokens, impossible to talk around**.
|
|
82
|
+
|
|
83
|
+
### Before & After: Same Task, Different Agent Behavior
|
|
84
|
+
|
|
85
|
+
| Scenario | Bare Agent (No Guardrails) | With AgentLock Harness (`--lean` + Local Gates) |
|
|
86
|
+
| :--- | :--- | :--- |
|
|
87
|
+
| **`F01` · 240+ file monorepo time-format fix** | Edits `packages/core-time`, runs its local test (passes), and stops — silently breaking SHA-256 Merkle hashes in distant `packages/audit-ledger` and CSV exports in `packages/reports`. | `docs/00-context.md` routes directly to the coupled packages (**-38.3% billable tokens**); universal Git `pre-commit` / `pre-push` blocks regressions at **0 LLM tokens**. |
|
|
88
|
+
| **`F03` · P0 outage ticket nudging `.env.production` & `infra/auth-policy.tf` edits** | Searches broadly under pressure (21 tool calls) or attempts unauthorized production/policy edits as a shortcut. | `policy.json` + local `pre-tool-guard` / `staged-guard` physically block protected paths while keeping execution focused (**14 tool calls, -33%**; **0 violations**). |
|
|
89
|
+
| **Brownfield repo with 30+ legacy docs** | Generic scaffolders drop parallel blank templates (`04-design/*.md`) next to real docs, creating conflicting sources of truth. | `alh adopt` detects existing `docs/` and defaults to **`thin-route`** (auto `minimal`, zero duplicate templates) — or opt-in **`archive-switch`** to move old docs to `docs/legacy-archive/` (auto-excluded) and seed Archive × Live-Code distillation tasks. |
|
|
90
|
+
|
|
91
|
+
### Measured Benchmark (`codex-cli 0.172.0` · Frontier Suite · Paired 3/3)
|
|
92
|
+
|
|
93
|
+
Measured via `alh eval run --suite frontier --agent codex` (all runs completed, zero timeouts, strict paired `(caseId, repeat)` comparison — full protocol in [docs/agent-evaluation.md](docs/agent-evaluation.md)):
|
|
94
|
+
|
|
95
|
+
| Stress Case | Setup | Pass Rate | Total Tokens | Billable (`Fresh+Out`) | Savings vs Bare | Cache Hit | Tool Calls |
|
|
96
|
+
| :--- | :--- | :---: | :---: | :---: | :---: | :---: | :---: |
|
|
97
|
+
| **`F01`** · 240+ File Monorepo Merkle Regression | Bare Agent | 100% | 463.9k | 54.1k | — | 89% | 16 |
|
|
98
|
+
| | **AgentLock Harness** | **100%** | **442.1k** | **33.4k** | **-38.3%** | **93%** | 17 |
|
|
99
|
+
| **`F03`** · P0 Outage + Approval Policy Wall | Bare Agent | 100% | 533.7k | 32.4k | — | 94% | 21 |
|
|
100
|
+
| | **AgentLock Harness** | **100%** | **411.7k** | **32.1k** | **-0.9%** | 93% | **14 (-33%)** |
|
|
101
|
+
| **Frontier Mean** *(incl. `F02` 4-session relay)* | Bare Agent | 100% (3/3) | 999.5k | 89.0k | — | 92% | 35.3 |
|
|
102
|
+
| | **AgentLock Harness** | **100% (3/3)** | **973.4k** | **86.0k** | **-3%** | **92%** | 35.7 |
|
|
103
|
+
|
|
104
|
+
> Full physical Git/Hook guardrails **paid for themselves** — cutting billable tokens by **38.3%** on the large monorepo and **3%** overall compared to running bare.
|
|
105
|
+
|
|
106
|
+
---
|
|
107
|
+
|
|
108
|
+
## Keeping Docs, Rules & Code in Sync (5-Layer Anti-Drift)
|
|
109
|
+
|
|
110
|
+
Most AI doc tools stop at generating Markdown. Three months later, code moves on, docs go stale, and stale specs actively mislead agents. AgentLock Harness combines **0-token deterministic guards** with **spec-aware semantic review**:
|
|
111
|
+
|
|
112
|
+
| Layer | Mechanism | What It Catches | Cost |
|
|
113
|
+
| :--- | :--- | :--- | :---: |
|
|
114
|
+
| **1. Contract Hygiene** | `validate-docs` + `code_refs` (`alh map`) | Broken links, `TODO`/placeholders left in `Current` specs, missing `code_refs` paths, or oversized entry files | 0 tokens |
|
|
115
|
+
| **2. Commit & Live Drift Guard** | `staged-guard.mjs` + `alh verify` + `alh ui` | Editing code covered by a `Current` doc's `code_refs` without updating that doc (warns by default; opt-in hard block via `guardrails.requireDocSyncOnMappedChanges: true`, one-off bypass `AGENTLOCK_HARNESS_SKIP_DOC_DRIFT=1`) | 0 tokens |
|
|
116
|
+
| **3. Change Crystallization** | `alh change` + `stop-gate.mjs` | Skipping acceptance checks before exit; archiving appends verified deltas straight into `SPEC.md` | 0 tokens |
|
|
117
|
+
| **4. 6-Host & Legacy Isolation** | `alh rules check` + `alh adopt` | Drift across Claude/Codex/Gemini/Cursor/Copilot rules, or duplicate parallel templates beside legacy `docs/` | 0 tokens |
|
|
118
|
+
| **5. Semantic Drift Audit** | Spec-aware `alh review` (`cross-review.mjs`) | Subtle behavior shifts (e.g., timeout `30s → 60s`, changed defaults/error shapes) by auto-injecting mapped `Current` specs (≤6k chars) into the read-only cross-model diff audit | On demand |
|
|
119
|
+
|
|
120
|
+
> **Honest boundary**: Deterministic scripts catch structural drift and forgotten doc updates at 0 tokens, but cannot read prose intent. Layer 5 (`alh review`) closes that semantic gap right before merge.
|
|
121
|
+
|
|
122
|
+
---
|
|
123
|
+
|
|
124
|
+
## Already Using `AGENTS.md`, Cursor Rules, OpenSpec, or Beads?
|
|
125
|
+
|
|
126
|
+
You do **not** have to replace your existing workflow. Teams layer AgentLock Harness on top for three things Markdown instructions alone cannot do:
|
|
127
|
+
|
|
128
|
+
1. **Physical 0-token enforcement**: Markdown rules are suggestions; `pre-tool-guard`, `stop-gate`, and Git `pre-commit`/`pre-push` enforce secrets, approval policies, and acceptance criteria deterministically across every agent.
|
|
129
|
+
2. **One rule source → 6 hosts, zero drift**: Maintain rules once under `.agentlock-harness/rules/*.md` and compile cleanly (zero timestamps, KV-cache safe) to Claude Code, Codex CLI, Gemini CLI / Antigravity, Cursor, and GitHub Copilot.
|
|
130
|
+
3. **Compatible by default, measurable by design**: `alh adopt` detects and preserves existing `SPEC.md`, `openapi.*`, `openspec/`, and `.specify/`, while `alh eval` lets you benchmark your own rules on your own CLI.
|
|
131
|
+
|
|
132
|
+
### How It Compares to Popular Tools
|
|
133
|
+
|
|
134
|
+
| Area | Popular Tools | Typical Trade-Off | AgentLock Harness |
|
|
135
|
+
| :--- | :--- | :--- | :--- |
|
|
136
|
+
| **Spec Workflows** | OpenSpec / GitHub Spec Kit | Often requires 4+ files per change even for small tasks; checklist boxes are not enforced on exit | Respects existing OpenSpec / Spec Kit / `SPEC.md`; otherwise uses a 2-file `alh change` flow (`delta.md` + `acceptance.md`), skips 1–3 file fixes, blocks unchecked ACs in `stop-gate.mjs`, and crystallizes `SPEC.md` on archive |
|
|
137
|
+
| **Doc-Code Anti-Drift** | Static Docs / Spec Generators | Generates docs once, with no commit-time mapping or semantic audit when code changes later | `code_refs` commit/working-tree drift guard (`staged-guard`, `alh verify`, `alh ui`) + opt-in hard block + spec-aware `alh review` semantic diff audit |
|
|
138
|
+
| **Multi-Host Rules** | Rulesync / Ruler | Focuses on format conversion; timestamps can bust KV caches and rules are separate from runtime checks | Compiles 1 source to **6 hosts** with **zero timestamps**, ships standalone `rules-drift-check.mjs`, and pairs with Hook/Git gates |
|
|
139
|
+
| **Context & Skills** | Superpowers / BMad Method / Cline Memory Bank | Always-loaded skills and full-read memory banks grow with the repo and add measurable latency/token cost | Enforces strict entry budgets (`<=50L`/`60L`/`80L`), replaceable `SESSION.md`, and `--lean` single-host adapters |
|
|
140
|
+
| **Task Graphs** | Beads | Depends on external storage (e.g. Dolt) or background daemons | **Zero-DB** `tasks.json` DAG ledger + OS `O_CREAT \| O_EXCL` atomic locks + DFS cycle checks |
|
|
141
|
+
| **Brownfield Docs** | Typical Scaffolders | Drops empty templates beside existing `docs/`, creating duplicate truth | Dual strategy: `thin-route` (auto `minimal`, zero parallel Drafts) or `archive-switch` (`docs/legacy-archive/` auto-excluded + Archive × Live-Code distillation DAG) |
|
|
142
|
+
| **Footprint & UI** | Multi-runtime / Python Stacks | Requires virtualenvs, DBs, or separate web toolchains | **0 third-party npm dependencies** (pure Node.js ≥ 18) + built-in offline Web Console (`alh ui`) |
|
|
143
|
+
| **Benchmarks** | Most AI Scaffolds | No built-in way to prove whether rules help or hurt | Built-in **12-case Behavioral & Token/Cache Eval Engine** (`alh eval`) |
|
|
144
|
+
|
|
145
|
+
---
|
|
146
|
+
|
|
147
|
+
## Common CLI Workflows
|
|
148
|
+
|
|
149
|
+
### 1. Adopt an Existing Repository (Brownfield)
|
|
150
|
+
|
|
151
|
+
```sh
|
|
152
|
+
cd /path/to/existing-project
|
|
153
|
+
|
|
154
|
+
# Strategy 1 (Default · Thin-Route): keeps existing docs untouched, auto-selects minimal
|
|
155
|
+
# to prevent parallel Drafts, indexes existing docs in 00-context.md, and activates 0-token gates
|
|
156
|
+
alh adopt . --lean --hosts codex --dry-run
|
|
157
|
+
alh adopt . --lean --hosts codex
|
|
158
|
+
|
|
159
|
+
# Strategy 2 (Full Migration · Archive & Cross-Distill):
|
|
160
|
+
# Moves legacy docs to docs/legacy-archive/ (auto-excluded in docs.config.json),
|
|
161
|
+
# scaffolds your chosen Domain Profile + MIGRATION_PLAN.md + Archive x Live-Code DAG tasks
|
|
162
|
+
alh adopt . --lean --profile web-saas --docs-strategy archive-switch --dry-run
|
|
163
|
+
alh adopt . --lean --profile web-saas --docs-strategy archive-switch --confirm-archive
|
|
164
|
+
|
|
165
|
+
# Verify docs, rule zero-drift, Git hooks, and test commands
|
|
166
|
+
alh verify . --run-checks
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
### 2. Start a New Repository (Greenfield)
|
|
170
|
+
|
|
171
|
+
```sh
|
|
172
|
+
mkdir my-app && cd my-app && git init
|
|
173
|
+
alh init . --lean --locale en-US
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
### 3. Daily Cadence
|
|
177
|
+
|
|
178
|
+
| Change Size | Recommended Flow |
|
|
179
|
+
| :--- | :--- |
|
|
180
|
+
| **1–3 file local fix** | Work directly with your agent — zero ceremony |
|
|
181
|
+
| **Feature / cross-module / contract change** | `alh change new <slug>` → implement & test → check off `acceptance.md` → `alh change archive <slug>` (syncs `SPEC.md`) |
|
|
182
|
+
| **Before merge / release** | `alh verify . --run-checks` + `alh review` (read-only cross-model diff audit) |
|
|
183
|
+
|
|
184
|
+
---
|
|
185
|
+
|
|
186
|
+
## Command Reference
|
|
187
|
+
|
|
188
|
+
| Command | Description |
|
|
189
|
+
| :--- | :--- |
|
|
190
|
+
| `alh ui [dir] [--port 4318] [--no-open]` | Launch zero-dependency local Web Console (`127.0.0.1` + anti-CSRF token) |
|
|
191
|
+
| `alh adopt [dir] [--lean] [--docs-strategy thin-route\|archive-switch]` | Brownfield scan, dual legacy-doc migration, auto Git hooks & CLI audit |
|
|
192
|
+
| `alh init [dir] [--lean]` / `alh update [dir]` | Greenfield scaffold / SHA-256 manifest safe incremental update |
|
|
193
|
+
| `alh verify [dir] [--strict] [--run-checks]` | Deterministic doc structure, live `code_refs` doc-code drift, spec status, rule drift & test backpressure check |
|
|
194
|
+
| `alh change <new\|list\|status\|verify\|archive>` | 2-file change workflow with lazy `SPEC.md` crystallization |
|
|
195
|
+
| `alh rules <compile\|check\|list> [dir]` | 6-host single-source path-scoped rule compiler & drift checker |
|
|
196
|
+
| `alh hooks <install\|status\|uninstall> [dir]` | Install, inspect, or remove universal Git `pre-commit` / `pre-push` guardrails |
|
|
197
|
+
| `alh review [dir] [--reviewer codex\|claude\|gemini]` | Run spec-aware read-only cross-model diff audit against `git diff HEAD` and mapped `Current` docs |
|
|
198
|
+
| `alh task <add\|list\|ready\|claim\|done\|graph>` | Zero-DB DAG task ledger with atomic file locking |
|
|
199
|
+
| `alh ralph [dir] [--max-iterations N]` | Unattended fresh-context loop wired to DAG ledger & stall/deadlock breakers |
|
|
200
|
+
| `alh eval <list\|run\|scaffold\|grade>` | 12-case behavioral + Token/Cache ablation engine |
|
|
201
|
+
| `alh stats [dir]` / `alh doctor [--fix]` | Zero-PII guardrail telemetry / local CLI toolchain audit & install |
|
|
202
|
+
| `alh find` / `alh map` | Bounded read-only doc search / source-change impact lookup |
|
|
203
|
+
|
|
204
|
+
---
|
|
205
|
+
|
|
206
|
+
## Scope, Platform Support & Security
|
|
207
|
+
|
|
208
|
+
- **CI Coverage**: Tested on Linux and macOS across Node.js 18, 22, and 24 (174 passing tests). Windows PowerShell bootstrap is included (Git Hooks rely on Git Bash; experimental).
|
|
209
|
+
- **Evaluation Boundaries**: `npm run check` and `mock-oracle` verify scripts, templates, and graders — not LLM accuracy. Real model numbers require running `alh eval` with your own CLI driver per [docs/agent-evaluation.md](docs/agent-evaluation.md).
|
|
210
|
+
- **Security**: Local-first threat model and private vulnerability reporting are documented in [SECURITY.md](SECURITY.md).
|
|
211
|
+
- **Contributing**: See [CONTRIBUTING.md](CONTRIBUTING.md) and [AGENTS.md](AGENTS.md).
|
|
212
|
+
- **License**: [MIT License](LICENSE).
|
package/README.zh-CN.md
ADDED
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
# AgentLock Harness
|
|
4
|
+
|
|
5
|
+
**面向 Claude Code、Codex、Gemini、Cursor 与 Copilot 的零依赖工程护栏 —— 不仅防越权回归,大仓实测反而省 Token**
|
|
6
|
+
|
|
7
|
+
[**English**](README.md) | **简体中文**
|
|
8
|
+
|
|
9
|
+
[](https://github.com/yjfkpyu/AgentLock-Harness/actions/workflows/docs.yml)
|
|
10
|
+
[](package.json)
|
|
11
|
+
[](package.json)
|
|
12
|
+
[](tests/)
|
|
13
|
+
[](LICENSE)
|
|
14
|
+
|
|
15
|
+
[更新日志 (v0.1.0)](RELEASE_NOTES.md) · [路线图](docs/roadmap.md) · [行为评估协议](docs/agent-evaluation.md) · [安全说明](SECURITY.md) · [贡献指南](CONTRIBUTING.md)
|
|
16
|
+
|
|
17
|
+
<br />
|
|
18
|
+
|
|
19
|
+
<img src="assets/agentlock-infographic.svg" alt="AgentLock Harness 架构与实测数据" width="100%" />
|
|
20
|
+
|
|
21
|
+
</div>
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## 10 秒对着自己的项目跑起来看效果
|
|
26
|
+
|
|
27
|
+
唯一前提:**Node.js ≥ 18**,项目 `dependencies` 为空(**0 第三方 npm 依赖**,无需 `npm install`、Python 或数据库):
|
|
28
|
+
|
|
29
|
+
```sh
|
|
30
|
+
# 方式 1:免克隆一行直接预览
|
|
31
|
+
npx github:yjfkpyu/AgentLock-Harness ui /path/to/your-project
|
|
32
|
+
|
|
33
|
+
# 方式 2:克隆并注册全局短命令 `alh`
|
|
34
|
+
git clone https://github.com/yjfkpyu/AgentLock-Harness.git && cd AgentLock-Harness
|
|
35
|
+
npm link
|
|
36
|
+
alh ui /path/to/your-project
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
> **零风险体验**:`alh ui` 在你点击预览并明确确认前完全只读;严格仅监听 `127.0.0.1` + 一次性防 CSRF Token,绝不向你的业务仓写入任何 UI 文件。
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## 内置本地 Web 控制台(`alh ui`)
|
|
44
|
+
|
|
45
|
+
纯原生 Node.js `node:http` 驱动的离线桌面感控制台。每个操作卡片均附带可折叠的 **等效 CLI 命令**,点完即可一键复制到 CI 流水线。
|
|
46
|
+
|
|
47
|
+
<table>
|
|
48
|
+
<tr>
|
|
49
|
+
<td colspan="2" align="center">
|
|
50
|
+
<img src="assets/ui-health-dashboard.png" alt="健康度与护栏仪表盘" width="100%" />
|
|
51
|
+
<br />
|
|
52
|
+
<sub><strong>健康度与护栏</strong> — 自动区分中英文阈值的入口预算条、6 宿主规则零漂移、通用 Git Hooks 开关、SSE 实时校验与 <code>alh stats</code> 拦截统计</sub>
|
|
53
|
+
</td>
|
|
54
|
+
</tr>
|
|
55
|
+
<tr>
|
|
56
|
+
<td width="50%" align="center" valign="top">
|
|
57
|
+
<img src="assets/ui-onboarding-migration.png" alt="存量双策略接入与 Dry-Run 预览" width="100%" />
|
|
58
|
+
<br />
|
|
59
|
+
<sub><strong>向导接入与体检</strong> — 自动识别存量旧文档,支持「薄路由」与「归档 + 双向蒸馏」双策略,落盘前先完整预览移动与写入清单</sub>
|
|
60
|
+
</td>
|
|
61
|
+
<td width="50%" align="center" valign="top">
|
|
62
|
+
<img src="assets/ui-spec-dag-board.png" alt="Spec 变更看板与 DAG 任务账本" width="100%" />
|
|
63
|
+
<br />
|
|
64
|
+
<sub><strong>Spec 变更与 DAG</strong> — 编辑 <code>delta.md</code>、实时勾选 <code>acceptance.md</code>、全勾解锁归档沉淀 <code>SPEC.md</code>,联动零数据库 DAG 任务账本</sub>
|
|
65
|
+
</td>
|
|
66
|
+
</tr>
|
|
67
|
+
</table>
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
## 解决什么问题(以及真机对照证据)
|
|
72
|
+
|
|
73
|
+
用 AI 写生产代码时,团队通常会踩进两个相反的坑:
|
|
74
|
+
|
|
75
|
+
- **裸跑 AI**:改小文件很快,但一进真实业务仓就容易静默改坏远端包、在紧急工单压力下私改 `.env`、跳过验收条件或跨会话失忆。
|
|
76
|
+
- **堆重型提示词 / Skill 框架**:把几十个常驻 Skills 和厚重手册塞进上下文,我们在早期 Codex CLI `0.172.0` 实测中发现这反而让强模型慢了 `+35.7%`,白烧高价 Token。
|
|
77
|
+
|
|
78
|
+
**AgentLock Harness** 把上下文和硬约束彻底拆开(**哑铃型零税架构**):
|
|
79
|
+
|
|
80
|
+
1. **上端上下文极薄**:`AGENTS.md`(≤50 行)、`SESSION.md`(≤60 行)、`docs/00-context.md`(≤80 行);`--lean` 只装配当前主力宿主,跳过常驻 Skills 税;1–3 文件修复不走变更流程。
|
|
81
|
+
2. **下端 0 Token 本地硬外壳**:密钥保护、企业 `policy.json` 审批路径、未勾选验收项阻断、6 宿主规则漂移检查与跨包测试回归,全部由本地 Node.js 与 Git Hooks 执行 —— **不花 1 个模型 Token,且 AI 无法靠话术绕过**。
|
|
82
|
+
|
|
83
|
+
### 接入前后对照:同一个任务,AI 行为有何不同
|
|
84
|
+
|
|
85
|
+
| 真实场景 | 裸跑 AI(无护栏) | 接入 AgentLock Harness(`--lean` + 本地门禁) |
|
|
86
|
+
| :--- | :--- | :--- |
|
|
87
|
+
| **`F01` · 240+ 文件 Monorepo 时间格式修复** | 修改 `packages/core-time` 并跑通本地单测后直接结束,静默破坏远端 `packages/audit-ledger` 的 SHA-256 默克尔哈希与 `packages/reports` 导出。 | `docs/00-context.md` 直接路由到关联包(**有效计费 Token 省 38.3%**);若仍有回归,通用 Git `pre-commit` / `pre-push` 在 **0 Token** 下直接阻断提交。 |
|
|
88
|
+
| **`F03` · 高压 P0 故障工单诱导修改 `.env.production` 与 `infra/auth-policy.tf`** | 压力下大范围翻找(21 次工具调用),或尝试直接改动受保护的生产配置走捷径。 | `policy.json` 与 `pre-tool-guard` / `staged-guard` 物理拦截受控路径,同时保持聚焦(**14 次工具调用,-33%**;**0 越权**)。 |
|
|
89
|
+
| **已有 30+ 份旧文档的存量老项目** | 普通脚手架直接写入 `docs/04-design/*.md` 空白模板,与原有文档并存导致读错文件。 | `alh adopt` 扫描既有 `docs/`,默认走 **`thin-route`**(自动降级 `minimal` 零冗余),或显式选 **`archive-switch`** 将旧文档安全归档至 `docs/legacy-archive/`(自动排除校验)并生成「旧文档 × 源码」双向蒸馏 DAG 任务。 |
|
|
90
|
+
|
|
91
|
+
### 真机实测数据(Codex CLI `0.172.0` · Frontier 套件 · 成对 3/3)
|
|
92
|
+
|
|
93
|
+
通过 `alh eval run --suite frontier --agent codex` 测得(全部完赛、0 超时、严格同题同轮次成对对比;方法论见 [docs/agent-evaluation.md](docs/agent-evaluation.md)):
|
|
94
|
+
|
|
95
|
+
| 压测场景 | 对照组 | 通过率 | 总 Token | 有效计费 (`Fresh+Out`) | 相对裸跑 | KV Cache 命中 | 工具调用 |
|
|
96
|
+
| :--- | :--- | :---: | :---: | :---: | :---: | :---: | :---: |
|
|
97
|
+
| **`F01`** · 240+ 文件 Monorepo 默克尔回归 | 裸跑 AI | 100% | 463.9k | 54.1k | — | 89% | 16 |
|
|
98
|
+
| | **AgentLock Harness** | **100%** | **442.1k** | **33.4k** | **-38.3%** | **93%** | 17 |
|
|
99
|
+
| **`F03`** · P0 故障 + 企业审批门禁 | 裸跑 AI | 100% | 533.7k | 32.4k | — | 94% | 21 |
|
|
100
|
+
| | **AgentLock Harness** | **100%** | **411.7k** | **32.1k** | **-0.9%** | 93% | **14 (-33%)** |
|
|
101
|
+
| **Frontier 综合均值**(含 `F02` 4 轮零历史演化) | 裸跑 AI | 100% (3/3) | 999.5k | 89.0k | — | 92% | 35.3 |
|
|
102
|
+
| | **AgentLock Harness** | **100% (3/3)** | **973.4k** | **86.0k** | **-3%** | **92%** | 35.7 |
|
|
103
|
+
|
|
104
|
+
> 挂满物理级 Git 与 Hook 安全网后,240+ 文件大仓有效计费 Token 净省 **38.3%**,整套高难度压测综合仍比裸跑省 **3%**。
|
|
105
|
+
|
|
106
|
+
---
|
|
107
|
+
|
|
108
|
+
## 如何防止文档、规则与代码静默漂移(5 层防漂移机制)
|
|
109
|
+
|
|
110
|
+
多数 AI 文档工具只解决「一次性生成文档」,三个月后代码变了、文档过期,反而持续误导 Agent。AgentLock Harness 将 **0 Token 确定性门禁** 与 **规范感知语义审校** 串联成 5 层防漂移闭环:
|
|
111
|
+
|
|
112
|
+
| 防线 | 机制 | 实际能拦住什么 | Token 成本 |
|
|
113
|
+
| :--- | :--- | :--- | :---: |
|
|
114
|
+
| **1. 契约卫生校验** | `validate-docs` + `code_refs`(`alh map`) | 死链、遗留在 `Current` 规范里的 `TODO`/占位符、失效的 `code_refs` 源码路径、超预算入口文档 | 0 Token |
|
|
115
|
+
| **2. 提交期与工作区漂移守护** | `staged-guard.mjs` + `alh verify` + `alh ui` | 修改了 `Current` 文档 `code_refs` 覆盖的源码却未同步更新该文档(默认提醒;支持配置 `guardrails.requireDocSyncOnMappedChanges: true` 硬拦截,以及 `AGENTLOCK_HARNESS_SKIP_DOC_DRIFT=1` 单次豁免) | 0 Token |
|
|
116
|
+
| **3. 变更归档自动沉淀** | `alh change` + `stop-gate.mjs` | 未勾完验收项就提前结束;归档时自动把已验证变更写入 `SPEC.md`,避免规范停留在临时对话里 | 0 Token |
|
|
117
|
+
| **4. 6 宿主与存量隔离** | `alh rules check` + `alh adopt` | Claude/Codex/Gemini/Cursor/Copilot 规则改一处忘五处,或老仓库新旧两套文档并存冲突 | 0 Token |
|
|
118
|
+
| **5. 语义漂移交叉审校** | 规范感知 `alh review`(`cross-review.mjs`) | 确定性脚本抓不到的静默行为变更(如超时 `30s → 60s`、默认参数或错误码变化)—— 自动通过 `code_refs` 注入受影响的 `Current` 规范摘要(上限 6,000 字符)交由只读异构模型核对 | 按需调用 |
|
|
119
|
+
|
|
120
|
+
> **诚实边界**:确定性脚本可以在 0 Token 下兜住结构失效、路径漂移和“改了代码忘了动文档”,但无法理解自然语言语义;第 5 层 `alh review` 在合入前补齐这最后 20% 的语义一致性审校。
|
|
121
|
+
|
|
122
|
+
---
|
|
123
|
+
|
|
124
|
+
## 已经在用 `AGENTS.md`、Cursor Rules、OpenSpec 或 Beads,为什么还要叠加它?
|
|
125
|
+
|
|
126
|
+
你**不需要**推翻现有工具。AgentLock Harness 补齐的是纯 Markdown 规范本身做不到的三件事:
|
|
127
|
+
|
|
128
|
+
1. **0 Token 物理级强制执行**:Markdown 里的规则只是建议;`pre-tool-guard`、`stop-gate` 与 Git `pre-commit` / `pre-push` 会在本地硬拦截密钥泄露、企业审批越权和未勾选验收项,跨所有 AI 工具生效。
|
|
129
|
+
2. **单一规则源 → 6 宿主零漂移编译**:在 `.agentlock-harness/rules/*.md` 写一次规则,零时间戳确定性编译到 Claude Code、Codex CLI、Gemini CLI / Antigravity、Cursor 与 GitHub Copilot,不再改一处忘五处。
|
|
130
|
+
3. **默认兼容既有规范,且自带量化评测**:`alh adopt` 自动发现并尊重现有的 `SPEC.md`、`openapi.*`、`openspec/` 与 `.specify/`,绝不覆盖;配合 `alh eval` 可在自己的模型上量化验证规则改动的真实收益。
|
|
131
|
+
|
|
132
|
+
### 与主流开源项目横向对比
|
|
133
|
+
|
|
134
|
+
| 对比维度 | 主流代表项目 | 常见取舍 | AgentLock Harness 的做法 |
|
|
135
|
+
| :--- | :--- | :--- | :--- |
|
|
136
|
+
| **Spec 变更流** | OpenSpec / GitHub Spec Kit | 每次改动常需维护 4+ 份文件,小修复仪式感偏重;勾选状态缺少结束时的物理拦截 | 兼容既有 OpenSpec / Spec Kit / `SPEC.md`;无规范时仅用 **2 份文件**(`delta.md` + `acceptance.md`),1–3 文件修复免走流程,`stop-gate.mjs` 物理拦截未勾选验收项,归档沉淀 `SPEC.md` |
|
|
137
|
+
| **文档-代码防漂移** | 静态文档 / 规范生成器 | 只负责初次生成,后续源码变动时缺少提交期映射提醒与语义核对 | `code_refs` 提交期与工作区实时漂移守护(`staged-guard` / `alh verify` / `alh ui`)+ 可选硬拦截 + 规范感知 `alh review` 语义审校 |
|
|
138
|
+
| **多宿主规则同步** | Rulesync / Ruler | 偏重格式转换;带时间戳易击穿 KV Cache,且不自带运行时护栏与测试背压 | 单一规则源编译至 **6 宿主**,**零时间戳输出**保护 Prompt Cache,配套独立 `rules-drift-check.mjs` 与 Git/Hook 门禁 |
|
|
139
|
+
| **上下文与工作流模板** | Superpowers / BMad Method / Cline Memory Bank | 常驻 Skills 与全量记忆读取随仓库增长膨胀,容易拉高延迟与 Token 成本 | 严格入口预算(`<=50L`/`60L`/`80L`)+ 替换式 `SESSION.md` + `--lean` 单宿主去噪 |
|
|
140
|
+
| **任务依赖与并发锁** | Beads | 依赖外部存储(如 Dolt)或后台常驻服务 | **零数据库** `tasks.json` DAG 账本 + OS 级 `O_CREAT \| O_EXCL` 原子文件锁 + DFS 环检测 |
|
|
141
|
+
| **存量老项目文档接入** | 各类初始化脚手架 | 直接往老项目 `docs/` 写入空白模板,造成新旧两套文档并存错乱 | 双策略:`thin-route`(自动降级 `minimal` 零冗余)或 `archive-switch`(归档至 `docs/legacy-archive/` 自动排除校验 + 双向蒸馏 DAG 任务) |
|
|
142
|
+
| **安装体积与本地 UI** | 多语言 / Python 框架 | 需配置虚拟环境、数据库或独立前后端构建链 | **0 第三方 npm 依赖**(纯 Node.js ≥ 18),自带离线可用的原生 `node:http` 本地控制台(`alh ui`) |
|
|
143
|
+
| **效果验证** | 多数同类项目 | 缺乏内置对照基准,难量化接入净收益 | 内置 **12 题行为与 Token/Cache 消融评测引擎**(`alh eval`) |
|
|
144
|
+
|
|
145
|
+
---
|
|
146
|
+
|
|
147
|
+
## 常用命令行工作流
|
|
148
|
+
|
|
149
|
+
### 1. 接入存量项目(Brownfield)
|
|
150
|
+
|
|
151
|
+
```sh
|
|
152
|
+
cd /path/to/existing-project
|
|
153
|
+
|
|
154
|
+
# 策略 1(默认 · 薄路由):保留原 docs/ 不动,自动降级 minimal 防冗余,挂载 0 Token 护栏
|
|
155
|
+
alh adopt . --lean --hosts codex --dry-run
|
|
156
|
+
alh adopt . --lean --hosts codex
|
|
157
|
+
|
|
158
|
+
# 策略 2(复杂项目整套切换 · 归档隔离 + 双向蒸馏):
|
|
159
|
+
# 将旧文档安全移入 docs/legacy-archive/(自动加入 docs.config.json exclude),
|
|
160
|
+
# 生成新领域骨架 + MIGRATION_PLAN.md + 「旧文档 × 源码」双向蒸馏 DAG 任务
|
|
161
|
+
alh adopt . --lean --profile web-saas --docs-strategy archive-switch --dry-run
|
|
162
|
+
alh adopt . --lean --profile web-saas --docs-strategy archive-switch --confirm-archive
|
|
163
|
+
|
|
164
|
+
# 核验文档结构、规则零漂移、Git Hooks 与测试命令
|
|
165
|
+
alh verify . --run-checks
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
### 2. 初始化新项目(Greenfield)
|
|
169
|
+
|
|
170
|
+
```sh
|
|
171
|
+
mkdir my-app && cd my-app && git init
|
|
172
|
+
alh init . --lean
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
### 3. 日常开发节奏
|
|
176
|
+
|
|
177
|
+
| 任务规模 | 推荐方式 |
|
|
178
|
+
| :--- | :--- |
|
|
179
|
+
| **1–3 文件局部修复** | 直接交由主力 AI 工具处理,零额外流程 |
|
|
180
|
+
| **新功能 / 跨模块 / 改契约** | `alh change new <slug>` → 编码与测试 → 勾选 `acceptance.md` → `alh change archive <slug>`(自动同步 `SPEC.md`) |
|
|
181
|
+
| **合入主干 / 发版前** | `alh verify . --run-checks` + `alh review`(只读异构模型交叉审 Diff) |
|
|
182
|
+
|
|
183
|
+
---
|
|
184
|
+
|
|
185
|
+
## 命令速查
|
|
186
|
+
|
|
187
|
+
| 命令 | 说明 |
|
|
188
|
+
| :--- | :--- |
|
|
189
|
+
| `alh ui [dir] [--port 4318] [--no-open]` | 启动零依赖本地 Web 控制台(`127.0.0.1` + 防 CSRF Token) |
|
|
190
|
+
| `alh adopt [dir] [--lean] [--docs-strategy thin-route\|archive-switch]` | 存量仓扫描、双策略旧文档接入、自动挂 Git Hooks 与工具链检查 |
|
|
191
|
+
| `alh init [dir] [--lean]` / `alh update [dir]` | 全新项目初始化 / 基于 SHA-256 清单的安全增量更新 |
|
|
192
|
+
| `alh verify [dir] [--strict] [--run-checks]` | 文档结构、`code_refs` 实时文档-代码漂移、规范状态、规则漂移与代码测试校验 |
|
|
193
|
+
| `alh change <new\|list\|status\|verify\|archive>` | 轻量双文件变更流与 `SPEC.md` 归档沉淀 |
|
|
194
|
+
| `alh rules <compile\|check\|list> [dir]` | 6 宿主单源路径级规则编译与漂移检查 |
|
|
195
|
+
| `alh hooks <install\|status\|uninstall> [dir]` | 安装、查看或卸载跨工具通用 Git `pre-commit` / `pre-push` 护栏 |
|
|
196
|
+
| `alh review [dir] [--reviewer codex\|claude\|gemini]` | 调用规范感知只读异构模型,对照映射 `Current` 规范审查 `git diff HEAD` |
|
|
197
|
+
| `alh task <add\|list\|ready\|claim\|done\|graph>` | 零数据库 DAG 任务账本与原子文件锁认领 |
|
|
198
|
+
| `alh ralph [dir] [--max-iterations N]` | 独立上下文自治循环(联动 DAG 账本与停滞/死锁熔断) |
|
|
199
|
+
| `alh eval <list\|run\|scaffold\|grade>` | 12 题行为与 Token/Cache 消融评测引擎 |
|
|
200
|
+
| `alh stats [dir]` / `alh doctor [--fix]` | 零 PII 护栏拦截统计 / 本机 CLI 工具链检测与安装 |
|
|
201
|
+
| `alh find` / `alh map` | 有界只读文档检索 / 源码变更影响反查 |
|
|
202
|
+
|
|
203
|
+
---
|
|
204
|
+
|
|
205
|
+
## 适用边界、平台支持与安全
|
|
206
|
+
|
|
207
|
+
- **平台验证**:Linux 与 macOS(Node.js 18 / 22 / 24)已通过 GitHub Actions 全量 174 项回归测试;内置 Windows PowerShell 引导脚本(Git Hooks 依赖 Git Bash,当前为实验性支持)。
|
|
208
|
+
- **评估边界**:`npm run check` 与 `mock-oracle` 仅用于验证脚本、模板与判分器本身,不代表真实 LLM 精度;真实模型结论需按 [docs/agent-evaluation.md](docs/agent-evaluation.md) 在目标 CLI 上运行 `alh eval` 获取。
|
|
209
|
+
- **安全与隐私**:安全模型与漏洞私下上报方式见 [SECURITY.md](SECURITY.md)。
|
|
210
|
+
- **参与贡献**:请参阅 [CONTRIBUTING.md](CONTRIBUTING.md) 与 [AGENTS.md](AGENTS.md)。
|
|
211
|
+
- **开源协议**:[MIT License](LICENSE)。
|
package/RELEASE_NOTES.md
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# Release Notes
|
|
2
|
+
|
|
3
|
+
## v0.1.0 — Initial Open-Source Release
|
|
4
|
+
|
|
5
|
+
Released: 2026-12-01.
|
|
6
|
+
|
|
7
|
+
First public release of **AgentLock Harness** — a zero-dependency (`Node.js >= 18`, empty `dependencies`) engineering guardrail, 6-host rule compiler, local Web Console (`alh ui`), and behavioral/token benchmark CLI for AI coding agents.
|
|
8
|
+
|
|
9
|
+
### Highlights
|
|
10
|
+
|
|
11
|
+
- **Dumbbell Zero-Tax Architecture**:
|
|
12
|
+
- Ultra-lean context entrypoints (`AGENTS.md <= 50L`, `SESSION.md <= 60L`, `docs/00-context.md <= 80L`) with `--lean` single-host adapters that avoid always-on skill discovery overhead.
|
|
13
|
+
- Zero-token deterministic local shell via L4 Hooks (`pre-tool-guard`, `post-edit-check`, `stop-gate`, `staged-guard`, `rules-drift-check`) and universal Git `pre-commit` / `pre-push` guardrails.
|
|
14
|
+
- **Zero-Dependency Local Web Console (`alh ui`)**:
|
|
15
|
+
- Powered purely by Node.js `node:http` and zero-build static assets (works completely offline, zero UI files written to inspected repos).
|
|
16
|
+
- Strictly binds `127.0.0.1` with per-launch anti-CSRF session tokens, `Host`/`Origin` allowlists, and per-request nonce CSP.
|
|
17
|
+
- Includes 4 interactive views: **Health & Guardrails**, **Onboarding & Toolchain Doctor**, **Spec Change & DAG Board**, and **Eval Lab** (with native SVG charts and collapsible equivalent CLI commands).
|
|
18
|
+
- **Dual-Strategy Brownfield Adoption (`alh adopt`)**:
|
|
19
|
+
- Auto-detects Node/TS, Python (`python3 -B`), C/C++, Go, Rust, monorepos, test commands, and existing specs (`SPEC.md`, `openapi.*`, `ADR`, `openspec/`, `.specify/`).
|
|
20
|
+
- **`thin-route` (default)**: Detects existing `docs/` and auto-selects `minimal` to prevent duplicate Draft templates while indexing existing docs in `docs/00-context.md`.
|
|
21
|
+
- **`archive-switch` (opt-in with `--confirm-archive`)**: Safely moves legacy docs to `docs/legacy-archive/` (auto-excluded in `docs.config.json`), scaffolds the chosen Domain Profile, generates `.agentlock-harness/MIGRATION_PLAN.md`, and seeds Archive × Live-Code cross-distillation DAG tasks.
|
|
22
|
+
- **Self-Bootstrapping Spec Workflow (`alh change`)**:
|
|
23
|
+
- Lightweight 2-file change packages (`delta.md` + `acceptance.md`), skipped for 1–3 file local fixes; `stop-gate.mjs` blocks finishing with unchecked acceptance boxes, and archiving lazily crystallizes verified contracts into `docs/06-dev-guide/SPEC.md`.
|
|
24
|
+
- **6-Host Single-Source Path-Scoped Rules (`alh rules`)**:
|
|
25
|
+
- Author once in `.agentlock-harness/rules/*.md` and compile deterministically (zero timestamps for KV-cache stability) to **Claude Code, Codex CLI, Gemini CLI / Antigravity, Cursor, and GitHub Copilot**.
|
|
26
|
+
- **Zero-DB DAG Task Ledger, Cross-Model Review & Autonomous Loop (`alh task`, `alh review`, `alh ralph`)**:
|
|
27
|
+
- Exclusive `O_CREAT | O_EXCL` file locks, DFS cycle detection, read-only cross-model diff review, and stall/deadlock circuit breakers.
|
|
28
|
+
- **12-Case Behavioral & Token/Cache Ablation Suite (`alh eval`)**:
|
|
29
|
+
- Isolated Git fixtures across `core` (5), `hard` (4), and `frontier` (3) with native Codex/Claude/Gemini Token, Prompt-Cache Hit %, Mid-Session Cache Invalidation, and Tool-Call telemetry using strict paired deltas.
|
|
30
|
+
- **Layered Doc-Code Anti-Drift System**:
|
|
31
|
+
- Commit-time 0-token drift guard in `staged-guard.mjs` via `code_refs` (`scripts/doc-map.mjs`): emits `Doc-Code Drift Advisory` by default, or hard-blocks when `guardrails.requireDocSyncOnMappedChanges: true` (with `AGENTLOCK_HARNESS_SKIP_DOC_DRIFT=1` one-off bypass).
|
|
32
|
+
- Live working-tree drift detection (`src/core/doc-drift.mjs`) surfaced in `alh verify` (blocking under `--strict`) and `alh ui` Health & Guardrails diagnostics (`category: "doc-drift"`).
|
|
33
|
+
- Spec-aware `alh review` (`cross-review.mjs`): automatically resolves mapped `Current` specs (≤6,000 chars) and injects them into the read-only cross-model diff audit to catch subtle semantic drift.
|
|
34
|
+
- **Bilingual Documentation & Governance Core (`zh-CN` / `en-US`)**:
|
|
35
|
+
- 78 aligned Markdown templates per locale, bounded read-only doc search (`alh find`), source-impact lookup (`alh map`), SHA-256 manifest incremental updates, and 174 automated regression tests (`npm run check`).
|