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,121 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ # agentic-artifact:
5
+ # schema: agentic-artifact/v2
6
+ # id: chat.script.session-log.check-commit-prerequisites
7
+ # version: 1
8
+ # status: active
9
+ # layer: 00.chat
10
+ # domain: session-log
11
+ # disciplines:
12
+ # - agentic
13
+ # kind: script
14
+ # purpose: Verify commit-boundary workflow, checklist, and referenced gate files exist.
15
+ # portability:
16
+ # class: required
17
+ # targets:
18
+ # - llm-workbench
19
+ # used_by:
20
+ # - id: chat.script.session-log.check-commit-prerequisites.readme
21
+ # path: scripts/00.chat/session-log/check-commit-prerequisites/README.md
22
+ # - id: chat.script.session-log.check-commit-prerequisites.smoke-test
23
+ # path: scripts/00.chat/session-log/check-commit-prerequisites/smoke-test.sh
24
+ # effects:
25
+ # - read-only
26
+
27
+ # shellcheck source=../paths/lib.sh
28
+ source "scripts/00.chat/session-log/paths/lib.sh"
29
+
30
+ BRANCH="$(git branch --show-current)"
31
+ CHECKLIST=".agentic/00.chat/checklists/before-commit.md"
32
+
33
+ if ! SESSION_ID="$(chat_session_id_from_branch "$BRANCH")"; then
34
+ echo "ERROR: current branch is not a chat branch: $BRANCH" >&2
35
+ exit 1
36
+ fi
37
+
38
+ LOG_FILE="$(chat_log_file_for_session "$SESSION_ID")"
39
+ FAILURES=0
40
+
41
+ fail() {
42
+ echo "ERROR: $*" >&2
43
+ FAILURES=$((FAILURES + 1))
44
+ }
45
+
46
+ ok() {
47
+ echo "OK: $*"
48
+ }
49
+
50
+ metadata_value() {
51
+ local key="$1"
52
+ sed -n "/<!-- agentic-session/,/-->/s/^${key}: //p" "$LOG_FILE" | head -n 1
53
+ }
54
+
55
+ check_file() {
56
+ local path="$1"
57
+ local description="$2"
58
+
59
+ if [ -f "$path" ]; then
60
+ ok "$description exists: $path"
61
+ else
62
+ fail "$description is missing: $path"
63
+ fi
64
+ }
65
+
66
+ collect_script_refs() {
67
+ local file="$1"
68
+
69
+ if [ ! -f "$file" ]; then
70
+ return
71
+ fi
72
+
73
+ grep -Eo "scripts/[^ \`\"']+\.sh" "$file" || true
74
+ }
75
+
76
+ if [ ! -f "$LOG_FILE" ]; then
77
+ fail "missing chat log: $LOG_FILE"
78
+ else
79
+ ok "chat log exists: $LOG_FILE"
80
+ fi
81
+
82
+ WORKFLOW=""
83
+ if [ -f "$LOG_FILE" ]; then
84
+ WORKFLOW="$(metadata_value "chat_lifecycle_workflow")"
85
+ if [ -z "${WORKFLOW// }" ]; then
86
+ WORKFLOW="$(metadata_value "workflow")"
87
+ fi
88
+ fi
89
+
90
+ if [ -z "${WORKFLOW// }" ]; then
91
+ fail "session metadata is missing chat_lifecycle_workflow"
92
+ else
93
+ check_file "$WORKFLOW" "declared chat lifecycle workflow"
94
+ fi
95
+
96
+ check_file "$CHECKLIST" "canonical before-commit checklist"
97
+
98
+ SCRIPT_REFS=""
99
+ if [ -n "${WORKFLOW// }" ] && [ -f "$WORKFLOW" ]; then
100
+ SCRIPT_REFS="$SCRIPT_REFS
101
+ $(collect_script_refs "$WORKFLOW")"
102
+ fi
103
+
104
+ if [ -f "$CHECKLIST" ]; then
105
+ SCRIPT_REFS="$SCRIPT_REFS
106
+ $(collect_script_refs "$CHECKLIST")"
107
+ fi
108
+
109
+ while IFS= read -r script_path; do
110
+ if [ -z "${script_path// }" ]; then
111
+ continue
112
+ fi
113
+ check_file "$script_path" "referenced gate script"
114
+ done < <(printf '%s\n' "$SCRIPT_REFS" | sort -u)
115
+
116
+ if [ "$FAILURES" -gt 0 ]; then
117
+ echo "Commit prerequisites are missing. Repair branch state before committing." >&2
118
+ exit 1
119
+ fi
120
+
121
+ echo "Commit prerequisites are present."
@@ -0,0 +1,119 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ # agentic-artifact:
5
+ # schema: agentic-artifact/v2
6
+ # id: chat.script.session-log.check-commit-prerequisites.smoke-test
7
+ # version: 1
8
+ # status: active
9
+ # layer: 00.chat
10
+ # domain: session-log
11
+ # disciplines:
12
+ # - agentic
13
+ # kind: script
14
+ # purpose: Smoke test commit prerequisite validation and missing-file failures.
15
+ # portability:
16
+ # class: reusable
17
+ # targets:
18
+ # - llm-workbench
19
+ # used_by:
20
+ # - id: chat.script.session-log.check-commit-prerequisites.readme
21
+ # path: scripts/00.chat/session-log/check-commit-prerequisites/README.md
22
+ # - id: chat.script.session-log.check-commit-prerequisites
23
+ # path: scripts/00.chat/session-log/check-commit-prerequisites/script.sh
24
+ # effects:
25
+ # - writes-files
26
+ # - branches
27
+ # - commits
28
+ fail() {
29
+ echo "FAIL: $*" >&2
30
+ exit 1
31
+ }
32
+
33
+ SOURCE_ROOT="$(git rev-parse --show-toplevel)"
34
+ TMP_ROOT="$(mktemp -d "${TMPDIR:-/tmp}/commit-prerequisites-smoke.XXXXXX")"
35
+
36
+ cleanup() {
37
+ rm -rf "$TMP_ROOT"
38
+ }
39
+
40
+ trap cleanup EXIT
41
+
42
+ REPO="$TMP_ROOT/repo"
43
+ mkdir -p "$REPO"
44
+ git -C "$REPO" init --quiet --initial-branch=main
45
+
46
+ mkdir -p \
47
+ "$REPO/.agentic/00.chat/checklists" \
48
+ "$REPO/.agentic/00.chat/workflows" \
49
+ "$REPO/commitLogs/2026/jun/19/2026-06-19-13-11-test" \
50
+ "$REPO/scripts/00.chat/session-log/check-commit-prerequisites" \
51
+ "$REPO/scripts/00.chat/session-log/read-current-chat-log" \
52
+ "$REPO/scripts/00.chat/session-log/paths" \
53
+ "$REPO/scripts/01.harness"
54
+
55
+ cp "$SOURCE_ROOT/scripts/00.chat/session-log/paths/lib.sh" "$REPO/scripts/00.chat/session-log/paths/lib.sh"
56
+ cp "$SOURCE_ROOT/scripts/00.chat/session-log/check-commit-prerequisites/script.sh" "$REPO/scripts/00.chat/session-log/check-commit-prerequisites/script.sh"
57
+ chmod +x "$REPO/scripts/00.chat/session-log/check-commit-prerequisites/script.sh"
58
+
59
+ cat > "$REPO/.agentic/00.chat/checklists/before-commit.md" <<'EOF'
60
+ # Before Commit
61
+
62
+ Run:
63
+
64
+ ```bash
65
+ bash scripts/00.chat/session-log/check-commit-prerequisites/script.sh
66
+ ```
67
+ EOF
68
+
69
+ cat > "$REPO/.agentic/00.chat/workflows/chat-start.md" <<'EOF'
70
+ # Chat Start
71
+
72
+ Run:
73
+
74
+ ```bash
75
+ bash scripts/00.chat/session-log/read-current-chat-log/script.sh
76
+ ```
77
+
78
+ The executable startup scripts live under canonical `scripts/00.chat/`
79
+ capability folders.
80
+ EOF
81
+
82
+ printf '#!/usr/bin/env bash\n' > "$REPO/scripts/00.chat/session-log/read-current-chat-log/script.sh"
83
+
84
+ cat > "$REPO/commitLogs/2026/jun/19/2026-06-19-13-11-test/README.md" <<'EOF'
85
+ # Chat Session: test
86
+
87
+ <!-- agentic-session
88
+ id: 2026-06-19-13-11-test
89
+ task: test
90
+ branch: chat/2026-06-19-13-11-test
91
+ worktree:
92
+ chat_lifecycle_workflow: .agentic/00.chat/workflows/chat-start.md
93
+ latest_context_packet_id:
94
+ latest_context_packet_routing_summary:
95
+ latest_context_packet_at_utc:
96
+ status: ready
97
+ -->
98
+ EOF
99
+
100
+ git -C "$REPO" add .
101
+ git -C "$REPO" -c user.name='Smoke Test' -c user.email='smoke@example.invalid' commit --quiet -m 'base'
102
+ git -C "$REPO" switch --quiet -c chat/2026-06-19-13-11-test
103
+
104
+ if sed -n '/<!-- agentic-session/,/-->/p' "$REPO/commitLogs/2026/jun/19/2026-06-19-13-11-test/README.md" | grep -Eq '^(layer|mode|workflow): '; then
105
+ fail "smoke fixture contains durable classification metadata"
106
+ fi
107
+
108
+ bash -c 'cd "$1" && shift && "$@"' sh "$REPO" \
109
+ bash scripts/00.chat/session-log/check-commit-prerequisites/script.sh \
110
+ >"$TMP_ROOT/out"
111
+
112
+ grep -q 'Commit prerequisites are present.' "$TMP_ROOT/out" \
113
+ || fail "commit prerequisites did not pass with prose directory reference"
114
+
115
+ if grep -q 'scripts/00.chat/ is missing' "$TMP_ROOT/out"; then
116
+ fail "directory prose reference was treated as a missing script"
117
+ fi
118
+
119
+ echo "commit prerequisites smoke test passed."
@@ -0,0 +1,90 @@
1
+ <!-- agentic-artifact:
2
+ schema: agentic-artifact/v2
3
+ id: chat.script.session-log.check-commitlog-deletions.readme
4
+ version: 1
5
+ status: active
6
+ layer: 00.chat
7
+ domain: session-log
8
+ disciplines:
9
+ - agentic
10
+ kind: capability-readme
11
+ purpose: Explain how the harness protects commit logs that record committed work.
12
+ portability:
13
+ class: required
14
+ targets:
15
+ - llm-workbench
16
+ used_by:
17
+ - id: chat.script.session-log.check-commitlog-deletions
18
+ path: scripts/00.chat/session-log/check-commitlog-deletions/script.sh
19
+ - id: chat.script.session-log.check-commitlog-deletions.smoke-test
20
+ path: scripts/00.chat/session-log/check-commitlog-deletions/smoke-test.sh
21
+ - id: harness.architecture.adr.0017-organize-scripts-by-owner-domain-and-capability
22
+ -->
23
+ # Check Commit Log Deletions
24
+
25
+ `script.sh` blocks staged deletion of chat commit logs that contain durable work
26
+ history.
27
+
28
+ It protects the audit trail. Empty or unsaved session logs can be removed by an
29
+ intentional cleanup commit, but logs that record completed work or are marked for
30
+ retention should not disappear as part of an ordinary task commit.
31
+
32
+ ## Mental Model
33
+
34
+ Commit logs are not scratch files once they record committed work. They explain
35
+ why a chat branch existed, what was decided, which commits landed, and what
36
+ follow-up may still matter.
37
+
38
+ This gate watches the staged deletion set. If a staged deletion targets
39
+ `commitLogs/**/README.md`, the script inspects the version from `HEAD` and
40
+ decides whether that log is protected.
41
+
42
+ ## Protected Logs
43
+
44
+ A deleted log is blocked when the `HEAD` version contains either:
45
+
46
+ - recorded commit metadata, such as `latest_commit_sha`
47
+ - an entry in `## Commits` that names a commit SHA
48
+ - a retention marker such as `retain: yes`, `preserve: true`, or an
49
+ `agentic-retain-log` style marker
50
+
51
+ ## Allowed Deletions
52
+
53
+ Deletion is allowed when the staged log appears empty of committed work and has
54
+ no retention marker. This supports cleanup of abandoned startup logs or other
55
+ bookkeeping-only artifacts.
56
+
57
+ ## What This Does Not Do
58
+
59
+ - It does not delete files itself.
60
+ - It does not restore protected logs.
61
+ - It does not inspect non-README files.
62
+ - It does not judge whether an allowed deletion is wise.
63
+ - It does not replace human review of cleanup commits.
64
+
65
+ ## Validation
66
+
67
+ `smoke-test.sh` creates a throwaway repo with three logs:
68
+
69
+ - one with a recorded commit
70
+ - one empty log
71
+ - one retained log
72
+
73
+ It verifies that recorded and retained logs are blocked, while an empty-only log
74
+ deletion passes.
75
+
76
+ Run the canonical smoke test with:
77
+
78
+ ```bash
79
+ bash scripts/00.chat/session-log/check-commitlog-deletions/smoke-test.sh
80
+ ```
81
+
82
+ ## Compatibility
83
+
84
+ The old shared path remains available:
85
+
86
+ ```bash
87
+ scripts/00.chat/session-log/check-commitlog-deletions/script.sh
88
+ ```
89
+
90
+ That file is now a compatibility wrapper around the canonical implementation.
@@ -0,0 +1,131 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ # agentic-artifact:
5
+ # schema: agentic-artifact/v2
6
+ # id: chat.script.session-log.check-commitlog-deletions
7
+ # version: 1
8
+ # status: active
9
+ # layer: 00.chat
10
+ # domain: session-log
11
+ # disciplines:
12
+ # - agentic
13
+ # kind: script
14
+ # purpose: Block staged deletion of commit logs that record committed work.
15
+ # portability:
16
+ # class: required
17
+ # targets:
18
+ # - llm-workbench
19
+ # used_by:
20
+ # - id: chat.script.session-log.check-commitlog-deletions.readme
21
+ # path: scripts/00.chat/session-log/check-commitlog-deletions/README.md
22
+ # - id: chat.script.session-log.check-commitlog-deletions.smoke-test
23
+ # path: scripts/00.chat/session-log/check-commitlog-deletions/smoke-test.sh
24
+ # - id: harness.architecture.adr.0010-protect-commit-logs-with-recorded-work
25
+ # effects:
26
+ # - read-only
27
+ usage() {
28
+ cat <<'EOF'
29
+ Usage:
30
+ check-commitlog-deletions.sh
31
+
32
+ Blocks staged deletion of commit logs that record committed work or are
33
+ explicitly marked for retention. Empty, unsaved session logs may be deleted by
34
+ an intentional cleanup commit.
35
+ EOF
36
+ }
37
+
38
+ if [ "${1:-}" = "-h" ] || [ "${1:-}" = "--help" ]; then
39
+ usage
40
+ exit 0
41
+ fi
42
+
43
+ if [ $# -ne 0 ]; then
44
+ usage >&2
45
+ exit 2
46
+ fi
47
+
48
+ FAILURES=0
49
+
50
+ fail() {
51
+ echo "ERROR: $*" >&2
52
+ FAILURES=$((FAILURES + 1))
53
+ }
54
+
55
+ staged_deleted_commit_logs() {
56
+ git diff --cached --name-only --diff-filter=D -- 'commitLogs/**/README.md'
57
+ }
58
+
59
+ head_content() {
60
+ local path="$1"
61
+ git show "HEAD:${path}" 2>/dev/null || true
62
+ }
63
+
64
+ has_recorded_commit() {
65
+ local content="$1"
66
+
67
+ if printf '%s\n' "$content" | grep -Eq '^latest_commit_sha: +[^[:space:]]+'; then
68
+ return 0
69
+ fi
70
+
71
+ if printf '%s\n' "$content" | awk '
72
+ $0 == "## Commits" {
73
+ in_section = 1
74
+ next
75
+ }
76
+ in_section && /^## / {
77
+ exit
78
+ }
79
+ in_section && /^- Commit: `[^`]+`/ {
80
+ found = 1
81
+ }
82
+ in_section && /^Commit: `[^`]+`/ {
83
+ found = 1
84
+ }
85
+ END {
86
+ exit found ? 0 : 1
87
+ }
88
+ '; then
89
+ return 0
90
+ fi
91
+
92
+ return 1
93
+ }
94
+
95
+ has_retention_marker() {
96
+ local content="$1"
97
+
98
+ printf '%s\n' "$content" | grep -Eiq \
99
+ '^(saved|retain|retained|preserve|preserved|keep|kept): +(yes|true)$|agentic-(save|saved|retain|retained|preserve|preserved|keep|kept)-log'
100
+ }
101
+
102
+ while IFS= read -r path; do
103
+ if [ -z "${path// }" ]; then
104
+ continue
105
+ fi
106
+
107
+ content="$(head_content "$path")"
108
+
109
+ if [ -z "${content// }" ]; then
110
+ fail "cannot inspect deleted commit log from HEAD: $path"
111
+ continue
112
+ fi
113
+
114
+ if has_recorded_commit "$content"; then
115
+ fail "cannot delete commit log with recorded commits: $path"
116
+ continue
117
+ fi
118
+
119
+ if has_retention_marker "$content"; then
120
+ fail "cannot delete commit log marked for retention: $path"
121
+ continue
122
+ fi
123
+ done < <(staged_deleted_commit_logs)
124
+
125
+ if [ "$FAILURES" -gt 0 ]; then
126
+ echo "Commit log deletion gate failed." >&2
127
+ echo "Restore protected logs or remove them from the staged deletion set." >&2
128
+ exit 1
129
+ fi
130
+
131
+ echo "Commit log deletion gate passed."
@@ -0,0 +1,123 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ # agentic-artifact:
5
+ # schema: agentic-artifact/v2
6
+ # id: chat.script.session-log.check-commitlog-deletions.smoke-test
7
+ # version: 1
8
+ # status: active
9
+ # layer: 00.chat
10
+ # domain: session-log
11
+ # disciplines:
12
+ # - agentic
13
+ # kind: script
14
+ # purpose: Smoke test commit log deletion protection for recorded work.
15
+ # portability:
16
+ # class: reusable
17
+ # targets:
18
+ # - llm-workbench
19
+ # used_by:
20
+ # - id: harness.architecture.adr.0010-protect-commit-logs-with-recorded-work
21
+ # - id: chat.script.session-log.check-commitlog-deletions.readme
22
+ # path: scripts/00.chat/session-log/check-commitlog-deletions/README.md
23
+ # - id: chat.script.session-log.check-commitlog-deletions
24
+ # path: scripts/00.chat/session-log/check-commitlog-deletions/script.sh
25
+ # effects:
26
+ # - writes-files
27
+ # - commits
28
+ SOURCE_ROOT="$(git rev-parse --show-toplevel)"
29
+ TMP_ROOT="$(mktemp -d "${TMPDIR:-/tmp}/commitlog-deletions-smoke.XXXXXX")"
30
+
31
+ cleanup() {
32
+ rm -rf "$TMP_ROOT"
33
+ }
34
+
35
+ trap cleanup EXIT
36
+
37
+ fail() {
38
+ echo "ERROR: $*" >&2
39
+ exit 1
40
+ }
41
+
42
+ REPO="$TMP_ROOT/repo"
43
+ mkdir -p "$REPO/scripts/00.chat/session-log/check-commitlog-deletions"
44
+ cp "$SOURCE_ROOT/scripts/00.chat/session-log/check-commitlog-deletions/script.sh" "$REPO/scripts/00.chat/session-log/check-commitlog-deletions/script.sh"
45
+ chmod +x "$REPO/scripts/00.chat/session-log/check-commitlog-deletions/script.sh"
46
+
47
+ git -C "$REPO" init -q -b main
48
+ git -C "$REPO" config user.name "Smoke Test"
49
+ git -C "$REPO" config user.email "smoke@example.invalid"
50
+
51
+ COMMITTED_LOG="$REPO/commitLogs/2026/jun/16/committed/README.md"
52
+ EMPTY_LOG="$REPO/commitLogs/2026/jun/16/empty/README.md"
53
+ RETAINED_LOG="$REPO/commitLogs/2026/jun/16/retained/README.md"
54
+
55
+ mkdir -p "$(dirname "$COMMITTED_LOG")" "$(dirname "$EMPTY_LOG")" "$(dirname "$RETAINED_LOG")"
56
+
57
+ cat > "$COMMITTED_LOG" <<'EOF'
58
+ # Chat Session: committed
59
+
60
+ <!-- agentic-session
61
+ latest_commit_sha: abc1234
62
+ -->
63
+
64
+ ## Commits
65
+
66
+ - Commit: `abc1234`
67
+ EOF
68
+
69
+ cat > "$EMPTY_LOG" <<'EOF'
70
+ # Chat Session: empty
71
+
72
+ ## Commits
73
+
74
+ TBD
75
+ EOF
76
+
77
+ cat > "$RETAINED_LOG" <<'EOF'
78
+ # Chat Session: retained
79
+
80
+ retain: yes
81
+
82
+ ## Commits
83
+
84
+ TBD
85
+ EOF
86
+
87
+ git -C "$REPO" add .
88
+ git -C "$REPO" commit -q -m "add logs"
89
+
90
+ git -C "$REPO" rm -q "$COMMITTED_LOG" "$EMPTY_LOG" "$RETAINED_LOG"
91
+
92
+ set +e
93
+ (
94
+ cd "$REPO"
95
+ bash scripts/00.chat/session-log/check-commitlog-deletions/script.sh
96
+ ) > "$TMP_ROOT/protected.out" 2> "$TMP_ROOT/protected.err"
97
+ PROTECTED_STATUS="$?"
98
+ set -e
99
+
100
+ if [ "$PROTECTED_STATUS" -eq 0 ]; then
101
+ fail "protected commit log deletions were allowed"
102
+ fi
103
+
104
+ if ! grep -q "cannot delete commit log with recorded commits" "$TMP_ROOT/protected.err"; then
105
+ fail "recorded commit deletion was not reported"
106
+ fi
107
+
108
+ if ! grep -q "cannot delete commit log marked for retention" "$TMP_ROOT/protected.err"; then
109
+ fail "retained commit log deletion was not reported"
110
+ fi
111
+
112
+ git -C "$REPO" restore --staged --worktree -- "$COMMITTED_LOG" "$RETAINED_LOG"
113
+
114
+ (
115
+ cd "$REPO"
116
+ bash scripts/00.chat/session-log/check-commitlog-deletions/script.sh
117
+ ) > "$TMP_ROOT/empty-only.out" 2> "$TMP_ROOT/empty-only.err"
118
+
119
+ if ! grep -q "Commit log deletion gate passed" "$TMP_ROOT/empty-only.out"; then
120
+ fail "empty-only deletion did not pass"
121
+ fi
122
+
123
+ echo "commitlog deletion smoke test passed."
@@ -0,0 +1,98 @@
1
+ <!-- agentic-artifact:
2
+ schema: agentic-artifact/v2
3
+ id: chat.script.session-log.checkpoint-chat-session-log.readme
4
+ version: 1
5
+ status: active
6
+ layer: 00.chat
7
+ domain: session-log
8
+ disciplines:
9
+ - agentic
10
+ kind: capability-readme
11
+ purpose: Explain when and how chat session-log bookkeeping is checkpointed as its
12
+ own commit.
13
+ portability:
14
+ class: required
15
+ targets:
16
+ - llm-workbench
17
+ used_by:
18
+ - id: chat.script.session-log.checkpoint-chat-session-log
19
+ path: scripts/00.chat/session-log/checkpoint-chat-session-log/script.sh
20
+ - id: harness.architecture.adr.0017-organize-scripts-by-owner-domain-and-capability
21
+ -->
22
+ # Checkpoint Chat Session Log
23
+
24
+ `script.sh` commits only the current chat session log as a narrow bookkeeping
25
+ checkpoint.
26
+
27
+ It exists because task work and session-log bookkeeping are intentionally
28
+ separate. A task commit should contain the actual implementation, documentation,
29
+ or harness change. After that commit is recorded into the session log, the log
30
+ itself becomes dirty. This helper creates the follow-up bookkeeping commit when
31
+ the session log is the only remaining change.
32
+
33
+ ## Mental Model
34
+
35
+ The session log is part of the audit trail, but it is not the task change
36
+ itself.
37
+
38
+ The usual rhythm is:
39
+
40
+ 1. make and commit the task change
41
+ 2. run `record-chat-commit` to write that task commit into the session log
42
+ 3. run `checkpoint-chat-session-log` to commit the session-log update by itself
43
+
44
+ That gives the Git history two clean boundaries: one for the work, and one for
45
+ the chat record about the work.
46
+
47
+ ## Safety Rule
48
+
49
+ This helper only checkpoints when the dirty state is limited to the current
50
+ chat session log.
51
+
52
+ It refuses to run if:
53
+
54
+ - any unrelated file is staged
55
+ - any unrelated file is dirty
56
+ - the current branch is not a `chat/*` branch
57
+ - the matching session log cannot be found
58
+
59
+ That refusal is the point. A bookkeeping checkpoint should never quietly include
60
+ task files, unrelated docs, generated output, or another chat's log.
61
+
62
+ ## Usage
63
+
64
+ ```bash
65
+ checkpoint-chat-session-log.sh [--dry-run] [message]
66
+ ```
67
+
68
+ - `--dry-run`: show what would be committed without staging or committing.
69
+ - `message`: optional commit message. The default is
70
+ `chore(session): checkpoint chat log`.
71
+
72
+ ## What This Does
73
+
74
+ - derives the session id from the current `chat/*` branch
75
+ - finds the matching session log
76
+ - verifies there are no unrelated staged or dirty files
77
+ - stages only the current session log
78
+ - commits only that session log
79
+
80
+ ## What This Does Not Do
81
+
82
+ - It does not record a task commit in the session log.
83
+ - It does not inspect whether the task commit itself was good.
84
+ - It does not push anything.
85
+ - It does not merge anything.
86
+ - It does not allow mixed bookkeeping and task changes.
87
+
88
+ ## Compatibility
89
+
90
+ The governed runner still approves the old path:
91
+
92
+ ```bash
93
+ scripts/00.chat/session-log/checkpoint-chat-session-log/script.sh
94
+ ```
95
+
96
+ That file is now a compatibility wrapper around the canonical implementation.
97
+ Checklists should keep using the approved shared path until the governed runner
98
+ allowlist policy is migrated.