/** Single runtime source of truth for memory types — CLI validation and any * future enum checks must use this array, not a hand-copied list (the CLI * once drifted to a stale 5-type copy and silently rejected note/event). * * U4-local (#111, ADR D4): reconciled to the canonical ~10-value union * shared with `@astragenie/astramem-contracts` (`contracts/schemas/ * atom.v1.schema.json` `type` enum) — astramem-local's original 7 * (`decision`..`event`) plus 3 cloud-only types (`preference`, * `task_result`, `summary`). * * The `memories.type` SQLite CHECK constraint was widened to match * (migrations/017-widen-memory-types.sql) — a real INSERT of `preference`/ * `task_result`/`summary` no longer throws at the DB layer. The MCP * `remember` tool (src/mcp/server.ts) and the REST `POST /remember` route * (src/server/routes/search.ts) both write against this widened union as * part of the canonical cross-repo save-contract unification. * The distill pipeline's own extraction registry (`src/distill/prompts/ * extract.ts` AtomSchema) and `src/pipeline/handlers/distill-events.ts` * are deliberately left at 7 — those are separate writer-surface * contracts (the LLM extractor itself never emits the 3 cloud types), * out of scope for this change. */ export declare const MEMORY_TYPES: readonly ["decision", "fact", "lesson", "command", "todo", "note", "event", "preference", "task_result", "summary"]; export type MemoryType = (typeof MEMORY_TYPES)[number]; /** ADR-009 memory scope — private is the default for all local-agent writes. * Renamed from 'personal' (DEC-048, U7-local astramem-local#110); team/org * are unchanged. Runtime source of truth (FEAT-532 L2), same MEMORY_TYPES * pattern above — a `filters.scope` enum check draws from one array * instead of a hand-copied literal list. */ export declare const MEMORY_SCOPES: readonly ["private", "team", "org"]; export type MemoryScope = (typeof MEMORY_SCOPES)[number]; /** * One-release inbound alias (U7-local astramem-local#110, DEC-048): accepts * the pre-rename 'personal' literal on top of the canonical MemoryScope so * older clients/plugins that still send it don't break. Boundary-only type — * nothing in storage or contracts/schemas' *required* enum should ever store * or require the literal 'personal'; normalizeScopeAlias() below converts it * before it reaches persistence. * * TODO(remove-personal-alias): drop this type, normalizeScopeAlias(), and * the wire schemas' additive 'personal' enum value in the release AFTER this * one — tracked in astramem-local#115. */ export type MemoryScopeAlias = MemoryScope | 'personal'; /** * Normalize an inbound scope value that may still carry the pre-rename * 'personal' literal (DEC-048 one-release alias) to the canonical * MemoryScope. Apply at every boundary that parses a client-supplied scope * (currently: POST /memory/:id/promote) so no new row ever persists the * literal 'personal'. */ export declare function normalizeScopeAlias(scope: MemoryScopeAlias): MemoryScope; export interface Memory { id: string; type: MemoryType; text: string; normalized_text: string; repo: string | null; project: string | null; branch: string | null; agent: string | null; session_id: string | null; importance: number; confidence: number; hash: string; embedding_provider: string | null; embedding_model: string | null; embedding_dim: number | null; created_at: number; updated_at: number; source_hash: string | null; evidence: string | null; /** Bitemporal valid-time start (ADR-001). Set to created_at at insert time; * advanced to the supersession instant when this atom becomes a successor * (supersede() co-issues new.valid_from = old.valid_to — FEAT-401). */ valid_from: number; /** Bitemporal valid-time end. NULL = currently valid. */ valid_to: number | null; /** Id of the memory that superseded this one (lifecycle ops, Wave 2b). */ superseded_by: string | null; /** Consolidation lineage — memory ids this atom was derived from. */ derived_from: string[] | null; /** ADR-009 scope. Defaults to 'private'. */ scope: MemoryScope; /** TTL/archival tiers (FEAT-404). true once the archival policy (or a * direct MemoryEventRepo.archive() call) has archived this atom — set in * the same transaction as valid_to, non-destructively (row survives, * restorable via MemoryEventRepo.restore()). */ archived: boolean; /** Epoch ms the archive transition happened; null while archived=false. */ archived_at: number | null; /** FEAT-455 / ADR-012 decision 4, widened 2026-07-12: `'auto_capture'` * from the hook-tap auto-capture trigger, `'hook_close'` from the * ordinary astramem-plugin close-capture hook, `null` for every other * write path (`/remember`, manual hook capture predating FEAT-449, Codex * capture — the vast majority of rows). Widened again FEAT-458 S3: * `'proxy'` from the LLM proxy relay's capture fork (ADR-013). Widened * again FEAT-489 (Slice A): `'audio_transcribe'` from the on-device * audio-file transcription pipeline (src/pipeline/handlers/transcribe.ts). * Widened again FEAT-491: `'meeting_captions'` from caption-sourced * transcripts scraped by the astramem-plugin browser extension. See * InsertInput.capture_source. */ capture_source: 'auto_capture' | 'hook_close' | 'proxy' | 'audio_transcribe' | 'meeting_captions' | null; /** FEAT-491: display-name/label this atom's `evidence` excerpt was traced * back to (src/distill/attribute-speaker.ts) — see InsertInput.speaker_label. */ speaker_label: string | null; /** FEAT-489/FEAT-491 (ADR-017 decision 6): tri-state — `null` means "not * applicable or not recorded" (every atom without a third-party-speaker * capture source), `true`/`false` means an explicit disclosure * determination was made at capture time. Plumbed straight through from * `transcripts.consent_disclosed` the same way `capture_source` already * flows (distillHandler -> PipelineContext -> EmbedIndexContext -> this * INSERT). See InsertInput.consent_disclosed. */ consent_disclosed: boolean | null; /** Issue #205 provenance flag — `false` (default, every pre-fix row) means * "extraction never considered this atom's validity"; `true` means * extraction looked (`valid_to` is `null` because the source text left * the fact genuinely unbounded, or populated because the source text * stated an end). Distinguishes REAL-zero ("this fact is unbounded, we * checked") from BROKEN-zero ("nobody ever looked") per ADR-015 — see * migrations/033-atom-validity-extracted.sql. Deliberately NOT a * query-path input: `valid_to`/`validityFilterClause()` semantics are * unchanged by this field. */ validity_extracted: boolean; /** Issue #209 (ADR-015 REAL-zero/BROKEN-zero marker): `false` (default) * means the vec-index upsert either succeeded inline or has never been * attempted; `true` means an upsert attempt failed and this row is * vector-search-blind until the `reembed` retry drain (write-time * enqueue + the `cleanup` job's 24h sweep, see migrations/041-vec-index- * retry.sql) picks it back up. See MemoryRepo.markNeedsVecIndex / * clearNeedsVecIndex. */ needs_vec_index: boolean; /** FEAT-547 (atom-triage v2): tri-state semantic evidence-support flag — * `null` means "not evaluated" (every pre-FEAT-547 row; every row from a * write path other than the triage-enabled distill stage-8 insert; every * atom the triage batch had no evidence quote to judge; every atom * triaged in 'dry-run' mode, which logs but never applies). `true`/ * `false` means an 'enabled'-mode atom-triage verdict judged this atom's * `evidence` quote as semantically supporting (or not supporting) its * claim. Purely additive/queryable — NEVER used to delete or rewrite the * atom itself (see src/distill/atom-triage.ts's doc comment). */ evidence_supported: boolean | null; /** * Retrieval-overhaul Phase 5 (storage half, migration 057) — structured * source-provenance for `evidence` (above), replacing the ~25%-match fuzzy * back-map the eval harness previously had to do at READ time with a * located span computed once at WRITE time. See * src/distill/locate-evidence.ts for how these are computed and * migrations/057-evidence-provenance.sql for the full field-by-field * rationale. All four are `null` together (never partially populated) for * every write path without a source transcript to locate evidence within, * every atom with no `evidence` string, and every atom whose evidence * didn't confidently match anywhere in its own source transcript. */ evidence_turn_index: number | null; evidence_char_start: number | null; evidence_char_end: number | null; /** The exact verbatim transcript text located at * [evidence_char_start, evidence_char_end) — distinct from `evidence` * (the extractor's own, possibly paraphrased, excerpt). See * migrations/057-evidence-provenance.sql. */ evidence_span: string | null; }