@meetless/mla 0.1.4

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 (202) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +81 -0
  3. package/dist/build-info.json +9 -0
  4. package/dist/bundles/ask-core.js +396 -0
  5. package/dist/bundles/mcp.js +16592 -0
  6. package/dist/bundles/trace-core.js +263 -0
  7. package/dist/cli.js +828 -0
  8. package/dist/commands/activate.js +781 -0
  9. package/dist/commands/adoption.js +130 -0
  10. package/dist/commands/ask.js +290 -0
  11. package/dist/commands/context.js +114 -0
  12. package/dist/commands/debug.js +313 -0
  13. package/dist/commands/doctor.js +1021 -0
  14. package/dist/commands/enrich.js +427 -0
  15. package/dist/commands/evidence.js +229 -0
  16. package/dist/commands/flush.js +184 -0
  17. package/dist/commands/graph.js +104 -0
  18. package/dist/commands/init.js +272 -0
  19. package/dist/commands/internal-active-review.js +322 -0
  20. package/dist/commands/internal-auto-index.js +188 -0
  21. package/dist/commands/internal-capture-decisions.js +320 -0
  22. package/dist/commands/internal-evidence-correlate.js +239 -0
  23. package/dist/commands/internal-evidence-hooks.js +240 -0
  24. package/dist/commands/internal-evidence-inject.js +231 -0
  25. package/dist/commands/internal-finalize.js +221 -0
  26. package/dist/commands/internal-pretool-observe.js +225 -0
  27. package/dist/commands/internal-refresh.js +136 -0
  28. package/dist/commands/internal-session-nudge.js +120 -0
  29. package/dist/commands/internal-steer-sync.js +117 -0
  30. package/dist/commands/internal-turn-recap.js +140 -0
  31. package/dist/commands/kb.js +375 -0
  32. package/dist/commands/kb_add.js +681 -0
  33. package/dist/commands/kb_forget.js +283 -0
  34. package/dist/commands/kb_move.js +45 -0
  35. package/dist/commands/kb_pending.js +410 -0
  36. package/dist/commands/kb_personal.js +149 -0
  37. package/dist/commands/kb_promote.js +188 -0
  38. package/dist/commands/kb_purge.js +168 -0
  39. package/dist/commands/kb_reingest.js +335 -0
  40. package/dist/commands/kb_retime.js +170 -0
  41. package/dist/commands/kb_review.js +391 -0
  42. package/dist/commands/kb_revision.js +179 -0
  43. package/dist/commands/kb_show.js +385 -0
  44. package/dist/commands/label.js +226 -0
  45. package/dist/commands/login.js +295 -0
  46. package/dist/commands/logout.js +108 -0
  47. package/dist/commands/mcp-supervisor.js +93 -0
  48. package/dist/commands/mcp.js +227 -0
  49. package/dist/commands/queue-prune.js +98 -0
  50. package/dist/commands/review.js +358 -0
  51. package/dist/commands/rewire.js +124 -0
  52. package/dist/commands/rules.js +728 -0
  53. package/dist/commands/scan-context.js +67 -0
  54. package/dist/commands/session.js +347 -0
  55. package/dist/commands/stats.js +479 -0
  56. package/dist/commands/status.js +61 -0
  57. package/dist/commands/summary.js +250 -0
  58. package/dist/commands/turn.js +114 -0
  59. package/dist/commands/uninstall.js +222 -0
  60. package/dist/commands/whoami.js +102 -0
  61. package/dist/commands/workspace.js +130 -0
  62. package/dist/hooks-template/ce0-post-tool-use.sh +34 -0
  63. package/dist/hooks-template/ce0-session-start.sh +49 -0
  64. package/dist/hooks-template/ce0-stop.sh +29 -0
  65. package/dist/hooks-template/ce0-user-prompt-submit.sh +38 -0
  66. package/dist/hooks-template/common.sh +934 -0
  67. package/dist/hooks-template/event-batch-filter.jq +67 -0
  68. package/dist/hooks-template/flush.sh +503 -0
  69. package/dist/hooks-template/post-tool-use.sh +423 -0
  70. package/dist/hooks-template/pre-tool-use.sh +69 -0
  71. package/dist/hooks-template/session-start.sh +140 -0
  72. package/dist/hooks-template/stop.sh +308 -0
  73. package/dist/hooks-template/user-prompt-submit.sh +1162 -0
  74. package/dist/lib/activation.js +79 -0
  75. package/dist/lib/active-conflict-cache.js +141 -0
  76. package/dist/lib/active-memory.js +59 -0
  77. package/dist/lib/active-review-runner.js +26 -0
  78. package/dist/lib/agent-decision/index.js +25 -0
  79. package/dist/lib/agent-decision/keys.js +49 -0
  80. package/dist/lib/agent-decision/normalize-claude.js +183 -0
  81. package/dist/lib/agent-decision/types.js +21 -0
  82. package/dist/lib/agent-decision/validate.js +216 -0
  83. package/dist/lib/analytics/capture.js +96 -0
  84. package/dist/lib/analytics/command-event.js +267 -0
  85. package/dist/lib/analytics/consent.js +58 -0
  86. package/dist/lib/analytics/coverage-gap.js +96 -0
  87. package/dist/lib/analytics/envelope.js +236 -0
  88. package/dist/lib/analytics/event-id.js +86 -0
  89. package/dist/lib/analytics/evidence.js +150 -0
  90. package/dist/lib/analytics/followthrough.js +194 -0
  91. package/dist/lib/analytics/forwarder.js +109 -0
  92. package/dist/lib/analytics/logs.js +78 -0
  93. package/dist/lib/analytics/metrics.js +78 -0
  94. package/dist/lib/analytics/recorder.js +92 -0
  95. package/dist/lib/analytics/review-analytics.js +75 -0
  96. package/dist/lib/analytics/sequence.js +77 -0
  97. package/dist/lib/analytics/store.js +131 -0
  98. package/dist/lib/analytics/turn-recap.js +279 -0
  99. package/dist/lib/artifact_id.js +108 -0
  100. package/dist/lib/auth-breaker.js +161 -0
  101. package/dist/lib/auto-index.js +112 -0
  102. package/dist/lib/classifier.js +88 -0
  103. package/dist/lib/config.js +298 -0
  104. package/dist/lib/conflict-advisory.js +64 -0
  105. package/dist/lib/debug-bundle.js +520 -0
  106. package/dist/lib/enrichment/ingest.js +301 -0
  107. package/dist/lib/enrichment/plan.js +253 -0
  108. package/dist/lib/enrichment/protocol.js +359 -0
  109. package/dist/lib/enrichment/scout-brief.js +176 -0
  110. package/dist/lib/failure-telemetry.js +444 -0
  111. package/dist/lib/git.js +200 -0
  112. package/dist/lib/governance-cache.js +77 -0
  113. package/dist/lib/governed-path-cache.js +76 -0
  114. package/dist/lib/http.js +677 -0
  115. package/dist/lib/identity-envelope.js +23 -0
  116. package/dist/lib/kb-candidate.js +65 -0
  117. package/dist/lib/kb_acl.js +98 -0
  118. package/dist/lib/login.js +353 -0
  119. package/dist/lib/mcp-fetchers.js +130 -0
  120. package/dist/lib/mcp-restart.js +47 -0
  121. package/dist/lib/observability.js +805 -0
  122. package/dist/lib/open-url.js +33 -0
  123. package/dist/lib/orphan-guard.js +70 -0
  124. package/dist/lib/packaged.js +21 -0
  125. package/dist/lib/reconcile-sessions.js +171 -0
  126. package/dist/lib/redactor.js +89 -0
  127. package/dist/lib/relationship-candidate-query.js +27 -0
  128. package/dist/lib/render.js +611 -0
  129. package/dist/lib/rules/applicability.js +64 -0
  130. package/dist/lib/rules/attest-code-rule-version.js +47 -0
  131. package/dist/lib/rules/attest-notes-location.js +217 -0
  132. package/dist/lib/rules/attest-rule-version.js +69 -0
  133. package/dist/lib/rules/canonical-json.js +97 -0
  134. package/dist/lib/rules/ce0-emit.js +64 -0
  135. package/dist/lib/rules/ce0-evidence.js +281 -0
  136. package/dist/lib/rules/ce0-recall-sample.js +82 -0
  137. package/dist/lib/rules/ce0-rule.js +55 -0
  138. package/dist/lib/rules/ce0-sampling-bucket.js +15 -0
  139. package/dist/lib/rules/ce0-store.js +683 -0
  140. package/dist/lib/rules/ce0-telemetry-project.js +93 -0
  141. package/dist/lib/rules/ce0-telemetry.js +158 -0
  142. package/dist/lib/rules/code-rule-registry.js +17 -0
  143. package/dist/lib/rules/command-match.js +185 -0
  144. package/dist/lib/rules/consult-evidence-binding.js +27 -0
  145. package/dist/lib/rules/consultation-capture-adapter.js +193 -0
  146. package/dist/lib/rules/content-match.js +56 -0
  147. package/dist/lib/rules/deny-admission.js +99 -0
  148. package/dist/lib/rules/durable-observation.js +190 -0
  149. package/dist/lib/rules/enforce-notes-version.js +421 -0
  150. package/dist/lib/rules/evaluation-input-hash.js +126 -0
  151. package/dist/lib/rules/evaluator.js +108 -0
  152. package/dist/lib/rules/inert-rule-families.js +51 -0
  153. package/dist/lib/rules/input-authority-resolver.js +241 -0
  154. package/dist/lib/rules/interception-schema.js +170 -0
  155. package/dist/lib/rules/interception-store.js +267 -0
  156. package/dist/lib/rules/live-input-authority.js +66 -0
  157. package/dist/lib/rules/local-matcher.js +108 -0
  158. package/dist/lib/rules/local-observe.js +79 -0
  159. package/dist/lib/rules/local-rule-version-repo.js +214 -0
  160. package/dist/lib/rules/memory-requirement.js +109 -0
  161. package/dist/lib/rules/notes-observe.js +39 -0
  162. package/dist/lib/rules/notes-path.js +261 -0
  163. package/dist/lib/rules/notes-rule.js +75 -0
  164. package/dist/lib/rules/observe-adapter.js +114 -0
  165. package/dist/lib/rules/observed-rule-hash.js +119 -0
  166. package/dist/lib/rules/prompt-submit-adapter.js +132 -0
  167. package/dist/lib/rules/requirement-subject.js +240 -0
  168. package/dist/lib/rules/rule-activity.js +67 -0
  169. package/dist/lib/rules/rule-version-hash.js +151 -0
  170. package/dist/lib/rules/runtime-scope.js +55 -0
  171. package/dist/lib/rules/stop-adapter.js +116 -0
  172. package/dist/lib/rules/stop-response-snapshot.js +174 -0
  173. package/dist/lib/rules/types.js +10 -0
  174. package/dist/lib/rules/ulid.js +46 -0
  175. package/dist/lib/rules/version-evaluation.js +156 -0
  176. package/dist/lib/scanner/agent-memory.js +99 -0
  177. package/dist/lib/scanner/bootstrap-summary.js +87 -0
  178. package/dist/lib/scanner/cache.js +59 -0
  179. package/dist/lib/scanner/frontmatter.js +42 -0
  180. package/dist/lib/scanner/parse-directives.js +69 -0
  181. package/dist/lib/scanner/parse-structured.js +72 -0
  182. package/dist/lib/scanner/render.js +73 -0
  183. package/dist/lib/scanner/scan.js +132 -0
  184. package/dist/lib/scanner/score.js +38 -0
  185. package/dist/lib/scanner/scout-mission.js +126 -0
  186. package/dist/lib/scanner/types.js +7 -0
  187. package/dist/lib/session-scope.js +195 -0
  188. package/dist/lib/spool.js +355 -0
  189. package/dist/lib/staleness.js +100 -0
  190. package/dist/lib/steer-cache.js +87 -0
  191. package/dist/lib/tagged-reference.js +20 -0
  192. package/dist/lib/temporal.js +109 -0
  193. package/dist/lib/turn-recap-emit.js +67 -0
  194. package/dist/lib/unwire.js +253 -0
  195. package/dist/lib/update-check.js +469 -0
  196. package/dist/lib/update-notifier.js +217 -0
  197. package/dist/lib/upgrade-apply.js +643 -0
  198. package/dist/lib/wire.js +1087 -0
  199. package/dist/lib/workspace.js +96 -0
  200. package/dist/lib/zip.js +154 -0
  201. package/dist/pretool-entry.js +37 -0
  202. package/package.json +75 -0
@@ -0,0 +1,130 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.runWorkspace = runWorkspace;
4
+ const config_1 = require("../lib/config");
5
+ const http_1 = require("../lib/http");
6
+ const workspace_1 = require("../lib/workspace");
7
+ // `mla workspace` (folder = workspace, T1.3 / T3.2,
8
+ // notes/20260604-folder-equals-workspace-binding-design.md)
9
+ //
10
+ // Repurposed for the folder-binding model. The workspace a directory runs under
11
+ // is no longer a machine-global cli-config pointer; it is resolved from the
12
+ // nearest `.meetless.json` marker, walking UP from cwd (nearest-wins, mirroring
13
+ // how Claude Code resolves CLAUDE.md). So:
14
+ //
15
+ // mla workspace show the workspace bound to this folder + health
16
+ // mla workspace show (alias for the above)
17
+ // mla workspace use <id> REMOVED. Hard error pointing at `mla activate`.
18
+ //
19
+ // `use` used to rewrite the global cli-config `workspaceId`, which is no longer
20
+ // a workspace source. Switching workspaces is now "cd to (or activate) the
21
+ // folder bound to that workspace", not flipping one machine-global pointer. We
22
+ // fail loud rather than silently no-op so muscle memory gets corrected, not
23
+ // swallowed.
24
+ // Loads machine credentials (controlUrl, controlToken, actor) from
25
+ // cli-config.json. NOTE: cli-config no longer carries the workspaceId (T1.1);
26
+ // the workspace is resolved from the folder marker, not here. This only fetches
27
+ // the creds the server probe needs.
28
+ function loadConfigOrExplain() {
29
+ if (!(0, config_1.configExists)()) {
30
+ console.error(`cli-config.json not found at ${config_1.CFG_PATH}. Run 'mla init --control-token <token>' first.`);
31
+ return 2;
32
+ }
33
+ try {
34
+ return (0, config_1.readConfig)();
35
+ }
36
+ catch (e) {
37
+ console.error(e.message);
38
+ return 2;
39
+ }
40
+ }
41
+ // `mla workspace show`: resolve the folder's workspace binding from the nearest
42
+ // marker and report its health.
43
+ //
44
+ // Pure-local states (not activated, stale marker) never touch the network. A
45
+ // healthy binding is corroborated against control so a marker pointing at a
46
+ // deleted / inaccessible workspace reads as a precise, actionable state here
47
+ // rather than an opaque 401/403/404 later mid-capture. The server probe is
48
+ // best-effort: control being down must NOT mask the local binding (which is
49
+ // printed first, before the probe).
50
+ async function runWorkspaceShow() {
51
+ const loaded = loadConfigOrExplain();
52
+ if (typeof loaded === "number")
53
+ return loaded;
54
+ const cfg = loaded;
55
+ let ctx;
56
+ try {
57
+ ctx = (0, workspace_1.resolveWorkspaceContext)();
58
+ }
59
+ catch (e) {
60
+ if (e instanceof workspace_1.NotActivatedError) {
61
+ console.log("No workspace is bound to this folder.");
62
+ console.log(" Run 'mla activate' here to bind (or create) one.");
63
+ console.log(" Meetless resolves the workspace from the nearest .meetless.json, " +
64
+ "walking up from the current directory.");
65
+ return 0;
66
+ }
67
+ if (e instanceof workspace_1.MarkerMissingWorkspaceIdError) {
68
+ console.log(`Stale binding: ${e.markerPath} has no usable workspaceId.`);
69
+ console.log(" Run 'mla activate --repair' to re-stamp the marker.");
70
+ return 0;
71
+ }
72
+ throw e;
73
+ }
74
+ // Healthy local binding. Print it FIRST so the answer is always visible even
75
+ // when the server probe below is offline.
76
+ const nameSuffix = ctx.workspaceName ? ` (${ctx.workspaceName})` : "";
77
+ console.log(`Workspace: ${ctx.workspaceId}${nameSuffix}`);
78
+ console.log(` Bound by ${ctx.markerPath}`);
79
+ // Corroborate against control. The marker is local truth for "which id"; only
80
+ // the server knows whether that id still exists and is reachable.
81
+ try {
82
+ await (0, http_1.get)(cfg, `/internal/v1/workspaces/me?workspaceId=${encodeURIComponent(ctx.workspaceId)}`, 5000);
83
+ console.log(" Status: active (exists and reachable).");
84
+ return 0;
85
+ }
86
+ catch (e) {
87
+ const err = e;
88
+ if (err.status === 404) {
89
+ console.log(` Status: this repo is bound to ${ctx.workspaceId}, but the ` +
90
+ `workspace does not exist or is inaccessible.`);
91
+ console.log(" Options: 'mla activate --repair' or 'mla deactivate'.");
92
+ return 0;
93
+ }
94
+ // 401/403: shared internal bearer rejected, or (post-T1.4, when the CLI
95
+ // sends X-Meetless-Actor) the caller is not a member. Today's shared key
96
+ // does not 403 on non-membership, so this branch is forward-compatible.
97
+ if (err.status === 401 || err.status === 403) {
98
+ console.log(` Status: this repo is bound to ${ctx.workspaceId}, but your token ` +
99
+ `is not a member. Ask a workspace owner to add you.`);
100
+ return 0;
101
+ }
102
+ // Network error / control down / unexpected status: never fail the report.
103
+ console.log(` Status: could not verify with control (${err.status ?? "offline"}). ` +
104
+ `The local binding above still applies.`);
105
+ return 0;
106
+ }
107
+ }
108
+ // `mla workspace use <id>` is removed (T3.2). It rewrote the global cli-config
109
+ // workspaceId, which is no longer a workspace source under folder = workspace.
110
+ // Hard-error with a pointer to the replacement verb instead of silently doing
111
+ // nothing, so existing muscle memory / scripts get a clear migration signal.
112
+ function runWorkspaceUseRemoved() {
113
+ console.error("`mla workspace use` has been removed. Workspaces are now bound per folder " +
114
+ "by a .meetless.json marker, not a global cli-config pointer.");
115
+ console.error(" To switch workspace: cd to the folder bound to it, or run 'mla activate' " +
116
+ "in this folder to bind (or create) a workspace here.");
117
+ return 2;
118
+ }
119
+ async function runWorkspace(argv) {
120
+ const [sub] = argv;
121
+ if (sub === undefined || sub === "show") {
122
+ return runWorkspaceShow();
123
+ }
124
+ if (sub === "use") {
125
+ return runWorkspaceUseRemoved();
126
+ }
127
+ console.error(`Unknown workspace subcommand: ${sub}. Usage: mla workspace [show] ` +
128
+ `(use 'mla activate' / 'mla deactivate' to change the binding).`);
129
+ return 2;
130
+ }
@@ -0,0 +1,34 @@
1
+ #!/usr/bin/env bash
2
+ # ce0-post-tool-use.sh: Claude Code PostToolUse hook for the CE0
3
+ # evidence-consultation measurement harness (RECORD_ONLY; proposal §4.1).
4
+ #
5
+ # Scope (registered by wire.ts MANAGED_HOOK_SCRIPTS on PostToolUse with matcher
6
+ # "mcp__meetless__"): fires after a meetless MCP tool call. It hands the raw
7
+ # PostToolUse stdin to `mla _internal evidence-capture`, which records the FACT of
8
+ # a governed-memory pull (retrieve_knowledge / kb_doc_detail / query) as a
9
+ # ConsultationAttempt under the live turn's identity; any other tool is a no-op in
10
+ # the subcommand. It then ALWAYS emits the empty `{}` pass-through body and exits 0.
11
+ #
12
+ # The matcher is the prefix `mcp__meetless__`, NOT the catch-all used by the
13
+ # load-bearing post-tool-use.sh: this hook only needs the governed pulls, so it
14
+ # does not spawn `mla` on every unrelated tool. The subcommand filters precisely to
15
+ # the three governed pulls as a backstop.
16
+ #
17
+ # Deliberately self-contained (does NOT source common.sh), like pre-tool-use.sh.
18
+ # No `set -e`: every step is best-effort and must leave a clean exit-0 pass-through.
19
+
20
+ INPUT="$(cat 2>/dev/null || true)"
21
+
22
+ CFG="${MEETLESS_HOME:-$HOME/.meetless}/cli-config.json"
23
+ MLA_PATH="$(jq -r '.mlaPath // empty' "$CFG" 2>/dev/null || true)"
24
+ if [[ -z "${MLA_PATH:-}" || ! -x "$MLA_PATH" ]]; then
25
+ MLA_PATH="$(command -v mla 2>/dev/null || true)"
26
+ fi
27
+
28
+ # Best-effort record. stdout discarded, stderr silenced, failure swallowed.
29
+ if [[ -n "${MLA_PATH:-}" && -x "$MLA_PATH" ]]; then
30
+ printf '%s' "$INPUT" | "$MLA_PATH" _internal evidence-capture >/dev/null 2>&1 || true
31
+ fi
32
+
33
+ printf '{}'
34
+ exit 0
@@ -0,0 +1,49 @@
1
+ #!/usr/bin/env bash
2
+ # ce0-session-start.sh: Claude Code SessionStart hook for the CE0
3
+ # evidence-consultation measurement harness (RECORD_ONLY; proposal §4.1, §6.4).
4
+ #
5
+ # Scope (registered by wire.ts MANAGED_HOOK_SCRIPTS on SessionStart, no matcher =
6
+ # every session start): gives the offline §6.4 telemetry projection an AUTOMATIC
7
+ # caller. The two denominator events that back precision/recall,
8
+ # memory_requirement_assessed (one per assessment) and evidence_obligation_finalized
9
+ # (one per FINALIZED obligation), are NOT emitted live by the turn hooks; they are
10
+ # projected from the CE0 store by the `mla evidence ce0-emit-telemetry` sweep. Before
11
+ # this hook that sweep only ran when a human typed it, so the denominator never
12
+ # flowed from passive dogfood. Here it runs once at the top of each session, projecting
13
+ # the prior session's accumulated rows.
14
+ #
15
+ # The sweep is IDEMPOTENT two ways (a deterministic event_id dedupes on the remote
16
+ # sink, and a local skip-set of already-logged event_ids avoids re-appending lines),
17
+ # so running it on every session start re-projects nothing already projected. Its
18
+ # LOCAL projection into ~/.meetless/events.jsonl is synchronous and happens BEFORE the
19
+ # best-effort network flush, so even if this hook is killed at its bounded timeout the
20
+ # denominator events are already landed locally and the regular flush forwards them.
21
+ #
22
+ # Unlike the other three ce0-*.sh hooks (pure local SQLite, no network) this one ends
23
+ # in a network flush, which is why MANAGED_HOOK_SCRIPTS gives it a timeout. It still
24
+ # ALWAYS emits the empty `{}` SessionStart body and exits 0: CE0 is measurement only,
25
+ # so this hook can never inject additionalContext, block, or change the session.
26
+ #
27
+ # Deliberately self-contained (does NOT source common.sh), like pre-tool-use.sh. No
28
+ # `set -e`: every step is best-effort and must leave a clean exit-0 pass-through.
29
+
30
+ # SessionStart delivers a small JSON payload on stdin; the sweep does not consume it
31
+ # (it reads the CE0 store, not the hook input), but we drain stdin so the producer is
32
+ # never left writing to a closed pipe.
33
+ cat >/dev/null 2>&1 || true
34
+
35
+ CFG="${MEETLESS_HOME:-$HOME/.meetless}/cli-config.json"
36
+ MLA_PATH="$(jq -r '.mlaPath // empty' "$CFG" 2>/dev/null || true)"
37
+ if [[ -z "${MLA_PATH:-}" || ! -x "$MLA_PATH" ]]; then
38
+ MLA_PATH="$(command -v mla 2>/dev/null || true)"
39
+ fi
40
+
41
+ # Best-effort sweep. stdout (the sweep's `{emitted, skipped}` JSON summary) is
42
+ # discarded, stderr silenced, any failure swallowed so the hook never blocks a session.
43
+ if [[ -n "${MLA_PATH:-}" && -x "$MLA_PATH" ]]; then
44
+ "$MLA_PATH" evidence ce0-emit-telemetry >/dev/null 2>&1 || true
45
+ fi
46
+
47
+ # The ONLY thing this hook ever writes to stdout: the empty no-decision body.
48
+ printf '{}'
49
+ exit 0
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env bash
2
+ # ce0-stop.sh: Claude Code Stop hook for the CE0 evidence-consultation measurement
3
+ # harness (RECORD_ONLY; proposal §4.1).
4
+ #
5
+ # Scope (registered by wire.ts MANAGED_HOOK_SCRIPTS on Stop, no matcher): fires
6
+ # when the turn ends. It hands the raw Stop stdin to `mla _internal evidence-stop`,
7
+ # which on the FIRST Stop of a turn freezes the obligation's eligibility boundary
8
+ # at the high-water consultation token; a later Stop is an idempotent no-op. It then
9
+ # ALWAYS emits the empty `{}` pass-through body and exits 0, so the hook can never
10
+ # block or re-open a turn.
11
+ #
12
+ # Deliberately self-contained (does NOT source common.sh), like pre-tool-use.sh.
13
+ # No `set -e`: every step is best-effort and must leave a clean exit-0 pass-through.
14
+
15
+ INPUT="$(cat 2>/dev/null || true)"
16
+
17
+ CFG="${MEETLESS_HOME:-$HOME/.meetless}/cli-config.json"
18
+ MLA_PATH="$(jq -r '.mlaPath // empty' "$CFG" 2>/dev/null || true)"
19
+ if [[ -z "${MLA_PATH:-}" || ! -x "$MLA_PATH" ]]; then
20
+ MLA_PATH="$(command -v mla 2>/dev/null || true)"
21
+ fi
22
+
23
+ # Best-effort record. stdout discarded, stderr silenced, failure swallowed.
24
+ if [[ -n "${MLA_PATH:-}" && -x "$MLA_PATH" ]]; then
25
+ printf '%s' "$INPUT" | "$MLA_PATH" _internal evidence-stop >/dev/null 2>&1 || true
26
+ fi
27
+
28
+ printf '{}'
29
+ exit 0
@@ -0,0 +1,38 @@
1
+ #!/usr/bin/env bash
2
+ # ce0-user-prompt-submit.sh: Claude Code UserPromptSubmit hook for the CE0
3
+ # evidence-consultation measurement harness (RECORD_ONLY; proposal §4.1).
4
+ #
5
+ # Scope (registered by wire.ts MANAGED_HOOK_SCRIPTS on UserPromptSubmit, no
6
+ # matcher = every prompt): fires once at the top of each turn. It hands the raw
7
+ # UserPromptSubmit stdin to `mla _internal evidence-turn-open`, which classifies
8
+ # the turn's memory requirement, persists the assessment, and (only for a REQUIRED
9
+ # turn) opens the turn's TurnRuleObligation. It then ALWAYS emits the empty `{}`
10
+ # pass-through body and exits 0, so wiring this hook can never inject context or
11
+ # change a turn. CE0 is measurement only; injection is a CE2 concern.
12
+ #
13
+ # Deliberately self-contained (does NOT source common.sh), exactly like
14
+ # pre-tool-use.sh: the activation gate is the subcommand's own workspace
15
+ # resolution, not a shell-side .meetless.json walk. No `set -e`: every step is
16
+ # best-effort, and a missing `mla` or a failed lookup must still leave a clean
17
+ # exit-0 pass-through, never a non-zero (blocking) exit.
18
+
19
+ INPUT="$(cat 2>/dev/null || true)"
20
+
21
+ # Resolve the absolute mla path the same way pre-tool-use.sh does (install-time
22
+ # path in cli-config.json, then PATH fallback).
23
+ CFG="${MEETLESS_HOME:-$HOME/.meetless}/cli-config.json"
24
+ MLA_PATH="$(jq -r '.mlaPath // empty' "$CFG" 2>/dev/null || true)"
25
+ if [[ -z "${MLA_PATH:-}" || ! -x "$MLA_PATH" ]]; then
26
+ MLA_PATH="$(command -v mla 2>/dev/null || true)"
27
+ fi
28
+
29
+ # Best-effort record. stdout is discarded (the hook decision is the hardcoded `{}`
30
+ # below); stderr is silenced; any failure is swallowed so the hook never blocks a
31
+ # turn. The subcommand persists its assessment + obligation out-of-band.
32
+ if [[ -n "${MLA_PATH:-}" && -x "$MLA_PATH" ]]; then
33
+ printf '%s' "$INPUT" | "$MLA_PATH" _internal evidence-turn-open >/dev/null 2>&1 || true
34
+ fi
35
+
36
+ # The ONLY thing this hook ever writes to stdout: the empty no-decision body.
37
+ printf '{}'
38
+ exit 0