[Phase 17-E] 계층 메모리/컨텍스트 고도화 — AgentLoopService 통합

AgentLoopService.Memory.cs (신규, 105줄):
- InjectHierarchicalMemoryAsync(): 세션 시작 시 4-layer 계층 메모리 수집
  (Managed→User→Project→Local AX.md + rules/*.md)
  AxMdIncludeResolver.ResolveAsync()로 @include 지시어 최대 5단계 재귀 해석
  40,000자 초과 시 크기 경고, 마커 기반 in-place 교체(중복 방지)
- InjectPathScopedRulesAsync(): 파일 도구 실행 후 .ax/rules/*.md paths: 프론트매터
  기반 경로 범위 규칙 주입. workFolder별 PathScopedRuleInjector 캐시 적용

AgentLoopService.cs (편집):
- Phase 17-A(Reflexion) 이후 await InjectHierarchicalMemoryAsync() 호출 추가

AgentLoopService.Execution.cs (편집):
- InjectPathBasedSkills() 이후 InjectPathScopedRulesAsync() fire-and-forget 추가

AppSettings.LlmSettings.cs (편집):
- EnableMemorySystem 설정 추가 (기본 true, json: "enableMemorySystem")

docs/AGENT_ROADMAP.md:
- Group E 완료 표시 + 구현 내역 기록 (17-E1/E2 완료, 17-E3 차기)

빌드: 경고 0, 오류 0

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-04 00:56:49 +09:00
parent 1313c65e5e
commit f1b1f1604c
5 changed files with 181 additions and 6 deletions

View File

@@ -226,6 +226,9 @@ public partial class AgentLoopService
// Phase 17-A: Reflexion — 과거 교훈을 시스템 메시지에 주입
await InjectReflexionContextAsync(messages, userQuery);
// Phase 17-E: 4-layer 계층 메모리 + @include 해석 → 시스템 메시지 주입
await InjectHierarchicalMemoryAsync(messages, llm.WorkFolder, ct);
try
{
// ── 플랜 모드 "always": 첫 번째 호출은 계획만 생성 (도구 없이) ──