@hiveai/core 0.13.9 → 0.15.0

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
@@ -609,6 +609,14 @@ interface RecurrenceReport {
609
609
  }
610
610
  declare function computeRecurrence(events: PreventionEvent[]): RecurrenceReport;
611
611
 
612
+ /** How long an emitted project context is considered "still fresh in the agent's context". */
613
+ declare const PROJECT_CONTEXT_THROTTLE_MS: number;
614
+ declare function hashProjectContext(content: string): string;
615
+ /** True if an identical project-context body was already emitted within the throttle window. */
616
+ declare function projectContextRecentlyEmitted(paths: HaivePaths, hash: string, now?: number): Promise<boolean>;
617
+ /** Record that this exact project-context body was just emitted. Best-effort. */
618
+ declare function recordProjectContextEmission(paths: HaivePaths, hash: string, now?: number): Promise<void>;
619
+
612
620
  /**
613
621
  * A rigorous, model-free, repeatable evaluation of hAIve's core promise: surfacing
614
622
  * the right knowledge and guardrails at the right moment. Unlike the agent benchmark
@@ -1102,6 +1110,14 @@ interface HaiveConfig {
1102
1110
  mode?: "off" | "advisory" | "strict";
1103
1111
  /** Require get_briefing / mem_relevant_to before state-changing MCP tools. */
1104
1112
  requireBriefingFirst?: boolean;
1113
+ /**
1114
+ * Pre-edit (PreToolUse) behaviour when a file's anchored policy was not yet surfaced:
1115
+ * - "advise" (default): inject the relevant memory content into the agent's context and record
1116
+ * it in the briefing marker, then ALLOW the edit — no round-trip, no separate briefing command.
1117
+ * - "block": hard-block the edit until a briefing covers the file (the legacy strict behaviour).
1118
+ * The commit-time decision-coverage gate and CI enforcement remain the hard backstops either way.
1119
+ */
1120
+ preEditGate?: "advise" | "block";
1105
1121
  /** Require a session recap before pre-push / CI gates pass. */
1106
1122
  requireSessionRecap?: boolean;
1107
1123
  /** Require memory anchor verification before pre-commit / CI gates pass. */
@@ -1121,6 +1137,29 @@ interface HaiveConfig {
1121
1137
  * Default: "anchored" — makes "known bad approaches are blocked" true for the precise case.
1122
1138
  */
1123
1139
  antiPatternGate?: "off" | "review" | "anchored" | "strict";
1140
+ /**
1141
+ * Execute `kind: "shell" | "test"` memory sensors during `haive sensors check`.
1142
+ * These run arbitrary repo-authored commands, so they are OFF by default; turn on per repo
1143
+ * (or pass `--commands`) once the team trusts the sensors. Regex sensors always run. Default false.
1144
+ */
1145
+ runCommandSensors?: boolean;
1146
+ /**
1147
+ * How `haive enforce finish` reacts to hard failures observed this session that were never
1148
+ * captured as a lesson (`mem_tried`):
1149
+ * - off: ignore
1150
+ * - warn: surface them as an info finding (default — failure detection has false positives)
1151
+ * - block: hard-block finish until each is captured
1152
+ * Default: "warn".
1153
+ */
1154
+ failureCaptureGate?: "off" | "warn" | "block";
1155
+ /**
1156
+ * How `haive eval --ci` reacts to a harness-quality regression vs the recorded baseline:
1157
+ * - off: never block
1158
+ * - warn: report the drop (default)
1159
+ * - block: exit non-zero on any score drop
1160
+ * Default: "warn".
1161
+ */
1162
+ evalRegressionGate?: "off" | "warn" | "block";
1124
1163
  /**
1125
1164
  * Default unread-age window (in days) for `haive memory archive` corpus decay.
1126
1165
  * A noisy or stale corpus is actively harmful — it makes the agent follow outdated policy.
@@ -1529,6 +1568,27 @@ declare function runRegexSensor(memoryId: string, sensor: Sensor, target: Sensor
1529
1568
  * are the CLI's responsibility). At most one hit per (memory, file) pair is returned.
1530
1569
  */
1531
1570
  declare function runSensors(memories: Memory[], targets: SensorTarget[]): SensorHit[];
1571
+ /**
1572
+ * A shell/test sensor selected for execution — the feedback *computational* layer that a regex
1573
+ * can't express. The schema reserves `kind: "shell" | "test"`; this picks the ones whose memory
1574
+ * applies to the changed paths so the CLI can run `command` (core stays pure — it never executes).
1575
+ */
1576
+ interface CommandSensorSpec {
1577
+ memory_id: string;
1578
+ /** Command to execute (shell or test runner invocation). */
1579
+ command: string;
1580
+ kind: "shell" | "test";
1581
+ severity: Sensor["severity"];
1582
+ /** LLM-facing self-correction message carried from the sensor. */
1583
+ message: string;
1584
+ /** Anchor/scoped paths this sensor cares about (for reporting). */
1585
+ paths: string[];
1586
+ }
1587
+ /**
1588
+ * Select the shell/test sensors that apply to `changedPaths`. With no changed paths (or a sensor
1589
+ * scoped to everywhere) the sensor is selected unconditionally. Pure: the caller executes commands.
1590
+ */
1591
+ declare function selectCommandSensors(memories: Memory[], changedPaths: string[]): CommandSensorSpec[];
1532
1592
  /** Split a unified diff into per-file targets containing only added lines. */
1533
1593
  declare function sensorTargetsFromDiff(diff: string): SensorTarget[];
1534
1594
  /**
@@ -1634,6 +1694,47 @@ declare function draftsFromFindings(findings: Finding[], options?: DraftsOptions
1634
1694
  /** Drop drafts whose topic already exists in the corpus (cross-run dedup). */
1635
1695
  declare function filterNewDrafts(drafts: MemoryDraft[], existingTopics: Iterable<string>): MemoryDraft[];
1636
1696
 
1697
+ /**
1698
+ * Gate signal-quality — is the inferential (anti-pattern) gate earning trust or crying wolf?
1699
+ *
1700
+ * hAIve's anti-pattern gate is probabilistic and warmup-sensitive, so it is deliberately calibrated
1701
+ * NOT to hard-block on weak matches. But a team needs to SEE whether the gate's signal is precise:
1702
+ * are its catches turning out to be real (prevented mistakes, applied lessons) or noise (rejected by
1703
+ * humans via `mem_feedback`)? This module turns the signals hAIve already records — prevention events
1704
+ * (by source) and per-memory rejection counts — into a precision indicator and an actionable tuning
1705
+ * suggestion for `enforcement.antiPatternGate`. Pure: no I/O.
1706
+ */
1707
+
1708
+ interface GatePrecision {
1709
+ /** Catches recorded by deterministic regex/command sensors. */
1710
+ sensor_catches: number;
1711
+ /** Catches recorded by the inferential anti-pattern gate. */
1712
+ anti_pattern_catches: number;
1713
+ /** Total "useful" outcomes (catches + human-applied lessons). */
1714
+ useful: number;
1715
+ /** Total human rejections (mem_feedback "not useful"). Proxy for false positives. */
1716
+ rejections: number;
1717
+ /** useful / (useful + rejections), 0..1. Null when there is no signal yet. */
1718
+ precision: number | null;
1719
+ /** A tuning recommendation for enforcement.antiPatternGate, or null when current looks right. */
1720
+ suggestion: GateTuningSuggestion | null;
1721
+ }
1722
+ interface GateTuningSuggestion {
1723
+ recommended: AntiPatternGate;
1724
+ reason: string;
1725
+ }
1726
+ /**
1727
+ * Compute the gate's signal quality from prevention events + usage.
1728
+ * @param currentGate the configured antiPatternGate, used to decide whether to suggest a change.
1729
+ */
1730
+ declare function computeGatePrecision(events: PreventionEvent[], usage: UsageIndex, currentGate?: AntiPatternGate): GatePrecision;
1731
+ /**
1732
+ * Suggest loosening the gate when it is noisy (low precision with real rejection volume), or
1733
+ * tightening it when it is precise but currently soft. Returns null when current looks right or
1734
+ * there isn't enough signal to act on.
1735
+ */
1736
+ declare function suggestGate(precision: number | null, rejections: number, currentGate: AntiPatternGate): GateTuningSuggestion | null;
1737
+
1637
1738
  interface DashboardOptions {
1638
1739
  /** How many rows to include in each "top" list. Default 10. */
1639
1740
  top?: number;
@@ -1642,6 +1743,8 @@ interface DashboardOptions {
1642
1743
  now?: Date;
1643
1744
  /** Prevention event log (from `loadPreventionEvents`) — powers the trend + recurrence rollups. */
1644
1745
  preventionEvents?: PreventionEvent[];
1746
+ /** Configured anti-pattern gate — lets the gate-precision rollup suggest tightening/loosening. */
1747
+ antiPatternGate?: AntiPatternGate;
1645
1748
  }
1646
1749
  interface ImpactRow {
1647
1750
  id: string;
@@ -1714,6 +1817,8 @@ interface DashboardReport {
1714
1817
  /** Lessons re-introduced after capture (caught on >= 2 distinct days). */
1715
1818
  recurrence: RecurrenceReport;
1716
1819
  };
1820
+ /** Inferential-gate signal quality: are catches real (useful) or noise (rejected)? + tuning hint. */
1821
+ gate_precision: GatePrecision;
1717
1822
  corpus: {
1718
1823
  /** Number of memory files (policy corpus, excludes session_recap). */
1719
1824
  memory_files: number;
@@ -1725,4 +1830,201 @@ interface DashboardReport {
1725
1830
  /** Build the full observability rollup from the loaded corpus + usage index. Pure. */
1726
1831
  declare function buildDashboard(memories: LoadedMemory[], usage: UsageIndex, options?: DashboardOptions): DashboardReport;
1727
1832
 
1728
- export { AUTOPILOT_DEFAULTS, type Activation, type ActivationContext, ActivationSchema, type Anchor, AnchorSchema, type AntiPatternGate, type AutoPromoteRule, BRIEFING_MARKER_TTL_MS, BRIEFING_PRESET_DEFAULTS, type BreakingChange, type BriefingBudgetNumbers, type BriefingBudgetPreset, type BriefingMarker, type BudgetPart, type BudgetSlice, type BuildCodeMapOptions, CHARS_PER_TOKEN, CODE_MAP_FILE, CODE_STOPWORDS, CONFIG_FILE, type CodeExport, type CodeExportKind, type CodeFileEntry, type CodeMap, type CodeMapQueryOptions, type CollectTimelineOpts, type ConfidenceLevel, type ConfidenceThresholds, type ConflictCandidatePair, type ConflictCandidatesOpts, type ContractDiffResult, type ContractFile, type ContractSnapshot, CrossRepoProvenanceSchema, type CrossRepoReport, type CrossRepoSource, DECAY_DAYS, DEFAULT_AUTO_PROMOTE_RULE, DEFAULT_CONFIDENCE_THRESHOLDS, DEFAULT_CONFIG, DEFAULT_DORMANT_DAYS, type DashboardOptions, type DashboardReport, type DepChange, type DepTrackResult, type DependencySnapshot, type DocFrequency, type DormantRow, type DraftOptions, type DraftsOptions, type EvalDelta, type EvalReport, type EvalSpec, type Finding, type FindingSeverity, GUESSABLE_THRESHOLD, HAIVE_DIR, type HaiveConfig, type HaivePaths, type ImpactOptions, type ImpactRow, type ImpactScore, type ImpactSummary, type ImpactTier, type LexicalRankResult, type LoadedMemory, MEMORIES_DIR, MIN_WORD_LEN, type Memory, type MemoryDraft, type MemoryFrontmatter, MemoryFrontmatterSchema, type MemoryScope, MemoryScopeSchema, type MemoryStatus, MemoryStatusSchema, type MemoryType, MemoryTypeSchema, type MemoryUsage, type MetricDelta, PREVENTION_DEBOUNCE_MS, PROJECT_CONTEXT_FILE, type PreventionEvent, type PreventionRow, type PreventionSource, type PreventionTrend, RUNTIME_JOURNAL_FILENAME, type RecurrenceReport, type RecurrenceRow, type ResolveProjectInfo, type RetirementSignal, type RetrievalAggregate, type RetrievalCase, type RetrievalCaseResult, type RuntimeJournalEntry, SESSION_RECAP_TTL_MS, STACK_PACK_TAG, type SelfEvalOptions, type Sensor, type SensorAggregate, type SensorCase, type SensorCaseResult, type SensorHit, type SensorRow, SensorSchema, type SensorSuggestionOptions, type SensorTarget, type SkillActivation, type TimelineEntry, type TopicStatusPair, type TruncateOptions, type TruncateResult, USAGE_FILE, USAGE_LOG_DIR, USAGE_LOG_FILE, type UsageAggregate, type UsageEvent, type UsageIndex, type VerifyOptions, type VerifyResult, addedLinesFromDiff, aggregateRetrieval, aggregateSensors, aggregateUsage, allocateBudget, antiPatternGateParams, appendPreventionEvent, appendRuntimeJournalEntry, appendUsageEvent, briefingMarkerPath, briefingMarkersDir, buildCodeMap, buildDashboard, buildDocFrequency, buildFrontmatter, buildReport, bumpRead, codeMapPath, collectTimelineEntries, compareEvalReports, compareImpact, compileRegexSensor, computeImpact, computePreventionTrend, computeRecurrence, configPath, contractLockPath, deriveConfidence, diffContract, diffHasDistinctiveOverlap, distinctiveCap, draftsFromFindings, emptyUsage, emptyUsageIndex, enforcementDir, estimateTokens, evaluateSkillActivation, extractActionsBriefBody, extractSnippet, filterNewDrafts, findLexicalConflictPairs, findProjectRoot, findTopicStatusConflictPairs, findingBody, findingToDraft, firstMemoryOneLine, getUsage, globToRegExp, hasRecentBriefingMarker, inferModulesFromPaths, isAutoPromoteEligible, isDecaying, isDistinctiveToken, isFreshIsoDate, isGlobPath, isLikelyGuessable, isRetiredMemory, isSkill, isSkillSuppressed, isStackPackSeed, listMarkdownFilesRecursive, literalMatchesAllTokens, literalMatchesAnyToken, loadCodeMap, loadConfig, loadConfigSync, loadMemoriesFromDir, loadMemory, loadPreventionEvents, loadUsageIndex, memoryFilePath, memoryMatchesAnchorPaths, newMemoryId, normalizeFindingSeverity, normalizeSessionId, overallScore, parseFindings, parseMemory, parseSarif, parseSince, parseSonar, pathsOverlap, pickSnippetNeedle, preventionLogPath, pullCrossRepoSources, queryCodeMap, rankMemoriesLexical, readRecentBriefingMarker, readRuntimeJournalTail, readUsageEvents, recordApplied, recordPrevention, recordRejection, relPathFrom, resolveBriefingBudget, resolveHaivePaths, resolveManifestFiles, resolveProjectInfo, retirementSignal, runRegexSensor, runSensors, runtimeJournalPath, saveCodeMap, saveConfig, saveUsageIndex, scoreRetrievalCase, scoreSensorCase, sensorAppliesToPath, sensorTargetsFromDiff, serializeMemory, snapshotContract, specificityScore, stripPrivate, suggestSensorFromMemory, suggestTopicKey, summarizeImpact, synthesizeSelfEvalCases, titleFromBody, tokenizeQuery, tokenizeWords, trackDependencies, trackReads, truncateToTokens, usageLogPath, usageLogSize, usagePath, verifyAnchor, watchContracts, writeBriefingMarker };
1833
+ /**
1834
+ * Failure-capture coverage — the gate behind hAIve's "never silently fix the same mistake" loop.
1835
+ *
1836
+ * `haive observe` (the PostToolUse hook) appends an observation per tool call to
1837
+ * `.ai/.cache/observations.jsonl`, tagging hard failures with `failure_hint: true`
1838
+ * (non-zero Bash exit, `error TSxxxx`, ENOENT, …). Those failures are exactly the
1839
+ * `mem_tried` candidates the harness wants captured — otherwise the next session repeats them.
1840
+ *
1841
+ * This module is the pure decision layer: given the failure observations and the corpus's
1842
+ * `attempt`/`gotcha` memories, which failures look UNCAPTURED (no lesson recorded after them)?
1843
+ * The CLI reads the files and turns the result into an `enforce finish` finding. No I/O here.
1844
+ */
1845
+ interface FailureObservation {
1846
+ /** ISO timestamp of the observation. */
1847
+ ts: string;
1848
+ /** Tool that failed (Bash / Edit / …). */
1849
+ tool: string;
1850
+ /** Short human-readable summary of what was attempted. */
1851
+ summary: string;
1852
+ }
1853
+ interface UncapturedFailure {
1854
+ ts: string;
1855
+ tool: string;
1856
+ summary: string;
1857
+ }
1858
+ interface FailureCoverageOptions {
1859
+ /** Only consider failures newer than this many hours (avoid stale observations blocking forever). Default 24. */
1860
+ windowHours?: number;
1861
+ /** Collapse near-identical failures (same normalized summary) to one row. Default true. */
1862
+ dedupe?: boolean;
1863
+ now?: Date;
1864
+ }
1865
+ /**
1866
+ * A failure is CAPTURED when an `attempt`/`gotcha` lesson was recorded at or after it
1867
+ * (within the window) — the agent stopped and wrote the lesson down. Failures that pre-date
1868
+ * every recent capture are uncaptured: the gate should nudge (or block) on those.
1869
+ *
1870
+ * @param failures failure-tagged observations (any order)
1871
+ * @param captureTimes ISO created_at of every attempt/gotcha memory in the corpus
1872
+ */
1873
+ declare function findUncapturedFailures(failures: FailureObservation[], captureTimes: string[], options?: FailureCoverageOptions): UncapturedFailure[];
1874
+
1875
+ /**
1876
+ * Harness coverage-gap detection — "which churny files have NO team knowledge on them?".
1877
+ *
1878
+ * hAIve's `eval` synthesizes cases from the memories that EXIST (does the corpus surface
1879
+ * correctly?). It cannot tell you what knowledge is MISSING. This module answers the inverse,
1880
+ * proactive question Fowler frames as an open challenge: of the files the team edits most, which
1881
+ * carry no covering decision/convention/gotcha/architecture memory? Those are the blind spots
1882
+ * where a confident agent is most likely to violate an unwritten rule.
1883
+ *
1884
+ * Pure: the caller supplies hot files (from git history / briefing-radar) and the loaded corpus.
1885
+ */
1886
+
1887
+ interface HotFile {
1888
+ path: string;
1889
+ /** Number of times the file changed in the lookback window (the "heat"). */
1890
+ changes: number;
1891
+ }
1892
+ interface CoverageGap {
1893
+ path: string;
1894
+ changes: number;
1895
+ }
1896
+ interface CoverageOptions {
1897
+ /** Only flag files with at least this many changes. Default 3. */
1898
+ minChanges?: number;
1899
+ /** Memory types that count as "covering" a file. Default decision/convention/gotcha/architecture. */
1900
+ coveringTypes?: string[];
1901
+ /** Cap on returned gaps. Default 20. */
1902
+ limit?: number;
1903
+ }
1904
+ /**
1905
+ * Build the set of path prefixes the corpus covers: every anchor path of a non-dead,
1906
+ * non-recap covering memory. A file is covered if it equals, or sits under, one of them.
1907
+ */
1908
+ declare function buildCoverageIndex(memories: LoadedMemory[], coveringTypes?: string[]): Set<string>;
1909
+ /** True when `file` equals or is nested under any covered path prefix. */
1910
+ declare function isCovered(file: string, coverage: Set<string>): boolean;
1911
+ /**
1912
+ * Cross hot files with the coverage index → the uncovered, frequently-edited files.
1913
+ * Highest heat first. These are the highest-value places to add a memory or sensor.
1914
+ */
1915
+ declare function findCoverageGaps(hotFiles: HotFile[], memories: LoadedMemory[], options?: CoverageOptions): CoverageGap[];
1916
+
1917
+ interface EvalHistoryEntry {
1918
+ /** ISO timestamp of the eval run. */
1919
+ at: string;
1920
+ /** Overall 0..100 score. */
1921
+ score: number;
1922
+ /** Optional component metrics for richer trend views. */
1923
+ mean_recall?: number;
1924
+ mrr?: number;
1925
+ catch_rate?: number;
1926
+ /** Optional version/commit the run was taken at. */
1927
+ ref?: string;
1928
+ }
1929
+ declare function evalHistoryPath(paths: HaivePaths): string;
1930
+ /** Append one eval run to the history. Best-effort, creates the dir on demand. */
1931
+ declare function appendEvalHistory(paths: HaivePaths, entry: EvalHistoryEntry): Promise<void>;
1932
+ /** Read all eval runs (skips malformed lines). */
1933
+ declare function loadEvalHistory(paths: HaivePaths): Promise<EvalHistoryEntry[]>;
1934
+ interface EvalTrend {
1935
+ /** Most recent score, or null when there is no history. */
1936
+ latest: number | null;
1937
+ /** Score before the latest, or null. */
1938
+ previous: number | null;
1939
+ /** latest − previous (positive = improving). */
1940
+ delta: number | null;
1941
+ /** Best score ever recorded. */
1942
+ best: number | null;
1943
+ /** Number of runs recorded. */
1944
+ runs: number;
1945
+ /** Last N scores oldest → newest for a sparkline. */
1946
+ recent: number[];
1947
+ /** True when the latest run dropped vs the previous one. */
1948
+ regressed: boolean;
1949
+ }
1950
+ /** Pure trend over the history (chronological order is enforced internally). */
1951
+ declare function computeEvalTrend(entries: EvalHistoryEntry[], recentN?: number): EvalTrend;
1952
+
1953
+ /**
1954
+ * Contradiction resolution planning — turns "two memories conflict" into "do THIS".
1955
+ *
1956
+ * `conflict-candidates.ts` surfaces pairs (same topic with opposed status, or lexically near-
1957
+ * duplicate). That's detection, not resolution — and Fowler lists incoherence-at-scale (a harness
1958
+ * full of contradictory guides) as a core open challenge. This module decides, deterministically,
1959
+ * which memory of a pair should WIN and which should be superseded (deprecated), so the CLI can
1960
+ * apply it. Pure: no I/O, unit-tested.
1961
+ *
1962
+ * Decision order (strongest signal first):
1963
+ * 1. status — a `validated` memory beats a `rejected`/`deprecated`/`stale` one.
1964
+ * 2. revision — higher `revision_count` (more refined via topic-upsert) wins.
1965
+ * 3. recency — newer `created_at` wins (the team's latest word).
1966
+ */
1967
+
1968
+ interface ConflictResolution {
1969
+ /** Memory id to keep authoritative. */
1970
+ keep_id: string;
1971
+ /** Memory id to deprecate (superseded). */
1972
+ supersede_id: string;
1973
+ /** Human-readable reason the winner was chosen. */
1974
+ reason: string;
1975
+ /** stale_reason to stamp on the superseded memory. */
1976
+ stale_reason: string;
1977
+ }
1978
+ /** Compare two memories; returns the one that should WIN plus the reason. Pure. */
1979
+ declare function planConflictResolution(a: LoadedMemory, b: LoadedMemory): ConflictResolution;
1980
+
1981
+ /**
1982
+ * Cold-start seeding from git history — the harness has value only once the corpus is populated,
1983
+ * and a fresh repo starts empty (Fowler's "harnessability": greenfield is easy, legacy is hard).
1984
+ *
1985
+ * Reverts and fixups are the cheapest signal of a real, repo-specific mistake: a commit that had to
1986
+ * be undone or hot-fixed encodes a lesson the team already paid for. This module parses a list of
1987
+ * commits (the CLI runs `git log`) and proposes DRAFT `attempt` seeds — never validated, always
1988
+ * human-reviewed. Pure: the caller does the git I/O and the memory writes.
1989
+ */
1990
+ interface GitCommit {
1991
+ sha: string;
1992
+ subject: string;
1993
+ /** Files touched by the commit (optional — improves anchoring). */
1994
+ files?: string[];
1995
+ }
1996
+ interface SeedProposal {
1997
+ /** Kebab-ish slug derived from the reverted subject. */
1998
+ slug: string;
1999
+ /** What was tried (the thing that had to be reverted/fixed). */
2000
+ what: string;
2001
+ /** Why it failed (inferred from the revert/fixup). */
2002
+ why_failed: string;
2003
+ /** Suggested anchor paths (from the commit's files). */
2004
+ paths: string[];
2005
+ /** The source commit, for provenance. */
2006
+ source_sha: string;
2007
+ /** Detected signal kind. */
2008
+ kind: "revert" | "fixup";
2009
+ }
2010
+ /**
2011
+ * Turn commits into seed proposals. A `Revert "X"` commit proposes an attempt about X; an obvious
2012
+ * hotfix/fixup commit proposes an attempt about the fixed area. Deduped by slug. Pure.
2013
+ */
2014
+ declare function proposeSeedsFromCommits(commits: GitCommit[], limit?: number): SeedProposal[];
2015
+
2016
+ interface MergeResult {
2017
+ /** The chosen file content. */
2018
+ content: string;
2019
+ /** Which side won. */
2020
+ winner: "ours" | "theirs";
2021
+ /** Why (for logging). */
2022
+ reason: string;
2023
+ }
2024
+ /**
2025
+ * Resolve two versions of the same memory file. Returns the winning content and the rationale.
2026
+ * Falls back to "ours" when either side can't be parsed (never throws — a merge driver must not).
2027
+ */
2028
+ declare function mergeMemoryVersions(ours: string, theirs: string): MergeResult;
2029
+
2030
+ export { AUTOPILOT_DEFAULTS, type Activation, type ActivationContext, ActivationSchema, type Anchor, AnchorSchema, type AntiPatternGate, type AutoPromoteRule, BRIEFING_MARKER_TTL_MS, BRIEFING_PRESET_DEFAULTS, type BreakingChange, type BriefingBudgetNumbers, type BriefingBudgetPreset, type BriefingMarker, type BudgetPart, type BudgetSlice, type BuildCodeMapOptions, CHARS_PER_TOKEN, CODE_MAP_FILE, CODE_STOPWORDS, CONFIG_FILE, type CodeExport, type CodeExportKind, type CodeFileEntry, type CodeMap, type CodeMapQueryOptions, type CollectTimelineOpts, type CommandSensorSpec, type ConfidenceLevel, type ConfidenceThresholds, type ConflictCandidatePair, type ConflictCandidatesOpts, type ConflictResolution, type ContractDiffResult, type ContractFile, type ContractSnapshot, type CoverageGap, type CoverageOptions, CrossRepoProvenanceSchema, type CrossRepoReport, type CrossRepoSource, DECAY_DAYS, DEFAULT_AUTO_PROMOTE_RULE, DEFAULT_CONFIDENCE_THRESHOLDS, DEFAULT_CONFIG, DEFAULT_DORMANT_DAYS, type DashboardOptions, type DashboardReport, type DepChange, type DepTrackResult, type DependencySnapshot, type DocFrequency, type DormantRow, type DraftOptions, type DraftsOptions, type EvalDelta, type EvalHistoryEntry, type EvalReport, type EvalSpec, type EvalTrend, type FailureCoverageOptions, type FailureObservation, type Finding, type FindingSeverity, GUESSABLE_THRESHOLD, type GatePrecision, type GateTuningSuggestion, type GitCommit, HAIVE_DIR, type HaiveConfig, type HaivePaths, type HotFile, type ImpactOptions, type ImpactRow, type ImpactScore, type ImpactSummary, type ImpactTier, type LexicalRankResult, type LoadedMemory, MEMORIES_DIR, MIN_WORD_LEN, type Memory, type MemoryDraft, type MemoryFrontmatter, MemoryFrontmatterSchema, type MemoryScope, MemoryScopeSchema, type MemoryStatus, MemoryStatusSchema, type MemoryType, MemoryTypeSchema, type MemoryUsage, type MergeResult, type MetricDelta, PREVENTION_DEBOUNCE_MS, PROJECT_CONTEXT_FILE, PROJECT_CONTEXT_THROTTLE_MS, type PreventionEvent, type PreventionRow, type PreventionSource, type PreventionTrend, RUNTIME_JOURNAL_FILENAME, type RecurrenceReport, type RecurrenceRow, type ResolveProjectInfo, type RetirementSignal, type RetrievalAggregate, type RetrievalCase, type RetrievalCaseResult, type RuntimeJournalEntry, SESSION_RECAP_TTL_MS, STACK_PACK_TAG, type SeedProposal, type SelfEvalOptions, type Sensor, type SensorAggregate, type SensorCase, type SensorCaseResult, type SensorHit, type SensorRow, SensorSchema, type SensorSuggestionOptions, type SensorTarget, type SkillActivation, type TimelineEntry, type TopicStatusPair, type TruncateOptions, type TruncateResult, USAGE_FILE, USAGE_LOG_DIR, USAGE_LOG_FILE, type UncapturedFailure, type UsageAggregate, type UsageEvent, type UsageIndex, type VerifyOptions, type VerifyResult, addedLinesFromDiff, aggregateRetrieval, aggregateSensors, aggregateUsage, allocateBudget, antiPatternGateParams, appendEvalHistory, appendPreventionEvent, appendRuntimeJournalEntry, appendUsageEvent, briefingMarkerPath, briefingMarkersDir, buildCodeMap, buildCoverageIndex, buildDashboard, buildDocFrequency, buildFrontmatter, buildReport, bumpRead, codeMapPath, collectTimelineEntries, compareEvalReports, compareImpact, compileRegexSensor, computeEvalTrend, computeGatePrecision, computeImpact, computePreventionTrend, computeRecurrence, configPath, contractLockPath, deriveConfidence, diffContract, diffHasDistinctiveOverlap, distinctiveCap, draftsFromFindings, emptyUsage, emptyUsageIndex, enforcementDir, estimateTokens, evalHistoryPath, evaluateSkillActivation, extractActionsBriefBody, extractSnippet, filterNewDrafts, findCoverageGaps, findLexicalConflictPairs, findProjectRoot, findTopicStatusConflictPairs, findUncapturedFailures, findingBody, findingToDraft, firstMemoryOneLine, getUsage, globToRegExp, hasRecentBriefingMarker, hashProjectContext, inferModulesFromPaths, isAutoPromoteEligible, isCovered, isDecaying, isDistinctiveToken, isFreshIsoDate, isGlobPath, isLikelyGuessable, isRetiredMemory, isSkill, isSkillSuppressed, isStackPackSeed, listMarkdownFilesRecursive, literalMatchesAllTokens, literalMatchesAnyToken, loadCodeMap, loadConfig, loadConfigSync, loadEvalHistory, loadMemoriesFromDir, loadMemory, loadPreventionEvents, loadUsageIndex, memoryFilePath, memoryMatchesAnchorPaths, mergeMemoryVersions, newMemoryId, normalizeFindingSeverity, normalizeSessionId, overallScore, parseFindings, parseMemory, parseSarif, parseSince, parseSonar, pathsOverlap, pickSnippetNeedle, planConflictResolution, preventionLogPath, projectContextRecentlyEmitted, proposeSeedsFromCommits, pullCrossRepoSources, queryCodeMap, rankMemoriesLexical, readRecentBriefingMarker, readRuntimeJournalTail, readUsageEvents, recordApplied, recordPrevention, recordProjectContextEmission, recordRejection, relPathFrom, resolveBriefingBudget, resolveHaivePaths, resolveManifestFiles, resolveProjectInfo, retirementSignal, runRegexSensor, runSensors, runtimeJournalPath, saveCodeMap, saveConfig, saveUsageIndex, scoreRetrievalCase, scoreSensorCase, selectCommandSensors, sensorAppliesToPath, sensorTargetsFromDiff, serializeMemory, snapshotContract, specificityScore, stripPrivate, suggestGate, suggestSensorFromMemory, suggestTopicKey, summarizeImpact, synthesizeSelfEvalCases, titleFromBody, tokenizeQuery, tokenizeWords, trackDependencies, trackReads, truncateToTokens, usageLogPath, usageLogSize, usagePath, verifyAnchor, watchContracts, writeBriefingMarker };