llm-wb 0.1.0-beta.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 (170) hide show
  1. package/.agentic/00.chat/README.md +78 -0
  2. package/.agentic/00.chat/checklists/before-commit.md +195 -0
  3. package/.agentic/00.chat/checklists/llm-workbench-public-beta.md +94 -0
  4. package/.agentic/00.chat/commands/README.md +108 -0
  5. package/.agentic/00.chat/migration-plan.md +132 -0
  6. package/.agentic/00.chat/skills/session-summary.md +48 -0
  7. package/.agentic/00.chat/standards/llm-workbench-public-beta-contract.md +216 -0
  8. package/.agentic/00.chat/standards/main-refresh-conflict-types.md +358 -0
  9. package/.agentic/00.chat/workflows/README.md +40 -0
  10. package/.agentic/00.chat/workflows/bootstrap-chat-workbench-repo.md +212 -0
  11. package/.agentic/00.chat/workflows/chat-cleanup.md +102 -0
  12. package/.agentic/00.chat/workflows/chat-commit.md +56 -0
  13. package/.agentic/00.chat/workflows/chat-promote-to-main.md +169 -0
  14. package/.agentic/00.chat/workflows/chat-refresh-from-main.md +242 -0
  15. package/.agentic/00.chat/workflows/chat-reporting.md +69 -0
  16. package/.agentic/00.chat/workflows/chat-start.md +173 -0
  17. package/.agentic/00.chat/workflows/chat-upstream-reusable-lesson.md +123 -0
  18. package/.agentic/shared/standards/README.md +32 -0
  19. package/.agentic/shared/standards/upstream-repo-bootstrap.md +131 -0
  20. package/.agentic/shared/workflows/README.md +35 -0
  21. package/.agentic/shared/workflows/capability-resolution-workflow.md +189 -0
  22. package/.agentic/shared/workflows/change-shared-process.md +92 -0
  23. package/.cursor/rules/llm-workbench.mdc +17 -0
  24. package/.github/copilot-instructions.md +16 -0
  25. package/AGENTS.md +63 -0
  26. package/CLAUDE.md +16 -0
  27. package/CONTRIBUTING.md +57 -0
  28. package/LICENSE +21 -0
  29. package/LLM_WORKBENCH.md +17 -0
  30. package/README.md +98 -0
  31. package/SECURITY.md +44 -0
  32. package/bin/llm-workbench.js +672 -0
  33. package/docs/00.chat/README.md +47 -0
  34. package/docs/00.chat/llm-workbench-acceptance-matrix.md +55 -0
  35. package/docs/00.chat/script-layout.md +107 -0
  36. package/docs/adapting-to-your-repo.md +29 -0
  37. package/docs/concepts.md +38 -0
  38. package/docs/install.md +114 -0
  39. package/docs/public-beta-contract.md +45 -0
  40. package/docs/workflows.md +103 -0
  41. package/examples/minimal-repo/README.md +13 -0
  42. package/package.json +93 -0
  43. package/scripts/00.chat/README.md +46 -0
  44. package/scripts/00.chat/bootstrap/README.md +35 -0
  45. package/scripts/00.chat/bootstrap/audit-chat-bootstrap-file-set/README.md +39 -0
  46. package/scripts/00.chat/bootstrap/audit-chat-bootstrap-file-set/script.sh +213 -0
  47. package/scripts/00.chat/closeout/README.md +30 -0
  48. package/scripts/00.chat/closeout/build-closeout-prompt/README.md +35 -0
  49. package/scripts/00.chat/closeout/build-closeout-prompt/script.sh +124 -0
  50. package/scripts/00.chat/command/README.md +31 -0
  51. package/scripts/00.chat/command/close/README.md +30 -0
  52. package/scripts/00.chat/command/close/script.sh +25 -0
  53. package/scripts/00.chat/command/dispatcher/README.md +46 -0
  54. package/scripts/00.chat/command/dispatcher/script.sh +91 -0
  55. package/scripts/00.chat/command/dispatcher/smoke-test.sh +168 -0
  56. package/scripts/00.chat/command/new/README.md +32 -0
  57. package/scripts/00.chat/command/new/script.sh +28 -0
  58. package/scripts/00.chat/command/open-window/README.md +38 -0
  59. package/scripts/00.chat/command/open-window/script.sh +25 -0
  60. package/scripts/00.chat/command/package-scripts/README.md +34 -0
  61. package/scripts/00.chat/command/package-scripts/smoke-test.sh +113 -0
  62. package/scripts/00.chat/git/README.md +30 -0
  63. package/scripts/00.chat/git/cleanup-empty-chat-branches/README.md +36 -0
  64. package/scripts/00.chat/git/cleanup-empty-chat-branches/script.sh +243 -0
  65. package/scripts/00.chat/git/cleanup-empty-chat-branches/smoke-test.sh +136 -0
  66. package/scripts/00.chat/local-merge/README.md +30 -0
  67. package/scripts/00.chat/local-merge/list-active-chat-branches/README.md +29 -0
  68. package/scripts/00.chat/local-merge/list-active-chat-branches/script.sh +109 -0
  69. package/scripts/00.chat/local-merge/report-chat-branch-overlaps/README.md +29 -0
  70. package/scripts/00.chat/local-merge/report-chat-branch-overlaps/script.sh +142 -0
  71. package/scripts/00.chat/local-merge/verify-chat-ready-to-merge-local-main/README.md +33 -0
  72. package/scripts/00.chat/local-merge/verify-chat-ready-to-merge-local-main/script.sh +345 -0
  73. package/scripts/00.chat/local-merge/verify-chat-ready-to-merge-local-main/smoke-test.sh +244 -0
  74. package/scripts/00.chat/main-refresh/README.md +39 -0
  75. package/scripts/00.chat/main-refresh/apply-rehearsed-refresh/README.md +32 -0
  76. package/scripts/00.chat/main-refresh/apply-rehearsed-refresh/script.sh +198 -0
  77. package/scripts/00.chat/main-refresh/check-chat-is-current-with-main/README.md +30 -0
  78. package/scripts/00.chat/main-refresh/check-chat-is-current-with-main/script.sh +121 -0
  79. package/scripts/00.chat/main-refresh/classify-conflict/README.md +39 -0
  80. package/scripts/00.chat/main-refresh/classify-conflict/script.sh +169 -0
  81. package/scripts/00.chat/main-refresh/classify-conflict/smoke-test.sh +137 -0
  82. package/scripts/00.chat/main-refresh/classify-refresh-readiness/README.md +35 -0
  83. package/scripts/00.chat/main-refresh/classify-refresh-readiness/script.sh +171 -0
  84. package/scripts/00.chat/main-refresh/classify-refresh-readiness/smoke-test.sh +132 -0
  85. package/scripts/00.chat/main-refresh/rehearse-refresh-from-main/README.md +34 -0
  86. package/scripts/00.chat/main-refresh/rehearse-refresh-from-main/script.sh +124 -0
  87. package/scripts/00.chat/main-refresh/rehearse-refresh-from-main/smoke-test.sh +257 -0
  88. package/scripts/00.chat/main-refresh/show-main-update-status/README.md +31 -0
  89. package/scripts/00.chat/main-refresh/show-main-update-status/script.sh +73 -0
  90. package/scripts/00.chat/main-refresh/verify-conflict-audit/README.md +37 -0
  91. package/scripts/00.chat/main-refresh/verify-conflict-audit/script.sh +154 -0
  92. package/scripts/00.chat/main-refresh/verify-conflict-audit/smoke-test.sh +99 -0
  93. package/scripts/00.chat/metrics/README.md +35 -0
  94. package/scripts/00.chat/metrics/data/chat-pricing.json +107 -0
  95. package/scripts/00.chat/metrics/data/chat-pricing.schema.json +63 -0
  96. package/scripts/00.chat/metrics/estimate-chat-cost/README.md +40 -0
  97. package/scripts/00.chat/metrics/estimate-chat-cost/script.js +130 -0
  98. package/scripts/00.chat/migration/README.md +30 -0
  99. package/scripts/00.chat/migration/audit-chat-layer-migration/README.md +33 -0
  100. package/scripts/00.chat/migration/audit-chat-layer-migration/script.sh +127 -0
  101. package/scripts/00.chat/recovery/README.md +30 -0
  102. package/scripts/00.chat/recovery/import-active-paths-to-chat-worktree/README.md +76 -0
  103. package/scripts/00.chat/recovery/import-active-paths-to-chat-worktree/script.sh +212 -0
  104. package/scripts/00.chat/recovery/import-active-paths-to-chat-worktree/smoke-test.sh +162 -0
  105. package/scripts/00.chat/reporting/README.md +30 -0
  106. package/scripts/00.chat/reporting/generate-commit-log-summary/README.md +35 -0
  107. package/scripts/00.chat/reporting/generate-commit-log-summary/script.sh +299 -0
  108. package/scripts/00.chat/reporting/generate-commit-log-summary/smoke-test.sh +93 -0
  109. package/scripts/00.chat/reporting/report-chat-workspaces/README.md +32 -0
  110. package/scripts/00.chat/reporting/report-chat-workspaces/script.sh +82 -0
  111. package/scripts/00.chat/session-log/README.md +33 -0
  112. package/scripts/00.chat/session-log/check-commit-prerequisites/README.md +89 -0
  113. package/scripts/00.chat/session-log/check-commit-prerequisites/script.sh +121 -0
  114. package/scripts/00.chat/session-log/check-commit-prerequisites/smoke-test.sh +119 -0
  115. package/scripts/00.chat/session-log/check-commitlog-deletions/README.md +90 -0
  116. package/scripts/00.chat/session-log/check-commitlog-deletions/script.sh +131 -0
  117. package/scripts/00.chat/session-log/check-commitlog-deletions/smoke-test.sh +123 -0
  118. package/scripts/00.chat/session-log/checkpoint-chat-session-log/README.md +98 -0
  119. package/scripts/00.chat/session-log/checkpoint-chat-session-log/script.sh +126 -0
  120. package/scripts/00.chat/session-log/paths/README.md +38 -0
  121. package/scripts/00.chat/session-log/paths/lib.sh +133 -0
  122. package/scripts/00.chat/session-log/prepare-chat-session-before-commit/README.md +90 -0
  123. package/scripts/00.chat/session-log/prepare-chat-session-before-commit/script.sh +145 -0
  124. package/scripts/00.chat/session-log/read-current-chat-log/README.md +44 -0
  125. package/scripts/00.chat/session-log/read-current-chat-log/script.sh +92 -0
  126. package/scripts/00.chat/session-log/read-current-chat-log/smoke-test.sh +127 -0
  127. package/scripts/00.chat/session-log/record-chat-commit/README.md +133 -0
  128. package/scripts/00.chat/session-log/record-chat-commit/script.sh +394 -0
  129. package/scripts/00.chat/session-log/record-chat-commit/smoke-test.sh +227 -0
  130. package/scripts/00.chat/session-log/record-main-refresh-conflict/README.md +34 -0
  131. package/scripts/00.chat/session-log/record-main-refresh-conflict/script.sh +239 -0
  132. package/scripts/00.chat/session-log/rename-current-chat-log-folder/README.md +32 -0
  133. package/scripts/00.chat/session-log/rename-current-chat-log-folder/script.sh +112 -0
  134. package/scripts/00.chat/session-log/update-chat-log/README.md +32 -0
  135. package/scripts/00.chat/session-log/update-chat-log/script.sh +294 -0
  136. package/scripts/00.chat/startup/README.md +37 -0
  137. package/scripts/00.chat/startup/auto-start-missing-session/README.md +113 -0
  138. package/scripts/00.chat/startup/auto-start-missing-session/script.sh +54 -0
  139. package/scripts/00.chat/startup/resolve-current-chat-session/README.md +57 -0
  140. package/scripts/00.chat/startup/resolve-current-chat-session/script.sh +47 -0
  141. package/scripts/00.chat/startup/resolve-current-chat-session/smoke-test.sh +130 -0
  142. package/scripts/00.chat/startup/start-chat-session/README.md +197 -0
  143. package/scripts/00.chat/startup/start-chat-session/script.sh +330 -0
  144. package/scripts/00.chat/startup/start-chat-session/smoke-test.sh +182 -0
  145. package/scripts/00.chat/startup/start-new-chat/README.md +31 -0
  146. package/scripts/00.chat/startup/start-new-chat/script.sh +29 -0
  147. package/scripts/00.chat/transcript/README.md +36 -0
  148. package/scripts/00.chat/transcript/discover-codex-session-log/README.md +32 -0
  149. package/scripts/00.chat/transcript/discover-codex-session-log/script.sh +106 -0
  150. package/scripts/00.chat/transcript/register-codex-session-log/README.md +32 -0
  151. package/scripts/00.chat/transcript/register-codex-session-log/script.sh +115 -0
  152. package/scripts/00.chat/worktree/README.md +32 -0
  153. package/scripts/00.chat/worktree/check-write-location/README.md +87 -0
  154. package/scripts/00.chat/worktree/check-write-location/script.sh +95 -0
  155. package/scripts/00.chat/worktree/dirty-worktree-check/README.md +77 -0
  156. package/scripts/00.chat/worktree/dirty-worktree-check/script.sh +93 -0
  157. package/scripts/00.chat/worktree/ensure-chat-worktree/README.md +33 -0
  158. package/scripts/00.chat/worktree/ensure-chat-worktree/script.sh +132 -0
  159. package/scripts/00.chat/worktree/open-window/README.md +34 -0
  160. package/scripts/00.chat/worktree/open-window/script.sh +131 -0
  161. package/scripts/00.chat/worktree/paths/README.md +32 -0
  162. package/scripts/00.chat/worktree/paths/lib.sh +71 -0
  163. package/scripts/01.harness/artifact-metadata/check-headers/script.sh +522 -0
  164. package/scripts/01.harness/artifact-metadata/check-headers/smoke-test.sh +48 -0
  165. package/scripts/01.harness/check-deterministic-process-drift.sh +416 -0
  166. package/scripts/01.harness/check-governed-script-command-drift.sh +184 -0
  167. package/scripts/01.harness/run-governed-script.sh +178 -0
  168. package/scripts/install.sh +503 -0
  169. package/scripts/uninstall.sh +199 -0
  170. package/tests/smoke-test-install.sh +70 -0
@@ -0,0 +1,212 @@
1
+ <!-- agentic-artifact:
2
+ schema: agentic-artifact/v2
3
+ id: chat.workflows.bootstrap-chat-workbench-repo
4
+ version: 1
5
+ status: active
6
+ layer: 00.chat
7
+ domain: bootstrap
8
+ disciplines:
9
+ - agentic
10
+ kind: workflow
11
+ purpose: Govern bootstrapping the portable chat workbench into an upstream repo.
12
+ portability:
13
+ class: required
14
+ targets:
15
+ - llm-workbench
16
+ used_by:
17
+ - id: shared.standard.upstream-repo-bootstrap
18
+ path: .agentic/shared/standards/upstream-repo-bootstrap.md
19
+ - id: chat.script.bootstrap.audit-chat-bootstrap-file-set
20
+ path: scripts/00.chat/bootstrap/audit-chat-bootstrap-file-set/script.sh
21
+ -->
22
+ # Bootstrap Chat Workbench Repo Workflow
23
+
24
+ ## Use When
25
+
26
+ Use this when seeding an upstream chat workbench repo such as `llm-workbench`
27
+ from a source repo that already contains the chat harness.
28
+
29
+ ## Purpose
30
+
31
+ Create the first minimal usable open-source chat workbench repo so engineers can
32
+ read, install, test, and run the portable chat harness from the upstream repo.
33
+
34
+ This workflow uses `.agentic/shared/standards/upstream-repo-bootstrap.md`.
35
+ It also uses
36
+ `.agentic/00.chat/standards/llm-workbench-public-beta-contract.md` for the
37
+ public `llm-workbench` contract.
38
+
39
+ ## Required Gates
40
+
41
+ Before writing to the upstream repo, inspect:
42
+
43
+ ```bash
44
+ git -C <upstream-repo> status --short
45
+ git -C <upstream-repo> remote -v
46
+ git -C <upstream-repo> rev-parse --verify HEAD || true
47
+ git -C <upstream-repo> branch --show-current || true
48
+ find <upstream-repo> -maxdepth 2 -type f
49
+ ```
50
+
51
+ Then run the portable script file set audit from the source repo:
52
+
53
+ ```bash
54
+ bash scripts/00.chat/bootstrap/audit-chat-bootstrap-file-set/script.sh
55
+ ```
56
+
57
+ If the upstream repo is not empty, list target paths that would be added or
58
+ overwritten and ask for explicit approval before writing.
59
+
60
+ If `HEAD` does not exist, treat the upstream repo as an empty bootstrap target.
61
+ The initial branch must be `main` unless the user explicitly approves a
62
+ different branch name.
63
+
64
+ ## Portable Chat File Set
65
+
66
+ Initial candidate paths:
67
+
68
+ - `AGENTS.md` as an upstream template, not a direct source-repo copy
69
+ - `.agentic/00.chat/`
70
+ - `.agentic/shared/standards/`
71
+ - `.agentic/shared/workflows/` entries required by cross-layer process and
72
+ capability resolution
73
+ - `package.json` chat command scripts as an upstream template, not a direct
74
+ source-repo copy
75
+ - `scripts/00.chat/` canonical chat capability scripts required by the audit
76
+ - `scripts/01.harness/` gates required by chat startup, commit,
77
+ governed script, and deterministic process checks
78
+ - `docs/00.chat/`
79
+
80
+ Do not copy the source repo `README.md` directly. It describes the source repo,
81
+ not the upstream workbench.
82
+
83
+ ## Minimal Open-Source Product Shell
84
+
85
+ The first bootstrap must include enough product surface to test the repo as an
86
+ outside engineer would use it:
87
+
88
+ - `README.md` as a public workbench overview
89
+ - `LICENSE` when the user has chosen a license
90
+ - `.gitignore` for local/editor/runtime clutter
91
+ - `docs/concepts.md`
92
+ - `docs/install.md`
93
+ - `docs/workflows.md`
94
+ - `docs/adapting-to-your-repo.md`
95
+ - `examples/minimal-repo/`
96
+ - `scripts/install.sh`
97
+ - `scripts/uninstall.sh`
98
+ - `tests/smoke-test-install.sh`
99
+ - `docs/public-beta-contract.md`
100
+
101
+ Starter templates for those files live in:
102
+
103
+ ```txt
104
+ docs/00.chat/bootstrap/llm-workbench-template/root/
105
+ ```
106
+
107
+ The install smoke test must install the workbench into a throwaway Git repo,
108
+ verify the public command surface works, and verify the first chat startup
109
+ creates the target repo's own `commitLogs/` inside a chat-owned worktree.
110
+
111
+ Use `scripts/00.chat/bootstrap/audit-chat-bootstrap-file-set/script.sh` to distinguish
112
+ required scripts from candidate unreferenced scripts before copying scripts
113
+ into the upstream repo.
114
+
115
+ Use `docs/00.chat/llm-workbench-acceptance-matrix.md` to verify the current
116
+ public export boundary and the checks that enforce it.
117
+
118
+ Before writing, run the dry-run planner:
119
+
120
+ ```bash
121
+ bash scripts/01.harness/run-governed-script.sh --approved-action scripts/00.chat/upstream/bootstrap-llm-workbench-repo/script.sh \
122
+ --target <upstream-repo> \
123
+ --dry-run
124
+ ```
125
+
126
+ Only run `--apply` after reviewing a clean plan. Apply mode must refuse to
127
+ write when the plan contains conflicts.
128
+
129
+ Before commit, complete
130
+ `.agentic/00.chat/checklists/llm-workbench-public-beta.md`.
131
+
132
+ ## Required Exclusions
133
+
134
+ In addition to the shared standard exclusions, do not copy:
135
+
136
+ - `.agentic/product/`
137
+ - `.agentic/education/`
138
+ - `.agentic/aws/`
139
+ - product `src/`, `tests/`, or app docs
140
+ - source repo `commitLogs/`
141
+ - source repo-specific open tabs, transcripts, or local worktree paths
142
+
143
+ ## Initial Commit For Empty Repos
144
+
145
+ For an empty upstream repo:
146
+
147
+ 1. Copy the approved portable file set and starter public files.
148
+ 2. Add the minimal open-source product shell.
149
+ 3. Verify `npm run chat:list` works.
150
+ 4. Verify `tests/smoke-test-install.sh` passes against a throwaway repo.
151
+ 5. Create the first upstream commit only after explicit commit approval.
152
+ 6. After the first commit exists, verify a normal chat can be started in the
153
+ upstream repo.
154
+
155
+ Do not create or copy `commitLogs/` during bootstrap. The first upstream chat
156
+ startup creates the upstream repo's first session log inside a chat-owned
157
+ worktree.
158
+
159
+ ## Bootstrap Prompt Shape
160
+
161
+ When preparing the first upstream bootstrap chat, use:
162
+
163
+ ```txt
164
+ Task: Bootstrap llm-workbench with the portable chat harness
165
+
166
+ Source repo: <absolute-path>
167
+ Upstream repo: <absolute-path>
168
+ Workflow: .agentic/00.chat/workflows/bootstrap-chat-workbench-repo.md
169
+ Standard: .agentic/shared/standards/upstream-repo-bootstrap.md
170
+
171
+ Goal:
172
+ Create the first minimal usable open-source chat workbench in llm-workbench.
173
+
174
+ Portable file set:
175
+ <paths>
176
+
177
+ Minimal product shell:
178
+ <README, docs, examples, install scripts, smoke test>
179
+
180
+ Required exclusions:
181
+ <paths and categories>
182
+
183
+ Initial Git state:
184
+ <empty repo or existing HEAD>
185
+
186
+ Starter public files:
187
+ <README, LICENSE decision, gitignore>
188
+
189
+ Boundaries:
190
+ Inspect both repos before writing.
191
+ Do not copy source-repo-specific product, deployment, customer, or session
192
+ history into llm-workbench.
193
+ Ask before writing upstream files.
194
+ Ask before committing.
195
+ Do not push unless explicitly approved separately.
196
+ Do not copy source commitLogs; first upstream chat startup creates commitLogs
197
+ inside a chat-owned worktree.
198
+ ```
199
+
200
+ ## Stop Conditions
201
+
202
+ Stop if:
203
+
204
+ - the upstream repo is not the intended repo
205
+ - the upstream repo has existing files whose ownership is unclear
206
+ - the upstream repo has no `HEAD` and the initial branch is not agreed
207
+ - the portable file set cannot be separated from source-specific material
208
+ - a required compatibility script or workflow is missing
209
+ - starter public files are missing or would misrepresent the upstream repo
210
+ - the install smoke test is missing or cannot prove a throwaway repo can use
211
+ the workbench
212
+ - bootstrap would require push, destructive cleanup, or history rewrite
@@ -0,0 +1,102 @@
1
+ <!-- agentic-artifact:
2
+ schema: agentic-artifact/v2
3
+ id: chat.workflows.chat-cleanup
4
+ version: 1
5
+ status: active
6
+ layer: 00.chat
7
+ domain: cleanup
8
+ disciplines:
9
+ - agentic
10
+ kind: workflow
11
+ purpose: Govern cleanup of chat branches, worktrees, temporary refresh artifacts,
12
+ and empty session logs.
13
+ portability:
14
+ class: required
15
+ targets:
16
+ - llm-workbench
17
+ used_by:
18
+ - id: chat.readme
19
+ path: .agentic/00.chat/README.md
20
+ - id: chat.script.git.cleanup-empty-chat-branches
21
+ path: scripts/00.chat/git/cleanup-empty-chat-branches/script.sh
22
+ -->
23
+ # Chat Cleanup Workflow
24
+
25
+ ## Use When
26
+
27
+ Use this when inspecting or cleaning chat branches, chat-owned worktrees,
28
+ temporary preflight worktrees, or empty session logs.
29
+
30
+ ## Purpose
31
+
32
+ Own cleanup of chat branches, chat-owned worktrees, temporary preflight
33
+ worktrees, and empty session logs.
34
+
35
+ ## Required Gates
36
+
37
+ Before deleting branches, removing worktrees, deleting logs, or discarding any
38
+ work, inspect chat workspace state:
39
+
40
+ ```bash
41
+ bash scripts/00.chat/reporting/report-chat-workspaces/script.sh
42
+ ```
43
+
44
+ For empty chat branch cleanup, start with a dry run:
45
+
46
+ ```bash
47
+ bash scripts/00.chat/git/cleanup-empty-chat-branches/script.sh --dry-run
48
+ ```
49
+
50
+ Only run `--apply` after explicit user approval in the current chat:
51
+
52
+ ```bash
53
+ bash scripts/00.chat/git/cleanup-empty-chat-branches/script.sh --apply
54
+ ```
55
+
56
+ ## Rules
57
+
58
+ - Never remove dirty worktrees automatically.
59
+ - Never delete logs with recorded commits or retention markers.
60
+ - Never delete the current branch.
61
+ - Never delete a branch checked out in any worktree.
62
+ - Delete empty session logs only when the matching branch is empty and the log
63
+ names that branch.
64
+ - Delete deterministic temporary preflight branches/worktrees only when their
65
+ corresponding operation has either been promoted or explicitly abandoned by
66
+ the user.
67
+ - After a successful preflight promotion, automatically delete stale sibling
68
+ preflight branches/worktrees for the same chat branch only when the stale
69
+ branch is already an ancestor of the promoted chat branch and any associated
70
+ worktree is clean.
71
+ - Report and skip stale sibling preflight branches that have unique commits,
72
+ dirty worktrees, multiple worktrees, or ambiguous ownership.
73
+ - Require explicit approval for cleanup outside deterministic safe cases.
74
+ - If a cleanup case is not covered here or by a script-level gate, stop and ask
75
+ whether to update the harness or approve a one-off exception.
76
+
77
+ ## Script Paths
78
+
79
+ The canonical empty-branch cleanup script is:
80
+
81
+ ```txt
82
+ scripts/00.chat/git/cleanup-empty-chat-branches/script.sh
83
+ scripts/00.chat/reporting/report-chat-workspaces/script.sh
84
+ ```
85
+
86
+ The old shared cleanup path remains as a compatibility wrapper during the
87
+ script-layout migration. See ADR 0017 for compatibility-wrapper paths.
88
+
89
+ Other cleanup helpers:
90
+
91
+ ```txt
92
+ scripts/00.chat/main-refresh/apply-rehearsed-refresh/script.sh
93
+ ```
94
+
95
+ ## Migration Notes
96
+
97
+ When migrating script paths later, preserve:
98
+
99
+ - never remove dirty worktrees automatically
100
+ - never delete logs with recorded commits or retention markers
101
+ - delete only deterministic temporary preflight branches/worktrees
102
+ - require explicit approval for cleanup outside deterministic safe cases
@@ -0,0 +1,56 @@
1
+ <!-- agentic-artifact:
2
+ schema: agentic-artifact/v2
3
+ id: chat.workflows.chat-commit
4
+ version: 1
5
+ status: active
6
+ layer: 00.chat
7
+ domain: chat
8
+ disciplines:
9
+ - agentic
10
+ kind: workflow
11
+ purpose: Document Chat Commit Workflow.
12
+ portability:
13
+ class: required
14
+ targets:
15
+ - llm-workbench
16
+ - entity-builder
17
+ - design-system-builder
18
+ used_by:
19
+ - id: repo.agents
20
+ path: AGENTS.md
21
+ -->
22
+ # Chat Commit Workflow
23
+
24
+ ## Purpose
25
+
26
+ Own chat task commits, session-log commit recording, and narrow session
27
+ bookkeeping checkpoints.
28
+
29
+ ## Required Gates
30
+
31
+ Before committing approved task work, follow:
32
+
33
+ ```txt
34
+ .agentic/00.chat/checklists/before-commit.md
35
+ ```
36
+
37
+ ## Rules
38
+
39
+ - Use the current branch session log as the first source of truth.
40
+ - Treat `.agentic/00.chat/checklists/before-commit.md` as the authority for
41
+ task-commit approval, write location, staging scope, transcript metrics,
42
+ checkpoint commits, and destructive-action boundaries.
43
+ - Do not duplicate before-commit checklist rules in this workflow.
44
+
45
+ ## Migration Notes
46
+
47
+ The executable scripts still live under `scripts/shared/` for compatibility.
48
+ That path is implementation location, not ownership.
49
+
50
+ When migrating script paths later, preserve:
51
+
52
+ - explicit user approval before task commits
53
+ - current session log as commit evidence
54
+ - ADR disposition before task commit
55
+ - checkpoint scope limited to the current session log
56
+ - no automatic task staging outside approved paths
@@ -0,0 +1,169 @@
1
+ <!-- agentic-artifact:
2
+ schema: agentic-artifact/v2
3
+ id: chat.workflows.chat-promote-to-main
4
+ version: 1
5
+ status: active
6
+ layer: 00.chat
7
+ domain: local-merge
8
+ disciplines:
9
+ - agentic
10
+ kind: workflow
11
+ purpose: Govern explicit local merge from completed chat branches into main.
12
+ portability:
13
+ class: required
14
+ targets:
15
+ - llm-workbench
16
+ used_by:
17
+ - id: chat.workflows.readme
18
+ path: .agentic/00.chat/workflows/README.md
19
+ - id: chat.script.local-merge.verify-chat-ready-to-merge-local-main
20
+ path: scripts/00.chat/local-merge/verify-chat-ready-to-merge-local-main/script.sh
21
+ -->
22
+ # Chat Promote To Main Workflow
23
+
24
+ ## Use When
25
+
26
+ Use this when completed chat branch work should be integrated into local `main`,
27
+ or when deciding whether a chat branch is ready for promotion.
28
+
29
+ ## Purpose
30
+
31
+ Treat the root worktree as the local integration console. Chat branches are
32
+ feature branches owned by their chat worktrees. Integration into `main` is an
33
+ explicit local merge operation.
34
+
35
+ ## Required Gates
36
+
37
+ Before merging, rebasing, staging, committing, pushing, deleting branches, or
38
+ discarding work, run:
39
+
40
+ ```bash
41
+ bash scripts/00.chat/worktree/dirty-worktree-check/script.sh
42
+ ```
43
+
44
+ <!-- deterministic-check: allow reason="workflow defines the exact blocked response around the dirty-worktree gate output" -->
45
+ If dirty, respond exactly:
46
+
47
+ ```txt
48
+ Blocked: dirty worktree. Confirm proceed? Layer: chat. Mode: <mode>. Workflow: .agentic/00.chat/workflows/chat-promote-to-main.md
49
+ ```
50
+
51
+ Do not change branches or edit files while blocked.
52
+
53
+ ## Intake
54
+
55
+ 1. Inspect all chat workspaces:
56
+
57
+ ```bash
58
+ bash scripts/00.chat/reporting/report-chat-workspaces/script.sh
59
+ ```
60
+
61
+ 2. Verify the target chat branch is ready to merge into local `main`:
62
+
63
+ ```bash
64
+ bash scripts/00.chat/local-merge/verify-chat-ready-to-merge-local-main/script.sh <chat-branch>
65
+ ```
66
+
67
+ This verification is read-only. It may inspect a session log from the chat
68
+ branch before that log exists on root `main`.
69
+
70
+ 3. If verification reports `State: eligible`, ask for explicit user approval
71
+ before merging the chat branch into local `main`.
72
+
73
+ ## Refresh Policy
74
+
75
+ - A user request to merge or promote a chat branch to `main` also approves the
76
+ non-rewriting refresh from `main` that local merge requires, unless the
77
+ user explicitly asks to inspect before refresh.
78
+ - Prefer merging `main` into a chat branch because it preserves recorded commit
79
+ SHAs and session evidence.
80
+ - When promotion verification reports `blocked-behind` or `blocked-diverged`,
81
+ use the rehearsed preflight refresh flow in
82
+ `.agentic/00.chat/workflows/chat-refresh-from-main.md` before mutating the
83
+ active chat branch.
84
+ - Rebase rewrites chat branch commits and requires explicit user approval.
85
+ - Never refresh by discarding dirty work.
86
+ - If conflicts appear, stop after Git reports the conflict set. Summarize the
87
+ conflicting files and ask before resolving them.
88
+
89
+ ### Behind `main`
90
+
91
+ If verification reports `blocked-behind`, do not merge the chat branch into
92
+ `main`. If the user already requested merge or promotion to `main`, refresh the
93
+ chat branch from `main` without asking for a second approval.
94
+
95
+ For the approved non-rewriting refresh, use the rehearsed preflight refresh flow
96
+ from `.agentic/00.chat/workflows/chat-refresh-from-main.md`:
97
+
98
+ ```bash
99
+ bash scripts/01.harness/run-governed-script.sh --approved-action scripts/00.chat/main-refresh/rehearse-refresh-from-main/script.sh
100
+ ```
101
+
102
+ If the preflight succeeds, run the required checks, apply the rehearsed refresh
103
+ with `scripts/00.chat/main-refresh/apply-rehearsed-refresh/script.sh`, then
104
+ rerun local merge verification.
105
+
106
+ ### Diverged From `main`
107
+
108
+ If verification reports `blocked-diverged`, do not merge the chat branch into
109
+ `main`. Explain that both `main` and the chat branch have unique commits.
110
+
111
+ If the user already requested merge or promotion to `main`, run the rehearsed
112
+ preflight refresh flow from `.agentic/00.chat/workflows/chat-refresh-from-main.md`
113
+ without asking for a second approval. Rebase rewrites chat branch commits and
114
+ requires separate explicit approval.
115
+
116
+ If preflight conflicts appear, stop before resolving. Classify and record them
117
+ using `.agentic/00.chat/standards/main-refresh-conflict-types.md`, then follow
118
+ the preflight conflict audit and apply gates before mutating the active chat
119
+ branch.
120
+
121
+ ### Dirty Chat Worktree
122
+
123
+ <!-- deterministic-check: allow reason="verifier emits the state; prose governs human recovery choices" -->
124
+ If verification reports `blocked-dirty-chat-worktree`, do not merge the chat
125
+ branch into `main`.
126
+
127
+ Do not stash, discard, stage, or commit dirty chat work automatically. Ask the
128
+ user whether to inspect, commit, preserve, or explicitly discard the work.
129
+
130
+ ### Missing Or Ambiguous Evidence
131
+
132
+ <!-- deterministic-check: allow reason="verifier emits the state; prose routes governed recovery and missing-governance fallback" -->
133
+ If verification reports a missing log, missing worktree, invalid metadata,
134
+ unrecorded commit, or log-head mismatch, do not merge. Follow the verifier's
135
+ required action and rerun verification.
136
+
137
+ If the required recovery path is not covered by this workflow, a script, a gate,
138
+ or a standard, stop and report the missing governance gap before acting.
139
+
140
+ ## Promotion Policy
141
+
142
+ Before promoting a chat branch into local `main`:
143
+
144
+ - Root `main` must be clean.
145
+ - The chat worktree must be clean.
146
+ - The session log must record the latest task commit or explicitly state why no
147
+ task commit exists.
148
+ - The chat branch must include latest local `main`. If a refresh is needed, the
149
+ initial merge or promotion request approves the non-rewriting refresh from
150
+ `main`.
151
+ - Relevant checks for the changed layer must pass.
152
+ - User approval is required before merging into `main`.
153
+
154
+ For an approved local merge, run from the root integration worktree:
155
+
156
+ ```bash
157
+ git merge --no-ff <chat-branch>
158
+ ```
159
+
160
+ Pushes to `origin` require separate explicit approval.
161
+
162
+ ## Cleanup Policy
163
+
164
+ - Empty abandoned chat branches may be deleted with their matching commit log
165
+ only when the log has no recorded commits and no retention marker.
166
+ - Superseded chat branches may have their branch and worktree removed, but
167
+ their commit log stays as historical evidence.
168
+ - Logs with recorded commits or retention markers must not be deleted
169
+ automatically.