@letsrebase/verify 0.0.0-stage → 0.1.1

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 (49) hide show
  1. package/.claude/commands/rebase-verify.md +118 -0
  2. package/LICENSE +21 -0
  3. package/PRIVACY.md +113 -0
  4. package/README.md +210 -2
  5. package/SECURITY.md +33 -0
  6. package/bin/rebase-verify.mjs +700 -0
  7. package/package.json +38 -4
  8. package/share/practices.json +224 -0
  9. package/share/tech-labels.json +57 -0
  10. package/share/tech-lexicon.json +62 -0
  11. package/src/adapters/claude-code.mjs +225 -0
  12. package/src/adapters/codex.mjs +476 -0
  13. package/src/adapters/cursor.mjs +584 -0
  14. package/src/adapters/kimi.mjs +594 -0
  15. package/src/adapters/omp.mjs +59 -0
  16. package/src/adapters/opencode.mjs +439 -0
  17. package/src/adapters/pi.mjs +414 -0
  18. package/src/adapters/tool-vocab.mjs +15 -0
  19. package/src/agent-run.mjs +10 -0
  20. package/src/agentic-literacy.mjs +211 -0
  21. package/src/agents/acp.mjs +364 -0
  22. package/src/agents/json-answer.mjs +72 -0
  23. package/src/agents/registry.mjs +370 -0
  24. package/src/agents/run.mjs +131 -0
  25. package/src/ai-relationship.mjs +95 -0
  26. package/src/consistency.mjs +382 -0
  27. package/src/days.mjs +45 -0
  28. package/src/digest.mjs +501 -0
  29. package/src/distribution.mjs +54 -0
  30. package/src/enrich.mjs +118 -0
  31. package/src/fingerprint.mjs +134 -0
  32. package/src/forensics.mjs +178 -0
  33. package/src/groundedness.mjs +347 -0
  34. package/src/hub.mjs +136 -0
  35. package/src/intensity.mjs +132 -0
  36. package/src/live-status.mjs +79 -0
  37. package/src/practices-llm.mjs +90 -0
  38. package/src/practices-rules.mjs +295 -0
  39. package/src/practices-sample.mjs +111 -0
  40. package/src/practices.mjs +279 -0
  41. package/src/profile-llm.mjs +249 -0
  42. package/src/profile.mjs +497 -0
  43. package/src/redact.mjs +97 -0
  44. package/src/sources.mjs +91 -0
  45. package/src/submit.mjs +65 -0
  46. package/src/system-text.mjs +3 -0
  47. package/src/tech-usage.mjs +88 -0
  48. package/src/trajectory.mjs +264 -0
  49. package/src/wizard.mjs +411 -0
@@ -0,0 +1,476 @@
1
+ // codex adapter: reads the Codex CLI / VS Code extension's rollout logs
2
+ // (~/.codex/sessions/YYYY/MM/DD/rollout-<iso>-<uuid>.jsonl, one file per
3
+ // session) and normalises them into the SAME session model claude-code.mjs
4
+ // and opencode.mjs produce, so every downstream lens (digest, agentic-
5
+ // literacy, forensics, fingerprint, intensity, distribution) keeps working
6
+ // unchanged.
7
+ //
8
+ // Codex's event stream is flatter than Claude Code's: every line is
9
+ // {timestamp, type, payload} and there is no per-message id or parent chain —
10
+ // only a chronological sequence of session_meta / turn_context / response_item
11
+ // (message, reasoning, function_call(_output), custom_tool_call(_output)) /
12
+ // event_msg (token_count, web_search_call, ...) records. We reconstruct TURNS
13
+ // ourselves: each surviving user message flushes the previously open
14
+ // assistant turn, emits the user message, and opens a fresh assistant turn;
15
+ // every reasoning/tool/usage record until the next user message folds into
16
+ // that open turn, and the final turn is flushed at EOF. This is the only
17
+ // adapter where turn boundaries aren't handed to us by the source tool.
18
+ //
19
+ // Two kinds of noise are filtered before a "user message" is allowed to
20
+ // become a turn boundary:
21
+ // - role "developer": framework-injected system turns (never authored by
22
+ // the human), dropped entirely — no text, no boundary, no count.
23
+ // - role "user" content BLOCKS wrapped ENTIRELY in <environment_context> or
24
+ // <permissions instructions> tags: Codex re-injects IDE/sandbox state as
25
+ // a synthetic block, sometimes alongside a real human block in the same
26
+ // message. Filtering is per block, not per message: a wrapped block never
27
+ // contributes text, and a message where every block is wrapped (or which
28
+ // has none left after filtering) is dropped entirely — counting it as a
29
+ // real turn would inflate the turn count and pollute textRedacted with
30
+ // boilerplate.
31
+ // - role "user" content blocks whose trimmed text STARTS WITH "# AGENTS.md
32
+ // instructions for ": Codex also re-injects the repo's AGENTS.md as a
33
+ // synthetic user block (an <INSTRUCTIONS> dump), same per-block filtering
34
+ // discipline as the tag-wrapped forms above.
35
+ //
36
+ // apply_patch is Codex's diff-application tool and its `input` is the raw
37
+ // unified-diff text — full file contents can ride along in an Add File hunk.
38
+ // We never store it: only the touched file paths are pulled out of the
39
+ // "*** Add/Update/Delete File: ..." headers (redacted, POSIX'd), one toolUse
40
+ // per file, so path-based analysis downstream (repo clustering, area
41
+ // extraction) still works without the diff body ever touching the bundle.
42
+ //
43
+ // Same structural-capture posture as the other two adapters: reasoning text,
44
+ // tool output, and diff bodies are reduced to lengths/booleans/paths, never
45
+ // kept — see redact.mjs and claude-code.mjs/opencode.mjs for the shared
46
+ // contract this adapter has to honor.
47
+ //
48
+ // toolResults[].bytes here (as in every other adapter) is the UTF-16
49
+ // code-unit length (`.length`) of the textual output, not an actual byte
50
+ // count — comparable across adapters, the text itself never stored.
51
+
52
+ import { readFileSync, existsSync, statSync } from "node:fs";
53
+ import { join, relative, basename } from "node:path";
54
+ import { homedir } from "node:os";
55
+ import { createHash } from "node:crypto";
56
+ import { redactText, countRedactions } from "../redact.mjs";
57
+ import { toPosix, walk } from "./claude-code.mjs";
58
+ import { fallbackToolName } from "./tool-vocab.mjs";
59
+
60
+ const sha256 = (buf) => createHash("sha256").update(buf).digest("hex");
61
+ const shortHash = (s) => sha256(s).slice(0, 8);
62
+
63
+ // ── Default location ────────────────────────────────────────────────────────
64
+ // CODEX_HOME defaults to ~/.codex; sessions live under sessions/. The PARENT
65
+ // (auth.json, config.toml, history.jsonl, *.sqlite*) is never resolved or
66
+ // opened here — only the sessions subdirectory is walked.
67
+ export function defaultCodexRoot() {
68
+ const base = process.env.CODEX_HOME || join(homedir(), ".codex");
69
+ return join(base, "sessions");
70
+ }
71
+
72
+ // ── Tool vocabulary: codex → canonical (Claude Code) names ─────────────────
73
+ const TOOL_MAP = {
74
+ exec_command: "Bash",
75
+ shell: "Bash",
76
+ shell_command: "Bash",
77
+ update_plan: "TodoWrite",
78
+ request_user_input: "AskUserQuestion",
79
+ };
80
+ function mapTool(name) {
81
+ if (!name) return name;
82
+ if (TOOL_MAP[name]) return TOOL_MAP[name];
83
+ // Anything else falls through to the fallback shared with every other
84
+ // adapter (see tool-vocab.mjs) so unmapped/MCP tool names land on the same
85
+ // "mcp__server__tool" shape regardless of which source produced them.
86
+ return fallbackToolName(name);
87
+ }
88
+
89
+ // A raw shell-ish command string pulled out of a function_call's already-
90
+ // parsed `arguments`, before mapping/redaction. `shell`'s command can be a
91
+ // string array (["bash","-lc","cmd"]); the others are plain strings.
92
+ function rawCommand(name, args) {
93
+ if (name === "exec_command") return args.cmd;
94
+ if (name === "shell") return Array.isArray(args.command) ? args.command.join(" ") : args.command;
95
+ if (name === "shell_command") return args.command;
96
+ return "";
97
+ }
98
+
99
+ // function_call → toolUse. Safe-parses `arguments` (a JSON-encoded string);
100
+ // malformed arguments degrade to {} rather than dropping the call entirely,
101
+ // since the call itself (name, id) is still structurally meaningful.
102
+ function buildFunctionCallToolUse(payload) {
103
+ const name = payload.name;
104
+ let args = {};
105
+ try {
106
+ args = JSON.parse(payload.arguments);
107
+ if (!args || typeof args !== "object") args = {};
108
+ } catch {
109
+ args = {};
110
+ }
111
+ const mapped = mapTool(name);
112
+ // Same truncation length opencode/claude-code apply to Bash commands.
113
+ const cmd = mapped === "Bash" ? redactText(String(rawCommand(name, args) || "").slice(0, 240)) : "";
114
+ const q = mapped === "AskUserQuestion" ? redactText(String(args.questions?.[0]?.question || "").slice(0, 200)) : "";
115
+ return { id: payload.call_id, name: mapped, path: "", cmd, q };
116
+ }
117
+
118
+ // apply_patch's `input` is the raw diff text — never stored. Only the touched
119
+ // file paths survive, extracted from the "*** Add/Update/Delete File: X"
120
+ // headers. Zero parseable headers → a single pathless toolUse (the call still
121
+ // happened; we just can't say which file it touched).
122
+ const PATCH_HEADER_RE = /^\*\*\* (?:Add File|Update File|Delete File): (.+)$/gm;
123
+ function buildApplyPatchToolUses(payload) {
124
+ const callId = payload.call_id;
125
+ const input = typeof payload.input === "string" ? payload.input : "";
126
+ const paths = [...input.matchAll(PATCH_HEADER_RE)].map((m) => m[1]);
127
+ if (paths.length === 0) return [{ id: callId, name: "Edit", path: "", cmd: "", q: "" }];
128
+ return paths.map((p, i) => ({ id: `${callId}-${i}`, name: "Edit", path: toPosix(redactText(p)), cmd: "", q: "" }));
129
+ }
130
+
131
+ // function_call_output → toolResult. Codex's exec harness prefixes real
132
+ // output with "Exit code: N"; a non-zero code is the only error signal we
133
+ // get (there's no separate boolean). Output text itself is never stored,
134
+ // only its length in UTF-16 code units (`.length`, not Buffer.byteLength) —
135
+ // the same convention claude-code.mjs/opencode.mjs/pi.mjs use, so
136
+ // toolResults[].bytes is comparable across adapters.
137
+ function buildFunctionCallResult(payload) {
138
+ const output = typeof payload.output === "string" ? payload.output : "";
139
+ const m = /^Exit code: (\d+)/.exec(output);
140
+ const isError = !!m && m[1] !== "0";
141
+ return { forId: payload.call_id, isError, bytes: output.length };
142
+ }
143
+
144
+ // custom_tool_call_output → toolResult (apply_patch's own result record).
145
+ // Unlike function_call_output there's no "Exit code" convention; when a
146
+ // `status` field is present, anything but "completed" is an error, else we
147
+ // have no error signal and default to false.
148
+ function buildCustomToolResult(payload) {
149
+ const isError = Object.prototype.hasOwnProperty.call(payload, "status") ? payload.status !== "completed" : false;
150
+ const output = payload.output;
151
+ const outStr = typeof output === "string" ? output : JSON.stringify(output ?? "");
152
+ return { forId: payload.call_id, isError, bytes: outStr.length };
153
+ }
154
+
155
+ // reasoning → {thinkingChars, signatureChars}. Like Claude's redacted
156
+ // thinking, only lengths survive as a depth proxy — the summary text and the
157
+ // encrypted_content blob are both dropped.
158
+ function reasoningLens(payload) {
159
+ const summary = Array.isArray(payload.summary) ? payload.summary : [];
160
+ const summaryText = summary.filter((s) => s && s.type === "summary_text").map((s) => s.text || "").join("");
161
+ const signature = typeof payload.encrypted_content === "string" ? payload.encrypted_content : "";
162
+ return { thinkingChars: summaryText.length, signatureChars: signature.length };
163
+ }
164
+
165
+ // message.content is an array of {type: "input_text"|"output_text", text}.
166
+ function extractMessageText(content) {
167
+ if (!Array.isArray(content)) return "";
168
+ let text = "";
169
+ for (const b of content) {
170
+ if (!b || typeof b !== "object") continue;
171
+ if (b.type === "input_text" || b.type === "output_text") text += (b.text || "") + "\n";
172
+ }
173
+ return text;
174
+ }
175
+
176
+ // Framework-injected content: Codex re-sends IDE/sandbox state as a synthetic
177
+ // block wrapped entirely in one of these tags (checked per content block —
178
+ // see extractUserMessageText below — not per message). Trimmed text must
179
+ // both start with the open tag and end with its close tag — otherwise a real
180
+ // block that merely mentions the tag would be dropped.
181
+ const FRAMEWORK_TAGS = [
182
+ { open: "<environment_context>", close: "</environment_context>" },
183
+ { open: "<permissions instructions>", close: "</permissions instructions>" },
184
+ ];
185
+ // AGENTS.md re-injection has no closing tag to pair against (it starts with a
186
+ // markdown heading, not an XML-ish wrapper) — a leading-prefix check on the
187
+ // WHOLE trimmed block is the only signal available, same "whole block or
188
+ // nothing" posture as the tag-wrapped forms.
189
+ const AGENTS_MD_PREFIX = "# AGENTS.md instructions for ";
190
+ function isFrameworkWrapped(trimmed) {
191
+ return FRAMEWORK_TAGS.some((t) => trimmed.startsWith(t.open) && trimmed.endsWith(t.close)) || trimmed.startsWith(AGENTS_MD_PREFIX);
192
+ }
193
+
194
+ // role "user" content, filtered per block: Codex can mix a real human block
195
+ // with a framework-injected <environment_context>/<permissions instructions>
196
+ // block in the SAME message. Each block is judged on its own trimmed text;
197
+ // a block that survives contributes to the message exactly like
198
+ // extractMessageText does, one that's framework-wrapped is dropped without
199
+ // contributing. Returns null when no block survives (all wrapped, or there
200
+ // were none) so the caller can skip the message entirely — the pre-existing
201
+ // behavior for pure boilerplate.
202
+ function extractUserMessageText(content) {
203
+ if (!Array.isArray(content)) return null;
204
+ let text = "";
205
+ let survived = 0;
206
+ for (const b of content) {
207
+ if (!b || typeof b !== "object") continue;
208
+ if (b.type !== "input_text" && b.type !== "output_text") continue;
209
+ const blockText = b.text || "";
210
+ if (isFrameworkWrapped(blockText.trim())) continue;
211
+ survived++;
212
+ text += blockText + "\n";
213
+ }
214
+ return survived > 0 ? text : null;
215
+ }
216
+
217
+ // rollout-<iso-ts>-<uuid>.jsonl — pull the trailing uuid as a sessionId
218
+ // fallback for when session_meta is missing or fails to parse.
219
+ const FILENAME_UUID_RE = /([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})\.jsonl$/i;
220
+ function sessionIdFromFilename(path) {
221
+ const m = FILENAME_UUID_RE.exec(basename(path));
222
+ return m ? m[1] : basename(path, ".jsonl");
223
+ }
224
+
225
+ const EMPTY = (root) => ({
226
+ source: "codex",
227
+ root: root || null,
228
+ files: [],
229
+ sessions: [],
230
+ compactionSummaries: [],
231
+ redaction: { hits: 0, charsRemoved: 0 },
232
+ stats: { originatorCounts: {}, malformedLines: 0 },
233
+ });
234
+
235
+ export function readCodex(root) {
236
+ if (!root || !existsSync(root)) return EMPTY(root);
237
+
238
+ const files = [];
239
+ const sessions = [];
240
+ let redactionHits = 0;
241
+ let redactedChars = 0;
242
+ const originatorCounts = {};
243
+ let malformedLinesTotal = 0;
244
+
245
+ for (const path of walk(root)) {
246
+ const buf = readFileSync(path);
247
+ const relPath = relative(root, path);
248
+ const lines = buf.toString("utf8").split("\n").filter((l) => l.trim());
249
+ const records = [];
250
+ let malformed = 0;
251
+ for (const line of lines) {
252
+ try {
253
+ records.push(JSON.parse(line));
254
+ } catch {
255
+ malformed++;
256
+ }
257
+ }
258
+ malformedLinesTotal += malformed;
259
+
260
+ const session = {
261
+ source: "codex",
262
+ sessionId: sessionIdFromFilename(path),
263
+ projectLabel: "project-unknown",
264
+ cwdRedacted: "",
265
+ cwdRaw: "", // local-only; never sent in the bundle
266
+ gitBranch: null, // codex does not record the branch
267
+ cliVersions: new Set(),
268
+ models: new Set(),
269
+ messages: [],
270
+ chain: [], // {uuid, parentUuid, ts}
271
+ firstTs: null,
272
+ lastTs: null,
273
+ };
274
+
275
+ let currentModel = null;
276
+ let modelProvider = null;
277
+ let turn = null; // open assistant-turn accumulator, or null between turns
278
+ let turnN = 0;
279
+ let prevUuid = null;
280
+
281
+ const stampSessionTs = (ts) => {
282
+ if (!ts) return;
283
+ if (!session.firstTs || ts < session.firstTs) session.firstTs = ts;
284
+ if (!session.lastTs || ts > session.lastTs) session.lastTs = ts;
285
+ };
286
+
287
+ // Emit one normalized message (user or the flushed assistant turn),
288
+ // wiring up the uuid/parentUuid chain and the redaction accumulators.
289
+ const emit = (role, ts, text, extra = {}) => {
290
+ turnN += 1;
291
+ const uuid = `${session.sessionId}-turn-${turnN}`;
292
+ const parentUuid = prevUuid;
293
+ prevUuid = uuid;
294
+
295
+ redactionHits += countRedactions(text);
296
+ const textRedacted = redactText(text);
297
+ redactedChars += text.length - textRedacted.length;
298
+
299
+ session.messages.push({
300
+ role,
301
+ ts,
302
+ uuid,
303
+ parentUuid,
304
+ model: currentModel,
305
+ textRedacted,
306
+ textLen: text.length,
307
+ thinkingChars: extra.thinkingChars || 0,
308
+ signatureChars: extra.signatureChars || 0,
309
+ toolUses: extra.toolUses || [],
310
+ toolResults: extra.toolResults || [],
311
+ usage: extra.usage || null,
312
+ });
313
+ session.chain.push({ uuid, parentUuid, ts });
314
+ stampSessionTs(ts);
315
+ };
316
+
317
+ const openTurn = () => {
318
+ turn = { ts: null, text: "", thinkingChars: 0, signatureChars: 0, toolUses: [], toolResults: [], usage: null };
319
+ };
320
+ const markTurnTs = (ts) => {
321
+ if (turn && !turn.ts && ts) turn.ts = ts;
322
+ };
323
+ const flushTurn = () => {
324
+ if (!turn) return;
325
+ const hasContent =
326
+ turn.text.trim().length > 0 ||
327
+ turn.toolUses.length > 0 ||
328
+ turn.toolResults.length > 0 ||
329
+ turn.thinkingChars > 0 ||
330
+ turn.signatureChars > 0 ||
331
+ !!turn.usage;
332
+ if (hasContent) {
333
+ emit("assistant", turn.ts, turn.text, {
334
+ thinkingChars: turn.thinkingChars,
335
+ signatureChars: turn.signatureChars,
336
+ toolUses: turn.toolUses,
337
+ toolResults: turn.toolResults,
338
+ usage: turn.usage,
339
+ });
340
+ }
341
+ turn = null;
342
+ };
343
+
344
+ for (const r of records) {
345
+ if (!r || typeof r !== "object") continue;
346
+ const ts = typeof r.timestamp === "string" ? r.timestamp : null;
347
+ const payload = r.payload && typeof r.payload === "object" ? r.payload : {};
348
+
349
+ if (r.type === "session_meta") {
350
+ if (payload.id) session.sessionId = payload.id;
351
+ if (payload.cwd) {
352
+ session.cwdRaw = payload.cwd;
353
+ session.cwdRedacted = toPosix(redactText(payload.cwd));
354
+ session.projectLabel = `project-${shortHash(payload.cwd)}`;
355
+ }
356
+ if (payload.cli_version) session.cliVersions.add(payload.cli_version);
357
+ if (payload.model_provider) modelProvider = payload.model_provider;
358
+ if (payload.originator) originatorCounts[payload.originator] = (originatorCounts[payload.originator] || 0) + 1;
359
+ continue;
360
+ }
361
+
362
+ if (r.type === "turn_context") {
363
+ if (payload.model) {
364
+ currentModel = modelProvider ? `${modelProvider}/${payload.model}` : payload.model;
365
+ session.models.add(currentModel);
366
+ }
367
+ continue;
368
+ }
369
+
370
+ if (r.type === "response_item") {
371
+ switch (payload.type) {
372
+ case "message": {
373
+ const role = payload.role;
374
+ if (role === "developer") break; // framework-injected: drop entirely
375
+ if (role === "user") {
376
+ const text = extractUserMessageText(payload.content);
377
+ if (text === null) break; // no surviving block: pure boilerplate, skip entirely
378
+ flushTurn();
379
+ emit("user", ts, text);
380
+ openTurn();
381
+ } else if (role === "assistant" && turn) {
382
+ turn.text += extractMessageText(payload.content);
383
+ markTurnTs(ts);
384
+ }
385
+ break;
386
+ }
387
+ case "reasoning": {
388
+ if (!turn) break;
389
+ const { thinkingChars, signatureChars } = reasoningLens(payload);
390
+ turn.thinkingChars += thinkingChars;
391
+ turn.signatureChars += signatureChars;
392
+ markTurnTs(ts);
393
+ break;
394
+ }
395
+ case "function_call": {
396
+ if (!turn) break;
397
+ turn.toolUses.push(buildFunctionCallToolUse(payload));
398
+ markTurnTs(ts);
399
+ break;
400
+ }
401
+ case "function_call_output": {
402
+ if (!turn) break;
403
+ turn.toolResults.push(buildFunctionCallResult(payload));
404
+ break;
405
+ }
406
+ case "custom_tool_call": {
407
+ if (!turn) break;
408
+ const toolUses =
409
+ payload.name === "apply_patch"
410
+ ? buildApplyPatchToolUses(payload)
411
+ : [{ id: payload.call_id, name: mapTool(payload.name), path: "", cmd: "", q: "" }];
412
+ turn.toolUses.push(...toolUses);
413
+ markTurnTs(ts);
414
+ break;
415
+ }
416
+ case "custom_tool_call_output": {
417
+ if (!turn) break;
418
+ turn.toolResults.push(buildCustomToolResult(payload));
419
+ break;
420
+ }
421
+ default:
422
+ break; // structural records with no message-shaped content
423
+ }
424
+ continue;
425
+ }
426
+
427
+ if (r.type === "event_msg") {
428
+ switch (payload.type) {
429
+ case "token_count": {
430
+ const u = payload.last_token_usage;
431
+ if (u && turn) {
432
+ turn.usage ||= { input: 0, output: 0, cacheRead: 0, cacheCreate: 0 };
433
+ turn.usage.input += u.input_tokens || 0;
434
+ turn.usage.output += u.output_tokens || 0;
435
+ turn.usage.cacheRead += u.cached_input_tokens || 0;
436
+ // cacheCreate has no codex counterpart; stays 0.
437
+ markTurnTs(ts);
438
+ }
439
+ break;
440
+ }
441
+ case "web_search_call": {
442
+ const query = payload.action && payload.action.query;
443
+ const q = query ? redactText(String(query).slice(0, 200)) : "";
444
+ const toolUse = { id: payload.call_id || payload.id, name: "WebSearch", path: "", cmd: "", q };
445
+ if (turn) {
446
+ turn.toolUses.push(toolUse);
447
+ markTurnTs(ts);
448
+ }
449
+ break;
450
+ }
451
+ default:
452
+ break; // task_started, task_complete, agent_message, user_message,
453
+ // web_search_end, agent_reasoning... duplicate response_item
454
+ // content or carry nothing structural worth capturing.
455
+ }
456
+ continue;
457
+ }
458
+ // Unknown top-level record type: ignore.
459
+ }
460
+
461
+ flushTurn();
462
+
463
+ files.push({ relPath, sha256: sha256(buf), bytes: statSync(path).size, lines: lines.length, malformed, cwdRaw: session.cwdRaw });
464
+ sessions.push({ ...session, cliVersions: [...session.cliVersions], models: [...session.models] });
465
+ }
466
+
467
+ return {
468
+ source: "codex",
469
+ root,
470
+ files,
471
+ sessions,
472
+ compactionSummaries: [], // codex has no compaction-summary convention to mine
473
+ redaction: { hits: redactionHits, charsRemoved: redactedChars },
474
+ stats: { originatorCounts, malformedLines: malformedLinesTotal },
475
+ };
476
+ }