repo-harness 0.1.0 → 0.1.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/AGENTS.md +18 -15
- package/CLAUDE.md +18 -15
- package/README.md +137 -40
- package/README.zh-CN.md +287 -0
- package/SKILL.md +19 -19
- package/agents/openai.yaml +1 -1
- package/assets/AGENTS.md +68 -0
- package/assets/CLAUDE.md +68 -0
- package/assets/hooks/AGENTS.md +26 -0
- package/assets/hooks/CLAUDE.md +26 -0
- package/assets/hooks/codex.hooks.template.json +9 -9
- package/assets/hooks/hook-input.sh +62 -4
- package/assets/hooks/lib/session-state.sh +38 -0
- package/assets/hooks/lib/workflow-state.sh +526 -11
- package/assets/hooks/post-bash.sh +60 -4
- package/assets/hooks/post-edit-guard.sh +33 -45
- package/assets/hooks/pre-edit-guard.sh +9 -5
- package/assets/hooks/prompt-guard.sh +450 -33
- package/assets/hooks/run-hook.sh +19 -0
- package/assets/hooks/session-start-context.sh +209 -11
- package/assets/hooks/trace-event.sh +22 -2
- package/assets/hooks/worktree-guard.sh +1 -1
- package/assets/partials/04-project-structure.partial.md +2 -2
- package/assets/partials/05-workflow.partial.md +1 -1
- package/assets/partials/07-footer.partial.md +1 -1
- package/assets/partials-agents/02-operating-mode.partial.md +3 -3
- package/assets/partials-agents/04-task-protocol.partial.md +1 -1
- package/assets/partials-agents/08-deep-docs.partial.md +1 -1
- package/assets/plan-map.json +1 -1
- package/assets/reference-configs/agentic-development-flow.md +21 -18
- package/assets/reference-configs/ai-workflows.md +1 -1
- package/assets/reference-configs/changelog-versioning.md +1 -1
- package/assets/reference-configs/coding-standards.md +1 -1
- package/assets/reference-configs/development-protocol.md +1 -1
- package/assets/reference-configs/document-generation.md +4 -2
- package/assets/reference-configs/evaluator-rubric.md +1 -1
- package/assets/reference-configs/external-tooling.md +39 -18
- package/assets/reference-configs/git-strategy.md +1 -1
- package/assets/reference-configs/handoff-protocol.md +6 -4
- package/assets/reference-configs/harness-overview.md +22 -15
- package/assets/reference-configs/hook-operations.md +12 -8
- package/assets/reference-configs/release-deploy.md +1 -1
- package/assets/reference-configs/spa-day-protocol.md +1 -1
- package/assets/reference-configs/sprint-contracts.md +2 -2
- package/assets/reference-configs/workflow-orchestration.md +1 -1
- package/assets/skill-commands/manifest.json +15 -15
- package/assets/skill-commands/{agentic-dev-architecture → repo-harness-architecture}/SKILL.md +8 -7
- package/assets/skill-commands/{agentic-dev-autoplan → repo-harness-autoplan}/SKILL.md +6 -6
- package/assets/skill-commands/{agentic-dev-capability → repo-harness-capability}/SKILL.md +5 -5
- package/assets/skill-commands/{agentic-dev-check → repo-harness-check}/SKILL.md +4 -4
- package/assets/skill-commands/{agentic-dev-deploy → repo-harness-deploy}/SKILL.md +5 -5
- package/assets/skill-commands/{agentic-dev-handoff → repo-harness-handoff}/SKILL.md +3 -3
- package/assets/skill-commands/{agentic-dev-init → repo-harness-init}/SKILL.md +7 -7
- package/assets/skill-commands/{agentic-dev-migrate → repo-harness-migrate}/SKILL.md +3 -3
- package/assets/skill-commands/{agentic-dev-plan → repo-harness-plan}/SKILL.md +5 -5
- package/assets/skill-commands/{agentic-dev-repair → repo-harness-repair}/SKILL.md +4 -4
- package/assets/skill-commands/{agentic-dev-review → repo-harness-review}/SKILL.md +4 -4
- package/assets/skill-commands/{agentic-dev-scaffold → repo-harness-scaffold}/SKILL.md +6 -6
- package/assets/skill-commands/{agentic-dev-upgrade → repo-harness-upgrade}/SKILL.md +4 -4
- package/assets/skill-version.json +7 -7
- package/assets/skills/claude-review/SKILL.md +114 -0
- package/assets/skills/codex-review/SKILL.md +96 -0
- package/assets/templates/contract.template.md +1 -1
- package/assets/templates/helpers/architecture-drift.sh +12 -3
- package/assets/templates/helpers/architecture-event.ts +5 -2
- package/assets/templates/helpers/archive-workflow.sh +4 -0
- package/assets/templates/helpers/capture-plan.sh +29 -1
- package/assets/templates/helpers/check-agent-tooling.sh +81 -28
- package/assets/templates/helpers/check-skill-version.ts +2 -2
- package/assets/templates/helpers/check-task-sync.sh +1 -1
- package/assets/templates/helpers/check-task-workflow.sh +12 -3
- package/assets/templates/helpers/context-contract-sync.sh +10 -4
- package/assets/templates/helpers/contract-worktree.sh +199 -7
- package/assets/templates/helpers/ensure-task-workflow.sh +61 -9
- package/assets/templates/helpers/migrate-project-template.sh +11 -11
- package/assets/templates/helpers/plan-to-todo.sh +19 -1
- package/assets/templates/helpers/prepare-codex-handoff.sh +8 -7
- package/assets/templates/helpers/refresh-current-status.sh +406 -0
- package/assets/templates/helpers/verify-contract.sh +13 -3
- package/assets/templates/helpers/verify-sprint.sh +25 -0
- package/assets/templates/helpers/workflow-contract.ts +8 -8
- package/assets/templates/helpers/workstream-sync.sh +1 -1
- package/assets/templates/review.template.md +12 -0
- package/assets/versions.json +1 -1
- package/assets/workflow-contract.v1.json +8 -4
- package/docs/reference-configs/agentic-development-flow.md +22 -18
- package/docs/reference-configs/ai-workflows.md +1 -1
- package/docs/reference-configs/changelog-versioning.md +1 -1
- package/docs/reference-configs/coding-standards.md +1 -1
- package/docs/reference-configs/development-protocol.md +1 -1
- package/docs/reference-configs/document-generation.md +4 -2
- package/docs/reference-configs/evaluator-rubric.md +1 -1
- package/docs/reference-configs/external-tooling.md +39 -18
- package/docs/reference-configs/git-strategy.md +1 -1
- package/docs/reference-configs/handoff-protocol.md +6 -4
- package/docs/reference-configs/harness-overview.md +22 -15
- package/docs/reference-configs/hook-operations.md +12 -8
- package/docs/reference-configs/release-deploy.md +1 -1
- package/docs/reference-configs/spa-day-protocol.md +1 -1
- package/docs/reference-configs/sprint-contracts.md +2 -2
- package/docs/reference-configs/workflow-orchestration.md +1 -1
- package/package.json +5 -3
- package/scripts/architecture-drift.sh +12 -3
- package/scripts/architecture-event.ts +5 -2
- package/scripts/archive-workflow.sh +4 -0
- package/scripts/canary-global-hook.sh +5 -5
- package/scripts/capture-plan.sh +29 -1
- package/scripts/check-agent-tooling.sh +81 -28
- package/scripts/check-brain-manifest.sh +70 -127
- package/scripts/check-npm-release.sh +36 -0
- package/scripts/check-skill-version.ts +2 -2
- package/scripts/check-task-sync.sh +1 -1
- package/scripts/check-task-workflow.sh +12 -3
- package/scripts/context-contract-sync.sh +10 -4
- package/scripts/contract-worktree.sh +199 -7
- package/scripts/create-project-dirs.sh +20 -5
- package/scripts/ensure-task-workflow.sh +61 -9
- package/scripts/hook-shim.sh +7 -7
- package/scripts/init-project.sh +21 -3
- package/scripts/lib/project-init-lib.sh +117 -23
- package/scripts/migrate-project-template.sh +26 -80
- package/scripts/plan-to-todo.sh +19 -1
- package/scripts/prepare-codex-handoff.sh +8 -7
- package/scripts/refresh-current-status.sh +406 -0
- package/scripts/{agentic-dev.sh → repo-harness.sh} +38 -38
- package/scripts/run-skill-evals.ts +5 -5
- package/scripts/setup-plugins.sh +13 -13
- package/scripts/sync-brain-docs.sh +165 -83
- package/scripts/sync-codex-installed-copies.sh +5 -5
- package/scripts/verify-contract.sh +13 -3
- package/scripts/verify-sprint.sh +25 -0
- package/scripts/workflow-contract.ts +8 -8
- package/scripts/workstream-sync.sh +1 -1
- package/src/cli/commands/brain.ts +614 -0
- package/src/cli/commands/capability-context.ts +613 -0
- package/src/cli/commands/doctor.ts +92 -17
- package/src/cli/commands/hook.ts +12 -104
- package/src/cli/commands/init.ts +117 -4
- package/src/cli/commands/install.ts +1 -1
- package/src/cli/commands/migrate.ts +4 -4
- package/src/cli/commands/status.ts +4 -4
- package/src/cli/commands/tools.ts +85 -1
- package/src/cli/hook/route-registry.ts +2 -2
- package/src/cli/hook/runtime.ts +132 -0
- package/src/cli/hook-entry.ts +36 -0
- package/src/cli/index.ts +26 -6
- package/src/cli/installer/managed-entries.ts +11 -10
- package/src/cli/installer/targets/claude.ts +1 -1
- package/src/cli/installer/targets/codex.ts +1 -1
- package/src/cli/installer/targets/registry.ts +1 -1
- package/src/cli/installer/types.ts +1 -1
- package/src/cli/tools/codegraph.ts +501 -9
package/AGENTS.md
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
#
|
|
1
|
+
# repo-harness AGENTS.md
|
|
2
2
|
|
|
3
|
-
This repository self-hosts the `
|
|
3
|
+
This repository self-hosts the `repo-harness` contract, formerly `repo-harness-skill` and `project-initializer`. Claude and Codex should follow the same repo-local workflow surface.
|
|
4
4
|
|
|
5
5
|
## Canonical Workflow Files
|
|
6
6
|
|
|
7
|
-
- `tasks/
|
|
7
|
+
- `tasks/current.md` for the tracked current-status snapshot derived from workflow artifacts
|
|
8
|
+
- `tasks/todo.md` for deferred medium/long-term goals, not active execution checklists
|
|
8
9
|
- `.ai/context/capabilities.json` for the capability registry and longest-prefix context boundaries
|
|
9
|
-
- `tasks/workstreams/` for capability long-running workstreams that project
|
|
10
|
+
- `tasks/workstreams/` for capability long-running workstreams that project durable progress into local contracts
|
|
10
11
|
- `tasks/lessons.md` for correction-derived rules
|
|
11
12
|
- `tasks/research.md` for deep repo knowledge
|
|
12
13
|
- `tasks/notes/` for task-local implementation decisions, deviations, tradeoffs, and open questions
|
|
@@ -21,7 +22,7 @@ This repository self-hosts the `agentic-dev` contract, formerly `agentic-dev-ski
|
|
|
21
22
|
|
|
22
23
|
- Sync `tasks/` whenever substantive repo changes are made.
|
|
23
24
|
- Use `tasks/notes/<slug>.notes.md` only for non-obvious slice decisions, deviations, tradeoffs, and open questions; do not use notes as durable memory or a task log, and archive/promote them deliberately when the slice closes.
|
|
24
|
-
- Treat `.ai/hooks/` as the shared hook implementation
|
|
25
|
+
- Treat `.ai/hooks/` as the shared repo-local hook implementation; user-level `~/.claude/settings.json` and `~/.codex/hooks.json` are the host adapters.
|
|
25
26
|
- Keep the umbrella hierarchy explicit: architecture owns stable truth, capability contracts own local agent context, `tasks/workstreams/<domain>/<capability>/` owns durable progress, and `tasks/todo.md` owns only deferred medium/long-term goals with tradeoff and revisit trigger.
|
|
26
27
|
- Treat `.ai/context/capabilities.json` as the source of truth for capability prefixes; `agent-context-blocks.txt` and nested agent files are compatibility inputs only.
|
|
27
28
|
- Keep architecture drift handling split: `architecture-drift.sh` writes architecture requests/events, `workstream-sync.sh` maintains durable capability workstreams, and `context-contract-sync.sh` only updates controlled local `CLAUDE.md`/`AGENTS.md` architecture blocks.
|
|
@@ -32,7 +33,7 @@ This repository self-hosts the `agentic-dev` contract, formerly `agentic-dev-ski
|
|
|
32
33
|
- Treat `deploy/` as the trackable deployment and operations surface for runbooks, submission materials, release checklists, helper scripts, ordered SQL files under `deploy/sql/`, and env examples.
|
|
33
34
|
- Treat `_ops/` as ignored local operations state for secrets, real env files, provider state, artifacts, logs, and scratch files; do not commit or agent-edit `_ops/*`.
|
|
34
35
|
- Treat contract-level task execution as worktree-first: `scripts/plan-to-todo.sh --plan <approved-plan>` starts `scripts/contract-worktree.sh start --plan <approved-plan>` when policy enables it, and completed blocks finish through Waza `/check` plus `scripts/contract-worktree.sh finish`.
|
|
35
|
-
- After Codex Plan mode, Waza `/think`, or `
|
|
36
|
+
- After Codex Plan mode, Waza `/think`, or `repo-harness-plan` produces a decision-complete plan, capture it with `scripts/capture-plan.sh --slug <slug> --title <title>` so `plans/` becomes the file-backed source of truth; if the user has already approved implementation, capture with `--status Approved --execute` or run `scripts/plan-to-todo.sh --plan <active-plan>`.
|
|
36
37
|
- If current repo state conflicts with the task, open an isolated `codex/<task-slug>` worktree, finish there, run Waza `/check`-style validation, then merge back to `main` without absorbing unrelated dirty changes.
|
|
37
38
|
- Route product discovery to gstack `office-hours`, complex engineering plans to gstack `plan-eng-review`, design plans to gstack `plan-design-review`, and daily small/medium planning, bug hunts, and checks to Waza `/think`, `/hunt`, and `/check`.
|
|
38
39
|
- Codex automation profile is runtime-referenced, not vendored: required skills are `health`, `check`, and `diagram-design` from `~/.codex/skills`.
|
|
@@ -41,7 +42,7 @@ This repository self-hosts the `agentic-dev` contract, formerly `agentic-dev-ski
|
|
|
41
42
|
- Treat Waza as Codex-first: `~/.codex/skills` is the Codex runtime source; `~/.agents/skills` is skills CLI staging/cache only. Update by staging upstream Waza, copying the eight managed `SKILL.md` files into Codex, and verifying with `cmp`.
|
|
42
43
|
- Use `docs/reference-configs/external-tooling.md` and `bash scripts/check-agent-tooling.sh --host both --check-updates` for environment checks; this self-host repo vendors CodeGraph as a dev dependency while generated downstream repos keep the global MCP default unless local policy opts in.
|
|
43
44
|
- When changing `scripts/migrate-project-template.sh` or `scripts/lib/project-init-lib.sh`, verify self-migration of this repo still works.
|
|
44
|
-
- Treat `.codex/hooks.json` as
|
|
45
|
+
- Treat repo-local `.claude/settings.json` and `.codex/hooks.json` hook adapters as retired legacy config; migration may back them up locally, but they are not product deliverables.
|
|
45
46
|
|
|
46
47
|
## Required Checks
|
|
47
48
|
|
|
@@ -57,26 +58,27 @@ bash scripts/migrate-project-template.sh --repo . --dry-run
|
|
|
57
58
|
<!-- BEGIN ARCHITECTURE CONTRACT -->
|
|
58
59
|
## Architecture Contract
|
|
59
60
|
|
|
60
|
-
- Functional block:
|
|
61
|
+
- Functional block: `.ai/hooks`
|
|
61
62
|
- Capability ID: `runtime-harness-hook-adapters`
|
|
62
|
-
- Matched prefix:
|
|
63
|
+
- Matched prefix: `.ai/hooks`
|
|
63
64
|
- Architecture domain: `runtime-harness`
|
|
64
65
|
- Architecture capability: `hook-adapters`
|
|
65
66
|
- Architecture module: `docs/architecture/modules/runtime-harness/hook-adapters.md`
|
|
66
|
-
- Last architecture event: 2026-05-
|
|
67
|
-
- Last changed path:
|
|
67
|
+
- Last architecture event: 2026-05-29T09:44:46+0800
|
|
68
|
+
- Last changed path: `.ai/hooks/session-start-context.sh`
|
|
68
69
|
- Severity: high
|
|
69
70
|
- Change type: workflow-surface
|
|
70
71
|
- Module responsibility: Keep this block aligned with the local boundary described by surrounding human-owned context.
|
|
71
|
-
- Entrypoints:
|
|
72
|
+
- Entrypoints: `.ai/hooks`
|
|
72
73
|
- Allowed dependencies: Follow root `AGENTS.md` / `CLAUDE.md` and this local contract.
|
|
73
74
|
- Forbidden dependencies: Do not cross sibling app/service/package boundaries without an architecture snapshot or explicit plan.
|
|
74
|
-
- Runtime path:
|
|
75
|
+
- Runtime path: `.ai/hooks`
|
|
75
76
|
- LSP/tooling profile: `typescript-lsp`
|
|
76
77
|
- Verification: Use root required checks plus local commands recorded in this capability contract.
|
|
77
78
|
- Latest snapshot: `(none yet)`
|
|
78
|
-
-
|
|
79
|
-
-
|
|
79
|
+
- Semantic diagram source: `docs/architecture/modules/runtime-harness/hook-adapters.md`
|
|
80
|
+
- Latest human diagram: `(none yet)`
|
|
81
|
+
- Pending architecture request: `docs/architecture/requests/20260529-094446-ai-hooks-ai-hooks-session-start-context-sh.md`
|
|
80
82
|
|
|
81
83
|
## Active Workstreams
|
|
82
84
|
|
|
@@ -85,5 +87,6 @@ bash scripts/migrate-project-template.sh --repo . --dry-run
|
|
|
85
87
|
## Current Session Projection
|
|
86
88
|
|
|
87
89
|
- Durable progress lives under `tasks/workstreams/runtime-harness/hook-adapters`.
|
|
90
|
+
- `tasks/current.md` is the tracked derived status snapshot; it is not a live lock or task source.
|
|
88
91
|
- `tasks/todo.md` is the deferred-goal ledger; current execution slices stay in the active plan's `## Task Breakdown`.
|
|
89
92
|
<!-- END ARCHITECTURE CONTRACT -->
|
package/CLAUDE.md
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
#
|
|
1
|
+
# repo-harness AGENTS.md
|
|
2
2
|
|
|
3
|
-
This repository self-hosts the `
|
|
3
|
+
This repository self-hosts the `repo-harness` contract, formerly `repo-harness-skill` and `project-initializer`. Claude and Codex should follow the same repo-local workflow surface.
|
|
4
4
|
|
|
5
5
|
## Canonical Workflow Files
|
|
6
6
|
|
|
7
|
-
- `tasks/
|
|
7
|
+
- `tasks/current.md` for the tracked current-status snapshot derived from workflow artifacts
|
|
8
|
+
- `tasks/todo.md` for deferred medium/long-term goals, not active execution checklists
|
|
8
9
|
- `.ai/context/capabilities.json` for the capability registry and longest-prefix context boundaries
|
|
9
|
-
- `tasks/workstreams/` for capability long-running workstreams that project
|
|
10
|
+
- `tasks/workstreams/` for capability long-running workstreams that project durable progress into local contracts
|
|
10
11
|
- `tasks/lessons.md` for correction-derived rules
|
|
11
12
|
- `tasks/research.md` for deep repo knowledge
|
|
12
13
|
- `tasks/notes/` for task-local implementation decisions, deviations, tradeoffs, and open questions
|
|
@@ -21,7 +22,7 @@ This repository self-hosts the `agentic-dev` contract, formerly `agentic-dev-ski
|
|
|
21
22
|
|
|
22
23
|
- Sync `tasks/` whenever substantive repo changes are made.
|
|
23
24
|
- Use `tasks/notes/<slug>.notes.md` only for non-obvious slice decisions, deviations, tradeoffs, and open questions; do not use notes as durable memory or a task log, and archive/promote them deliberately when the slice closes.
|
|
24
|
-
- Treat `.ai/hooks/` as the shared hook implementation
|
|
25
|
+
- Treat `.ai/hooks/` as the shared repo-local hook implementation; user-level `~/.claude/settings.json` and `~/.codex/hooks.json` are the host adapters.
|
|
25
26
|
- Keep the umbrella hierarchy explicit: architecture owns stable truth, capability contracts own local agent context, `tasks/workstreams/<domain>/<capability>/` owns durable progress, and `tasks/todo.md` owns only deferred medium/long-term goals with tradeoff and revisit trigger.
|
|
26
27
|
- Treat `.ai/context/capabilities.json` as the source of truth for capability prefixes; `agent-context-blocks.txt` and nested agent files are compatibility inputs only.
|
|
27
28
|
- Keep architecture drift handling split: `architecture-drift.sh` writes architecture requests/events, `workstream-sync.sh` maintains durable capability workstreams, and `context-contract-sync.sh` only updates controlled local `CLAUDE.md`/`AGENTS.md` architecture blocks.
|
|
@@ -32,7 +33,7 @@ This repository self-hosts the `agentic-dev` contract, formerly `agentic-dev-ski
|
|
|
32
33
|
- Treat `deploy/` as the trackable deployment and operations surface for runbooks, submission materials, release checklists, helper scripts, ordered SQL files under `deploy/sql/`, and env examples.
|
|
33
34
|
- Treat `_ops/` as ignored local operations state for secrets, real env files, provider state, artifacts, logs, and scratch files; do not commit or agent-edit `_ops/*`.
|
|
34
35
|
- Treat contract-level task execution as worktree-first: `scripts/plan-to-todo.sh --plan <approved-plan>` starts `scripts/contract-worktree.sh start --plan <approved-plan>` when policy enables it, and completed blocks finish through Waza `/check` plus `scripts/contract-worktree.sh finish`.
|
|
35
|
-
- After Codex Plan mode, Waza `/think`, or `
|
|
36
|
+
- After Codex Plan mode, Waza `/think`, or `repo-harness-plan` produces a decision-complete plan, capture it with `scripts/capture-plan.sh --slug <slug> --title <title>` so `plans/` becomes the file-backed source of truth; if the user has already approved implementation, capture with `--status Approved --execute` or run `scripts/plan-to-todo.sh --plan <active-plan>`.
|
|
36
37
|
- If current repo state conflicts with the task, open an isolated `codex/<task-slug>` worktree, finish there, run Waza `/check`-style validation, then merge back to `main` without absorbing unrelated dirty changes.
|
|
37
38
|
- Route product discovery to gstack `office-hours`, complex engineering plans to gstack `plan-eng-review`, design plans to gstack `plan-design-review`, and daily small/medium planning, bug hunts, and checks to Waza `/think`, `/hunt`, and `/check`.
|
|
38
39
|
- Codex automation profile is runtime-referenced, not vendored: required skills are `health`, `check`, and `diagram-design` from `~/.codex/skills`.
|
|
@@ -41,7 +42,7 @@ This repository self-hosts the `agentic-dev` contract, formerly `agentic-dev-ski
|
|
|
41
42
|
- Treat Waza as Codex-first: `~/.codex/skills` is the Codex runtime source; `~/.agents/skills` is skills CLI staging/cache only. Update by staging upstream Waza, copying the eight managed `SKILL.md` files into Codex, and verifying with `cmp`.
|
|
42
43
|
- Use `docs/reference-configs/external-tooling.md` and `bash scripts/check-agent-tooling.sh --host both --check-updates` for environment checks; this self-host repo vendors CodeGraph as a dev dependency while generated downstream repos keep the global MCP default unless local policy opts in.
|
|
43
44
|
- When changing `scripts/migrate-project-template.sh` or `scripts/lib/project-init-lib.sh`, verify self-migration of this repo still works.
|
|
44
|
-
- Treat `.codex/hooks.json` as
|
|
45
|
+
- Treat repo-local `.claude/settings.json` and `.codex/hooks.json` hook adapters as retired legacy config; migration may back them up locally, but they are not product deliverables.
|
|
45
46
|
|
|
46
47
|
## Required Checks
|
|
47
48
|
|
|
@@ -57,26 +58,27 @@ bash scripts/migrate-project-template.sh --repo . --dry-run
|
|
|
57
58
|
<!-- BEGIN ARCHITECTURE CONTRACT -->
|
|
58
59
|
## Architecture Contract
|
|
59
60
|
|
|
60
|
-
- Functional block:
|
|
61
|
+
- Functional block: `.ai/hooks`
|
|
61
62
|
- Capability ID: `runtime-harness-hook-adapters`
|
|
62
|
-
- Matched prefix:
|
|
63
|
+
- Matched prefix: `.ai/hooks`
|
|
63
64
|
- Architecture domain: `runtime-harness`
|
|
64
65
|
- Architecture capability: `hook-adapters`
|
|
65
66
|
- Architecture module: `docs/architecture/modules/runtime-harness/hook-adapters.md`
|
|
66
|
-
- Last architecture event: 2026-05-
|
|
67
|
-
- Last changed path:
|
|
67
|
+
- Last architecture event: 2026-05-29T09:44:46+0800
|
|
68
|
+
- Last changed path: `.ai/hooks/session-start-context.sh`
|
|
68
69
|
- Severity: high
|
|
69
70
|
- Change type: workflow-surface
|
|
70
71
|
- Module responsibility: Keep this block aligned with the local boundary described by surrounding human-owned context.
|
|
71
|
-
- Entrypoints:
|
|
72
|
+
- Entrypoints: `.ai/hooks`
|
|
72
73
|
- Allowed dependencies: Follow root `AGENTS.md` / `CLAUDE.md` and this local contract.
|
|
73
74
|
- Forbidden dependencies: Do not cross sibling app/service/package boundaries without an architecture snapshot or explicit plan.
|
|
74
|
-
- Runtime path:
|
|
75
|
+
- Runtime path: `.ai/hooks`
|
|
75
76
|
- LSP/tooling profile: `typescript-lsp`
|
|
76
77
|
- Verification: Use root required checks plus local commands recorded in this capability contract.
|
|
77
78
|
- Latest snapshot: `(none yet)`
|
|
78
|
-
-
|
|
79
|
-
-
|
|
79
|
+
- Semantic diagram source: `docs/architecture/modules/runtime-harness/hook-adapters.md`
|
|
80
|
+
- Latest human diagram: `(none yet)`
|
|
81
|
+
- Pending architecture request: `docs/architecture/requests/20260529-094446-ai-hooks-ai-hooks-session-start-context-sh.md`
|
|
80
82
|
|
|
81
83
|
## Active Workstreams
|
|
82
84
|
|
|
@@ -85,5 +87,6 @@ bash scripts/migrate-project-template.sh --repo . --dry-run
|
|
|
85
87
|
## Current Session Projection
|
|
86
88
|
|
|
87
89
|
- Durable progress lives under `tasks/workstreams/runtime-harness/hook-adapters`.
|
|
90
|
+
- `tasks/current.md` is the tracked derived status snapshot; it is not a live lock or task source.
|
|
88
91
|
- `tasks/todo.md` is the deferred-goal ledger; current execution slices stay in the active plan's `## Task Breakdown`.
|
|
89
92
|
<!-- END ARCHITECTURE CONTRACT -->
|
package/README.md
CHANGED
|
@@ -1,16 +1,104 @@
|
|
|
1
|
-
#
|
|
1
|
+
# repo-harness
|
|
2
2
|
|
|
3
|
-
Repo-local agentic development harness skill for Claude/Codex
|
|
4
|
-
|
|
5
|
-
remains a compatibility alias, while `project-initializer`
|
|
6
|
-
retired and removed by installed-copy sync.
|
|
7
|
-
Repository: `https://github.com/Ancienttwo/
|
|
3
|
+
Repo-local agentic development harness CLI and skill runtime for Claude/Codex
|
|
4
|
+
workflows. The npm package and primary command are now `repo-harness`.
|
|
5
|
+
`repo-harness-skill` remains a compatibility alias, while `project-initializer`
|
|
6
|
+
install paths are retired and removed by installed-copy sync.
|
|
7
|
+
Repository: `https://github.com/Ancienttwo/repo-harness`
|
|
8
|
+
|
|
9
|
+
[English](README.md) | [简体中文](README.zh-CN.md)
|
|
8
10
|
|
|
9
11
|
This repository now dogfoods its own tasks-first contract. It is both:
|
|
10
12
|
|
|
11
|
-
- the source repo for the `
|
|
13
|
+
- the source repo for the `repo-harness` CLI and `repo-harness` skill runtime
|
|
12
14
|
- a self-hosted example of the repo-local workflow it generates for other projects
|
|
13
15
|
|
|
16
|
+
## What repo-harness Does
|
|
17
|
+
|
|
18
|
+
`repo-harness` turns AI-assisted development from chat-memory coordination into
|
|
19
|
+
repo-local workflow state. It installs a small, file-backed contract into a
|
|
20
|
+
target repository so Claude, Codex, and humans can agree on:
|
|
21
|
+
|
|
22
|
+
- what product intent is stable
|
|
23
|
+
- which plan is approved for execution
|
|
24
|
+
- what the current sprint contract allows
|
|
25
|
+
- which checks and review evidence prove the work is done
|
|
26
|
+
- how hooks should warn, block, trace, and hand off work across sessions
|
|
27
|
+
|
|
28
|
+
It is not an agent gateway, product runtime, database service, or MCP server.
|
|
29
|
+
The product boundary is deliberately boring: inspect a repo, install or refresh
|
|
30
|
+
workflow files, route host events through repo-local hooks, and verify that the
|
|
31
|
+
workflow surfaces stay consistent.
|
|
32
|
+
|
|
33
|
+
## How It Works
|
|
34
|
+
|
|
35
|
+
The design has three layers:
|
|
36
|
+
|
|
37
|
+
1. **Source package**: this repository owns the CLI, command skill facades,
|
|
38
|
+
templates, hook assets, workflow contract, tests, and release gate.
|
|
39
|
+
2. **Target repo contract**: `repo-harness init` or migration writes repo-local
|
|
40
|
+
files such as `docs/spec.md`, `plans/`, `tasks/`, `.ai/context/`,
|
|
41
|
+
`.ai/harness/`, helper scripts, and `.ai/hooks/`.
|
|
42
|
+
3. **Host adapters**: user-level `~/.claude/settings.json` and
|
|
43
|
+
`~/.codex/hooks.json` route Claude/Codex events into `repo-harness-hook`.
|
|
44
|
+
The hook entrypoint exits silently for non-opt-in repos and dispatches into
|
|
45
|
+
the current repo's `.ai/hooks/*` scripts only when
|
|
46
|
+
`.ai/harness/workflow-contract.json` exists.
|
|
47
|
+
|
|
48
|
+
The core invariant is that durable truth lives in the repo, not in a chat
|
|
49
|
+
thread. Hooks are accelerators and guardrails; the authority remains the
|
|
50
|
+
file-backed plan, contract, review, checks, and handoff artifacts.
|
|
51
|
+
|
|
52
|
+
## Task Workflow: Plan to Closeout
|
|
53
|
+
|
|
54
|
+
The diagram below assumes the harness is already installed in the repo. It shows
|
|
55
|
+
the normal task lifecycle: plan, project into a sprint contract, check out the
|
|
56
|
+
contract worktree when policy requires it, implement under hooks, verify, review,
|
|
57
|
+
and close out.
|
|
58
|
+
|
|
59
|
+
```mermaid
|
|
60
|
+
flowchart TD
|
|
61
|
+
UserTask["User task or planning prompt"] --> Discovery["Due diligence<br/>P1 map, P2 trace, P3 decision"]
|
|
62
|
+
Discovery --> PlanDraft["Draft plan<br/>plans/plan-*.md"]
|
|
63
|
+
PlanDraft --> PlanReview{"Plan ready for execution?"}
|
|
64
|
+
PlanReview -->|no| Refine["Refine plan, scope, evidence contract"]
|
|
65
|
+
Refine --> PlanDraft
|
|
66
|
+
PlanReview -->|yes| Approve["Approved plan<br/>Status: Approved"]
|
|
67
|
+
|
|
68
|
+
Approve --> Project["Project plan into execution<br/>capture-plan.sh --execute<br/>or plan-to-todo.sh --plan"]
|
|
69
|
+
Project --> Active["Active markers<br/>.ai/harness/active-plan<br/>.ai/harness/active-worktree"]
|
|
70
|
+
Project --> Contract["Sprint contract<br/>tasks/contracts/task-slug.contract.md"]
|
|
71
|
+
Project --> ReviewFile["Review file<br/>tasks/reviews/task-slug.review.md"]
|
|
72
|
+
Project --> Notes["Task notes<br/>tasks/notes/task-slug.notes.md"]
|
|
73
|
+
|
|
74
|
+
Contract --> WorktreePolicy{"Contract worktree required?"}
|
|
75
|
+
WorktreePolicy -->|yes| Checkout["Checkout isolated worktree<br/>contract-worktree.sh start --plan<br/>branch codex/task-slug"]
|
|
76
|
+
WorktreePolicy -->|no| CurrentTree["Use current worktree<br/>small or explicitly allowed slice"]
|
|
77
|
+
Checkout --> Implement
|
|
78
|
+
CurrentTree --> Implement
|
|
79
|
+
|
|
80
|
+
Implement["Edit and run commands"] --> PreHooks["Pre-edit guards<br/>PlanStatusGuard, ContractScopeGuard, WorktreeGuard"]
|
|
81
|
+
PreHooks -->|blocked| ScopeFix["Fix plan, contract, worktree, or scope"]
|
|
82
|
+
ScopeFix --> Implement
|
|
83
|
+
PreHooks -->|allowed| Changes["Code, docs, tests, or config changes"]
|
|
84
|
+
Changes --> PostHooks["Post-edit and post-bash hooks<br/>trace, drift request, handoff, check evidence"]
|
|
85
|
+
PostHooks --> Verify["Run verification<br/>tests plus repo workflow checks"]
|
|
86
|
+
|
|
87
|
+
Verify --> Checks["Structured evidence<br/>.ai/harness/checks/latest.json<br/>.ai/harness/runs/*.json"]
|
|
88
|
+
Checks --> CheckReview["Evaluator review<br/>Waza /check -> review file"]
|
|
89
|
+
CheckReview --> External["External acceptance advice<br/>or explicit manual override"]
|
|
90
|
+
External --> DoneGate{"Contract, checks, review, and acceptance pass?"}
|
|
91
|
+
DoneGate -->|no| Repair["Repair failing evidence or implementation"]
|
|
92
|
+
Repair --> Implement
|
|
93
|
+
DoneGate -->|yes| Closeout["Closeout<br/>scripts/contract-worktree.sh finish"]
|
|
94
|
+
|
|
95
|
+
Closeout --> Commit["Commit contract branch"]
|
|
96
|
+
Commit --> Merge["Fast-forward target branch"]
|
|
97
|
+
Merge --> Archive["Archive plan/todo and refresh handoff"]
|
|
98
|
+
Archive --> Cleanup["Cleanup merged worktree<br/>contract-worktree.sh cleanup"]
|
|
99
|
+
Cleanup --> Done["Reviewable completed task"]
|
|
100
|
+
```
|
|
101
|
+
|
|
14
102
|
## First 5 Minutes
|
|
15
103
|
|
|
16
104
|
This is the fastest path for an AI tooling owner evaluating whether the workflow is
|
|
@@ -22,26 +110,29 @@ safe to adopt in a real repo.
|
|
|
22
110
|
npx -y repo-harness init
|
|
23
111
|
```
|
|
24
112
|
|
|
25
|
-
The npm package
|
|
26
|
-
|
|
27
|
-
|
|
113
|
+
The npm package release line is `0.1.x`; generated workflow compatibility is
|
|
114
|
+
tracked separately as the `5.x` model line. The `0.1.2` package publishes the
|
|
115
|
+
renamed `repo-harness` CLI, user-level Claude/Codex hook adapter bootstrap,
|
|
116
|
+
Waza runtime skill sync, `diagram-design` sync, and the release gate used by
|
|
117
|
+
maintainers before npm publish. When working from a source checkout instead of
|
|
118
|
+
npm, run:
|
|
28
119
|
|
|
29
120
|
```bash
|
|
30
|
-
git clone https://github.com/Ancienttwo/
|
|
31
|
-
cd ~/Projects/
|
|
121
|
+
git clone https://github.com/Ancienttwo/repo-harness.git ~/Projects/repo-harness
|
|
122
|
+
cd ~/Projects/repo-harness
|
|
32
123
|
bun src/cli/index.ts init
|
|
33
124
|
```
|
|
34
125
|
|
|
35
126
|
Local path model:
|
|
36
127
|
|
|
37
|
-
- Source repo: `~/Projects/
|
|
38
|
-
- Claude skill aliases: `~/.claude/skills/
|
|
39
|
-
- Codex discoverable skill alias: `~/.codex/skills/
|
|
40
|
-
- Codex compatibility fallback alias: `~/.codex/skills/
|
|
128
|
+
- Source repo: `~/Projects/repo-harness`
|
|
129
|
+
- Claude skill aliases: `~/.claude/skills/repo-harness`, `~/.claude/skills/repo-harness-skill`
|
|
130
|
+
- Codex discoverable skill alias: `~/.codex/skills/repo-harness`
|
|
131
|
+
- Codex compatibility fallback alias: `~/.codex/skills/repo-harness-skill`
|
|
41
132
|
|
|
42
|
-
The `~/Projects/
|
|
133
|
+
The `~/Projects/repo-harness` repo is the only editable source of truth. Local
|
|
43
134
|
Claude/Codex paths are symlink-backed runtime entrypoints. Only
|
|
44
|
-
`~/.codex/skills/
|
|
135
|
+
`~/.codex/skills/repo-harness` should expose `SKILL.md` and
|
|
45
136
|
`assets/skill-commands/`; compatibility directories exist only so renamed
|
|
46
137
|
repos can still resolve upstream assets without duplicate command discovery.
|
|
47
138
|
The retired `project-initializer` directories under `~/.codex/skills` and
|
|
@@ -68,8 +159,8 @@ Apply only after the dry-run report looks correct:
|
|
|
68
159
|
npx -y repo-harness init
|
|
69
160
|
```
|
|
70
161
|
|
|
71
|
-
For a new project or module, use the `
|
|
72
|
-
an existing repo, use `
|
|
162
|
+
For a new project or module, use the `repo-harness-scaffold` command skill. For
|
|
163
|
+
an existing repo, use `repo-harness-init`; it installs or refreshes the harness
|
|
73
164
|
without creating an application stack.
|
|
74
165
|
|
|
75
166
|
### Success looks like this
|
|
@@ -77,9 +168,8 @@ without creating an application stack.
|
|
|
77
168
|
The command should end with `=== Migration Report ===` and summarize:
|
|
78
169
|
|
|
79
170
|
- `Project hooks synced from:` to show where generated hook behavior comes from
|
|
80
|
-
- `
|
|
81
|
-
- `
|
|
82
|
-
- `Codex hook trust required:` to remind the user to trust the repo hook in Codex Settings
|
|
171
|
+
- `Host hook config target: user-level ~/.claude/settings.json and ~/.codex/hooks.json` to show the adapter layer
|
|
172
|
+
- `Host hook adapters are user-level:` to remind the user to install global adapters and trust `~/.codex/hooks.json`
|
|
83
173
|
- `Workflow migration:` to show the repo-local harness surfaces it will create or refresh
|
|
84
174
|
- `Helper scripts:` to show the operational toolchain you get after apply
|
|
85
175
|
- `--- External Tooling ---` to show default gstack/Waza/gbrain routing plus advisory install/update hints
|
|
@@ -98,10 +188,11 @@ before applying anything.
|
|
|
98
188
|
## Hook Authority Map
|
|
99
189
|
|
|
100
190
|
- `.ai/hooks/` is the only shared hook implementation you should edit first.
|
|
101
|
-
-
|
|
102
|
-
-
|
|
103
|
-
-
|
|
104
|
-
-
|
|
191
|
+
- `~/.claude/settings.json` is the user-level Claude adapter that dispatches into opted-in repos.
|
|
192
|
+
- `~/.codex/hooks.json` is the user-level Codex adapter that dispatches into the same runner.
|
|
193
|
+
- Repo-local `.claude/settings.json` and `.codex/hooks.json` hook adapters are legacy project-level config and should be retired during migration.
|
|
194
|
+
- Codex must mark `~/.codex/hooks.json` as trusted in Codex Settings before those hooks run.
|
|
195
|
+
- Debug in this order: user-level adapter config -> `repo-harness-hook` (or fallback `repo-harness hook`) -> route registry -> `.ai/hooks/*`.
|
|
105
196
|
|
|
106
197
|
## Hook Failure Playbook
|
|
107
198
|
|
|
@@ -123,13 +214,19 @@ Most common guards:
|
|
|
123
214
|
|
|
124
215
|
- Root routing docs: `CLAUDE.md`, `AGENTS.md`
|
|
125
216
|
- Shared hook layer: `.ai/hooks/`
|
|
126
|
-
-
|
|
127
|
-
- Codex adapter layer: `.codex/hooks.json`
|
|
217
|
+
- User-level adapter layer: `~/.claude/settings.json`, `~/.codex/hooks.json`
|
|
128
218
|
- Active execution surface: `tasks/`
|
|
129
219
|
- Plan source of truth: `plans/`
|
|
130
220
|
- Durable progress: `tasks/workstreams/`
|
|
131
221
|
- Release history: `docs/CHANGELOG.md`
|
|
132
222
|
|
|
223
|
+
## Current Release
|
|
224
|
+
|
|
225
|
+
- npm package: `repo-harness@0.1.2`
|
|
226
|
+
- Generated workflow compatibility: `5.2.3`
|
|
227
|
+
- GitHub repository: `Ancienttwo/repo-harness`
|
|
228
|
+
- Release history: [`docs/CHANGELOG.md`](docs/CHANGELOG.md)
|
|
229
|
+
|
|
133
230
|
## Current Model (5.2.3)
|
|
134
231
|
|
|
135
232
|
- Question flow uses **12 grouped decision points** with harness defaults inferred first.
|
|
@@ -156,9 +253,9 @@ Most common guards:
|
|
|
156
253
|
- `complex -> gstack`
|
|
157
254
|
- `simple -> Waza` with Codex-first runtime copies in `~/.codex/skills`
|
|
158
255
|
- `knowledge -> gbrain`
|
|
159
|
-
- `
|
|
256
|
+
- `repo-harness init` bootstraps the Codex/Claude runtime pieces needed for the
|
|
160
257
|
default workflow:
|
|
161
|
-
- refreshes `
|
|
258
|
+
- refreshes `repo-harness` skill aliases
|
|
162
259
|
- installs global Codex/Claude hook adapters
|
|
163
260
|
- installs Waza skills (`check`, `design`, `health`, `hunt`, `learn`, `read`, `think`, `write`) through the skills CLI
|
|
164
261
|
- syncs `diagram-design` into Codex/Claude skill roots when a source copy exists
|
|
@@ -179,27 +276,27 @@ Source-owned command skill facades live in `assets/skill-commands/`. They keep
|
|
|
179
276
|
the public surface action-style while sharing the same router, contract, scripts,
|
|
180
277
|
and tests:
|
|
181
278
|
|
|
182
|
-
- Planning and review: `
|
|
183
|
-
- Repo workflow actions: `
|
|
184
|
-
- Project creation: `
|
|
279
|
+
- Planning and review: `repo-harness-plan`, `repo-harness-review`, `repo-harness-autoplan`
|
|
280
|
+
- Repo workflow actions: `repo-harness-init`, `repo-harness-migrate`, `repo-harness-upgrade`, `repo-harness-capability`, `repo-harness-architecture`, `repo-harness-handoff`, `repo-harness-deploy`, `repo-harness-repair`, `repo-harness-check`
|
|
281
|
+
- Project creation: `repo-harness-scaffold`
|
|
185
282
|
|
|
186
|
-
`
|
|
283
|
+
`repo-harness-init` is for an existing repo; `repo-harness-scaffold` creates a new
|
|
187
284
|
project or module scaffold. `hooks-init`, `docs-init`, and `create-project-dirs`
|
|
188
285
|
are internal steps, not public commands.
|
|
189
286
|
|
|
190
|
-
Use `
|
|
287
|
+
Use `repo-harness-capability` when the harness already exists and only selected
|
|
191
288
|
capability boundaries should be added. It updates `.ai/context/capabilities.json`,
|
|
192
289
|
syncs the requested local `AGENTS.md` / `CLAUDE.md` contract files, and validates
|
|
193
290
|
the registry without running a full init, migrate, or upgrade pass.
|
|
194
291
|
|
|
195
|
-
Use `
|
|
292
|
+
Use `repo-harness-architecture`, `repo-harness-handoff`, and `repo-harness-deploy`
|
|
196
293
|
for focused architecture documentation, rollover, and deploy/ops readiness
|
|
197
294
|
passes. These commands call existing repo-local helpers and keep their scope
|
|
198
295
|
narrow instead of refreshing the full harness.
|
|
199
296
|
|
|
200
|
-
Codex installed-copy rule: only `~/.codex/skills/
|
|
201
|
-
skill and `
|
|
202
|
-
`~/.codex/skills/
|
|
297
|
+
Codex installed-copy rule: only `~/.codex/skills/repo-harness` exposes the root
|
|
298
|
+
skill and `repo-harness-*` command facades. The compatibility directory
|
|
299
|
+
`~/.codex/skills/repo-harness-skill` is a runtime fallback bundle only; it must
|
|
203
300
|
not contain `SKILL.md` files or `assets/skill-commands/`. The retired
|
|
204
301
|
`~/.codex/skills/project-initializer` and `~/.claude/skills/project-initializer`
|
|
205
302
|
directories are removed during sync.
|