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,182 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ # agentic-artifact:
5
+ # schema: agentic-artifact/v2
6
+ # id: chat.script.startup.start-chat-session.smoke-test
7
+ # version: 1
8
+ # status: active
9
+ # layer: 00.chat
10
+ # domain: startup
11
+ # disciplines:
12
+ # - agentic
13
+ # kind: script
14
+ # purpose: Smoke test chat startup creates a separate chat-owned worktree.
15
+ # portability:
16
+ # class: reusable
17
+ # targets:
18
+ # - llm-workbench
19
+ # used_by:
20
+ # - id: chat.workflows.chat-start
21
+ # path: .agentic/00.chat/workflows/chat-start.md
22
+ # - id: chat.workflows.bootstrap-chat-workbench-repo
23
+ # path: .agentic/00.chat/workflows/bootstrap-chat-workbench-repo.md
24
+ # - id: chat.script.startup.start-chat-session.readme
25
+ # path: scripts/00.chat/startup/start-chat-session/README.md
26
+ # effects:
27
+ # - writes-files
28
+ # - branches
29
+ # - worktrees
30
+ # - commits
31
+ fail() {
32
+ echo "FAIL: $*" >&2
33
+ exit 1
34
+ }
35
+
36
+ SOURCE_ROOT="$(git rev-parse --show-toplevel)"
37
+ TMP_ROOT="$(mktemp -d "${TMPDIR:-/tmp}/chat-worktree-session-smoke.XXXXXX")"
38
+
39
+ cleanup() {
40
+ rm -rf "$TMP_ROOT"
41
+ }
42
+
43
+ trap cleanup EXIT
44
+
45
+ REPO="$TMP_ROOT/repo"
46
+ mkdir -p "$REPO"
47
+ git -C "$REPO" init --quiet --initial-branch=main
48
+
49
+ mkdir -p \
50
+ "$REPO/scripts/00.chat/git/cleanup-empty-chat-branches" \
51
+ "$REPO/scripts/00.chat/session-log/paths" \
52
+ "$REPO/scripts/00.chat/startup/start-chat-session" \
53
+ "$REPO/scripts/00.chat/worktree/ensure-chat-worktree" \
54
+ "$REPO/scripts/00.chat/worktree/open-window" \
55
+ "$REPO/scripts/00.chat/worktree/paths"
56
+
57
+ cp "$SOURCE_ROOT/scripts/00.chat/session-log/paths/lib.sh" "$REPO/scripts/00.chat/session-log/paths/lib.sh"
58
+ cp "$SOURCE_ROOT/scripts/00.chat/worktree/paths/lib.sh" "$REPO/scripts/00.chat/worktree/paths/lib.sh"
59
+ cp "$SOURCE_ROOT/scripts/00.chat/worktree/ensure-chat-worktree/script.sh" "$REPO/scripts/00.chat/worktree/ensure-chat-worktree/script.sh"
60
+ cp "$SOURCE_ROOT/scripts/00.chat/startup/start-chat-session/script.sh" "$REPO/scripts/00.chat/startup/start-chat-session/script.sh"
61
+ cp "$SOURCE_ROOT/scripts/00.chat/git/cleanup-empty-chat-branches/script.sh" "$REPO/scripts/00.chat/git/cleanup-empty-chat-branches/script.sh"
62
+ cp "$SOURCE_ROOT/scripts/00.chat/worktree/open-window/script.sh" "$REPO/scripts/00.chat/worktree/open-window/script.sh"
63
+ chmod +x "$REPO/scripts/00.chat/startup/start-chat-session/script.sh" "$REPO/scripts/00.chat/worktree/ensure-chat-worktree/script.sh" "$REPO/scripts/00.chat/worktree/open-window/script.sh" "$REPO/scripts/00.chat/git/cleanup-empty-chat-branches/script.sh"
64
+
65
+ printf 'base\n' > "$REPO/README.md"
66
+ git -C "$REPO" add README.md scripts
67
+ git -C "$REPO" -c user.name='Smoke Test' -c user.email='smoke@example.invalid' commit --quiet -m 'base'
68
+
69
+ AGENTIC_CHAT_WORKTREE_ROOT="$TMP_ROOT/worktrees" \
70
+ CHAT_CLEANUP_EMPTY_BRANCHES=skip \
71
+ CHAT_COPY_PROMPT=skip \
72
+ bash -c 'cd "$1" && shift && "$@"' sh "$REPO" \
73
+ bash scripts/00.chat/startup/start-chat-session/script.sh "test chat worktree session" \
74
+ >"$TMP_ROOT/chat-worktree-session.out"
75
+
76
+ if ! grep -q 'Skipping VS Code window open:' "$TMP_ROOT/chat-worktree-session.out"; then
77
+ fail "startup did not skip VS Code window open by default"
78
+ fi
79
+
80
+ root_branch="$(git -C "$REPO" branch --show-current)"
81
+ if [ "$root_branch" != "main" ]; then
82
+ fail "root branch changed to $root_branch"
83
+ fi
84
+
85
+ chat_branch="$(git -C "$REPO" branch --format='%(refname:short)' | grep '^chat/' | head -n 1)"
86
+ if [ -z "$chat_branch" ]; then
87
+ fail "chat branch was not created"
88
+ fi
89
+
90
+ worktree_path="$(
91
+ git -C "$REPO" worktree list --porcelain \
92
+ | awk -v branch="refs/heads/${chat_branch}" '
93
+ /^worktree / { path = substr($0, 10) }
94
+ /^branch / && substr($0, 8) == branch { print path }
95
+ '
96
+ )"
97
+
98
+ if [ -z "$worktree_path" ] || [ "$worktree_path" = "$REPO" ]; then
99
+ fail "chat branch does not have a separate worktree"
100
+ fi
101
+
102
+ if [ -n "$(git -C "$REPO" diff --cached --name-only)" ]; then
103
+ fail "root worktree has staged changes"
104
+ fi
105
+
106
+ if ! git -C "$worktree_path" diff --cached --name-only | grep -q '^commitLogs/'; then
107
+ fail "chat worktree did not stage the session log"
108
+ fi
109
+
110
+ session_log="$(git -C "$worktree_path" diff --cached --name-only | grep '^commitLogs/.*/README.md$' | head -n 1)"
111
+ if [ -z "$session_log" ]; then
112
+ fail "could not find staged session log"
113
+ fi
114
+
115
+ layer="$(sed -n '/<!-- agentic-session/,/-->/s/^layer: //p' "$worktree_path/$session_log" | head -n 1)"
116
+ mode="$(sed -n '/<!-- agentic-session/,/-->/s/^mode: //p' "$worktree_path/$session_log" | head -n 1)"
117
+ workflow="$(sed -n '/<!-- agentic-session/,/-->/s/^workflow: //p' "$worktree_path/$session_log" | head -n 1)"
118
+ chat_lifecycle_workflow="$(sed -n '/<!-- agentic-session/,/-->/s/^chat_lifecycle_workflow: //p' "$worktree_path/$session_log" | head -n 1)"
119
+
120
+ if [ -n "$layer" ] || [ -n "$mode" ] || [ -n "$workflow" ]; then
121
+ fail "chat startup wrote durable classification fields"
122
+ fi
123
+
124
+ if [ "$chat_lifecycle_workflow" != ".agentic/00.chat/workflows/chat-start.md" ]; then
125
+ fail "chat startup did not record the chat lifecycle workflow: ${chat_lifecycle_workflow:-missing}"
126
+ fi
127
+
128
+ if ! sed -n '/<!-- agentic-session/,/-->/p' "$worktree_path/$session_log" | grep -q '^latest_context_packet_id:$'; then
129
+ fail "chat startup did not initialize latest_context_packet_id"
130
+ fi
131
+
132
+ if ! sed -n '/<!-- agentic-session/,/-->/p' "$worktree_path/$session_log" | grep -q '^latest_context_packet_routing_summary:$'; then
133
+ fail "chat startup did not initialize latest_context_packet_routing_summary"
134
+ fi
135
+
136
+ FAKE_BIN="$TMP_ROOT/fake-bin"
137
+ mkdir -p "$FAKE_BIN"
138
+ cat > "$FAKE_BIN/clip.exe" <<'EOF'
139
+ #!/usr/bin/env bash
140
+ cat >/dev/null
141
+ exit 1
142
+ EOF
143
+ chmod +x "$FAKE_BIN/clip.exe"
144
+
145
+ AGENTIC_CHAT_WORKTREE_ROOT="$TMP_ROOT/worktrees" \
146
+ CHAT_CLEANUP_EMPTY_BRANCHES=skip \
147
+ CHAT_COPY_PROMPT=copy \
148
+ CHAT_OPEN_WORKTREE_WINDOW=skip \
149
+ PATH="$FAKE_BIN:$PATH" \
150
+ bash -c 'cd "$1" && shift && "$@"' sh "$REPO" \
151
+ bash scripts/00.chat/startup/start-chat-session/script.sh "test clipboard fallback session" \
152
+ >"$TMP_ROOT/chat-worktree-session-clipboard.out" 2>&1
153
+
154
+ if ! grep -q 'WARNING: Clipboard copy via clip.exe failed; printing prompt instead.' "$TMP_ROOT/chat-worktree-session-clipboard.out"; then
155
+ fail "clipboard failure did not warn before falling back"
156
+ fi
157
+
158
+ if ! grep -q 'Paste this into Codex / Claude / Mistral:' "$TMP_ROOT/chat-worktree-session-clipboard.out"; then
159
+ fail "clipboard failure did not print the first prompt"
160
+ fi
161
+
162
+ if ! grep -q 'Governed startup bootstrap has already created this chat branch, worktree, and session log.' "$TMP_ROOT/chat-worktree-session-clipboard.out"; then
163
+ fail "first prompt did not explain startup bootstrap boundary"
164
+ fi
165
+
166
+ if ! grep -q 'Default mode after startup bootstrap: read-only until I grant write permission in this chat.' "$TMP_ROOT/chat-worktree-session-clipboard.out"; then
167
+ fail "first prompt did not preserve task write permission boundary"
168
+ fi
169
+
170
+ if ! grep -q "For prompt-level routing, use the current user request, this repo's assistant instructions, and any repo-provided context router if one exists." "$TMP_ROOT/chat-worktree-session-clipboard.out"; then
171
+ fail "first prompt did not explain neutral prompt-level routing"
172
+ fi
173
+
174
+ if ! grep -q 'Do not assign the whole chat a durable layer, mode, or workflow.' "$TMP_ROOT/chat-worktree-session-clipboard.out"; then
175
+ fail "first prompt did not preserve durable classification guard"
176
+ fi
177
+
178
+ if grep -q 'query the RAG/rulebook runtime' "$TMP_ROOT/chat-worktree-session-clipboard.out"; then
179
+ fail "first prompt assumes a RAG/rulebook runtime exists"
180
+ fi
181
+
182
+ echo "chat worktree session smoke test passed."
@@ -0,0 +1,31 @@
1
+ <!-- agentic-artifact:
2
+ schema: agentic-artifact/v2
3
+ id: chat.script.startup.start-new-chat.readme
4
+ version: 1
5
+ status: active
6
+ layer: 00.chat
7
+ domain: startup
8
+ disciplines:
9
+ - agentic
10
+ kind: capability-readme
11
+ purpose: Explain the new-chat startup wrapper.
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.startup.start-new-chat
20
+ path: scripts/00.chat/startup/start-new-chat/script.sh
21
+ -->
22
+ # Start New Chat
23
+
24
+ `script.sh` is the canonical startup wrapper used by the public `new` command.
25
+ It delegates to `scripts/00.chat/startup/start-chat-session/script.sh`.
26
+
27
+ This wrapper exists so the public command surface can use a human phrase
28
+ (`new`) while the full startup engine keeps its descriptive capability name.
29
+
30
+ It can create branches, worktrees, and session logs through the startup engine.
31
+
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ # agentic-artifact:
5
+ # schema: agentic-artifact/v2
6
+ # id: chat.script.startup.start-new-chat
7
+ # version: 1
8
+ # status: active
9
+ # layer: 00.chat
10
+ # domain: startup
11
+ # disciplines:
12
+ # - agentic
13
+ # kind: script
14
+ # purpose: Start a new governed chat session through the startup engine.
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
+ # - branches
26
+ # - worktrees
27
+ # - writes-files
28
+ # - stages-files
29
+ exec bash scripts/00.chat/startup/start-chat-session/script.sh "$@"
@@ -0,0 +1,36 @@
1
+ <!-- agentic-artifact:
2
+ schema: agentic-artifact/v2
3
+ id: chat.script.transcript.readme
4
+ version: 1
5
+ status: active
6
+ layer: 00.chat
7
+ domain: transcript
8
+ disciplines:
9
+ - agentic
10
+ kind: script-domain-readme
11
+ purpose: Explain transcript discovery and registration scripts.
12
+ portability:
13
+ class: required
14
+ targets:
15
+ - llm-workbench
16
+ used_by:
17
+ - id: chat.workflows.chat-start
18
+ path: .agentic/00.chat/workflows/chat-start.md
19
+ - id: chat.script.transcript.register-codex-session-log.readme
20
+ path: scripts/00.chat/transcript/register-codex-session-log/README.md
21
+ -->
22
+ # Transcript Scripts
23
+
24
+ Transcript scripts connect chat session logs to assistant transcript evidence.
25
+ The core metadata is provider-neutral:
26
+
27
+ - `transcript_provider`
28
+ - `transcript_path`
29
+ - `transcript_bytes`
30
+ - `transcript_source`
31
+
32
+ Codex JSONL discovery is one optional adapter for filling those fields. Other
33
+ assistants can provide transcript byte counts or paths directly.
34
+
35
+ These scripts inspect local transcript files. They do not upload transcripts or
36
+ depend on network access.
@@ -0,0 +1,32 @@
1
+ <!-- agentic-artifact:
2
+ schema: agentic-artifact/v2
3
+ id: chat.script.transcript.discover-codex-session-log.readme
4
+ version: 1
5
+ status: active
6
+ layer: 00.chat
7
+ domain: transcript
8
+ disciplines:
9
+ - agentic
10
+ kind: capability-readme
11
+ purpose: Explain local Codex transcript discovery for a chat session.
12
+ portability:
13
+ class: required
14
+ targets:
15
+ - llm-workbench
16
+ used_by:
17
+ - id: chat.script.transcript.discover-codex-session-log
18
+ path: scripts/00.chat/transcript/discover-codex-session-log/script.sh
19
+ - id: chat.script.transcript.register-codex-session-log
20
+ path: scripts/00.chat/transcript/register-codex-session-log/script.sh
21
+ -->
22
+ # Discover Codex Session Log
23
+
24
+ `script.sh` searches the local Codex sessions directory for the JSONL
25
+ transcript that matches a chat session id, branch, or session log path.
26
+
27
+ It prints the newest matching transcript path. The result is used by commit
28
+ recording and transcript registration so chat metrics can be tied to actual
29
+ local evidence.
30
+
31
+ The script is read-only. It does not modify the session log or transcript.
32
+
@@ -0,0 +1,106 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ # agentic-artifact:
5
+ # schema: agentic-artifact/v2
6
+ # id: chat.script.transcript.discover-codex-session-log
7
+ # version: 1
8
+ # status: active
9
+ # layer: 00.chat
10
+ # domain: transcript
11
+ # disciplines:
12
+ # - agentic
13
+ # kind: script
14
+ # purpose: Find the Codex JSONL transcript for a chat session.
15
+ # portability:
16
+ # class: required
17
+ # targets:
18
+ # - llm-workbench
19
+ # used_by:
20
+ # - id: chat.script.transcript.register-codex-session-log
21
+ # path: scripts/00.chat/transcript/register-codex-session-log/script.sh
22
+ # - id: chat.script.session-log.record-chat-commit
23
+ # path: scripts/00.chat/session-log/record-chat-commit/script.sh
24
+ # effects:
25
+ # - read-only
26
+
27
+ usage() {
28
+ cat <<'EOF'
29
+ Usage:
30
+ discover-codex-session-log.sh <session-id> [session-log-path]
31
+
32
+ Finds the Codex JSONL session log that contains the chat session id, branch, or
33
+ session log path. Prints the newest matching path.
34
+ EOF
35
+ }
36
+
37
+ if [ $# -lt 1 ] || [ $# -gt 2 ]; then
38
+ usage >&2
39
+ exit 2
40
+ fi
41
+
42
+ SESSION_ID="$1"
43
+ SESSION_LOG_PATH="${2:-}"
44
+ CODEX_HOME_DIR="${CODEX_HOME:-${HOME}/.codex}"
45
+
46
+ if [ -z "${SESSION_ID// }" ]; then
47
+ echo "ERROR: session id is required." >&2
48
+ exit 2
49
+ fi
50
+
51
+ if [ ! -d "$CODEX_HOME_DIR" ]; then
52
+ echo "ERROR: Codex home directory does not exist: $CODEX_HOME_DIR" >&2
53
+ exit 1
54
+ fi
55
+
56
+ TMP_MATCHES="$(mktemp)"
57
+ trap 'rm -f "$TMP_MATCHES"' EXIT
58
+
59
+ append_match() {
60
+ local file="$1"
61
+ local mtime
62
+
63
+ if ! mtime="$(stat -c '%Y' "$file" 2>/dev/null)"; then
64
+ if ! mtime="$(stat -f '%m' "$file" 2>/dev/null)"; then
65
+ return
66
+ fi
67
+ fi
68
+
69
+ if [ -z "${mtime// }" ]; then
70
+ return
71
+ fi
72
+
73
+ printf '%s\t%s\n' "$mtime" "$file" >> "$TMP_MATCHES"
74
+ }
75
+
76
+ matches_file() {
77
+ local file="$1"
78
+
79
+ grep -Fq "$SESSION_ID" "$file" && return 0
80
+ grep -Fq "chat/${SESSION_ID}" "$file" && return 0
81
+
82
+ if [ -n "${SESSION_LOG_PATH// }" ]; then
83
+ grep -Fq "$SESSION_LOG_PATH" "$file" && return 0
84
+ fi
85
+
86
+ return 1
87
+ }
88
+
89
+ for root in "$CODEX_HOME_DIR/sessions" "$CODEX_HOME_DIR/archived_sessions"; do
90
+ if [ ! -d "$root" ]; then
91
+ continue
92
+ fi
93
+
94
+ while IFS= read -r -d '' file; do
95
+ if matches_file "$file"; then
96
+ append_match "$file"
97
+ fi
98
+ done < <(find "$root" -type f -name '*.jsonl' -print0)
99
+ done
100
+
101
+ if [ ! -s "$TMP_MATCHES" ]; then
102
+ echo "ERROR: no Codex session log matched session: $SESSION_ID" >&2
103
+ exit 1
104
+ fi
105
+
106
+ sort -rn "$TMP_MATCHES" | head -n 1 | cut -f2-
@@ -0,0 +1,32 @@
1
+ <!-- agentic-artifact:
2
+ schema: agentic-artifact/v2
3
+ id: chat.script.transcript.register-codex-session-log.readme
4
+ version: 1
5
+ status: active
6
+ layer: 00.chat
7
+ domain: transcript
8
+ disciplines:
9
+ - agentic
10
+ kind: capability-readme
11
+ purpose: Explain recording the local Codex transcript path in the current chat log.
12
+ portability:
13
+ class: required
14
+ targets:
15
+ - llm-workbench
16
+ used_by:
17
+ - id: chat.workflows.chat-start
18
+ path: .agentic/00.chat/workflows/chat-start.md
19
+ - id: chat.script.transcript.register-codex-session-log
20
+ path: scripts/00.chat/transcript/register-codex-session-log/script.sh
21
+ -->
22
+ # Register Codex Session Log
23
+
24
+ `script.sh` discovers the current chat's local Codex JSONL transcript and
25
+ records that path in the current session log metadata.
26
+
27
+ Registration lets later commit recording estimate transcript-derived metrics
28
+ without rediscovering the transcript from scratch.
29
+
30
+ This script writes session-log metadata. It does not create commits or copy
31
+ transcript content into the repository.
32
+
@@ -0,0 +1,115 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ # agentic-artifact:
5
+ # schema: agentic-artifact/v2
6
+ # id: chat.script.transcript.register-codex-session-log
7
+ # version: 1
8
+ # status: active
9
+ # layer: 00.chat
10
+ # domain: transcript
11
+ # disciplines:
12
+ # - agentic
13
+ # kind: script
14
+ # purpose: Record the discovered Codex transcript path as neutral transcript metadata.
15
+ # portability:
16
+ # class: required
17
+ # targets:
18
+ # - llm-workbench
19
+ # used_by:
20
+ # - id: chat.workflows.chat-start
21
+ # path: .agentic/00.chat/workflows/chat-start.md
22
+ # - id: chat.script.session-log.record-chat-commit
23
+ # path: scripts/00.chat/session-log/record-chat-commit/script.sh
24
+ # effects:
25
+ # - writes-files
26
+
27
+ # shellcheck source=../../session-log/paths/lib.sh
28
+ source "scripts/00.chat/session-log/paths/lib.sh"
29
+
30
+ usage() {
31
+ cat <<'EOF'
32
+ Usage:
33
+ register-codex-session-log.sh
34
+
35
+ Discovers the current chat's Codex JSONL session log and records it as neutral
36
+ transcript metadata in the current chat session log.
37
+ EOF
38
+ }
39
+
40
+ if [ $# -ne 0 ]; then
41
+ usage >&2
42
+ exit 2
43
+ fi
44
+
45
+ BRANCH="$(git branch --show-current)"
46
+
47
+ if ! SESSION_ID="$(chat_session_id_from_branch "$BRANCH")"; then
48
+ echo "ERROR: current branch is not a chat branch: $BRANCH" >&2
49
+ exit 1
50
+ fi
51
+
52
+ LOG_FILE="$(chat_log_file_for_session "$SESSION_ID")"
53
+
54
+ if [ ! -f "$LOG_FILE" ]; then
55
+ echo "ERROR: missing chat log: $LOG_FILE" >&2
56
+ exit 1
57
+ fi
58
+
59
+ CODEX_SESSION_LOG_PATH="$(bash scripts/00.chat/transcript/discover-codex-session-log/script.sh "$SESSION_ID" "$LOG_FILE")"
60
+
61
+ if [ ! -f "$CODEX_SESSION_LOG_PATH" ]; then
62
+ echo "ERROR: discovered Codex session log is not a file: $CODEX_SESSION_LOG_PATH" >&2
63
+ exit 1
64
+ fi
65
+
66
+ tmp="$(mktemp)"
67
+
68
+ awk -v transcript_provider="codex" -v transcript_path="$CODEX_SESSION_LOG_PATH" '
69
+ BEGIN {
70
+ in_meta = 0
71
+ wrote_provider = 0
72
+ wrote_path = 0
73
+ }
74
+ /^<!-- agentic-session/ {
75
+ in_meta = 1
76
+ print
77
+ next
78
+ }
79
+ in_meta && /^transcript_provider:/ {
80
+ print "transcript_provider: " transcript_provider
81
+ wrote_provider = 1
82
+ next
83
+ }
84
+ in_meta && /^transcript_path:/ {
85
+ print "transcript_path: " transcript_path
86
+ wrote_path = 1
87
+ next
88
+ }
89
+ in_meta && /^codex_session_log_path:/ {
90
+ next
91
+ }
92
+ in_meta && /^-->/ {
93
+ if (wrote_provider == 0) {
94
+ print "transcript_provider: " transcript_provider
95
+ wrote_provider = 1
96
+ }
97
+ if (wrote_path == 0) {
98
+ print "transcript_path: " transcript_path
99
+ wrote_path = 1
100
+ }
101
+ in_meta = 0
102
+ print
103
+ next
104
+ }
105
+ {
106
+ print
107
+ }
108
+ ' "$LOG_FILE" > "$tmp"
109
+
110
+ mv "$tmp" "$LOG_FILE"
111
+
112
+ echo "Registered Codex session log:"
113
+ echo "session_log=$LOG_FILE"
114
+ echo "transcript_provider=codex"
115
+ echo "transcript_path=$CODEX_SESSION_LOG_PATH"
@@ -0,0 +1,32 @@
1
+ <!-- agentic-artifact:
2
+ schema: agentic-artifact/v2
3
+ id: chat.script.worktree.readme
4
+ version: 1
5
+ status: active
6
+ layer: 00.chat
7
+ domain: worktree
8
+ disciplines:
9
+ - agentic
10
+ kind: script-domain-readme
11
+ purpose: Explain chat-owned worktree scripts and helpers.
12
+ portability:
13
+ class: required
14
+ targets:
15
+ - llm-workbench
16
+ used_by:
17
+ - id: chat.workflows.chat-start
18
+ path: .agentic/00.chat/workflows/chat-start.md
19
+ - id: chat.script.worktree.ensure-chat-worktree.readme
20
+ path: scripts/00.chat/worktree/ensure-chat-worktree/README.md
21
+ -->
22
+ # Worktree Scripts
23
+
24
+ Worktree scripts keep chat task work in the right checkout. The root worktree is
25
+ the integration console; each chat should edit in its own sibling worktree.
26
+
27
+ This domain provides path helpers, write-location checks, dirty-state checks,
28
+ and worktree creation/verification.
29
+
30
+ The goal is not to make Git clever. The goal is to prevent accidental edits in
31
+ the wrong place.
32
+
@@ -0,0 +1,87 @@
1
+ <!-- agentic-artifact:
2
+ schema: agentic-artifact/v2
3
+ id: chat.script.worktree.check-write-location.readme
4
+ version: 1
5
+ status: active
6
+ layer: 00.chat
7
+ domain: worktree
8
+ disciplines:
9
+ - agentic
10
+ kind: capability-readme
11
+ purpose: Explain how chat work is kept inside chat-owned worktrees rather than the
12
+ root integration worktree.
13
+ portability:
14
+ class: required
15
+ targets:
16
+ - llm-workbench
17
+ used_by:
18
+ - id: chat.script.worktree.check-write-location
19
+ path: scripts/00.chat/worktree/check-write-location/script.sh
20
+ - id: harness.architecture.adr.0017-organize-scripts-by-owner-domain-and-capability
21
+ -->
22
+ # Check Write Location
23
+
24
+ `script.sh` verifies that task work is happening in the chat-owned worktree for
25
+ the current `chat/*` branch.
26
+
27
+ The root worktree is the integration console. It is where completed chat work is
28
+ reviewed, merged, and coordinated. Task edits should happen in the sibling
29
+ worktree created for that chat branch.
30
+
31
+ ## Mental Model
32
+
33
+ Each chat branch has one canonical worktree path. If an agent edits from the
34
+ root integration worktree, it can mix task work with local integration state. If
35
+ an agent edits a chat branch from an unexpected worktree, the harness can no
36
+ longer rely on its branch-to-directory ownership model.
37
+
38
+ This gate protects that invariant before write-heavy or commit-boundary work.
39
+
40
+ ## Checks
41
+
42
+ The script verifies:
43
+
44
+ - the current repository path is not the primary/root worktree, unless explicit
45
+ root maintenance is allowed
46
+ - the current branch is a `chat/*` branch
47
+ - the current path matches the canonical chat worktree path for that branch
48
+
49
+ On success it prints:
50
+
51
+ ```txt
52
+ chat-worktree
53
+ ```
54
+
55
+ ## Root Maintenance Escape Hatch
56
+
57
+ Root maintenance is allowed only when explicit:
58
+
59
+ ```bash
60
+ AGENTIC_ALLOW_ROOT_WRITE=1 bash scripts/00.chat/worktree/check-write-location/script.sh
61
+ ```
62
+
63
+ or:
64
+
65
+ ```bash
66
+ bash scripts/00.chat/worktree/check-write-location/script.sh --allow-root-maintenance
67
+ ```
68
+
69
+ This is for intentional root/integration maintenance, not ordinary task work.
70
+
71
+ ## What This Does Not Do
72
+
73
+ - It does not move files into the chat worktree.
74
+ - It does not create the chat worktree.
75
+ - It does not switch branches.
76
+ - It does not decide that root work is safe.
77
+ - It does not commit anything.
78
+
79
+ ## Compatibility
80
+
81
+ The old shared path remains available:
82
+
83
+ ```bash
84
+ scripts/00.chat/worktree/check-write-location/script.sh
85
+ ```
86
+
87
+ That file is now a compatibility wrapper around the canonical implementation.