@hivelore/core 0.57.3 → 0.57.5

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
@@ -304,6 +304,16 @@ declare const MemoryFrontmatterSchema: z.ZodEffects<z.ZodObject<{
304
304
  * Lets a human distinguish reviewed knowledge from AI/auto-trusted knowledge.
305
305
  */
306
306
  validated_by: z.ZodDefault<z.ZodNullable<z.ZodEnum<["human", "agent", "auto"]>>>;
307
+ /**
308
+ * Does this memory describe code that EXISTS today, or a decision not yet built? Orthogonal to
309
+ * `confidence`/`status`: a `planned` decision can be fully trusted AS a decision while being false
310
+ * AS a description of the current code. Surfaced distinctly in briefings so an agent does not write
311
+ * code against a cookie/route/Node version that was only decided, never implemented (field report §3.3).
312
+ * applied — reflected in the code now (the default when omitted)
313
+ * planned — decided/intended, NOT yet implemented
314
+ * abandoned — considered and rejected; kept so it is not re-attempted
315
+ */
316
+ lifecycle: z.ZodOptional<z.ZodEnum<["applied", "planned", "abandoned"]>>;
307
317
  }, "strip", z.ZodTypeAny, {
308
318
  type: "convention" | "decision" | "gotcha" | "architecture" | "glossary" | "skill" | "attempt" | "session_recap";
309
319
  status: "draft" | "proposed" | "validated" | "deprecated" | "stale" | "rejected";
@@ -351,6 +361,7 @@ declare const MemoryFrontmatterSchema: z.ZodEffects<z.ZodObject<{
351
361
  domain?: string | undefined;
352
362
  author?: string | undefined;
353
363
  topic?: string | undefined;
364
+ lifecycle?: "applied" | "planned" | "abandoned" | undefined;
354
365
  }, {
355
366
  type: "convention" | "decision" | "gotcha" | "architecture" | "glossary" | "skill" | "attempt" | "session_recap";
356
367
  id: string;
@@ -398,6 +409,7 @@ declare const MemoryFrontmatterSchema: z.ZodEffects<z.ZodObject<{
398
409
  revision_count?: number | undefined;
399
410
  requires_human_approval?: boolean | undefined;
400
411
  validated_by?: "human" | "agent" | "auto" | null | undefined;
412
+ lifecycle?: "applied" | "planned" | "abandoned" | undefined;
401
413
  }>, {
402
414
  type: "convention" | "decision" | "gotcha" | "architecture" | "glossary" | "skill" | "attempt" | "session_recap";
403
415
  status: "draft" | "proposed" | "validated" | "deprecated" | "stale" | "rejected";
@@ -445,6 +457,7 @@ declare const MemoryFrontmatterSchema: z.ZodEffects<z.ZodObject<{
445
457
  domain?: string | undefined;
446
458
  author?: string | undefined;
447
459
  topic?: string | undefined;
460
+ lifecycle?: "applied" | "planned" | "abandoned" | undefined;
448
461
  }, {
449
462
  type: "convention" | "decision" | "gotcha" | "architecture" | "glossary" | "skill" | "attempt" | "session_recap";
450
463
  id: string;
@@ -492,6 +505,7 @@ declare const MemoryFrontmatterSchema: z.ZodEffects<z.ZodObject<{
492
505
  revision_count?: number | undefined;
493
506
  requires_human_approval?: boolean | undefined;
494
507
  validated_by?: "human" | "agent" | "auto" | null | undefined;
508
+ lifecycle?: "applied" | "planned" | "abandoned" | undefined;
495
509
  }>;
496
510
  declare const CrossRepoProvenanceSchema: z.ZodOptional<z.ZodObject<{
497
511
  source_name: z.ZodString;
@@ -542,6 +556,7 @@ declare function buildFrontmatter(input: {
542
556
  relatedIds?: string[];
543
557
  sensor?: Sensor;
544
558
  activation?: Activation;
559
+ lifecycle?: MemoryFrontmatter["lifecycle"];
545
560
  }): MemoryFrontmatter;
546
561
 
547
562
  declare const HAIVE_DIR = ".ai";
@@ -1159,6 +1174,19 @@ declare function auditAnchorSpecificity(memories: ReadonlyArray<{
1159
1174
  anchorPaths: readonly string[];
1160
1175
  }>, fileChurn: AnchorChurn, totalCommits: number): AnchorAuditRow[];
1161
1176
 
1177
+ /**
1178
+ * One ordering for dotted version strings, shared by everything in the release chain.
1179
+ *
1180
+ * There were three byte-identical copies of this — two in core, one in the CLI — because each new
1181
+ * release check wrote its own rather than look for one. Ordering is the kind of thing that must
1182
+ * not disagree with itself between two gates reading the same tags.
1183
+ *
1184
+ * Deliberately lenient, not a semver parser: it splits on `.` and `-`, reads each part as an
1185
+ * integer and treats anything unparseable as 0. Inputs here are tags and registry versions the
1186
+ * repo produced itself, and a comparator that throws would turn an advisory check into a crash.
1187
+ */
1188
+ declare function compareVersions(a: string, b: string): number;
1189
+
1162
1190
  /**
1163
1191
  * Did the tagged releases actually reach the registry?
1164
1192
  *
@@ -1195,6 +1223,52 @@ interface NpmPublicationVerdict {
1195
1223
  }
1196
1224
  declare function classifyNpmPublication(input: NpmPublicationInput): NpmPublicationVerdict;
1197
1225
 
1226
+ /**
1227
+ * Did the tags that were meant to be releases become GitHub Releases?
1228
+ *
1229
+ * The npm check ([[npm-publication.ts]]) closed one end of the release chain. This closes the
1230
+ * other. They are not the same signal: npm is where the code is *installed from*, a GitHub Release
1231
+ * is where the version is *announced* — changelog, provenance, and the thing listing directories
1232
+ * and score checkers read to decide whether a project ships. This repo carried 190 version tags
1233
+ * and zero Releases, and the only reason anyone noticed was a third-party listing scoring it down.
1234
+ *
1235
+ * ## The pre-adoption rule is the whole design
1236
+ *
1237
+ * A repo that adopts Releases at version 0.57 has 189 older tags that were never going to be
1238
+ * Releases. Calling those "skipped" would mean a permanent warning that no action can ever clear,
1239
+ * and a warning you cannot clear is one people learn to scroll past. So only tags **newer than the
1240
+ * oldest Release** count: gaps that opened *after* the repo started releasing. Adopting the
1241
+ * practice retroactively cleans nothing, and is not asked to.
1242
+ *
1243
+ * Severities mirror the npm check exactly, and for the same reason — `finish` runs BEFORE you
1244
+ * publish, so "HEAD has no Release yet" is the normal state and can only be info. Never an error:
1245
+ * publishing is the human's call.
1246
+ *
1247
+ * Pure: listing tags and asking GitHub happen in the caller.
1248
+ */
1249
+ type GithubReleaseCode = "github-release-published" | "github-release-pending" | "github-releases-skipped" | "github-releases-absent" | "github-release-unverified";
1250
+ interface GithubReleaseInput {
1251
+ /** Version in the working tree (the lockstep version). */
1252
+ localVersion: string;
1253
+ /**
1254
+ * Versions that have a published, non-draft GitHub Release. `null` means the lookup could not
1255
+ * run at all — no `gh`, no network, not a GitHub remote — which is "cannot tell", not a defect.
1256
+ */
1257
+ releasedVersions: readonly string[] | null;
1258
+ /** Every version tag in the repo, without the `v` prefix. */
1259
+ taggedVersions: readonly string[];
1260
+ /** How to create one, injected so core stays free of tooling opinions. */
1261
+ releaseHint?: string;
1262
+ }
1263
+ interface GithubReleaseVerdict {
1264
+ code: GithubReleaseCode;
1265
+ severity: "ok" | "info" | "warn";
1266
+ message: string;
1267
+ fix?: string;
1268
+ }
1269
+ /** `null` when there is nothing worth saying — an untagged repo has no release chain to check. */
1270
+ declare function classifyGithubRelease(input: GithubReleaseInput): GithubReleaseVerdict | null;
1271
+
1198
1272
  type MemoryPriority = "must_read" | "useful" | "background";
1199
1273
  /**
1200
1274
  * Normalized priority evidence. A caller fills only the signals it can compute; unknown ones default
@@ -2028,6 +2102,16 @@ interface HaiveConfig {
2028
2102
  * unpublished release looks exactly like a shipped one.
2029
2103
  */
2030
2104
  npmPublishCheck?: "off" | "warn";
2105
+ /**
2106
+ * Whether `hivelore enforce finish` checks that tagged versions became GitHub Releases.
2107
+ * Default on; set "off" for repos that deliberately tag without releasing.
2108
+ *
2109
+ * It never blocks, and it never asks you to backfill: only tags NEWER than the oldest existing
2110
+ * Release are reported as gaps, so adopting Releases mid-history does not produce a warning
2111
+ * that no action can clear. A repo with tags and no Release at all gets one info line — tags
2112
+ * are not Releases, and listing/scoring tools read Releases.
2113
+ */
2114
+ githubReleaseCheck?: "off" | "warn";
2031
2115
  /**
2032
2116
  * How `hivelore enforce finish` reacts to hard failures observed this session that were never
2033
2117
  * captured as a lesson (`mem_tried`):
@@ -2555,8 +2639,10 @@ declare function isRetiredMemory(fm: MemoryFrontmatter, body?: string, now?: Dat
2555
2639
  /**
2556
2640
  * Is a regex sensor pattern brittle — over-fit to incident-specific literals that rot when code
2557
2641
  * shifts (hardcoded line numbers / ranges like `1131-1186`)? High-precision by design: digits that
2558
- * live inside a character class (`[0-9]`) or quantifier (`{2,}`) generalize and are NOT flagged, so
2559
- * durable patterns like `v[0-9]+\.[0-9]+` or `:\s*any\b` stay clean. Returns a short reason or null.
2642
+ * live inside a character class (`[0-9]`) or quantifier (`{2,}`), regex escapes (`\d`, `\w`, `\s`),
2643
+ * or a dotted-quad IP / version literal (`127\.0\.0\.1`, `1\.2\.3`) all GENERALIZE and are NOT
2644
+ * flagged — so durable patterns like `v[0-9]+\.[0-9]+`, `:\s*any\b`, or `https?://127\.0\.0\.1:\d+`
2645
+ * stay clean. Returns a short reason naming the offending token, or null.
2560
2646
  *
2561
2647
  * Used to keep brittle legacy sensors from being counted as real protection or promoted to `block`.
2562
2648
  */
@@ -4023,4 +4109,4 @@ interface ReviewDraftOptions {
4023
4109
  /** Template review learnings into proposed-memory drafts (reuses the scanner-ingest draft shape). */
4024
4110
  declare function reviewLearningsToDrafts(learnings: ReviewLearning[], options?: ReviewDraftOptions): MemoryDraft[];
4025
4111
 
4026
- export { AUTOPILOT_DEFAULTS, type Activation, type ActivationContext, ActivationSchema, type AgentContext, type Anchor, type AnchorAuditRow, type AnchorChurn, AnchorSchema, type AntiPatternGate, type AppendFrictionInput, type AppendFrictionResult, type AppliedConflictResolution, type AstExport, type AutoPromoteRule, BRIDGE_MARKERS, BRIDGE_TARGETS, BRIDGE_TARGET_PATH, BRIEFING_MARKER_TTL_MS, BRIEFING_PRESET_DEFAULTS, type BaselineHealth, type BehaviourCoverageInput, type BehaviourCoverageMetrics, type BehaviourOracleInfo, type BootstrapAssessment, type BootstrapGap, type BootstrapGate, type BootstrapMetrics, type BootstrapState, type BootstrapStateInput, 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_DEFAULT_EXCLUDE, CODE_MAP_DEFAULT_INCLUDE, CODE_MAP_FILE, CODE_STOPWORDS, CONFIG_FILE, CONTENT_CATCH_CODES, 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 ContractCheck, type ContractDiffResult, type ContractFile, type ContractSnapshot, type CoverageGap, type CoverageOptions, CrossRepoProvenanceSchema, type CrossRepoReport, type CrossRepoSource, DECAY_DAYS, DEFAULT_AUTO_PROMOTE_RULE, DEFAULT_BRIEFING_EXCLUDE_TAGS, DEFAULT_CONFIDENCE_THRESHOLDS, DEFAULT_CONFIG, DEFAULT_DORMANT_DAYS, DEFAULT_POSTURE, DEFAULT_PRIORITY_SIGNALS, DEFAULT_SPECIFICITY, type DashboardOptions, type DashboardReport, type DepChange, type DepTrackResult, type DependencySnapshot, type DetectStacksInput, type DetectableStack, type DistilledFailureLesson, type DocFrequency, type DormantRow, type DraftOptions, type DraftsOptions, ENV_WORKAROUND_TAGS, type EvalDelta, type EvalHistoryEntry, type EvalReport, type EvalSpec, type EvalTrend, FRICTION_FIELD_MAX, FRICTION_LOG_FILE, FRICTION_STATE_FILE, type FailureCoverageOptions, type FailureObservation, type FeedbackAdjustment, type FeedbackAdjustmentAction, type FeedbackAdjustmentOptions, type Finding, type FindingFormat, type FindingSeverity, type FrictionGroup, type FrictionKind, type FrictionReport, type FrictionState, type FrictionStateEntry, type FrictionStatus, GATE_REMINDER_WINDOW_MS, GUESSABLE_THRESHOLD, type GateFinding, type GateMissProposal, type GatePolicy, type GatePolicyInput, type GatePosture, type GatePrecision, type GatePrecisionDelta, type GatePrecisionMetricDelta, type GateSeverity, type GateStage, type GateTuningSuggestion, type GateVerdict, type GateVerdictInput, type GenerateBridgesOptions, type GitCommit, type GitWatchPlan, type GitWatchState, HAIVE_DIR, HAIVE_OWNED_FILES, HANDOFF_FILENAME, HIVELORE_ATTRIBUTION, type HaiveConfig, type HaivePaths, type HotFile, type HotFileSource, type ImpactOptions, type ImpactRow, type ImpactScore, type ImpactSummary, type ImpactTier, type IncidentHints, type InvalidMemoryFile, LEGACY_CONFIG_FILE, 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, type NpmPublicationCode, type NpmPublicationInput, type NpmPublicationVerdict, PREVENTION_DEBOUNCE_MS, PREVENTION_RECEIPT_MARKER, PROCESS_GATE_CODES, PROJECT_CONTEXT_FILE, PROJECT_CONTEXT_THROTTLE_MS, type PostIncidentLesson, type PreventionCommentFinding, type PreventionEvent, type PreventionEventDetail, type PreventionReceipt, type PreventionReceiptRow, type PreventionRow, type PreventionSource, type PreventionTrend, type PrioritySignals, type ProposedEvalSpec, type ProposedSensorVerdict, REVIEW_LEARNING_MARKER, RUNTIME_JOURNAL_FILENAME, type RecurrenceReport, type RecurrenceRow, type ResolveProjectInfo, type RetirementSignal, type RetrievalAggregate, type RetrievalCase, type RetrievalCaseResult, type ReviewDraftOptions, type ReviewLearning, type RuntimeJournalEntry, SCAFFOLD_MARKER_RE, SEED_QUALITY_FLOOR, SENSOR_ABSENT_LOOKBACK, SENSOR_ABSENT_WINDOW, SESSION_RECAP_TTL_MS, SETUP_GATE_CODES, STACK_PACK_TAG, type ScaffoldLoopGap, type ScaffoldOptions, type ScaffoldStyle, type SeedProposal, type SelfEvalOptions, type Sensor, type SensorAggregate, type SensorCase, type SensorCaseResult, type SensorEvaluation, type SensorEvaluationOutcome, type SensorEvaluationStage, type SensorFlap, type SensorHealth, type SensorHit, type SensorRow, SensorSchema, type SensorSeed, type SensorSelfCheck, type SensorSuggestionOptions, type SensorTarget, type SensorWeakening, type SessionHandoffData, type SkillActivation, TEST_FRAMEWORKS, type TestFramework, type TestScaffold, type TierContractCheck, type TimelineEntry, type TopicStatusPair, type TruncateOptions, type TruncateResult, USAGE_FILE, USAGE_LOG_DIR, USAGE_LOG_FILE, type UncapturedFailure, type UncoveredAreaSuggestion, type UsageAggregate, type UsageEvent, type UsageIndex, type VerifyOptions, type VerifyResult, WEAK_ANCHOR_CHURN_RATIO, addedLineNumbersFromDiff, addedLinesFromDiff, aggregateRetrieval, aggregateSensors, aggregateUsage, allocateBudget, anchorMatchesComponent, anchorSpecificity, antiPatternGateParams, appendEvalHistory, appendFrictionReport, appendPreventionEvent, appendProposedRetrievalCases, appendRuntimeJournalEntry, appendSensorEvaluations, appendUsageEvent, applyConflictResolution, applyFeedbackAdjustment, approveProposedCases, assessBehaviourCoverage, assessBootstrapState, assessScaffoldLoop, assessSensorHealth, auditAnchorSpecificity, bridgeMemorySummary, briefingMarkerPath, briefingMarkersDir, briefingProofLine, buildBaselineHealthFinding, buildCodeMap, buildCoverageIndex, buildDashboard, buildDocFrequency, buildFrontmatter, buildHandoffMarkdown, buildPreventionReceipt, buildProposeCommand, buildReport, bumpRead, churnForAnchors, classifyMemoryPriority, classifyNpmPublication, codeMapContentHash, codeMapPath, collectTimelineEntries, compactAutoRecapBody, compareEvalReports, compareGatePrecision, compareImpact, compileRegexSensor, componentOf, computeBaselineHealth, computeEvalTrend, computeGatePrecision, computeImpact, computePreventionTrend, computeRecurrence, computeScopeHash, configPath, contractLockPath, countSourceFilesOnDisk, decideVerdict, dedupeRefusals, deriveConfidence, deriveMainAreas, describePosture, detectAgentContext, detectSensorWeakening, detectStacksFromManifests, diffContract, diffHasDistinctiveOverlap, distillFailureObservations, distinctiveCap, draftsFromFindings, emptyUsage, emptyUsageIndex, enforcementDir, estimateTokens, evalHistoryPath, evaluateSkillActivation, existingGateMissShas, explainSensorRejection, extractActionsBriefBody, extractCorrectApproachExamples, extractReferencedPaths, extractReviewLearnings, extractSensorExamples, extractSnippet, extractTestFilePathsFromCommand, filterNewDrafts, findCoverageGaps, findLexicalConflictPairs, findProjectRoot, findTopicStatusConflictPairs, findUncapturedFailures, findingBody, findingToDraft, firstMemoryOneLine, formatFrictionIssue, frictionFingerprint, frictionLogPath, frictionStatePath, gatePassedShas, generateBridges, getUsage, globToRegExp, groupFriction, handoffAgeMs, handoffFilePath, hasPendingTestMarker, hasRecentBriefingMarker, hashProjectContext, incidentHintsFromDiff, incidentSuffix, inferModulesFromPaths, isAutoPromoteEligible, isAutoRecap, isCovered, isDecaying, isDistinctiveToken, isEnvWorkaroundMemory, isFreshIsoDate, isGlobPath, isHarnessErrorOutput, isLikelyGuessable, isNoiseSubject, isProductionCodeFile, isRetiredMemory, isSensorScannablePath, isSkill, isSkillSuppressed, isStackPackSeed, isStylisticRule, isTemplateProjectContext, isWeakAnchor, judgeProposedSensor, lessonShortName, listMarkdownFilesRecursive, literalMatchesAllTokens, literalMatchesAnyToken, loadCodeMap, loadConfig, loadConfigSync, loadEvalHistory, loadFrictionState, loadMemoriesFromDir, loadMemoriesFromDirDetailed, loadMemory, loadPreventionEvents, loadSensorLedger, loadUsageIndex, looksLikeGenericAdvice, meetsSeedQualityFloor, memoryFilePath, memoryHasExcludedTag, memoryMatchesAnchorPaths, mergeHotFiles, mergeMemoryVersions, mineSensorSeedFromDiff, moduleNameOf, newMemoryId, normalizeChurnPath, normalizeFindingSeverity, normalizeFramework, normalizeFrictionSummary, normalizeKind, normalizeScaffoldStyle, normalizeSessionId, overallScore, parseEslintJson, parseFileAst, parseFindings, parseLessonFields, parseMemory, parseNpmAudit, parseSarif, parseSince, parseSonar, pathsOverlap, pickSnippetNeedle, pickTestFramework, planConflictResolution, planGitWatch, prepareBridgeData, preventionLogPath, priorityRank, prioritySignals, projectContextRecentlyEmitted, proposeGateMissDrafts, proposeSeedsFromCommits, pullCrossRepoSources, quarantineNote, queryCodeMap, rankMemoriesLexical, readFrictionReports, readRecentBriefingMarker, readRuntimeJournalTail, readSessionHandoff, readUsageEvents, recommendFeedbackAdjustment, recordApplied, recordGateReminder, recordPrevention, recordPreventionHits, recordProjectContextEmission, recordRejection, relPathFrom, renderBehaviourCoverageLine, renderBootstrapChecklist, renderCaughtForYou, renderPreventionComment, renderPreventionReceipt, renderPreventionReceiptShare, resolveBriefingBudget, resolveConfigPath, resolveGatePolicy, resolveHaivePaths, resolveManifestFiles, resolveProjectInfo, retirementSignal, revertedShaFromCommit, reviewLearningsToDrafts, runRegexSensor, runSensors, runTierContract, runValidationContract, runtimeJournalPath, saveCodeMap, saveConfig, saveFrictionState, saveUsageIndex, scaffoldPostIncidentTest, scannableSensorTargets, scoreRetrievalCase, scoreSensorCase, scrubbedCommandEnv, selectCommandSensors, sensorAppliesToPath, sensorLedgerPath, sensorPatternBrittleness, sensorPromotedAtMap, sensorSelfCheck, sensorTargetsFromDiff, serializeCodeMap, serializeMemory, setFrictionStatus, shouldExpandGateReminder, snapshotContract, specificityScore, stripPrivate, suggestGate, suggestSensorFromMemory, suggestSensorSeed, suggestTopicKey, summarizeCaughtForYou, summarizeImpact, synthesizeSelfEvalCases, tallyHotFiles, titleFromBody, tokenizeQuery, tokenizeWords, trackDependencies, trackReads, truncateToTokens, usageLogPath, usageLogSize, usagePath, verifyAnchor, watchContracts, withQuarantineNote, withoutQuarantineNote, writeBriefingMarker, writeSessionHandoff };
4112
+ export { AUTOPILOT_DEFAULTS, type Activation, type ActivationContext, ActivationSchema, type AgentContext, type Anchor, type AnchorAuditRow, type AnchorChurn, AnchorSchema, type AntiPatternGate, type AppendFrictionInput, type AppendFrictionResult, type AppliedConflictResolution, type AstExport, type AutoPromoteRule, BRIDGE_MARKERS, BRIDGE_TARGETS, BRIDGE_TARGET_PATH, BRIEFING_MARKER_TTL_MS, BRIEFING_PRESET_DEFAULTS, type BaselineHealth, type BehaviourCoverageInput, type BehaviourCoverageMetrics, type BehaviourOracleInfo, type BootstrapAssessment, type BootstrapGap, type BootstrapGate, type BootstrapMetrics, type BootstrapState, type BootstrapStateInput, 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_DEFAULT_EXCLUDE, CODE_MAP_DEFAULT_INCLUDE, CODE_MAP_FILE, CODE_STOPWORDS, CONFIG_FILE, CONTENT_CATCH_CODES, 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 ContractCheck, type ContractDiffResult, type ContractFile, type ContractSnapshot, type CoverageGap, type CoverageOptions, CrossRepoProvenanceSchema, type CrossRepoReport, type CrossRepoSource, DECAY_DAYS, DEFAULT_AUTO_PROMOTE_RULE, DEFAULT_BRIEFING_EXCLUDE_TAGS, DEFAULT_CONFIDENCE_THRESHOLDS, DEFAULT_CONFIG, DEFAULT_DORMANT_DAYS, DEFAULT_POSTURE, DEFAULT_PRIORITY_SIGNALS, DEFAULT_SPECIFICITY, type DashboardOptions, type DashboardReport, type DepChange, type DepTrackResult, type DependencySnapshot, type DetectStacksInput, type DetectableStack, type DistilledFailureLesson, type DocFrequency, type DormantRow, type DraftOptions, type DraftsOptions, ENV_WORKAROUND_TAGS, type EvalDelta, type EvalHistoryEntry, type EvalReport, type EvalSpec, type EvalTrend, FRICTION_FIELD_MAX, FRICTION_LOG_FILE, FRICTION_STATE_FILE, type FailureCoverageOptions, type FailureObservation, type FeedbackAdjustment, type FeedbackAdjustmentAction, type FeedbackAdjustmentOptions, type Finding, type FindingFormat, type FindingSeverity, type FrictionGroup, type FrictionKind, type FrictionReport, type FrictionState, type FrictionStateEntry, type FrictionStatus, GATE_REMINDER_WINDOW_MS, GUESSABLE_THRESHOLD, type GateFinding, type GateMissProposal, type GatePolicy, type GatePolicyInput, type GatePosture, type GatePrecision, type GatePrecisionDelta, type GatePrecisionMetricDelta, type GateSeverity, type GateStage, type GateTuningSuggestion, type GateVerdict, type GateVerdictInput, type GenerateBridgesOptions, type GitCommit, type GitWatchPlan, type GitWatchState, type GithubReleaseCode, type GithubReleaseInput, type GithubReleaseVerdict, HAIVE_DIR, HAIVE_OWNED_FILES, HANDOFF_FILENAME, HIVELORE_ATTRIBUTION, type HaiveConfig, type HaivePaths, type HotFile, type HotFileSource, type ImpactOptions, type ImpactRow, type ImpactScore, type ImpactSummary, type ImpactTier, type IncidentHints, type InvalidMemoryFile, LEGACY_CONFIG_FILE, 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, type NpmPublicationCode, type NpmPublicationInput, type NpmPublicationVerdict, PREVENTION_DEBOUNCE_MS, PREVENTION_RECEIPT_MARKER, PROCESS_GATE_CODES, PROJECT_CONTEXT_FILE, PROJECT_CONTEXT_THROTTLE_MS, type PostIncidentLesson, type PreventionCommentFinding, type PreventionEvent, type PreventionEventDetail, type PreventionReceipt, type PreventionReceiptRow, type PreventionRow, type PreventionSource, type PreventionTrend, type PrioritySignals, type ProposedEvalSpec, type ProposedSensorVerdict, REVIEW_LEARNING_MARKER, RUNTIME_JOURNAL_FILENAME, type RecurrenceReport, type RecurrenceRow, type ResolveProjectInfo, type RetirementSignal, type RetrievalAggregate, type RetrievalCase, type RetrievalCaseResult, type ReviewDraftOptions, type ReviewLearning, type RuntimeJournalEntry, SCAFFOLD_MARKER_RE, SEED_QUALITY_FLOOR, SENSOR_ABSENT_LOOKBACK, SENSOR_ABSENT_WINDOW, SESSION_RECAP_TTL_MS, SETUP_GATE_CODES, STACK_PACK_TAG, type ScaffoldLoopGap, type ScaffoldOptions, type ScaffoldStyle, type SeedProposal, type SelfEvalOptions, type Sensor, type SensorAggregate, type SensorCase, type SensorCaseResult, type SensorEvaluation, type SensorEvaluationOutcome, type SensorEvaluationStage, type SensorFlap, type SensorHealth, type SensorHit, type SensorRow, SensorSchema, type SensorSeed, type SensorSelfCheck, type SensorSuggestionOptions, type SensorTarget, type SensorWeakening, type SessionHandoffData, type SkillActivation, TEST_FRAMEWORKS, type TestFramework, type TestScaffold, type TierContractCheck, type TimelineEntry, type TopicStatusPair, type TruncateOptions, type TruncateResult, USAGE_FILE, USAGE_LOG_DIR, USAGE_LOG_FILE, type UncapturedFailure, type UncoveredAreaSuggestion, type UsageAggregate, type UsageEvent, type UsageIndex, type VerifyOptions, type VerifyResult, WEAK_ANCHOR_CHURN_RATIO, addedLineNumbersFromDiff, addedLinesFromDiff, aggregateRetrieval, aggregateSensors, aggregateUsage, allocateBudget, anchorMatchesComponent, anchorSpecificity, antiPatternGateParams, appendEvalHistory, appendFrictionReport, appendPreventionEvent, appendProposedRetrievalCases, appendRuntimeJournalEntry, appendSensorEvaluations, appendUsageEvent, applyConflictResolution, applyFeedbackAdjustment, approveProposedCases, assessBehaviourCoverage, assessBootstrapState, assessScaffoldLoop, assessSensorHealth, auditAnchorSpecificity, bridgeMemorySummary, briefingMarkerPath, briefingMarkersDir, briefingProofLine, buildBaselineHealthFinding, buildCodeMap, buildCoverageIndex, buildDashboard, buildDocFrequency, buildFrontmatter, buildHandoffMarkdown, buildPreventionReceipt, buildProposeCommand, buildReport, bumpRead, churnForAnchors, classifyGithubRelease, classifyMemoryPriority, classifyNpmPublication, codeMapContentHash, codeMapPath, collectTimelineEntries, compactAutoRecapBody, compareEvalReports, compareGatePrecision, compareImpact, compareVersions, compileRegexSensor, componentOf, computeBaselineHealth, computeEvalTrend, computeGatePrecision, computeImpact, computePreventionTrend, computeRecurrence, computeScopeHash, configPath, contractLockPath, countSourceFilesOnDisk, decideVerdict, dedupeRefusals, deriveConfidence, deriveMainAreas, describePosture, detectAgentContext, detectSensorWeakening, detectStacksFromManifests, diffContract, diffHasDistinctiveOverlap, distillFailureObservations, distinctiveCap, draftsFromFindings, emptyUsage, emptyUsageIndex, enforcementDir, estimateTokens, evalHistoryPath, evaluateSkillActivation, existingGateMissShas, explainSensorRejection, extractActionsBriefBody, extractCorrectApproachExamples, extractReferencedPaths, extractReviewLearnings, extractSensorExamples, extractSnippet, extractTestFilePathsFromCommand, filterNewDrafts, findCoverageGaps, findLexicalConflictPairs, findProjectRoot, findTopicStatusConflictPairs, findUncapturedFailures, findingBody, findingToDraft, firstMemoryOneLine, formatFrictionIssue, frictionFingerprint, frictionLogPath, frictionStatePath, gatePassedShas, generateBridges, getUsage, globToRegExp, groupFriction, handoffAgeMs, handoffFilePath, hasPendingTestMarker, hasRecentBriefingMarker, hashProjectContext, incidentHintsFromDiff, incidentSuffix, inferModulesFromPaths, isAutoPromoteEligible, isAutoRecap, isCovered, isDecaying, isDistinctiveToken, isEnvWorkaroundMemory, isFreshIsoDate, isGlobPath, isHarnessErrorOutput, isLikelyGuessable, isNoiseSubject, isProductionCodeFile, isRetiredMemory, isSensorScannablePath, isSkill, isSkillSuppressed, isStackPackSeed, isStylisticRule, isTemplateProjectContext, isWeakAnchor, judgeProposedSensor, lessonShortName, listMarkdownFilesRecursive, literalMatchesAllTokens, literalMatchesAnyToken, loadCodeMap, loadConfig, loadConfigSync, loadEvalHistory, loadFrictionState, loadMemoriesFromDir, loadMemoriesFromDirDetailed, loadMemory, loadPreventionEvents, loadSensorLedger, loadUsageIndex, looksLikeGenericAdvice, meetsSeedQualityFloor, memoryFilePath, memoryHasExcludedTag, memoryMatchesAnchorPaths, mergeHotFiles, mergeMemoryVersions, mineSensorSeedFromDiff, moduleNameOf, newMemoryId, normalizeChurnPath, normalizeFindingSeverity, normalizeFramework, normalizeFrictionSummary, normalizeKind, normalizeScaffoldStyle, normalizeSessionId, overallScore, parseEslintJson, parseFileAst, parseFindings, parseLessonFields, parseMemory, parseNpmAudit, parseSarif, parseSince, parseSonar, pathsOverlap, pickSnippetNeedle, pickTestFramework, planConflictResolution, planGitWatch, prepareBridgeData, preventionLogPath, priorityRank, prioritySignals, projectContextRecentlyEmitted, proposeGateMissDrafts, proposeSeedsFromCommits, pullCrossRepoSources, quarantineNote, queryCodeMap, rankMemoriesLexical, readFrictionReports, readRecentBriefingMarker, readRuntimeJournalTail, readSessionHandoff, readUsageEvents, recommendFeedbackAdjustment, recordApplied, recordGateReminder, recordPrevention, recordPreventionHits, recordProjectContextEmission, recordRejection, relPathFrom, renderBehaviourCoverageLine, renderBootstrapChecklist, renderCaughtForYou, renderPreventionComment, renderPreventionReceipt, renderPreventionReceiptShare, resolveBriefingBudget, resolveConfigPath, resolveGatePolicy, resolveHaivePaths, resolveManifestFiles, resolveProjectInfo, retirementSignal, revertedShaFromCommit, reviewLearningsToDrafts, runRegexSensor, runSensors, runTierContract, runValidationContract, runtimeJournalPath, saveCodeMap, saveConfig, saveFrictionState, saveUsageIndex, scaffoldPostIncidentTest, scannableSensorTargets, scoreRetrievalCase, scoreSensorCase, scrubbedCommandEnv, selectCommandSensors, sensorAppliesToPath, sensorLedgerPath, sensorPatternBrittleness, sensorPromotedAtMap, sensorSelfCheck, sensorTargetsFromDiff, serializeCodeMap, serializeMemory, setFrictionStatus, shouldExpandGateReminder, snapshotContract, specificityScore, stripPrivate, suggestGate, suggestSensorFromMemory, suggestSensorSeed, suggestTopicKey, summarizeCaughtForYou, summarizeImpact, synthesizeSelfEvalCases, tallyHotFiles, titleFromBody, tokenizeQuery, tokenizeWords, trackDependencies, trackReads, truncateToTokens, usageLogPath, usageLogSize, usagePath, verifyAnchor, watchContracts, withQuarantineNote, withoutQuarantineNote, writeBriefingMarker, writeSessionHandoff };
package/dist/index.js CHANGED
@@ -135,7 +135,17 @@ var MemoryFrontmatterSchema = z.object({
135
135
  * null when the memory is not yet validated, or on legacy memories written before this field.
136
136
  * Lets a human distinguish reviewed knowledge from AI/auto-trusted knowledge.
137
137
  */
138
- validated_by: z.enum(["human", "agent", "auto"]).nullable().default(null)
138
+ validated_by: z.enum(["human", "agent", "auto"]).nullable().default(null),
139
+ /**
140
+ * Does this memory describe code that EXISTS today, or a decision not yet built? Orthogonal to
141
+ * `confidence`/`status`: a `planned` decision can be fully trusted AS a decision while being false
142
+ * AS a description of the current code. Surfaced distinctly in briefings so an agent does not write
143
+ * code against a cookie/route/Node version that was only decided, never implemented (field report §3.3).
144
+ * applied — reflected in the code now (the default when omitted)
145
+ * planned — decided/intended, NOT yet implemented
146
+ * abandoned — considered and rejected; kept so it is not re-attempted
147
+ */
148
+ lifecycle: z.enum(["applied", "planned", "abandoned"]).optional()
139
149
  }).refine(
140
150
  (data) => data.scope !== "module" || !!data.module,
141
151
  { message: "module name is required when scope is 'module'", path: ["module"] }
@@ -153,15 +163,30 @@ var CrossRepoProvenanceSchema = z.object({
153
163
 
154
164
  // src/parser.ts
155
165
  import matter from "gray-matter";
166
+ import "zod";
156
167
  var PRIVATE_BLOCK_RE = /<private>[\s\S]*?<\/private>/g;
157
168
  function stripPrivate(body) {
158
169
  return body.replace(PRIVATE_BLOCK_RE, "").trimEnd();
159
170
  }
171
+ function formatFrontmatterError(err) {
172
+ const issue = err.issues[0];
173
+ if (!issue) return "invalid frontmatter";
174
+ const field = issue.path.length > 0 ? issue.path.join(".") : "frontmatter";
175
+ if (issue.code === "invalid_enum_value") {
176
+ const got = JSON.stringify(issue.received);
177
+ const allowed = issue.options.join(" | ");
178
+ return `invalid ${field}: ${got} is not a supported value \u2014 expected one of: ${allowed}`;
179
+ }
180
+ return `invalid ${field}: ${issue.message}`;
181
+ }
160
182
  function parseMemory(raw) {
161
183
  const parsed = matter(raw);
162
- const frontmatter = MemoryFrontmatterSchema.parse(parsed.data);
184
+ const result = MemoryFrontmatterSchema.safeParse(parsed.data);
185
+ if (!result.success) {
186
+ throw new Error(formatFrontmatterError(result.error));
187
+ }
163
188
  return {
164
- frontmatter,
189
+ frontmatter: result.data,
165
190
  body: stripPrivate(parsed.content.trim())
166
191
  };
167
192
  }
@@ -210,6 +235,7 @@ function buildFrontmatter(input) {
210
235
  topic: input.topic,
211
236
  sensor: input.sensor,
212
237
  activation: input.activation,
238
+ lifecycle: input.lifecycle,
213
239
  revision_count: 0,
214
240
  related_ids: input.relatedIds ?? []
215
241
  });
@@ -1462,16 +1488,19 @@ function auditAnchorSpecificity(memories, fileChurn, totalCommits) {
1462
1488
  return rows.sort((a, b) => a.specificity - b.specificity);
1463
1489
  }
1464
1490
 
1465
- // src/npm-publication.ts
1491
+ // src/version-order.ts
1466
1492
  function compareVersions(a, b) {
1467
- const pa = a.split(/[.-]/).map((p) => Number.parseInt(p, 10) || 0);
1468
- const pb = b.split(/[.-]/).map((p) => Number.parseInt(p, 10) || 0);
1469
- for (let i = 0; i < Math.max(pa.length, pb.length, 3); i++) {
1493
+ const pa = a.split(/[.-]/).map((part) => Number.parseInt(part, 10) || 0);
1494
+ const pb = b.split(/[.-]/).map((part) => Number.parseInt(part, 10) || 0);
1495
+ const len = Math.max(pa.length, pb.length, 3);
1496
+ for (let i = 0; i < len; i++) {
1470
1497
  const diff = (pa[i] ?? 0) - (pb[i] ?? 0);
1471
1498
  if (diff !== 0) return diff;
1472
1499
  }
1473
1500
  return 0;
1474
1501
  }
1502
+
1503
+ // src/npm-publication.ts
1475
1504
  function classifyNpmPublication(input) {
1476
1505
  const { packageName, localVersion, publishedVersion } = input;
1477
1506
  const hint = input.publishHint ?? `publish ${packageName} ${localVersion}`;
@@ -1506,6 +1535,62 @@ function classifyNpmPublication(input) {
1506
1535
  };
1507
1536
  }
1508
1537
 
1538
+ // src/github-release.ts
1539
+ var MAX_LISTED = 5;
1540
+ function listGap(versions) {
1541
+ const shown = versions.slice(0, MAX_LISTED).map((v) => `v${v}`).join(", ");
1542
+ const rest = versions.length - MAX_LISTED;
1543
+ return rest > 0 ? `${shown} and ${rest} more` : shown;
1544
+ }
1545
+ function classifyGithubRelease(input) {
1546
+ const { localVersion, releasedVersions, taggedVersions } = input;
1547
+ const hint = input.releaseHint ?? `create a GitHub Release for v${localVersion}`;
1548
+ if (releasedVersions === null) {
1549
+ return {
1550
+ code: "github-release-unverified",
1551
+ severity: "info",
1552
+ message: `Could not check whether v${localVersion} has a GitHub Release.`
1553
+ };
1554
+ }
1555
+ const tags = [...new Set(taggedVersions)].sort(compareVersions);
1556
+ if (releasedVersions.length === 0) {
1557
+ if (tags.length === 0) return null;
1558
+ return {
1559
+ code: "github-releases-absent",
1560
+ severity: "info",
1561
+ message: `${tags.length} version tag(s) exist but the repository has no GitHub Release. Tags are not Releases: listing and scoring tools read Releases.`,
1562
+ fix: `Start with the current version \u2014 ${hint}. Older tags stay as they are; only gaps after the first Release are reported.`
1563
+ };
1564
+ }
1565
+ const released = new Set(releasedVersions);
1566
+ const oldestReleased = [...releasedVersions].sort(compareVersions)[0];
1567
+ const newestReleased = [...releasedVersions].sort(compareVersions).at(-1);
1568
+ const skipped = tags.filter(
1569
+ (v) => !released.has(v) && compareVersions(v, oldestReleased) > 0 && compareVersions(v, localVersion) < 0
1570
+ );
1571
+ if (skipped.length > 0) {
1572
+ return {
1573
+ code: "github-releases-skipped",
1574
+ severity: "warn",
1575
+ message: `${skipped.length} tagged version(s) after v${oldestReleased} never became a GitHub Release: ${listGap(skipped)}.`,
1576
+ fix: `Releases are not cumulative, so the newest is the one that matters: ${hint}. If the gap is deliberate, turn the check off with \`enforcement.githubReleaseCheck: "off"\`.`
1577
+ };
1578
+ }
1579
+ if (compareVersions(newestReleased, localVersion) >= 0) {
1580
+ return {
1581
+ code: "github-release-published",
1582
+ severity: "ok",
1583
+ message: `v${newestReleased} has a GitHub Release.`
1584
+ };
1585
+ }
1586
+ return {
1587
+ code: "github-release-pending",
1588
+ severity: "info",
1589
+ message: `v${localVersion} has no GitHub Release yet (newest is v${newestReleased}) \u2014 expected at this point; the Release comes after the tag is pushed.`,
1590
+ fix: hint
1591
+ };
1592
+ }
1593
+
1509
1594
  // src/priority.ts
1510
1595
  var DEFAULT_PRIORITY_SIGNALS = {
1511
1596
  type: "",
@@ -1693,9 +1778,13 @@ function generateBridges(memories, sensors, opts) {
1693
1778
 
1694
1779
  // src/sensors.ts
1695
1780
  function sensorPatternBrittleness(pattern) {
1696
- const literal = pattern.replace(/\[[^\]]*\]/g, "").replace(/\{[^}]*\}/g, "");
1697
- if (/\d{2,}\s*-\s*\d{2,}/.test(literal)) return "hardcoded line/number range \u2014 rots when code shifts";
1698
- if (/\d{3,}/.test(literal)) return "hardcoded numeric literal (likely a line number) \u2014 rots when code shifts";
1781
+ const literal = pattern.replace(/\\[a-zA-Z]/g, " ").replace(/\[[^\]]*\]/g, " ").replace(/\{[^}]*\}/g, " ").replace(/\b\d{1,3}(?:\s*\\?\.\s*\d{1,3}){2,3}\b/g, " ");
1782
+ const range = literal.match(/\d{2,}\s*-\s*\d{2,}/);
1783
+ if (range) return `hardcoded line/number range "${range[0].replace(/\s+/g, "")}" \u2014 rots when code shifts`;
1784
+ const numeric = literal.match(/\d{3,}/);
1785
+ if (numeric) {
1786
+ return `hardcoded numeric literal "${numeric[0]}" (likely a line number) \u2014 rots when code shifts; if it is a real constant, put it in a character class ([0-9]) or anchor it to a stable token`;
1787
+ }
1699
1788
  return null;
1700
1789
  }
1701
1790
  function normalizeProjectPath(value) {
@@ -7346,6 +7435,7 @@ export {
7346
7435
  buildReport,
7347
7436
  bumpRead,
7348
7437
  churnForAnchors,
7438
+ classifyGithubRelease,
7349
7439
  classifyMemoryPriority,
7350
7440
  classifyNpmPublication,
7351
7441
  codeMapContentHash,
@@ -7355,6 +7445,7 @@ export {
7355
7445
  compareEvalReports,
7356
7446
  compareGatePrecision,
7357
7447
  compareImpact,
7448
+ compareVersions,
7358
7449
  compileRegexSensor,
7359
7450
  componentOf,
7360
7451
  computeBaselineHealth,