/**
* Auto-remember engine for Iranti's Attendant post-response scan.
*
* Handles two memory paths:
*
* 1. Explicit assistant memory: scans the assistant's response for
* `...` structured tags and extracts
* them into ExtractedMemoryFact objects ready for iranti_write. Used by
* the post-response attend scan to persist facts the agent explicitly flagged.
*
* 2. User-prompt auto-remember: scans user messages for imperative "remember X"
* and "my X is Y" patterns and writes them as personal facts automatically,
* without requiring the agent to tag them explicitly.
*
* 3. Backfill detection: identifies whether prior conversation turns contain
* durable facts that should have been persisted but weren't, and surfaces
* a backfill suggestion in the handshake response.
*
* Key exports:
* - extractExplicitAssistantMemory() — parse iranti tags from an assistant response
* - runAutoRemember() — write auto-remembered facts from a user prompt
* - detectMandatoryRecall() — detect if a turn requires recall before responding
* - detectBackfillOpportunity() — find un-persisted facts in a conversation
* - canonicalizeMemoryKey() — normalize a key string (British → American spellings)
* - isPersonalEntityType() — check if an entity type maps to personal memory
*/
type IrantiQueryClient = {
query(entity: string, key: string): Promise<{
found: boolean;
value?: unknown;
}>;
write(input: {
entity: string;
key: string;
value: unknown;
summary: string;
confidence: number;
source: string;
agent: string;
properties?: Record;
}): Promise;
};
type DurableMemoryClass = 'preference' | 'profile' | 'decision' | 'next_step' | 'blocker' | 'owner' | 'current_step' | 'open_risks' | 'artifact' | 'file_change' | 'action_log' | 'failed_path' | 'alternative_route';
type ExtractedMemoryFact = {
scope: 'personal' | 'project';
key: string;
value: unknown;
summary: string;
durableClass: DurableMemoryClass;
};
type AutoRememberResult = {
enabled: boolean;
entity?: string;
extracted: number;
written: number;
skipped: Array<{
key: string;
reason: string;
}>;
};
export type MandatoryRecallDecision = {
required: boolean;
scope: 'personal' | 'project' | null;
key?: string;
reason?: string;
};
export type BackfillChatRole = 'user' | 'assistant' | 'unknown';
export type BackfillChatMessage = {
role: BackfillChatRole;
text: string;
};
export declare const USER_PROMPT_AUTO_REMEMBER_SOURCE = "UserPromptAutoRemember";
export declare function canonicalizeMemoryKey(text: string): string;
export declare function isPersonalEntityType(entityType: string): boolean;
export declare function isAutoRememberEnabled(): boolean;
export declare function getPersonalMemoryEntity(explicit?: string | null): string;
export declare function getPersonalRecallEntities(explicit?: string | null): string[];
export declare function getProjectMemoryEntity(explicit?: string | null): string | undefined;
export declare function resolvePersonalWriteTarget(params: {
entity: string;
key: string;
personalEntity?: string | null;
}): {
entity: string;
rerouted: boolean;
originalEntity?: string;
};
export declare function classifyMemoryScope(message: string): 'personal' | 'project' | null;
export declare function isPersonalMemoryKey(key: string): boolean;
export declare function detectMandatoryRecall(message: string): MandatoryRecallDecision;
export declare function extractExplicitPromptMemory(prompt: string): ExtractedMemoryFact[];
export declare function extractExplicitAssistantMemory(response: string): ExtractedMemoryFact[];
export declare function extractResponseArtifacts(response: string): ExtractedMemoryFact[];
export declare function autoRememberPromptFacts(params: {
iranti: IrantiQueryClient;
prompt: string;
agent: string;
source: string;
entity?: string | null;
projectEntity?: string | null;
personalEntity?: string | null;
confidence?: number;
ledgerContext?: {
source?: string;
host?: string | null;
};
}): Promise;
export declare function autoRememberAssistantFacts(params: {
iranti: IrantiQueryClient;
response: string;
agent: string;
source: string;
entity?: string | null;
projectEntity?: string | null;
personalEntity?: string | null;
confidence?: number;
ledgerContext?: {
source?: string;
host?: string | null;
};
}): Promise;
export declare function rememberAssistantResponseFacts(params: {
iranti: IrantiQueryClient;
response: string;
agent: string;
source: string;
entity?: string | null;
projectEntity?: string | null;
personalEntity?: string | null;
confidence?: number;
ledgerContext?: {
source?: string;
host?: string | null;
};
}): Promise;
export declare function parseBackfillChatTranscript(content: string): BackfillChatMessage[];
export declare function backfillChatHistory(params: {
iranti: IrantiQueryClient;
content: string;
agent: string;
source: string;
entity?: string | null;
projectEntity?: string | null;
personalEntity?: string | null;
confidence?: number;
}): Promise;
export {};
//# sourceMappingURL=autoRemember.d.ts.map