/** * Entity-only LLM extraction (FEAT-402 AC-7) — used by the `entity-backfill` * command to extract entities from ALREADY-DISTILLED memory text, without * re-running the full 8-stage distill pipeline (no re-chunking, no atom * re-extraction, memory text and hash untouched). Distill-time extraction * (stage 5, src/distill/stages/05-extract.ts) instead emits entities inline * on each atom in the SAME LLM call — this module exists only for the * backfill's one-shot pass over pre-existing rows that predate that stage. * * Deliberately lenient: unlike stage 5's extractChunk (which throws * DeterministicError on parse failure and poisons the job), a bad response * here just returns [] and lets the caller log + move on. The corpus is * scanned by "not yet linked" (src/entity/backfill.ts), so a memory that got * an empty/failed extraction this run remains a valid candidate on the next * run — the backfill is naturally resumable without a checkpoint table. */ import type { LLMProvider } from '../contracts/index.js'; import { type AtomEntity } from '../distill/prompts/extract.js'; import { BudgetTracker } from '../budget/tracker.js'; export declare const ENTITY_ONLY_SYSTEM_PROMPT = "You identify named things mentioned in a short piece of durable knowledge extracted from an AI coding agent transcript.\n\nOutput STRICT JSON matching:\n{\n \"entities\": [\n { \"name\": \"\", \"kind\": \"actor\" | \"team\" | \"org\" | \"project\" | \"product\" | \"workitem\" | \"decision\" | \"tech\" | \"tool\" | \"concept\" | \"event\" | \"other\", \"subtype\": \"human\" | \"ai\" }\n ]\n}\n\nkind is one of:\n- actor: a named human OR AI agent \u2014 set subtype to \"human\" or \"ai\" when you can tell which; omit subtype when unsure\n- team: a named team or squad within an organization\n- org: a company or organization (e.g. \"Anthropic\", \"Astragenie\")\n- project: a named codebase/repo/workspace the work belongs to (e.g. \"astramem-local\")\n- product: a named product or app (e.g. \"AstraMemory\", \"GitHub Copilot\")\n- workitem: a FEAT/PR/issue/ticket id (e.g. \"FEAT-402\", \"#145\")\n- decision: a DEC/ADR reference (e.g. \"DEC-048\", \"ADR-001\")\n- tech: a language/framework/library/protocol (e.g. \"Postgres\", \"TypeScript\", \"sqlite-vec\")\n- tool: a CLI/dev tool used to do the work (e.g. \"vitest\", \"Docker\")\n- concept: a named pattern, architecture, or idea \u2014 only RECURRING technical concepts worth remembering across sessions (e.g. \"bitemporal model\", \"CRDT\")\n- event: a named happening at a point in time (e.g. \"the 2026-07-08 incident\")\n- other: doesn't fit any kind above but is still a specific named thing\n\nList every specific named thing the text is ABOUT \u2014 not every word. If nothing specific is named, return {\"entities\": []}."; /** * Extract entities from one piece of already-distilled memory text. * Returns [] (never throws) on budget-exceeded, transport, or parse failure * — callers decide whether/how to surface that (the backfill CLI counts it * as "skipped", not "failed"). */ export declare function extractEntitiesForText(text: string, provider: LLMProvider, budget: BudgetTracker, capUsd: number): Promise;