@blundergoat/goat-flow
Version:
AI coding agent harness and local dashboard for Claude Code, OpenAI Codex, Google Antigravity, and GitHub Copilot - setup audits, guardrails, structured skills, deny hooks, and persistent learning loops.
60 lines • 2.46 kB
TypeScript
/**
* Curates a bounded slice of learning-loop memory for generated prompts.
*
* Full learning-loop validation belongs to `goat-flow stats --check`; this
* module only selects enough recent evidence to steer the next agent without
* broad-loading footgun, lesson, pattern, or decision buckets.
*/
import type { LearningLoopEntryKind, SharedFacts } from "../types.js";
type LearningLoopContextSurface = "quality-agent-setup" | "quality-harness" | "quality-process" | "setup" | "maintenance";
/** Per-kind caps keep one noisy learning-loop bucket from consuming the prompt. */
interface KindBudget {
maxBytes: number;
maxEntries: number;
}
/** Caller-tunable selection policy for a prompt surface. */
export interface LearningLoopContextOptions {
surface?: LearningLoopContextSurface;
maxBytes?: number;
perEntryMaxBytes?: number;
includeStale?: boolean;
includeDecisions?: boolean;
includeOversized?: boolean;
perKind?: Partial<Record<LearningLoopEntryKind, Partial<KindBudget>>>;
}
/** Entry excerpt selected for the compact prompt block. */
interface SelectedLearningLoopEntry {
sourcePath: string;
kind: LearningLoopEntryKind;
title: string;
reasonSelected: string;
excerpt: string;
staleRefs: string[];
invalidLineRefs: string[];
}
/** Final selection plus accounting metadata embedded in the prompt wrapper. */
export interface LearningLoopContextSelection {
entries: SelectedLearningLoopEntry[];
budgetUsed: number;
budgetMax: number;
selectedCount: number;
omittedCount: number;
zeroHit: boolean;
}
/**
* Select deterministic, size-bounded learning-loop context from shared facts.
*
* @param sharedFacts - Extracted project facts containing learning-loop entries.
* @param options - Surface-specific caps and inclusion overrides.
* @returns Prompt-ready selection and budget accounting.
*/
export declare function selectLearningLoopContext(sharedFacts: Pick<SharedFacts, "learningLoopEntries">, options?: LearningLoopContextOptions): LearningLoopContextSelection;
/**
* Render the selected entries as a compact prompt block.
*
* @param selection - Selection returned by `selectLearningLoopContext`.
* @returns XML-like prompt block, or an empty string when no entries were selected.
*/
export declare function renderLearningLoopContext(selection: LearningLoopContextSelection): string;
export {};
//# sourceMappingURL=learning-loop-context.d.ts.map