@structor-dev/cli 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.
Files changed (119) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +405 -0
  3. package/bin/structor.mjs +576 -0
  4. package/docs/INIT.md +109 -0
  5. package/docs/adr/0001-default-generated-repo-name.md +9 -0
  6. package/docs/issues/0001-structor-doctor.md +39 -0
  7. package/examples/frontend-backend/harness.config.json +35 -0
  8. package/examples/openai-and-anthropic/harness.config.json +28 -0
  9. package/examples/single-repo/harness.config.json +26 -0
  10. package/harness.config.example.json +38 -0
  11. package/package.json +58 -0
  12. package/schemas/contract-manifest.schema.json +18 -0
  13. package/schemas/harness-config.schema.json +85 -0
  14. package/schemas/task-brief.schema.json +37 -0
  15. package/scripts/check-config.mjs +76 -0
  16. package/scripts/check-contract-manifests.mjs +85 -0
  17. package/scripts/check-model-overlays.mjs +30 -0
  18. package/scripts/check-placeholders.mjs +48 -0
  19. package/scripts/check-task-template.mjs +53 -0
  20. package/scripts/check-template-files.mjs +110 -0
  21. package/scripts/init-harness.mjs +270 -0
  22. package/scripts/lib.mjs +190 -0
  23. package/scripts/smoke-template.mjs +309 -0
  24. package/scripts/validate-governance.mjs +3 -0
  25. package/scripts/validate-template.mjs +16 -0
  26. package/template/.claude/CLAUDE.md.tpl +12 -0
  27. package/template/.claude/rules/harness-client-surfaces.md.tpl +20 -0
  28. package/template/.claude/settings.json.tpl +10 -0
  29. package/template/.codex/hooks.json.tpl +77 -0
  30. package/template/AGENTS.md.tpl +22 -0
  31. package/template/CLAUDE.md.tpl +16 -0
  32. package/template/README.md.tpl +109 -0
  33. package/template/ai/AGENT-GARBAGE-COLLECTION.md.tpl +18 -0
  34. package/template/ai/AGENTS.md.tpl +36 -0
  35. package/template/ai/ARCHITECTURE.md.tpl +35 -0
  36. package/template/ai/CODEX-HOOKS.md.tpl +23 -0
  37. package/template/ai/DECISIONS.md.tpl +22 -0
  38. package/template/ai/DESIGN.md.tpl +22 -0
  39. package/template/ai/HARNESS-ENGINEERING.md.tpl +107 -0
  40. package/template/ai/HARNESS.md.tpl +53 -0
  41. package/template/ai/HUB.md.tpl +53 -0
  42. package/template/ai/PRODUCT-SUMMARY.md.tpl +28 -0
  43. package/template/ai/PRODUCT.md.tpl +32 -0
  44. package/template/ai/QUALITY.md.tpl +37 -0
  45. package/template/ai/READINESS.md.tpl +39 -0
  46. package/template/ai/RUNNER-READINESS.md.tpl +14 -0
  47. package/template/ai/RUNNER-SAFETY.md.tpl +21 -0
  48. package/template/ai/VERSIONING.md.tpl +16 -0
  49. package/template/ai/WORKFLOW.md.tpl +42 -0
  50. package/template/ai/context.md.tpl +17 -0
  51. package/template/ai/contracts/README.md.tpl +23 -0
  52. package/template/ai/contracts/api-boundary.contract.json.tpl +11 -0
  53. package/template/ai/contracts/api-boundary.md.tpl +17 -0
  54. package/template/ai/contracts/app-legibility.contract.json.tpl +11 -0
  55. package/template/ai/contracts/app-legibility.md.tpl +24 -0
  56. package/template/ai/contracts/codex-hooks.contract.json.tpl +15 -0
  57. package/template/ai/contracts/codex-hooks.md.tpl +18 -0
  58. package/template/ai/contracts/github-safety.contract.json.tpl +11 -0
  59. package/template/ai/contracts/github-safety.md.tpl +15 -0
  60. package/template/ai/contracts/release-flow.contract.json.tpl +12 -0
  61. package/template/ai/contracts/release-flow.md.tpl +15 -0
  62. package/template/ai/contracts/repo-boundaries.contract.json.tpl +12 -0
  63. package/template/ai/contracts/repo-boundaries.md.tpl +18 -0
  64. package/template/ai/contracts/security-boundary.contract.json.tpl +11 -0
  65. package/template/ai/contracts/security-boundary.md.tpl +19 -0
  66. package/template/ai/knowledge-manifest.json.tpl +149 -0
  67. package/template/ai/model-overlays/anthropic/CLAUDE.md.tpl +14 -0
  68. package/template/ai/model-overlays/openai/AGENTS.md.tpl +13 -0
  69. package/template/ai/plans/README.md.tpl +10 -0
  70. package/template/ai/plans/tech-debt.md.tpl +7 -0
  71. package/template/ai/skills/README.md.tpl +15 -0
  72. package/template/ai/skills/review-architecture.md.tpl +41 -0
  73. package/template/ai/skills/review-contract-drift.md.tpl +41 -0
  74. package/template/ai/skills/review-governance-drift.md.tpl +42 -0
  75. package/template/ai/skills/review-security.md.tpl +40 -0
  76. package/template/ai/specs/README.md.tpl +14 -0
  77. package/template/ai/templates/README.md.tpl +13 -0
  78. package/template/ai/templates/fixtures/issues/invalid-placeholder.md.tpl +20 -0
  79. package/template/ai/templates/fixtures/issues/invalid-protected-surface.md.tpl +21 -0
  80. package/template/ai/templates/fixtures/issues/valid-ready.md.tpl +105 -0
  81. package/template/ai/templates/issue-template.md.tpl +107 -0
  82. package/template/ai/templates/task-brief-template.md.tpl +185 -0
  83. package/template/ai/workspace/LOCAL-STACK.md.tpl +21 -0
  84. package/template/ai/workspace/REPOS.md.tpl +19 -0
  85. package/template/ai/workspace/SESSION-BOOTSTRAP.md.tpl +27 -0
  86. package/template/ai/workspace/SYSTEM-MAP.md.tpl +19 -0
  87. package/template/ai/workspace/TEST-STRATEGY.md.tpl +22 -0
  88. package/template/consumer/.claude/CLAUDE.md.tpl +14 -0
  89. package/template/consumer/AGENTS.md.tpl +23 -0
  90. package/template/consumer/CLAUDE.md.tpl +15 -0
  91. package/template/scripts/bootstrap-codex-worktree.mjs.tpl +52 -0
  92. package/template/scripts/bootstrap-workspace.mjs.tpl +100 -0
  93. package/template/scripts/check-claude-compatibility.mjs.tpl +120 -0
  94. package/template/scripts/check-codex-hooks.mjs.tpl +190 -0
  95. package/template/scripts/check-contract-manifests.mjs.tpl +81 -0
  96. package/template/scripts/check-garbage-collection.mjs.tpl +25 -0
  97. package/template/scripts/check-html-views.mjs.tpl +60 -0
  98. package/template/scripts/check-issue-template.mjs.tpl +167 -0
  99. package/template/scripts/check-knowledge-manifest.mjs.tpl +82 -0
  100. package/template/scripts/check-overlay-drift.mjs.tpl +49 -0
  101. package/template/scripts/check-plans.mjs.tpl +70 -0
  102. package/template/scripts/check-readiness.mjs.tpl +130 -0
  103. package/template/scripts/check-review-skills.mjs.tpl +48 -0
  104. package/template/scripts/check-task-template.mjs.tpl +63 -0
  105. package/template/scripts/check-template-governance.mjs.tpl +161 -0
  106. package/template/scripts/check-workspace.mjs.tpl +212 -0
  107. package/template/scripts/check-worktree-bootstrap-fixtures.mjs.tpl +122 -0
  108. package/template/scripts/check-worktrees.mjs.tpl +69 -0
  109. package/template/scripts/fixtures/worktrees/README.md.tpl +4 -0
  110. package/template/scripts/generate-html-views.mjs.tpl +189 -0
  111. package/template/scripts/hooks/codex-hook.mjs.tpl +21 -0
  112. package/template/scripts/hooks/lib/codex-hooks-core.mjs.tpl +114 -0
  113. package/template/scripts/lib/worktree-bootstrap.mjs.tpl +388 -0
  114. package/template/scripts/validate-governance.mjs.tpl +78 -0
  115. package/template/workspace/.claude/CLAUDE.md.tpl +9 -0
  116. package/template/workspace/.claude/rules/harness-client-surfaces.md.tpl +15 -0
  117. package/template/workspace/.claude/settings.json.tpl +10 -0
  118. package/template/workspace/AGENTS.md.tpl +17 -0
  119. package/template/workspace/CLAUDE.md.tpl +18 -0
@@ -0,0 +1,35 @@
1
+ # {{PROJECT_NAME}} Architecture
2
+
3
+ This document captures the durable architecture map for {{PROJECT_NAME}}.
4
+
5
+ ## System Shape
6
+
7
+ - Harness repo: `{{HARNESS_REPO_NAME}}`
8
+ - Consumer repos:
9
+ {{CONSUMER_REPOS_LIST}}
10
+ - Active harness contracts and contracts views live in `ai/contracts` and `ai/views`.
11
+
12
+ ## Ownership Boundaries
13
+
14
+ - The harness owns shared policy, contracts, routing, and validation
15
+ expectations.
16
+ - Consumer repos own implementation, local tests, runtime behavior, and
17
+ deployment-specific details.
18
+ - Cross-repo invariants belong in `ai/contracts/*`.
19
+ - Product-owned behavior contracts should be explicit and versionable through
20
+ `ai/contracts/*.contract.json`.
21
+
22
+ ## Module Guidance
23
+
24
+ - Prefer deep modules that hide decisions behind clear APIs.
25
+ - Avoid scattered coordination logic across unrelated files.
26
+ - Keep names precise enough that the domain model is obvious.
27
+ - Reuse existing types and abstractions before creating new ones.
28
+ - Make shared interfaces explicit; avoid moving contract-owned logic into consumer
29
+ overlays.
30
+
31
+ ## Open Architecture Notes
32
+
33
+ - Add repo-specific module maps as you onboard each consumer repo.
34
+ - Add ADRs only for durable trade-offs that would surprise a future reader.
35
+ - Keep bootstrap and worktree contracts close to workspace entrypoints.
@@ -0,0 +1,23 @@
1
+ # Codex Hooks
2
+
3
+ Codex hooks provide lightweight local guardrails for `{{PROJECT_NAME}}`.
4
+
5
+ ## Scope
6
+
7
+ - Hooks may emit context or deny clearly unsafe actions.
8
+ - Hooks must be deterministic, local, and dependency-free.
9
+ - Hooks must not write files, call networks, run subprocess orchestration, or
10
+ mutate remote services.
11
+ - Hooks are local guardrails, not a complete security boundary. They complement
12
+ sandboxing, permission controls, code review, CI policy, and secret
13
+ management.
14
+
15
+ ## Validation
16
+
17
+ Run:
18
+
19
+ ```bash
20
+ node scripts/check-codex-hooks.mjs
21
+ ```
22
+
23
+ The hook contract lives in `ai/contracts/codex-hooks.md`.
@@ -0,0 +1,22 @@
1
+ # Decisions
2
+
3
+ Record durable harness decisions here.
4
+
5
+ ## Format
6
+
7
+ - Date:
8
+ - Decision:
9
+ - Context:
10
+ - Consequences:
11
+
12
+ ## Initial Decisions
13
+
14
+ ### Harness owns policy; runner owns execution
15
+
16
+ - Date: initial generation
17
+ - Decision: This repository owns harness policy, contracts, task shape, review
18
+ rules, and validation. Runtime orchestration belongs outside this repo.
19
+ - Context: Keeping policy separate from execution makes the harness reusable
20
+ across model systems and runners.
21
+ - Consequences: Runner behavior may consume this repo, but must not become the
22
+ canonical source of policy.
@@ -0,0 +1,22 @@
1
+ # {{PROJECT_NAME}} Design Direction
2
+
3
+ Use this document for durable product and interface design direction when the
4
+ consumer repos include user-facing surfaces.
5
+
6
+ ## Experience Principles
7
+
8
+ - Define the tone and interaction expectations.
9
+ - Define accessibility and responsiveness expectations.
10
+ - Keep design rules tied to product needs, not decoration.
11
+
12
+ ## Interface Boundaries
13
+
14
+ - Consumer repos own implementation details and component code.
15
+ - The harness may define review criteria, product language, and cross-repo
16
+ consistency expectations.
17
+
18
+ ## Review Notes
19
+
20
+ - Add examples, screenshots, or design references only when they are stable
21
+ enough to guide future work.
22
+
@@ -0,0 +1,107 @@
1
+ # Harness Engineering Standard
2
+
3
+ An engineering harness is the durable, versioned system of context, contracts,
4
+ validation, review policy, quality tracking, and feedback loops that makes
5
+ AI-assisted engineering reliable and repeatable.
6
+
7
+ This harness is optimized for agent legibility: future agents should be able to
8
+ discover intent, boundaries, and validation paths from repo-local artifacts
9
+ instead of chat history or human memory.
10
+
11
+ ## Harness, Not Runner
12
+
13
+ - The harness defines what must be true.
14
+ - A runner decides when and how work executes.
15
+ - The harness owns policy, contracts, templates, quality, and validation.
16
+ - Runtime state, polling, PR automation, dashboards, auto-merge, and repair
17
+ loops belong outside the canonical docs layer unless explicitly authorized.
18
+
19
+ ## System Of Record
20
+
21
+ - Repo-local docs under `ai/*` are the system of record.
22
+ - Knowledge in chat or external tools is invisible until encoded here.
23
+ - Root `AGENTS.md` and `CLAUDE.md` stay short and route into `ai/*`.
24
+ - Large always-loaded instruction blobs are prohibited.
25
+ - Decisions that explain durable harness changes belong in `ai/DECISIONS.md`.
26
+
27
+ ## Progressive Disclosure
28
+
29
+ Agents should load:
30
+
31
+ 1. the entrypoint map
32
+ 2. the current task
33
+ 3. the routed docs
34
+ 4. the relevant contract or review skill
35
+ 5. implementation files after boundaries are clear
36
+
37
+ The goal is targeted context, not maximum context. If an agent needs to load
38
+ the whole repo to understand the task, the harness is under-specified.
39
+
40
+ ## Enforced Invariants
41
+
42
+ Advisory prose is not enough. Important architecture, safety, and task-shape
43
+ rules should be mechanically checked when practical.
44
+
45
+ Good harness checks:
46
+
47
+ - validate structure, links, manifests, task metadata, and review-skill shape
48
+ - fail with remediation-oriented messages an agent can act on
49
+ - prefer narrow static checks over broad fragile interpretation
50
+ - keep protected surfaces human-gated
51
+ - stay independent of product runtime state unless explicitly documented
52
+
53
+ ## First-Class Artifacts
54
+
55
+ - Product, architecture, workflow, and design docs explain intent.
56
+ - Contracts encode boundaries and compatibility expectations.
57
+ - Task briefs carry machine-readable risk, autonomy, model, repo, and path
58
+ metadata.
59
+ - Plans capture multi-step work without becoming runtime state.
60
+ - Quality grades expose weak areas honestly.
61
+ - Review skills define repeatable evaluator behavior.
62
+ - Garbage collection converts repeated mistakes into durable rules or checks.
63
+
64
+ ## Consumer Repo Legibility
65
+
66
+ Consumer repos should expose enough local commands, docs, and checks for agents
67
+ to inspect and validate work without guessing:
68
+
69
+ - install, lint, test, build, dev, and health commands where applicable
70
+ - critical smoke paths and safe local validation commands
71
+ - required environment variables or local-service prerequisites
72
+ - fixture, migration, screenshot, log, and observability expectations
73
+ - root `AGENTS.md` and/or `CLAUDE.md` pointers back to this harness
74
+
75
+ ## Long-Running Work Readiness
76
+
77
+ Long-running work needs handoff artifacts before it needs a runner. Task briefs
78
+ must make decomposition, validation, review routing, and recovery expectations
79
+ explicit enough that a fresh agent can continue after a context reset.
80
+
81
+ Before a task is delegated to a runner, the harness should define:
82
+
83
+ - the path contract and protected contracts
84
+ - bootstrap commands and expected context files
85
+ - required validation evidence
86
+ - evaluator or review-skill routing
87
+ - stop conditions and human approval gates
88
+ - rollback or recovery path
89
+
90
+ ## Definition Of Done
91
+
92
+ This harness is production-grade when:
93
+
94
+ 1. Agents can discover the right context without loading the entire repo.
95
+ 2. Product, architecture, contracts, decisions, and workflow policy are
96
+ versioned in `ai/*`.
97
+ 3. Task specs are bounded by machine-checkable metadata.
98
+ 4. Important architecture and safety rules are mechanically enforced where
99
+ practical.
100
+ 5. Validation evidence is required and structured.
101
+ 6. Repeated agent mistakes are captured and converted into durable fixes.
102
+ 7. Quality is graded and updated over time.
103
+ 8. Consumer repos expose agent-legible validation and observability hooks.
104
+ 9. Future runner integration can consume the harness without owning policy.
105
+ 10. Protected surfaces remain human-gated.
106
+ 11. OpenAI/Codex and Anthropic/Claude Code can start from native entrypoints
107
+ without duplicating canonical policy.
@@ -0,0 +1,53 @@
1
+ # {{PROJECT_NAME}} Engineering Harness
2
+
3
+ This repo is the canonical harness for {{PROJECT_NAME}}. It defines shared
4
+ guidance, contracts, task structure, review policy, and validation checks.
5
+
6
+ It does not implement product behavior and it is not a runner.
7
+
8
+ ## What The Harness Owns
9
+
10
+ - shared workflow and model-neutral guidance
11
+ - shared product, architecture, design, and vocabulary docs
12
+ - context routing
13
+ - contracts and boundary rules
14
+ - task templates and task metadata expectations
15
+ - review procedures
16
+ - validation scripts
17
+ - workspace bootstrap checks and consumer entrypoint routing
18
+ - model/client startup surfaces and local compatibility validators
19
+ - quality tracking
20
+ - repeated-mistake capture
21
+
22
+ ## What The Harness Does Not Own
23
+
24
+ - long-running polling
25
+ - agent session lifecycle
26
+ - PR lifecycle automation
27
+ - dashboards
28
+ - auto-merge
29
+ - production autonomous execution
30
+ - runtime state stores
31
+ - repair-loop daemons
32
+ - external client automation that is not validated as a local harness guardrail
33
+
34
+ ## Harness vs Runner
35
+
36
+ The harness answers what must be true. A runner answers when and how work is
37
+ scheduled and executed.
38
+
39
+ Future runners may consume this harness as read-only policy input. They must
40
+ not become the policy source of truth.
41
+
42
+ ## Workspace Bootstrap
43
+
44
+ Use:
45
+
46
+ ```sh
47
+ node scripts/bootstrap-workspace.mjs
48
+ ```
49
+
50
+ This installs workspace-level pointer files and checks that configured consumer
51
+ repos can route agents back to the harness. It skips existing files by default.
52
+ Use `--dry-run` to preview writes and `--force` only after reviewing existing
53
+ consumer or workspace entrypoints.
@@ -0,0 +1,53 @@
1
+ # {{PROJECT_NAME}} Harness Hub
2
+
3
+ This is the routing layer for the {{PROJECT_NAME}} engineering harness.
4
+
5
+ ## Baseline
6
+
7
+ Always read:
8
+
9
+ - `./AGENTS.md` or the local entrypoint
10
+ - `./ai/AGENTS.md`
11
+ - `./ai/context.md`
12
+
13
+ ## Routing
14
+
15
+ - Product, user journeys, or business context:
16
+ `./ai/PRODUCT-SUMMARY.md`, `./ai/PRODUCT.md`
17
+ - Architecture, repo boundaries, or module design:
18
+ `./ai/ARCHITECTURE.md`
19
+ - UI or design direction:
20
+ `./ai/DESIGN.md`
21
+ - Harness policy, bootstrap, validation, or model overlay changes:
22
+ `./ai/HARNESS.md`, `./ai/HARNESS-ENGINEERING.md`, `./ai/READINESS.md`,
23
+ `./ai/QUALITY.md`, `./ai/DECISIONS.md`, `./ai/knowledge-manifest.json`
24
+ - Codex/Claude client surfaces, `.codex/**`, `.claude/**`, or overlay drift:
25
+ `./ai/HARNESS.md`, `./ai/HARNESS-ENGINEERING.md`, `./ai/QUALITY.md`,
26
+ `./ai/CODEX-HOOKS.md`,
27
+ and the matching generated client validator
28
+ - Workspace, repo ownership, local stack, session bootstrap, or validation
29
+ ownership:
30
+ `./ai/workspace/REPOS.md`, `./ai/workspace/SYSTEM-MAP.md`,
31
+ `./ai/workspace/SESSION-BOOTSTRAP.md`, `./ai/workspace/LOCAL-STACK.md`,
32
+ `./ai/workspace/TEST-STRATEGY.md`
33
+ - Runner or automation questions:
34
+ `./ai/WORKFLOW.md`, `./ai/RUNNER-SAFETY.md`,
35
+ `./ai/RUNNER-READINESS.md`, `./ai/VERSIONING.md`
36
+ - Contracts or repo boundaries:
37
+ `./ai/contracts/README.md` and the matching contract doc
38
+ - Task template changes:
39
+ `./ai/templates/README.md` and the matching template
40
+ - Generated HTML review views:
41
+ `./ai/views/index.html` plus canonical Markdown, JSON, and YAML sources
42
+ - Shared specs:
43
+ `./ai/specs/README.md` and the matching spec
44
+ - Review requests:
45
+ `./ai/skills/README.md` and the matching review skill
46
+ - Repeated agent mistakes:
47
+ `./ai/AGENT-GARBAGE-COLLECTION.md`
48
+
49
+ ## Load Rules
50
+
51
+ - Load the smallest doc set that can answer the task.
52
+ - Add topical docs only when the task clearly needs them.
53
+ - Do not load every doc by default.
@@ -0,0 +1,28 @@
1
+ # {{PROJECT_NAME}} Product Summary
2
+
3
+ This document captures the short product context agents need before proposing
4
+ or changing user-facing behavior.
5
+
6
+ ## Product
7
+
8
+ - Name: {{PROJECT_NAME}}
9
+ - Primary consumer repo: {{PRIMARY_CONSUMER_NAME}}
10
+ - Consumer repos:
11
+ {{CONSUMER_REPOS_LIST}}
12
+
13
+ ## Users
14
+
15
+ - Primary users are defined as any actors that consume the product surface from
16
+ {{PRIMARY_CONSUMER_NAME}} or downstream consumer repos.
17
+ - Product value is measured by how reliably each actor reaches intended outcome
18
+ with the fewest failure handoffs.
19
+
20
+ ## Core Workflows
21
+
22
+ - Keep a single workflow map per critical actor in the relevant task brief.
23
+ - Track entrypoint, validation, decision points, and durable handoff/output.
24
+ - Link detailed specs or active task briefs when they exist.
25
+
26
+ ## Current Focus
27
+
28
+ - Keep this section short and update it when product direction changes.
@@ -0,0 +1,32 @@
1
+ # {{PROJECT_NAME}} Product Context
2
+
3
+ This is the durable product context for the {{PROJECT_NAME}} engineering
4
+ harness. Agents should treat this as the source of truth for product semantics.
5
+
6
+ ## Problem
7
+
8
+ The harness exists to keep every consumer repo aligned on the same business
9
+ meaning, shared vocabulary, and user-facing invariants.
10
+
11
+ - Preserve the end-to-end value chain from input to outcome.
12
+ - Surface the failure modes that must be handled explicitly.
13
+ - Keep behavior choices traceable to a durable contract, not to local convenience.
14
+
15
+ ## Product Model
16
+
17
+ - Define the core domain objects for this product and keep names consistent across
18
+ all repos.
19
+ - Define ownership of each object and where source-of-truth transitions happen.
20
+ - Define which terms are equivalent and which are not. Do not silently merge terms.
21
+
22
+ ## User Journeys
23
+
24
+ - Document the expected happy path from first user intent to completed outcome.
25
+ - Define recovery paths and observable fallback behavior for every step that can fail.
26
+ - Keep implementation details out unless needed to clarify ownership boundaries.
27
+
28
+ ## Boundaries
29
+
30
+ - Product behavior belongs in consumer repos.
31
+ - Shared product language and cross-repo invariants belong in this harness.
32
+ - If implementation and product context disagree, update one deliberately.
@@ -0,0 +1,37 @@
1
+ # Harness Quality
2
+
3
+ This scorecard tracks harness readiness. Keep grades evidence-based and update
4
+ them when validation or policy changes.
5
+
6
+ | Domain | Grade | Evidence | Enforced by | Blocking gaps |
7
+ | --- | --- | --- | --- | --- |
8
+ | Entrypoints | B | `AGENTS.md`, `CLAUDE.md` | `scripts/validate-governance.mjs` | Customize after initial generation |
9
+ | Context routing | B | `ai/HUB.md`, `ai/context.md` | Manual review | Add project-specific routing as needed |
10
+ | Contracts | B | `ai/contracts/*` | `scripts/check-template-governance.mjs`, manual review | Replace starter contracts with project contracts |
11
+ | Task shape | B | `ai/templates/task-brief-template.md` | `scripts/check-task-template.mjs` | Fill concrete project issue metadata and path contracts |
12
+ | Review skills | B | `ai/skills/*` | Manual review | Customize review inputs and evaluator routing |
13
+ | Readiness contract | B | `ai/READINESS.md`, `scripts/check-readiness.mjs` | `scripts/check-readiness.mjs`, manual review | Run post-generation machine gates and accept manual review domains |
14
+ | Runner boundary | A | `ai/RUNNER-SAFETY.md` | Manual review | Keep runtime out of harness |
15
+ | Workspace bootstrap | B | `scripts/bootstrap-workspace.mjs`, `scripts/check-workspace.mjs` | `node scripts/check-workspace.mjs` | Run after consumer repos are cloned |
16
+
17
+ ## Production-Grade Checklist
18
+
19
+ - Entry points are short maps, not large manuals.
20
+ - The hub routes agents to the smallest relevant context.
21
+ - Task briefs include risk, autonomy, model, repo, path, validation, review,
22
+ and recovery metadata.
23
+ - Contracts define repository boundaries and protected surfaces.
24
+ - Validation scripts check every invariant that can be checked cheaply and
25
+ safely.
26
+ - `ai/READINESS.md` distinguishes machine gates from manual review domains.
27
+ - Validation failures include enough context for an agent to repair drift.
28
+ - Consumer repos expose local commands and evidence hooks.
29
+ - Repeated review feedback is captured in `ai/AGENT-GARBAGE-COLLECTION.md`.
30
+ - Runner integration remains read-only until a separate runtime contract is
31
+ approved.
32
+
33
+ ## Update Rule
34
+
35
+ When a grade changes, update the evidence and the blocking gap in the same
36
+ edit. Do not improve a grade based on intent alone; use validation output,
37
+ contract coverage, or review evidence.
@@ -0,0 +1,39 @@
1
+ # Harness Readiness
2
+
3
+ This file defines the post-generation readiness contract for the
4
+ {{PROJECT_NAME}} harness. Readiness is a gate with evidence, not a numeric
5
+ score and not a golden semantic diff against an ideal harness.
6
+
7
+ ## Verdicts
8
+
9
+ - PASS: required machine gates pass and manual review domains are accepted for
10
+ the current project.
11
+ - FAIL: any required machine gate fails.
12
+ - MANUAL REVIEW REQUIRED: machine gates pass, but project-specific context,
13
+ contracts, routing, or review guidance still need human judgment.
14
+
15
+ ## Required Machine Gates
16
+
17
+ | Gate | Command | Required evidence |
18
+ | --- | --- | --- |
19
+ | Governance validation | `node scripts/validate-governance.mjs` | Command exits 0 |
20
+ | Workspace bootstrap preview | `node scripts/bootstrap-workspace.mjs --dry-run` | Planned pointer writes are expected |
21
+ | Workspace bootstrap | `node scripts/bootstrap-workspace.mjs` | Command exits 0 or reports only intentional skips |
22
+ | Workspace check | `node scripts/check-workspace.mjs` | Command exits 0 |
23
+ | Overlay drift | `node scripts/check-overlay-drift.mjs` | Required when OpenAI or Anthropic support is enabled |
24
+ | Codex hooks | `node scripts/check-codex-hooks.mjs` | Required when Codex hooks are enabled |
25
+ | Claude compatibility | `node scripts/check-claude-compatibility.mjs` | Required when Anthropic support is enabled |
26
+
27
+ ## Manual Review Domains
28
+
29
+ - `ai/context.md` names the real project, repos, and operating assumptions.
30
+ - `ai/HUB.md` routes agents to the smallest useful context.
31
+ - `ai/contracts/*` reflects real repo boundaries and protected surfaces.
32
+ - `ai/templates/task-brief-template.md` matches the team's task intake shape.
33
+ - `ai/skills/*` names review inputs that are available in this workspace.
34
+ - `ai/QUALITY.md` records evidence and blocking gaps for each readiness domain.
35
+
36
+ ## Update Rule
37
+
38
+ When readiness changes, update command evidence and `ai/QUALITY.md` in the same
39
+ edit. Do not promote readiness based on intent alone.
@@ -0,0 +1,14 @@
1
+ # Runner Readiness
2
+
3
+ This checklist is the gate before implementing any runner that consumes this
4
+ harness.
5
+
6
+ ## Required Before Runner Work
7
+
8
+ - Harness validation passes.
9
+ - Task metadata is machine-checkable.
10
+ - Path contracts are documented.
11
+ - Dry-run artifact format is defined.
12
+ - First runner phase performs no external writes.
13
+ - Runtime state lives outside canonical docs.
14
+ - Protected surfaces remain human-gated.
@@ -0,0 +1,21 @@
1
+ # Future Runner Safety
2
+
3
+ This document defines safety policy a future runner should honor. It is not an
4
+ active runtime implementation.
5
+
6
+ ## Protected Surfaces
7
+
8
+ Future runners should require human review for:
9
+
10
+ - architecture or shared contracts
11
+ - authentication or authorization
12
+ - billing or payment behavior
13
+ - secrets or environment variables
14
+ - infrastructure or deployment configuration
15
+ - database migrations or production data
16
+ - large refactors across repo boundaries
17
+
18
+ ## External Actions
19
+
20
+ Pushes, merges, paid external actions, tracker writes, and production mutations
21
+ require explicit authorization and belong in a separate observable runner.
@@ -0,0 +1,16 @@
1
+ # Versioning
2
+
3
+ Harness policy changes should preserve existing generated repo behavior unless
4
+ the task explicitly calls for a breaking change.
5
+
6
+ ## Compatibility
7
+
8
+ - Keep existing script names stable.
9
+ - Add new validation as additive checks when possible.
10
+ - Document breaking changes in `ai/DECISIONS.md`.
11
+
12
+ ## Release Boundary
13
+
14
+ The harness can define release criteria and evidence. It must not publish,
15
+ deploy, tag, or mutate remote systems unless a human explicitly authorizes that
16
+ action in the current task.
@@ -0,0 +1,42 @@
1
+ # Agent Workflow Policy
2
+
3
+ This is harness policy for AI-assisted engineering tasks. It is not a runtime
4
+ daemon contract and it does not start or control agent sessions.
5
+
6
+ ## Load Order
7
+
8
+ 1. Read the task brief.
9
+ 2. Read `ai/HUB.md`.
10
+ 3. Read the smallest routed doc set needed for the task.
11
+ 4. Read any named contract or review skill.
12
+
13
+ ## Execution Rules
14
+
15
+ - Work only in authorized repos and paths.
16
+ - Keep changes within `allowed_paths` when provided.
17
+ - Do not touch `forbidden_paths`.
18
+ - Make the smallest change that satisfies the task.
19
+ - Stop when task intent conflicts with harness contracts.
20
+ - State expected file changes, preserved contracts, validation commands, and
21
+ unresolved risks before editing.
22
+ - Keep handoff notes current when work spans multiple sessions or context
23
+ resets.
24
+
25
+ ## Validation Rules
26
+
27
+ - Run every safe validation command listed in the task.
28
+ - Capture commands run, failures, skipped checks, and reasons.
29
+ - Fix validation failures in the smallest relevant scope.
30
+ - If validation cannot run, report the blocker explicitly instead of implying
31
+ coverage.
32
+
33
+ ## Handoff Rules
34
+
35
+ Long-running work should leave enough state for a fresh agent to continue
36
+ without reconstructing intent from chat:
37
+
38
+ - current goal and accepted non-goals
39
+ - files changed and files intentionally avoided
40
+ - validation already run and remaining validation
41
+ - decisions made and open questions
42
+ - known risks, rollback path, and human approval gates
@@ -0,0 +1,17 @@
1
+ # {{PROJECT_NAME}} Harness Context
2
+
3
+ ## Current Focus
4
+
5
+ - Keep canonical AI engineering policy versioned in this harness.
6
+ - Make consumer repo work discoverable, bounded, and verifiable.
7
+ - Keep model overlays and consumer entrypoints thin.
8
+
9
+ ## Known Fragile Areas
10
+
11
+ - Drift between model-specific overlays.
12
+ - Consumer repos duplicating or contradicting harness policy.
13
+ - Harness docs growing too large to route effectively.
14
+
15
+ ## Consumer Repos
16
+
17
+ {{CONSUMER_REPOS_LIST}}
@@ -0,0 +1,23 @@
1
+ # Contracts
2
+
3
+ Contracts define cross-repo invariants. They do not implement behavior.
4
+
5
+ ## Index
6
+
7
+ - `repo-boundaries.md`: repository ownership boundaries
8
+ - `app-legibility.md`: commands, health checks, and validation evidence expected
9
+ from consumer repos
10
+ - `api-boundary.md`: API ownership and compatibility expectations
11
+ - `security-boundary.md`: protected surfaces and human approval gates
12
+ - `codex-hooks.md`: local hook behavior and safety limits
13
+ - `release-flow.md`: release and external mutation safety
14
+ - `github-safety.md`: remote repository mutation guardrails
15
+
16
+ Contract JSON manifests use the `*.contract.json` suffix and are checked by
17
+ `node scripts/check-contract-manifests.mjs`.
18
+
19
+ ## Rule
20
+
21
+ Contracts are authoritative for what must stay true. Consumer repos implement
22
+ the contracts. If implementation and contract disagree, update one deliberately
23
+ instead of allowing drift.
@@ -0,0 +1,11 @@
1
+ {
2
+ "id": "api-boundary",
3
+ "name": "API Boundary Contract",
4
+ "version": "1.0.0",
5
+ "owners": ["{{HARNESS_REPO_NAME}}"],
6
+ "affectedRepos": {{CONSUMER_REPO_NAMES_JSON}},
7
+ "requiredFiles": [
8
+ "ai/contracts/api-boundary.md"
9
+ ],
10
+ "validation": ["node scripts/validate-governance.mjs"]
11
+ }
@@ -0,0 +1,17 @@
1
+ # API Boundary
2
+
3
+ Use this contract to document API ownership and compatibility expectations.
4
+
5
+ ## Required Fields
6
+
7
+ - Owning repo:
8
+ - Consumers:
9
+ - Backward compatibility rule:
10
+ - Versioning or migration rule:
11
+ - Required validation:
12
+
13
+ ## Drift That Should Block
14
+
15
+ - Breaking a documented API without a migration plan.
16
+ - Moving source-of-truth behavior into a consumer that does not own it.
17
+ - Changing external contracts without updating task and validation evidence.
@@ -0,0 +1,11 @@
1
+ {
2
+ "id": "app-legibility",
3
+ "name": "App Legibility Contract",
4
+ "version": "1.0.0",
5
+ "owners": ["{{HARNESS_REPO_NAME}}"],
6
+ "affectedRepos": {{CONSUMER_REPO_NAMES_JSON}},
7
+ "requiredFiles": [
8
+ "ai/contracts/app-legibility.md"
9
+ ],
10
+ "validation": ["node scripts/validate-governance.mjs"]
11
+ }
@@ -0,0 +1,24 @@
1
+ # App Legibility
2
+
3
+ Consumer repos must expose enough local information for agents to inspect and
4
+ validate work without guessing.
5
+
6
+ ## Expected Local Signals
7
+
8
+ - install command
9
+ - lint command
10
+ - test command
11
+ - build command
12
+ - health or smoke-check command when available
13
+ - required environment variable documentation
14
+ - artifact or log locations when validation creates them
15
+
16
+ ## Validation Evidence Shape
17
+
18
+ Final reports should include:
19
+
20
+ - commands run
21
+ - commands skipped and why
22
+ - affected repos and contract IDs
23
+ - protected surfaces reviewed
24
+ - artifact or log paths when produced