@hiveai/core 0.15.0 → 0.18.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
@@ -565,6 +565,21 @@ interface ImpactSummary {
565
565
  }
566
566
  /** Roll up a set of impact scores into tier counts. */
567
567
  declare function summarizeImpact(scores: ImpactScore[]): ImpactSummary;
568
+ type FeedbackAdjustmentAction = "none" | "downgrade-block-sensor" | "deprecate-memory";
569
+ interface FeedbackAdjustment {
570
+ action: FeedbackAdjustmentAction;
571
+ reason: string;
572
+ }
573
+ interface FeedbackAdjustmentOptions {
574
+ /** Rejections needed before deprecating a memory with no positive outcomes. Defaults to 2. */
575
+ rejectionThreshold?: number;
576
+ }
577
+ /**
578
+ * Turn explicit human rejection (`mem_feedback outcome=rejected`) into a deterministic
579
+ * noise-reduction action. Pure: callers decide whether to persist the returned change.
580
+ */
581
+ declare function recommendFeedbackAdjustment(fm: MemoryFrontmatter, usage: MemoryUsage, options?: FeedbackAdjustmentOptions): FeedbackAdjustment;
582
+ declare function applyFeedbackAdjustment(fm: MemoryFrontmatter, adjustment: FeedbackAdjustment, now?: Date): MemoryFrontmatter;
568
583
 
569
584
  type PreventionSource = "sensor" | "anti-pattern";
570
585
  interface PreventionEvent {
@@ -608,6 +623,44 @@ interface RecurrenceReport {
608
623
  top: RecurrenceRow[];
609
624
  }
610
625
  declare function computeRecurrence(events: PreventionEvent[]): RecurrenceReport;
626
+ interface BriefingProofLineOptions {
627
+ /** End of the reporting window. Defaults to now. */
628
+ now?: Date;
629
+ /** Window size in days. Defaults to 30 ("this month" in product copy). */
630
+ days?: number;
631
+ }
632
+ /**
633
+ * Coordination point for Lot C: turn prevention events into one compact proof line
634
+ * suitable for get_briefing, without coupling this lot to the MCP tool.
635
+ */
636
+ declare function briefingProofLine(events: PreventionEvent[], options?: BriefingProofLineOptions): string | null;
637
+ interface CaughtForYouOptions {
638
+ /** Only include events at or after this instant. */
639
+ since?: string | Date;
640
+ /** Only include events at or before this instant. Defaults to now. */
641
+ now?: Date;
642
+ /** Max rows in the summary. Defaults to 5. */
643
+ limit?: number;
644
+ }
645
+ interface CaughtForYouRow {
646
+ id: string;
647
+ title: string;
648
+ source: PreventionSource;
649
+ catches: number;
650
+ previous_count: number;
651
+ current_count: number;
652
+ last_at: string;
653
+ }
654
+ interface CaughtForYouSummary {
655
+ total_catches: number;
656
+ since: string | null;
657
+ until: string;
658
+ rows: CaughtForYouRow[];
659
+ }
660
+ /** Build the end-of-session "caught for you" scene from prevention events. Pure. */
661
+ declare function summarizeCaughtForYou(events: PreventionEvent[], memories: LoadedMemory[], usage: UsageIndex, options?: CaughtForYouOptions): CaughtForYouSummary;
662
+ /** Render a compact human-readable block for CLI/session recaps. */
663
+ declare function renderCaughtForYou(summary: CaughtForYouSummary): string | null;
611
664
 
612
665
  /** How long an emitted project context is considered "still fresh in the agent's context". */
613
666
  declare const PROJECT_CONTEXT_THROTTLE_MS: number;
@@ -676,6 +729,12 @@ interface SensorCaseResult {
676
729
  }
677
730
  interface RetrievalAggregate {
678
731
  cases: RetrievalCaseResult[];
732
+ /**
733
+ * Top-k precision = expected hits ÷ surfaced results. Inherently LOW when only ~1 memory is
734
+ * expected per case but k results are surfaced (e.g. 1/8 ≈ 0.12) — this is a top-k artifact, not
735
+ * a quality defect. Retrieval quality is judged by `mean_recall` and `mrr`; precision is NOT part
736
+ * of the headline eval score (see `scoreEval`). Reported for completeness only.
737
+ */
679
738
  mean_precision: number;
680
739
  mean_recall: number;
681
740
  /** Mean reciprocal rank of the first expected hit — rewards ranking the right memory high. */
@@ -795,6 +854,19 @@ declare const STACK_PACK_TAG = "stack-pack";
795
854
  declare function isStackPackSeed(fm: {
796
855
  tags?: string[];
797
856
  } | null | undefined): boolean;
857
+ /**
858
+ * Tags that mark a memory as a *local dev-environment workaround* (hot-swap, nested node_modules,
859
+ * global-install quirks) rather than repo-specific team policy. These are real, but they describe
860
+ * tooling debt, not unguessable team knowledge — and because they get read on almost every session
861
+ * their read_count inflates and they crowd the briefing. Ranking caps them at `background` UNLESS
862
+ * they directly anchor a file being edited, so they stop displacing actual policy. The fix for a
863
+ * recurring one is to repair the environment, not to keep surfacing the note.
864
+ */
865
+ declare const ENV_WORKAROUND_TAGS: Set<string>;
866
+ /** True when a memory is tagged as a local dev-environment workaround (see {@link ENV_WORKAROUND_TAGS}). */
867
+ declare function isEnvWorkaroundMemory(fm: {
868
+ tags?: string[];
869
+ } | null | undefined): boolean;
798
870
  /**
799
871
  * Best-effort inference: given a list of file paths, infer module names from
800
872
  * conventional layouts (packages/X/, apps/X/, modules/X/, src/X/).
@@ -1180,6 +1252,13 @@ interface HaiveConfig {
1180
1252
  toolProfile?: "enforcement" | "maintenance" | "experimental" | "full";
1181
1253
  /** Named memory/policy families enabled for this project. */
1182
1254
  policyPacks?: string[];
1255
+ /**
1256
+ * Branch on which `enforce finish` enforces the release discipline (lockstep version bump +
1257
+ * matching pushed tag) as a HARD gate. On any other branch — feature/* or an integration branch
1258
+ * like `develop` — those same checks are advisory (warn), since the version/tag are produced when
1259
+ * releasing from this branch, not on every integration commit. Default: "main".
1260
+ */
1261
+ releaseBranch?: string;
1183
1262
  };
1184
1263
  }
1185
1264
  declare const DEFAULT_CONFIG: HaiveConfig;
@@ -1488,6 +1567,14 @@ declare function writeBriefingMarker(paths: HaivePaths, input: {
1488
1567
  source: string;
1489
1568
  memoryIds?: string[];
1490
1569
  files?: string[];
1570
+ /**
1571
+ * Accumulate memory_ids/files with the existing fresh marker for THIS session instead of
1572
+ * overwriting (default true). This is what lets decision-coverage build up as the agent works:
1573
+ * every get_briefing call, every pre-edit injection, every `haive briefing` ADDS to the
1574
+ * session's consulted set — so a broad commit no longer requires one giant briefing covering
1575
+ * every relevant decision at once. Pass false to replace (e.g. starting a brand-new session).
1576
+ */
1577
+ accumulate?: boolean;
1491
1578
  }): Promise<BriefingMarker>;
1492
1579
  declare function hasRecentBriefingMarker(paths: HaivePaths, sessionId?: string, ttlMs?: number): Promise<boolean>;
1493
1580
  declare function readRecentBriefingMarker(paths: HaivePaths, sessionId?: string, ttlMs?: number): Promise<BriefingMarker | null>;
@@ -1683,8 +1770,26 @@ declare function parseSarif(input: string | unknown): Finding[];
1683
1770
  * lives in `component` as `projectKey:relative/path`; we strip the project key.
1684
1771
  */
1685
1772
  declare function parseSonar(input: string | unknown): Finding[];
1773
+ /**
1774
+ * Parse the ESLint JSON formatter output (`eslint --format json`): an array of
1775
+ * `{ filePath, messages: [{ ruleId, severity, message, line }] }`. No SARIF formatter
1776
+ * package needed — this is ESLint's built-in format. `severity` is 2=error, 1=warning.
1777
+ * `opts.cwd`, when given, makes absolute `filePath`s project-relative so anchoring works.
1778
+ */
1779
+ declare function parseEslintJson(input: string | unknown, opts?: {
1780
+ cwd?: string;
1781
+ }): Finding[];
1782
+ /**
1783
+ * Parse `npm audit --json` output (`vulnerabilities` map). Each vulnerable package becomes one
1784
+ * finding anchored to `package.json` (vulnerabilities are dependency-level, not file-level), so
1785
+ * the next agent is warned before re-introducing or ignoring the advisory.
1786
+ */
1787
+ declare function parseNpmAudit(input: string | unknown): Finding[];
1788
+ type FindingFormat = "sarif" | "sonar" | "eslint" | "npm-audit";
1686
1789
  /** Dispatch to the right parser by declared format. */
1687
- declare function parseFindings(format: "sarif" | "sonar", input: string | unknown): Finding[];
1790
+ declare function parseFindings(format: FindingFormat, input: string | unknown, opts?: {
1791
+ cwd?: string;
1792
+ }): Finding[];
1688
1793
  /** Build the markdown body for a finding-derived memory. */
1689
1794
  declare function findingBody(finding: Finding): string;
1690
1795
  /** Convert one finding into a proposed memory draft (with a conservative sensor when derivable). */
@@ -1723,6 +1828,21 @@ interface GateTuningSuggestion {
1723
1828
  recommended: AntiPatternGate;
1724
1829
  reason: string;
1725
1830
  }
1831
+ interface GatePrecisionMetricDelta {
1832
+ baseline: number | null;
1833
+ current: number | null;
1834
+ delta: number | null;
1835
+ }
1836
+ interface GatePrecisionDelta {
1837
+ precision: GatePrecisionMetricDelta;
1838
+ rejections: GatePrecisionMetricDelta;
1839
+ /** True when humans rejected more gate output than the baseline run. */
1840
+ false_positives_increased: boolean;
1841
+ /** True when precision is known on both sides and dropped. */
1842
+ precision_regressed: boolean;
1843
+ /** CI-friendly rollup: either more false positives or lower known precision. */
1844
+ regressed: boolean;
1845
+ }
1726
1846
  /**
1727
1847
  * Compute the gate's signal quality from prevention events + usage.
1728
1848
  * @param currentGate the configured antiPatternGate, used to decide whether to suggest a change.
@@ -1734,6 +1854,8 @@ declare function computeGatePrecision(events: PreventionEvent[], usage: UsageInd
1734
1854
  * there isn't enough signal to act on.
1735
1855
  */
1736
1856
  declare function suggestGate(precision: number | null, rejections: number, currentGate: AntiPatternGate): GateTuningSuggestion | null;
1857
+ /** Compare gate signal quality against a baseline for CI regression gates. Pure. */
1858
+ declare function compareGatePrecision(baseline: GatePrecision, current: GatePrecision): GatePrecisionDelta;
1737
1859
 
1738
1860
  interface DashboardOptions {
1739
1861
  /** How many rows to include in each "top" list. Default 10. */
@@ -1781,6 +1903,19 @@ interface DashboardReport {
1781
1903
  by_type: Record<string, number>;
1782
1904
  by_status: Record<string, number>;
1783
1905
  };
1906
+ /** OUTCOME measurement: prevention events = times a memory's sensor/anti-pattern fired on a real
1907
+ * diff, intercepting a known mistake. Distinct from retrieval (reads) — demonstrated value. */
1908
+ prevention: {
1909
+ total_events: number;
1910
+ memories_with_catches: number;
1911
+ top: PreventionRow[];
1912
+ /** Catch volume over time (from the prevention event log). */
1913
+ trend: PreventionTrend;
1914
+ /** Lessons re-introduced after capture (caught on >= 2 distinct days). */
1915
+ recurrence: RecurrenceReport;
1916
+ };
1917
+ /** Inferential-gate signal quality: are catches real (useful) or noise (rejected)? + tuning hint. */
1918
+ gate_precision: GatePrecision;
1784
1919
  impact: ImpactSummary & {
1785
1920
  top: ImpactRow[];
1786
1921
  };
@@ -1806,19 +1941,6 @@ interface DashboardReport {
1806
1941
  decaying: number;
1807
1942
  top_dormant: DormantRow[];
1808
1943
  };
1809
- /** OUTCOME measurement: prevention events = times a memory's sensor/anti-pattern fired on a real
1810
- * diff, intercepting a known mistake. Distinct from retrieval (reads) — demonstrated value. */
1811
- prevention: {
1812
- total_events: number;
1813
- memories_with_catches: number;
1814
- top: PreventionRow[];
1815
- /** Catch volume over time (from the prevention event log). */
1816
- trend: PreventionTrend;
1817
- /** Lessons re-introduced after capture (caught on >= 2 distinct days). */
1818
- recurrence: RecurrenceReport;
1819
- };
1820
- /** Inferential-gate signal quality: are catches real (useful) or noise (rejected)? + tuning hint. */
1821
- gate_precision: GatePrecision;
1822
1944
  corpus: {
1823
1945
  /** Number of memory files (policy corpus, excludes session_recap). */
1824
1946
  memory_files: number;
@@ -2005,7 +2127,7 @@ interface SeedProposal {
2005
2127
  /** The source commit, for provenance. */
2006
2128
  source_sha: string;
2007
2129
  /** Detected signal kind. */
2008
- kind: "revert" | "fixup";
2130
+ kind: "revert" | "fixup" | "workaround";
2009
2131
  }
2010
2132
  /**
2011
2133
  * Turn commits into seed proposals. A `Revert "X"` commit proposes an attempt about X; an obvious
@@ -2013,6 +2135,42 @@ interface SeedProposal {
2013
2135
  */
2014
2136
  declare function proposeSeedsFromCommits(commits: GitCommit[], limit?: number): SeedProposal[];
2015
2137
 
2138
+ /**
2139
+ * Pure stack-detection helpers for cold-start seeding.
2140
+ *
2141
+ * Multi-language: reads package.json deps (JS/TS), requirements.txt (Python),
2142
+ * go.mod (Go), and pom.xml (Java/Spring) to produce the list of detected stacks.
2143
+ * No I/O — the caller reads the files and passes contents in, making this fully testable.
2144
+ */
2145
+ interface DetectStacksInput {
2146
+ /** Merged deps from package.json (dependencies + devDependencies). */
2147
+ packageJsonDeps?: Record<string, string>;
2148
+ /** Raw text of requirements.txt (or any requirements file). */
2149
+ requirementsTxt?: string;
2150
+ /** Raw text of go.mod. */
2151
+ goMod?: string;
2152
+ /** Raw text of pom.xml. */
2153
+ pomXml?: string;
2154
+ /** Raw text of composer.json (PHP). */
2155
+ composerJson?: string;
2156
+ /** Raw text of Gemfile (Ruby). */
2157
+ gemfile?: string;
2158
+ /** True when at least one .csproj/.sln file is present (.NET). */
2159
+ hasCsproj?: boolean;
2160
+ /** True when a Dockerfile is present. */
2161
+ hasDockerfile?: boolean;
2162
+ /** True when turbo.json is present (Turborepo). */
2163
+ hasTurboJson?: boolean;
2164
+ /** True when nx.json is present (Nx). */
2165
+ hasNxJson?: boolean;
2166
+ }
2167
+ type DetectableStack = "nestjs" | "nextjs" | "remix" | "react" | "express" | "fastify" | "prisma" | "drizzle" | "zustand" | "redux" | "reactquery" | "trpc" | "mongoose" | "graphql" | "vue" | "tailwind" | "vite" | "sveltekit" | "astro" | "typescript" | "monorepo" | "fastapi" | "django" | "flask" | "go" | "spring" | "laravel" | "rails" | "dotnet" | "docker";
2168
+ /**
2169
+ * Detect stacks present in a project from the raw contents of its manifest files.
2170
+ * Pure — no I/O. Pass what you have; omit what you don't.
2171
+ */
2172
+ declare function detectStacksFromManifests(input: DetectStacksInput): DetectableStack[];
2173
+
2016
2174
  interface MergeResult {
2017
2175
  /** The chosen file content. */
2018
2176
  content: string;
@@ -2027,4 +2185,147 @@ interface MergeResult {
2027
2185
  */
2028
2186
  declare function mergeMemoryVersions(ours: string, theirs: string): MergeResult;
2029
2187
 
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 };
2188
+ /**
2189
+ * Recap compaction — keep the auto-generated session recap from dominating the briefing head.
2190
+ *
2191
+ * The MCP server auto-saves a minimal recap on exit (goal = "Auto-captured session (N tool calls)",
2192
+ * body = a raw tool-call/file dump). It's low signal, yet get_briefing shows the freshest recap's
2193
+ * full body at the very top of every briefing. A human/post_task recap (with a real Discoveries
2194
+ * section) is far richer. This module detects an auto recap and compresses it to its useful core
2195
+ * (the Discoveries, if any) so it informs without crowding. Pure, unit-tested.
2196
+ */
2197
+ /**
2198
+ * True when a recap body looks auto-generated (vs. a human/post_task recap). Auto recaps come in a
2199
+ * couple of shapes, all low-signal: the session-tracker's "Auto-captured session (N tool calls)" and
2200
+ * the run-wrapper's "Edited N files across M tool calls". The common tell is a raw tool-call count.
2201
+ */
2202
+ declare function isAutoRecap(body: string): boolean;
2203
+ /**
2204
+ * Return a compact version of an auto recap body: a one-line header (the Goal line) plus the
2205
+ * Discoveries section when it carries real content (e.g. detected failures). Non-auto recaps are
2206
+ * returned unchanged.
2207
+ */
2208
+ declare function compactAutoRecapBody(body: string, maxChars?: number): string;
2209
+
2210
+ type MemoryPriority = "must_read" | "useful" | "background";
2211
+ /**
2212
+ * Normalized priority evidence. A caller fills only the signals it can compute; unknown ones default
2213
+ * to false (see {@link DEFAULT_PRIORITY_SIGNALS}). The MCP path has semantic scores; the CLI path has
2214
+ * lexical scores — both reduce to these booleans.
2215
+ */
2216
+ interface PrioritySignals {
2217
+ /** Memory type (attempt, gotcha, skill, decision, …). */
2218
+ type: string;
2219
+ /** Memory tags — used for the stack-pack / env-workaround down-rank. */
2220
+ tags: string[];
2221
+ /** The memory demands explicit human approval — always surface first. */
2222
+ requiresHumanApproval: boolean;
2223
+ /** Anchored to a file the agent is editing. */
2224
+ directAnchor: boolean;
2225
+ /** Anchored to a symbol the agent requested. */
2226
+ directSymbol: boolean;
2227
+ /** Exact/literal task match (semantic match_quality "exact", or an exact lexical task hit). */
2228
+ exactTaskMatch: boolean;
2229
+ /** Strong semantic relevance (cosine ≥ 0.65). CLI has no embeddings → passes false. */
2230
+ strongSemantic: boolean;
2231
+ /** Useful-level relevance: semantic ≥ 0.35, a partial task hit, or a high lexical score. */
2232
+ usefulSemantic: boolean;
2233
+ /** Matched an inferred module or domain from the touched files. */
2234
+ moduleOrDomainMatch: boolean;
2235
+ /** A memory tag matched a task token. */
2236
+ tagTaskMatch: boolean;
2237
+ }
2238
+ declare const DEFAULT_PRIORITY_SIGNALS: PrioritySignals;
2239
+ /** Convenience: build a full signal set from a partial one. */
2240
+ declare function prioritySignals(partial: Partial<PrioritySignals>): PrioritySignals;
2241
+ /**
2242
+ * Classify a memory's briefing priority from its signals. Order matters:
2243
+ * 1. must_read — human-approval gates, direct anchor/symbol matches, and exact/strong hits on
2244
+ * negative (attempt) or skill memories: the things an agent must not miss.
2245
+ * 2. background (down-rank) — generic stack-pack seeds and local dev-environment workarounds never
2246
+ * claim `useful` on a semantic/tag match alone; they'd crowd out repo-specific knowledge. (A
2247
+ * direct anchor already promoted them to must_read above, so genuinely-relevant ones still rank.)
2248
+ * 3. useful — skills, module/domain matches, exact hits, and useful-level relevance.
2249
+ * 4. background — everything else.
2250
+ */
2251
+ declare function classifyMemoryPriority(signals: PrioritySignals): MemoryPriority;
2252
+ declare function priorityRank(priority: MemoryPriority): number;
2253
+
2254
+ /**
2255
+ * Native bridge generator — produces agent-harness-specific config files
2256
+ * from the hAIve corpus (validated memories + block sensors).
2257
+ *
2258
+ * One pure formatter per target; no I/O.
2259
+ * The CLI command (cli/commands/bridges.ts) handles file writes and
2260
+ * idempotent marker-based updates.
2261
+ *
2262
+ * Exposed for Lot A (init.ts): call generateBridges() from haive init
2263
+ * to seed all bridges at initialisation time.
2264
+ */
2265
+
2266
+ type BridgeTarget = "claude" | "cursor" | "cline" | "windsurf" | "continue" | "cody" | "zed" | "roo" | "gemini" | "aider" | "agents" | "copilot";
2267
+ /** Canonical relative path from project root for each target. */
2268
+ declare const BRIDGE_TARGET_PATH: Record<BridgeTarget, string>;
2269
+ declare const BRIDGE_TARGETS: BridgeTarget[];
2270
+ /**
2271
+ * Condensed sensor shape for bridge injection.
2272
+ * Callers extract this from Memory.frontmatter.sensor — no sensor-module import needed.
2273
+ */
2274
+ interface BridgeSensor {
2275
+ id: string;
2276
+ severity: "block" | "warn";
2277
+ message: string;
2278
+ /** Regex pattern, present when sensor.kind === "regex". */
2279
+ pattern?: string;
2280
+ /** Scoped file paths (sensor.paths ?? anchor.paths). */
2281
+ paths: string[];
2282
+ }
2283
+ interface BridgeMemoryEntry {
2284
+ id: string;
2285
+ scope: string;
2286
+ type: string;
2287
+ summary: string;
2288
+ /** Anchor paths the memory applies to (for path-scoped display / Cursor globs). */
2289
+ paths: string[];
2290
+ }
2291
+ interface GenerateBridgesOptions {
2292
+ /** Max memories to inject per bridge (default: 8). */
2293
+ maxMemories?: number;
2294
+ /** Restrict generation to these targets. Defaults to all BRIDGE_TARGETS. */
2295
+ targets?: BridgeTarget[];
2296
+ }
2297
+ interface BridgeFileOutput {
2298
+ target: BridgeTarget;
2299
+ /** Relative path from project root. */
2300
+ path: string;
2301
+ content: string;
2302
+ }
2303
+ declare const BRIDGE_MARKERS: {
2304
+ readonly memoriesStart: "<!-- haive:memories-start -->";
2305
+ readonly memoriesEnd: "<!-- haive:memories-end -->";
2306
+ readonly sensorsStart: "<!-- haive:sensors-start -->";
2307
+ readonly sensorsEnd: "<!-- haive:sensors-end -->";
2308
+ };
2309
+ /** First meaningful line of a memory body, condensed for bridge display. */
2310
+ declare function bridgeMemorySummary(body: string): string;
2311
+ /**
2312
+ * Filter and rank memories + sensors for bridge injection.
2313
+ * Pure — callers load data; this function does not read files.
2314
+ */
2315
+ declare function prepareBridgeData(memories: Memory[], sensors: BridgeSensor[], opts?: Pick<GenerateBridgesOptions, "maxMemories">): {
2316
+ topMemories: BridgeMemoryEntry[];
2317
+ blockSensors: BridgeSensor[];
2318
+ };
2319
+ /**
2320
+ * Generate bridge file content for the requested targets.
2321
+ *
2322
+ * Pure: accepts loaded memories + sensors, returns file content strings.
2323
+ * The CLI command handles I/O and idempotent marker-based updates.
2324
+ *
2325
+ * **Lot A integration point**: call this from `haive init` to seed bridges at initialisation.
2326
+ * Signature is intentionally stable — init.ts should call:
2327
+ * `generateBridges(memories, sensors, { targets: BRIDGE_TARGETS })`
2328
+ */
2329
+ declare function generateBridges(memories: Memory[], sensors: BridgeSensor[], opts?: GenerateBridgesOptions): BridgeFileOutput[];
2330
+
2331
+ export { AUTOPILOT_DEFAULTS, type Activation, type ActivationContext, ActivationSchema, type Anchor, AnchorSchema, type AntiPatternGate, type AutoPromoteRule, BRIDGE_MARKERS, BRIDGE_TARGETS, BRIDGE_TARGET_PATH, BRIEFING_MARKER_TTL_MS, BRIEFING_PRESET_DEFAULTS, type BreakingChange, type BridgeFileOutput, type BridgeMemoryEntry, type BridgeSensor, type BridgeTarget, type BriefingBudgetNumbers, type BriefingBudgetPreset, type BriefingMarker, type BriefingProofLineOptions, type BudgetPart, type BudgetSlice, type BuildCodeMapOptions, CHARS_PER_TOKEN, CODE_MAP_FILE, CODE_STOPWORDS, CONFIG_FILE, type CaughtForYouOptions, type CaughtForYouRow, type CaughtForYouSummary, 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, DEFAULT_PRIORITY_SIGNALS, type DashboardOptions, type DashboardReport, type DepChange, type DepTrackResult, type DependencySnapshot, type DetectStacksInput, type DetectableStack, type DocFrequency, type DormantRow, type DraftOptions, type DraftsOptions, ENV_WORKAROUND_TAGS, type EvalDelta, type EvalHistoryEntry, type EvalReport, type EvalSpec, type EvalTrend, type FailureCoverageOptions, type FailureObservation, type FeedbackAdjustment, type FeedbackAdjustmentAction, type FeedbackAdjustmentOptions, type Finding, type FindingFormat, type FindingSeverity, GUESSABLE_THRESHOLD, type GatePrecision, type GatePrecisionDelta, type GatePrecisionMetricDelta, type GateTuningSuggestion, type GenerateBridgesOptions, 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 MemoryPriority, 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, type PrioritySignals, 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, applyFeedbackAdjustment, bridgeMemorySummary, briefingMarkerPath, briefingMarkersDir, briefingProofLine, buildCodeMap, buildCoverageIndex, buildDashboard, buildDocFrequency, buildFrontmatter, buildReport, bumpRead, classifyMemoryPriority, codeMapPath, collectTimelineEntries, compactAutoRecapBody, compareEvalReports, compareGatePrecision, compareImpact, compileRegexSensor, computeEvalTrend, computeGatePrecision, computeImpact, computePreventionTrend, computeRecurrence, configPath, contractLockPath, deriveConfidence, detectStacksFromManifests, diffContract, diffHasDistinctiveOverlap, distinctiveCap, draftsFromFindings, emptyUsage, emptyUsageIndex, enforcementDir, estimateTokens, evalHistoryPath, evaluateSkillActivation, extractActionsBriefBody, extractSnippet, filterNewDrafts, findCoverageGaps, findLexicalConflictPairs, findProjectRoot, findTopicStatusConflictPairs, findUncapturedFailures, findingBody, findingToDraft, firstMemoryOneLine, generateBridges, getUsage, globToRegExp, hasRecentBriefingMarker, hashProjectContext, inferModulesFromPaths, isAutoPromoteEligible, isAutoRecap, isCovered, isDecaying, isDistinctiveToken, isEnvWorkaroundMemory, 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, parseEslintJson, parseFindings, parseMemory, parseNpmAudit, parseSarif, parseSince, parseSonar, pathsOverlap, pickSnippetNeedle, planConflictResolution, prepareBridgeData, preventionLogPath, priorityRank, prioritySignals, projectContextRecentlyEmitted, proposeSeedsFromCommits, pullCrossRepoSources, queryCodeMap, rankMemoriesLexical, readRecentBriefingMarker, readRuntimeJournalTail, readUsageEvents, recommendFeedbackAdjustment, recordApplied, recordPrevention, recordProjectContextEmission, recordRejection, relPathFrom, renderCaughtForYou, resolveBriefingBudget, resolveHaivePaths, resolveManifestFiles, resolveProjectInfo, retirementSignal, runRegexSensor, runSensors, runtimeJournalPath, saveCodeMap, saveConfig, saveUsageIndex, scoreRetrievalCase, scoreSensorCase, selectCommandSensors, sensorAppliesToPath, sensorTargetsFromDiff, serializeMemory, snapshotContract, specificityScore, stripPrivate, suggestGate, suggestSensorFromMemory, suggestTopicKey, summarizeCaughtForYou, summarizeImpact, synthesizeSelfEvalCases, titleFromBody, tokenizeQuery, tokenizeWords, trackDependencies, trackReads, truncateToTokens, usageLogPath, usageLogSize, usagePath, verifyAnchor, watchContracts, writeBriefingMarker };