Commit 634b0d33efe1
Changed files (2)
dots
pi
agent
extensions
ai-storage
dots/pi/agent/extensions/ai-storage/index.ts
@@ -132,7 +132,7 @@ export default function (pi: ExtensionAPI) {
name: "save_session_to_history",
label: "Save Session to History",
description:
- "Saves a session summary to ~/.local/share/ai/sessions/. Works with any AI coding tool (pi, claude, copilot, cursor). Auto-detects which tool is being used. If called multiple times in the same session, updates the existing file.",
+ "Saves a session summary to ~/.local/share/ai/sessions/. Works with any AI coding tool (pi, claude, copilot, cursor). Auto-detects which tool is being used. If called multiple times in the same session, updates the existing file. Content MUST include **Project:** and **Directory:** metadata fields.",
parameters: {
type: "object",
properties: {
@@ -142,7 +142,7 @@ export default function (pi: ExtensionAPI) {
},
content: {
type: "string",
- description: "Full markdown content following the Session Entry template from history-system.md",
+ description: "Full markdown content. MUST include metadata header with **Date:**, **Tool:**, **Project:** (org/repo or path), and **Directory:** (working directory) fields for proper categorization.",
},
},
required: ["description", "content"],
@@ -272,7 +272,7 @@ export default function (pi: ExtensionAPI) {
name: "save_research",
label: "Save Research",
description:
- "Saves research findings to ~/.local/share/ai/research/YYYY-MM/. Use for exploratory research, technical investigation, or background study on a topic. Research is date-organized for temporal context.",
+ "Saves research findings to ~/.local/share/ai/research/YYYY-MM/. Use for exploratory research, technical investigation, or background study on a topic. Research is date-organized for temporal context. Content should include **Project:** or **Repository:** metadata when the research relates to a specific project.",
parameters: {
type: "object",
properties: {
@@ -335,7 +335,7 @@ export default function (pi: ExtensionAPI) {
name: "save_plan",
label: "Save Plan",
description:
- "Saves a plan to ~/.local/share/ai/plans/. Use for project plans, roadmaps, or structured action plans. Plans are NOT date-organized as they represent timeless strategies.",
+ "Saves a plan to ~/.local/share/ai/plans/. Use for project plans, roadmaps, or structured action plans. Plans are NOT date-organized as they represent timeless strategies. Content should include **Project:** metadata to identify the target project.",
parameters: {
type: "object",
properties: {
@@ -396,7 +396,7 @@ export default function (pi: ExtensionAPI) {
name: "save_learning",
label: "Save Learning",
description:
- "Saves a learning or insight to ~/.local/share/ai/learnings/YYYY-MM/. Use for lessons learned, insights gained, or knowledge discoveries. Learnings are date-organized to track knowledge evolution.",
+ "Saves a learning or insight to ~/.local/share/ai/learnings/YYYY-MM/. Use for lessons learned, insights gained, or knowledge discoveries. Learnings are date-organized to track knowledge evolution. Content should include **Project:** metadata when the learning relates to a specific project.",
parameters: {
type: "object",
properties: {
@@ -831,6 +831,8 @@ export default function (pi: ExtensionAPI) {
}
}
+ const cwd = process.cwd();
+
// Build the prompt for the AI
const prompt = `Please generate ${currentSessionFile ? "an updated" : "a"} session summary for this conversation.
@@ -852,6 +854,10 @@ The summary should include:
- The outcome
- Any next steps
+IMPORTANT: The metadata header MUST include **Project:** and/or **Repository:** when applicable.
+Infer the project name from the working directory, git remote, or conversation context.
+For example: "tektoncd/pipeline", "~/src/home", "vdemeester/chisel", etc.
+
Use this template format:
\`\`\`markdown
@@ -861,6 +867,8 @@ Use this template format:
**Time:** ${time}
**Host:** ${host}
**Tool:** ${tool}
+**Project:** <infer from context, e.g. org/repo or ~/path>
+**Directory:** ${cwd}
## Summary
Brief description of what was accomplished.
dots/pi/agent/extensions/ai-storage/summarizer.ts
@@ -68,6 +68,10 @@ Session metadata:
Conversation:
${conversationText}
+IMPORTANT: The metadata header MUST include **Project:** and/or **Repository:** when applicable.
+Infer the project name from the working directory, git remote, or conversation context.
+For example: "tektoncd/pipeline", "~/src/home", "vdemeester/chisel", etc.
+
Output ONLY the markdown, with this exact format:
# Session: <3-5 Word Title>
@@ -76,6 +80,8 @@ Output ONLY the markdown, with this exact format:
**Time:** ${transcript.savedAt.split("T")[1]?.slice(0, 5) || "unknown"}
**Host:** ${transcript.host}
**Tool:** ${transcript.tool}
+**Project:** <infer from working directory and conversation context>
+**Directory:** ${transcript.cwd}
## Summary
Brief description of what was accomplished.
@@ -179,12 +185,12 @@ function generateFallbackSummary(transcript: Transcript): string {
**Time:** ${time}
**Host:** ${transcript.host}
**Tool:** ${transcript.tool}
+**Directory:** ${transcript.cwd}
## Summary
This session was auto-recovered from an unsaved transcript. AI summarization failed - manual review recommended.
## Context
-- **Working directory:** \`${transcript.cwd}\`
- **Message count:** ${transcript.messageCount}
## First User Message