aft-base 0.67.1

Shared foundation for Agent Foundational Toolkit
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
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
use crate::list_envelope::{Reason, Unit};

pub mod bash;
pub mod call_tree;
pub mod callers;
pub mod callgraph;
pub mod glob;
pub mod grep;
pub mod impact;
pub mod inspect;
pub mod outline;
pub mod read;
pub mod search;
pub mod trace;
pub mod trace_data;
pub mod trace_to;

/// Shared list-envelope rendering entry point for tool and daemon output.
pub fn render_envelope_trailer(envelope: &crate::list_envelope::ListEnvelope) -> Option<String> {
    crate::list_envelope::render_trailer(envelope)
}

#[cfg(test)]
mod tests {
    #[test]
    fn callgraph_caps_keep_the_twenty_trigger_and_fifteen_limit() {
        let mut items: Vec<_> = (0..20).collect();
        assert_eq!(super::callgraph::cap_items(&mut items), (20, 20));
        items.push(20);
        assert_eq!(super::callgraph::cap_items(&mut items), (15, 21));
        assert_eq!(items, (0..15).collect::<Vec<_>>());
    }

    #[test]
    fn foreground_annotations_and_rendered_grep_rows_keep_their_counts() {
        assert!(super::bash::is_foreground_task_line("[task bash-1]"));
        assert!(super::bash::is_foreground_task_line(
            "[task bash-1 (job job-2)]"
        ));
        assert!(!super::bash::is_foreground_task_line("[task ]"));
        assert_eq!(
            super::bash::count_output_lines("one\n[task bash-1]\ntwo\n"),
            2
        );
        let mut data = serde_json::json!({"matches": [1, 2, 3]});
        assert_eq!(super::grep::rendered_grep_match_count(&data), 3);
        data["rendered_matches"] = serde_json::json!(2);
        assert_eq!(super::grep::rendered_grep_match_count(&data), 2);
        data["rendered_matches"] = serde_json::json!(9);
        assert_eq!(super::grep::rendered_grep_match_count(&data), 3);
    }
}

pub fn ast_search_envelope(
    shown: usize,
    total: usize,
    skipped: bool,
) -> crate::list_envelope::ListEnvelope {
    use crate::list_envelope::{ListEnvelope, Total};
    ListEnvelope::new(
        shown,
        if skipped {
            Total::AtLeast(total)
        } else {
            Total::Exact(total)
        },
        Unit::Results,
        vec![Reason::Budget],
        &["paths", "globs", "pattern"],
    )
}

/// Classification of a reason: whether the traversal stopped (`Bounding`)
/// or a selector chose which of an enumerated set to retain (`Selecting`).
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum ReasonKind {
    Bounding,
    Selecting,
}

/// A registered reason on a surface with its kind and the name of the function or constant where the condition is evaluated.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct ReasonEntry {
    pub reason: Reason,
    pub kind: ReasonKind,
    pub predicate_name: &'static str,
}

/// Registry entry for a list-shaped surface.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct SurfaceEntry {
    pub command: &'static str,
    pub mode: &'static str,
    pub list_id: &'static str,
    /// A negotiated route capability required for this surface to exist.
    pub requires: Option<&'static str>,
    pub unit: Unit,
    pub narrow: &'static [&'static str],
    pub reasons: &'static [ReasonEntry],
}

/// Authoritative registry of every list-shaped surface in AFT.
pub static LIST_SURFACES: &[SurfaceEntry] = &[
    SurfaceEntry {
        requires: None,
        command: "callgraph",
        mode: "impact",
        list_id: "payload.sites",
        unit: Unit::Sites,
        narrow: &["depth", "includeTests"],
        reasons: &[
            ReasonEntry {
                reason: Reason::Budget,
                kind: ReasonKind::Bounding,
                predicate_name: "IMPACT_EXPANSION_BUDGET, direct_callers_bounded",
            },
            ReasonEntry {
                reason: Reason::Cap,
                kind: ReasonKind::Selecting,
                predicate_name: "HUB_SUMMARY_LIMIT, impact_result, impact_result_with_budget",
            },
            ReasonEntry {
                reason: Reason::Depth,
                kind: ReasonKind::Bounding,
                predicate_name: "depth_cut_inside_requested, truncated",
            },
        ],
    },
    SurfaceEntry {
        requires: None,
        command: "callgraph",
        mode: "callers",
        list_id: "payload.callers",
        unit: Unit::Items,
        narrow: &["depth", "includeTests"],
        reasons: &[
            ReasonEntry {
                reason: Reason::Cap,
                kind: ReasonKind::Selecting,
                predicate_name: "HUB_SUMMARY_LIMIT, callers_result, test_hidden_summary, included_summary",
            },
            ReasonEntry {
                reason: Reason::Depth,
                kind: ReasonKind::Bounding,
                predicate_name: "depth_cut_inside_requested, truncated",
            },
        ],
    },
    SurfaceEntry {
        requires: None,
        command: "callgraph",
        mode: "callers",
        list_id: "payload.unresolved_callers.sites",
        unit: Unit::Sites,
        narrow: &["includeTests"],
        reasons: &[ReasonEntry {
            reason: Reason::Cap,
            kind: ReasonKind::Selecting,
            predicate_name: "UNRESOLVED_CALLER_SITES_LIMIT, unresolved_call_sites_named: sites.len() < limit",
        }],
    },
    SurfaceEntry {
        requires: None,
        command: "callgraph",
        mode: "call_tree",
        list_id: "payload.tree",
        unit: Unit::Items,
        narrow: &["depth", "includeTests"],
        reasons: &[
            ReasonEntry {
                reason: Reason::Cap,
                kind: ReasonKind::Selecting,
                predicate_name: "HUB_SUMMARY_LIMIT",
            },
            ReasonEntry {
                reason: Reason::Depth,
                kind: ReasonKind::Bounding,
                predicate_name: "depth_cut_inside_requested, truncated",
            },
        ],
    },
    // Note: `trace_to_symbol` was originally grouped with `trace_to` under `payload.paths`,
    // but its reply is a single shortest path with no list semantics
    // (`path: Option<Vec<...>>`), rather than a `paths` list. Truncation envelopes apply
    // only to multi-path lists (`trace_to`).
    SurfaceEntry {
        requires: None,
        command: "callgraph",
        mode: "trace_to",
        list_id: "payload.paths",
        unit: Unit::Paths,
        narrow: &["depth", "includeTests"],
        reasons: &[
            ReasonEntry {
                reason: Reason::Depth,
                kind: ReasonKind::Bounding,
                predicate_name: "trace_to_result, max_depth_reached",
            },
            ReasonEntry {
                reason: Reason::Budget,
                kind: ReasonKind::Bounding,
                predicate_name: "TRACE_TO_EXPANSION_BUDGET, trace_to_result_with_budget, lower_bound_trace_summary",
            },
            ReasonEntry {
                reason: Reason::Cap,
                kind: ReasonKind::Selecting,
                predicate_name: "TRACE_TO_RETAINED_PATH_LIMIT, retain_trace_path, trace_to_symbol_result",
            },
        ],
    },
    SurfaceEntry {
        requires: None,
        command: "callgraph",
        mode: "trace_data",
        list_id: "payload.hops",
        unit: Unit::Hops,
        narrow: &["depth"],
        reasons: &[ReasonEntry {
            reason: Reason::Depth,
            kind: ReasonKind::Bounding,
            predicate_name: "depth_limited",
        }],
    },
    SurfaceEntry {
        requires: None,
        command: "search",
        mode: "",
        list_id: "payload.results",
        unit: Unit::Results,
        narrow: &["offset", "topK", "path", "includeTests"],
        reasons: &[
            ReasonEntry {
                reason: Reason::Walk,
                kind: ReasonKind::Bounding,
                predicate_name: "bounded_walk_search_envelope, fallback_search_envelope, execute_fallback_mode, ExternalFallbackBody, external_fallback_response, external_exact::sweep, walk_truncated",
            },
            ReasonEntry {
                reason: Reason::Depth,
                kind: ReasonKind::Bounding,
                predicate_name: "SearchTrailer::shared_envelope_projection, StopState::S3DepthCap",
            },
            ReasonEntry {
                reason: Reason::Budget,
                kind: ReasonKind::Bounding,
                // The regex route sets engine_capped in rank_collection when its
                // file-count or time bound left candidate files unexamined.
                predicate_name: "engine_capped, rank_collection, read_degraded_grep_file",
            },
            // from_matches is the regex route's per-result line allowance: a
            // file lists its first matching lines and reports the rest in
            // more_in_file and a "+N more in this file" line.
            ReasonEntry {
                reason: Reason::Cap,
                kind: ReasonKind::Selecting,
                predicate_name: "SearchTrailer::shared_envelope_projection, StopState::S1MoreAtDepth, StopState::S2Exhausted, more_available, handle_external_semantic_or_hybrid_search, handle_external_grep_search, handle_semantic_or_hybrid_search, handle_grep_search, from_matches, run_engine_ranking, blast_radius_annotation_for_result, enrich_snippets_from_source_reference, enrich_snippets_from_source_with_context, read_bounded_snippet_line, truncate_chars, split_semantic_results, split_semantic_from_data, handle_split_search, reply",
            },
        ],
    },
    SurfaceEntry {
        requires: None,
        command: "grep",
        mode: "",
        list_id: "payload.matches",
        unit: Unit::Rows,
        narrow: &["offset", "path", "include"],
        reasons: &[
            ReasonEntry {
                reason: Reason::Walk,
                kind: ReasonKind::Bounding,
                predicate_name: "handle_grep, handle_grep_inner, grep_result, grep_result_bytes, walk_truncated, skipped_foreign_mounts",
            },
            ReasonEntry {
                reason: Reason::Cap,
                kind: ReasonKind::Selecting,
                predicate_name: "DEFAULT_MAX_RESULTS, GREP_MAX_OUTPUT_BYTES, MAX_DISPLAY_MATCHES_PER_FILE, FIRST_PAGE_ROWS, FIRST_PAGE_BYTES, FIRST_PAGE_ROUNDS, WHOLE_RESULT_ROWS, WHOLE_RESULT_BYTES, SUMMARY_FILES_LISTED, SUMMARY_FOLDERS_LISTED, handle_grep, handle_grep_inner, format_grep_text, grep_page_output, round_robin_order, files_first_summary, rendered_grep_match_count",
            },
            // Lines in lockfiles, generated and minified files, logs and
            // JSON data files are counted per file instead of printed, unless
            // the call names them; past COUNTED_ENTRIES_LISTED entries the
            // counted-only block folds the rest into one row per kind and
            // marker.
            ReasonEntry {
                reason: Reason::Kind,
                kind: ReasonKind::Selecting,
                predicate_name: "HANDFUL_ROWS, HANDFUL_BYTES, COUNTED_ENTRIES_LISTED, grep_page_output, counted_entries, include_targets",
            },
        ],
    },
    SurfaceEntry {
        requires: Some(crate::protocol::RESULT_FORMAT),
        command: "ast_search",
        mode: "matches",
        list_id: "payload.matches",
        unit: Unit::Results,
        narrow: &["paths", "globs", "pattern"],
        reasons: &[ReasonEntry {
            reason: Reason::Budget,
            kind: ReasonKind::Selecting,
            predicate_name: "MatchBudget",
        }],
    },
    SurfaceEntry {
        requires: None,
        command: "search",
        mode: "",
        list_id: "payload.skipped_files",
        unit: Unit::Files,
        narrow: &["path"],
        reasons: &[ReasonEntry { reason: Reason::Cap, kind: ReasonKind::Selecting, predicate_name: "disclose_large_read_skips" }],
    },
    SurfaceEntry {
        requires: None,
        command: "grep",
        mode: "",
        list_id: "payload.skipped_files",
        unit: Unit::Files,
        narrow: &["path"],
        reasons: &[ReasonEntry { reason: Reason::Cap, kind: ReasonKind::Selecting, predicate_name: "disclose_large_read_skips" }],
    },
    SurfaceEntry {
        requires: None,
        command: "grep",
        mode: "",
        list_id: "payload.ignored_entries",
        unit: Unit::Paths,
        narrow: &["path"],
        reasons: &[
            ReasonEntry { reason: Reason::Walk, kind: ReasonKind::Bounding, predicate_name: "MAX_IGNORE_PROBE_ENTRIES, ignored_entries_in_folder" },
            ReasonEntry { reason: Reason::Cap, kind: ReasonKind::Selecting, predicate_name: "MAX_IGNORED_SCOPE_NAMES, ignored_entries_in_folder" },
        ],
    },
    SurfaceEntry {
        requires: None,
        command: "glob",
        mode: "",
        list_id: "payload.files",
        unit: Unit::Files,
        narrow: &["path"],
        reasons: &[
            ReasonEntry {
                reason: Reason::TimeLimit,
                kind: ReasonKind::Bounding,
                predicate_name: "walk_time_limit_reached, walk_files_unbounded, bounded_fallback_walk_files_with_limits_target",
            },
            // glob_from_view answers from the data layer's checkout listing,
            // which never walks, so it reports walk_truncated false and no
            // skipped mounts; a directory missing from the listing is handed
            // to fallback_glob, whose walk can stop early.
            ReasonEntry {
                reason: Reason::Walk,
                kind: ReasonKind::Bounding,
                predicate_name: "GlobDiscovery, handle_glob, handle_glob_inner, fallback_glob, glob_root, glob_from_view, discover_glob_root, named_ignored_glob_walk_stops_at_cap_and_deadline, walk_truncated, skipped_foreign_mounts",
            },
            ReasonEntry {
                reason: Reason::Cap,
                kind: ReasonKind::Selecting,
                predicate_name: "DEFAULT_MAX_RESULTS, MAX_DIRECTORY_SECTIONS, MAX_DISPLAY_DIRECTORIES, MAX_DISPLAY_FILES_PER_DIRECTORY, handle_glob, handle_glob_inner, format_glob_text, format_glob_output, format_glob_selected, rendered_glob_file_count",
            },
        ],
    },
    SurfaceEntry {
        requires: None,
        command: "outline",
        mode: "files",
        list_id: "payload.files",
        unit: Unit::Files,
        narrow: &["path"],
        reasons: &[
            ReasonEntry {
                reason: Reason::TimeLimit,
                kind: ReasonKind::Bounding,
                predicate_name: "outline_batch_deadline_reached, stop_at_deadline, take_back_last_file, build_outline_structure_envelope",
            },
            ReasonEntry {
                reason: Reason::Budget,
                kind: ReasonKind::Selecting,
                predicate_name: "MAX_OUTPUT_BYTES, discover_outline_files, handle_outline_files_mode, MultiFileTreeWriter, requested_outline_files, budget_rollups_present",
            },
            ReasonEntry {
                reason: Reason::Walk,
                kind: ReasonKind::Bounding,
                predicate_name: "OutlineFileDiscovery, discover_outline_files_with_options, discover_outline_files_unbounded, collect_outline_files_with_device_lookup, collect_outline_files_breadth_first_with_device_lookup, outline_walk_skips_and_reports_injected_foreign_mount, ITERATIONS, collection_truncated, walk_truncated, skipped_foreign_mounts",
            },
        ],
    },
    SurfaceEntry {
        requires: None,
        command: "read",
        mode: "directory",
        list_id: "payload.entries",
        unit: Unit::Items,
        narrow: &["path", "offset", "limit"],
        reasons: &[
            ReasonEntry {
                reason: Reason::Walk,
                kind: ReasonKind::Bounding,
                predicate_name: "handle_directory",
            },
            ReasonEntry {
                reason: Reason::Cap,
                kind: ReasonKind::Selecting,
                predicate_name: "handle_directory",
            },
        ],
    },
    SurfaceEntry {
        requires: None,
        command: "inspect",
        mode: "",
        list_id: "payload.details",
        unit: Unit::Items,
        narrow: &["topK", "scope", "sections"],
        reasons: &[ReasonEntry {
            reason: Reason::Cap,
            kind: ReasonKind::Selecting,
            predicate_name: "details_for, generated_details_for, test_only_details_for, uncovered_files_details_for, topk_limiting, write_skipped_files, filter_payload_for_scope, SKIPPED_FILES_LIMIT, attach_complexity_size_skips",
        }],
    },
    SurfaceEntry {
        requires: None,
        command: "bash",
        mode: "",
        list_id: "bash.output",
        unit: Unit::Lines,
        narrow: &[],
        reasons: &[ReasonEntry {
            reason: Reason::Cap,
            kind: ReasonKind::Selecting,
            predicate_name: "cap_lines, compress_json, finish, middle_truncate, append_hunk, cap_git_lines, compress_add, compress_blame, compress_diff, flush_status_entries, looks_like_golangci_json, finish_folded, first_error_lines, truncate_line, parse_tree, compress_tsc, frozen_compress_tsc, compressor_line_dropping, render_cut, cap_lines_head_tail, cap_text_head_tail, apply_plain_cap_streaming, test_verdict, cap_test_verdict, bounded_failure_sections",
        }],
    },
    SurfaceEntry { requires: None, command: "bash", mode: "changed_files", list_id: "bash.changed_files", unit: Unit::Files, narrow: &[], reasons: &[ReasonEntry { reason: Reason::Cap, kind: ReasonKind::Selecting, predicate_name: "render" }, ReasonEntry { reason: Reason::TimeLimit, kind: ReasonKind::Bounding, predicate_name: "render" }] },
    SurfaceEntry { requires: None, command: "bash", mode: "diff_lines", list_id: "bash.diff_lines", unit: Unit::Lines, narrow: &[], reasons: &[ReasonEntry { reason: Reason::Cap, kind: ReasonKind::Selecting, predicate_name: "diff_file" }] },
];

/// An entry in the discovery exclusions table with written justification.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct ExclusionEntry {
    pub file: &'static str,
    pub enclosing_item: &'static str,
    pub location_or_primitive: &'static str,
    pub reason: &'static str,
}

/// Exclusions from the registry-free discovery scan with non-empty written reasons.
pub static EXCLUSIONS: &[ExclusionEntry] = &[
    ExclusionEntry {
        file: "access_policy/linked_worktree.rs",
        enclosing_item: "nearest_common_dir, read_pointer",
        location_or_primitive: "MAX_ANCESTORS, MAX_POINTER_BYTES",
        reason: "Repository identity checks bound traversal and pointer reads; neither returns a partial tool result.",
    },
    ExclusionEntry {
        file: "commands/edit_match.rs",
        enclosing_item: "handle_single_file_edit_match",
        location_or_primitive: "take(AMBIGUOUS_OCCURRENCE_LIST_LIMIT)",
        reason: "An ambiguous edit is a refusal, not a result list: its structured occurrence rows stop at the same eight the error message lists, and the message states the exact match count and how many more were not listed.",
    },
    ExclusionEntry {
        file: "commands/batch.rs",
        enclosing_item: "resolve_edit_with_offsets",
        location_or_primitive: "take(AMBIGUOUS_OCCURRENCE_LIST_LIMIT)",
        reason: "An ambiguous batch edit is a refusal, not a result list: its structured occurrence rows stop at the same eight the error message lists, and the message states the exact match count and how many more were not listed.",
    },
    ExclusionEntry {
        file: "subc/rich_ui/display/bash_tail.rs",
        enclosing_item: "from_streams",
        location_or_primitive: "MAX_LINES, MAX_CHARS, .take(MAX_LINES)",
        reason: "The optional tool-display completion preview uses the shared text_lines limits; the command output and its list envelope are unchanged.",
    },
    ExclusionEntry {
        file: "context/checkout_suggestion.rs",
        enclosing_item: "unique_indexed_checkout_suffix",
        location_or_primitive: "MAX_PATHS, MAX_COMPONENTS",
        reason: "Missing-path correction refuses recovery when the complete indexed inventory or requested path exceeds its work budget; it never returns a suggestion based on a truncated candidate list.",
    },
    ExclusionEntry {
        file: "subc/scope_describe.rs",
        enclosing_item: "CompletedEnds::insert",
        location_or_primitive: "COMPLETED_END_CAP, pop_front",
        reason: "Internal completed-end notification deduplication evicts oldest stamps at capacity or after ten minutes; a later duplicate can repeat an idempotent cleanup notice but cannot truncate a tool result or kill an ended task again.",
    },
    ExclusionEntry {
        file: "late_result_bus.rs",
        enclosing_item: "scan,replay,read_batch,capacity,due,deliver",
        location_or_primitive: "SCAN_BATCH (64), LATE_RESULTS_PAGE_MAX, UNACKED_RESULTS_MAX, SQL LIMIT",
        reason: "internal bus wakes use index-seeked settlement batches and startup-only custodian feed pages; the retry set stops cursor advancement at the existing feed retention cap, leaving overflow durable in the ledger rather than shortening a command result list",
    },
    #[cfg(feature = "callgraph-shape-census")]
    ExclusionEntry {
        file: "data_layer/shape_census.rs",
        enclosing_item: "top_callers",
        location_or_primitive: "truncate(10)",
        reason: "Opt-in measurement export of the ten highest exact caller counts, not an agent-facing list.",
    },
    ExclusionEntry {
        file: "exec_remote/read_only_note.rs",
        enclosing_item: "source_read_only_note",
        location_or_primitive: ".take(1_000)",
        reason: "Internal permission-error scan stops after 1,000 matching lines to select one explanatory note; it never truncates the command output or returns a result list.",
    },
    ExclusionEntry {
        file: "gh_shim_speech/service.rs",
        enclosing_item: "log_no_binding_row_refusal",
        location_or_primitive: "UNCONFIGURED_BINDING_LOG_CAP, cap, clear",
        reason: "Internal INFO-log deduplication history is cleared at capacity; older agents may log again, but refusals and agent-visible result lists are unchanged.",
    },
    ExclusionEntry {
        file: "subc/consent.rs",
        enclosing_item: "DirectoryScopeProbes::note_fallback",
        location_or_primitive: "DIRECTORY_SCOPE_MISSING_LOG_CAP, clear",
        reason: "Internal vanished-directory INFO-log history is cleared at capacity; older scopes may log again, without changing the original file grant or any agent-visible result list.",
    },
    ExclusionEntry {
        file: "checkpoint.rs",
        enclosing_item: "status_count, STATUS_DIRECTORY_ENTRIES, STATUS_MANIFEST_BYTES, STATUS_BLOB_CHECKS",
        location_or_primitive: "bounded status observation",
        reason: "The checkpoint status reader caps directory entries, metadata bytes and blob validations; exhaustion returns unknown, never a truncated count or result list. Authoritative list and mutations retain full recovery semantics.",
    },
    ExclusionEntry {
        file: "github_read/threads.rs",
        enclosing_item: "fetch_review_threads",
        location_or_primitive: "MAX_THREAD_PAGES, MAX_EXTRA_COMMENT_PAGES",
        reason: "GitHub read renders a canonical document rather than a ListEnvelope; bounded thread and comment-ID pagination discloses omitted counts, marks partial thread totals, and leaves unmatched comments' thread state unknown.",
    },
    ExclusionEntry {
        file: "parser/todo_markers.rs",
        enclosing_item: "markers_lexical",
        location_or_primitive: ".take(MAX_LINES_PER_FILE)",
        reason: "Bounds per-file lexical comment scanning when producing stored TODO marker facts; it is not response pagination.",
    },
    ExclusionEntry {
        file: "parser/todo_markers.rs",
        enclosing_item: "truncate_text",
        location_or_primitive: ".take(MAX_TEXT_CHARS)",
        reason: "Bounds the text of one TODO marker in its stored content record, not the number of findings returned by inspect.",
    },
    ExclusionEntry {
        file: "parser/dead_code_facts.rs",
        enclosing_item: "collect_rust_macro_token_refs,Step",
        location_or_primitive: "scope_stack.truncate(scope_len)",
        reason: "Restores the syntax walk's lexical scope after leaving a node; it does not cut findings or stored references.",
    },
    ExclusionEntry {
        file: "parent_search/mod.rs",
        enclosing_item: "discover,walk,note_outside,DEFAULT_MAX_CHILD_REPOS,MAX_DISCOVERY_DEPTH,MAX_DISCOVERY_ENTRIES,MAX_OUTSIDE_PATHS",
        location_or_primitive: "bounded parent repository discovery and split_off(cap)",
        reason: "Parent discovery bounds filesystem work and the served child set. Repositories past the child cap remain in Discovery.skipped and queries disclose them as parent_children_over_cap gaps; outside paths are bounded discovery diagnostics, not a paged result list.",
    },
    ExclusionEntry {
        file: "commands/data_search.rs",
        enclosing_item: "lexical_rank_at_depth",
        location_or_primitive: ".take(depth), truncate(depth)",
        reason: "Internal lexical candidate pool at the engine's requested depth; final search pagination and completeness are reported by the search result envelope, not this intermediate pool.",
    },
    ExclusionEntry {
        file: "commands/data_search.rs",
        enclosing_item: "rarest",
        location_or_primitive: ".take(3)",
        reason: "Selects three trigram keys to plan an index lookup, not files or findings in an agent-visible list.",
    },
    ExclusionEntry {
        file: "commands/parent_query/engine.rs",
        enclosing_item: "search_with_disclosure",
        location_or_primitive: ".take()",
        reason: "Option::take transfers the embedding model between the parent and child search contexts; it does not cut a list.",
    },
    ExclusionEntry {
        file: "gh_shim_speech/start_view/sweep.rs",
        enclosing_item: "sweep_entries",
        location_or_primitive: "MAX_ENTRIES, MAX_PASS, max_entries, deadline",
        reason: "Internal crash-file housekeeping bounds directory iteration per detached pass, retaining its iterator for continuation; it never truncates an agent-visible result list.",
    },
    ExclusionEntry {
        file: "search_state/memo.rs",
        enclosing_item: "DigestProofCache::insert",
        location_or_primitive: "MAX_DIGEST_PROOF_BYTES",
        reason: "Internal verified-content proof retention budget; eviction or bypass always falls back to reading and hashing the complete served page, never truncates search candidates or output.",
    },
    ExclusionEntry {
        file: "subc/rich_ui/records.rs",
        enclosing_item: "cut_detail",
        location_or_primitive: "canonical byte limit, files.pop, UTF-8 stream prefix, hunks.pop, lines.pop",
        reason: "tool-display/v1 details use their own truncated/omittedItems/omittedBytes envelope, measured on RFC 8785 bytes, rather than the model-facing ListEnvelope.",
    },
    ExclusionEntry {
        file: "subc/rich_ui/display/edit_hunks.rs",
        enclosing_item: "Hunks::push, Hunks::charge, line_prefix",
        location_or_primitive: "MAX_HUNKS, MAX_LINES, MAX_LINE_BYTES, DIFF_RESPONSE_BUDGET",
        reason: "Edit detail uses the tool-display truncation flag and serves the prefix retained for the Diff component; this does not limit the edit result.",
    },
    ExclusionEntry {
        file: "subc/rich_ui/outbox.rs",
        enclosing_item: "admit, retry, pop_due, ReadCache::insert, ReadCache::prune",
        location_or_primitive: "MAX_CALLS, MAX_BYTES, EXPIRY, attempts",
        reason: "Optional display delivery quotas bound pending snapshots and retries, never a tool's result list or execution.",
    },
    ExclusionEntry {
        file: "subc/rich_ui/outbox/reads.rs",
        enclosing_item: "ReadCache::insert, ReadCache::prune",
        location_or_primitive: "MAX_CALLS, MAX_BYTES, MIN_READ_WINDOW, EXPIRY",
        reason: "Process-local display pull copies have bounded count, bytes and retention; early pressure eviction is counted in bus health and missing records return the protocol's unknown refusal, not a truncated tool result.",
    },
    ExclusionEntry {
        file: "subc/rich_ui/display.rs",
        enclosing_item: "register",
        location_or_primitive: "calls.len() >= 64",
        reason: "Optional in-flight display capture admission is bounded independently of command execution; a rejected display capture never truncates the tool reply.",
    },
    ExclusionEntry {
        file: "semantic_index.rs",
        enclosing_item: "format_skipped_chunks_summary",
        location_or_primitive: ".take(5)",
        reason: "Diagnostic preview of refused-input paths; skipped chunks and omitted file counts are disclosed alongside the first five paths.",
    },
    ExclusionEntry {
        file: "db/call_ledger.rs",
        enclosing_item: "late_results_for_consumer",
        location_or_primitive: "LATE_RESULTS_PAGE_MAX (256), SQL LIMIT cap + 1, take(cap), max_body",
        reason: "tool-provider protocol feed pagination uses entries, cursor and more, not an AFT ListEnvelope; the existing 256-entry limit and encoded reply-byte bound retain continuation through the shared cursor",
    },
    ExclusionEntry {
        file: "db/display_records.rs",
        enclosing_item: "sweep, persist",
        location_or_primitive: "SWEEP_LIMIT, SQL LIMIT, MAX_RECORDS, MAX_BYTES",
        reason: "Durable display pull retention bounds housekeeping pages and stored output, not a tool result list; protected capacity defers wakes without truncating or evicting promised records.",
    },
    ExclusionEntry {
        file: "db/access_grants.rs",
        enclosing_item: "saved_scope_batch",
        location_or_primitive: "SQL LIMIT, PER_TICK (4)",
        reason: "Keyset pagination bounds background lifecycle probes, not permissions.list; every live grant remains listed and later maintenance ticks continue after the saved cursor.",
    },
    ExclusionEntry {
        file: "db/codemode_owners.rs",
        enclosing_item: "save",
        location_or_primitive: "MAX_ROWS (4,096), SQL LIMIT/OFFSET",
        reason: "Eviction bounds the optional local route identity cache, not a list returned by a tool.",
    },
    ExclusionEntry {
        file: "subc/consent_expiry.rs",
        enclosing_item: "candidates, Sweep::run",
        location_or_primitive: "SQL LIMIT, ROW_LIMIT (32)",
        reason: "Pagination bounds background withdrawal of idle file approvals. Later sweeps continue at the saved cursor; no tool returns this list.",
    },
    ExclusionEntry {
        file: "subc/scope_watch.rs",
        enclosing_item: "reconcile",
        location_or_primitive: "SELECTORS_PER_WATCH (256), WATCHES_PER_CONNECTION (16)",
        reason: "Daemon subscription limits partition internal lifecycle selectors; excess scopes retain polling coverage and are counted in health, never dropped from a tool result or from lifecycle monitoring.",
    },
    ExclusionEntry {
        file: "subc/held_task_recovery.rs",
        enclosing_item: "sessions",
        location_or_primitive: "RECOVERY_CHUNK (64), SQL LIMIT, keyset pagination",
        reason: "Internal startup recovery exhausts every candidate source in index-seeking pages; the chunk bounds one shared database mutex hold, not an agent-visible result list.",
    },
    ExclusionEntry {
        file: "subc/shells/runtime.rs",
        enclosing_item: "list, project_row, output",
        location_or_primitive: "PAGE_SIZE, 2048, DEFAULT_CHUNK_BYTES, take_while",
        reason: "The operator-only shells/v1 wire protocol uses next_cursor for 50-row pages, command_truncated for command previews, and raw offset/end_offset for bounded output chunks; no agent-visible list is shortened.",
    },
    ExclusionEntry {
        file: "subc/shells/runtime.rs",
        enclosing_item: "read_root_agents",
        location_or_primitive: "SQL LIMIT, ROOT_ASSOCIATION_LIMIT (256), lookahead (257)",
        reason: "Operator sidebar root-agent hints have one shared 256-association budget. A bounded SQL iterator reads one lookahead row; agent_ids_truncated marks that root and any later roots whose association lists were not fully visited. Shell rows and their holder resolution remain complete.",
    },
    ExclusionEntry {
        file: "subc/shells/state.rs",
        enclosing_item: "push, resync",
        location_or_primitive: "HISTORY, PAGE_SIZE",
        reason: "The provider journal has finite cursor retention; an expired position triggers a full resync. Split resync parts deliver every matching row and are applied only at final:true.",
    },
    ExclusionEntry {
        file: "subc/shells/output.rs",
        enclosing_item: "next, plan, backfill_start",
        location_or_primitive: "max, budget, BACKFILL_BYTES",
        reason: "Shell output is a byte-addressed subscription, not an agent list: backfill cuts are explicit in truncated_before, subsequent chunks preserve raw offset/end_offset, and oversized escapes are omitted without losing raw byte accounting.",
    },
    ExclusionEntry {
        file: "subc/shells/wire.rs",
        enclosing_item: "PAGE_SIZE, RETENTION_MS, DEFAULT_CHUNK_BYTES, MAX_CHUNK_BYTES, BACKFILL_BYTES",
        location_or_primitive: "shells/v1 protocol constants",
        reason: "Operator-only wire limits use explicit continuation cursors, resync parts and raw byte offsets; they do not bound or change any agent tool reply.",
    },
    ExclusionEntry {
        file: "subc/shells/capture.rs",
        enclosing_item: "open, read, read_screen",
        location_or_primitive: "DEFAULT_CHUNK_BYTES, max, take_while, 500 ms",
        reason: "Capture reads and incremental screen rendering have bounded working memory and preserve raw offset coverage. Screen coalescing limits update rate, not the shell inventory or any agent-visible list.",
    },
    ExclusionEntry {
        file: "bash_background/shell_registry.rs",
        enclosing_item: "shell_masked_range, format_context_possible, SHELL_MASK_CONTEXT_BYTES",
        location_or_primitive: "bounded file scan and masking context",
        reason: "Internal masking windows preserve raw byte coverage; undecidable ranges carry explicit withheld text. These bounds neither drop shell rows nor shorten an agent-visible list.",
    },
    ExclusionEntry {
        file: "bash_background/completion_preview.rs",
        enclosing_item: "shell_mask_window_with_values, watch_mask_region, mask_region_from",
        location_or_primitive: "take(range.start), line_limit",
        reason: "Masking inspects a byte-addressed context rather than returning a result list. Operator output uses bounded source windows with explicit withheld ranges; existing agent watch-preview limits remain unchanged.",
    },
    ExclusionEntry {
        file: "log_redact.rs",
        enclosing_item: "shells_ticket_range, SHELL_TICKET_RANGE_BYTES, replace_in",
        location_or_primitive: "4 KiB ticket masking windows; take_while common prefix and suffix",
        reason: "Every requested byte remains covered while ticket masking uses bounded overlapping source windows. This cap limits masking work per window, not rows, tool results or streamed raw offset coverage.",
    },
    ExclusionEntry {
        file: "db/call_ledger.rs",
        enclosing_item: "enforce_retention_bounds",
        location_or_primitive: "UNACKED_RESULTS_MAX (1000), EXPIRED_ENTRIES_MAX (1000), SQL OFFSET",
        reason: "durable protocol retention quotas bound stored terminal answers and non-terminal update payloads rather than shortening a command result list; acknowledged updates keep deduplication keys until their admitted call is removed",
    },
    ExclusionEntry {
        file: "bash_background/remote.rs",
        enclosing_item: "admission_progress_detail",
        location_or_primitive: "MAX_DETAIL_CHARS character preview",
        reason: "pre-acceptance progress detail is one display string, not a result list; its redacted text is ellipsized at a Unicode character boundary without omitting any task or output records",
    },
    ExclusionEntry {
        file: "subc/rich_ui/bash_output.rs",
        enclosing_item: "page, stream_items",
        location_or_primitive: "limit, PAGE_BYTES, ITEM_BYTES",
        reason: "Resumable cursor pages split output losslessly by byte limits instead of dropping result items.",
    },
    ExclusionEntry {
        file: "bash_background/viewed_task.rs",
        enclosing_item: "resolve",
        location_or_primitive: "SQL LIMIT 2",
        reason: "The LIMIT 2 uniqueness probe detects ambiguous task keys and never returns a list.",
    },
    ExclusionEntry {
        file: "commands/read.rs",
        enclosing_item: "fit_github_images, process_image_fitting",
        location_or_primitive: "remaining image byte budget, MAX_IMAGE_FIT_STEPS",
        reason: "binary image sidecars are a bounded multimodal supplement, not pageable result records; omitted attachments are disclosed in read text with an exact count and source links, while local images shrink to a fixed floor or refuse explicitly",
    },
    ExclusionEntry {
        file: "bash_permissions/scan.rs",
        enclosing_item: "top_level_directory_targets, MAX_CWD_PATHS, insert",
        location_or_primitive: "MAX_CWD_PATHS",
        reason: "internal cwd analysis retains at most eight folder/mode states per exit-status branch; exceeding that bound makes the folder unknown rather than removing alternatives, and no response list is shortened",
    },
    ExclusionEntry {
        file: "task_watch_lines.rs",
        enclosing_item: "LineDelivery",
        location_or_primitive: "MAX_LINES_PER_NOTIFICATION, MAX_NOTIFICATIONS_PER_MINUTE, MAX_LINE_BYTES",
        reason: "Async push notifications are not command-response lists. LineBatch reports exact cap drops and the source stream/byte offset; oversized lines explicitly mark scanning incomplete.",
    },
    ExclusionEntry {
        file: "standalone_input.rs",
        enclosing_item: "read_bounded_line, room, push",
        location_or_primitive: "MAX_LINE_BYTES / MAX_RETAINED_BYTES / MAX_RETAINED_ITEMS / MAX_HELD_BYTES / MAX_HELD_ITEMS",
        reason: "transport admission and allocation bounds, not result-list cuts; oversized frames and excess held requests receive explicit errors, retained input keeps its budget charge across queue moves",
    },
    ExclusionEntry {
        file: "cli/sandbox_launch/landlock_backend.rs",
        enclosing_item: "session_task_read_paths",
        location_or_primitive: "tasks.truncate(MAX_SESSION_READ_TASKS)",
        reason: "internal Landlock read-grant snapshot; tasks beyond the 500-entry budget stay unreadable without a broader grant, not an agent-visible list",
    },
    ExclusionEntry {
        file: "gh_shim.rs",
        enclosing_item: "summarize_bypass_audit",
        location_or_primitive: "BYPASS_AUDIT_RECENT_LIMIT (10), VecDeque::pop_front",
        reason: "gh --status audit preview, not an AFT tool result list; bypass_audit_count discloses the exact total and --status --audit returns the full audit",
    },
    ExclusionEntry {
        file: "gh_shim/read_contract.rs",
        enclosing_item: "validate, validate_path",
        location_or_primitive: "MAX_REPLY_BYTES job ranges and per_page <= 100",
        reason: "closed GitHub read wire validation refuses oversized ranges and page sizes; it does not truncate an AFT result list",
    },
    ExclusionEntry {
        file: "gh_shim/read_executor.rs",
        enclosing_item: "decode_reply",
        location_or_primitive: "REPLY_BYTES payload ceiling and returned byte range validation",
        reason: "the GitHub read wire refuses oversized or malformed replies rather than silently cutting a response list",
    },
    ExclusionEntry {
        file: "gh_shim/read_render.rs",
        enclosing_item: "checked, fetch, stream_log",
        location_or_primitive: "REPLY_BYTES and bounded JobLog byte windows",
        reason: "governed read transport bound, not an AFT list surface; oversized replies refuse and complete logs stream through all byte windows",
    },
    ExclusionEntry {
        file: "gh_shim/read_render.rs",
        enclosing_item: "list, search, native",
        location_or_primitive: "per_page caps of 100 (10 for Actions runs), adaptive page-size retries, items.iter().take(remaining), items.iter().take(plan.limit() - rows.len()) and native gh --limit selection",
        reason: "REST API paging and gh-compatible explicit output limits, not an AFT tool result list; over-return is a fetch error",
    },
    ExclusionEntry {
        file: "gh_shim/worker_reads.rs",
        enclosing_item: "limit, search_query",
        location_or_primitive: "native gh defaults and 1000-result search ceiling",
        reason: "gh-compatible CLI output limits and GitHub search refusal, not an AFT list surface",
    },
    ExclusionEntry {
        file: "lsp/manager.rs",
        enclosing_item: "walk_applicable_area_uncached",
        location_or_primitive: "visited >= entry_limit",
        reason: "internal applicability discovery, not a response list; exhausting the iterator budget returns an explicit incomplete-walk error instead of certifying a partial server set",
    },
    ExclusionEntry {
        file: "runtime_drain.rs",
        enclosing_item: "collect_mutation_paths",
        location_or_primitive: "budget.exhausted()",
        reason: "bounded internal mutation-index discovery, not a response list; ignored directories are pruned, examined counts are logged, and unfinished work schedules a background corpus replacement with the index marked not ready",
    },
    ExclusionEntry {
        file: "backup.rs",
        enclosing_item: "discovery_limits, merge_disk_stack_heads, run_operation_discard",
        location_or_primitive: "MAX_SESSION_DISCOVERY_ENTRIES, examined >= entry_limit, BackupIoBudget::check, ROLLBACK_CLEANUP_ALLOWANCE",
        reason: "internal durable undo-stack discovery stops at its entry or deadline budget and returns an error, never a partial path list or false no-history result; operation-scoped rollback stops before advancing its path iterator when the independent cleanup allowance expires, queues the remaining paths for retry, and logs one deferred-path count; per-file undo avoids the session scan",
    },
    ExclusionEntry {
        file: "status_inventory.rs",
        enclosing_item: "discover_into",
        location_or_primitive: "examined >= limits.entry_limit, BackupIoBudget::check",
        reason: "the shared durable undo-stack discovery pass (also behind status-push tracked-file counts) stops at its entry or deadline budget and returns an error, never a partial path list; the status count then falls back to resident keys exactly as tracked_files does",
    },
    ExclusionEntry {
        file: "runtime_drain.rs",
        enclosing_item: "drop",
        location_or_primitive: "budget.exhausted()",
        reason: "bounded internal mutation-index refresh, not a response list; refreshed counts are logged and budget exhaustion schedules one background corpus replacement instead of certifying stale search answers as complete",
    },
    ExclusionEntry {
        file: "commands/configure.rs",
        enclosing_item: "join_storage_sweep_worker",
        location_or_primitive: "Option .take()",
        reason: "test-only handoff of the held storage sweep worker's join handle out of its gate, not a list",
    },
    ExclusionEntry {
        file: "commands/url_resolution.rs",
        enclosing_item: "drop",
        location_or_primitive: "with_secret_fetch_for_test::Restore::drop self.0.take(), self.1.take()",
        reason: "Option::take restores the previous test fetch vault and options when the scoped helper exits; neither call cuts a list",
    },
    ExclusionEntry {
        file: "commands/configure.rs",
        enclosing_item: "view_working_tree_refresh_path",
        location_or_primitive: "max_examined .take()",
        reason: "startup verification of persisted view bytes, not a result list; reaching the iterator budget schedules a full background publication and refuses stale graph answers rather than treating partial verification as complete",
    },
    ExclusionEntry {
        file: "commands/configure.rs",
        enclosing_item: "view_git_changed_paths",
        location_or_primitive: "max_examined .take()",
        reason: "bounded startup dirty-path discovery, not a result list; truncated subprocess output or reaching the iterator budget forces full view publication rather than certifying the checkout as clean",
    },
    ExclusionEntry {
        file: "context.rs",
        enclosing_item: "should_emit",
        location_or_primitive: "256-entry status-bar session history / pop_front",
        reason: "bounded deduplication bookkeeping, not a result list; evicting an idle session only repeats its next bar and never suppresses a changed value",
    },
    ExclusionEntry {
        file: "lsp/manager.rs",
        enclosing_item: "remember",
        location_or_primitive: "WATCHED_LIFECYCLE_CAP / oldest pop_first",
        reason: "per-server watched-file echo bookkeeping, not a result list; eviction can only forward a duplicate lifecycle event, never hide a file change",
    },
    ExclusionEntry {
        file: "edit.rs",
        enclosing_item: "drop, notify_full_validation_start",
        location_or_primitive: "FULL_VALIDATION_START_HOOK Option::take",
        reason: "consumes or clears a test-only callback; Option::take removes one optional value, not entries from an agent-visible list",
    },
    ExclusionEntry {
        file: "edit.rs",
        enclosing_item: "foreign_group",
        location_or_primitive: "groups.truncate(count.max(0) as usize)",
        reason: "test helper shrinking a getgroups buffer to the count the OS returned; group ids for a fixture, never an agent-visible list",
    },
    ExclusionEntry {
        file: "edit.rs",
        enclosing_item: "read_sized",
        location_or_primitive: "buffer.truncate(read_size as usize)",
        reason: "shrinks a byte buffer to the size the OS reported for an extended-attribute name list or value; raw metadata copied to the replacement file, never an agent-visible list",
    },
    ExclusionEntry {
        file: "edit.rs",
        enclosing_item: "REFORMATTED_EXCERPT_MAX_LINES, REFORMATTED_EXCERPT_MAX_BYTES, compute_reformatted_excerpt, excerpt_caps_bound_owned_line_construction",
        location_or_primitive: "REFORMATTED_EXCERPT_MAX_",
        reason: "bounds an inline post-format source excerpt, not a paginated list; oversized excerpts retain the existing extensive marker instead of returning partial source text",
    },
    ExclusionEntry {
        file: "subc_format.rs",
        enclosing_item: "format_ast_search_capture",
        location_or_primitive: "AST_CAPTURE_INLINE_CHAR_LIMIT .chars().take()",
        reason: "long or multiline AST capture values are referenced by their line range in the matched excerpt with an ellipsized first-line character preview; no match or capture entries are omitted, and the complete values remain in the structured response",
    },
    ExclusionEntry {
        file: "subc_format.rs",
        enclosing_item: "append_zoom_annotation_calls",
        location_or_primitive: "ZOOM_CALL_ANNOTATION_LIMIT .take()",
        reason: "aft_zoom displays at most 15 file-local call references per annotation section and counts omitted references with +N more; all annotation entries remain in the structured response",
    },
    ExclusionEntry {
        file: "bash_background/registry.rs",
        enclosing_item: "format_background_slot_refusal",
        location_or_primitive: "SLOT_REFUSAL_MAX_ROWS / SLOT_REFUSAL_COMMAND_CHARS .take()",
        reason: "a background-launch error previews at most eight of the caller's slot holders, counts omitted own holders and other sessions' holders, and shortens command labels with an ellipsis; this is actionable refusal context, not a paginated task-result list",
    },
    ExclusionEntry {
        file: "bash_background/registry.rs",
        enclosing_item: "kill_survivors_line",
        location_or_primitive: "KILL_SURVIVORS_NAMED .take()",
        reason: "the one-line kill-survivor notice names the first three surviving processes and counts the rest with +N more; every listed survivor stays in the structured live_descendants field",
    },
    ExclusionEntry {
        file: "bash_background/process.rs",
        enclosing_item: "bounded_members, safe_name, macos_argv, capped_identities",
        location_or_primitive: "LIVE_DESCENDANT_CAP .take(), LIVE_DESCENDANT_NAME_CAP .take(), MAX_ARGS, GROUP_IDENTITY_CAP .take()",
        reason: "a process-group check keeps at most 16 members and reports the exact omitted count in live_descendants_omitted; each member's name is shortened with an ellipsis and its arguments are never kept; the record keeps at most 1,024 member identities for recognising the group later and flags when more were found; this is task status detail, not a paginated result list",
    },
    ExclusionEntry {
        file: "subc/consent.rs",
        enclosing_item: "scope_reason_path",
        location_or_primitive: "160-character reason limit, middle path-component elision, repository basename chars().take()",
        reason: "consent-card display text, not a tool result list; the approved sentence stays intact while its path shows home as ~, keeps the repository basename before ancestor components, and visibly middle-elides a basename only when it alone cannot fit; the request path, scope pattern and stored grant retain the full path",
    },
    ExclusionEntry {
        file: "subc/health.rs",
        enclosing_item: "budget_health_metrics_with_limits, fit_health_metrics, group_health_roots, trim_health_root_groups, reduce_health_root_details, gap_largest_ancillary_health_field, compact_health_lsp_preview, enforce_health_hard_limit, abbreviate_health_root, abbreviated_health_path, abbreviated_health_refusal, build_health_diagnostic_rollup_from_actors",
        location_or_primitive: "HEALTH_PROJECT_BUDGET_BYTES, HEALTH_ROOT_GROUP_EXAMPLES truncate, example pop and preview removal, healthy root detail cap and removal, default root counter removal, abnormal root reduction with largest-only overflow prefix, LSP preview clear, cache/root path and free-text caps, storage_retention map removal, v2_family_sweeps and data_store_failed pop, named telemetry gaps under HEALTH_METRICS_BUDGET_BYTES, root and optional gap-id pop under project and reply ceilings",
        reason: "management health detail, not an agent result list; process telemetry is budgeted independently first, project detail receives at most half the metrics budget and only the remainder; repeated normal statuses always keep count and status, with exact examples_omitted, root_details_omitted and root_detail_gap.summarized counts; failed or stalled roots stay individual, most severe first; project cuts report root_detail_gap; abnormal reductions preserve failure facts and count root_details_reduced; current watcher loss keeps its overflow total and largest prefix; LSP fleet totals survive preview removal; identities that fit the project ceiling are not shortened by process pressure; long identities use full digests and bounded free text names the bytes cut; other oversized telemetry becomes a named gap with its original byte size",
    },
    ExclusionEntry {
        file: "subc/health.rs",
        enclosing_item: "health_lsp_metrics",
        location_or_primitive: "HEALTH_LSP_APPLICABILITY_ROOT_CAP .take()",
        reason: "health-only LSP cost preview, not a paginated result list; six roots ordered by full-walk time then misses are rendered with bounded digest-backed paths; applicability totals cover all roots with exact total and omitted counts, while the cached census and explicit status keep all roots",
    },
    ExclusionEntry {
        file: "lsp/child_registry.rs",
        enclosing_item: "health_for_children",
        location_or_primitive: "LSP_CHILD_ROOT_DETAIL_CAP / split_off before child-row construction",
        reason: "LSP child health telemetry bounds roots before rendering per-kind rows; exact omitted-root, child-count and RSS totals cover every omitted root, not a paginated tool result list",
    },
    ExclusionEntry {
        file: "subc/route_census.rs",
        enclosing_item: "snapshot, ScopeDescriptions::record",
        location_or_primitive: "ROOT_LIMIT, ROUTE_LIMIT, PRINCIPAL_LIMIT, DESCRIPTION_LIMIT",
        reason: "management-only ownership diagnostics, not an agent result list; root and per-root route details and principal groups have exact omitted counts while summary counts include omitted rows; the latest-result scope cache is bounded and reports evictions, with absent observations remaining unknown",
    },
    ExclusionEntry {
        file: "gc/family.rs",
        enclosing_item: "SweepStatsStore::update",
        location_or_primitive: "SWEEP_STATS_FAMILY_LIMIT / pop_front",
        reason: "observational health telemetry retains the latest 64 family details, not a paginated result list; cap evictions and retired-family removals are disclosed separately",
    },
    ExclusionEntry {
        file: "status_push.rs",
        enclosing_item: "project",
        location_or_primitive: "REFUSAL_DETAILS .take()",
        reason: "root-owned status notification detail, not an agent result list; exact refusal totals, omitted and unattributed counts remain present with an explicit status read pointer",
    },
    ExclusionEntry {
        file: "status_push.rs",
        enclosing_item: "bounded_body, scalar, summary",
        location_or_primitive: "BODY_MAX_BYTES count-only wire summary and bounded scalar strings",
        reason: "status notifications are not paginated results; deterministic compact summaries retain consumer scalar state and exact list/refusal totals with an explicit status read pointer",
    },
    ExclusionEntry {
        file: "subc/push.rs",
        enclosing_item: "drain_turn",
        location_or_primitive: "STATUS_FANOUT_TURN_BYTES",
        reason: "per-root status wire scheduling budget; remaining route deliveries retain the latest state and resume on later turns without omitting recipients",
    },
    ExclusionEntry {
        file: "bash_background/registry.rs",
        enclosing_item: "cleanup_finished_at_with, gc_harness_stores",
        location_or_primitive: "GC_ENTRY_BUDGET maintenance queue and namespace iterator",
        reason: "internal housekeeping advances bounded round-robin queues and resumable directory iterators; retained work is revisited on later passes, not truncated from an agent-visible list",
    },
    ExclusionEntry {
        file: "sandbox_spawn/task_temp.rs",
        enclosing_item: "sweep_stale",
        location_or_primitive: "SWEEP_BUDGET directory iterator advancement",
        reason: "internal crash cleanup resumes the same iterator on later task launches; the budget bounds maintenance work and does not cut an agent-visible list",
    },
    ExclusionEntry {
        file: "bash_background/gc_cursor.rs",
        enclosing_item: "next_batch",
        location_or_primitive: "GC_ENTRY_BUDGET directory iterator advancement",
        reason: "internal persisted-task and quarantine retention scans resume the same iterator next pass; the cap bounds inspection work, not returned records",
    },
    ExclusionEntry {
        file: "bash_background/gc_memo.rs",
        enclosing_item: "due_batches",
        location_or_primitive: "GC_ENTRY_BUDGET ordered deadline iterator advancement",
        reason: "internal retention candidates beyond the budget remain indexed for the next maintenance request; no agent-visible records are truncated",
    },
    ExclusionEntry {
        file: "search_state/memo.rs",
        enclosing_item: "make_room_for, store_literal_presence, prune_lifecycle",
        location_or_primitive: "MAX_EXACT_MEMO_BYTES, MAX_LITERAL_PRESENCE_BYTES, MAX_RETIRED_POISONED_BYTES and obsolete-generation cache retirement",
        reason: "internal reconstructible cache ownership only; complete verified results still feed ranking and oversized entries are served without retention, while evicted literal-presence answers are recomputed; no agent-visible result is cut",
    },
    ExclusionEntry {
        file: "commands/semantic_search/data_file.rs",
        enclosing_item: "is_data_file_after_metadata",
        location_or_primitive: "io::Read::take(DATA_FILE_MIN_BYTES)",
        reason: "classification needs only the size threshold or a long line in a smaller file; reaching the byte threshold classifies the file as data, without cutting a result list",
    },
    ExclusionEntry {
        file: "search_state/memo.rs",
        enclosing_item: "digest_open_file_at_size",
        location_or_primitive: "io::Read::take(size)",
        reason: "small and streamed digests both stop at the descriptor's size at open; growth changes the stat and is re-digested by the next lookup, not silently accepted as a complete current-file hash",
    },
    ExclusionEntry {
        file: "search_state/request_files.rs",
        enclosing_item: "read_whole_file_at",
        location_or_primitive: "io::Read::take(stat.size)",
        reason: "reads the descriptor's size at open; files above the whole-read ceiling are separately disclosed as skipped, not silently cut from a result list",
    },
    ExclusionEntry {
        file: "bash_background/remote.rs",
        enclosing_item: "append_executor_environment_disclosure",
        location_or_primitive: "executor environment name preview min(10)",
        reason: "supplemental execution note names at most ten filtered environment variables and explicitly counts the rest with +N more; the complete executor report remains in persisted task metadata, not a paginated tool-result list",
    },
    ExclusionEntry {
        file: "bash_background/remote.rs",
        enclosing_item: "render_terminal_report",
        location_or_primitive: "workspace changes preview PATH_LIMIT and folder summary GROUP_LIMIT",
        reason: "supplemental remote execution report names at most twenty paths and summarizes the remainder in at most five folder groups with exact counts; the complete list remains in the build server's terminal record, not a paginated tool-result list",
    },
    ExclusionEntry {
        file: "subc/bind_log.rs",
        location_or_primitive: "consumer_capabilities preview (eight-entry slice cap)",
        reason: "Bounds RouteBind INFO logging only; does not cut a product result list.",
        enclosing_item: "consumer_capabilities",
    },
    ExclusionEntry {
        file: "subc/held_task_recovery.rs",
        enclosing_item: "recover",
        location_or_primitive: "missing root log preview (five examples)",
        reason: "Bounds an INFO log preview only; the total count is logged and no product result list is cut.",
    },
    ExclusionEntry {
        file: "large_read.rs",
        enclosing_item: "summarize_health_sites",
        location_or_primitive: "top-site health preview truncate(4)",
        reason: "Bounds supplemental health telemetry only; count, bytes, largest, whole_count, whole_bytes and sites_active still aggregate every active site, so the preview does not cut a tool result list.",
    },
    ExclusionEntry {
        file: "url_fetch.rs",
        enclosing_item: "hash_url",
        location_or_primitive: "URL cache hash prefix",
        reason: "cache filename derivation takes a fixed digest prefix, not a truncation of agent-visible text or records",
    },
    ExclusionEntry {
        file: "commands/url_output.rs",
        enclosing_item: "cap_text",
        location_or_primitive: "URL rendered text byte ceiling",
        reason: "remote document previews use an explicit truncated-at-N-of-M-bytes footer with URL and symbol narrowing advice; this is a byte cut, not a paginated list of records",
    },
    ExclusionEntry {
        file: "edit.rs",
        enclosing_item: "render_diff, separator, write_str, finish",
        location_or_primitive: "shared optional diff response byte budget",
        reason: "optional diff text is omitted as a whole with an explicit notice when its byte allowance is exceeded; every file outcome and line count remains, so this does not cut a result list",
    },
    ExclusionEntry {
        file: "file_read_exact.rs",
        enclosing_item: "bounded_bytes",
        location_or_primitive: "exact binary read byte ceiling",
        reason: "the module operation refuses oversized files after at most one lookahead byte; no truncated list or partial file is returned",
    },
    ExclusionEntry {
        file: "subc/perf_sweep.rs",
        enclosing_item: "parse_log",
        location_or_primitive: "bounded log iterator and take(8) metric previews",
        reason: "flow-only telemetry stops at byte or line caps and reports truncated plus scanned counts; top tool and WARN previews disclose tools_total and warn_shapes_total, not a paginated agent list",
    },
    ExclusionEntry {
        file: "subc/diagnostics_findings.rs",
        enclosing_item: "bounded_body",
        location_or_primitive: "truncate(5) samples and size >= BODY_LIMIT response trimming",
        reason: "diagnostics.findings v1 is a bounded diagnosis snapshot, not a paginated ledger; samples are removed first, then tail findings, and retained counts are unchanged as required by the vendored contract",
    },
    ExclusionEntry {
        file: "subc/perf_sweep.rs",
        enclosing_item: "summarize_profile, child_output, ChildCapture::drain",
        location_or_primitive: "top eight threads, first stack, leaf frame and child-output ceilings",
        reason: "flow-only profile summary preserves the sweep script's preview limits with threads_total; bounded child stdout is refused as a named gap rather than returned partially, and a marked bounded stderr tail preserves the failure cause",
    },
    ExclusionEntry {
        file: "url_fetch.rs",
        enclosing_item: "read_response_body, read_response_body_with, download_to_cache, fetch_with_secrets",
        location_or_primitive: "URL download byte ceiling and UTF-8 prefix repair",
        reason: "the producer stops after a bounded prefix and one lookahead byte; cached metadata discloses the cut with the known size or an explicit lower bound, separately from the rendered output ceiling",
    },
    ExclusionEntry {
        file: "tool_output.rs",
        enclosing_item: "cap_with_scope, cap_read, notice_suffix, render_cut, render_cut_with_data, read, cleanup_expired, SCAN_ENTRIES, save_failed_trailer",
        location_or_primitive: "rendered reply and saved artifact byte bounds",
        reason: "a transport-independent text byte budget, not a list surface; preserves list envelopes and saves the uncut reply in a session-private file with a recovery trailer; read instead reclaims whole source lines for its native paging footer and notices without saving a copy; failure reasons have a bounded UTF-8 prefix, artifact reads have a separate 64 MiB allocation guard, and retention cleanup resumes each bounded directory scan",
    },
    ExclusionEntry {
        file: "output_store.rs",
        enclosing_item: "read, cleanup_expired, SCAN_ENTRIES",
        location_or_primitive: "saved tool result storage bounds",
        reason: "Saved-file byte limits and bounded artifact cleanup do not truncate response lists.",
    },
    ExclusionEntry {
        file: "hashline/snapshot/mod.rs",
        enclosing_item: "read_body_limit, render_tagged_snapshot_with_options, render_tagless_snapshot_with_options",
        location_or_primitive: "hashline read byte budget with reserved finalization headroom",
        reason: "a source-text byte ceiling, not a result list; elision is decided before publishing exactly the rendered seen-line set, and the existing footer names unaddressable lines; finalization preserves published rows and spends reserved headroom on notices",
    },
    ExclusionEntry {
        file: "commands/bash_watch.rs",
        enclosing_item: "output_tail",
        location_or_primitive: "worker watch tail byte and line preview",
        reason: "a recent-output prose preview, not a result list; limits bytes as well as lines so a single huge log line cannot bypass the preview budget; full task output remains on disk",
    },
    ExclusionEntry {
        file: "subc/scope_background_tasks.rs",
        enclosing_item: "scan_saved, scan_sessions, next_entry, expected_roots, registry_snapshot",
        location_or_primitive: "WALK_LIMIT",
        reason: "owner-only management snapshot, not an agent result list; complete false with a reason discloses every bounded or failed walk",
    },
    ExclusionEntry {
        file: "bash_background/scoped_tasks.rs",
        enclosing_item: "running",
        location_or_primitive: "COMMAND_BYTES",
        reason: "a command preview, not a result list; command_truncated identifies the UTF-8 byte ceiling",
    },
    ExclusionEntry {
        file: "bash_background/runner_notice_scheduler.rs",
        enclosing_item: "offer_follow",
        location_or_primitive: "QUEUE_CAPACITY",
        reason: "an internal delivery queue bound, not a limit on results returned to an agent",
    },
    ExclusionEntry {
        file: "subc/bash_notice_text.rs",
        enclosing_item: "long_running",
        location_or_primitive: "120 UTF-16 code-unit command preview",
        reason: "a command text preview rather than a result list; preserves the existing OpenCode reminder formatter, including its ellipsis and full-command inspection guidance",
    },
    ExclusionEntry {
        file: "db/runner_harness_keys.rs",
        enclosing_item: "copy_aliases_with_limit, lookup_alias",
        location_or_primitive: "SOURCE_LIMIT and SQL LIMIT",
        reason: "startup value migration bounds source rows before copying and skips an oversized batch atomically; fallback reads select one authoritative row by identical key and deterministic recency, not an agent result list; originals remain available for rollback",
    },
    ExclusionEntry {
        file: "bash_background/registry.rs",
        enclosing_item: "try_scope_background_tasks",
        location_or_primitive: "remaining iterator budget",
        reason: "scope.background_tasks shares its bounded scan budget with saved records and returns complete false on exhaustion, never a complete empty done-gate snapshot",
    },
    ExclusionEntry {
        file: "commands/bash_watch/restart.rs",
        enclosing_item: "watch_unknown",
        location_or_primitive: "watch_unknown state.held.take() and state.wait.take()",
        reason: "Option::take consuming the held-call identity and its wait before settling an unknown result; no list is cut",
    },
    ExclusionEntry {
        file: "cold_build_limiter/progress.rs",
        enclosing_item: "snapshot",
        location_or_primitive: "take(LIST_CAP)",
        reason: "management health telemetry, not an agent list; running and queued are bounded at their iterators and disclose exact omitted counts",
    },
    ExclusionEntry {
        file: "github_read/fetch.rs",
        enclosing_item: "read_capped",
        location_or_primitive: "bounded gh subprocess reader",
        reason: "bounds stdout and stderr at the iterator; diff fetch ceilings are disclosed independently of line paging, and metadata ceilings refuse the fetch",
    },
    ExclusionEntry {
        file: "github_read/diff.rs",
        enclosing_item: "fetch_diff, page",
        location_or_primitive: "PR diff diagnostic paths and line window",
        reason: "diagnostic changed-path previews and sequential diff line pages integrate their list envelope trailers into content through the authorized NDJSON text builder",
    },
    ExclusionEntry {
        file: "grep_executor.rs",
        enclosing_item: "diagnose_scope_counts, diagnose_scope_counts_unbounded, bounded_fallback_walk_files_with_limits_target, walk_files_unbounded, walk_each_file_unbounded",
        location_or_primitive: "MAX_FALLBACK_WALK_FILES / FALLBACK_WALK_BUDGET",
        reason: "bounded filesystem fallback and empty-scope exclusion probe; ignored directories are pruned and counted once, and an exhausted probe reports unknown/incomplete rather than claiming an empty filesystem",
    },
    ExclusionEntry {
        file: "inspect/diagnostics_category.rs",
        enclosing_item: "ScopeWalkBudget, scoped_coverage_candidates_with_budget",
        location_or_primitive: "200_000 entry limit and scoped walk deadline",
        reason: "internal scoped-file inventory, not a paginated findings list; budget rejection is retained separately from iterator exhaustion and adds an analysis_incomplete gap with unknown diagnostic totals",
    },
    ExclusionEntry {
        file: "commands/inspect.rs",
        enclosing_item: "scoped_in_root_file_count, build_inspect_payload_with_offset",
        location_or_primitive: "ScopeWalkBudget scoped file count",
        reason: "internal corpus census, not a paginated findings list; an incomplete walk reports a named gap, marks scope_files_complete false, and renders the count as a lower bound",
    },
    ExclusionEntry {
        file: "cache_location/markers.rs",
        enclosing_item: "sweep_all_read_markers_pinned, sweep_marker_generation, read_marker_protection, marker_file_is_protected",
        location_or_primitive: "shared repair traversal budget and read-marker byte limit",
        reason: "internal marker liveness and cleanup, not result lists; incomplete or oversized marker reads protect the cache rather than authorize deletion",
    },
    ExclusionEntry {
        file: "pinned_dir.rs",
        enclosing_item: "RepairBudget, DirectoryEntries, unix_entries, unix_names, repair_names, directory_identities, collect_directory_identities, repair_measure, repair_remove_contents, windows_repair_names, repair_descendant, repair_validate_descendants",
        location_or_primitive: "repair traversal depth, entry and deadline bounds",
        reason: "internal cache repair and retention walks, not result lists; an incomplete identity census or inventory refuses deletion and interrupted removal reports partial progress",
    },
    ExclusionEntry {
        file: "crates/aft-store/src/family/disk.rs",
        enclosing_item: "Scan::open_dir, Scan::next_entry",
        location_or_primitive: "shared entry cap and deadline across manifest discovery and leftover file measurement",
        reason: "internal index store disk accounting, not a result list; a stopped scan keeps bytes, examined entries and the stop reason and withholds the total from status",
    },
    ExclusionEntry {
        file: "views/callgraph_copies.rs",
        enclosing_item: "evict_for",
        location_or_primitive: "EVICTION_CANDIDATES and five-second deadline",
        reason: "internal database admission maintenance, not result lists; exhausted eviction work makes the checkout borrow the main graph",
    },
    ExclusionEntry {
        file: "views/tree_base.rs",
        enclosing_item: "identity_for_admission, prove_until",
        location_or_primitive: "optional admission deadline in member proof and membership identity loops",
        reason: "internal reuse proof, not result lists; an expired proof cannot establish base reuse or authorize deletion",
    },
    ExclusionEntry {
        file: "views/base_builder.rs",
        enclosing_item: "claim_base_locked",
        location_or_primitive: "LIVE_BASES_PER_FAMILY",
        reason: "internal base admission count, not result lists; held capacity borrows a published graph or keeps text on its planned retry path",
    },
    ExclusionEntry {
        file: "storage_retention.rs",
        enclosing_item: "evict_least_recent_v3_member, reclaim_v3_admission_family",
        location_or_primitive: "SQL LIMIT and take(max_examined), 64-removal loop and five-second admission deadline",
        reason: "internal LRU database reclamation, not result lists; every deletion rechecks references and live holds and insufficient reclaim preserves the device-space refusal",
    },
    ExclusionEntry {
        file: "gh_shim/ticket_repository.rs",
        enclosing_item: "Cache::insert",
        location_or_primitive: "MAX_ROOTS",
        reason: "internal repository snapshot LRU, not a result list; eviction recomputes the binding from Git on the next ticket rather than omitting a repository",
    },
    ExclusionEntry {
        file: "cache_location.rs",
        enclosing_item: "candidates_and_durable, candidates_and_durable_with_budget, deletion_protections, deletion_protections_with_budget, retention_protections_with_budget, ensure_cache_idle",
        location_or_primitive: "RepairBudget",
        reason: "internal cleanup preflight, not result lists; exhausting the traversal budget refuses all deletion rather than accepting incomplete protection or lock inventories",
    },
    ExclusionEntry {
        file: "storage_retention.rs",
        enclosing_item: "bounded_dirs, traversal_batch_filtered, next_batch, sweep_view_generations, v3_view_domains, generation_registries, report_generation_registry_error, validate_tree, validate_tree_with_admission, validate_tree_observed, TreeObservation::unchanged, report_candidate_error, DueBatch::flush, PreparedDue::refuse, candidate_inner, reap_trash, reap_trash_with_snapshot_budget, reap_trash_with_cursor, trash_scans, reap_retired_with_budget, due_first, orphan_first, run_pass_with_budget, prune_bindings, retirement_members, retirement_members_with_budget, write_retirement_witness, verify_retirement_witness, collect_v3_idle, collect_v3_family_at, report_v3_idle_unknown, root_history, drain_due_views",
        location_or_primitive: "DUE_FIRST_ENTRIES, PASS_ENTRIES, TREE_ENTRIES, HISTORY_ENTRIES, TRASH_SCAN_HANDLES, reaper deadline and 10ms mount-snapshot admission budget, 64-view generation batch, 16 diagnostic errors or incomplete reasons per list, take, v3 idle SQL LIMIT 1 and member/deadline window, HISTORY_ENTRIES root-history census chunks and four immediate census followups",
        reason: "internal disk-maintenance walks, not tool-result lists; bounded lexical batches persist only processed names, retained-tree metadata probes honor the repair budget, TRASH_SCAN_HANDLES counts active iterators rather than completed refusal memos, incomplete protection snapshots refuse deletion, root-history iterators resume until a directory-stable census completes, and health separates real errors from incomplete work while reporting census examined/accumulated/restarted/complete alongside remaining views, trash estimates and kept reasons",
    },
    ExclusionEntry {
        file: "views/registry.rs",
        enclosing_item: "members_bounded, read_members_limited",
        location_or_primitive: "SQL LIMIT",
        reason: "internal family membership census, not an agent-visible list; an incomplete membership snapshot aborts background marking rather than deleting unmarked content",
    },
    ExclusionEntry {
        file: "views/assembly_seed.rs",
        enclosing_item: "worktree_roots, read_worktree_child, read_worktree_roots",
        location_or_primitive: "take(MAX_BYTES + 1), take(65_536), MAX_WORKTREES",
        reason: "optional sibling donor discovery bounds Git topology bytes, records and worktrees at their iterators; an incomplete or malformed enumeration disables reuse rather than claiming a freshest donor",
    },
    ExclusionEntry {
        file: "views/derived_index.rs",
        enclosing_item: "candidates, record",
        location_or_primitive: "SQL LIMIT CANDIDATES_PER_KIND, LIMIT RETAINED_ROWS",
        reason: "internal donor hints for derived-database seeding, not an agent-visible list; a candidate outside the bound or a trimmed row only means a seedless publication falls back to the worktree census or a cold build",
    },
    ExclusionEntry {
        file: "views/generation.rs",
        enclosing_item: "generation_directory_entries, bounded_directory_entries, blob_references_by_generation, generation_sweep_registry, has_superseded_artifacts, sweep_generations_bounded, claim_generation, reap_generation_trash, remove_generation_files",
        location_or_primitive: "take(limit.saturating_add(1)), truncate(limit), take(GENERATION_DIRECTORY_LIMIT), MAX_CLAIM_FILES atomic retirement batch",
        reason: "internal generation/protection enumeration; ownership or blob-mark overflow aborts before deletion, an oversized directory is cleaned one bounded window per pass that keeps any generation whose derived-owner reference it cannot see, and an incomplete temporary-file deletion pass only leaves garbage for a later pass",
    },
    ExclusionEntry {
        file: "views/reference_sidecar.rs",
        enclosing_item: "free_slots",
        location_or_primitive: "take(limit.saturating_add(1))",
        reason: "internal count of view-directory entries, taken once per blob scan or publication, that bounds how many reference sidecars may be added; counting stops just past the limit because only the free slots below it matter, and a skipped sidecar only means blob GC decodes that manifest",
    },
    ExclusionEntry {
        file: "gc/mod.rs",
        enclosing_item: "sweep_bounded, mark_live_assembly_pins, sweep_plane",
        location_or_primitive: "take(8193), take(4097), LIMIT 4096",
        reason: "internal mark-and-sweep budgets; incomplete marks refuse deletion and a SQL keyset cursor resumes bounded deletion; row/deletion counts and compaction deferrals are reported",
    },
    ExclusionEntry {
        file: "root_cache.rs",
        enclosing_item: "read_marker_protection",
        location_or_primitive: "take(4097)",
        reason: "internal reader-protection census; an unread marker or iterator overflow is protected, never permission to unlink a generation",
    },
    ExclusionEntry {
        file: "callgraph_store/mod.rs",
        enclosing_item: "gc_old_generations",
        location_or_primitive: "take(4096)",
        reason: "internal generation deletion batch, not a query result list; the current pointer and protected readers are checked independently for every candidate",
    },
    ExclusionEntry {
        file: "lsp/completed_rust_check.rs",
        enclosing_item: "sweep_records",
        location_or_primitive: "RECORD_SCAN_LIMIT, MAX_RECORDS",
        reason: "background disk-cache maintenance, not an agent-visible list; the scan counts directory entries inside the iterator loop and logs examined, removed and completion counts; a bounded scan refuses a new record until it can certify the 64-record cap",
    },
    ExclusionEntry {
        file: "subc/tool_provider.rs",
        enclosing_item: "uncertain_settlement_frame",
        location_or_primitive: "SETTLEMENT_RESULT_EXCERPT_BYTES",
        reason: "bounded diagnostic byte excerpt of an already formatted terminal, not a result-list cutoff; original_result_truncated explicitly discloses omitted bytes and no replay guarantee is claimed",
    },
    ExclusionEntry {
        file: "logging.rs",
        enclosing_item: "write_str",
        location_or_primitive: "PANIC_MESSAGE_BYTES, PANIC_BACKTRACE_BYTES",
        reason: "panic diagnostics bound formatted text, not a tool-result list; message and stack have separate byte budgets and an explicit truncation marker",
    },
    ExclusionEntry {
        file: "bash_db_hints/mod.rs",
        enclosing_item: "table_list, render, run_probe",
        location_or_primitive: "BLOCK_CAP, PROBE_OUTPUT_CAP",
        reason: "supplemental read-only schema trailer, not a paginated bash output list; omitted tables or schemas are explicitly counted, and an over-cap probe is discarded and counted as an error",
    },
    ExclusionEntry {
        file: "agent_child_env.rs",
        enclosing_item: "refresh_legacy_git_hooks_until",
        location_or_primitive: "legacy hook directory and file byte take",
        reason: "internal cache-maintenance enumeration and input-byte safety bounds, not an agent-visible list; the iterator caps new verification work, preserves verified progress on a bounded scan, and logs examined and rewritten counts plus whether its scan was bounded",
    },
    // The views-on semantic gap note names its first few missing files in the
    // response text; every missing file is listed in the JSON `semantic_gap`
    // field, and the text says how many more there are.
    ExclusionEntry {
        file: "commands/semantic_search/mod.rs",
        enclosing_item: "disclose",
        location_or_primitive: "semantic gap note take",
        reason: "summary line naming the first few files a views-on semantic answer is missing, with its own '(+N more)' count; the full list is in the semantic_gap JSON field",
    },
    // The unanalyzed-macro note on `callers` is one summary line, not a list
    // the agent pages through: it states how many mentions exist (or that the
    // count is a lower bound) and says how many of them it spells out.
    ExclusionEntry {
        file: "data_layer/callgraph_store_adapter.rs",
        enclosing_item: "unanalyzed_macro_note",
        location_or_primitive: "macro note site truncate",
        reason: "summary line under the callers list that carries its own count and 'shown N of M' wording; the callers list itself keeps its envelope",
    },
    ExclusionEntry {
        file: "callgraph_store/mod.rs",
        enclosing_item: "unresolved_call_site_count_filtered",
        location_or_primitive: "UNRESOLVED_CALL_SITE_COUNT_LIMIT, SQL LIMIT",
        reason: "bounded count for callers and impact incompleteness notes, including nonempty answers with matching unresolved names, not a list cut; the note says 'at least N' at the limit and the callers and impact lists retain their own truncation metadata",
    },
    // The borrowed-graph coverage note on callgraph answers is one summary
    // line: it names the first few files the borrowed graph does not reflect
    // and says how many more there are.
    ExclusionEntry {
        file: "commands/callgraph_borrowed.rs",
        enclosing_item: "sample",
        location_or_primitive: "coverage note file sample take",
        reason: "summary line naming the first few files a borrowed callgraph does not reflect, with its own 'and N more' count; the counts are in the borrowed_coverage JSON field and the answer's own list keeps its envelope",
    },
    // The lexical lane's depth tiers are engine-internal cuts over a candidate
    // pool (D_k = 200..3200); the agent never sees this list. The only cut an
    // agent sees is the search surface's topK, which carries the envelope.
    ExclusionEntry {
        file: "commands/semantic_search/lexical_lane.rs",
        enclosing_item: "from_scored_candidates",
        location_or_primitive: "depth-tier truncate",
        reason: "engine-internal lexical depth tier over the candidate pool; not an agent-visible list, the search surface attaches the envelope",
    },
    ExclusionEntry {
        file: "commands/semantic_search/lexical_lane.rs",
        enclosing_item: "enumerate_to_depth",
        location_or_primitive: "depth-tier take",
        reason: "engine-internal lexical depth tier over the candidate pool; not an agent-visible list, the search surface attaches the envelope",
    },
    ExclusionEntry {
        file: "commands/semantic_search/lexical_lane.rs",
        enclosing_item: "score_complete_selected_pool",
        location_or_primitive: "depth-tier take",
        reason: "engine-internal lexical depth tier over the candidate pool; not an agent-visible list, the search surface attaches the envelope",
    },
    // The block builder's page cut and the depth-tier observation are engine
    // cuts inside the search engine; the page the agent sees is the search
    // surface's, which attaches the envelope and the paging trailer.
    ExclusionEntry {
        file: "commands/semantic_search/blocks.rs",
        enclosing_item: "build",
        location_or_primitive: "page take",
        reason: "engine-internal page cut over the frozen block list; the search surface attaches the envelope and paging trailer",
    },
    ExclusionEntry {
        file: "commands/semantic_search/blocks.rs",
        enclosing_item: "observe_through_depth",
        location_or_primitive: "depth-tier take",
        reason: "engine-internal depth-tier observation over lane candidates; not an agent-visible list",
    },
    ExclusionEntry {
        file: "commands/semantic_search/paging.rs",
        enclosing_item: "build_l",
        location_or_primitive: "interval take",
        reason: "engine-internal interval cut when building L over frozen blocks; the served page's envelope and paging trailer are the search surface's",
    },
    ExclusionEntry {
        file: "commands/semantic_search/rerank/mod.rs",
        enclosing_item: "rerank_head",
        location_or_primitive: "page take",
        reason: "re-cuts the served page from the reranked canonical list with the same offset and topK as the block builder; the search surface computes the envelope and paging trailer from that page afterwards",
    },
    ExclusionEntry {
        file: "commands/semantic_search/rerank/mod.rs",
        enclosing_item: "rerank_positions",
        location_or_primitive: "rerank candidate take",
        reason: "selects which first-block entries a reranker may reorder (at most the configured rerank top_n); nothing is dropped from the list, so the served page and its paging trailer are unchanged in length",
    },
    ExclusionEntry {
        file: "commands/semantic_search/rerank/pool_export.rs",
        enclosing_item: "entries",
        location_or_primitive: "benchmark pool export take",
        reason: "benchmark-only export, written only when AFT_RERANK_POOL_EXPORT is set, of a fixed number of first-block candidates to a file; it is never part of a tool response",
    },
    ExclusionEntry {
        file: "commands/semantic_search/rerank/tests.rs",
        enclosing_item: "onnx_cost_profile_when_available",
        location_or_primitive: "test candidate text truncate",
        reason: "test-only cost profile that trims each candidate's text to a byte budget before timing the local reranker; no tool response is produced",
    },
    ExclusionEntry {
        file: "commands/semantic_search/exact_lane.rs",
        enclosing_item: "copied_worktree_exact_fallback_reproduction",
        location_or_primitive: "test walk-list truncate",
        reason: "ignored manual reproduction test that replays the former 1,000-file fallback walk cap to compare it with the current walk; no tool response is produced",
    },
    ExclusionEntry {
        file: "commands/glob.rs",
        enclosing_item: "exact_file_glob_with_ready_index_matches_basename_without_widening_scope, exact_file_glob_fallback_matches_basename_without_widening_scope",
        location_or_primitive: "test walk_truncated assertions",
        reason: "test-only assertions on walk_truncated for indexed and fallback exact-file discovery; they do not cut a list or produce a tool response",
    },
    // Checkpoint and restore results name their first files and then say how
    // many more there are; the checkpoint itself always covers every file.
    ExclusionEntry {
        file: "subc_format.rs",
        enclosing_item: "checkpoint_path_lines",
        location_or_primitive: "checkpoint path lines take",
        reason: "summary of a checkpoint or restore result naming its first few files with its own '… and N more' count; the operation covers every file and no paging applies",
    },
    ExclusionEntry {
        file: "commands/bash_status.rs",
        enclosing_item: "handle",
        location_or_primitive: "bash_status / bash live-tail",
        reason: "bash live-tail (bash_status polling) output is shown raw by design and carries no truncation envelope",
    },
    ExclusionEntry {
        file: "bash_background/registry.rs",
        enclosing_item: "read_artifact_page",
        location_or_primitive: "ARTIFACT_PAGE_BYTES",
        reason: "raw artifact transport is paged in bytes, not output lines or list records; callers continue at the actual returned byte offset and has_more discloses a captured backlog rather than claiming exhaustion",
    },
    ExclusionEntry {
        file: "commands/bash_status.rs",
        enclosing_item: "read_status_artifact_page",
        location_or_primitive: "ARTIFACT_PAGE_BYTES",
        reason: "store-unavailable status reads use the same bounded byte pages as registered tasks; next_offset and has_more describe the remaining artifact rather than a list truncation envelope",
    },
    ExclusionEntry {
        file: "commands/status.rs",
        enclosing_item: "handle",
        location_or_primitive: "summary count arrays",
        reason: "summary counts and census count arrays are totals by construction and carry no truncation envelope",
    },
    ExclusionEntry {
        file: "commands/delete_file.rs",
        enclosing_item: "MAX_PATHS",
        location_or_primitive: "commands::delete_file::MAX_PATHS",
        reason: "error message preview of offending non-regular file paths is diagnostic formatting, not a returned list payload",
    },
    ExclusionEntry {
        file: "commands/outline.rs",
        enclosing_item: "render_top_level_entries",
        location_or_primitive: "type member preview take",
        reason: "a type API preview with an exact '(N more)' count; single-file outlines list every product member, and the outer file budget carries the list trailer",
    },
    ExclusionEntry {
        file: "commands/outline.rs",
        enclosing_item: "inspect_outline_file_content",
        location_or_primitive: "bounded line-count byte reader",
        reason: "caps bytes inspected for a file's line-count statistic; the file remains in the outline with an unknown line count, so no agent-visible list items are removed",
    },
    ExclusionEntry {
        file: "commands/outline.rs",
        enclosing_item: "files_walk_stall_keeps_examined_paths_and_named_gap",
        location_or_primitive: "collection_truncated regression assertion",
        reason: "a test observes incomplete discovery; the assertion does not cut an agent-visible list",
    },
    ExclusionEntry {
        file: "commands/read.rs",
        enclosing_item: "handle_streaming_range_read",
        location_or_primitive: "bounded streamed line window",
        reason: "limits bytes retained while reading a selected text line; truncated content and scan gaps are disclosed by the read response, not a cut to a list of files or result records",
    },
    ExclusionEntry {
        file: "commands/lsp_diagnostics.rs",
        enclosing_item: "build_response, compute_unchecked_files, handle_directory_mode",
        location_or_primitive: "commands::lsp_diagnostics::DIRECTORY_FILE_CAP",
        reason: "internal diagnostics scanner file resolution cap is an engine boundary, not a returned list",
    },
    ExclusionEntry {
        file: "watcher_filter.rs",
        enclosing_item: "derive_exclusion_plan, refresh_touched",
        location_or_primitive: "WATCHER_EXCLUSION_LIMIT kernel exclusion slots",
        reason: "internal watcher exclusion budget, not an agent-visible result list; paths without a kernel exclusion slot remain rejected at the walk boundary",
    },
    ExclusionEntry {
        file: "shell_format.rs",
        enclosing_item: "format_seconds",
        location_or_primitive: "shell_format::seconds.truncate",
        reason: "string manipulation trimming timestamp representation, not a list truncation",
    },
    ExclusionEntry {
        file: "commands/zoom.rs",
        enclosing_item: "suggest_close_symbols",
        location_or_primitive: "commands::zoom::resolve_zoom_symbol candidate suggestion",
        reason: "did-you-mean candidate suggestion trimming for invalid symbol error messages",
    },
    ExclusionEntry {
        file: "commands/grep.rs",
        enclosing_item: "truncate_line_text",
        location_or_primitive: "commands::grep::truncate_line_text",
        reason: "line text preview truncation, not a list truncation",
    },
    ExclusionEntry {
        file: "commands/semantic_search/mod.rs",
        enclosing_item: "collect_degraded_grep_files, empty_degraded_grep_fallback_names_missing_semantic_coverage, execute_degraded_grep_fallback, handle_external_bounded_lexical_fallback, semantic_unavailable_grep_fallback_response",
        location_or_primitive: "commands::semantic_search degraded grep fallback status",
        reason: "internal fallback search status notes and degraded grep walk markers",
    },
    ExclusionEntry {
        file: "subc_format.rs",
        enclosing_item: "unresolved_summary_text",
        location_or_primitive: "subc_format::UNRESOLVED_SUMMARY_NAME_LIMIT",
        reason: "unresolved call site summary line preview names formatting",
    },
    ExclusionEntry {
        file: "subc_format.rs",
        enclosing_item: "format_outline_files_text",
        location_or_primitive: "subc_format::MAX_UNCHECKED_FILES_IN_FOOTER",
        reason: "legacy unchecked files list in outline text footer",
    },
    ExclusionEntry {
        file: "subc_format.rs",
        enclosing_item: "structure_outline_trailer_stays_last_after_skips",
        location_or_primitive: "walk_truncated",
        reason: "test-only response fixture proving that an integrated structure-map trailer remains last after skipped-file diagnostics; production outline walk and budget cuts are registered on the outline surface",
    },
    ExclusionEntry {
        file: "subc_format.rs",
        enclosing_item: "directory_outline_preserves_walk_truncation_footer, files_outline_uses_the_counting_walk_limit_in_partial_footer",
        location_or_primitive: "subc_format walk truncation footer tests",
        reason: "test assertions verifying legacy walk truncation footer",
    },
    ExclusionEntry {
        file: "commands/trace_to_symbol.rs",
        enclosing_item: "handle_trace_to_symbol",
        location_or_primitive: "commands::trace_to_symbol::handle_trace_to_symbol",
        reason: "trace_to_symbol reply is a single shortest path (path: Option<Vec<...>>) with no list semantics, so it carries no truncation envelope",
    },
    ExclusionEntry {
        file: "response_finalize.rs",
        enclosing_item: "drop",
        location_or_primitive: "response_finalize::DeferredWakeGuard drop self.0.take()",
        reason: "Option::take restoring the previous deferred-completion wake when a guard drops; no list is cut",
    },
    ExclusionEntry {
        file: "commands/configure.rs",
        enclosing_item: "schedule_artifact_loads_admitted",
        location_or_primitive: "commands::configure::schedule_artifact_loads_admitted warm_permit.take()",
        reason: "Option::take releasing a warm-reload permit before a cold-build acquire; no list is cut",
    },
    ExclusionEntry {
        file: "search_index.rs",
        enclosing_item: "git_diff_within_path_limit",
        location_or_primitive: "WARM_GIT_DIFF_PATH_LIMIT",
        reason: "bounds the union of warm Git-diff and disk-stale paths; over-limit refreshes are rejected before content reads and configure falls back to a full cold rebuild, so no agent-visible list is truncated",
    },
    ExclusionEntry {
        file: "search_index.rs",
        enclosing_item: "verify_file_mtimes_with_budget",
        location_or_primitive: "changed_paths.len() > limit",
        reason: "admission budget for disk-only changes and Git-diff paths; an over-budget refresh returns a cache miss for a permitted full rebuild, not a truncated agent-visible list",
    },
    ExclusionEntry {
        file: "commands/semantic_search/lexical_lane.rs",
        enclosing_item: "reference_selected_pool",
        location_or_primitive: "commands::semantic_search::lexical_lane::reference_selected_pool",
        reason: "test-only reference implementation choosing the three rarest trigram postings to compare against the optimized pool; not an agent-visible list",
    },
    ExclusionEntry {
        file: "commands/zoom.rs",
        enclosing_item: "indexed_offsets_avoid_repeated_prefix_scans_at_end_of_large_file",
        location_or_primitive: "commands::zoom indexed offset work-count test",
        reason: "test fixture selecting sample offsets for a work-count assertion; not an agent-visible list",
    },
    ExclusionEntry {
        file: "commands/semantic_search/mod.rs",
        enclosing_item: "audit1432_degraded_transient_rows_are_bounded_by_concurrency_not_all_files",
        location_or_primitive: "degraded grep fixture expected first ten rows",
        reason: "test-only reference selecting the expected input-order prefix before comparing independently sorted paths and line numbers; no tool response is produced",
    },
    // Split-query search (aft_search with both query and pattern). The
    // results list is the search surface's, cut and enveloped by the engine;
    // these items only describe the pattern input.
    ExclusionEntry {
        file: "commands/semantic_search/split_query.rs",
        enclosing_item: "line",
        location_or_primitive: "commands::semantic_search::split_query::SUMMARY_DEFINITION_SITES",
        reason: "the one-line pattern summary names at most three definition sites as a preview; the reply's pattern_summary.definition_files carries the full count, and no result is removed",
    },
    ExclusionEntry {
        file: "commands/semantic_search/split_query.rs",
        enclosing_item: "from_bounded_scan, bounded_scan_groups_lines_by_file_and_keeps_the_bound",
        location_or_primitive: "commands::semantic_search::split_query bounded scan truncation flags",
        reason: "reads (or, in the test, sets) the bounded grep scan's truncation flags to mark the pattern examination capped; nothing is cut here, and the split reply discloses the bound through its budget envelope",
    },
    ExclusionEntry {
        file: "commands/semantic_search/split_query.rs",
        enclosing_item: "selective_definitions, admission_definers, expand_group",
        location_or_primitive: "commands::semantic_search::split_query::MAX_PLACED_DEFINITIONS, MAX_GROUP_EXPANSION",
        reason: "bounds the definitions scored for relevance or carried into the ranking and the alternatives a group expands into; these are ranking inputs, no list is shown to the agent, and the results list is cut and enveloped by the engine",
    },
    // Identifier search in another project (external path): the sweep's
    // results page is the search surface's, registered under its cap reason.
    ExclusionEntry {
        file: "commands/semantic_search/external_exact.rs",
        enclosing_item: "sweep_after_metadata",
        location_or_primitive: "commands::semantic_search::external_exact::sweep skipped_foreign_mounts",
        reason: "counts mount points of other filesystems that the walk does not enter; no list is cut here, and a walk the deadline stops is reported through the sweep's enumeration_stopped and the reply's coverage line",
    },
    ExclusionEntry {
        file: "commands/semantic_search/mod.rs",
        enclosing_item: "count",
        location_or_primitive: "commands::semantic_search external grep coverage line walk_truncated",
        reason: "reads the bounded scan's truncation flag to word the coverage line; nothing is cut here, and the same flag marks the reply incomplete in external_fallback_response",
    },
    ExclusionEntry {
        file: "commands/semantic_search/nearest_names.rs",
        enclosing_item: "nearest_names",
        location_or_primitive: "commands::semantic_search::nearest_names NEAREST_NAME_FILE_LIMIT, NEAREST_NAME_LIMIT",
        reason: "a not-found answer suggests a few nearest names: the scan reads a bounded number of files and keeps the most similar names; these are suggestions for a name that occurs nowhere, not a cut of matching results",
    },
    ExclusionEntry {
        file: "commands/semantic_search/external_pattern.rs",
        enclosing_item: "semantic_results",
        location_or_primitive: "commands::semantic_search::external_pattern::Corpus semantic enumeration",
        reason: "enumerates at most SEMANTIC_ENUMERATION_LIMIT prose candidates before ranking, like the external query-only route; more_available reports the remaining candidates and the engine envelopes the results page",
    },
    ExclusionEntry {
        file: "commands/inspect.rs",
        enclosing_item: "partial_reason_from_parts",
        location_or_primitive: "commands::inspect::MAX_INSPECT_HEADER_PARTS",
        reason: "the PARTIAL status line shows every explicitly requested cause first, then previews unrequested causes up to MAX_INSPECT_HEADER_PARTS total parts and says `+N more`; every scanner reason stays in the body and the structured gaps, diagnostic overflow reasons are rendered in the body, and the cap never changes `complete`",
    },
    ExclusionEntry {
        file: "commands/inspect/gap_render.rs",
        enclosing_item: "incomplete_analysis_reason_with_files",
        location_or_primitive: "commands::inspect::MAX_PARSE_FAILURE_FILES",
        reason: "an incomplete-analysis explanation previews five parse-failure paths with their parse reasons and says `+N more`; this is a coverage gap, not a findings page. The full failure count and structured parse_errors stay visible and scope can narrow the affected files; the preview never changes completeness",
    },
    ExclusionEntry {
        file: "bounded_io.rs",
        enclosing_item: "walk_permission_gap",
        location_or_primitive: ".take(3)",
        reason: "three-folder preview inside a gap note with the full skipped count, not a pageable list",
    },
    ExclusionEntry {
        file: "bounded_io.rs",
        enclosing_item: "Reader::chunk",
        location_or_primitive: "buffer.truncate(count)",
        reason: "shrinks an I/O buffer to the number of bytes read; later chunks retain the rest of the file, so no result rows are cut",
    },
    ExclusionEntry {
        file: "commands/semantic_search/snippet_bounds.rs",
        enclosing_item: "LineWindow",
        location_or_primitive: "SNIPPET_LINE_MAX_CHARS",
        reason: "incremental implementation of the existing per-line text window, with exactly the same ellipsis and truncation marker; bounds retained characters, not result rows",
    },
    ExclusionEntry {
        file: "data_layer/surfaces.rs",
        enclosing_item: "disclose_index_gaps",
        location_or_primitive: "INDEX_GAP_PREVIEW",
        reason: "coverage-gap preview, not a findings page; skipped_folders counts every relevant unreadable folder and skipped_folders_omitted counts names beyond the preview",
    },
    ExclusionEntry {
        file: "data_layer/surfaces.rs",
        enclosing_item: "disclose_parse_gaps",
        location_or_primitive: "INDEX_GAP_PREVIEW",
        reason: "parse-coverage preview; skipped_parses and skipped_parses_omitted retain full counts; parse_gaps_list and its standard trailer disclose the preview cap",
    },
    ExclusionEntry {
        file: "commands/semantic_search/mod.rs",
        enclosing_item: "CheckoutSemanticGaps::disclose",
        location_or_primitive: ".take(crate::data_layer::surfaces::INDEX_GAP_PREVIEW)",
        reason: "semantic Luau coverage previews; skipped_files_count/omitted and failed_files_count/omitted retain full counts; each list envelope and its standard trailer disclose the preview cap",
    },
];

/// Look up a surface by command, mode, and list id.
pub fn find_surface(command: &str, mode: &str, list_id: &str) -> Option<&'static SurfaceEntry> {
    LIST_SURFACES.iter().find(|s| {
        s.command == command
            && (s.mode == mode || s.mode.is_empty() || mode.is_empty())
            && s.list_id == list_id
    })
}