@plur-ai/core 0.3.1 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -260,6 +260,8 @@ declare const EngramSchema: z.ZodObject<{
260
260
  }>>;
261
261
  /** Extensible key-value data for domain-specific fields. */
262
262
  structured_data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
263
+ /** Polarity classification: 'do' for directives, 'dont' for prohibitions, null for unclassified. */
264
+ polarity: z.ZodDefault<z.ZodNullable<z.ZodEnum<["do", "dont"]>>>;
263
265
  }, "strip", z.ZodTypeAny, {
264
266
  type: "behavioral" | "architectural" | "procedural" | "terminological";
265
267
  status: "active" | "dormant" | "retired" | "candidate";
@@ -298,6 +300,7 @@ declare const EngramSchema: z.ZodObject<{
298
300
  negative: number;
299
301
  neutral: number;
300
302
  };
303
+ polarity: "do" | "dont" | null;
301
304
  rationale?: string | undefined;
302
305
  contraindications?: string[] | undefined;
303
306
  source?: string | undefined;
@@ -446,6 +449,7 @@ declare const EngramSchema: z.ZodObject<{
446
449
  contradiction_rate?: number | undefined;
447
450
  } | undefined;
448
451
  structured_data?: Record<string, unknown> | undefined;
452
+ polarity?: "do" | "dont" | null | undefined;
449
453
  }>;
450
454
  type Engram = z.infer<typeof EngramSchema>;
451
455
  type KnowledgeAnchor = z.infer<typeof KnowledgeAnchorSchema>;
@@ -611,6 +615,8 @@ declare const PlurConfigSchema: z.ZodObject<{
611
615
  spread_budget?: number | undefined;
612
616
  co_access?: boolean | undefined;
613
617
  }>>>;
618
+ allow_secrets: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
619
+ index: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
614
620
  }, "strip", z.ZodTypeAny, {
615
621
  auto_learn?: boolean | undefined;
616
622
  auto_capture?: boolean | undefined;
@@ -623,6 +629,8 @@ declare const PlurConfigSchema: z.ZodObject<{
623
629
  spread_budget: number;
624
630
  co_access: boolean;
625
631
  } | undefined;
632
+ allow_secrets?: boolean | undefined;
633
+ index?: boolean | undefined;
626
634
  }, {
627
635
  auto_learn?: boolean | undefined;
628
636
  auto_capture?: boolean | undefined;
@@ -635,6 +643,8 @@ declare const PlurConfigSchema: z.ZodObject<{
635
643
  spread_budget?: number | undefined;
636
644
  co_access?: boolean | undefined;
637
645
  } | undefined;
646
+ allow_secrets?: boolean | undefined;
647
+ index?: boolean | undefined;
638
648
  }>;
639
649
  type PlurConfig = z.infer<typeof PlurConfigSchema>;
640
650
 
@@ -666,6 +676,7 @@ interface InjectOptions {
666
676
  }
667
677
  interface InjectionResult {
668
678
  directives: string;
679
+ constraints: string;
669
680
  consider: string;
670
681
  count: number;
671
682
  tokens_used: number;
@@ -684,9 +695,470 @@ interface TimelineQuery {
684
695
  search?: string;
685
696
  }
686
697
 
698
+ interface TypedRole {
699
+ role: string;
700
+ domain_instance: string;
701
+ }
702
+ interface RelationalTriple {
703
+ subject: TypedRole;
704
+ predicate: string;
705
+ object: TypedRole;
706
+ outcome?: string;
707
+ }
708
+ interface RelationalAnalysis {
709
+ engram_id: string;
710
+ triples: RelationalTriple[];
711
+ goal_context: string;
712
+ is_failure_driven: boolean;
713
+ domain: string;
714
+ polarity: 'do' | 'dont';
715
+ }
716
+ declare function analyzeStructure(engrams: Engram[], llm: LlmFunction): Promise<RelationalAnalysis[]>;
717
+
718
+ interface EngramCluster {
719
+ cluster_id: string;
720
+ members: RelationalAnalysis[];
721
+ domains: string[];
722
+ is_cross_domain: boolean;
723
+ cohesion: number;
724
+ }
725
+ /**
726
+ * Cluster relational analyses by structural similarity.
727
+ * Prefers embedding-based cosine similarity (384-dim BGE vectors) for semantic depth.
728
+ * Falls back to token overlap when @huggingface/transformers is unavailable.
729
+ */
730
+ declare function clusterByStructure(analyses: RelationalAnalysis[], threshold?: number): Promise<EngramCluster[]>;
731
+
732
+ declare const StructuralTemplateSchema: z.ZodObject<{
733
+ goal_type: z.ZodString;
734
+ constraint_type: z.ZodString;
735
+ outcome_type: z.ZodString;
736
+ template: z.ZodString;
737
+ /** Structural frame — declares which relational pattern this meta-engram uses.
738
+ * Allows flexible analogy beyond rigid [goal]+[constraint]->[outcome]. */
739
+ structure_type: z.ZodDefault<z.ZodEnum<["goal-constraint-outcome", "feedback-loop", "causal-chain", "recursive", "tradeoff", "freeform"]>>;
740
+ /** For patterns that don't fit the standard template fields — the LLM's own structural description */
741
+ freeform_structure: z.ZodOptional<z.ZodString>;
742
+ }, "strip", z.ZodTypeAny, {
743
+ template: string;
744
+ goal_type: string;
745
+ constraint_type: string;
746
+ outcome_type: string;
747
+ structure_type: "goal-constraint-outcome" | "feedback-loop" | "causal-chain" | "recursive" | "tradeoff" | "freeform";
748
+ freeform_structure?: string | undefined;
749
+ }, {
750
+ template: string;
751
+ goal_type: string;
752
+ constraint_type: string;
753
+ outcome_type: string;
754
+ structure_type?: "goal-constraint-outcome" | "feedback-loop" | "causal-chain" | "recursive" | "tradeoff" | "freeform" | undefined;
755
+ freeform_structure?: string | undefined;
756
+ }>;
757
+ declare const EvidenceEntrySchema: z.ZodObject<{
758
+ engram_id: z.ZodString;
759
+ domain: z.ZodString;
760
+ mapping_rationale: z.ZodString;
761
+ alignment_score: z.ZodNumber;
762
+ }, "strip", z.ZodTypeAny, {
763
+ domain: string;
764
+ engram_id: string;
765
+ mapping_rationale: string;
766
+ alignment_score: number;
767
+ }, {
768
+ domain: string;
769
+ engram_id: string;
770
+ mapping_rationale: string;
771
+ alignment_score: number;
772
+ }>;
773
+ declare const FalsificationSchema: z.ZodObject<{
774
+ expected_conditions: z.ZodString;
775
+ expected_exceptions: z.ZodString;
776
+ test_prediction: z.ZodOptional<z.ZodString>;
777
+ }, "strip", z.ZodTypeAny, {
778
+ expected_conditions: string;
779
+ expected_exceptions: string;
780
+ test_prediction?: string | undefined;
781
+ }, {
782
+ expected_conditions: string;
783
+ expected_exceptions: string;
784
+ test_prediction?: string | undefined;
785
+ }>;
786
+ declare const MetaConfidenceSchema: z.ZodObject<{
787
+ evidence_count: z.ZodNumber;
788
+ domain_count: z.ZodNumber;
789
+ structural_depth: z.ZodNumber;
790
+ validation_ratio: z.ZodDefault<z.ZodNumber>;
791
+ composite: z.ZodNumber;
792
+ }, "strip", z.ZodTypeAny, {
793
+ evidence_count: number;
794
+ domain_count: number;
795
+ structural_depth: number;
796
+ validation_ratio: number;
797
+ composite: number;
798
+ }, {
799
+ evidence_count: number;
800
+ domain_count: number;
801
+ structural_depth: number;
802
+ composite: number;
803
+ validation_ratio?: number | undefined;
804
+ }>;
805
+ declare const DomainCoverageSchema: z.ZodObject<{
806
+ validated: z.ZodArray<z.ZodString, "many">;
807
+ failed: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
808
+ predicted: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
809
+ }, "strip", z.ZodTypeAny, {
810
+ validated: string[];
811
+ failed: string[];
812
+ predicted: string[];
813
+ }, {
814
+ validated: string[];
815
+ failed?: string[] | undefined;
816
+ predicted?: string[] | undefined;
817
+ }>;
818
+ declare const HierarchyPositionSchema: z.ZodObject<{
819
+ level: z.ZodEnum<["mop", "top"]>;
820
+ parent: z.ZodDefault<z.ZodNullable<z.ZodString>>;
821
+ children: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
822
+ }, "strip", z.ZodTypeAny, {
823
+ level: "mop" | "top";
824
+ parent: string | null;
825
+ children: string[];
826
+ }, {
827
+ level: "mop" | "top";
828
+ parent?: string | null | undefined;
829
+ children?: string[] | undefined;
830
+ }>;
831
+ declare const MetaFieldSchema: z.ZodObject<{
832
+ structure: z.ZodObject<{
833
+ goal_type: z.ZodString;
834
+ constraint_type: z.ZodString;
835
+ outcome_type: z.ZodString;
836
+ template: z.ZodString;
837
+ /** Structural frame — declares which relational pattern this meta-engram uses.
838
+ * Allows flexible analogy beyond rigid [goal]+[constraint]->[outcome]. */
839
+ structure_type: z.ZodDefault<z.ZodEnum<["goal-constraint-outcome", "feedback-loop", "causal-chain", "recursive", "tradeoff", "freeform"]>>;
840
+ /** For patterns that don't fit the standard template fields — the LLM's own structural description */
841
+ freeform_structure: z.ZodOptional<z.ZodString>;
842
+ }, "strip", z.ZodTypeAny, {
843
+ template: string;
844
+ goal_type: string;
845
+ constraint_type: string;
846
+ outcome_type: string;
847
+ structure_type: "goal-constraint-outcome" | "feedback-loop" | "causal-chain" | "recursive" | "tradeoff" | "freeform";
848
+ freeform_structure?: string | undefined;
849
+ }, {
850
+ template: string;
851
+ goal_type: string;
852
+ constraint_type: string;
853
+ outcome_type: string;
854
+ structure_type?: "goal-constraint-outcome" | "feedback-loop" | "causal-chain" | "recursive" | "tradeoff" | "freeform" | undefined;
855
+ freeform_structure?: string | undefined;
856
+ }>;
857
+ evidence: z.ZodArray<z.ZodObject<{
858
+ engram_id: z.ZodString;
859
+ domain: z.ZodString;
860
+ mapping_rationale: z.ZodString;
861
+ alignment_score: z.ZodNumber;
862
+ }, "strip", z.ZodTypeAny, {
863
+ domain: string;
864
+ engram_id: string;
865
+ mapping_rationale: string;
866
+ alignment_score: number;
867
+ }, {
868
+ domain: string;
869
+ engram_id: string;
870
+ mapping_rationale: string;
871
+ alignment_score: number;
872
+ }>, "many">;
873
+ domain_coverage: z.ZodObject<{
874
+ validated: z.ZodArray<z.ZodString, "many">;
875
+ failed: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
876
+ predicted: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
877
+ }, "strip", z.ZodTypeAny, {
878
+ validated: string[];
879
+ failed: string[];
880
+ predicted: string[];
881
+ }, {
882
+ validated: string[];
883
+ failed?: string[] | undefined;
884
+ predicted?: string[] | undefined;
885
+ }>;
886
+ falsification: z.ZodObject<{
887
+ expected_conditions: z.ZodString;
888
+ expected_exceptions: z.ZodString;
889
+ test_prediction: z.ZodOptional<z.ZodString>;
890
+ }, "strip", z.ZodTypeAny, {
891
+ expected_conditions: string;
892
+ expected_exceptions: string;
893
+ test_prediction?: string | undefined;
894
+ }, {
895
+ expected_conditions: string;
896
+ expected_exceptions: string;
897
+ test_prediction?: string | undefined;
898
+ }>;
899
+ confidence: z.ZodObject<{
900
+ evidence_count: z.ZodNumber;
901
+ domain_count: z.ZodNumber;
902
+ structural_depth: z.ZodNumber;
903
+ validation_ratio: z.ZodDefault<z.ZodNumber>;
904
+ composite: z.ZodNumber;
905
+ }, "strip", z.ZodTypeAny, {
906
+ evidence_count: number;
907
+ domain_count: number;
908
+ structural_depth: number;
909
+ validation_ratio: number;
910
+ composite: number;
911
+ }, {
912
+ evidence_count: number;
913
+ domain_count: number;
914
+ structural_depth: number;
915
+ composite: number;
916
+ validation_ratio?: number | undefined;
917
+ }>;
918
+ hierarchy: z.ZodObject<{
919
+ level: z.ZodEnum<["mop", "top"]>;
920
+ parent: z.ZodDefault<z.ZodNullable<z.ZodString>>;
921
+ children: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
922
+ }, "strip", z.ZodTypeAny, {
923
+ level: "mop" | "top";
924
+ parent: string | null;
925
+ children: string[];
926
+ }, {
927
+ level: "mop" | "top";
928
+ parent?: string | null | undefined;
929
+ children?: string[] | undefined;
930
+ }>;
931
+ pipeline_version: z.ZodString;
932
+ last_validated: z.ZodOptional<z.ZodString>;
933
+ }, "strip", z.ZodTypeAny, {
934
+ confidence: {
935
+ evidence_count: number;
936
+ domain_count: number;
937
+ structural_depth: number;
938
+ validation_ratio: number;
939
+ composite: number;
940
+ };
941
+ structure: {
942
+ template: string;
943
+ goal_type: string;
944
+ constraint_type: string;
945
+ outcome_type: string;
946
+ structure_type: "goal-constraint-outcome" | "feedback-loop" | "causal-chain" | "recursive" | "tradeoff" | "freeform";
947
+ freeform_structure?: string | undefined;
948
+ };
949
+ evidence: {
950
+ domain: string;
951
+ engram_id: string;
952
+ mapping_rationale: string;
953
+ alignment_score: number;
954
+ }[];
955
+ domain_coverage: {
956
+ validated: string[];
957
+ failed: string[];
958
+ predicted: string[];
959
+ };
960
+ falsification: {
961
+ expected_conditions: string;
962
+ expected_exceptions: string;
963
+ test_prediction?: string | undefined;
964
+ };
965
+ hierarchy: {
966
+ level: "mop" | "top";
967
+ parent: string | null;
968
+ children: string[];
969
+ };
970
+ pipeline_version: string;
971
+ last_validated?: string | undefined;
972
+ }, {
973
+ confidence: {
974
+ evidence_count: number;
975
+ domain_count: number;
976
+ structural_depth: number;
977
+ composite: number;
978
+ validation_ratio?: number | undefined;
979
+ };
980
+ structure: {
981
+ template: string;
982
+ goal_type: string;
983
+ constraint_type: string;
984
+ outcome_type: string;
985
+ structure_type?: "goal-constraint-outcome" | "feedback-loop" | "causal-chain" | "recursive" | "tradeoff" | "freeform" | undefined;
986
+ freeform_structure?: string | undefined;
987
+ };
988
+ evidence: {
989
+ domain: string;
990
+ engram_id: string;
991
+ mapping_rationale: string;
992
+ alignment_score: number;
993
+ }[];
994
+ domain_coverage: {
995
+ validated: string[];
996
+ failed?: string[] | undefined;
997
+ predicted?: string[] | undefined;
998
+ };
999
+ falsification: {
1000
+ expected_conditions: string;
1001
+ expected_exceptions: string;
1002
+ test_prediction?: string | undefined;
1003
+ };
1004
+ hierarchy: {
1005
+ level: "mop" | "top";
1006
+ parent?: string | null | undefined;
1007
+ children?: string[] | undefined;
1008
+ };
1009
+ pipeline_version: string;
1010
+ last_validated?: string | undefined;
1011
+ }>;
1012
+ type MetaField = z.infer<typeof MetaFieldSchema>;
1013
+ type StructuralTemplate = z.infer<typeof StructuralTemplateSchema>;
1014
+ type EvidenceEntry = z.infer<typeof EvidenceEntrySchema>;
1015
+ type MetaConfidence = z.infer<typeof MetaConfidenceSchema>;
1016
+ type DomainCoverage = z.infer<typeof DomainCoverageSchema>;
1017
+ type HierarchyPosition = z.infer<typeof HierarchyPositionSchema>;
1018
+ type Falsification = z.infer<typeof FalsificationSchema>;
1019
+
1020
+ interface MemberAlignment {
1021
+ engram_id: string;
1022
+ alignment_score: number;
1023
+ mapping_rationale: string;
1024
+ }
1025
+ interface AlignmentResult {
1026
+ cluster_id: string;
1027
+ common_structure: StructuralTemplate;
1028
+ member_alignments: MemberAlignment[];
1029
+ structural_depth: number;
1030
+ systematicity: number;
1031
+ candidate_inferences: string[];
1032
+ }
1033
+ declare function alignCluster(cluster: EngramCluster, llm: LlmFunction): Promise<AlignmentResult | null>;
1034
+
1035
+ declare function formulateMetaEngram(alignment: AlignmentResult, llm: LlmFunction, existingMetas?: Engram[],
1036
+ /** Distinct domains from the cluster (provided by pipeline orchestrator) */
1037
+ domains?: string[]): Promise<Engram | null>;
1038
+
1039
+ interface ValidationResult {
1040
+ meta_engram_id: string;
1041
+ test_domain: string;
1042
+ prediction_held: boolean;
1043
+ matching_engram_id: string | null;
1044
+ alignment_score: number;
1045
+ rationale: string;
1046
+ }
1047
+ declare function validateMetaEngram(meta: Engram, testEngrams: Engram[], testDomain: string, llm: LlmFunction): Promise<ValidationResult>;
1048
+
1049
+ /**
1050
+ * Organize meta-engrams into MOP/TOP hierarchy.
1051
+ * Purely deterministic: pairwise template similarity, parent-child by domain subsumption.
1052
+ * Returns engrams with updated hierarchy fields.
1053
+ */
1054
+ declare function organizeHierarchy(metaEngrams: Engram[]): Engram[];
1055
+
1056
+ interface ExtractOptions {
1057
+ /** Whether to run Stage 5 validation (default: false — can be deferred) */
1058
+ run_validation?: boolean;
1059
+ /** Engrams to use for validation (held-out domains) */
1060
+ validation_engrams?: Engram[];
1061
+ /** Existing meta-engrams to check for deduplication */
1062
+ existing_metas?: Engram[];
1063
+ /** Minimum cluster size to attempt alignment (default: 2) */
1064
+ min_cluster_size?: number;
1065
+ }
1066
+ interface ExtractionResult {
1067
+ engrams_analyzed: number;
1068
+ clusters_found: number;
1069
+ alignments_passed: number;
1070
+ meta_engrams_extracted: number;
1071
+ rejected_as_platitudes: number;
1072
+ validation_results: ValidationResult[];
1073
+ results: Engram[];
1074
+ duration_ms: number;
1075
+ }
1076
+ /**
1077
+ * Full meta-engram extraction pipeline: Stages 1 → 2 → 3 → 4 → 5(optional) → 6
1078
+ */
1079
+ declare function extractMetaEngrams(engrams: Engram[], llm: LlmFunction, options?: ExtractOptions): Promise<ExtractionResult>;
1080
+
1081
+ /** Patterns that are too generic to be useful as meta-engrams */
1082
+ declare const PLATITUDE_PATTERNS: string[];
1083
+ declare function isPlatitude(statement: string): boolean;
1084
+
1085
+ /** Token-based similarity between two template strings. Used for clustering, dedup, and hierarchy. */
1086
+ declare function tokenSimilarity(a: string, b: string): number;
1087
+
1088
+ declare function classifyPolarity(statement: string): 'dont' | null;
1089
+
1090
+ /**
1091
+ * Minimal interface for confidence computation.
1092
+ * Accepts any object with these optional fields — works with Engram,
1093
+ * AgentEngram, WireEngram, or any subset.
1094
+ */
1095
+ interface ConfidenceInput {
1096
+ feedback_signals?: {
1097
+ positive: number;
1098
+ negative: number;
1099
+ neutral: number;
1100
+ };
1101
+ consolidated?: boolean;
1102
+ }
1103
+ /**
1104
+ * Compute a confidence score (0.0-1.0) from feedback signals.
1105
+ *
1106
+ * Uses sigmoid of net feedback ratio, dampened by sample size.
1107
+ * No feedback → 0.5 (neutral). Heavy positive → approaches 1.0.
1108
+ * Small sample sizes are dampened toward 0.5.
1109
+ */
1110
+ declare function computeConfidence(input: ConfidenceInput): number;
1111
+ /**
1112
+ * Compute a composite meta-confidence score (0.0-1.0) for a META- engram
1113
+ * based on the richness of its evidence, domain coverage, structural depth,
1114
+ * and validation ratio.
1115
+ *
1116
+ * Weights:
1117
+ * - evidenceCount (capped at 5): 25%
1118
+ * - domainCount (capped at 3): 35%
1119
+ * - structuralDepth (capped at 3): 20%
1120
+ * - validationRatio (0.0–1.0): 20%
1121
+ */
1122
+ declare function computeMetaConfidence(evidenceCount: number, domainCount: number, structuralDepth: number, validationRatio: number): number;
1123
+ /** Convert numeric confidence to human-readable band */
1124
+ declare function confidenceBand(score: number): 'low' | 'medium' | 'high';
1125
+
1126
+ interface ToolCallRecord {
1127
+ tool: string;
1128
+ args_keys: string;
1129
+ timestamp: string;
1130
+ }
1131
+ declare class SessionBreadcrumbs {
1132
+ private toolCalls;
1133
+ private engramsRecalled;
1134
+ recordToolCall(tool: string, args: Record<string, unknown>): void;
1135
+ recordEngramRecalled(engramId: string): void;
1136
+ getToolCalls(): ToolCallRecord[];
1137
+ getEngramsRecalled(): string[];
1138
+ /**
1139
+ * Returns only engram IDs that have the META- prefix.
1140
+ * These represent meta-engrams injected into the session context.
1141
+ */
1142
+ getMetaEngramsRecalled(): string[];
1143
+ generateContinuationContext(): string;
1144
+ }
1145
+
1146
+ /**
1147
+ * Generate CLAUDE.md guardrails markdown for PLUR install.
1148
+ * Appended to project CLAUDE.md (or equivalent instruction file) during setup.
1149
+ */
1150
+ declare function generateGuardrails(): string;
1151
+
687
1152
  /** Build searchable text from all engram fields */
688
1153
  declare function engramSearchText(engram: Engram): string;
689
1154
 
1155
+ interface SecretMatch {
1156
+ pattern: string;
1157
+ match: string;
1158
+ }
1159
+ /** Scan text for potential secrets. Returns empty array if clean. */
1160
+ declare function detectSecrets(text: string): SecretMatch[];
1161
+
690
1162
  interface PlurPaths {
691
1163
  root: string;
692
1164
  engrams: string;
@@ -695,9 +1167,36 @@ interface PlurPaths {
695
1167
  packs: string;
696
1168
  exchange: string;
697
1169
  config: string;
1170
+ db: string;
698
1171
  }
699
1172
  declare function detectPlurStorage(explicitPath?: string): PlurPaths;
700
1173
 
1174
+ declare class IndexedStorage {
1175
+ private dbPath;
1176
+ private engramsPath;
1177
+ private db;
1178
+ constructor(engramsPath: string, dbPath: string);
1179
+ private getDb;
1180
+ /** Load all engrams from SQLite index. Auto-rebuilds if db missing. */
1181
+ loadAll(): Engram[];
1182
+ /** Load engrams with SQL-level filtering. */
1183
+ loadFiltered(filter: {
1184
+ status?: string;
1185
+ scope?: string;
1186
+ domain?: string;
1187
+ }): Engram[];
1188
+ /** Count engrams with optional status filter. */
1189
+ count(filter?: {
1190
+ status?: string;
1191
+ }): number;
1192
+ /** Sync SQLite index from YAML source of truth. */
1193
+ syncFromYaml(): void;
1194
+ /** Drop and rebuild the entire index from YAML. */
1195
+ reindex(): void;
1196
+ /** Close the database connection. */
1197
+ close(): void;
1198
+ }
1199
+
701
1200
  /**
702
1201
  * Non-blocking version check against npm registry.
703
1202
  * Caches result in memory — one fetch per process lifetime.
@@ -743,6 +1242,7 @@ interface StatusResult {
743
1242
  declare class Plur {
744
1243
  private paths;
745
1244
  private config;
1245
+ private indexedStorage;
746
1246
  constructor(options?: {
747
1247
  path?: string;
748
1248
  });
@@ -768,9 +1268,15 @@ declare class Plur {
768
1268
  recallExpanded(query: string, options: RecallOptions & {
769
1269
  llm: LlmFunction;
770
1270
  }): Promise<Engram[]>;
1271
+ /** List all active engrams, optionally filtered by scope/domain. No search — returns all matches. */
1272
+ list(options?: {
1273
+ scope?: string;
1274
+ domain?: string;
1275
+ min_strength?: number;
1276
+ }): Engram[];
771
1277
  /** Filter engrams by scope/domain/strength (shared by both modes) */
772
1278
  private _filterEngrams;
773
- /** Reactivate accessed engrams (bump retrieval strength, frequency, last_accessed) */
1279
+ /** Reactivate accessed engrams and update co-access associations */
774
1280
  private _reactivateResults;
775
1281
  /** Scored injection within token budget (BM25 only). Returns formatted strings. */
776
1282
  inject(task: string, options?: InjectOptions): InjectionResult;
@@ -779,8 +1285,24 @@ declare class Plur {
779
1285
  private _formatInjection;
780
1286
  /** Update feedback_signals and adjust retrieval_strength. */
781
1287
  feedback(id: string, signal: 'positive' | 'negative' | 'neutral'): void;
1288
+ /** Save extracted meta-engrams to the engram store. Skips IDs that already exist. */
1289
+ saveMetaEngrams(metas: Engram[]): {
1290
+ saved: number;
1291
+ skipped: number;
1292
+ };
1293
+ /** Update an existing engram in the store by ID. Returns true if found and updated. */
1294
+ updateEngram(updated: Engram): boolean;
782
1295
  /** Set engram status to 'retired'. */
783
1296
  forget(id: string, reason?: string): void;
1297
+ /** Remove retired engrams from storage. Returns count of removed and remaining. */
1298
+ compact(): {
1299
+ removed: number;
1300
+ remaining: number;
1301
+ };
1302
+ /** Rebuild SQLite index from YAML source of truth. Only works when index: true. */
1303
+ reindex(): void;
1304
+ /** Sync SQLite index after YAML write (no-op if index disabled) */
1305
+ private _syncIndex;
784
1306
  /** Capture an episodic memory. */
785
1307
  capture(summary: string, context?: CaptureContext): Episode;
786
1308
  /** Query the episode timeline. */
@@ -812,4 +1334,4 @@ declare class Plur {
812
1334
  status(): StatusResult;
813
1335
  }
814
1336
 
815
- export { type Association, type CaptureContext, type Engram, type Episode, type IngestCandidate, type IngestOptions, type InjectOptions, type InjectionResult, type KnowledgeAnchor, type LearnContext, type LlmFunction, type PackManifest, Plur, type PlurConfig, type PlurPaths, type RecallOptions, type StatusResult, type SyncResult, type SyncStatus, type TimelineQuery, type VersionCheckResult, checkForUpdate, clearVersionCache, detectPlurStorage, engramSearchText, getCachedUpdateCheck };
1337
+ export { type AlignmentResult, type Association, type CaptureContext, type DomainCoverage, DomainCoverageSchema, type Engram, type EngramCluster, type Episode, type EvidenceEntry, EvidenceEntrySchema, type ExtractOptions, type ExtractionResult, type Falsification, FalsificationSchema, type HierarchyPosition, HierarchyPositionSchema, IndexedStorage, type IngestCandidate, type IngestOptions, type InjectOptions, type InjectionResult, type KnowledgeAnchor, type LearnContext, type LlmFunction, type MemberAlignment, type MetaConfidence, MetaConfidenceSchema, type MetaField, MetaFieldSchema, PLATITUDE_PATTERNS, type PackManifest, Plur, type PlurConfig, type PlurPaths, type RecallOptions, type RelationalAnalysis, type RelationalTriple, SessionBreadcrumbs, type StatusResult, type StructuralTemplate, StructuralTemplateSchema, type SyncResult, type SyncStatus, type TimelineQuery, type TypedRole, type ValidationResult, type VersionCheckResult, alignCluster, analyzeStructure, checkForUpdate, classifyPolarity, clearVersionCache, clusterByStructure, computeConfidence, computeMetaConfidence, confidenceBand, detectPlurStorage, detectSecrets, engramSearchText, extractMetaEngrams, formulateMetaEngram, generateGuardrails, getCachedUpdateCheck, isPlatitude, organizeHierarchy, tokenSimilarity, validateMetaEngram };