feat(core): reserve skills in memfs sync and list top-level skill directory [LET-7710] (#9691)

This commit is contained in:
Sarah Wooders
2026-02-26 13:41:05 -08:00
committed by Caren Thomas
parent 750b83a2ea
commit 57e7e0e52b
5 changed files with 99 additions and 5 deletions

View File

@@ -54,6 +54,8 @@ class TestLogContextMiddleware:
return {
"system/human.md": "---\ndescription: human\n---\nname: sarah",
"system/persona.md": "---\ndescription: persona\n---\nbe helpful",
"skills/research-helper/SKILL.md": "---\ndescription: helper\n---\n# Research Helper",
"skills/research-helper/references/details.md": "---\ndescription: nested\n---\nShould not be synced",
}
class DummyMemoryRepoManager:
@@ -95,6 +97,8 @@ class TestLogContextMiddleware:
labels = {call["label"] for call in synced_calls}
assert "system/human" in labels
assert "system/persona" in labels
assert "skills/research-helper/SKILL" not in labels
assert "skills/research-helper/references/details" not in labels
def test_extracts_actor_id_from_headers(self, client):
response = client.get("/v1/agents/agent-123e4567-e89b-42d3-8456-426614174000", headers={"user_id": "user-abc123"})

View File

@@ -309,3 +309,48 @@ def test_compile_git_memory_filesystem_no_description_when_empty():
assert "notes.md\n" in out or "notes.md\n" in out
# reference/api.md has a description
assert "api.md (API docs)" in out
def test_compile_git_memory_filesystem_condenses_skills_to_top_level_entries():
"""skills/ should render as top-level skill folders with description.
We intentionally avoid showing nested files under skills/ in the system prompt
tree to keep context concise.
"""
m = Memory(
agent_type=AgentType.letta_v1_agent,
git_enabled=True,
blocks=[
Block(label="system/human", value="human data", limit=100),
Block(
label="skills/searching-messages/SKILL",
value="# searching messages",
limit=100,
description="Search past messages to recall context.",
),
Block(
label="skills/creating-skills/SKILL",
value="# creating skills",
limit=100,
description="Guide for creating effective skills.",
),
Block(
label="skills/creating-skills/references/workflows",
value="nested docs",
limit=100,
description="Nested workflow docs (should not appear)",
),
],
)
out = m.compile()
# Condensed top-level skill entries with descriptions.
assert "searching-messages/ (Search past messages to recall context.)" in out
assert "creating-skills/ (Guide for creating effective skills.)" in out
# Do not show SKILL.md or nested skill docs in tree.
assert "skills/searching-messages/SKILL.md" not in out
assert "skills/creating-skills/SKILL.md" not in out
assert "references/workflows" not in out