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>