Add skill definitions (SKILL.md + run.py) for all agent tools
This commit is contained in:
13
skills/save_memory/SKILL.md
Normal file
13
skills/save_memory/SKILL.md
Normal file
@@ -0,0 +1,13 @@
|
||||
---
|
||||
name: save_memory
|
||||
description: Save something important to your persistent memory. Use this to remember facts about users, lessons learned, project context, or anything you want to recall in future conversations. Memories survive restarts.
|
||||
parameters:
|
||||
topic:
|
||||
type: string
|
||||
description: "Short topic name for the memory file (e.g. 'user_prefs', 'project_x', 'lessons')"
|
||||
required: true
|
||||
content:
|
||||
type: string
|
||||
description: The memory content to save
|
||||
required: true
|
||||
---
|
||||
33
skills/save_memory/run.py
Normal file
33
skills/save_memory/run.py
Normal file
@@ -0,0 +1,33 @@
|
||||
#!/usr/bin/env python3
|
||||
import sys
|
||||
import json
|
||||
import os
|
||||
|
||||
args = json.loads(sys.stdin.read())
|
||||
topic = args.get("topic", "note")
|
||||
content = args.get("content", "")
|
||||
workspace = os.environ.get("WORKSPACE", "/workspace")
|
||||
|
||||
mem_dir = f"{workspace}/memory"
|
||||
os.makedirs(mem_dir, exist_ok=True)
|
||||
|
||||
# Write the memory file
|
||||
filepath = f"{mem_dir}/{topic}.md"
|
||||
with open(filepath, "w") as f:
|
||||
f.write(content + "\n")
|
||||
|
||||
# Update MEMORY.md index
|
||||
index_path = f"{workspace}/MEMORY.md"
|
||||
existing = ""
|
||||
try:
|
||||
with open(index_path) as f:
|
||||
existing = f.read()
|
||||
except FileNotFoundError:
|
||||
existing = "# Agent Memory\n"
|
||||
|
||||
entry = f"- [{topic}](memory/{topic}.md)"
|
||||
if topic not in existing:
|
||||
with open(index_path, "a") as f:
|
||||
f.write(f"\n{entry}")
|
||||
|
||||
print(f"Memory saved to {filepath}")
|
||||
Reference in New Issue
Block a user