feat: update Skill tool to support load/unload commands (#219)

Co-authored-by: Letta <noreply@letta.com>
This commit is contained in:
Charles Packer
2025-12-15 18:36:27 -08:00
committed by GitHub
parent 693ae8b4e0
commit 4d5287520a
12 changed files with 334 additions and 112 deletions

View File

@@ -16,6 +16,12 @@ export const PROJECT_BLOCK_LABELS = [
"loaded_skills",
] as const;
/**
* Block labels that should be read-only (agent cannot modify via memory tools).
* These blocks are managed by specific tools (e.g., Skill tool for skills/loaded_skills).
*/
export const READ_ONLY_BLOCK_LABELS = ["skills", "loaded_skills"] as const;
/**
* Check if a block label is a project-level block
*/
@@ -77,8 +83,9 @@ async function loadMemoryBlocksFromMdx(): Promise<CreateBlock[]> {
}
const { frontmatter, body } = parseMdxFrontmatter(content);
const label = frontmatter.label || filename.replace(".mdx", "");
const block: CreateBlock = {
label: frontmatter.label || filename.replace(".mdx", ""),
label,
value: body,
};
@@ -86,6 +93,11 @@ async function loadMemoryBlocksFromMdx(): Promise<CreateBlock[]> {
block.description = frontmatter.description;
}
// Set read-only for skills blocks (managed by Skill tool, not memory tools)
if ((READ_ONLY_BLOCK_LABELS as readonly string[]).includes(label)) {
block.read_only = true;
}
memoryBlocks.push(block);
} catch (error) {
console.error(`Error loading ${filename}:`, error);