nawabari 0.10.3 → 0.12.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.
Files changed (260) hide show
  1. package/README.md +110 -29
  2. package/dist/cli-command-registry.d.ts +1102 -2
  3. package/dist/cli-command-registry.js +262 -4
  4. package/dist/cli-command-registry.js.map +1 -1
  5. package/dist/cli.d.ts +25 -11
  6. package/dist/cli.js +717 -134
  7. package/dist/cli.js.map +1 -1
  8. package/dist/contract.d.ts +6 -0
  9. package/dist/contract.js +294 -7
  10. package/dist/contract.js.map +1 -1
  11. package/dist/coordination-admission.d.ts +1 -0
  12. package/dist/coordination-admission.js +2 -0
  13. package/dist/coordination-admission.js.map +1 -0
  14. package/dist/coordination-preview.d.ts +107 -0
  15. package/dist/coordination-preview.js +401 -0
  16. package/dist/coordination-preview.js.map +1 -0
  17. package/dist/coordination-transactions.d.ts +131 -0
  18. package/dist/coordination-transactions.js +538 -0
  19. package/dist/coordination-transactions.js.map +1 -0
  20. package/dist/domain/auxiliary-state-policy.d.ts +98 -0
  21. package/dist/domain/auxiliary-state-policy.js +545 -0
  22. package/dist/domain/auxiliary-state-policy.js.map +1 -0
  23. package/dist/domain/auxiliary-state-projection.d.ts +83 -0
  24. package/dist/domain/auxiliary-state-projection.js +265 -0
  25. package/dist/domain/auxiliary-state-projection.js.map +1 -0
  26. package/dist/domain/cgroups-v2.d.ts +40 -2
  27. package/dist/domain/cgroups-v2.js +128 -22
  28. package/dist/domain/cgroups-v2.js.map +1 -1
  29. package/dist/domain/errors.d.ts +2 -2
  30. package/dist/domain/errors.js +1 -0
  31. package/dist/domain/errors.js.map +1 -1
  32. package/dist/domain/fhs-development-runtime.d.ts +14 -1
  33. package/dist/domain/fhs-development-runtime.js +206 -8
  34. package/dist/domain/fhs-development-runtime.js.map +1 -1
  35. package/dist/domain/filesystem-enforcement-integration.d.ts +23 -0
  36. package/dist/domain/filesystem-enforcement-integration.js +34 -0
  37. package/dist/domain/filesystem-enforcement-integration.js.map +1 -0
  38. package/dist/domain/filesystem-policy-decision.d.ts +66 -0
  39. package/dist/domain/filesystem-policy-decision.js +203 -0
  40. package/dist/domain/filesystem-policy-decision.js.map +1 -0
  41. package/dist/domain/filesystem-policy-enforcement.d.ts +52 -0
  42. package/dist/domain/filesystem-policy-enforcement.js +340 -0
  43. package/dist/domain/filesystem-policy-enforcement.js.map +1 -0
  44. package/dist/domain/filesystem-policy-evidence.d.ts +128 -0
  45. package/dist/domain/filesystem-policy-evidence.js +791 -0
  46. package/dist/domain/filesystem-policy-evidence.js.map +1 -0
  47. package/dist/domain/filesystem-policy-materialization.d.ts +132 -0
  48. package/dist/domain/filesystem-policy-materialization.js +704 -0
  49. package/dist/domain/filesystem-policy-materialization.js.map +1 -0
  50. package/dist/domain/filesystem-policy-revision.d.ts +58 -0
  51. package/dist/domain/filesystem-policy-revision.js +199 -0
  52. package/dist/domain/filesystem-policy-revision.js.map +1 -0
  53. package/dist/domain/filesystem-policy.d.ts +146 -0
  54. package/dist/domain/filesystem-policy.js +942 -0
  55. package/dist/domain/filesystem-policy.js.map +1 -0
  56. package/dist/domain/landlock.d.ts +1 -0
  57. package/dist/domain/landlock.js +1 -1
  58. package/dist/domain/landlock.js.map +1 -1
  59. package/dist/domain/runtime-projection.d.ts +3 -0
  60. package/dist/domain/runtime-projection.js +10 -1
  61. package/dist/domain/runtime-projection.js.map +1 -1
  62. package/dist/domain/runtime-provider-declared.d.ts +98 -0
  63. package/dist/domain/runtime-provider-declared.js +416 -0
  64. package/dist/domain/runtime-provider-declared.js.map +1 -0
  65. package/dist/domain/runtime-resolution.d.ts +4 -0
  66. package/dist/domain/runtime-resolution.js +91 -1
  67. package/dist/domain/runtime-resolution.js.map +1 -1
  68. package/dist/domain/sandbox-launcher.d.ts +15 -2
  69. package/dist/domain/sandbox-launcher.js +514 -104
  70. package/dist/domain/sandbox-launcher.js.map +1 -1
  71. package/dist/domain/sandbox.d.ts +9 -1
  72. package/dist/domain/sandbox.js +46 -3
  73. package/dist/domain/sandbox.js.map +1 -1
  74. package/dist/domain/session-admission-decision.d.ts +67 -0
  75. package/dist/domain/session-admission-decision.js +200 -0
  76. package/dist/domain/session-admission-decision.js.map +1 -0
  77. package/dist/domain/session-backend.d.ts +40 -4
  78. package/dist/domain/session-backend.js +645 -36
  79. package/dist/domain/session-backend.js.map +1 -1
  80. package/dist/domain/session-bootstrap.d.ts +11 -0
  81. package/dist/domain/session-bootstrap.js +292 -0
  82. package/dist/domain/session-bootstrap.js.map +1 -0
  83. package/dist/domain/session-console.d.ts +119 -0
  84. package/dist/domain/session-console.js +600 -0
  85. package/dist/domain/session-console.js.map +1 -0
  86. package/dist/domain/session-environment.d.ts +114 -0
  87. package/dist/domain/session-environment.js +563 -0
  88. package/dist/domain/session-environment.js.map +1 -0
  89. package/dist/domain/session-execution-control.d.ts +114 -0
  90. package/dist/domain/session-execution-control.js +517 -0
  91. package/dist/domain/session-execution-control.js.map +1 -0
  92. package/dist/domain/session-execution-record.d.ts +163 -0
  93. package/dist/domain/session-execution-record.js +524 -0
  94. package/dist/domain/session-execution-record.js.map +1 -0
  95. package/dist/domain/session-git-hooks.d.ts +145 -0
  96. package/dist/domain/session-git-hooks.js +789 -0
  97. package/dist/domain/session-git-hooks.js.map +1 -0
  98. package/dist/domain/session-launch-supervisor-worker.d.ts +19 -0
  99. package/dist/domain/session-launch-supervisor-worker.js +261 -0
  100. package/dist/domain/session-launch-supervisor-worker.js.map +1 -0
  101. package/dist/domain/session-launch-supervisor.d.ts +142 -0
  102. package/dist/domain/session-launch-supervisor.js +591 -0
  103. package/dist/domain/session-launch-supervisor.js.map +1 -0
  104. package/dist/domain/session-process-observation.d.ts +84 -0
  105. package/dist/domain/session-process-observation.js +196 -0
  106. package/dist/domain/session-process-observation.js.map +1 -0
  107. package/dist/domain/session-protected-launch.d.ts +68 -0
  108. package/dist/domain/session-protected-launch.js +335 -0
  109. package/dist/domain/session-protected-launch.js.map +1 -0
  110. package/dist/domain/session-resource-accounting.d.ts +39 -0
  111. package/dist/domain/session-resource-accounting.js +183 -0
  112. package/dist/domain/session-resource-accounting.js.map +1 -0
  113. package/dist/domain/session.d.ts +151 -0
  114. package/dist/domain/session.js +3 -0
  115. package/dist/domain/session.js.map +1 -1
  116. package/dist/domain/shell-runtime.d.ts +22 -0
  117. package/dist/domain/shell-runtime.js +38 -0
  118. package/dist/domain/shell-runtime.js.map +1 -0
  119. package/dist/domain/working-set-runtime-projection.d.ts +29 -0
  120. package/dist/domain/working-set-runtime-projection.js +254 -0
  121. package/dist/domain/working-set-runtime-projection.js.map +1 -0
  122. package/dist/domain/worktree-file-operation-helper.d.ts +10 -0
  123. package/dist/domain/worktree-file-operation-helper.js +255 -0
  124. package/dist/domain/worktree-file-operation-helper.js.map +1 -0
  125. package/dist/domain/worktree-file-operation.d.ts +116 -0
  126. package/dist/domain/worktree-file-operation.js +529 -0
  127. package/dist/domain/worktree-file-operation.js.map +1 -0
  128. package/dist/domain/worktree-profile-builtins.d.ts +41 -0
  129. package/dist/domain/worktree-profile-builtins.js +239 -0
  130. package/dist/domain/worktree-profile-builtins.js.map +1 -0
  131. package/dist/domain/worktree-profile-catalog.d.ts +21 -0
  132. package/dist/domain/worktree-profile-catalog.js +163 -0
  133. package/dist/domain/worktree-profile-catalog.js.map +1 -0
  134. package/dist/domain/worktree-profile-inspection.d.ts +77 -0
  135. package/dist/domain/worktree-profile-inspection.js +114 -0
  136. package/dist/domain/worktree-profile-inspection.js.map +1 -0
  137. package/dist/domain/worktree-profile-overrides.d.ts +67 -0
  138. package/dist/domain/worktree-profile-overrides.js +685 -0
  139. package/dist/domain/worktree-profile-overrides.js.map +1 -0
  140. package/dist/domain/worktree-profile-pinning.d.ts +47 -0
  141. package/dist/domain/worktree-profile-pinning.js +96 -0
  142. package/dist/domain/worktree-profile-pinning.js.map +1 -0
  143. package/dist/domain/worktree-profile-runtime.d.ts +72 -0
  144. package/dist/domain/worktree-profile-runtime.js +221 -0
  145. package/dist/domain/worktree-profile-runtime.js.map +1 -0
  146. package/dist/domain/worktree-profile-scope.d.ts +54 -0
  147. package/dist/domain/worktree-profile-scope.js +285 -0
  148. package/dist/domain/worktree-profile-scope.js.map +1 -0
  149. package/dist/domain/worktree-runtime-profile.d.ts +99 -0
  150. package/dist/domain/worktree-runtime-profile.js +505 -0
  151. package/dist/domain/worktree-runtime-profile.js.map +1 -0
  152. package/dist/errors.d.ts +1 -1
  153. package/dist/errors.js.map +1 -1
  154. package/dist/failure-code-vocabulary.d.ts +7 -2
  155. package/dist/failure-code-vocabulary.js +85 -1
  156. package/dist/failure-code-vocabulary.js.map +1 -1
  157. package/dist/git.d.ts +2 -0
  158. package/dist/git.js +18 -0
  159. package/dist/git.js.map +1 -1
  160. package/dist/index.d.ts +2 -1
  161. package/dist/index.js +2 -0
  162. package/dist/index.js.map +1 -1
  163. package/dist/public-contract.d.ts +18 -0
  164. package/dist/public-contract.js +42 -0
  165. package/dist/public-contract.js.map +1 -1
  166. package/dist/public-state.d.ts +21 -0
  167. package/dist/public-state.js +25 -0
  168. package/dist/public-state.js.map +1 -1
  169. package/dist/registry/file-operation-record.d.ts +169 -0
  170. package/dist/registry/file-operation-record.js +634 -0
  171. package/dist/registry/file-operation-record.js.map +1 -0
  172. package/dist/registry/runtime-records.d.ts +59 -0
  173. package/dist/registry/runtime-records.js +426 -0
  174. package/dist/registry/runtime-records.js.map +1 -0
  175. package/dist/repository-runtime-observations.d.ts +56 -0
  176. package/dist/repository-runtime-observations.js +388 -0
  177. package/dist/repository-runtime-observations.js.map +1 -0
  178. package/dist/repository-runtime-snapshot.d.ts +52 -0
  179. package/dist/repository-runtime-snapshot.js +170 -0
  180. package/dist/repository-runtime-snapshot.js.map +1 -0
  181. package/dist/resource-claims.d.ts +31 -7
  182. package/dist/resource-claims.js +68 -15
  183. package/dist/resource-claims.js.map +1 -1
  184. package/dist/resource-coordination-cli.d.ts +9 -0
  185. package/dist/resource-coordination-cli.js +199 -0
  186. package/dist/resource-coordination-cli.js.map +1 -0
  187. package/dist/resource-coordination-evidence.d.ts +185 -0
  188. package/dist/resource-coordination-evidence.js +750 -0
  189. package/dist/resource-coordination-evidence.js.map +1 -0
  190. package/dist/resource-coordination-snapshot.d.ts +181 -0
  191. package/dist/resource-coordination-snapshot.js +433 -0
  192. package/dist/resource-coordination-snapshot.js.map +1 -0
  193. package/dist/resource-coordination-view.d.ts +60 -0
  194. package/dist/resource-coordination-view.js +342 -0
  195. package/dist/resource-coordination-view.js.map +1 -0
  196. package/dist/resource-coordination.d.ts +125 -0
  197. package/dist/resource-coordination.js +482 -0
  198. package/dist/resource-coordination.js.map +1 -0
  199. package/dist/resource-handoff-execution.d.ts +14 -0
  200. package/dist/resource-handoff-execution.js +111 -0
  201. package/dist/resource-handoff-execution.js.map +1 -0
  202. package/dist/resource-handoff.d.ts +172 -0
  203. package/dist/resource-handoff.js +576 -0
  204. package/dist/resource-handoff.js.map +1 -0
  205. package/dist/resource-merge-decision.d.ts +54 -0
  206. package/dist/resource-merge-decision.js +287 -0
  207. package/dist/resource-merge-decision.js.map +1 -0
  208. package/dist/resource-text-merge.d.ts +63 -0
  209. package/dist/resource-text-merge.js +254 -0
  210. package/dist/resource-text-merge.js.map +1 -0
  211. package/dist/session-attention.d.ts +41 -0
  212. package/dist/session-attention.js +226 -0
  213. package/dist/session-attention.js.map +1 -0
  214. package/dist/session-console-cli.d.ts +38 -0
  215. package/dist/session-console-cli.js +132 -0
  216. package/dist/session-console-cli.js.map +1 -0
  217. package/dist/session-lifecycle-actions.d.ts +14 -0
  218. package/dist/session-lifecycle-actions.js +15 -0
  219. package/dist/session-lifecycle-actions.js.map +1 -1
  220. package/dist/session-parking.d.ts +54 -0
  221. package/dist/session-parking.js +348 -0
  222. package/dist/session-parking.js.map +1 -0
  223. package/dist/session-registry.d.ts +332 -21
  224. package/dist/session-registry.js +2549 -100
  225. package/dist/session-registry.js.map +1 -1
  226. package/dist/session-retention.d.ts +211 -0
  227. package/dist/session-retention.js +428 -0
  228. package/dist/session-retention.js.map +1 -0
  229. package/dist/session-runtime-history.d.ts +26 -0
  230. package/dist/session-runtime-history.js +48 -0
  231. package/dist/session-runtime-history.js.map +1 -0
  232. package/dist/session-runtime-lifecycle.d.ts +142 -0
  233. package/dist/session-runtime-lifecycle.js +188 -0
  234. package/dist/session-runtime-lifecycle.js.map +1 -0
  235. package/dist/session-runtime-reconciliation.d.ts +22 -0
  236. package/dist/session-runtime-reconciliation.js +159 -0
  237. package/dist/session-runtime-reconciliation.js.map +1 -0
  238. package/dist/state/session/machine.d.ts +2 -2
  239. package/dist/ui/repository-screen.d.ts +59 -0
  240. package/dist/ui/repository-screen.js +323 -0
  241. package/dist/ui/repository-screen.js.map +1 -0
  242. package/dist/ui/repository-terminal.d.ts +42 -0
  243. package/dist/ui/repository-terminal.js +414 -0
  244. package/dist/ui/repository-terminal.js.map +1 -0
  245. package/dist/ui/session-actions.d.ts +77 -0
  246. package/dist/ui/session-actions.js +711 -0
  247. package/dist/ui/session-actions.js.map +1 -0
  248. package/dist/verification-executor.d.ts +78 -0
  249. package/dist/verification-executor.js +299 -0
  250. package/dist/verification-executor.js.map +1 -0
  251. package/dist/working-set.d.ts +160 -0
  252. package/dist/working-set.js +525 -0
  253. package/dist/working-set.js.map +1 -0
  254. package/dist/worktree-file-operation-cli.d.ts +68 -0
  255. package/dist/worktree-file-operation-cli.js +470 -0
  256. package/dist/worktree-file-operation-cli.js.map +1 -0
  257. package/dist/worktree-profile-cli.d.ts +105 -0
  258. package/dist/worktree-profile-cli.js +389 -0
  259. package/dist/worktree-profile-cli.js.map +1 -0
  260. package/package.json +7 -7
package/README.md CHANGED
@@ -1,3 +1,14 @@
1
+ <p align="center">
2
+ <img src="./docs/assets/readme/nawabari-hero.webp" alt="Nawabari — Git Worktree Isolation." width="100%">
3
+ </p>
4
+
5
+ <p align="center">
6
+ <a href="https://github.com/yohn-jp/nawabari/actions/workflows/ci.yml"><img alt="CI" src="https://github.com/yohn-jp/nawabari/actions/workflows/ci.yml/badge.svg"></a>
7
+ <a href="https://www.npmjs.com/package/nawabari"><img alt="npm" src="https://img.shields.io/npm/v/nawabari"></a>
8
+ <a href="https://www.npmjs.com/package/nawabari"><img alt="Node" src="https://img.shields.io/node/v/nawabari"></a>
9
+ <a href="./LICENSE"><img alt="License" src="https://img.shields.io/npm/l/nawabari"></a>
10
+ </p>
11
+
1
12
  # Nawabari
2
13
 
3
14
  Nawabari is a local governance layer for parallel coding agents. It gives each agent session an owned Git worktree and branch, records which repository resources that session may use, and checks those boundaries before governed mutations.
@@ -6,12 +17,17 @@ It is for teams and tools that need several agents to work in one repository wit
6
17
 
7
18
  This README describes the current 0.10.x product model. It is an overview and navigation surface, not a copy of generated contracts or implementation history.
8
19
 
9
- The product model is intentionally small:
20
+ The canonical routine-use workflow is one machine-authority path for both people
21
+ and agents:
10
22
 
11
- 1. Create a session. Nawabari provisions a dedicated worktree and branch.
12
- 2. Claim the resources the session is allowed to use.
13
- 3. Route governed work through claims, evidence, and mutation authorization.
14
- 4. Inspect the result, then close the session only when integration is proven.
23
+ 1. Create a managed session with explicit initial claims.
24
+ 2. Declare any required auxiliary repository-local state explicitly.
25
+ 3. Inspect the session and its claims.
26
+ 4. Run governed work and mutations through the claim and evidence surfaces.
27
+ 5. Handle claim conflicts from machine-readable evidence and typed lifecycle actions.
28
+ 6. Reconcile stale or inconsistent physical state through the canonical operation.
29
+ 7. Close or discard according to the lifecycle authority.
30
+ 8. Confirm convergence with `doctor` and garbage-collection observation.
15
31
 
16
32
  Nawabari governs operations routed through Nawabari. A normal governed session is an ownership and authorization boundary, not an operating-system or filesystem sandbox. A process with ambient filesystem permissions can still edit another worktree directly.
17
33
 
@@ -27,29 +43,52 @@ git nawabari --help
27
43
 
28
44
  The package installs both `nawabari` and `git-nawabari`; `git nawabari ...` works as Git's external subcommand.
29
45
 
30
- ## First session
46
+ ## Canonical routine-use workflow
31
47
 
32
- Run from the repository's integration worktree. `src/example.ts` below is a placeholder path; substitute a real file that exists in your repository.
48
+ Run from the repository's integration worktree. The following bootstrap uses the
49
+ same public option shape as the packed routine-use certification. Omit the
50
+ auxiliary declaration when the session needs no declared repository-local state;
51
+ do not replace it with an arbitrary host path.
33
52
 
34
53
  ```bash
35
54
  nawabari capabilities --json
36
-
37
- created=$(git nawabari session create --branch feature/example --json)
55
+ nawabari doctor --json
56
+
57
+ auxiliary_state='{"source":{"kind":"repository-local","path":".codegraph/ignored"},"target":{"kind":"managed-worktree","path":".codegraph/ignored"},"mode":"copy","durability":"durable"}'
58
+ created=$(git nawabari session create \
59
+ --branch feature/example \
60
+ --resource README.md --mode write \
61
+ --auxiliary-state "$auxiliary_state" \
62
+ --json)
38
63
  session_id=$(printf '%s' "$created" | jq -r .session_id)
39
64
  worktree=$(printf '%s' "$created" | jq -r .worktree)
40
65
 
41
- (cd "$worktree" && git nawabari session claim --session "$session_id" --resource src/example.ts --mode exclusive-write --json)
42
- (cd "$worktree" && git nawabari guard --session "$session_id" --operation source-write --resource src/example.ts --json)
43
- (cd "$worktree" && "$EDITOR" src/example.ts)
66
+ (cd "$worktree" && git nawabari session show --session "$session_id" --json)
67
+ (cd "$worktree" && git nawabari session claims --session "$session_id" --json)
68
+ (cd "$worktree" && git nawabari session inspect --session "$session_id" --schema-version 2 --json)
69
+
70
+ (cd "$worktree" && git nawabari session claim --session "$session_id" --resource contract-lifecycle.txt --mode exclusive-write --json)
71
+ (cd "$worktree" && git nawabari authorize --session "$session_id" --operation source-write --resource contract-lifecycle.txt --json)
72
+ (cd "$worktree" && "$EDITOR" contract-lifecycle.txt)
73
+ (cd "$worktree" && git nawabari evidence snapshot --session "$session_id" --json)
44
74
  (cd "$worktree" && git nawabari checkpoint --session "$session_id" --json)
45
- (cd "$worktree" && git nawabari commit --session "$session_id" --all-claimed --message "Update example" --json)
75
+ (cd "$worktree" && git nawabari commit --session "$session_id" --message "Exercise governed lifecycle" --resource contract-lifecycle.txt --json)
76
+ (cd "$worktree" && git nawabari push --session "$session_id" --remote origin --branch feature/example --resource contract-lifecycle.txt --create-upstream --json)
46
77
  ```
47
78
 
48
79
  `session create` provisions the new worktree under `<repository-parent>/.nawabari/worktrees` by default (discoverable via `status --json` as `managed_worktree_root`). Nawabari creates that managed subdirectory on first default placement. New exact `--worktree` paths must be under the reported root; an absolute path directly under the repository parent remains accepted for compatibility with older callers and persisted sessions.
49
80
 
81
+ The initial-claim grammar is `--resource <path-or-glob> --mode <read|write|exclusive-write>` and the pair may be repeated. Each resource is paired with its own mode. The parser also permits zero pairs for backward compatibility, but the canonical routine path declares at least one initial claim. Initial claims are committed atomically with the new session, worktree, and branch. A conflict returns a machine-readable failure such as `RESOURCE_CLAIM_CONFLICT` and does not leave a partially established session or claim set.
82
+
83
+ Resource-claim enforcement is disabled by default for a new session: `commit`/`push` authorization does not require the session to hold a resource claim for its own session-owned operations. Pass `--enforce-claims` to `session create` to opt that session into the previous claim-authorization behavior, including `MISSING_RESOURCE_CLAIM`/`INSUFFICIENT_CLAIM_MODE` denials and existing claim-mode compatibility rules. Worktree ownership, branch ownership, and `RESOURCE_CLAIM_CONFLICT` protection against another session's active claim remain enforced either way.
84
+
85
+ The packed auxiliary-state declaration above is the bounded `copy` form: a `repository-local` source is copied to a `managed-worktree` target with `durability: durable`. It is an explicit, repeatable, allowlisted capability. It does not discover ignored state, project process-local sockets/PID files/logs, shadow Git-tracked paths, or expose arbitrary host filesystem paths. Auxiliary-state projection is separate from `SessionRuntimeProjection`: the former copies declared repository-local durable state for a managed worktree; the latter describes explicit runtime material and filesystem visibility for protected execution. Auxiliary state does not change the runtime projection.
86
+
87
+ The create operation is atomic, but a caller must treat an uncertain result carefully. If JSON reports `REGISTRY_DURABILITY_UNCERTAIN`, re-read the reported session and claims before retrying. If the exact original declaration is already present, follow `bootstrap_retry.next_action: inspect-established-session` and inspect that `session_id`; if another declaration owns the worktree or branch, follow `bootstrap_retry.next_action: inspect-blocking-session`. Nawabari never silently adopts an existing owner. A retry is appropriate only after the authoritative state proves that the requested bootstrap was not established.
88
+
50
89
  `--all-claimed` is an explicit resource selector. It resolves safely observed Git-changed paths covered by qualifying claims; it does not bypass claim authorization. Use repeated `--resource <path>` when an explicit path list is preferable.
51
90
 
52
- After reviewing and integrating the session branch:
91
+ After reviewing and integrating the session branch through the caller's normal local Git/provider process:
53
92
 
54
93
  ```bash
55
94
  git nawabari session inspect --session "$session_id" --json
@@ -58,34 +97,68 @@ git nawabari session close --session "$session_id" --json
58
97
 
59
98
  Close is conservative. Unintegrated commits, dirty worktrees, ambiguous Git state, and ownership mismatches remain blocked. For a squash or rebase merge, pass an exact local `--integrated-revision <rev>` so Nawabari can independently re-verify the content.
60
99
 
100
+ If the lifecycle result exposes a recoverable blocker, follow its typed `next_action`/`next_actions` entry. `reconcile-physical-state` is the non-mutating observation action (its command is `doctor`). Its explicit apply action is `reconcile-physical-state-apply`, and its exact command is:
101
+
102
+ ```bash
103
+ git nawabari session reconcile --session "$owner_session_id" --apply --json
104
+ ```
105
+
106
+ The session ID must be the blocking owner reported by the machine result. A successful apply returns `operation: "reconcile-apply"`, `action.action_id: "reconcile-physical-state-apply"`, and a completed outcome; the owner is terminalized and its claims are released only when the existing lifecycle and physical-state evidence authorizes that transition. Retry the blocked claim only after this result succeeds.
107
+
108
+ After every session reaches its terminal lifecycle result, confirm convergence from
109
+ the repository integration worktree:
110
+
111
+ ```bash
112
+ git nawabari gc --dry-run --json
113
+ git nawabari doctor --json
114
+ ```
115
+
61
116
  ## Authority model
62
117
 
63
118
  Each boundary has one job and one local authority. README summarizes the product contract; executable code and machine-readable projections remain authoritative for exact schemas, transitions, and failure vocabularies.
64
119
 
65
- | Boundary | What it answers | Typical commands |
66
- | ---------------------- | ------------------------------------------------------------------------------------ | ---------------------------------------------------------------------- |
67
- | Session lifecycle | Which session owns a worktree/branch and whether it can safely progress or terminate | `session create`, `session inspect`, `session close` |
68
- | Resource Claims | Which session may access a canonical repository resource and at what mode | `session claim`, `session claims`, `session update`, `session release` |
69
- | Mutation authorization | Whether a concrete operation has sufficient claims and no conflicting owner | `guard`, `authorize`, `commit`, `push` |
70
- | Repository evidence | What Git can observe about revisions, paths, changes, ancestry, and bounded diffs | `checkpoint`, `evidence snapshot`, `diff` |
71
- | Protected execution | Whether a command runs inside the opt-in Linux process/filesystem boundary | `session run`, `session exec`, `session shell`, `doctor` |
120
+ | Boundary | What it answers | Typical commands |
121
+ | ---------------------- | -------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------- |
122
+ | Session lifecycle | Which session owns a worktree/branch and whether it can safely progress or terminate | `session create`, `session inspect`, `session close` |
123
+ | Resource Claims | Which session may access a canonical repository resource and at what mode | `session claim`, `session claims`, `session update`, `session release` |
124
+ | Mutation authorization | Whether a concrete operation has sufficient claims and no conflicting owner | `guard`, `authorize`, `commit`, `push` |
125
+ | Repository evidence | What Git can observe about revisions, paths, changes, ancestry, and bounded diffs | `checkpoint`, `evidence snapshot`, `diff` |
126
+ | Auxiliary state | Whether explicitly declared durable repository-local state may be copied into the managed worktree | `session create --auxiliary-state`, `capabilities` |
127
+ | Reconciliation/cleanup | Whether observed physical state permits a lifecycle recovery or cleanup action | `session inspect`, `session reconcile`, `doctor`, `gc` |
128
+ | Protected execution | Whether a command runs inside the opt-in Linux process/filesystem boundary | `session run`, `session exec`, `session shell`, `doctor` |
72
129
 
73
130
  Claims are not task labels and do not encode GitHub or agent semantics. `write` permits ordinary path changes; `exclusive-write` is required for finalizing operations such as commit and push. Conflicting or ambiguous claims fail closed.
74
131
 
75
132
  The default governance path does not install hooks and does not prevent direct filesystem writes outside Nawabari. Its guarantee is that Nawabari-routed operations consult authoritative session, Git, and claim state before mutation.
76
133
 
134
+ Nawabari's authority ends at local session ownership, claims, Git evidence, and the lifecycle of the managed worktree and branch. Task meaning, Issue/PR state, review decisions, and provider/GitHub state remain outside that authority.
135
+
136
+ ### Claim conflict and physical recovery
137
+
138
+ `RESOURCE_CLAIM_CONFLICT` does not always mean stale state. A healthy owner is reported with `ownerState: "active"`; the certified contention path exposes `inspect-blocking-session` and `wait-for-conflicting-claim-release` safe actions without a reconciliation `nextAction`. Inspect the owner and wait for the legitimate claim release; do not remove another session's claim.
139
+
140
+ For a stale or inconsistent owner, the machine result instead carries physical and lifecycle evidence such as `ownerPhysicalState: "prunable-missing"`, `ownerLifecycleState: "stale-inconsistent"`, and the typed `nextAction.actionId: "reconcile-physical-state"`. Inspect it first:
141
+
142
+ ```bash
143
+ git nawabari session inspect --session "$owner_session_id" --schema-version 2 --json
144
+ ```
145
+
146
+ Then use the explicit apply operation shown above and retry the original claim after it completes. Age or a missing path alone is not destructive authority. The packed test removes a worktree only as external fault injection; supported recovery does not involve editing the session registry manually or deleting a raw Git worktree.
147
+
77
148
  ## Session and resource lifecycle
78
149
 
79
150
  The normal path is:
80
151
 
81
152
  ```text
82
- session create
153
+ session create (explicit initial claims)
83
154
  ↓
84
- active session → claim resources → guard/checkpoint → commit or push
155
+ inspect session/claims → claim/authorize → checkpoint → commit or push
85
156
  ↓ ↓
86
157
  inspect readiness integrate the branch
87
158
  ↓ ↓
88
- session close ←────────────────────────────────────┘
159
+ session close or discard ←─────────────────────────┘
160
+ ↓
161
+ doctor + gc --dry-run convergence check
89
162
  ```
90
163
 
91
164
  If work is not integrated, `session inspect` reports bounded blockers and safe next actions. Discard is never an implicit fallback for close or garbage collection.
@@ -94,7 +167,7 @@ The Session lifecycle is backed by the executable XState authority in 0.10.x and
94
167
 
95
168
  ### Claims
96
169
 
97
- Claims are canonical repository-relative resource records attached to a session. Supported modes are `read`, `write`, and `exclusive-write`.
170
+ Claims are canonical repository-relative resource records attached to a session. Supported modes are `read`, `write`, and `exclusive-write`. The canonical routine path establishes its first claim during `session create`; later additions, transitions, and releases use the existing claim surfaces.
98
171
 
99
172
  ```bash
100
173
  git nawabari session claim --session "$session_id" --resource src/example.ts --mode exclusive-write --json
@@ -115,7 +188,7 @@ The policy requires `exclusive-write` for operations that finalize or remove sha
115
188
 
116
189
  ### Inspect, close, discard, and garbage collection
117
190
 
118
- `session inspect` is read-only and uses the same close/cleanup evidence as `session close`.
191
+ `session inspect` is read-only and uses the same close/cleanup evidence as `session close`. Use `--schema-version 2` when consuming the single-authority lifecycle and action projection.
119
192
 
120
193
  ```bash
121
194
  git nawabari session inspect --session "$session_id" --json
@@ -124,7 +197,11 @@ git nawabari session discard --session "$session_id" --preview --json
124
197
 
125
198
  `session discard` requires an explicit session ID and may destroy unintegrated commits and uncommitted work in that session's worktree. Preview reports bounded destructive scope without mutation. Actual discard revalidates repository, worktree, branch, `HEAD`, and registry ownership before destructive steps.
126
199
 
127
- `gc --dry-run` reports stale candidates and blockers. `gc --apply` only cleans candidates passing the same safety checks; elapsed age alone is not destructive authority. `doctor` reports prerequisite and reconciliation state without silently repairing ownership.
200
+ When the caller intentionally abandons the session, apply that explicit
201
+ decision with `git nawabari session discard --session "$session_id" --json`.
202
+ Discard is not an automatic fallback for a blocked close.
203
+
204
+ `gc --dry-run` reports stale candidates and blockers. `gc --apply` only cleans candidates passing the same safety checks; elapsed age alone is diagnostic suspicion, not destructive authority. `doctor` reports prerequisite and reconciliation state without silently repairing ownership. Use the typed lifecycle action and explicit `session reconcile` operation for supported stale/inconsistent-owner recovery; `doctor` does not silently repair it.
128
205
 
129
206
  ## Governed Git work
130
207
 
@@ -172,14 +249,18 @@ The installed CLI is the primary integration surface. Discover its contract rath
172
249
  nawabari capabilities --json
173
250
  nawabari --version --json
174
251
  nawabari session create --help --json
252
+ nawabari session inspect --help --json
253
+ nawabari session reconcile --help --json
175
254
  nawabari commit --help --json
176
255
  ```
177
256
 
178
- `capabilities --json` works without a Git repository. The top-level contract is `nawabari.standalone-execution.v1`, schema version `1`; Resource Claim meaning is separately versioned as `nawabari.resource-claims.v2`. Package version alone is not a compatibility decision.
257
+ `capabilities --json` works without a Git repository. The top-level contract is `nawabari.standalone-execution.v1`, schema version `1`; Resource Claim meaning is separately versioned as `nawabari.resource-claims.v2`. Package version alone is not a compatibility decision. The capability projection publishes the initial-claim grammar and retry vocabulary, auxiliary-state contract, lifecycle action IDs, and the `session reconcile --session <id> --apply` apply arguments used above.
179
258
 
180
259
  JSON mode emits one bounded document on stdout. Consumers should use machine-readable fields and stable codes rather than parse human-oriented text.
181
260
 
182
- The command surface includes Session lifecycle, Resource Claims, authorization/evidence, governed Git commit/push, reconciliation/discovery, and protected execution. Use `--help --json` and `capabilities --json` for the authoritative inventory.
261
+ The command surface includes Session lifecycle, Resource Claims, authorization/evidence, governed Git commit/push, reconciliation/discovery, and protected execution. Use `--help --json` and `capabilities --json` for the authoritative inventory. Human-readable guidance and agent integrations use these same command and action identifiers; there is no separate human or agent workflow.
262
+
263
+ `src/cli-command-registry.ts` is the single canonical authority for that surface: every command/option name is a `CommandId`/`OptionId` literal type derived directly from the registry data (not hand-typed), and `--help`, `capabilities`, and the executable dispatcher's own accepted-flag parsing all read that same data. There is no second command or option table to keep in sync.
183
264
 
184
265
  ## Stable package exports
185
266