From 37e44f8186e5ed6106f16be1c44a530a3e8dd793 Mon Sep 17 00:00:00 2001 From: sumeyaaaa Date: Sat, 21 Feb 2026 13:56:17 +0300 Subject: [PATCH] chore: commit src/core/prompts/tools/native-tools/record_lesson.ts --- .../tools/native-tools/record_lesson.ts | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 src/core/prompts/tools/native-tools/record_lesson.ts diff --git a/src/core/prompts/tools/native-tools/record_lesson.ts b/src/core/prompts/tools/native-tools/record_lesson.ts new file mode 100644 index 0000000000..0c16094844 --- /dev/null +++ b/src/core/prompts/tools/native-tools/record_lesson.ts @@ -0,0 +1,46 @@ +import type OpenAI from "openai" + +/** + * Tool for recording lessons learned to AGENT.md (Phase 4 requirement). + * This tool allows the agent to append lessons learned when verification steps fail + * or when important insights are discovered during development. + */ +const recordLesson: OpenAI.Chat.ChatCompletionFunctionTool = { + type: "function", + function: { + name: "record_lesson", + description: + "Record a lesson learned to .orchestration/AGENT.md. Use this tool when verification steps (linter/test) fail, when architectural decisions are made, or when important insights are discovered. Lessons are appended with timestamps and context information.", + parameters: { + type: "object", + properties: { + lesson: { + type: "string", + description: + "The lesson learned or insight to record. Should be clear and actionable for future reference.", + }, + context: { + type: "object", + properties: { + tool: { + type: "string", + description: "Optional: The tool that was being used when the lesson was learned.", + }, + error: { + type: "string", + description: "Optional: The error message or issue that led to this lesson.", + }, + file: { + type: "string", + description: "Optional: The file path related to this lesson.", + }, + }, + description: "Optional context information about when/where this lesson was learned.", + }, + }, + required: ["lesson"], + }, + }, +} + +export default recordLesson