계층형 메모리 frontmatter에 description 메타를 추가해 rule 파일의 의도와 적용 범위를 /memory 결과에서 함께 읽을 수 있도록 정리했습니다. MemoryTool에 show_scope 액션을 추가해 managed, user, project, local 메모리 파일의 실제 내용을 슬래시 명령으로 직접 확인할 수 있게 했습니다. README와 DEVELOPMENT 문서에 2026-04-07 00:31 (KST) 기준 변경 이력을 반영했고 Release 빌드 경고 0 오류 0을 확인했습니다.
This commit is contained in:
@@ -16,6 +16,7 @@ public class MemoryTool : IAgentTool
|
||||
"대화 간 지속되는 메모리로, 새 대화에서도 이전에 학습한 내용을 활용할 수 있습니다.\n" +
|
||||
"- action=\"save\": 학습 메모리 저장 (type, content 필수)\n" +
|
||||
"- action=\"save_scope\": 계층형 메모리 파일에 저장 (scope, content 필수)\n" +
|
||||
"- action=\"show_scope\": 계층형 메모리 파일 본문 조회 (scope 필수)\n" +
|
||||
"- action=\"search\": 관련 메모리 검색 (query 필수)\n" +
|
||||
"- action=\"list\": 현재 메모리 전체 목록 + 계층형 메모리 파일 목록\n" +
|
||||
"- action=\"delete\": 학습 메모리 삭제 (id 필수)\n" +
|
||||
@@ -27,7 +28,7 @@ public class MemoryTool : IAgentTool
|
||||
{
|
||||
Properties = new()
|
||||
{
|
||||
["action"] = new() { Type = "string", Description = "save | save_scope | search | list | delete | delete_scope" },
|
||||
["action"] = new() { Type = "string", Description = "save | save_scope | show_scope | search | list | delete | delete_scope" },
|
||||
["type"] = new() { Type = "string", Description = "메모리 유형: rule | preference | fact | correction. save 시 필수." },
|
||||
["scope"] = new() { Type = "string", Description = "계층형 메모리 대상: managed | user | project | local. save_scope/delete_scope 시 필수." },
|
||||
["content"] = new() { Type = "string", Description = "저장할 내용. save 시 필수." },
|
||||
@@ -58,11 +59,12 @@ public class MemoryTool : IAgentTool
|
||||
{
|
||||
"save" => ExecuteSave(args, memoryService, context),
|
||||
"save_scope" => ExecuteSaveScope(args, memoryService, context),
|
||||
"show_scope" => ExecuteShowScope(args, memoryService, context),
|
||||
"search" => ExecuteSearch(args, memoryService),
|
||||
"list" => ExecuteList(memoryService),
|
||||
"delete" => ExecuteDelete(args, memoryService),
|
||||
"delete_scope" => ExecuteDeleteScope(args, memoryService, context),
|
||||
_ => ToolResult.Fail($"알 수 없는 액션: {action}. save | save_scope | search | list | delete | delete_scope 중 선택하세요."),
|
||||
_ => ToolResult.Fail($"알 수 없는 액션: {action}. save | save_scope | show_scope | search | list | delete | delete_scope 중 선택하세요."),
|
||||
});
|
||||
}
|
||||
|
||||
@@ -104,7 +106,11 @@ public class MemoryTool : IAgentTool
|
||||
{
|
||||
sb.AppendLine($"계층형 메모리 {docs.Count}개:");
|
||||
foreach (var doc in docs)
|
||||
sb.AppendLine($" [{doc.Label}] {doc.Path}");
|
||||
{
|
||||
var suffix = string.IsNullOrWhiteSpace(doc.Description) ? "" : $" — {doc.Description}";
|
||||
var scopeHint = doc.Paths.Count > 0 ? $" (paths: {string.Join(", ", doc.Paths)})" : "";
|
||||
sb.AppendLine($" [{doc.Label}] {doc.Path}{suffix}{scopeHint}");
|
||||
}
|
||||
sb.AppendLine();
|
||||
}
|
||||
|
||||
@@ -129,7 +135,11 @@ public class MemoryTool : IAgentTool
|
||||
{
|
||||
sb.AppendLine($"계층형 메모리 파일 {docs.Count}개:");
|
||||
foreach (var doc in docs)
|
||||
sb.AppendLine($" • [{doc.Label}] {doc.Path}");
|
||||
{
|
||||
var suffix = string.IsNullOrWhiteSpace(doc.Description) ? "" : $" — {doc.Description}";
|
||||
var scopeHint = doc.Paths.Count > 0 ? $" (paths: {string.Join(", ", doc.Paths)})" : "";
|
||||
sb.AppendLine($" • [{doc.Label}] {doc.Path}{suffix}{scopeHint}");
|
||||
}
|
||||
sb.AppendLine();
|
||||
}
|
||||
|
||||
@@ -186,4 +196,21 @@ public class MemoryTool : IAgentTool
|
||||
? ToolResult.Ok($"{result.Message}\n경로: {result.Path}")
|
||||
: ToolResult.Fail(result.Message);
|
||||
}
|
||||
|
||||
private static ToolResult ExecuteShowScope(JsonElement args, AgentMemoryService svc, AgentContext context)
|
||||
{
|
||||
var scope = args.TryGetProperty("scope", out var s) ? s.GetString() ?? "" : "";
|
||||
if (string.IsNullOrWhiteSpace(scope))
|
||||
return ToolResult.Fail("scope가 필요합니다. managed | user | project | local 중 선택하세요.");
|
||||
|
||||
var path = svc.GetWritableInstructionPath(scope, context.WorkFolder);
|
||||
if (string.IsNullOrWhiteSpace(path))
|
||||
return ToolResult.Fail("해당 scope의 메모리 파일 경로를 결정할 수 없습니다.");
|
||||
|
||||
var content = svc.ReadInstructionFile(scope, context.WorkFolder);
|
||||
if (content == null)
|
||||
return ToolResult.Ok($"메모리 파일이 아직 없습니다.\n경로: {path}");
|
||||
|
||||
return ToolResult.Ok($"메모리 파일 경로: {path}\n\n{content}");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user