Skip to content

Commit 8d5d4e6

Browse files
committed
merge: integrate architecture runtime ownership and Agent guidance
2 parents cd9ad5c + 827368d commit 8d5d4e6

16 files changed

Lines changed: 1008 additions & 15 deletions
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
bun test v1.4.2 (744846f84)
2+
3+
tests/check-task-sync.test.ts:
4+
29 | });
5+
30 | }
6+
31 |
7+
32 | function reportedDigest(output: string): string {
8+
33 | const match = output.match(/sha256:[0-9a-f]{64}/u);
9+
34 | expect(match).not.toBeNull();
10+
^
11+
error: expect(received).not.toBeNull()
12+
13+
Received: null
14+
15+
at reportedDigest (/Users/kito/Projects/repo-harness-wt-architecture-agent-guidance/tests/check-task-sync.test.ts:34:21)
16+
at <anonymous> (/Users/kito/Projects/repo-harness-wt-architecture-agent-guidance/tests/check-task-sync.test.ts:77:22)
17+
(fail) check-task-sync helper > a blocked resolver exposes exact evidence binding and the next run recovers without ignoring its exit code [939.05ms]
18+
19+
0 pass
20+
33 filtered out
21+
1 fail
22+
9 expect() calls
23+
Ran 1 test across 1 file. [969.00ms]
24+
25+
PRE_FIX_EXIT=1

assets/reference-configs/external-tooling.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -960,6 +960,19 @@ candidate verification may explicitly select the candidate package root.
960960
Missing or mismatching runtime dependencies still fail closed with no target-repo
961961
fallback. Project model, ownership and snapshot checks remain repository-local.
962962

963+
SessionStart also gives the Agent read-only model coverage guidance under this
964+
global provider setting; no per-repo execution toggle is needed. It observes empty
965+
capability models, missing declared module documents, and tracked package roots
966+
with no capability match or a shared ancestor capability. These are bounded
967+
inspection prompts, not inferred semantic nodes. The Agent uses the
968+
`repo-harness-architecture` skill to inspect source evidence and decide boundaries
969+
within the authorized task, then creates nodes through archctx ChangeSets and
970+
runs the existing projection. An intentional umbrella is valid. Hooks do not
971+
write model YAML, and unrelated coverage findings remain advice. The manifest
972+
inventory is limited to Git-tracked `package.json` paths; this is not a complete
973+
semantic coverage audit for every language or untracked source tree. Inspection
974+
errors become SessionStart provider diagnostics instead of invented model facts.
975+
963976
When enabled, Stop observes the Git changed set and coalesces eligible paths
964977
into one durable projection job, excludes
965978
ArchContext-owned `docs/architecture/**` and declared agent-context targets,

assets/skill-commands/repo-harness-architecture/SKILL.md

Lines changed: 53 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
name: repo-harness-architecture
3-
description: Resolves repo-harness architecture drift requests and updates architecture docs or diagrams without running full init, migrate, or upgrade.
4-
when_to_use: "repo-harness-architecture, architecture drift, architecture doc, architecture diagram, update architecture index, resolve architecture request"
3+
description: Handles architecture coverage guidance, capability registration and drift requests through the existing model and projection authorities.
4+
when_to_use: "repo-harness-architecture, architecture drift, architecture doc, architecture diagram, architecture model guidance, register capability, update architecture index, resolve architecture request"
55
---
66

77
# repo-harness-architecture
@@ -12,7 +12,7 @@ architecture documentation, drift-request, or diagram pass.
1212
## Protocol
1313

1414
1. Confirm the target repo path and architecture scope.
15-
2. Inspect `docs/architecture/index.md` and pending files under `docs/architecture/requests/`.
15+
2. Inspect `docs/architecture/index.md`, `.archcontext/model/nodes/`, and pending files under `docs/architecture/requests/`. For architecture model guidance or a registration scope, follow the coverage procedure below even when no drift request exists.
1616
3. When the scope maps to repo code or config, resolve the capability with:
1717
- `repo-harness run capability-resolver match --repo <repo> --path <path> --format json`
1818
4. Update the smallest relevant architecture artifact:
@@ -28,9 +28,58 @@ architecture documentation, drift-request, or diagram pass.
2828
- `repo-harness run capability-resolver validate --repo <repo> --format text`
2929
- `repo-harness run check-task-workflow --strict` when repo workflow surfaces changed
3030

31+
## Coverage and Agent-owned registration
32+
33+
SessionStart automatically supplies read-only coverage observations when the global
34+
architecture provider is enabled and the repo selects `capability_source: archcontext`.
35+
An empty model, missing module docs, unmatched tracked package roots, or multiple
36+
packages sharing an ancestor capability are reasons to inspect, not proof that a new
37+
capability is required. Hooks do not decide responsibilities or write nodes.
38+
39+
1. Read the existing semantic architecture docs and trace the relevant entrypoints,
40+
dependencies, ownership and verification in source. Use CodeGraph when indexed.
41+
Compare `repo-harness run capability-resolver list --format json` and
42+
`repo-harness run capability-resolver match --path <source-path> --format json`.
43+
Package layout is inventory evidence; it does not establish semantic boundaries.
44+
2. Give a concrete recommendation: retain an intentional umbrella, create a justified
45+
capability, or restore a missing projection. Include source evidence, responsibility,
46+
proposed prefixes, overlap with existing nodes, contract paths and verification.
47+
Within already authorized architecture work, the Agent may decide and execute;
48+
do not ask for the same approval again. During unrelated work, keep this as advice.
49+
3. For a new capability, author a complete `archcontext.node/v2` body with an
50+
`id` of `capability.<domain>.<name>`, `kind: capability`, `status: active`, `name`,
51+
`summary`, `responsibilities`, `source.include`, and `extensions` containing
52+
`contractFiles.agents`, `contractFiles.claude`, `lspProfile`, and `verification`.
53+
Use the current model schema and source evidence; do not copy an example's semantics.
54+
4. Resolve the owned archctx executable from
55+
`repo-harness architecture-projection status --json` (`projectionProvider.binaryPath`).
56+
Require ready status and use that binary with its supported Node runtime in the
57+
target repo. Do not install a repo-local archctx or select an unrelated PATH copy.
58+
The following `archctx` notation means that resolved executable:
59+
60+
```text
61+
archctx plan --id <unique-changeset-id> --path .archcontext/model/nodes/capability.<domain>.<name>.yaml --expected-hash missing --body <complete-YAML-as-one-argument> --format json
62+
archctx apply --id <same-changeset-id> --approved --expected-worktree-digest <data.draft.base.worktreeDigest-from-plan> --format json
63+
```
64+
65+
Inspect the plan's full draft and preview before applying. Keep the same daemon
66+
and ChangeSet ID; pass body via a structured process argument, not shell interpolation.
67+
`--approved` records the authorized Agent decision; it does not grant extra scope.
68+
If the worktree changed, re-plan and re-inspect. In archctx 0.5.10 this public `plan`
69+
route creates one entity only. It is not an update route: when an existing node must
70+
change, report the required update and use a supported typed ChangeSet authoring
71+
surface if available; do not overwrite YAML or disguise an update as creation.
72+
5. Run `archctx validate --format json`, verify source matching with capability-resolver,
73+
then `repo-harness architecture-projection plan --json --changed-path <node-path>`
74+
and `repo-harness architecture-projection apply --json --changed-path <node-path>`.
75+
Verify the expected module document exists and run the protocol's architecture checks.
76+
Missing docs for an unchanged node need projection, not a duplicate node. Generated
77+
module regions belong to archctx; preserve human-owned prose. Resolve any resulting
78+
drift request through the normal request protocol.
79+
3180
## Failure Modes
3281

33-
- If no pending architecture request exists, report `no-change` and do not invent one.
82+
- If no pending architecture request exists, do not invent one. Coverage and registration work can proceed independently; report `no-change` only after inspecting the requested coverage scope.
3483
- If capability resolution is ambiguous, stop at the matching paths and ask for a narrower scope.
3584
- If `check-architecture-sync.sh` blocks in strict mode, resolve or archive the pending request card for the touched capability before finishing the worktree.
3685
- If diagram validation fails, fix the Mermaid Markdown source or report the validation failure; do not substitute HTML.

assets/templates/helpers/check-task-sync.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,11 @@ for file in "${changed_files[@]}"; do
356356
done
357357
if ! workflow_profile="$("${repo_harness_cli[@]}" state resolve --json --field workflow_profile --target-path "${profile_paths[@]}")"; then
358358
echo "[task-sync] Workflow profile resolution failed; no lite exemption admitted." >&2
359+
# Failed verification can itself block state resolution. Keep the failure,
360+
# but expose the exact binding consumed above so recovery needs no cache reset
361+
# or trust in a blocked resolver's profile field.
362+
echo "[task-sync] To satisfy task-sync, record the current diff in a changed canonical workflow artifact with this exact line:" >&2
363+
printf '> **Substantive Change SHA256**: `%s`\n' "$substantive_digest" >&2
359364
exit 1
360365
fi
361366
case "$workflow_profile" in

docs/architecture/.projection-manifest.json

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55
"sourceDigest": "sha256:b859983f97115344cb2d922ace1e8499d648eeca197ec66cf58b3775378e135d",
66
"provenance": {
77
"schemaVersion": "archcontext.architecture-docs-projection-provenance/v1",
8-
"baseHeadSha": "3f286554da41d162b31bbab7f6074a9445f3a413",
9-
"worktreeDigest": "sha256:c3280beaa6f2da5be639946261c624479085d0868b5e6dce8949ff5f0b590cc4",
10-
"sourceTreeDigest": "sha256:f817fb2ad55621758fd2061c83b60bda6b9981919d5985a631853c222873c3de",
8+
"baseHeadSha": "cd9ad5c64278f756bdad572b4f9616f2094d9047",
9+
"worktreeDigest": "sha256:f4074cd24184ffe906e2d6e334c170018511bd8b703bfe0dd34ed7b8f6070b79",
10+
"sourceTreeDigest": "sha256:dcee551d83782e235acfe1e58e90d13e3feb0fdddad8a41355f2dd3a46a8ede5",
1111
"modelDigest": "sha256:a11afbf16edf9e822bf02222d331beb8c050ef0b659ae605c23183193b10bbd5",
12-
"codeGraphDigest": "sha256:3155b860fd48cb6dcfdbac8e30a39ababbd5a276826b2e8f19650d1b5bca2a3f",
13-
"indexedWorktreeDigest": "sha256:0619e7e3883ff0f14586453364d7b9ffba18e6b10b2bb6b051c5894aab0b9314",
12+
"codeGraphDigest": "sha256:c9f5e7b631032475667f7e1bb5bbd39b9df762147b31122c2e72586ca9b349ee",
13+
"indexedWorktreeDigest": "sha256:931de978f90c7273324b8605bd9573fcca65cce57f1dd71a429a79f2197d4721",
1414
"rendererVersion": "archcontext.docs-renderer/v4",
1515
"layoutVersion": "archcontext.docs-layout/v1",
1616
"generatedFrom": {
@@ -19,9 +19,9 @@
1919
"codeGraphBinaryDigest": "sha256:e4be48573fdf16196ca0d2867be2790aa161534e9973dcb89bc70465100ea537",
2020
"codeGraphStatus": "ready"
2121
},
22-
"projectionInputDigest": "sha256:1beecfcbb376bc7a0cd26847e34c0959430ec87a530b53115adc3557030e7b0d"
22+
"projectionInputDigest": "sha256:80d51f9593ae0a6e6971398564582a39e977d13d2ab34bbc2f629b79b9552d72"
2323
},
24-
"projectionDigest": "sha256:cbb69b9b78ea604e0f3414dd0ec4d77a35c2ebaea0de07c419047c2510ec24b9",
24+
"projectionDigest": "sha256:83064d9423135d1a683185a2e696913fddf04cb2970654cfeea3ae4054413d3f",
2525
"semanticBaseline": {
2626
"semanticState": {
2727
"schemaVersion": "archcontext.architecture-semantic-state/v1",
@@ -709,12 +709,12 @@
709709
},
710710
"digests": {
711711
"modelDigest": "sha256:a11afbf16edf9e822bf02222d331beb8c050ef0b659ae605c23183193b10bbd5",
712-
"sourceTreeDigest": "sha256:f817fb2ad55621758fd2061c83b60bda6b9981919d5985a631853c222873c3de",
712+
"sourceTreeDigest": "sha256:dcee551d83782e235acfe1e58e90d13e3feb0fdddad8a41355f2dd3a46a8ede5",
713713
"flowProofDigest": "sha256:938dadfc988b732b6a67413ece104c062bb257ffd9f67caaf7db04dbc957b983",
714-
"projectionDigest": "sha256:cbb69b9b78ea604e0f3414dd0ec4d77a35c2ebaea0de07c419047c2510ec24b9"
714+
"projectionDigest": "sha256:83064d9423135d1a683185a2e696913fddf04cb2970654cfeea3ae4054413d3f"
715715
}
716716
},
717-
"receiptDigest": "sha256:a8751028a6de02ab9a1184e43b0cada9d5830bdbbd7395c31efc7db7f9bc2fa5",
717+
"receiptDigest": "sha256:2be80270e9a584aaea849cbf692196a1871dfbcd5e994016e8a6209ad8015924",
718718
"refreshSignalIds": [],
719719
"targetCount": 33,
720720
"fileCount": 33,

docs/reference-configs/external-tooling.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -960,6 +960,19 @@ candidate verification may explicitly select the candidate package root.
960960
Missing or mismatching runtime dependencies still fail closed with no target-repo
961961
fallback. Project model, ownership and snapshot checks remain repository-local.
962962

963+
SessionStart also gives the Agent read-only model coverage guidance under this
964+
global provider setting; no per-repo execution toggle is needed. It observes empty
965+
capability models, missing declared module documents, and tracked package roots
966+
with no capability match or a shared ancestor capability. These are bounded
967+
inspection prompts, not inferred semantic nodes. The Agent uses the
968+
`repo-harness-architecture` skill to inspect source evidence and decide boundaries
969+
within the authorized task, then creates nodes through archctx ChangeSets and
970+
runs the existing projection. An intentional umbrella is valid. Hooks do not
971+
write model YAML, and unrelated coverage findings remain advice. The manifest
972+
inventory is limited to Git-tracked `package.json` paths; this is not a complete
973+
semantic coverage audit for every language or untracked source tree. Inspection
974+
errors become SessionStart provider diagnostics instead of invented model facts.
975+
963976
When enabled, Stop observes the Git changed set and coalesces eligible paths
964977
into one durable projection job, excludes
965978
ArchContext-owned `docs/architecture/**` and declared agent-context targets,

0 commit comments

Comments
 (0)