/** * Ken's context digest — assembled fresh on each `@Ken` question. * * The build session (GG Coder) and Ken are two separate `AgentSession` objects. * Ken never appears in GG Coder's transcript; on each question we read GG * Coder's `getMessages()`, distill it into a cheap text digest, and prepend it * to the user's question as Ken's prompt body. Ken's read-only tools fill any * gap the digest misses (he can read the actual files or screenshot the UI). * * Kept pure + dependency-light so it's unit-testable without booting the sidecar * (which runs `main()` at import time). * * NOTE: static project docs (CLAUDE.md/AGENTS.md) are NOT part of this digest * — they're folded into Ken's cached system prompt once per session * (`buildKenSystemPrompt`/`buildKenAutopilotSystemPrompt` in ken-prompt.ts) so * they hit the provider prompt cache instead of being re-sent uncached on * every `@Ken` question and every autopilot review round. */ import type { Message } from "@kenkaiiii/gg-ai"; import { type WorkflowCommandSpec } from "./autopilot-gate.js"; /** How many of the most recent build-session messages to inline verbatim. */ export declare const KEN_RECENT_MESSAGE_LIMIT = 20; /** Label for a user-role message that was actually injected by Autopilot Ken. * Without it, multi-round cycles render Ken's own fix prompts as `**User:**` * and he starts reviewing against his own last prompt instead of the user's * original ask. Referenced by the autopilot system prompt — keep in sync. */ export declare const INJECTED_PROMPT_LABEL = "**Ken autopilot (injected):**"; export interface KenDigestInput { /** The user's `@Ken …` text (already stripped of the mention). */ question: string; cwd: string; gitBranch: string | null; /** Build session messages (`buildSession.getMessages()`). */ messages: Message[]; /** Platform string (defaults to process.platform). */ platform?: string; /** Override the recent-message cap (tests). */ recentLimit?: number; /** The user prompt that started the turn under review (autopilot). Pinned in * its own section so it can never scroll out of the rolling recent-activity * window during multi-round cycles. */ originalRequest?: string; /** Prompt bodies Autopilot Ken injected into the build session. Matching * user messages render under {@link INJECTED_PROMPT_LABEL}, not `**User:**`. */ injectedPrompts?: readonly string[]; /** Known workflow commands (built-in + custom). Expanded template bodies in * the transcript render as a short `[ran workflow command /name]` note * instead of hundreds of template lines masquerading as a user ask. */ workflowCommands?: readonly WorkflowCommandSpec[]; } /** * Fixed instruction fed into the digest's `question` slot in autopilot mode. * Autopilot Ken doesn't answer a user — he reviews the just-finished GG Coder * turn against the user's original ask and replies with a verdict only. The * verdict format itself is taught by his system prompt; this just points him at * the transcript and demands the machine-parseable answer. */ export declare const AUTOPILOT_REVIEW_INSTRUCTION: string; /** Inputs the sidecar gathers for an autopilot review digest (everything * `buildKenDigest` needs except the fixed review instruction, which this helper * supplies as the `question`). */ export type KenAutopilotContextInput = Omit; /** * Build the autopilot-review digest: identical to a normal Ken digest but with * the fixed {@link AUTOPILOT_REVIEW_INSTRUCTION} as the trailing question, so * Ken reviews the transcript instead of answering a user. Pure — no I/O. */ export declare function buildKenAutopilotContext(input: KenAutopilotContextInput): string; /** * Fixed instruction fed into the digest's `question` slot for an autopilot * PLAN review. In autopilot there is no user in the loop: Ken himself is the * plan reviewer — ALL_CLEAR approves (auto-accept + implementation starts), * PROMPT sends revision feedback, HUMAN is reserved for genuine user-level * decisions. IGNORE is meaningless for a plan (the sidecar maps it to approve * defensively), so the instruction forbids it outright. */ export declare const AUTOPILOT_PLAN_REVIEW_INSTRUCTION: string; /** * Build the autopilot PLAN-review digest: the normal autopilot digest plus a * `## Plan under review` section carrying the submitted plan's markdown, with * {@link AUTOPILOT_PLAN_REVIEW_INSTRUCTION} as the trailing question. Pure — * the sidecar reads the plan file and passes its content. The plan section is * spliced in before the trailing question so it sits closest to the * instruction that references it. */ export declare function buildKenAutopilotPlanContext(input: KenAutopilotContextInput & { planContent: string; }): string; /** * Build Ken's full context digest string. Pure — no I/O. The sidecar gathers the * inputs (project context, git, messages) and calls this. */ export declare function buildKenDigest(input: KenDigestInput): string; //# sourceMappingURL=ken-context.d.ts.map