/** * RootCausePromptBuilder — Stage A prompt builder for the split diagnostician pipeline. * * Constructs the prompt for the Root Cause stage (Stage A), which identifies * the underlying cause of a pain signal using a 5-Whys causal chain and * categorises it into one of four root-cause categories. * * ## Phases * * - PHASE 1 — Evidence Review * - PHASE 2 — Causal Chain (5 Whys) * - PHASE 3 — Root Cause Classification * - PHASE 3.5 — Core Axiom Grounding (when coreGrounding=true, PRI-371) * * ## Output * * The prompt requires output matching DiagRootCauseOutputV1Schema. * * @see PRI-372 */ import type { TSchema } from '@sinclair/typebox'; import type { SchemaPromptAdapter } from '../adapter/schema-prompt-adapter.js'; import type { DiagnosticianContextPayload } from '../context-payload.js'; import type { PainCorrectionEvidence } from '../context-payload.js'; import type { OutputLanguage } from '../language-directive.js'; import type { BuildPromptOptions, PromptBuildResult } from '../diagnostician-prompt-builder.js'; /** * Options for RootCausePromptBuilder constructor and buildRootCauseInstruction. * * Uses an opts-object pattern to satisfy @typescript-eslint/max-params. * * @see PRI-372 */ export interface RootCausePromptBuilderOptions { /** Schema prompt adapter (default: DefaultSchemaPromptAdapter) */ adapter?: SchemaPromptAdapter; /** TypeBox schema for output validation (default: DiagRootCauseOutputV1Schema) */ schema?: TSchema; /** Output language directive (default: none) */ outputLanguage?: OutputLanguage; /** T-E (PRI-371): Inject core axiom grounding as PHASE 3.5 (default: false) */ coreGrounding?: boolean; /** * PRI-468: Inject intent tension check as PHASE 3.6 (default: false). * * When true, inserts the SPEC §17 text instructing the LLM to optionally * produce an `intentTension` field. When false/undefined, the prompt is * byte-identical to the pre-PRI-468 prompt (EP-03: no silent fallback). */ intentGrounding?: boolean; /** * Evidence First Attribution (Pain Diagnosis Persistence SPEC §2.2/§6, * gated by the `pain_diagnosis_persistence` flag; default: false). * * When true, inserts attribution rules that constrain PHASE 3 classification * to be evidence-driven (People only on agent-avoidable-behavior evidence, * never as a default). When false/undefined, the prompt is byte-identical * to the pre-feature prompt (EP-03: no silent fallback). */ evidenceFirstAttribution?: boolean; /** * PRI-844: the Owner's verbatim correction, when the diagnosis target * carries one. When present, inserts a PHASE 1.5 block instructing the * model to treat the Owner's own words as authoritative evidence and to * cite them verbatim (sourceRef `owner_correction`). When absent, the * prompt is byte-identical to the pre-PRI-844 prompt (EP-03: no silent * fallback) — no correction, no block, no fabrication. */ correctionEvidence?: PainCorrectionEvidence; } /** * Build the Stage A diagnostic protocol instruction (PHASE 1–3 + optional PHASE 3.5). * * Per DPB-02 (LOCKED): Output is ONLY JSON — no markdown, no file ops, no tool calls. * Per DPB-04: LLM can only analyse the context provided in the prompt; it must NOT * read files, call tools, or write to databases. * * When `coreGrounding` is true, PHASE 3.5 (Core Axiom Grounding) is inserted * between PHASE 3 and the final output instruction. When false or undefined, * a newline is inserted to preserve byte-identical output (EP-03: no silent fallback). * * @see PRI-372 */ export declare function buildRootCauseProtocolInstruction(opts?: RootCausePromptBuilderOptions): string; /** * RootCausePromptBuilder — Stage A prompt builder for the split diagnostician pipeline. * * Transforms DiagnosticianContextPayload into a PromptBuildResult for the * Root Cause stage (Stage A). The output prompt requires the LLM to produce * JSON matching DiagRootCauseOutputV1Schema. * * Uses an opts-object pattern for all methods to satisfy @typescript-eslint/max-params. * * @see PRI-372 */ export declare class RootCausePromptBuilder { private readonly adapter; private readonly schema; constructor(opts?: RootCausePromptBuilderOptions); /** * Build the Stage A diagnostic protocol instruction. * * Contains PHASE 1 (evidence review), PHASE 2 (causal chain / 5-Whys), * PHASE 3 (root cause classification), and optional PHASE 3.5 (core axiom * grounding when coreGrounding=true). * * @see PRI-372 */ buildRootCauseInstruction(opts?: RootCausePromptBuilderOptions): string; /** * Build the full prompt for Stage A. * * Transforms DiagnosticianContextPayload into a PromptBuildResult containing * the JSON message to pass as the --message argument to the LLM agent. * * Per DPB-02: Output is ONLY JSON — no markdown, no file ops, no tool calls. * Per DPB-05: This method only builds the prompt; it does NOT commit to PD database. * Per DPB-07 (as revised by PRI-633): the base-layer systemPrompt (role + * protocol) is returned separately; the profile's configured systemPrompt * remains the append layer owned by the agent profile. * * @see PRI-372 */ buildPrompt(payload: DiagnosticianContextPayload, opts?: BuildPromptOptions): PromptBuildResult; } //# sourceMappingURL=rootcause-prompt-builder.d.ts.map