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>
AgentLoopService.TaskState.cs (신규, 96줄):
- InitTaskStateAsync(): 세션 시작 시 TaskStateService 초기화, 현재 작업 기록
- TrackToolFile(): 도구 성공 시 파일 경로 참조 목록 추가 (fire-and-forget)
- InjectTaskStateContext(): 압축 전 Working Memory를 시스템 메시지에 in-place 주입
(## 현재 작업 상태 마커로 기존 섹션 탐지·교체 → 중복 방지)
- UpdateTaskStateSummaryAsync(): 압축 완료 후 컨텍스트 요약 갱신 (fire-and-forget)
AgentLoopService.cs:
- userQuery 선언 후 UserMessage 이벤트 기록 + InitTaskStateAsync() 호출
- 압축 블록: InjectTaskStateContext() 호출 (압축 전 Working Memory 주입)
- 기본 압축 완료 시: CompactionCompleted 이벤트 + UpdateTaskStateSummaryAsync()
- 적극적 압축 트리거 시: CompactionTriggered 이벤트 (usagePct 포함)
- LLM 텍스트 응답 후: AssistantMessage 이벤트 기록 (length, hasToolCalls)
AgentLoopService.Execution.cs:
- 도구 성공(state.ConsecutiveErrors = 0) 직후 TrackToolFile(result.FilePath) 호출
이벤트 커버리지: SessionStart/End·UserMessage·AssistantMessage·
ToolRequest·ToolResult·CompactionTriggered·CompactionCompleted 전 구간 기록
저장: %APPDATA%\AxCopilot\sessions\{sessionId}\{task_state.json, events.jsonl}
빌드: 경고 0, 오류 0
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
ReflexionEvaluatorService 신규 구현 (ReflexionService.cs):
- LLM 기반 자기평가: 완성도 점수(0~1), 강점/약점/교훈 추출
- $$raw string 평가 프롬프트로 JSON 포맷 안전하게 삽입
- JSON 블록 추출 + 역직렬화, LLM 실패 시 규칙 기반 폴백 엔트리
- ReflexionRepository.BuildContextPromptAsync() maxEntries 파라미터 추가
AgentLoopService.Reflexion.cs (신규, 82줄):
- InjectReflexionContextAsync(): 세션 시작 전 과거 교훈→시스템 메시지 주입
- FireAndForgetReflexionEval(): 세션 완료 후 Task.Run 비동기 자기평가 저장
- 지연 초기화(_reflexionRepo, _reflexionEval): 사용 시점에 생성
AgentLoopService.cs 통합 포인트 2개 추가:
- RunAsync() 루프 시작 전: await InjectReflexionContextAsync()
- finally 블록 통계 섹션: FireAndForgetReflexionEval() 호출
AgentSettingsPanel — 자기성찰 메모리 섹션 추가:
- 활성화 토글(ChkReflexionEnabled)
- 성공 세션만 평가 토글(ChkReflexionSuccessOnly)
- 최대 참고 교훈 수 슬라이더(1~20, 기본값 5)
- LoadFromSettings() 초기화 + 3개 이벤트 핸들러
빌드: 경고 0, 오류 0