Skip to content

@codesoul-co/hypha-memory / lifecycle-contracts ​

Using this module ​

Use the Lifecycle contracts module for declaring and runtime-validating contracts. It exports 20 interfaces, 2 types.

Import from the package entrypoint ​

ts
import type {
  EpisodicRecordInput,
  ExtractedMemoryCandidate,
  ExtractedMemoryEvidence,
  MemoryExtractionBatch,
  MemoryExtractionCursor,
  MemoryExtractionJob,
  MemoryExtractionProfileSpec,
  MemoryExtractionRequest,
} from '@codesoul-co/hypha-memory';

// The complete export list is documented below.

Usage patterns ​

  • Use the 22 type/interface exports as static contracts in application code, adapters, or tests. Import them with import type; they do not exist at runtime.

Public exports ​

SymbolKindSignatureDescription
EpisodicRecordInputinterfaceinterface EpisodicRecordInputEpisodic Record Input interface with 14 public fields or methods.
ExtractedMemoryCandidateinterfaceinterface ExtractedMemoryCandidateExtracted Memory Candidate interface with 20 public fields or methods.
ExtractedMemoryEvidenceinterfaceinterface ExtractedMemoryEvidenceExtracted Memory Evidence interface with 4 public fields or methods.
MemoryExtractionBatchinterfaceinterface MemoryExtractionBatchMemory Extraction Batch interface with 9 public fields or methods.
MemoryExtractionCursorinterfaceinterface MemoryExtractionCursorMemory Extraction Cursor interface with 6 public fields or methods.
MemoryExtractionJobinterfaceinterface MemoryExtractionJobMemory Extraction Job interface with 16 public fields or methods.
MemoryExtractionProfileSpecinterfaceinterface MemoryExtractionProfileSpecMemory Extraction Profile Spec interface with 14 public fields or methods.
MemoryExtractionRequestinterfaceinterface MemoryExtractionRequestMemory Extraction Request interface with 9 public fields or methods.
MemoryExtractionSourceAdapterinterfaceinterface MemoryExtractionSourceAdapterMemory Extraction Source Adapter interface with 4 public fields or methods.
MemoryExtractionSourceBatchinterfaceinterface MemoryExtractionSourceBatchMemory Extraction Source Batch interface with 3 public fields or methods.
MemoryExtractionSourceRefinterfaceinterface MemoryExtractionSourceRefMemory Extraction Source Ref interface with 15 public fields or methods.
MemoryExtractionStageSpecinterfaceinterface MemoryExtractionStageSpecMemory Extraction Stage Spec interface with 6 public fields or methods.
MemoryExtractorinterfaceinterface MemoryExtractorMemory Extractor interface with 3 public fields or methods.
MemoryMaintenanceApplyRequestinterfaceinterface MemoryMaintenanceApplyRequestMemory Maintenance Apply Request interface with 3 public fields or methods.
MemoryMaintenanceDecisioninterfaceinterface MemoryMaintenanceDecisionMemory Maintenance Decision interface with 18 public fields or methods.
MemoryMaintenancePlannerinterfaceinterface MemoryMaintenancePlannerMemory Maintenance Planner interface with 3 public fields or methods.
MemoryMaintenancePlanRequestinterfaceinterface MemoryMaintenancePlanRequestMemory Maintenance Plan Request interface with 5 public fields or methods.
MemoryMaintenancePolicySpecinterfaceinterface MemoryMaintenancePolicySpecMemory Maintenance Policy Spec interface with 8 public fields or methods.
NormalizedExtractionInputinterfaceinterface NormalizedExtractionInputNormalized Extraction Input interface with 3 public fields or methods.
TruthAssertioninterfaceinterface TruthAssertionTruth Assertion interface with 11 public fields or methods.
MemoryExtractionSourceTypetypetype MemoryExtractionSourceType = 'conversation' | 'truth' | 'episodic_record' | 'runtime_event' | 'tool_observation' | 'artifact' | 'structured_record' | 'custom'Public type alias for Memory Extraction Source Type; the declaration contains its complete type expression.
MemoryMaintenanceActiontypetype MemoryMaintenanceAction = 'create' | 'noop' | 'reuse' | 'update' | 'merge' | 'supersede' | 'invalidate' | 'reject' | 'require_review'Public type alias for Memory Maintenance Action; the declaration contains its complete type expression.

EpisodicRecordInput ​

Episodic Record Input interface with 14 public fields or methods.

  • Kind: interface
  • Import: import type { EpisodicRecordInput } from '@codesoul-co/hypha-memory';
  • Source module: lifecycle-contracts

Declaration ​

text
export interface EpisodicRecordInput {
    episodeId: string;
    title?: string;
    startAt: string;
    endAt?: string;
    actors?: string[];
    goal?: string;
    actions?: string[];
    observations?: string[];
    outcome?: unknown;
    success?: boolean;
    failureCode?: string;
    causalEventIds?: string[];
    artifactRefs?: string[];
    metadata?: Record<string, unknown>;
}

Contract members ​

MemberKindSignatureDescription
actionspropertyactions?: string[]Public property; its type, readonly modifier and optionality are shown in the signature.
actorspropertyactors?: string[]Public property; its type, readonly modifier and optionality are shown in the signature.
artifactRefspropertyartifactRefs?: string[]Public property; its type, readonly modifier and optionality are shown in the signature.
causalEventIdspropertycausalEventIds?: string[]Public property; its type, readonly modifier and optionality are shown in the signature.
endAtpropertyendAt?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
episodeIdpropertyepisodeId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
failureCodepropertyfailureCode?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
goalpropertygoal?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
metadatapropertymetadata?: Record<string, unknown>Public property; its type, readonly modifier and optionality are shown in the signature.
observationspropertyobservations?: string[]Public property; its type, readonly modifier and optionality are shown in the signature.
outcomepropertyoutcome?: unknownPublic property; its type, readonly modifier and optionality are shown in the signature.
startAtpropertystartAt: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
successpropertysuccess?: booleanPublic property; its type, readonly modifier and optionality are shown in the signature.
titlepropertytitle?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.

ExtractedMemoryCandidate ​

Extracted Memory Candidate interface with 20 public fields or methods.

  • Kind: interface
  • Import: import type { ExtractedMemoryCandidate } from '@codesoul-co/hypha-memory';
  • Source module: lifecycle-contracts

Declaration ​

text
export interface ExtractedMemoryCandidate {
    candidateId: string;
    type: ManagedMemoryType;
    content: unknown;
    canonicalText: string;
    summary?: string;
    confidence: number;
    importance?: number;
    canonicalKey?: string;
    subject?: string;
    predicate?: string;
    object?: unknown;
    temporal?: {
        observedAt?: string;
        validFrom?: string;
        validTo?: string;
        temporalConfidence?: number;
    };
    entities?: MemoryEntityRef[];
    relations?: MemoryRelation[];
    sensitive?: boolean;
    authority?: MemoryExtractionSourceRef['authority'];
    evidence: ExtractedMemoryEvidence[];
    extractionRationale?: string;
    extractionProfileRevision: string;
    sourceHash: string;
}

Contract members ​

MemberKindSignatureDescription
authoritypropertyauthority?: "verified" | "unverified" | "user_asserted" | "system_observed" | "authoritative"Public property; its type, readonly modifier and optionality are shown in the signature.
candidateIdpropertycandidateId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
canonicalKeypropertycanonicalKey?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
canonicalTextpropertycanonicalText: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
confidencepropertyconfidence: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
contentpropertycontent: unknownPublic property; its type, readonly modifier and optionality are shown in the signature.
entitiespropertyentities?: MemoryEntityRef[]Public property; its type, readonly modifier and optionality are shown in the signature.
evidencepropertyevidence: ExtractedMemoryEvidence[]Public property; its type, readonly modifier and optionality are shown in the signature.
extractionProfileRevisionpropertyextractionProfileRevision: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
extractionRationalepropertyextractionRationale?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
importancepropertyimportance?: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
objectpropertyobject?: unknownPublic property; its type, readonly modifier and optionality are shown in the signature.
predicatepropertypredicate?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
relationspropertyrelations?: MemoryRelation[]Public property; its type, readonly modifier and optionality are shown in the signature.
sensitivepropertysensitive?: booleanPublic property; its type, readonly modifier and optionality are shown in the signature.
sourceHashpropertysourceHash: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
subjectpropertysubject?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
summarypropertysummary?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
temporalpropertytemporal?: { observedAt?: string; validFrom?: string; validTo?: string; temporalConfidence?: number; }Public property; its type, readonly modifier and optionality are shown in the signature.
typepropertytype: ManagedMemoryTypePublic property; its type, readonly modifier and optionality are shown in the signature.

ExtractedMemoryEvidence ​

Extracted Memory Evidence interface with 4 public fields or methods.

  • Kind: interface
  • Import: import type { ExtractedMemoryEvidence } from '@codesoul-co/hypha-memory';
  • Source module: lifecycle-contracts

Declaration ​

text
export interface ExtractedMemoryEvidence {
    sourceRef: MemoryExtractionSourceRef;
    sourceSpan?: {
        messageId?: string;
        eventId?: string;
        artifactRef?: string;
        start?: number;
        end?: number;
        quoteHash?: string;
    };
    supportType: 'direct' | 'derived' | 'contradicting';
    confidence?: number;
}

Contract members ​

MemberKindSignatureDescription
confidencepropertyconfidence?: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
sourceRefpropertysourceRef: MemoryExtractionSourceRefPublic property; its type, readonly modifier and optionality are shown in the signature.
sourceSpanpropertysourceSpan?: { messageId?: string; eventId?: string; artifactRef?: string; start?: number; end?: number; quoteHash?: string; }Public property; its type, readonly modifier and optionality are shown in the signature.
supportTypepropertysupportType: "derived" | "direct" | "contradicting"Public property; its type, readonly modifier and optionality are shown in the signature.

MemoryExtractionBatch ​

Memory Extraction Batch interface with 9 public fields or methods.

  • Kind: interface
  • Import: import type { MemoryExtractionBatch } from '@codesoul-co/hypha-memory';
  • Source module: lifecycle-contracts

Declaration ​

text
export interface MemoryExtractionBatch {
    id: string;
    jobId: string;
    sourceRefs: MemoryExtractionSourceRef[];
    candidates: ExtractedMemoryCandidate[];
    rejectedCandidates: MemoryRejectedItem[];
    sourceHash: string;
    extractorVersion: string;
    modelObservationRef?: string;
    createdAt: string;
}

Contract members ​

MemberKindSignatureDescription
candidatespropertycandidates: ExtractedMemoryCandidate[]Public property; its type, readonly modifier and optionality are shown in the signature.
createdAtpropertycreatedAt: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
extractorVersionpropertyextractorVersion: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
idpropertyid: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
jobIdpropertyjobId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
modelObservationRefpropertymodelObservationRef?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
rejectedCandidatespropertyrejectedCandidates: MemoryRejectedItem[]Public property; its type, readonly modifier and optionality are shown in the signature.
sourceHashpropertysourceHash: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
sourceRefspropertysourceRefs: MemoryExtractionSourceRef[]Public property; its type, readonly modifier and optionality are shown in the signature.

MemoryExtractionCursor ​

Memory Extraction Cursor interface with 6 public fields or methods.

  • Kind: interface
  • Import: import type { MemoryExtractionCursor } from '@codesoul-co/hypha-memory';
  • Source module: lifecycle-contracts

Declaration ​

text
export interface MemoryExtractionCursor {
    sourceType: MemoryExtractionSourceType;
    sourceId: string;
    sequence?: number;
    timestamp?: string;
    sourceHash?: string;
    opaqueCursor?: string;
}

Contract members ​

MemberKindSignatureDescription
opaqueCursorpropertyopaqueCursor?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
sequencepropertysequence?: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
sourceHashpropertysourceHash?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
sourceIdpropertysourceId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
sourceTypepropertysourceType: MemoryExtractionSourceTypePublic property; its type, readonly modifier and optionality are shown in the signature.
timestamppropertytimestamp?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.

MemoryExtractionJob ​

Memory Extraction Job interface with 16 public fields or methods.

  • Kind: interface
  • Import: import type { MemoryExtractionJob } from '@codesoul-co/hypha-memory';
  • Source module: lifecycle-contracts

Declaration ​

text
export interface MemoryExtractionJob {
    id: string;
    operationId: string;
    scopeHash: string;
    profileRef: MemoryContractSpecRef;
    profileRevision: string;
    sourceRefs: MemoryExtractionSourceRef[];
    status: 'queued' | 'running' | 'awaiting_review' | 'completed' | 'partial' | 'failed' | 'cancelled';
    cursorBefore?: MemoryExtractionCursor;
    cursorAfter?: MemoryExtractionCursor;
    attempts: number;
    leaseOwner?: string;
    leaseExpiresAt?: string;
    lastError?: NormalizedMemoryError;
    createdAt: string;
    startedAt?: string;
    completedAt?: string;
}

Contract members ​

MemberKindSignatureDescription
attemptspropertyattempts: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
completedAtpropertycompletedAt?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
createdAtpropertycreatedAt: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
cursorAfterpropertycursorAfter?: MemoryExtractionCursorPublic property; its type, readonly modifier and optionality are shown in the signature.
cursorBeforepropertycursorBefore?: MemoryExtractionCursorPublic property; its type, readonly modifier and optionality are shown in the signature.
idpropertyid: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
lastErrorpropertylastError?: NormalizedMemoryErrorPublic property; its type, readonly modifier and optionality are shown in the signature.
leaseExpiresAtpropertyleaseExpiresAt?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
leaseOwnerpropertyleaseOwner?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
operationIdpropertyoperationId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
profileRefpropertyprofileRef: MemoryContractSpecRefPublic property; its type, readonly modifier and optionality are shown in the signature.
profileRevisionpropertyprofileRevision: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
scopeHashpropertyscopeHash: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
sourceRefspropertysourceRefs: MemoryExtractionSourceRef[]Public property; its type, readonly modifier and optionality are shown in the signature.
startedAtpropertystartedAt?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
statuspropertystatus: "completed" | "queued" | "running" | "cancelled" | "failed" | "partial" | "awaiting_review"Public property; its type, readonly modifier and optionality are shown in the signature.

MemoryExtractionProfileSpec ​

Memory Extraction Profile Spec interface with 14 public fields or methods.

  • Kind: interface
  • Import: import type { MemoryExtractionProfileSpec } from '@codesoul-co/hypha-memory';
  • Source module: lifecycle-contracts

Declaration ​

text
export interface MemoryExtractionProfileSpec {
    id: string;
    version: string;
    revision?: string;
    acceptedSourceTypes: MemoryExtractionSourceType[];
    outputMemoryTypes: ManagedMemoryType[];
    extractor: {
        type: 'deterministic';
        extractorRef: MemoryContractSpecRef;
    } | {
        type: 'model';
        modelProfileRef: MemoryContractSpecRef;
        promptTemplateRef: MemoryContractSpecRef;
    } | {
        type: 'provider';
        providerRef: MemoryContractSpecRef;
    } | {
        type: 'hybrid';
        stages: MemoryExtractionStageSpec[];
    };
    conversation?: {
        maxMessagesPerWindow: number;
        overlapMessages?: number;
        includeSystemMessages?: boolean;
        includeToolMessages?: boolean;
        extractionTrigger: 'each_turn' | 'window' | 'run_end' | 'session_idle' | 'manual';
    };
    episodic?: {
        boundary: 'run' | 'workflow_state' | 'task' | 'time_window' | 'custom';
        includeFailedEpisodes?: boolean;
        includeIntermediateObservations?: boolean;
    };
    truth?: {
        minimumAuthority: TruthAssertion['authority'];
        requireEvidence?: boolean;
        preserveValidityInterval?: boolean;
    };
    sensitiveDataPolicyRef?: MemoryContractSpecRef;
    candidateValidation: {
        minConfidence: number;
        requireCanonicalText: boolean;
        requireEvidence: boolean;
        maxCandidatesPerJob?: number;
        rejectInstructionLikeContent?: boolean;
    };
    writePolicyRef: MemoryContractSpecRef;
    maintenancePolicyRef: MemoryContractSpecRef;
    metadata?: Record<string, unknown>;
}

Contract members ​

MemberKindSignatureDescription
acceptedSourceTypespropertyacceptedSourceTypes: MemoryExtractionSourceType[]Public property; its type, readonly modifier and optionality are shown in the signature.
candidateValidationpropertycandidateValidation: { minConfidence: number; requireCanonicalText: boolean; requireEvidence: boolean; maxCandidatesPerJob?: number; rejectInstructionLikeContent?: boolean; }Public property; its type, readonly modifier and optionality are shown in the signature.
conversationpropertyconversation?: { maxMessagesPerWindow: number; overlapMessages?: number; includeSystemMessages?: boolean; includeToolMessages?: boolean; extractionTrigger: "each_turn" | "window" | "run_end" | "session_idle" | "manual"; }Public property; its type, readonly modifier and optionality are shown in the signature.
episodicpropertyepisodic?: { boundary: "run" | "workflow_state" | "task" | "time_window" | "custom"; includeFailedEpisodes?: boolean; includeIntermediateObservations?: boolean; }Public property; its type, readonly modifier and optionality are shown in the signature.
extractorpropertyextractor: { type: "deterministic"; extractorRef: MemoryContractSpecRef; } | { type: "model"; modelProfileRef: MemoryContractSpecRef; promptTemplateRef: MemoryContractSpecRef; } | { type: "provider"; providerRef: MemoryContractSpecRef; } | { type: "hybrid"; stages: MemoryExtractionStageSpec[]; }Public property; its type, readonly modifier and optionality are shown in the signature.
idpropertyid: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
maintenancePolicyRefpropertymaintenancePolicyRef: MemoryContractSpecRefPublic property; its type, readonly modifier and optionality are shown in the signature.
metadatapropertymetadata?: Record<string, unknown>Public property; its type, readonly modifier and optionality are shown in the signature.
outputMemoryTypespropertyoutputMemoryTypes: ManagedMemoryType[]Public property; its type, readonly modifier and optionality are shown in the signature.
revisionpropertyrevision?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
sensitiveDataPolicyRefpropertysensitiveDataPolicyRef?: MemoryContractSpecRefPublic property; its type, readonly modifier and optionality are shown in the signature.
truthpropertytruth?: { minimumAuthority: TruthAssertion["authority"]; requireEvidence?: boolean; preserveValidityInterval?: boolean; }Public property; its type, readonly modifier and optionality are shown in the signature.
versionpropertyversion: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
writePolicyRefpropertywritePolicyRef: MemoryContractSpecRefPublic property; its type, readonly modifier and optionality are shown in the signature.

MemoryExtractionRequest ​

Memory Extraction Request interface with 9 public fields or methods.

  • Kind: interface
  • Import: import type { MemoryExtractionRequest } from '@codesoul-co/hypha-memory';
  • Source module: lifecycle-contracts

Declaration ​

text
export interface MemoryExtractionRequest {
    operationId: string;
    principal: MemoryPrincipal;
    scope: ManagedMemoryScope;
    profileRef: MemoryContractSpecRef;
    sources: MemoryExtractionSourceRef[];
    mode: 'sync' | 'async';
    force?: boolean;
    idempotencyKey?: string;
    metadata?: Record<string, unknown>;
}

Contract members ​

MemberKindSignatureDescription
forcepropertyforce?: booleanPublic property; its type, readonly modifier and optionality are shown in the signature.
idempotencyKeypropertyidempotencyKey?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
metadatapropertymetadata?: Record<string, unknown>Public property; its type, readonly modifier and optionality are shown in the signature.
modepropertymode: "sync" | "async"Public property; its type, readonly modifier and optionality are shown in the signature.
operationIdpropertyoperationId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
principalpropertyprincipal: MemoryPrincipalPublic property; its type, readonly modifier and optionality are shown in the signature.
profileRefpropertyprofileRef: MemoryContractSpecRefPublic property; its type, readonly modifier and optionality are shown in the signature.
scopepropertyscope: ManagedMemoryScopePublic property; its type, readonly modifier and optionality are shown in the signature.
sourcespropertysources: MemoryExtractionSourceRef[]Public property; its type, readonly modifier and optionality are shown in the signature.

MemoryExtractionSourceAdapter ​

Memory Extraction Source Adapter interface with 4 public fields or methods.

  • Kind: interface
  • Import: import type { MemoryExtractionSourceAdapter } from '@codesoul-co/hypha-memory';
  • Source module: lifecycle-contracts

Declaration ​

text
export interface MemoryExtractionSourceAdapter<T = unknown> {
    readonly type: MemoryExtractionSourceType;
    load(refs: MemoryExtractionSourceRef[], cursor?: MemoryExtractionCursor): Promise<MemoryExtractionSourceBatch<T>>;
    normalize(batch: MemoryExtractionSourceBatch<T>): Promise<NormalizedExtractionInput[]>;
    health(): Promise<ProviderHealth>;
}

Contract members ​

MemberKindSignatureDescription
healthmethodhealth(): Promise<ProviderHealth>Public method; parameters and return type are shown in the signature.
loadmethodload(refs: MemoryExtractionSourceRef[], cursor?: MemoryExtractionCursor): Promise<MemoryExtractionSourceBatch<T>>Public method; parameters and return type are shown in the signature.
normalizemethodnormalize(batch: MemoryExtractionSourceBatch<T>): Promise<NormalizedExtractionInput[]>Public method; parameters and return type are shown in the signature.
typepropertyreadonly type: MemoryExtractionSourceTypePublic property; its type, readonly modifier and optionality are shown in the signature.

MemoryExtractionSourceBatch ​

Memory Extraction Source Batch interface with 3 public fields or methods.

  • Kind: interface
  • Import: import type { MemoryExtractionSourceBatch } from '@codesoul-co/hypha-memory';
  • Source module: lifecycle-contracts

Declaration ​

text
export interface MemoryExtractionSourceBatch<T = unknown> {
    sourceRefs: MemoryExtractionSourceRef[];
    items: Array<{
        sourceRef: MemoryExtractionSourceRef;
        value: T;
    }>;
    nextCursor?: MemoryExtractionCursor;
}

Contract members ​

MemberKindSignatureDescription
itemspropertyitems: { sourceRef: MemoryExtractionSourceRef; value: T; }[]Public property; its type, readonly modifier and optionality are shown in the signature.
nextCursorpropertynextCursor?: MemoryExtractionCursorPublic property; its type, readonly modifier and optionality are shown in the signature.
sourceRefspropertysourceRefs: MemoryExtractionSourceRef[]Public property; its type, readonly modifier and optionality are shown in the signature.

MemoryExtractionSourceRef ​

Memory Extraction Source Ref interface with 15 public fields or methods.

  • Kind: interface
  • Import: import type { MemoryExtractionSourceRef } from '@codesoul-co/hypha-memory';
  • Source module: lifecycle-contracts

Declaration ​

text
export interface MemoryExtractionSourceRef {
    type: MemoryExtractionSourceType;
    sourceId: string;
    sourceVersion?: string;
    sourceHash?: string;
    sessionId?: string;
    runId?: string;
    messageIds?: string[];
    eventIds?: string[];
    artifactRefs?: string[];
    observedAt?: string;
    validFrom?: string;
    validTo?: string;
    authority?: 'unverified' | 'user_asserted' | 'system_observed' | 'verified' | 'authoritative';
    trustScore?: number;
    metadata?: Record<string, unknown>;
}

Contract members ​

MemberKindSignatureDescription
artifactRefspropertyartifactRefs?: string[]Public property; its type, readonly modifier and optionality are shown in the signature.
authoritypropertyauthority?: "verified" | "unverified" | "user_asserted" | "system_observed" | "authoritative"Public property; its type, readonly modifier and optionality are shown in the signature.
eventIdspropertyeventIds?: string[]Public property; its type, readonly modifier and optionality are shown in the signature.
messageIdspropertymessageIds?: string[]Public property; its type, readonly modifier and optionality are shown in the signature.
metadatapropertymetadata?: Record<string, unknown>Public property; its type, readonly modifier and optionality are shown in the signature.
observedAtpropertyobservedAt?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
runIdpropertyrunId?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
sessionIdpropertysessionId?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
sourceHashpropertysourceHash?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
sourceIdpropertysourceId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
sourceVersionpropertysourceVersion?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
trustScorepropertytrustScore?: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
typepropertytype: MemoryExtractionSourceTypePublic property; its type, readonly modifier and optionality are shown in the signature.
validFrompropertyvalidFrom?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
validTopropertyvalidTo?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.

MemoryExtractionStageSpec ​

Memory Extraction Stage Spec interface with 6 public fields or methods.

  • Kind: interface
  • Import: import type { MemoryExtractionStageSpec } from '@codesoul-co/hypha-memory';
  • Source module: lifecycle-contracts

Declaration ​

text
export interface MemoryExtractionStageSpec {
    id: string;
    type: 'normalize' | 'classify' | 'extract' | 'validate' | 'enrich' | 'custom';
    handlerRef: MemoryContractSpecRef;
    optional?: boolean;
    timeoutMs?: number;
    retryPolicy?: Record<string, unknown>;
}

Contract members ​

MemberKindSignatureDescription
handlerRefpropertyhandlerRef: MemoryContractSpecRefPublic property; its type, readonly modifier and optionality are shown in the signature.
idpropertyid: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
optionalpropertyoptional?: booleanPublic property; its type, readonly modifier and optionality are shown in the signature.
retryPolicypropertyretryPolicy?: Record<string, unknown>Public property; its type, readonly modifier and optionality are shown in the signature.
timeoutMspropertytimeoutMs?: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
typepropertytype: "custom" | "validate" | "normalize" | "classify" | "extract" | "enrich"Public property; its type, readonly modifier and optionality are shown in the signature.

MemoryExtractor ​

Memory Extractor interface with 3 public fields or methods.

  • Kind: interface
  • Import: import type { MemoryExtractor } from '@codesoul-co/hypha-memory';
  • Source module: lifecycle-contracts

Declaration ​

text
export interface MemoryExtractor {
    readonly id: string;
    extract(inputs: NormalizedExtractionInput[], profile: MemoryExtractionProfileSpec): Promise<ExtractedMemoryCandidate[]>;
    health(): Promise<ProviderHealth>;
}

Contract members ​

MemberKindSignatureDescription
extractmethodextract(inputs: NormalizedExtractionInput[], profile: MemoryExtractionProfileSpec): Promise<ExtractedMemoryCandidate[]>Public method; parameters and return type are shown in the signature.
healthmethodhealth(): Promise<ProviderHealth>Public method; parameters and return type are shown in the signature.
idpropertyreadonly id: stringPublic property; its type, readonly modifier and optionality are shown in the signature.

MemoryMaintenanceApplyRequest ​

Memory Maintenance Apply Request interface with 3 public fields or methods.

  • Kind: interface
  • Import: import type { MemoryMaintenanceApplyRequest } from '@codesoul-co/hypha-memory';
  • Source module: lifecycle-contracts

Declaration ​

text
export interface MemoryMaintenanceApplyRequest {
    decision: MemoryMaintenanceDecision;
    candidate: ExtractedMemoryCandidate;
    scope: ManagedMemoryScope;
}

Contract members ​

MemberKindSignatureDescription
candidatepropertycandidate: ExtractedMemoryCandidatePublic property; its type, readonly modifier and optionality are shown in the signature.
decisionpropertydecision: MemoryMaintenanceDecisionPublic property; its type, readonly modifier and optionality are shown in the signature.
scopepropertyscope: ManagedMemoryScopePublic property; its type, readonly modifier and optionality are shown in the signature.

MemoryMaintenanceDecision ​

Memory Maintenance Decision interface with 18 public fields or methods.

  • Kind: interface
  • Import: import type { MemoryMaintenanceDecision } from '@codesoul-co/hypha-memory';
  • Source module: lifecycle-contracts

Declaration ​

text
export interface MemoryMaintenanceDecision {
    id: string;
    operationId: string;
    candidateId: string;
    scopeHash: string;
    action: MemoryMaintenanceAction;
    targetMemoryIds: string[];
    expectedRevisions: Record<string, number>;
    duplicateScore?: number;
    conflictScore?: number;
    authorityComparison?: 'candidate_higher' | 'existing_higher' | 'equal' | 'unknown';
    mergedContent?: unknown;
    patch?: MemoryPatch;
    relationsToCreate?: MemoryRelation[];
    recordsToInvalidate?: string[];
    reasonCode: 'NEW_FACT' | 'EXACT_DUPLICATE' | 'SEMANTIC_DUPLICATE' | 'ADDITIONAL_EVIDENCE' | 'FACT_CORRECTION' | 'TEMPORAL_UPDATE' | 'AUTHORITY_OVERRIDE' | 'CONFLICT_REQUIRES_REVIEW' | 'LOW_CONFIDENCE' | 'POLICY_REJECTED' | 'CUSTOM';
    explanation?: string;
    policyRevision: string;
    createdAt: string;
}

Contract members ​

MemberKindSignatureDescription
actionpropertyaction: MemoryMaintenanceActionPublic property; its type, readonly modifier and optionality are shown in the signature.
authorityComparisonpropertyauthorityComparison?: "unknown" | "candidate_higher" | "existing_higher" | "equal"Public property; its type, readonly modifier and optionality are shown in the signature.
candidateIdpropertycandidateId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
conflictScorepropertyconflictScore?: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
createdAtpropertycreatedAt: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
duplicateScorepropertyduplicateScore?: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
expectedRevisionspropertyexpectedRevisions: Record<string, number>Public property; its type, readonly modifier and optionality are shown in the signature.
explanationpropertyexplanation?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
idpropertyid: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
mergedContentpropertymergedContent?: unknownPublic property; its type, readonly modifier and optionality are shown in the signature.
operationIdpropertyoperationId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
patchpropertypatch?: MemoryPatchPublic property; its type, readonly modifier and optionality are shown in the signature.
policyRevisionpropertypolicyRevision: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
reasonCodepropertyreasonCode: "CUSTOM" | "NEW_FACT" | "EXACT_DUPLICATE" | "SEMANTIC_DUPLICATE" | "ADDITIONAL_EVIDENCE" | "FACT_CORRECTION" | "TEMPORAL_UPDATE" | "AUTHORITY_OVERRIDE" | "CONFLICT_REQUIRES_REVIEW" | "LOW_CONFIDENCE" | "POLICY_REJECTED"Public property; its type, readonly modifier and optionality are shown in the signature.
recordsToInvalidatepropertyrecordsToInvalidate?: string[]Public property; its type, readonly modifier and optionality are shown in the signature.
relationsToCreatepropertyrelationsToCreate?: MemoryRelation[]Public property; its type, readonly modifier and optionality are shown in the signature.
scopeHashpropertyscopeHash: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
targetMemoryIdspropertytargetMemoryIds: string[]Public property; its type, readonly modifier and optionality are shown in the signature.

MemoryMaintenancePlanner ​

Memory Maintenance Planner interface with 3 public fields or methods.

  • Kind: interface
  • Import: import type { MemoryMaintenancePlanner } from '@codesoul-co/hypha-memory';
  • Source module: lifecycle-contracts

Declaration ​

text
export interface MemoryMaintenancePlanner {
    plan(request: MemoryMaintenancePlanRequest): Promise<MemoryMaintenanceDecision>;
    apply(request: MemoryMaintenanceApplyRequest): Promise<ManagedMemoryWriteResult>;
    explain(decisionId: string): Promise<MemoryMaintenanceDecision | null>;
}

Contract members ​

MemberKindSignatureDescription
applymethodapply(request: MemoryMaintenanceApplyRequest): Promise<ManagedMemoryWriteResult>Public method; parameters and return type are shown in the signature.
explainmethodexplain(decisionId: string): Promise<MemoryMaintenanceDecision | null>Public method; parameters and return type are shown in the signature.
planmethodplan(request: MemoryMaintenancePlanRequest): Promise<MemoryMaintenanceDecision>Public method; parameters and return type are shown in the signature.

MemoryMaintenancePlanRequest ​

Memory Maintenance Plan Request interface with 5 public fields or methods.

  • Kind: interface
  • Import: import type { MemoryMaintenancePlanRequest } from '@codesoul-co/hypha-memory';
  • Source module: lifecycle-contracts

Declaration ​

text
export interface MemoryMaintenancePlanRequest {
    operationId: string;
    scope: ManagedMemoryScope;
    candidate: ExtractedMemoryCandidate;
    existingRecords: ManagedMemoryRecord[];
    policy: MemoryMaintenancePolicySpec;
}

Contract members ​

MemberKindSignatureDescription
candidatepropertycandidate: ExtractedMemoryCandidatePublic property; its type, readonly modifier and optionality are shown in the signature.
existingRecordspropertyexistingRecords: ManagedMemoryRecord<unknown>[]Public property; its type, readonly modifier and optionality are shown in the signature.
operationIdpropertyoperationId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
policypropertypolicy: MemoryMaintenancePolicySpecPublic property; its type, readonly modifier and optionality are shown in the signature.
scopepropertyscope: ManagedMemoryScopePublic property; its type, readonly modifier and optionality are shown in the signature.

MemoryMaintenancePolicySpec ​

Memory Maintenance Policy Spec interface with 8 public fields or methods.

  • Kind: interface
  • Import: import type { MemoryMaintenancePolicySpec } from '@codesoul-co/hypha-memory';
  • Source module: lifecycle-contracts

Declaration ​

text
export interface MemoryMaintenancePolicySpec {
    id: string;
    version: string;
    revision?: string;
    preWriteRetrieval: {
        enabled: boolean;
        exactKeyLookup: boolean;
        semanticLookup?: boolean;
        maxCandidates: number;
        semanticThreshold?: number;
        includeSuperseded?: boolean;
        includeInvalidated?: boolean;
    };
    duplicateResolution: 'reuse_existing' | 'increase_support' | 'create_version' | 'require_review';
    updateResolution: 'patch_current' | 'create_version' | 'supersede' | 'require_review';
    conflictResolution: 'keep_both_marked' | 'prefer_authoritative' | 'prefer_verified' | 'prefer_latest' | 'invalidate_old' | 'require_review';
    metadata?: Record<string, unknown>;
}

Contract members ​

MemberKindSignatureDescription
conflictResolutionpropertyconflictResolution: "prefer_latest" | "prefer_verified" | "require_review" | "keep_both_marked" | "prefer_authoritative" | "invalidate_old"Public property; its type, readonly modifier and optionality are shown in the signature.
duplicateResolutionpropertyduplicateResolution: "reuse_existing" | "increase_support" | "create_version" | "require_review"Public property; its type, readonly modifier and optionality are shown in the signature.
idpropertyid: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
metadatapropertymetadata?: Record<string, unknown>Public property; its type, readonly modifier and optionality are shown in the signature.
preWriteRetrievalpropertypreWriteRetrieval: { enabled: boolean; exactKeyLookup: boolean; semanticLookup?: boolean; maxCandidates: number; semanticThreshold?: number; includeSuperseded?: boolean; includeInvalidated?: boolean; }Public property; its type, readonly modifier and optionality are shown in the signature.
revisionpropertyrevision?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
updateResolutionpropertyupdateResolution: "create_version" | "require_review" | "patch_current" | "supersede"Public property; its type, readonly modifier and optionality are shown in the signature.
versionpropertyversion: stringPublic property; its type, readonly modifier and optionality are shown in the signature.

NormalizedExtractionInput ​

Normalized Extraction Input interface with 3 public fields or methods.

  • Kind: interface
  • Import: import type { NormalizedExtractionInput } from '@codesoul-co/hypha-memory';
  • Source module: lifecycle-contracts

Declaration ​

text
export interface NormalizedExtractionInput {
    sourceRef: MemoryExtractionSourceRef;
    value: unknown;
    canonicalText?: string;
}

Contract members ​

MemberKindSignatureDescription
canonicalTextpropertycanonicalText?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
sourceRefpropertysourceRef: MemoryExtractionSourceRefPublic property; its type, readonly modifier and optionality are shown in the signature.
valuepropertyvalue: unknownPublic property; its type, readonly modifier and optionality are shown in the signature.

TruthAssertion ​

Truth Assertion interface with 11 public fields or methods.

  • Kind: interface
  • Import: import type { TruthAssertion } from '@codesoul-co/hypha-memory';
  • Source module: lifecycle-contracts

Declaration ​

text
export interface TruthAssertion {
    assertionId: string;
    subject: string;
    predicate: string;
    object: unknown;
    authority: 'user_confirmed' | 'human_reviewed' | 'system_of_record' | 'policy_defined';
    confidence: number;
    validFrom?: string;
    validTo?: string;
    supersedesAssertionId?: string;
    evidenceRefs: string[];
    metadata?: Record<string, unknown>;
}

Contract members ​

MemberKindSignatureDescription
assertionIdpropertyassertionId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
authoritypropertyauthority: "user_confirmed" | "human_reviewed" | "system_of_record" | "policy_defined"Public property; its type, readonly modifier and optionality are shown in the signature.
confidencepropertyconfidence: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
evidenceRefspropertyevidenceRefs: string[]Public property; its type, readonly modifier and optionality are shown in the signature.
metadatapropertymetadata?: Record<string, unknown>Public property; its type, readonly modifier and optionality are shown in the signature.
objectpropertyobject: unknownPublic property; its type, readonly modifier and optionality are shown in the signature.
predicatepropertypredicate: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
subjectpropertysubject: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
supersedesAssertionIdpropertysupersedesAssertionId?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
validFrompropertyvalidFrom?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
validTopropertyvalidTo?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.

MemoryExtractionSourceType ​

Public type alias for Memory Extraction Source Type; the declaration contains its complete type expression.

  • Kind: type
  • Import: import type { MemoryExtractionSourceType } from '@codesoul-co/hypha-memory';
  • Source module: lifecycle-contracts

Declaration ​

text
export type MemoryExtractionSourceType = 'conversation' | 'truth' | 'episodic_record' | 'runtime_event' | 'tool_observation' | 'artifact' | 'structured_record' | 'custom';

MemoryMaintenanceAction ​

Public type alias for Memory Maintenance Action; the declaration contains its complete type expression.

  • Kind: type
  • Import: import type { MemoryMaintenanceAction } from '@codesoul-co/hypha-memory';
  • Source module: lifecycle-contracts

Declaration ​

text
export type MemoryMaintenanceAction = 'create' | 'noop' | 'reuse' | 'update' | 'merge' | 'supersede' | 'invalidate' | 'reject' | 'require_review';