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,39 @@
1
+ <!-- agentic-artifact:
2
+ schema: agentic-artifact/v2
3
+ id: chat.script.bootstrap.audit-chat-bootstrap-file-set.readme
4
+ version: 1
5
+ status: active
6
+ layer: 00.chat
7
+ domain: bootstrap
8
+ disciplines:
9
+ - agentic
10
+ kind: capability-readme
11
+ purpose: Explain the portable chat bootstrap file-set audit.
12
+ portability:
13
+ class: required
14
+ targets:
15
+ - llm-workbench
16
+ used_by:
17
+ - id: chat.workflows.bootstrap-chat-workbench-repo
18
+ path: .agentic/00.chat/workflows/bootstrap-chat-workbench-repo.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
+ # Audit Chat Bootstrap File Set
23
+
24
+ `script.sh` reports the script and support-file set needed to bootstrap the
25
+ portable chat harness into another repository.
26
+
27
+ The audit starts from public chat commands, chat workflows, shared process
28
+ artifacts, and the governed runner. It follows script references from those
29
+ seed surfaces and separates results into:
30
+
31
+ - required scripts and support files
32
+ - validation and compatibility candidates
33
+ - unclassified candidates
34
+
35
+ The audit does not copy files. It is an evidence tool for the bootstrap
36
+ workflow. A clean result means the portable set is understood; it does not mean
37
+ the public repository shell, install script, license, or smoke test has already
38
+ been created.
39
+
@@ -0,0 +1,213 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ # agentic-artifact:
5
+ # schema: agentic-artifact/v2
6
+ # id: chat.script.bootstrap.audit-chat-bootstrap-file-set
7
+ # version: 1
8
+ # status: active
9
+ # layer: 00.chat
10
+ # domain: bootstrap
11
+ # disciplines:
12
+ # - agentic
13
+ # kind: script
14
+ # purpose: Audit the portable chat bootstrap script and support-file set.
15
+ # portability:
16
+ # class: required
17
+ # targets:
18
+ # - llm-workbench
19
+ # used_by:
20
+ # - id: chat.workflows.bootstrap-chat-workbench-repo
21
+ # path: .agentic/00.chat/workflows/bootstrap-chat-workbench-repo.md
22
+ # - id: shared.standard.upstream-repo-bootstrap
23
+ # path: .agentic/shared/standards/upstream-repo-bootstrap.md
24
+ # - id: harness.script.run-governed-script
25
+ # path: scripts/01.harness/run-governed-script.sh
26
+ # effects:
27
+ # - read-only
28
+
29
+ usage() {
30
+ cat <<'EOF'
31
+ Usage:
32
+ audit-chat-bootstrap-file-set.sh
33
+
34
+ Reports the script and support-file dependency set for the portable chat
35
+ harness bootstrap.
36
+
37
+ The audit starts from package chat commands, chat workflows, shared process
38
+ artifacts used by chat startup/commit/promotion, and the governed script runner.
39
+ It then follows script references to produce a required script set and candidate
40
+ unreferenced scripts.
41
+ EOF
42
+ }
43
+
44
+ if [ "${1:-}" = "-h" ] || [ "${1:-}" = "--help" ]; then
45
+ usage
46
+ exit 0
47
+ fi
48
+
49
+ REPO_ROOT="$(git rev-parse --show-toplevel)"
50
+ cd "$REPO_ROOT"
51
+
52
+ TMP_DIR="$(mktemp -d "${TMPDIR:-/tmp}/chat-bootstrap-audit.XXXXXX")"
53
+ trap 'rm -rf "$TMP_DIR"' EXIT
54
+
55
+ SEEDS="$TMP_DIR/seeds.txt"
56
+ SEEN="$TMP_DIR/seen.txt"
57
+ QUEUE="$TMP_DIR/queue.txt"
58
+ NEXT_QUEUE="$TMP_DIR/next-queue.txt"
59
+ SCRIPT_REFS="$TMP_DIR/script-refs.txt"
60
+ MISSING="$TMP_DIR/missing.txt"
61
+ ALL_SCRIPTS="$TMP_DIR/all-scripts.txt"
62
+ REQUIRED="$TMP_DIR/required.txt"
63
+ UNREFERENCED="$TMP_DIR/unreferenced.txt"
64
+ VALIDATION="$TMP_DIR/validation.txt"
65
+ COMPATIBILITY="$TMP_DIR/compatibility.txt"
66
+ UNCLASSIFIED="$TMP_DIR/unclassified.txt"
67
+
68
+ : > "$SEEDS"
69
+ : > "$SEEN"
70
+ : > "$QUEUE"
71
+ : > "$SCRIPT_REFS"
72
+ : > "$MISSING"
73
+
74
+ add_if_exists() {
75
+ local path="$1"
76
+
77
+ if [ -e "$path" ]; then
78
+ printf '%s\n' "$path" >> "$SEEDS"
79
+ fi
80
+ }
81
+
82
+ add_tree_if_exists() {
83
+ local path="$1"
84
+
85
+ if [ -d "$path" ]; then
86
+ find "$path" -type f >> "$SEEDS"
87
+ fi
88
+ }
89
+
90
+ add_if_exists "AGENTS.md"
91
+ add_tree_if_exists ".agentic/00.chat"
92
+ add_tree_if_exists ".agentic/shared/standards"
93
+ add_tree_if_exists ".agentic/shared/workflows"
94
+ add_if_exists "package.json"
95
+ add_if_exists "scripts/01.harness/run-governed-script.sh"
96
+ add_if_exists "scripts/01.harness/check-deterministic-process-drift.sh"
97
+ add_tree_if_exists "scripts/01.harness/artifact-metadata"
98
+ add_if_exists "scripts/01.harness/check-artifact-metadata-headers.sh"
99
+ add_if_exists "scripts/01.harness/check-governed-script-command-drift.sh"
100
+ add_if_exists "scripts/01.harness/plan-artifact-path-migration.sh"
101
+ add_if_exists "scripts/01.harness/check-artifact-path-migration.sh"
102
+
103
+ sort -u "$SEEDS" > "$QUEUE"
104
+
105
+ extract_script_refs() {
106
+ local path="$1"
107
+ local dir
108
+
109
+ grep -Eo 'scripts/[A-Za-z0-9._/-]+\.(sh|js|mjs|cjs|tsv|json)' "$path" 2>/dev/null \
110
+ | grep -E '^scripts/(00\.chat|01\.harness|chat|harness|shared)/' || true
111
+
112
+ case "$path" in
113
+ scripts/*)
114
+ dir="$(dirname "$path")"
115
+ grep -Eo 'SCRIPT_DIR/[A-Za-z0-9._/-]+\.(sh|js|mjs|cjs|tsv|json)' "$path" 2>/dev/null \
116
+ | sed "s#^SCRIPT_DIR/#${dir}/#" || true
117
+ grep -Eo 'dirname "\$0"\)/[A-Za-z0-9._/-]+\.(sh|js|mjs|cjs|tsv|json)' "$path" 2>/dev/null \
118
+ | sed "s#^dirname \"\\\$0\")/#${dir}/#" || true
119
+ ;;
120
+ esac
121
+ }
122
+
123
+ while [ -s "$QUEUE" ]; do
124
+ : > "$NEXT_QUEUE"
125
+
126
+ while IFS= read -r path; do
127
+ [ -n "$path" ] || continue
128
+ grep -Fxq "$path" "$SEEN" && continue
129
+ printf '%s\n' "$path" >> "$SEEN"
130
+
131
+ if [ ! -f "$path" ]; then
132
+ printf '%s\n' "$path" >> "$MISSING"
133
+ continue
134
+ fi
135
+
136
+ while IFS= read -r ref; do
137
+ [ -n "$ref" ] || continue
138
+ printf '%s\n' "$ref" >> "$SCRIPT_REFS"
139
+ if [ -f "$ref" ]; then
140
+ case "$ref" in
141
+ scripts/*)
142
+ if ! grep -Fxq "$ref" "$SEEN"; then
143
+ printf '%s\n' "$ref" >> "$NEXT_QUEUE"
144
+ fi
145
+ ;;
146
+ esac
147
+ else
148
+ printf '%s\n' "$ref" >> "$MISSING"
149
+ fi
150
+ done < <(extract_script_refs "$path")
151
+ done < "$QUEUE"
152
+
153
+ sort -u "$NEXT_QUEUE" > "$QUEUE"
154
+ done
155
+
156
+ find scripts -type f \
157
+ \( -name '*.sh' -o -name '*.js' -o -name '*.mjs' -o -name '*.cjs' -o -name '*.tsv' -o -name '*.json' \) \
158
+ | sort -u > "$ALL_SCRIPTS"
159
+
160
+ {
161
+ grep '^scripts/' "$SEEN" || true
162
+ sort -u "$SCRIPT_REFS"
163
+ } | sort -u > "$REQUIRED"
164
+
165
+ comm -23 "$ALL_SCRIPTS" "$REQUIRED" > "$UNREFERENCED"
166
+ while IFS= read -r path; do
167
+ [ -n "$path" ] || continue
168
+ if grep -Eq '^([#[:space:]]*|[[:space:]]*//[[:space:]]*)portability: .*compatibility' "$path"; then
169
+ printf '%s\n' "$path"
170
+ fi
171
+ done < "$UNREFERENCED" > "$COMPATIBILITY"
172
+ {
173
+ grep -E '/smoke-test-[^/]+\.sh$|/smoke-test\.sh$|/with-chat-branch\.sh$' "$UNREFERENCED" || true
174
+ cat "$COMPATIBILITY"
175
+ } | sort -u > "$VALIDATION"
176
+ comm -23 "$UNREFERENCED" "$VALIDATION" > "$UNCLASSIFIED"
177
+
178
+ echo "Chat bootstrap script file set audit"
179
+ echo
180
+ echo "Seed surfaces scanned:"
181
+ echo "- AGENTS.md"
182
+ echo "- .agentic/00.chat/"
183
+ echo "- .agentic/shared/standards/"
184
+ echo "- .agentic/shared/workflows/"
185
+ echo "- package.json chat scripts"
186
+ echo "- governed runner and deterministic harness checks"
187
+ echo
188
+ echo "Required scripts and support files:"
189
+ cat "$REQUIRED"
190
+ echo
191
+ echo "Validation and compatibility candidates:"
192
+ if [ -s "$VALIDATION" ]; then
193
+ cat "$VALIDATION"
194
+ else
195
+ echo "(none)"
196
+ fi
197
+ echo
198
+ echo "Unclassified candidates:"
199
+ if [ -s "$UNCLASSIFIED" ]; then
200
+ cat "$UNCLASSIFIED"
201
+ else
202
+ echo "(none)"
203
+ fi
204
+
205
+ if [ -s "$MISSING" ]; then
206
+ echo
207
+ echo "Missing referenced scripts:" >&2
208
+ sort -u "$MISSING" >&2
209
+ exit 1
210
+ fi
211
+
212
+ echo
213
+ echo "Audit completed."
@@ -0,0 +1,30 @@
1
+ <!-- agentic-artifact:
2
+ schema: agentic-artifact/v2
3
+ id: chat.script.closeout.readme
4
+ version: 1
5
+ status: active
6
+ layer: 00.chat
7
+ domain: closeout
8
+ disciplines:
9
+ - agentic
10
+ kind: script-domain-readme
11
+ purpose: Explain closeout scripts that prepare governed end-of-chat prompts.
12
+ portability:
13
+ class: required
14
+ targets:
15
+ - llm-workbench
16
+ used_by:
17
+ - id: chat.commands.readme
18
+ path: .agentic/00.chat/commands/README.md
19
+ - id: chat.script.closeout.build-closeout-prompt.readme
20
+ path: scripts/00.chat/closeout/build-closeout-prompt/README.md
21
+ -->
22
+ # Closeout Scripts
23
+
24
+ Closeout scripts prepare the handoff from active work to a final agent turn.
25
+ They do not commit or merge work by themselves. Instead, they build the prompt
26
+ that tells the next agent how to inspect the current chat, run required gates,
27
+ commit approved work, and report the result.
28
+
29
+ This keeps terminal shortcuts convenient without hiding approval boundaries.
30
+
@@ -0,0 +1,35 @@
1
+ <!-- agentic-artifact:
2
+ schema: agentic-artifact/v2
3
+ id: chat.script.closeout.build-closeout-prompt.readme
4
+ version: 1
5
+ status: active
6
+ layer: 00.chat
7
+ domain: closeout
8
+ disciplines:
9
+ - agentic
10
+ kind: capability-readme
11
+ purpose: Explain how the chat closeout prompt is built and handed to terminal users.
12
+ portability:
13
+ class: required
14
+ targets:
15
+ - llm-workbench
16
+ used_by:
17
+ - id: chat.script.closeout.build-closeout-prompt
18
+ path: scripts/00.chat/closeout/build-closeout-prompt/script.sh
19
+ - id: chat.script.command.close
20
+ path: scripts/00.chat/command/close/script.sh
21
+ -->
22
+ # Build Closeout Prompt
23
+
24
+ `script.sh` builds the governed prompt used when a human runs the public close
25
+ command. The prompt is meant for the next agent turn: it asks the agent to
26
+ inspect the chat worktree, run the right gates, commit approved work, and
27
+ record the commit.
28
+
29
+ The script tries to copy the prompt to the clipboard for terminal convenience
30
+ and prints it when clipboard copy is unavailable. Clipboard behavior is not the
31
+ governance contract; the prompt content is.
32
+
33
+ This capability does not stage files, commit, merge, push, or decide whether
34
+ work is complete.
35
+
@@ -0,0 +1,124 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ # agentic-artifact:
5
+ # schema: agentic-artifact/v2
6
+ # id: chat.script.closeout.build-closeout-prompt
7
+ # version: 1
8
+ # status: active
9
+ # layer: 00.chat
10
+ # domain: closeout
11
+ # disciplines:
12
+ # - agentic
13
+ # kind: script
14
+ # purpose: Build and copy or print the governed chat closeout prompt.
15
+ # portability:
16
+ # class: required
17
+ # targets:
18
+ # - llm-workbench
19
+ # used_by:
20
+ # - id: chat.commands.readme
21
+ # path: .agentic/00.chat/commands/README.md
22
+ # - id: chat.script.command.dispatcher
23
+ # path: scripts/00.chat/command/dispatcher/script.sh
24
+ # effects:
25
+ # - read-only
26
+
27
+ # shellcheck source=../../session-log/paths/lib.sh
28
+ source "scripts/00.chat/session-log/paths/lib.sh"
29
+
30
+ print_prompt() {
31
+ echo
32
+ echo "Paste this into Codex / Claude / Mistral:"
33
+ echo "$CLOSE_PROMPT"
34
+ }
35
+
36
+ copy_prompt_with_retry() {
37
+ local label="$1"
38
+ shift
39
+
40
+ local attempt=1
41
+ while [ "$attempt" -le 2 ]; do
42
+ if printf '%s' "$CLOSE_PROMPT" | "$@"; then
43
+ echo "Copied closeout prompt to clipboard."
44
+ return 0
45
+ fi
46
+
47
+ if [ "$attempt" -lt 2 ]; then
48
+ echo "Clipboard copy via ${label} failed; retrying..." >&2
49
+ sleep 1
50
+ fi
51
+
52
+ attempt=$((attempt + 1))
53
+ done
54
+
55
+ echo "WARNING: Clipboard copy via ${label} failed; printing prompt instead." >&2
56
+ return 1
57
+ }
58
+
59
+ BRANCH="$(git branch --show-current)"
60
+
61
+ if ! SESSION_ID="$(chat_session_id_from_branch "$BRANCH")"; then
62
+ echo "ERROR: current branch is not a chat branch: $BRANCH" >&2
63
+ exit 1
64
+ fi
65
+
66
+ LOG_FILE="$(chat_log_file_for_session "$SESSION_ID")"
67
+
68
+ if [ ! -f "$LOG_FILE" ]; then
69
+ echo "ERROR: missing chat log: $LOG_FILE" >&2
70
+ exit 1
71
+ fi
72
+
73
+ TASK="$(chat_log_metadata_value "$LOG_FILE" "task")"
74
+ WORKTREE="$(chat_log_metadata_value "$LOG_FILE" "worktree")"
75
+ LAYER="$(chat_log_metadata_value "$LOG_FILE" "layer")"
76
+ MODE="$(chat_log_metadata_value "$LOG_FILE" "mode")"
77
+
78
+ WORKTREE="${WORKTREE:-$(pwd)}"
79
+ LAYER="${LAYER:-chat}"
80
+ MODE="${MODE:-implementation}"
81
+
82
+ CLOSE_PROMPT="Task: close this chat by committing approved work if needed and merging the chat branch to local main
83
+ Session log: ${LOG_FILE}
84
+ Chat branch: ${BRANCH}
85
+ Chat worktree: ${WORKTREE}
86
+ Original task: ${TASK}
87
+ Layer: chat
88
+ Mode: implementation
89
+ Workflow: .agentic/00.chat/workflows/chat-promote-to-main.md
90
+
91
+ Default mode: read-only until I grant each required approval.
92
+
93
+ Use the current session log as the first source of truth.
94
+ If there is uncommitted task work, follow .agentic/00.chat/workflows/chat-commit.md and .agentic/00.chat/checklists/before-commit.md.
95
+ Ask for explicit approval before creating any task commit.
96
+ After any task commit, record it with:
97
+ bash scripts/01.harness/run-governed-script.sh --approved-action scripts/00.chat/session-log/record-chat-commit/script.sh <sha> <message> <summary> [adr-impact]
98
+
99
+ Then follow .agentic/00.chat/workflows/chat-promote-to-main.md for local convergence.
100
+ Run the required gates and verification before merging.
101
+ Ask for explicit approval before merging into local main.
102
+ Do not push to origin unless I explicitly approve a separate push.
103
+
104
+ If governance is missing or state is ambiguous, stop and explain the gap."
105
+
106
+ case "${CHAT_COPY_PROMPT:-copy}" in
107
+ skip)
108
+ print_prompt
109
+ ;;
110
+ copy)
111
+ if command -v clip.exe >/dev/null 2>&1; then
112
+ copy_prompt_with_retry "clip.exe" clip.exe || print_prompt
113
+ elif command -v xclip >/dev/null 2>&1; then
114
+ copy_prompt_with_retry "xclip" xclip -selection clipboard || print_prompt
115
+ else
116
+ print_prompt
117
+ fi
118
+ ;;
119
+ *)
120
+ echo "ERROR: invalid CHAT_COPY_PROMPT value: ${CHAT_COPY_PROMPT}" >&2
121
+ echo "Use copy or skip." >&2
122
+ exit 2
123
+ ;;
124
+ esac
@@ -0,0 +1,31 @@
1
+ <!-- agentic-artifact:
2
+ schema: agentic-artifact/v2
3
+ id: chat.script.command.readme
4
+ version: 1
5
+ status: active
6
+ layer: 00.chat
7
+ domain: command
8
+ disciplines:
9
+ - agentic
10
+ kind: script-domain-readme
11
+ purpose: Explain canonical chat command entrypoints.
12
+ portability:
13
+ class: required
14
+ targets:
15
+ - llm-workbench
16
+ used_by:
17
+ - id: chat.commands.readme
18
+ path: .agentic/00.chat/commands/README.md
19
+ - id: chat.script.command.dispatcher.readme
20
+ path: scripts/00.chat/command/dispatcher/README.md
21
+ -->
22
+ # Command Scripts
23
+
24
+ Command scripts are the canonical implementation behind public `npm run chat:*`
25
+ shortcuts. They keep the human command surface stable while allowing the actual
26
+ capabilities to live in domain folders such as `startup`, `closeout`, or
27
+ `reporting`.
28
+
29
+ The command domain is mostly routing. A command entrypoint should delegate to a
30
+ capability script rather than duplicating the capability's logic.
31
+
@@ -0,0 +1,30 @@
1
+ <!-- agentic-artifact:
2
+ schema: agentic-artifact/v2
3
+ id: chat.script.command.close.readme
4
+ version: 1
5
+ status: active
6
+ layer: 00.chat
7
+ domain: command
8
+ disciplines:
9
+ - agentic
10
+ kind: capability-readme
11
+ purpose: Explain the public chat close command entrypoint.
12
+ portability:
13
+ class: required
14
+ targets:
15
+ - llm-workbench
16
+ used_by:
17
+ - id: chat.script.command.close
18
+ path: scripts/00.chat/command/close/script.sh
19
+ -->
20
+ # Close Command
21
+
22
+ `script.sh` is the canonical entrypoint for the public `chat:close` command. It
23
+ delegates to `scripts/00.chat/closeout/build-closeout-prompt/script.sh`.
24
+
25
+ The command exists so humans can use a stable public shortcut without knowing
26
+ where closeout prompt construction lives internally.
27
+
28
+ This command does not commit, merge, or push. It prepares the governed closeout
29
+ prompt for a later agent turn.
30
+
@@ -0,0 +1,25 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ # agentic-artifact:
5
+ # schema: agentic-artifact/v2
6
+ # id: chat.script.command.close
7
+ # version: 1
8
+ # status: active
9
+ # layer: 00.chat
10
+ # domain: command
11
+ # disciplines:
12
+ # - agentic
13
+ # kind: script
14
+ # purpose: Dispatch the public chat close command to the closeout prompt capability.
15
+ # portability:
16
+ # class: required
17
+ # targets:
18
+ # - llm-workbench
19
+ # used_by:
20
+ # - id: chat.script.command.dispatcher
21
+ # path: scripts/00.chat/command/dispatcher/script.sh
22
+ # effects:
23
+ # - read-only
24
+
25
+ exec bash scripts/00.chat/closeout/build-closeout-prompt/script.sh "$@"
@@ -0,0 +1,46 @@
1
+ <!-- agentic-artifact:
2
+ schema: agentic-artifact/v2
3
+ id: chat.script.command.dispatcher.readme
4
+ version: 1
5
+ status: active
6
+ layer: 00.chat
7
+ domain: command
8
+ disciplines:
9
+ - agentic
10
+ kind: capability-readme
11
+ purpose: Explain the chat command dispatcher capability and its script layout.
12
+ portability:
13
+ class: required
14
+ targets:
15
+ - llm-workbench
16
+ used_by:
17
+ - id: harness.architecture.adr.0017-organize-scripts-by-owner-domain-and-capability
18
+ - id: chat.script.command.dispatcher
19
+ path: scripts/00.chat/command/dispatcher/script.sh
20
+ -->
21
+ # Chat Command Dispatcher
22
+
23
+ This capability owns the chat command dispatcher.
24
+
25
+ The dispatcher is the small command-line router for chat commands. It accepts a
26
+ command name such as `list`, `new`, or `close`, validates the name, finds the
27
+ matching script under `scripts/00.chat/command/<name>/script.sh`, and transfers
28
+ control to that command through Bash.
29
+
30
+ The dispatcher is not the implementation of each chat action. The subcommand
31
+ scripts remain separate so each command can evolve independently.
32
+
33
+ ## Files
34
+
35
+ - `script.sh` is the canonical dispatcher entrypoint.
36
+ - `<command>/script.sh` files are canonical command entrypoints.
37
+ - `smoke-test.sh` validates the dispatcher and core chat subcommands in a
38
+ throwaway repository.
39
+
40
+ The dispatcher invokes command scripts with `bash` instead of requiring
41
+ executable mode, so archive extraction or Windows filesystems that strip mode
42
+ bits do not break the public command surface.
43
+
44
+ The old `scripts/shared/chat/commands/` compatibility wrappers have been
45
+ retired. Public callers should use `package.json` `chat:*` scripts; governed
46
+ callers should use canonical `scripts/00.chat/command/...` paths.
@@ -0,0 +1,91 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ # agentic-artifact:
5
+ # schema: agentic-artifact/v2
6
+ # id: chat.script.command.dispatcher
7
+ # version: 1
8
+ # status: active
9
+ # layer: 00.chat
10
+ # domain: command
11
+ # disciplines:
12
+ # - agentic
13
+ # kind: script
14
+ # purpose: Dispatch chat subcommands from canonical scripts/00.chat/command folders.
15
+ # portability:
16
+ # class: required
17
+ # targets:
18
+ # - llm-workbench
19
+ # used_by:
20
+ # - id: chat.commands.readme
21
+ # path: .agentic/00.chat/commands/README.md
22
+ # - id: chat.script.command.dispatcher.readme
23
+ # path: scripts/00.chat/command/dispatcher/README.md
24
+ # - id: chat.script.startup.auto-start-missing-session
25
+ # path: scripts/00.chat/startup/auto-start-missing-session/script.sh
26
+ # effects:
27
+ # - branches
28
+ # - stages-files
29
+ # - worktrees
30
+ # - writes-files
31
+
32
+ COMMAND_DIR="scripts/00.chat/command"
33
+
34
+ usage() {
35
+ cat <<EOF
36
+ Usage: npm run chat -- <command> [args...]
37
+
38
+ Commands:
39
+ EOF
40
+
41
+ if [ -d "$COMMAND_DIR" ]; then
42
+ find "$COMMAND_DIR" -mindepth 2 -maxdepth 2 -type f -path '*/script.sh' \
43
+ ! -path "$COMMAND_DIR/dispatcher/script.sh" \
44
+ | sed -E 's#^scripts/00\.chat/command/([^/]+)/script\.sh$# \1#' \
45
+ | sort
46
+ fi
47
+ }
48
+
49
+ if [ $# -eq 0 ]; then
50
+ usage
51
+ exit 0
52
+ fi
53
+
54
+ case "$1" in
55
+ -h|--help|help|list)
56
+ usage
57
+ exit 0
58
+ ;;
59
+ esac
60
+
61
+ COMMAND_NAME="$1"
62
+ shift
63
+
64
+ if [ "$COMMAND_NAME" = "open" ] && [ "${1:-}" = "window" ]; then
65
+ COMMAND_NAME="open-window"
66
+ shift
67
+ fi
68
+
69
+ case "$COMMAND_NAME" in
70
+ *[!a-zA-Z0-9_-]*|'')
71
+ echo "ERROR: invalid chat command name: $COMMAND_NAME" >&2
72
+ echo "Use letters, numbers, underscores, or hyphens." >&2
73
+ exit 2
74
+ ;;
75
+ esac
76
+
77
+ COMMAND_SCRIPT="${COMMAND_DIR}/${COMMAND_NAME}/script.sh"
78
+
79
+ if [ "$COMMAND_NAME" = "dispatcher" ]; then
80
+ echo "ERROR: unknown chat command: $COMMAND_NAME" >&2
81
+ usage >&2
82
+ exit 2
83
+ fi
84
+
85
+ if [ ! -f "$COMMAND_SCRIPT" ]; then
86
+ echo "ERROR: unknown chat command: $COMMAND_NAME" >&2
87
+ usage >&2
88
+ exit 2
89
+ fi
90
+
91
+ exec bash "$COMMAND_SCRIPT" "$@"