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
//! Shared SQL WHERE predicates for enrich scanners and backlog counters.
//!
//! GAP-SG-77: each operation-specific predicate lives in ONE place so the
//! scanner and `count_operation_backlog` cannot drift.
/// `memory-bindings`: memories with zero `memory_entities` rows.
pub const UNBOUND_MEMORY_PREDICATE: &str =
"NOT EXISTS (SELECT 1 FROM memory_entities me WHERE me.memory_id = m.id)";
/// `entity-descriptions`: entities whose description is NULL or empty.
pub const NULL_DESCRIPTION_PREDICATE: &str = "(description IS NULL OR description = '')";
/// GAP-CLI-ED-06 / ED-LQ-01 (v1.1.8): default low-quality detectors for
/// `--force-redescribe`. Grounding score sampling complements LIKE.
pub const LOW_QUALITY_DESCRIPTION_PREDICATE: &str = "(
description LIKE '%configuration file%'
OR description LIKE '%software/system design%'
OR description LIKE '%system design%'
OR description LIKE '%software design%'
OR description LIKE '%software application%'
OR description LIKE '%in the context of software%'
OR description LIKE '%software project%'
OR description LIKE '%software system%'
OR description LIKE '%software component%'
OR description LIKE '%software architecture%'
OR description LIKE '%software development%'
OR description LIKE '%software engineering%'
OR description LIKE '%enhances chatbot%'
OR description LIKE '%chatbot response%'
OR description LIKE '%is a software%'
OR description LIKE '%of the software%'
OR description LIKE '%European digital identity%'
OR description LIKE '%in the software%'
)";
/// `body-enrich`: memory body shorter than the `?2` character threshold.
pub const SHORT_BODY_PREDICATE: &str = "LENGTH(COALESCE(m.body,'')) < ?2";
/// `description-enrich`: memories with generic/auto-generated descriptions.
pub const GENERIC_DESCRIPTION_PREDICATE: &str = "(description LIKE '%ingested%' \
OR description LIKE '%imported%' OR description LIKE '%added%' \
OR length(description) < 30)";
/// Predicate for entity-descriptions scan (GAP-CLI-ED-06).
pub
/// `weight-calibrate`: relationships strong enough to warrant recalibration.
pub const HIGH_WEIGHT_PREDICATE: &str = "r.weight >= 0.7";
/// `relation-reclassify`: relationships still using the generic `applies_to`.
pub const GENERIC_RELATION_PREDICATE: &str = "r.relation = 'applies_to'";
/// `re-embed --target memories`: memory `m` lacks a live vector.
pub
/// `re-embed --target entities`: entity `e` lacks a live vector.
pub
/// `re-embed --target chunks`: chunk `c` lacks a live vector.
pub