remem-ai 0.5.202

Local-first coding agent memory for Claude Code and OpenAI Codex
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
use super::*;
use rusqlite::params;

fn setup_gate_conn() -> rusqlite::Connection {
    let conn = rusqlite::Connection::open_in_memory().unwrap();
    conn.execute_batch(include_str!(
        "../../migrations/v016_context_injection_gate.sql"
    ))
    .unwrap();
    conn
}

fn setup_gate_conn_with_data_version() -> Result<rusqlite::Connection> {
    let conn = setup_gate_conn();
    conn.execute(
        "ALTER TABLE context_injections ADD COLUMN data_version TEXT",
        [],
    )?;
    Ok(conn)
}

fn gate_invocation(session_id: Option<&str>) -> ContextInvocation {
    ContextInvocation {
        cwd: "/tmp/remem".to_string(),
        project: "/tmp/remem".to_string(),
        session_id: session_id.map(str::to_string),
        transcript_path: Some("/tmp/remem.jsonl".to_string()),
        source: None,
        host: HostKind::CodexCli,
        use_colors: false,
        debug: false,
        force: false,
        gate_mode: None,
    }
}

fn claude_gate_invocation(session_id: Option<&str>) -> ContextInvocation {
    let mut invocation = gate_invocation(session_id);
    invocation.host = HostKind::ClaudeCode;
    invocation
}

fn apply_test_context_gate(invocation: &ContextInvocation, output: String) -> ContextGateDecision {
    let conn = match crate::db::test_support::runtime_connection() {
        Ok(conn) => conn,
        Err(error) => panic!("test database should open: {error:#}"),
    };
    apply_context_gate(&conn, invocation, output)
}

#[test]
fn fingerprint_ignores_header_timestamp() {
    let a = "# [/tmp/remem] context 2026-05-25 1:00pm\nBody\n";
    let b = "# [/tmp/remem] context 2026-05-25 2:00pm\nBody\n";

    assert_eq!(context_fingerprint(a), context_fingerprint(b));
}

#[test]
fn fingerprint_ignores_footer_totals_derived_from_header_width() {
    let a = "# [/tmp/remem] context 2026-05-25 9:00am\nBody\n\n1 context memories loaded. 1 core (10 chars). 0 lessons (0 chars). 0 indexed (0 chars). 0 preferences (project:0 global:0, 0 chars). 0 sessions (0 chars). host=codex-cli branch=main total=100 chars/~25 tokens limit=12000 truncated=no\n";
    let b = "# [/tmp/remem] context 2026-05-25 10:00am\nBody\n\n1 context memories loaded. 1 core (10 chars). 0 lessons (0 chars). 0 indexed (0 chars). 0 preferences (project:0 global:0, 0 chars). 0 sessions (0 chars). host=codex-cli branch=main total=101 chars/~26 tokens limit=12000 truncated=no\n";

    assert_eq!(context_fingerprint(a), context_fingerprint(b));
}

#[test]
fn fingerprint_ignores_context_source_note() {
    let normal =
        "# [/tmp/remem] context now\nUse `search`/`get_observations` for details.\n\nBody\n";
    let post_compact = "# [/tmp/remem] context now [REMEM POST-COMPACT RELOAD]\nUse `search`/`get_observations` for details.\nREMEM_CONTEXT_SOURCE=compact: Codex compact triggered this memory context reload.\n\nBody\n";
    let current_compact = "# [/tmp/remem] context now\nUse `search`/`get_observations` for details.\n\nCodex compacted the chat, so remem refreshed memory context.\n\nBody\n";
    let current_clear = "# [/tmp/remem] context now\nUse `search`/`get_observations` for details.\n\nContext was reloaded after an explicit clear.\n\nBody\n";

    assert_eq!(
        context_fingerprint(normal),
        context_fingerprint(post_compact)
    );
    assert_eq!(
        context_fingerprint(normal),
        context_fingerprint(current_compact)
    );
    assert_eq!(
        context_fingerprint(normal),
        context_fingerprint(current_clear)
    );
}

#[test]
fn fingerprint_ignores_indented_terminal_header_source_and_timestamp() {
    let a = "remem context\n              ├─ project: /tmp/remem\n              ├─ source: compact\n              └─ updated: 2026-06-02 6:44pm +08:00\nBody\n";
    let b = "remem context\n              ├─ project: /tmp/remem\n              ├─ source: compact\n              └─ updated: 2026-06-02 6:45pm +08:00\nBody\n";

    assert_eq!(context_fingerprint(a), context_fingerprint(b));
}

#[test]
fn fingerprint_ignores_codex_color_indent_and_visual_footer_totals() {
    let plain = "remem context\n├─ project: /tmp/remem\n├─ branch: main\n└─ updated: 2026-06-02 6:44pm +08:00\nBody\n\nLoaded\n├─ Memories: 1 total, 1 core, 0 lessons, 0 indexed\n├─ Preferences: 0 total, 0 project, 0 global\n├─ Sessions: 0\n├─ Workstreams: 0\n└─ Budget: 100 chars (~25 tokens) / 12000, truncated: no\n";
    let colored = "\x1b[1;36mremem context\x1b[0m\n              ├─ \x1b[1mproject\x1b[0m: /tmp/remem\n              ├─ \x1b[1mbranch\x1b[0m: main\n              └─ \x1b[1mupdated\x1b[0m: 2026-06-02 6:45pm +08:00\nBody\n\n\x1b[1;36mLoaded\x1b[0m\n├─ \x1b[1mMemories\x1b[0m: 1 total, 1 core, 0 lessons, 0 indexed\n├─ \x1b[1mPreferences\x1b[0m: 0 total, 0 project, 0 global\n├─ \x1b[1mSessions\x1b[0m: 0\n├─ \x1b[1mWorkstreams\x1b[0m: 0\n└─ \x1b[1mBudget\x1b[0m: 101 chars (~26 tokens) / 12000, truncated: no\n";

    assert_eq!(context_fingerprint(plain), context_fingerprint(colored));
}

#[test]
fn fingerprint_keeps_non_footer_total_text() {
    let a = "# [/tmp/remem] context now\nBody total=100 chars/~25 tokens\n";
    let b = "# [/tmp/remem] context now\nBody total=101 chars/~26 tokens\n";

    assert_ne!(context_fingerprint(a), context_fingerprint(b));
}

#[test]
fn first_same_session_context_emits_and_second_suppresses() -> Result<()> {
    let conn = setup_gate_conn();
    let invocation = gate_invocation(Some("sess-1"));
    let key = injection_key(&invocation);
    let hash = context_fingerprint("# [/tmp/remem] context now\nBody\n");

    assert!(load_gate_row(&conn, invocation.host.as_env_value(), &key)?.is_none());
    upsert_emit_row(&conn, &invocation, &key, &hash, None, "full", 32, 100)?;
    let row = load_gate_row(&conn, invocation.host.as_env_value(), &key)?
        .ok_or_else(|| anyhow::anyhow!("missing context injection gate row"))?;
    assert_eq!(row.context_hash, hash);

    record_suppression(&conn, &invocation, &key, None, 101)?;
    let suppress_count: i64 = conn.query_row(
        "SELECT suppress_count FROM context_injections WHERE host = ?1 AND injection_key = ?2",
        params![invocation.host.as_env_value(), key],
        |row| row.get(0),
    )?;
    assert_eq!(suppress_count, 1);
    Ok(())
}

#[test]
fn fallback_injection_key_canonicalizes_equivalent_cwd() -> Result<()> {
    let cwd = std::env::current_dir()?;
    let mut direct = gate_invocation(None);
    direct.transcript_path = None;
    direct.cwd = cwd.to_string_lossy().to_string();

    let mut dotted = direct.clone();
    dotted.cwd = cwd.join(".").to_string_lossy().to_string();

    assert_eq!(injection_key(&direct), injection_key(&dotted));
    Ok(())
}

#[test]
fn transcript_fallback_injection_key_canonicalizes_equivalent_cwd() -> Result<()> {
    let cwd = std::env::current_dir()?;
    let mut direct = gate_invocation(None);
    direct.cwd = cwd.to_string_lossy().to_string();
    direct.transcript_path = Some("/tmp/remem-transcript.jsonl".to_string());

    let mut dotted = direct.clone();
    dotted.cwd = cwd.join(".").to_string_lossy().to_string();

    assert_eq!(injection_key(&direct), injection_key(&dotted));
    Ok(())
}

#[test]
fn cwd_only_fallback_identity_fails_open_without_suppressing() {
    let _data_dir = crate::db::test_support::ScopedTestDataDir::new("context-gate-cwd-only");
    let mut invocation = gate_invocation(None);
    invocation.transcript_path = None;
    let output = "# [/tmp/remem] context now\nBody\n".to_string();

    let first = apply_test_context_gate(&invocation, output.clone());
    assert_eq!(first.action, ContextGateAction::FailOpen);
    assert_eq!(first.reason, "missing_session_identity");
    assert_eq!(first.output, output);

    let second = apply_test_context_gate(&invocation, output.clone());
    assert_eq!(second.action, ContextGateAction::FailOpen);
    assert_eq!(second.reason, "missing_session_identity");
    assert_eq!(second.output, output);
}

#[test]
fn suppression_does_not_extend_fallback_cooldown() -> Result<()> {
    let conn = setup_gate_conn();
    let invocation = gate_invocation(None);
    let key = injection_key(&invocation);
    let hash = context_fingerprint("# [/tmp/remem] context now\nBody\n");

    upsert_emit_row(&conn, &invocation, &key, &hash, None, "full", 32, 100)?;
    record_suppression(&conn, &invocation, &key, None, 150)?;

    let (updated_at_epoch, last_emitted_epoch, suppress_count): (i64, i64, i64) = conn.query_row(
        "SELECT updated_at_epoch, last_emitted_epoch, suppress_count
             FROM context_injections
             WHERE host = ?1 AND injection_key = ?2",
        params![invocation.host.as_env_value(), key],
        |row| Ok((row.get(0)?, row.get(1)?, row.get(2)?)),
    )?;

    assert_eq!(updated_at_epoch, 150);
    assert_eq!(last_emitted_epoch, 100);
    assert_eq!(suppress_count, 1);
    Ok(())
}

#[test]
fn restart_source_requires_fresh_emission() {
    assert!(source_requires_fresh_emission(Some("clear")));
    assert!(!source_requires_fresh_emission(Some("Compact")));
    assert!(!source_requires_fresh_emission(Some("startup")));
    assert!(!source_requires_fresh_emission(None));
}

#[test]
fn compact_source_is_suppressed_by_default() {
    assert!(source_is_suppressed(Some("Compact")));
    assert!(!source_is_suppressed(Some("clear")));
    assert!(!source_is_suppressed(Some("startup")));
    assert!(!source_is_suppressed(None));
}

#[test]
fn compact_source_emits_first_context() {
    let _data_dir = crate::db::test_support::ScopedTestDataDir::new("context-gate-compact-first");
    let mut invocation = gate_invocation(Some("sess-compact-first"));
    invocation.source = Some("compact".to_string());
    let output = "# [/tmp/remem] context now\nBody\n".to_string();

    let decision = apply_test_context_gate(&invocation, output.clone());
    assert_eq!(decision.action, ContextGateAction::EmittedFull);
    assert_eq!(decision.reason, "first_or_forced");
    assert_eq!(decision.output, output);
    assert_eq!(decision.output_mode, Some("full"));
    assert!(decision
        .key
        .as_deref()
        .is_some_and(|key| key.contains("sess-compact-first")));
    assert!(decision.context_hash.is_some());
}

#[test]
fn compact_source_suppresses_same_hash_after_first_context() {
    let _data_dir =
        crate::db::test_support::ScopedTestDataDir::new("context-gate-compact-same-hash");
    let mut invocation = gate_invocation(Some("sess-compact-same-hash"));
    let output = "# [/tmp/remem] context now\nBody\n".to_string();

    let first = apply_test_context_gate(&invocation, output.clone());
    assert_eq!(first.action, ContextGateAction::EmittedFull);

    invocation.source = Some("compact".to_string());
    let second = apply_test_context_gate(&invocation, output);
    assert_eq!(second.action, ContextGateAction::Suppressed);
    assert_eq!(second.reason, "suppressed_source");
    assert!(second.output.is_empty());
}

#[test]
fn compact_source_force_bypasses_suppression() {
    let _data_dir = crate::db::test_support::ScopedTestDataDir::new("context-gate-compact-force");
    let mut invocation = gate_invocation(Some("sess-compact-force"));
    let output = "# [/tmp/remem] context now\nBody\n".to_string();

    let first = apply_test_context_gate(&invocation, output.clone());
    assert_eq!(first.action, ContextGateAction::EmittedFull);

    invocation.source = Some("compact".to_string());
    invocation.force = true;
    let forced = apply_test_context_gate(&invocation, output.clone());
    assert_eq!(forced.action, ContextGateAction::EmittedFull);
    assert_eq!(forced.reason, "first_or_forced");
    assert_eq!(forced.output, output);
}

#[test]
fn claude_code_resume_suppresses_same_session_same_hash_by_default() {
    let _data_dir = crate::db::test_support::ScopedTestDataDir::new("context-gate-claude-resume");
    let invocation = claude_gate_invocation(Some("claude-session-1"));
    let output = "# [/tmp/remem] context now\nBody\n".to_string();

    let first = apply_test_context_gate(&invocation, output.clone());
    assert_eq!(first.action, ContextGateAction::EmittedFull);
    assert_eq!(first.reason, "first_or_forced");
    assert_eq!(first.output, output);
    assert!(first
        .key
        .as_deref()
        .is_some_and(|key| key.contains("claude-session-1")));

    let second = apply_test_context_gate(&invocation, output);
    assert_eq!(second.action, ContextGateAction::Suppressed);
    assert_eq!(second.reason, "same_hash");
    assert!(second.output.is_empty());
}

#[test]
fn claude_code_compact_session_start_suppresses_same_hash_by_default() {
    let _data_dir = crate::db::test_support::ScopedTestDataDir::new("context-gate-claude-compact");
    let mut invocation = claude_gate_invocation(Some("claude-session-compact"));
    let output = "# [/tmp/remem] context now\nBody\n".to_string();

    let first = apply_test_context_gate(&invocation, output.clone());
    assert_eq!(first.action, ContextGateAction::EmittedFull);

    invocation.source = Some("compact".to_string());
    let second = apply_test_context_gate(&invocation, output);
    assert_eq!(second.action, ContextGateAction::Suppressed);
    assert_eq!(second.reason, "suppressed_source");
    assert!(second.output.is_empty());
}

#[test]
fn claude_code_compact_changed_hash_emits_delta_by_default() {
    let _data_dir =
        crate::db::test_support::ScopedTestDataDir::new("context-gate-claude-compact-changed");
    let mut invocation = claude_gate_invocation(Some("claude-session-compact-changed"));

    let first = apply_test_context_gate(
        &invocation,
        "# [/tmp/remem] context now\nBody A\n".to_string(),
    );
    assert_eq!(first.action, ContextGateAction::EmittedFull);

    invocation.source = Some("compact".to_string());
    let second = apply_test_context_gate(
        &invocation,
        "# [/tmp/remem] context now\nBody B\n".to_string(),
    );
    assert_eq!(second.action, ContextGateAction::EmittedDelta);
    assert_eq!(second.reason, "changed_hash");
    assert!(second.output.contains("context delta"));
}

#[test]
fn unknown_host_remains_ungated_by_default() {
    let _data_dir = crate::db::test_support::ScopedTestDataDir::new("context-gate-unknown-host");
    let mut invocation = gate_invocation(Some("unknown-session"));
    invocation.host = HostKind::Unknown;
    let output = "# [/tmp/remem] context now\nBody\n".to_string();

    let first = apply_test_context_gate(&invocation, output.clone());
    assert_eq!(first.action, ContextGateAction::Bypassed);
    assert_eq!(first.reason, "host_not_gated");
    assert_eq!(first.output, output);

    let second = apply_test_context_gate(&invocation, output.clone());
    assert_eq!(second.action, ContextGateAction::Bypassed);
    assert_eq!(second.reason, "host_not_gated");
    assert_eq!(second.output, output);
}

#[test]
fn compact_source_missing_identity_fails_open() {
    let _data_dir = crate::db::test_support::ScopedTestDataDir::new("context-gate-compact-no-id");
    let mut invocation = gate_invocation(None);
    invocation.transcript_path = None;
    invocation.source = Some("compact".to_string());
    let output = "# [/tmp/remem] context now\nBody\n".to_string();

    let decision = apply_test_context_gate(&invocation, output.clone());
    assert_eq!(decision.action, ContextGateAction::FailOpen);
    assert_eq!(decision.reason, "missing_session_identity");
    assert_eq!(decision.output, output);
}

#[test]
fn compact_source_changed_hash_emits_delta() {
    let _data_dir = crate::db::test_support::ScopedTestDataDir::new("context-gate-compact-changed");
    let mut invocation = gate_invocation(Some("sess-compact-changed"));

    let first = apply_test_context_gate(
        &invocation,
        "# [/tmp/remem] context now\nBody A\n".to_string(),
    );
    assert_eq!(first.action, ContextGateAction::EmittedFull);

    invocation.source = Some("compact".to_string());
    let second = apply_test_context_gate(
        &invocation,
        "# [/tmp/remem] context now\nBody B\n".to_string(),
    );
    assert_eq!(second.action, ContextGateAction::EmittedDelta);
    assert_eq!(second.reason, "changed_hash");
    assert!(second.output.contains("context delta"));
}

#[test]
fn strict_mode_suppresses_changed_hash_after_first_context() {
    let _data_dir = crate::db::test_support::ScopedTestDataDir::new("context-gate-strict-changed");
    let mut invocation = gate_invocation(Some("sess-strict-changed"));
    invocation.gate_mode = Some("strict".to_string());

    let first = apply_test_context_gate(
        &invocation,
        "# [/tmp/remem] context now\nBody A\n".to_string(),
    );
    assert_eq!(first.action, ContextGateAction::EmittedFull);

    let second = apply_test_context_gate(
        &invocation,
        "# [/tmp/remem] context now\nBody B\n".to_string(),
    );
    assert_eq!(second.action, ContextGateAction::Suppressed);
    assert_eq!(second.reason, "strict");
    assert!(second.output.is_empty());
}

#[test]
fn restart_source_reemits_same_hash_context() {
    let _data_dir = crate::db::test_support::ScopedTestDataDir::new("context-gate-restart");
    let mut invocation = gate_invocation(Some("sess-restart"));
    let output = "# [/tmp/remem] context now\nBody\n".to_string();

    let first = apply_test_context_gate(&invocation, output.clone());
    assert_eq!(first.action, ContextGateAction::EmittedFull);

    let second = apply_test_context_gate(&invocation, output.clone());
    assert_eq!(second.action, ContextGateAction::Suppressed);

    invocation.source = Some("clear".to_string());
    let restart = apply_test_context_gate(&invocation, output.clone());
    assert_eq!(restart.action, ContextGateAction::EmittedFull);
    assert_eq!(restart.reason, "restart_source");
    assert_eq!(restart.output, output);
}

#[test]
fn strict_suppression_after_render_refreshes_data_version_only() -> Result<()> {
    let conn = setup_gate_conn_with_data_version()?;
    let mut invocation = gate_invocation(Some("sess-strict-data-version"));
    invocation.gate_mode = Some("strict".to_string());
    let key = injection_key(&invocation);
    let emitted_hash = context_fingerprint("# [/tmp/remem] context now\nBody A\n");
    let now = chrono::Utc::now().timestamp();

    upsert_emit_row(
        &conn,
        &invocation,
        &key,
        &emitted_hash,
        Some("version-a"),
        "full",
        32,
        now,
    )?;

    let decision = apply_context_gate_with_data_version(
        &conn,
        &invocation,
        "# [/tmp/remem] context now\nBody B\n".to_string(),
        Some("version-b"),
    );

    assert_eq!(decision.action, ContextGateAction::Suppressed);
    assert_eq!(decision.reason, "strict");
    let (stored_hash, stored_version): (String, Option<String>) = conn.query_row(
        "SELECT context_hash, data_version
         FROM context_injections
         WHERE host = ?1 AND injection_key = ?2",
        params![invocation.host.as_env_value(), key],
        |row| Ok((row.get(0)?, row.get(1)?)),
    )?;
    assert_eq!(stored_hash, emitted_hash);
    assert_eq!(stored_version.as_deref(), Some("version-b"));
    Ok(())
}

#[test]
fn emit_and_suppress_persist_hook_source() -> Result<()> {
    let conn = setup_gate_conn();
    let mut invocation = gate_invocation(Some("sess-source"));
    invocation.source = Some("startup".to_string());
    let key = injection_key(&invocation);
    let hash = context_fingerprint("# [/tmp/remem] context now\nBody\n");

    upsert_emit_row(&conn, &invocation, &key, &hash, None, "full", 32, 100)?;
    invocation.source = Some("resume".to_string());
    record_suppression(&conn, &invocation, &key, None, 101)?;

    let hook_source: Option<String> = conn.query_row(
        "SELECT hook_source FROM context_injections WHERE host = ?1 AND injection_key = ?2",
        params![invocation.host.as_env_value(), key],
        |row| row.get(0),
    )?;

    assert_eq!(hook_source.as_deref(), Some("resume"));
    Ok(())
}

#[test]
fn fingerprint_keeps_user_debug_trace_heading() {
    let a = "# [/tmp/remem] context now\nBody\n## Debug Trace\nUser note A\n";
    let b = "# [/tmp/remem] context now\nBody\n## Debug Trace\nUser note B\n";

    assert_ne!(context_fingerprint(a), context_fingerprint(b));
}

#[test]
fn fingerprint_ignores_generated_debug_trace() {
    let base = "# [/tmp/remem] context now\nBody\n";
    let a = format!(
        "{}\n## Debug Trace\n- request host=codex-cli project=/tmp/remem cwd=/tmp/remem branch=main session=sess-1\n\n1 context memories loaded. 1 core (10 chars). 0 lessons (0 chars). 0 indexed (0 chars). 0 preferences (project:0 global:0, 0 chars). 0 sessions (0 chars). host=codex-cli branch=main total=100 chars/~25 tokens limit=12000 truncated=no\n",
        base
    );
    let b = format!(
        "{}\n## Debug Trace\n- request host=codex-cli project=/tmp/remem cwd=/tmp/remem branch=dev session=sess-2\n\n1 context memories loaded. 1 core (10 chars). 0 lessons (0 chars). 0 indexed (0 chars). 0 preferences (project:0 global:0, 0 chars). 0 sessions (0 chars). host=codex-cli branch=dev total=120 chars/~30 tokens limit=12000 truncated=no\n",
        base
    );

    assert_eq!(context_fingerprint(&a), context_fingerprint(&b));
}