@mastra/core
Version:
28 lines • 4.16 kB
TypeScript
import type { ProcessInputStepArgs, Processor } from '../processors/index.js';
export interface KnowledgeInstructionParts {
read: string;
write: string;
pins: string;
}
/** `false` adds no block; a string replaces it; a function receives each enabled part ('' when disabled) and must be deterministic. */
export type KnowledgeInstructionsOption = false | string | ((parts: KnowledgeInstructionParts) => string);
export declare const KNOWLEDGE_READ_INSTRUCTIONS = "Use the Knowledge tools for durable, shared knowledge. Pinned knowledge pages may already be in your context if <pinned-knowledge> tags are present in the visible conversation history: answer from their bodies without searching for or reading them again, and edit one straight from its body and the version shown, unless its body was cut off: then read it first, since a write replaces the whole body. Read a pinned page with knowledge_read only when the answer depends on what its notes say, or on its child pages; a note count alone is no reason to read it. For anything else, search with knowledge_search before answering from Knowledge, and read a page with knowledge_read before relying on it. To see how a scope or section is organized, list it with knowledge_list and read pages by the refs it gives. Read a page whole first; when its body is too long, it comes back as its headings with line numbers and the first lines under each: read the section you need, or match the terms you are looking for. A result's more says what it left out: follow it only when what you need is not already in what you have read, and answer as soon as you have it. Cite the page or note you used. When nothing is found, say so plainly instead of guessing. When notes disagree, show both with their dates.";
export declare const KNOWLEDGE_WRITE_INSTRUCTIONS = "When you write to Knowledge, add one durable fact per note with knowledge_note, on the page it is about. Add notes to an existing page before creating a new one. Put long-form text such as specs and runbooks in a page body with knowledge_page. A body write replaces the whole body. When a read returns only part of a body (numbered lines from a long page, a section, or matches), each part comes with its range: to edit those lines, write the new text, without the line numbers, with that range (or a smaller one inside it) and the version you read, and only those lines are replaced. Never write a partial body back without its range. Write page bodies in markdown (headings, lists, links); notes may use inline markdown such as links and code. Record a change as a new dated note rather than rewriting an old one, and remove only notes that are wrong.";
export declare const KNOWLEDGE_PINS_INSTRUCTIONS = "Maintain pinned pages with knowledge_pin (op pin or unpin). Pinned pages are delivered to the main agent on every turn, so they cost tokens permanently and must stay short. Pin only knowledge that should apply without being asked for, such as standing instructions, durable preferences, and hard constraints. Pin only knowledge that is BOTH costly to rediscover AND not the kind of thing a future agent would think to search for; anything a reminder can surface on demand does not belong in the pin set. Unpin a page as soon as it stops being unconditionally true.";
export declare function buildKnowledgeInstructions(groups: {
read: boolean;
write: boolean;
pins: boolean;
}, option?: KnowledgeInstructionsOption): string;
export declare const KNOWLEDGE_INSTRUCTIONS_PROCESSOR_ID: 'knowledge-instructions-processor';
/** Adds Knowledge's fixed usage block as a system message. The text depends only on configuration, so it is prompt-cacheable. */
export declare class KnowledgeInstructionsProcessor implements Processor<typeof KNOWLEDGE_INSTRUCTIONS_PROCESSOR_ID> {
private readonly instructions;
readonly id: "knowledge-instructions-processor";
readonly name = "Knowledge Instructions Processor";
constructor(instructions: string);
processInputStep({ messageList }: ProcessInputStepArgs): {
messageList: import("../agent").MessageList;
};
}
//# sourceMappingURL=instructions.d.ts.map