trusty-mpm 1.3.4

trusty-mpm: unified multi-agent orchestration platform (core, daemon, CLI, TUI, Telegram)
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
512
513
514
515
516
517
518
519
520
521
522
523
524
//! Unit tests for [`super`] — the PM prompt composer and the retired-override
//! detector.
//!
//! Split out of `instruction_overrides.rs` by #4286: restoring coverage for the
//! roster-absent memory slot and the unapplied-section report pushed the parent
//! file to 538 SLOC, over the 500 production cap. Same `#[path]` split
//! `claude_md_sections.rs` already uses.

use super::*;
use std::fs;
use tempfile::TempDir;

/// Write `<project>/.trusty-mpm/<name>` with `content`, creating dirs.
fn write_override(project: &Path, name: &str, content: &str) {
    let dir = project.join(OVERRIDE_DIR_NAME);
    fs::create_dir_all(&dir).expect("create .trusty-mpm");
    fs::write(dir.join(name), content).expect("write override");
}

/// Deploy a composed agent into the PROJECT tier (`<project>/.claude/agents`).
///
/// Why: the project tier is the highest-precedence roster source and the one
/// the daemon managed-spawn path actually deploys into, so a test that writes
/// here asserts the real launch shape without depending on the machine's
/// `~/.claude/agents` (which these tests must never require or forbid).
fn deploy_agent(project: &Path, name: &str) {
    let dir = project.join(".claude").join("agents");
    fs::create_dir_all(&dir).expect("create .claude/agents");
    fs::write(
        dir.join(format!("{name}.md")),
        format!(
            "---\nname: {name}\nrole: {name}\ndescription: Handles {name} work.\n\
             model: sonnet\n---\n\n# {name}\n"
        ),
    )
    .expect("write agent");
}

#[test]
fn bundled_delegation_appends_deployed_roster() {
    // Issue #4069 REGRESSION GATE. The delegation section must describe the
    // agents that are actually deployed, not the static asset's
    // hand-maintained table. `ticketing` and `memory-manager` are deployed
    // in reality but appear NOWHERE in any bundled asset, so a rendered
    // `### <name>` roster entry for them can only come from the live scan.
    // Against the pre-fix code this assertion fails: `resolve_pm_prompt`
    // returned the static `AGENT_DELEGATION.md` verbatim.
    let tmp = TempDir::new().unwrap();
    deploy_agent(tmp.path(), "ticketing");
    deploy_agent(tmp.path(), "memory-manager");

    let prompt = resolve_pm_prompt(tmp.path());

    assert!(
        prompt.contains("## Delegation Authority"),
        "the live roster section must be present"
    );
    assert!(
        prompt.contains("### ticketing"),
        "a deployed agent absent from the static asset must reach the prompt"
    );
    assert!(
        prompt.contains("### memory-manager"),
        "a deployed agent absent from the static asset must reach the prompt"
    );
    assert!(
        prompt.contains("Handles ticketing work."),
        "the agent's own description must reach the prompt"
    );

    // The bundled routing doctrine is APPENDED to, never replaced: the
    // roster carries no make/mise or keyword routing rules.
    assert!(prompt.contains("# Agent Delegation Routing"));
    assert!(prompt.contains("## Make / Mise Command Routing"));

    // Review HIGH-2 / MEDIUM-2: the two blocks contradict each other on
    // concrete points, and the roster is a tier UNION that no single launch
    // mode fully loads. Both are resolved by the note between them, which
    // must be present whenever a roster is rendered.
    assert!(
        prompt.contains("trust the roster"),
        "the roster must be declared authoritative over the stale doctrine table"
    );
    assert!(
        prompt.contains("re-route to the closest listed alternative"),
        "an advertised-but-unloadable agent must carry a recovery instruction"
    );

    // Ordering: doctrine first, note, roster after, BASE_PM floor last.
    let doctrine = prompt.find("# Agent Delegation Routing").expect("doctrine");
    let note = prompt.find("trust the roster").expect("note");
    let roster = prompt.find("## Delegation Authority").expect("roster");
    let base = prompt.find("# Framework Instructions").expect("base");
    assert!(doctrine < note, "doctrine precedes the note");
    assert!(note < roster, "the note precedes the roster it governs");
    assert!(roster < base, "BASE_PM floor stays last");
}

#[test]
fn no_overrides_uses_bundled() {
    // No `.trusty-mpm/` dir at all → the bundled four sections are present
    // and BASE_PM is the last section.
    let tmp = TempDir::new().unwrap();
    let prompt = resolve_pm_prompt(tmp.path());

    assert!(prompt.contains("# PM Agent -- Trusty MPM"));
    assert!(prompt.contains("# PM Workflow Configuration"));
    assert!(prompt.contains("# Agent Delegation Routing"));
    assert!(prompt.contains("# Framework Instructions"));

    let base = prompt.find("# Framework Instructions").expect("base");
    let delegation = prompt.find("# Agent Delegation Routing").expect("deleg");
    assert!(base > delegation, "BASE_PM floor must be last");
}

// RETIREMENT GATES (#4286). Each of the six tests below was previously the
// assertion that a `.trusty-mpm/` file DID override, and each is now
// inverted to assert it does NOT. They are inverted rather than deleted on
// purpose: an inverted test still fails if someone reinstates the read path,
// whereas a deleted one would let the whole mechanism come back unnoticed.

#[test]
fn a_retired_instructions_file_no_longer_reaches_the_prompt() {
    // Was `instructions_appended`. This is the file that actually exists in
    // the field, so it is the retirement's highest-blast-radius case.
    let tmp = TempDir::new().unwrap();
    write_override(
        tmp.path(),
        FILE_INSTRUCTIONS,
        "# Project Rules\n\nALWAYS_RUN_MAKE_CHECK\n",
    );
    let prompt = resolve_pm_prompt(tmp.path());

    assert!(
        !prompt.contains("ALWAYS_RUN_MAKE_CHECK"),
        "a retired INSTRUCTIONS.md must not contribute to the prompt"
    );
    // The bundled sections are unaffected.
    assert!(prompt.contains("# PM Agent -- Trusty MPM"));
    assert!(prompt.contains("# Agent Delegation Routing"));
    assert!(prompt.contains("# Framework Instructions"));
}

#[test]
fn a_retired_workflow_file_no_longer_replaces_the_workflow_section() {
    // Was `workflow_override_replaces`. The bundled workflow heading now
    // SURVIVES, which is the exact inversion.
    let tmp = TempDir::new().unwrap();
    write_override(
        tmp.path(),
        FILE_WORKFLOW,
        "# Custom Workflow\n\nTWO_PHASE_ONLY\n",
    );
    let prompt = resolve_pm_prompt(tmp.path());

    assert!(!prompt.contains("TWO_PHASE_ONLY"));
    assert!(
        prompt.contains("# PM Workflow Configuration"),
        "the bundled workflow section must survive a retired WORKFLOW.md"
    );
}

#[test]
fn a_retired_delegation_file_no_longer_suppresses_the_live_roster() {
    // Was `agent_delegation_override_replaces`. This inversion also closes
    // the #4069 defect by construction: the retired file can no longer
    // suppress the live roster, because it is not read at all.
    let tmp = TempDir::new().unwrap();
    deploy_agent(tmp.path(), "ticketing");
    write_override(
        tmp.path(),
        FILE_AGENT_DELEGATION,
        "# Custom Routing\n\nROUTE_ALL_TO_ENGINEER\n",
    );
    let prompt = resolve_pm_prompt(tmp.path());

    assert!(!prompt.contains("ROUTE_ALL_TO_ENGINEER"));
    assert!(prompt.contains("# Agent Delegation Routing"));
    assert!(
        prompt.contains("### ticketing"),
        "the live roster must reach the prompt — a retired file cannot suppress it"
    );
}

#[test]
fn a_retired_memory_file_no_longer_slots_a_memory_block() {
    // Was `memory_override_is_slotted_after_pm_instructions`.
    let tmp = TempDir::new().unwrap();
    write_override(
        tmp.path(),
        FILE_MEMORY,
        "Recall from the `team` palace before any task.\n",
    );
    let prompt = resolve_pm_prompt(tmp.path());

    assert!(!prompt.contains(MEMORY_OVERRIDE_HEADING));
    assert!(!prompt.contains("Recall from the `team` palace"));
    assert!(prompt.contains("# PM Agent -- Trusty MPM"));
}

#[test]
fn a_retired_deployed_file_no_longer_replaces_the_body() {
    // Was `pm_deployed_replaces_body_but_keeps_base_floor`. This was the
    // most destructive of the five — a full-body replacement — so the
    // inversion asserts every bundled section is back.
    let tmp = TempDir::new().unwrap();
    write_override(
        tmp.path(),
        FILE_PM_DEPLOYED,
        "# Wholly Custom PM\n\nDO_EXACTLY_THIS\n",
    );
    let prompt = resolve_pm_prompt(tmp.path());

    assert!(!prompt.contains("DO_EXACTLY_THIS"));
    assert!(prompt.contains("# PM Agent -- Trusty MPM"));
    assert!(prompt.contains("# PM Workflow Configuration"));
    assert!(prompt.contains("# Agent Delegation Routing"));
    assert!(prompt.contains("# Framework Instructions"));
    assert!(prompt.contains("## Trusty Tool Priority (Non-Overridable)"));
}

#[test]
fn every_retired_file_present_at_once_changes_nothing() {
    // Was `pm_deployed_still_appends_instructions`. The strongest form of
    // the retirement claim: a project carrying ALL FIVE files receives
    // byte-for-byte the prompt of a project carrying none.
    let with = TempDir::new().unwrap();
    for name in LEGACY_OVERRIDE_FILES {
        write_override(with.path(), name, &format!("CONTENT_OF_{name}\n"));
    }
    let without = TempDir::new().unwrap();

    let (with_prompt, _) =
        resolve_pm_prompt_with_roster(with.path(), || Some("## Delegation Authority".into()));
    let (without_prompt, _) =
        resolve_pm_prompt_with_roster(without.path(), || Some("## Delegation Authority".into()));

    assert_eq!(
        with_prompt, without_prompt,
        "the five retired files must have zero effect on the composed prompt"
    );
}

#[test]
fn a_named_memory_override_is_slotted_on_the_roster_absent_path() {
    // COVERAGE RESTORED (#4286). `MEMORY_OVERRIDE_HEADING` is still live —
    // `assemble_sections` slots a MEMORY override as a delimited block — but
    // its only test drove it through the retired `.trusty-mpm/MEMORY.md`
    // file. Retiring that file left the behaviour real and untested. The
    // surviving way to reach it is a CLAUDE.md `MEMORY` block on the
    // roster-absent path, which is what this covers.
    let tmp = TempDir::new().unwrap();
    fs::write(
        tmp.path().join("CLAUDE.md"),
        "<!-- TRUSTY-MPM: MEMORY START v=1 -->\n\
         Recall from the `team` palace before any task.\n\
         <!-- TRUSTY-MPM: MEMORY END -->\n",
    )
    .unwrap();

    let (prompt, source) = resolve_pm_prompt_with_roster(tmp.path(), || None);
    assert_eq!(source, PromptSource::Legacy, "no roster -> string assembly");

    assert!(prompt.contains(MEMORY_OVERRIDE_HEADING));
    assert!(prompt.contains("Recall from the `team` palace"));

    let pm = prompt.find("# PM Agent -- Trusty MPM").expect("pm");
    let mem = prompt.find(MEMORY_OVERRIDE_HEADING).expect("mem");
    let wf = prompt
        .find("# PM Workflow Configuration")
        .expect("bundled workflow");
    assert!(pm < mem, "the memory block follows PM_INSTRUCTIONS");
    assert!(mem < wf, "and precedes the workflow section");
}

#[test]
fn unaddressable_sections_are_reported_unapplied_on_the_roster_absent_path() {
    // COVERAGE RESTORED (#4286). The string assembly can address only
    // WORKFLOW, MEMORY and AGENT-DELEGATION. Overrides for any other section
    // are handed to `warn_unapplied` rather than dropped in silence — that
    // call is still live, and its test went with the #4399 cluster.
    //
    // Asserted in its observable form: the override body must NOT appear
    // (it could not be applied), while the bundled section survives.
    let tmp = TempDir::new().unwrap();
    fs::write(
        tmp.path().join("CLAUDE.md"),
        "<!-- TRUSTY-MPM: SEARCH START v=1 -->\n\
         UNAPPLIED_SEARCH_BODY\n\
         <!-- TRUSTY-MPM: SEARCH END -->\n\n\
         <!-- TRUSTY-MPM: WORKFLOW START v=1 -->\n\
         APPLIED_WORKFLOW_BODY\n\
         <!-- TRUSTY-MPM: WORKFLOW END -->\n",
    )
    .unwrap();

    let (prompt, source) = resolve_pm_prompt_with_roster(tmp.path(), || None);
    assert_eq!(source, PromptSource::Legacy);

    assert!(
        !prompt.contains("UNAPPLIED_SEARCH_BODY"),
        "SEARCH has no slot in the string assembly and must not land"
    );
    // ...and the section it aimed at is still delivered from the bundle.
    assert!(prompt.contains("## Code Search Protocol (Context-First)"));
    // The addressable sibling in the same file still applies, which is what
    // makes the negative above a real limitation rather than a dropped file.
    assert!(prompt.contains("APPLIED_WORKFLOW_BODY"));
}

#[test]
fn legacy_override_files_are_the_five_retired_names() {
    // Pins the detector's set against the individual constants, so adding a
    // sixth name to one place and not the other is a red test rather than a
    // file that is silently never detected.
    assert_eq!(
        LEGACY_OVERRIDE_FILES,
        [
            "PM_INSTRUCTIONS_DEPLOYED.md",
            "AGENT_DELEGATION.md",
            "WORKFLOW.md",
            "MEMORY.md",
            "INSTRUCTIONS.md",
        ]
    );
}

#[test]
fn no_legacy_files_detected_in_a_clean_project() {
    let tmp = TempDir::new().unwrap();
    assert!(detect_legacy_overrides(tmp.path()).is_empty());
    // A `.trusty-mpm/` directory holding only non-override state is clean.
    fs::create_dir_all(tmp.path().join(OVERRIDE_DIR_NAME)).unwrap();
    fs::write(
        tmp.path()
            .join(OVERRIDE_DIR_NAME)
            .join("last-instructions.md"),
        "composed",
    )
    .unwrap();
    assert!(detect_legacy_overrides(tmp.path()).is_empty());
}

#[test]
fn every_retired_file_is_detected() {
    let tmp = TempDir::new().unwrap();
    for name in LEGACY_OVERRIDE_FILES {
        write_override(tmp.path(), name, "x\n");
    }
    let found = detect_legacy_overrides(tmp.path());
    assert_eq!(found.len(), LEGACY_OVERRIDE_FILES.len());
    for name in LEGACY_OVERRIDE_FILES {
        assert!(
            found.iter().any(|p| p.ends_with(name)),
            "detector missed {name}"
        );
    }
}

#[test]
fn legacy_file_signal_names_the_migration() {
    // The migration hint is what turns a failure into an actionable one; it
    // must name the destination surface AND the marker grammar.
    assert!(LEGACY_MIGRATION_HINT.contains("CLAUDE.md"));
    assert!(LEGACY_MIGRATION_HINT.contains("TRUSTY-MPM:"));
    assert!(LEGACY_MIGRATION_HINT.contains("#4286"));
}

#[test]
fn missing_override_dir_uses_bundled() {
    // A `.trusty-mpm/` directory that does not exist is not an error.
    let tmp = TempDir::new().unwrap();
    assert!(!tmp.path().join(OVERRIDE_DIR_NAME).exists());
    let prompt = resolve_pm_prompt(tmp.path());
    assert!(prompt.contains("# PM Agent -- Trusty MPM"));
    assert!(prompt.contains("# Framework Instructions"));
}

#[test]
fn a_directory_in_a_retired_files_place_is_not_detected_and_not_fatal() {
    // Was `unreadable_override_falls_back`. The detector uses `is_file`, so
    // a directory sitting where a retired file would be is NOT reported —
    // reporting it would send the operator to migrate a directory. The
    // launch must also still succeed.
    let tmp = TempDir::new().unwrap();
    let dir = tmp.path().join(OVERRIDE_DIR_NAME);
    fs::create_dir_all(&dir).unwrap();
    fs::create_dir(dir.join(FILE_WORKFLOW)).unwrap();

    assert!(detect_legacy_overrides(tmp.path()).is_empty());
    let prompt = resolve_pm_prompt(tmp.path());
    assert!(prompt.contains("# PM Workflow Configuration"));
    assert!(prompt.contains("# Framework Instructions"));
}

#[test]
fn an_empty_retired_file_is_still_detected() {
    // Was `empty_override_falls_back`. Emptiness used to mean "no override";
    // it now means nothing at all for composition, but the file must still
    // be REPORTED — an empty leftover is still a file the operator has to
    // delete, and staying silent about it leaves `tm doctor` green with a
    // retired file on disk.
    let tmp = TempDir::new().unwrap();
    write_override(tmp.path(), FILE_WORKFLOW, "   \n\t\n");

    assert_eq!(detect_legacy_overrides(tmp.path()).len(), 1);
    let prompt = resolve_pm_prompt(tmp.path());
    assert!(prompt.contains("# PM Workflow Configuration"));
    assert!(prompt.contains("# Framework Instructions"));
}

#[test]
fn separators_are_consistent() {
    // The resolved prompt uses the same `---` rule the bundled assembler
    // uses, so the two never visually diverge.
    let tmp = TempDir::new().unwrap();
    let prompt = resolve_pm_prompt(tmp.path());
    assert!(prompt.contains(SECTION_SEPARATOR));
}

#[test]
fn stack_profile_present_when_detected() {
    // A detected project (Cargo.toml) folds in the auto-derived stack profile
    // right after PM_INSTRUCTIONS and before the BASE_PM floor, routing to the
    // detected engineer — never a hardcoded default (#1971).
    use crate::core::stack_profile::STACK_PROFILE_HEADING;
    let tmp = TempDir::new().unwrap();
    fs::write(tmp.path().join("Cargo.toml"), "[package]\nname=\"x\"\n").unwrap();

    let prompt = resolve_pm_prompt(tmp.path());
    assert!(prompt.contains(STACK_PROFILE_HEADING));
    assert!(prompt.contains("`rust-engineer`"));

    let pm = prompt.find("# PM Agent -- Trusty MPM").expect("pm");
    let stack = prompt.find(STACK_PROFILE_HEADING).expect("stack");
    let base = prompt.find("# Framework Instructions").expect("base");
    assert!(pm < stack, "stack profile follows PM_INSTRUCTIONS");
    assert!(stack < base, "stack profile precedes the BASE_PM floor");
}

#[test]
fn stack_profile_neutral_when_undetected() {
    // An unknown project type yields a neutral, detect-first profile — the PM
    // is told NOT to assume any stack rather than inheriting a default.
    use crate::core::stack_profile::STACK_PROFILE_HEADING;
    let tmp = TempDir::new().unwrap();
    let prompt = resolve_pm_prompt(tmp.path());
    assert!(prompt.contains(STACK_PROFILE_HEADING));
    assert!(prompt.contains("Do NOT assume any stack"));
}

#[test]
fn framework_guaranteed_conventions_survive_every_override_combination() {
    // Issue #3374 (mirrors `primary_directive_mandate_not_duplicated_across_
    // channels` in instruction_pipeline.rs): the commit/PR attribution
    // footer, the proportional-documentation policy, and the ticket-
    // attribution-at-change-site convention must live in the BASE_PM floor
    // and therefore survive EVERY override combination — including the
    // full-PM-replacement branch, where every bundled body section is
    // discarded but the floor is still appended.
    const MARKERS: &[&str] = &[
        "Generated with trusty-mpm",
        "Proportional documentation",
        "Ticket attribution at the change site",
    ];

    // No overrides at all: conventions present via the bundled floor.
    let tmp = TempDir::new().unwrap();
    let prompt = resolve_pm_prompt(tmp.path());
    for marker in MARKERS {
        assert!(
            prompt.contains(marker),
            "no-override prompt must carry the guaranteed convention {marker:?}"
        );
    }

    // CLAUDE.md named-section overrides of every PROJECT-tier section at
    // once — the maximal customization a project can now express. The floor
    // is `fixed` tier, so none of these can touch it. This replaces the
    // former "all five legacy files" and "full PM replacement" arms, which
    // no longer exist as reachable configurations (#4286).
    let tmp2 = TempDir::new().unwrap();
    std::fs::write(
        tmp2.path().join("CLAUDE.md"),
        "<!-- TRUSTY-MPM: CORE START v=1 -->\nCUSTOM_CORE\n<!-- TRUSTY-MPM: CORE END -->\n\n\
         <!-- TRUSTY-MPM: MEMORY START v=1 -->\nCUSTOM_MEMORY\n<!-- TRUSTY-MPM: MEMORY END -->\n\n\
         <!-- TRUSTY-MPM: SEARCH START v=1 -->\nCUSTOM_SEARCH\n<!-- TRUSTY-MPM: SEARCH END -->\n\n\
         <!-- TRUSTY-MPM: WORKFLOW START v=1 -->\nCUSTOM_WORKFLOW\n<!-- TRUSTY-MPM: WORKFLOW END -->\n\n\
         <!-- TRUSTY-MPM: AGENT-DELEGATION START v=1 -->\nCUSTOM_ROUTING\n<!-- TRUSTY-MPM: AGENT-DELEGATION END -->\n",
    )
    .unwrap();
    let (prompt2, _) =
        resolve_pm_prompt_with_roster(tmp2.path(), || Some("## Delegation Authority".into()));
    for marker in MARKERS {
        assert!(
            prompt2.contains(marker),
            "a fully-overridden prompt must still carry {marker:?} via the floor"
        );
    }
    // The overrides really did land — otherwise the assertions above would
    // pass vacuously against an unmodified bundled prompt.
    assert!(prompt2.contains("CUSTOM_WORKFLOW"));
    assert!(prompt2.contains("CUSTOM_ROUTING"));

    // A project that ALSO carries all five retired files must be no
    // different: the floor survives and the retired content never appears.
    let tmp3 = TempDir::new().unwrap();
    for name in LEGACY_OVERRIDE_FILES {
        write_override(tmp3.path(), name, "RETIRED_CONTENT\n");
    }
    let prompt3 = resolve_pm_prompt(tmp3.path());
    for marker in MARKERS {
        assert!(
            prompt3.contains(marker),
            "a prompt for a project with retired files must still carry {marker:?}"
        );
    }
    assert!(
        !prompt3.contains("RETIRED_CONTENT"),
        "retired files must not contribute"
    );
    // The other half of the survival set the floor guarantees.
    assert!(prompt3.contains("## Trusty Tool Priority (Non-Overridable)"));
}