import type { CoreAxiomBlockOptions } from '../core-principles/core-axiom-block.js'; import type { OutputLanguage } from '../language-directive.js'; import type { FormationContext } from './formation-context.js'; export interface ScribePromptBuilderInput { taskId: string; contextHash: string; sourcePhilosopherArtifactId: string; /** * PRI-816 (R-01): authoritative dreamer artifact id, extracted by the * runner from the philosopher artifact's `sourceDreamerArtifactId`. When * present the scribe copies it into `sourceTrace.dreamerArtifactId`; * when absent the field stays optional (pre-PRI-508 flows). */ sourceDreamerArtifactId?: string; philosopherArtifact: unknown; /** * PRI-838: bounded projection of the formation evidence this formation was * built from (dreamer proposals + source diagnosis + provenance). Absent when * the dreamer artifact could not be resolved — the prompt then keeps its * pre-PRI-838 shape exactly (legacy / degraded compatibility). */ formationContext?: FormationContext; /** Owner's preferred language for principle generation (PRI-336). */ outputLanguage?: OutputLanguage; /** Inject core axiom grounding section (default: false). */ coreGrounding?: boolean; } export interface ScribePromptInput { taskId: string; contextHash: string; sourcePhilosopherArtifactId: string; sourceDreamerArtifactId?: string; philosopherArtifact: unknown; /** PRI-838: present only when formation evidence resolved for this run. */ formationContext?: FormationContext; promptContractVersion: string; } export interface ScribePromptBuildResult { readonly message: string; readonly promptInput: ScribePromptInput; /** * PRI-633: base-layer system prompt (role + protocol). Previously embedded * in the payload as `scribeInstruction`; now delivered via the system * channel by the runtime adapter. */ readonly systemPrompt: string; } /** * PRI-838: the formation-evidence addendum (system-prompt half of the repair). * * The CANDIDATE PRIORITY contract below is reused **byte-identical** from the * frozen PRI-815 Phase A addendum (`scripts/pri-815/b-addendum.mjs`, * `B_ADDENDUM_VERSION = 'pri815-b-addendum.v1'`). That exact text is the * information channel which produced the measured * `NET_ADVANTAGE = 85.7pp` (W=19 / L=1 / T=1) in PR #1753, so re-deriving or * paraphrasing it would discard the only quantitative evidence we have for it. * * Two deliberate deltas from the frozen text, both required to productionise it: * 1. the locator paragraph — the production payload nests the three blocks * under `formationContext`, where the harness passed them flat; * 2. one degradation bullet — production formations include legacy artifacts * with no resolvable diagnosis (PRI-838 Phase 4 Case 2/3), and the model * must be told to degrade rather than invent a missing source intent. * * Every other line is unchanged. */ export declare const FORMATION_EVIDENCE_ADDENDUM_VERSION = "pri815-b-addendum.v1"; export declare const FORMATION_EVIDENCE_ADDENDUM = "\n\nADDITIONAL CONTEXT (formation evidence recovery):\nYour input additionally carries `formationContext` \u2014 the ORIGINAL FORMATION EVIDENCE that started this formation:\n- formationContext.sourceDiagnosis: the diagnostician output that started this formation, including its rootCause, summary, violatedPrinciples and evidence array (the primary source intent).\n- formationContext.dreamerProposals: ALL alternative candidates the Dreamer proposed (not only the selected one), each with badDecision / betterDecision / rationale / confidence / riskLevel / strategicPerspective. `priorityRank` is a derived reading aid over the Dreamer's own signals, not an authority.\n- formationContext.provenance: lineage ids linking this formation back to the source pain and diagnosis.\n\nCANDIDATE PRIORITY (must obey):\nsource intent (sourceDiagnosis) > critique conclusions (philosopherArtifact) > proposals as candidate evidence (dreamerProposals).\n- The philosopher's critique already evaluated the proposals: do NOT revive a proposal the critique explicitly rejected.\n- Do NOT merge mutually exclusive proposals into one principle.\n- Use the proposals as EVIDENCE for specificity (concrete failure modes, concrete better decisions), never to widen the principle's scope beyond the source intent.\n- Ground every concrete claim in the formation evidence (diagnosis evidence, a proposal's concrete decision, or the critique). Do NOT invent specifics that are absent from this formation context.\n- Longer output is not better: the goal is a MORE FAITHFUL, MORE SPECIFIC, correctly-bounded principle, not a longer one.\n- When `formationContext.sourceDiagnosis` is absent, the source intent is UNAVAILABLE: say so in `risks` instead of inventing one, and let the critique conclusions carry the intent.\n- All other PROTOCOL, OUTPUT FORMAT and CONSTRAINTS above remain unchanged."; /** * Build the Scribe protocol instruction with optional core axiom grounding. * * When `coreGrounding` is true, a CORE AXIOMS section is injected so the * Scribe can ensure the formal principle draft is consistent with the * existing core principle framework. * * When `formationEvidence` is true (PRI-838), the formation-evidence addendum * is appended after the CONSTRAINTS section — the same system-channel placement * the validated PRI-815 Phase A Arm B used. */ export declare function buildScribeProtocolInstruction(opts?: CoreAxiomBlockOptions & { outputLanguage?: OutputLanguage; formationEvidence?: boolean; }): string; /** * PRI-703 Phase 1 (Owner decision 2026-09-07): bumped v1 → v2. The scribe * output contract gains the required structured intentContract — the single * Owner-intent alignment anchor consumed by rule generation, evaluation, and * repair. Wire shape is additive; the hand-rolled validator enforces the five * non-empty fields when the key is present. */ /** * PRI-816: bumped v2 → v3. The OUTPUT FORMAT sourceTrace.dreamerArtifactId * instruction changed semantics — from "scrape the philosopher artifact for * an id (field name mismatched)" to "copy input.sourceDreamerArtifactId * exactly" — the prompt input gained `sourceDreamerArtifactId`, and the * CONSTRAINTS text tightened accordingly (audit R-01 lineage fix). */ /** * PRI-838: bumped v3 → v4. The prompt input gained the optional * `formationContext` block (dreamer proposals + source diagnosis + provenance) * and the system prompt conditionally carries the formation-evidence addendum * (`FORMATION_EVIDENCE_ADDENDUM`, the frozen Phase A text). Additive: the * OUTPUT FORMAT, the CONSTRAINTS, the validator and `ScribeOutputV1` are * unchanged, and a run without formation evidence emits exactly the v3 wire * shape plus the new version string. */ export declare const SCRIBE_PROMPT_CONTRACT_VERSION = "scribe-output-v1.prompt.v4"; export declare class ScribePromptBuilder { private readonly coreGrounding; private readonly outputLanguage?; constructor(opts?: { coreGrounding?: boolean; outputLanguage?: OutputLanguage; }); /** * Build a scribe prompt with optional core axiom grounding and language directive (PRI-336). */ buildPrompt(input: ScribePromptBuilderInput): ScribePromptBuildResult; } //# sourceMappingURL=scribe-prompt-builder.d.ts.map