The buildScripts/ai/summarizeSession.mjs script should be enhanced to extract more detailed, structured metadata from each agent session. This will allow for better filtering, analysis, and learning from past sessions.
The Problem
Currently, the session summary is a block of text. While useful, it is difficult to programmatically query or filter sessions based on their quality, outcome, or complexity.
The Solution
The summarization prompt sent to the generative model will be updated to request a JSON object containing the summary along with several key metrics.
New Data Structure:
The model will be asked to provide a JSON object with the following structure:
{
"summary": "A detailed summary of the session's events...",
"title": "A concise, descriptive title for the session.",
"category": "bugfix | feature | refactoring | documentation | new-app | etc.",
"quality": "A score (0-100) rating the session's flow and focus.",
"productivity": "A score (0-100) indicating if the session's goals were achieved.",
"impact": "A score (0-100) estimating the significance of the changes made.",
"complexity": "A score (0-100) rating the task's complexity based on factors like file touchpoints, depth of changes (core vs. app-level), and cognitive load. A simple typo fix is < 10. A deep refactoring of a core module is > 90.",
"technologies": ["neo.mjs", "chromadb", "nodejs"]
}
Implementation Steps:
- Update Prompt: Modify the
summaryPrompt in buildScripts/ai/summarizeSession.mjs to instruct the model to return the data in the specified JSON format.
- Parse Response: Parse the JSON response from the model.
- Store Metadata: Add the new fields (
title, category, quality, productivity, impact, complexity, technologies) to the metadatas object being upserted into the sessionsCollection. The summary text will remain the main document content.
The
buildScripts/ai/summarizeSession.mjsscript should be enhanced to extract more detailed, structured metadata from each agent session. This will allow for better filtering, analysis, and learning from past sessions.The Problem
Currently, the session summary is a block of text. While useful, it is difficult to programmatically query or filter sessions based on their quality, outcome, or complexity.
The Solution
The summarization prompt sent to the generative model will be updated to request a JSON object containing the summary along with several key metrics.
New Data Structure:
The model will be asked to provide a JSON object with the following structure:
{ "summary": "A detailed summary of the session's events...", "title": "A concise, descriptive title for the session.", "category": "bugfix | feature | refactoring | documentation | new-app | etc.", "quality": "A score (0-100) rating the session's flow and focus.", "productivity": "A score (0-100) indicating if the session's goals were achieved.", "impact": "A score (0-100) estimating the significance of the changes made.", "complexity": "A score (0-100) rating the task's complexity based on factors like file touchpoints, depth of changes (core vs. app-level), and cognitive load. A simple typo fix is < 10. A deep refactoring of a core module is > 90.", "technologies": ["neo.mjs", "chromadb", "nodejs"] }Implementation Steps:
summaryPromptinbuildScripts/ai/summarizeSession.mjsto instruct the model to return the data in the specified JSON format.title,category,quality,productivity,impact,complexity,technologies) to themetadatasobject being upserted into thesessionsCollection. Thesummarytext will remain the main document content.