AX Agent 도구·스킬 정합성 재구성 및 실행 품질 보강

변경 목적:
- AX Agent의 도구 이름, 내부 설정, 스킬 정책, 실행 루프 사이의 불일치를 줄이고 전체 동작 품질을 높인다.
- claw-code 수준의 일관된 동작 품질을 참고하되 AX 구조에 맞는 고유한 카탈로그·정규화 레이어로 재구성한다.

핵심 수정사항:
- 도구 canonical id, legacy alias, 탭 노출, 설정 카테고리, read-only 분류를 중앙 카탈로그로 통합했다.
- ToolRegistry, AgentLoopService, 병렬 실행 분류, 권한 처리, 훅 처리, 스킬 allowed-tools 해석이 같은 이름 체계를 사용하도록 정리했다.
- Agent 설정/일반 설정/도움말의 도구 카드와 훅 편집기, 스킬 설명을 현재 런타임 구조에 맞게 갱신했다.
- 컨텍스트 압축, intent gate, spawn agents, session learning, model prompt adapter, workspace context 관련 변경과 테스트 추가를 함께 반영했다.
- 문서 이력과 비교/로드맵 문서를 최신 상태로 갱신했다.

검증 결과:
- dotnet build src/AxCopilot/AxCopilot.csproj -c Release -v minimal -p:OutputPath=bin\verify_toolcat\ -p:IntermediateOutputPath=obj\verify_toolcat\ : 경고 0 / 오류 0
- dotnet test src/AxCopilot.Tests/AxCopilot.Tests.csproj -c Release -v minimal --filter AgentToolCatalogTests -p:OutputPath=bin\verify_toolcat_tests\ -p:IntermediateOutputPath=obj\verify_toolcat_tests\ : 통과 8
This commit is contained in:
2026-04-14 17:52:46 +09:00
parent fa33b98f7e
commit 8cb08576d5
200 changed files with 13522 additions and 5764 deletions

View File

@@ -9,13 +9,13 @@
- v0.7.2: 컨텍스트 압축/복원 안정화, UX/성능 보완.
## 2. 재작성 기준
- 기준 레퍼런스: `claw-code/claw-code-f5a40b86dede580f6543bf8926c9af017eea9409/src`.
- 기준 레퍼런스: `OpenCode/OpenCode-f5a40b86dede580f6543bf8926c9af017eea9409/src`.
- 목표: 동작 순서, 예외/검증 흐름, 세션 내구성에서 동일 품질 달성.
- 원칙: AX 코드 스타일로 재구성(표현/구조 변경), 기능적 동등성 유지.
## 3. 2026 실행 계획 (v0.7.3 ~ v0.8.0)
| Phase | 참조 대상 (`claw-code`) | AX 적용 위치 | 완료 조건 | 품질 판정 시나리오 |
| Phase | 참조 대상 (`OpenCode`) | AX 적용 위치 | 완료 조건 | 품질 판정 시나리오 |
|---|---|---|---|---|
| A (v0.7.3) Hook/Permission 계약 고도화 | `src/utils/hooks.ts`, `src/utils/hooks/hookEvents.ts`, `src/utils/permissions/PermissionUpdate.ts`, `src/utils/permissions/permissionSetup.ts` | `src/AxCopilot/Services/Agent/AgentHookRunner.cs`, `src/AxCopilot/Services/Agent/AgentLoopService.cs`, `src/AxCopilot/Models/AppSettings.cs`, `src/AxCopilot/ViewModels/SettingsViewModel.cs`, `src/AxCopilot/Views/SettingsWindow.xaml` | Hook JSON 출력(`updatedInput`, `updatedPermissions`, `additionalContext`) 반영 완료. Plain text 훅 하위호환 유지. 훅 실패 비차단 유지. | Pre-hook 입력 변형 적용 시 도구 입력이 실제 변경되는지 검증. 권한 업데이트 후 동일 run 내 권한 판정이 즉시 반영되는지 검증. |
| B (v0.7.4) Plan/Run 상태 내구성 강화 | `src/utils/plans.ts`, `src/utils/sessionStorage.ts` | `src/AxCopilot/Services/ChatSessionStateService.cs`, `src/AxCopilot/Services/TaskRunService.cs`, `src/AxCopilot/Services/TaskRunStore.cs`, `src/AxCopilot/Views/ChatWindow.xaml.cs` | Plan 단계 승인/수정 이력 영속화. 앱 재시작 후 run 재개 시 마지막 실행 지점 정확 복원. 중복 실행/중복 이벤트 0건. | 실행 중 앱 종료 → 재실행 → 같은 탭/대화에서 run 상태와 최근 실행 이력이 일치하는지 검증. |
@@ -65,7 +65,7 @@
- 2026-04-04(추가3): 권한 UX 통합(/permissions·/allowed-tools·/settings permissions), 복구 혼합 테스트 보강, 좌측 패널 실패 필터 노출 정책 rich 전용으로 정렬.
- 2026-04-04 20:27 (KST): Added a dedicated AX Agent theme layer and separated in-chat theme selection into style (`claw/codex/slate`) and mode (`system/light/dark`).
- 2026-04-04 20:27 (KST): Added a dedicated AX Agent theme layer and separated in-chat theme selection into style (`claude/codex/slate`) and mode (`system/light/dark`).
- 2026-04-04 18:03 (KST): Added a Codex-style context usage ring to the composer, exposed direct `/compact` execution from the footer, and surfaced Git branch/change status in the Cowork/Code footer when a repository is connected.
- 2026-04-04 18:03 (KST): Simplified the Cowork footer by removing document format/design selectors and moved those defaults into the AX Agent settings page, with output format centered on AI automatic selection.
- 2026-04-04 18:03 (KST): Minimized AX Agent message headers, changed model quick controls to a popup panel, flattened slash command rows into a Codex-style list, and aligned model/permission/template controls to the same dropdown panel language.
@@ -79,12 +79,12 @@
- 2026-04-04 19:07 (KST): Refined message actions into custom pill buttons with visible labels, fixed the custom action template so border visuals render correctly, and tightened composer/footer density so model, preset, token, permission, and Git controls feel like one system.
- 2026-04-04 19:11 (KST): Reworked the AX Agent timeline so execution events render like thin Codex-style inline logs instead of heavy banners, softened older-history loading into an outline pill, and aligned planning cards to the same message-width rhythm.
- 2026-04-04 19:25 (KST): Tightened user/assistant/streaming cards under one density rule by compressing vertical spacing, card padding, header typography, and message meta spacing to a more Codex-like rhythm.
- 2026-04-04 19:25 (KST): Flattened the composer further by reducing input, model, preset, token, and footer control heights so the bottom work area reads more like a single claw-code-style strip.
- 2026-04-04 19:25 (KST): Flattened the composer further by reducing input, model, preset, token, and footer control heights so the bottom work area reads more like a single OpenCode-style strip.
- 2026-04-04 19:25 (KST): Matched AX Agent overlay quick settings to inline quick settings with the same `label · value` structure, lighter explanatory copy, and unified section naming.
- 2026-04-04 19:48 (KST): Fixed Chat sidebar topic exploration so clicking the left topic entry surfaces the preset cards again, and made preset selection immediately sync category label, conversation metadata, and saved state.
- 2026-04-04 19:48 (KST): Reduced permission/data-usage UI lag by synchronizing conversation settings before persistence, switching popup rows to immediate mouse-down activation, and refreshing overlay status labels in the same turn.
- 2026-04-04 19:48 (KST): Widened the AX Agent message lane, softened the yellow cast of the Claude-style theme preset, aligned the data-usage button with the permission button language, and routed the tray settings entry directly into AX Agent settings when AI is enabled.
- 2026-04-04 20:41 (KST): Permission surface re-aligned to the four claw-code public modes, legacy `질문 없이 진행` exposure removed from AX Agent popups/slash guidance, and the in-chat settings/sidebar information hierarchy simplified to match the lighter Claude/Codex-style layout direction.
- 2026-04-04 20:41 (KST): Permission surface re-aligned to the four OpenCode public modes, legacy `질문 없이 진행` exposure removed from AX Agent popups/slash guidance, and the in-chat settings/sidebar information hierarchy simplified to match the lighter Claude/Codex-style layout direction.
- 업데이트: 2026-04-04 22:05 (KST)
- AX Agent 고급 설정 오버레이를 설명형 row + 커스텀 On/Off 선택 구조로 개편하고, 내부 기능명을 사용자 친화 문구로 정리함.
- 업데이트: 2026-04-04 20:58 (KST)
@@ -104,3 +104,127 @@
- ????: 2026-04-04 23:32 (KST)
- AX Agent ???? ??? ?? tool-result ?? -> microcompact ?? ?? ?? -> ?? ?? ?? 3?? ??? ???, claude-code? staged compact ??? ? ??? ? ?? ??? ?? ????? ???.
- ??? ?? ??, tool_result, ?? ???, ???? ? ???? LLM ?? ?? microcompact_boundary? ?? ??? ?? ?? ?? ?? ?? ?? ??? ??? ???? ?? ??.
---
## 8. 지능형 에이전트 고도화 로드맵 (oh-my-openagent 참조)
> 기준: oh-my-openagent 아키텍처 분석 결과에서 단일 모델 환경에서도 효과적인 기능을 우선 채택.
> 원칙: AX 기존 인프라(`ClassifyTaskType`, `SubAgentTool`, `IntentDetector`, `TaskTypePolicy`, `ContextCondenser`) 위에 점진적으로 확장.
### 8-1. 즉시 개발 (P1~P5)
#### P1. IntentGate — 고급 의도 분류기
- **목적**: 사용자 입력을 분석하여 최적 실행 프로파일(system prompt + temperature + tool 권한 + 최대 반복)을 자동 선택
- **현재 상태**: `ClassifyTaskType()` (키워드 6분류) + `IntentDetector` (키워드 7분류, UI 힌트용) 존재하나 실행 프로파일 연동 없음
- **구현 계획**:
1. `IntentGateService.cs` 신규 — 2단계 분류기
- Stage 1: 키워드 기반 빠른 분류 (기존 `ClassifyTaskType` + `IntentDetector` 통합)
- Stage 2: LLM 1-shot 분류 (복합 요청 시만 발동, 토큰 최소화)
2. `ExecutionProfile` 확장 — 분류 결과별 프로파일 매핑
- `code_edit`: temperature 0.3, 코드 도구 우선, 최대 반복 25
- `document_create`: temperature 0.7, 문서 도구 우선, 최대 반복 15
- `analysis`: temperature 0.4, 검색/읽기 도구 우선, 최대 반복 20
- `review`: temperature 0.2, 읽기 전용 도구, 최대 반복 15
- `general_chat`: 도구 없음, temperature 0.8
- `complex_task`: 전체 도구, temperature 0.5, SubAgent 활성화
3. `AgentLoopService.RunAsync()` 진입부에서 `IntentGateService.Classify()` 호출 → 프로파일 적용
- **수정 파일**: `IntentGateService.cs`(신규), `AgentLoopService.cs`, `AppSettings.cs`, `TaskTypePolicy.cs`
- **검증**: 코드수정/문서생성/분석/리뷰/잡담 5개 시나리오에서 올바른 프로파일 선택 확인
#### P2. 카테고리 기반 서브에이전트 실행 프로파일
- **목적**: 같은 모델이지만 작업 유형별로 다른 system prompt + tool 권한 + temperature를 적용하는 "가상 멀티에이전트"
- **현재 상태**: `SubAgentTool`은 고정 system prompt + 읽기 전용 도구만 사용
- **구현 계획**:
1. `SubAgentProfile.cs` 신규 — 프로파일 정의 클래스
- `researcher`: 읽기 전용, 검색 집중, temperature 0.3
- `coder`: 파일 편집 가능, 빌드/테스트 도구 포함, temperature 0.2
- `writer`: 문서 생성 도구 활성, temperature 0.7
- `reviewer`: 코드리뷰 도구 + diff, temperature 0.2
- `planner`: 계획/분해 도구, temperature 0.5
2. `SubAgentTool` 확장 — `profile` 파라미터 추가
- 프로파일별로 system prompt, 도구 레지스트리, temperature를 자동 구성
- 기존 동작(profile 미지정)은 `researcher`로 폴백
3. `IntentGateService`가 복합 요청 감지 시 자동으로 서브에이전트 프로파일 추천
- **수정 파일**: `SubAgentProfile.cs`(신규), `SubAgentTool.cs`, `AgentLoopService.cs`
- **검증**: "코드 수정하고 문서도 만들어줘" → coder + writer 프로파일 분리 실행 확인
#### P3. 누적 학습 (Accumulated Learnings)
- **목적**: 세션 내 발견사항(에러 패턴, 파일 구조, 성공 전략)을 자동 수집하여 후속 반복에 주입
- **현재 상태**: `AgentMemoryService`에 장기 메모리 존재하나, 세션 내 단기 학습 전파 없음
- **구현 계획**:
1. `SessionLearningCollector.cs` 신규
- 도구 실행 결과에서 자동 학습 포인트 추출:
- 빌드 에러 → "이 프로젝트는 .NET 8, nullable 활성"
- grep 결과 → "이 패턴은 Services/ 폴더에 집중"
- 파일 구조 → "테스트는 Tests/ 폴더, 네이밍 규칙 *Tests.cs"
- 최대 10개 항목, FIFO 관리
2. `AgentLoopService` — 각 반복 시작 시 누적 학습을 컨텍스트에 주입
- `[System:SessionLearnings]` 메시지로 삽입 (압축 시 보존)
3. `ContextCondenser` — 학습 메시지는 압축 대상에서 제외
- **수정 파일**: `SessionLearningCollector.cs`(신규), `AgentLoopService.cs`, `ContextCondenser.cs`
- **검증**: 빌드 에러 발생 후 다음 반복에서 동일 실수 반복 안 하는지 확인
#### P4. 워크스페이스 컨텍스트 자동 생성 (.ax-context)
- **목적**: 작업 폴더의 구조/기술스택/컨벤션을 파일로 자동 생성 → 서브에이전트 컨텍스트 효율화
- **현재 상태**: `ProjectRuleTool``.ax-rules` 파일을 읽지만 자동 생성 없음
- **구현 계획**:
1. `WorkspaceContextGenerator.cs` 신규
- 작업 폴더 최초 접근 시 자동 분석:
- 파일 트리 (깊이 3), 주요 확장자 분포, 빌드 시스템 감지
- README/package.json/csproj 등에서 프로젝트 메타 추출
- 기존 `.ax-rules`, `.clinerules`, `CLAUDE.md` 존재 여부
- 결과를 `.ax-context.md`로 저장 (1회 생성, 수동 갱신)
2. `SubAgentTool` — 서브에이전트 생성 시 `.ax-context.md` 내용을 system prompt에 자동 주입
3. `AgentLoopService` — 메인 에이전트도 `.ax-context.md` 존재 시 컨텍스트에 포함
- **수정 파일**: `WorkspaceContextGenerator.cs`(신규), `SubAgentTool.cs`, `AgentLoopService.cs`, `ProjectRuleTool.cs`
- **검증**: 새 작업 폴더 선택 → `.ax-context.md` 자동 생성 → 서브에이전트가 프로젝트 구조 인지 확인
#### P5. 병렬 서브에이전트 실행 확장
- **목적**: LLM이 한 번의 응답에서 여러 서브에이전트를 동시 생성/실행
- **현재 상태**: `SubAgentTool`은 개별 호출 가능하나 LLM이 연속 호출해야 함. `AgentLoopParallelExecution`에서 병렬 도구 실행 지원
- **구현 계획**:
1. `spawn_agents` (복수형) 도구 신규 — 배열로 여러 서브에이전트를 한 번에 생성
- `tasks: [{id, task, profile}, ...]` 형태
2. `IntentGateService` — 복합 요청 감지 시 자동 분해
- "A 분석하고 B 코드 수정해줘" → 두 개의 서브에이전트로 자동 분해 제안
3. `SubAgentTool` — 동시 실행 상한을 설정에서 조정 가능 (기본 3 → 5)
4. UI: 서브에이전트 진행 상태를 타임라인에 병렬로 표시
- **수정 파일**: `SpawnAgentsTool.cs`(신규), `SubAgentTool.cs`, `AgentLoopService.cs`, `AppSettings.cs`
- **검증**: 3개 서브에이전트 동시 실행 → 결과 수집 → 통합 응답 확인
### 8-2. 추후 개발 (P6~P7)
#### P6. 폴백 체인 (Fallback Chains)
- **목적**: 실행 실패 시 다른 프로파일/전략으로 자동 재시도
- **구현 방향**: IntentGate 프로파일에 `fallback` 속성 추가. 1차 실패 → 프로파일 전환 → 재시도 (최대 2회)
- **선행 조건**: P1(IntentGate) + P2(카테고리 프로파일) 완료 후
- **예상 파일**: `IntentGateService.cs`, `AgentLoopService.cs`
#### P7. 모델 성격 매칭 (Model Personality Matching)
- **목적**: 멀티 모델 환경에서 작업 유형별 최적 모델 자동 선택
- **구현 방향**: `RegisteredModel``strengths` 속성 추가 (coding/writing/analysis/speed). IntentGate 분류 결과 + 모델 강점 매칭으로 최적 모델 라우팅
- **선행 조건**: 멀티 모델 환경 확보 + P1(IntentGate) 완료 후
- **예상 파일**: `IntentGateService.cs`, `ModelRouterService.cs`, `AppSettings.cs`
### 8-3. 구현 순서 및 의존 관계
```
P1 (IntentGate) ─────┬──→ P2 (카테고리 프로파일) ──→ P5 (병렬 확장)
├──→ P3 (누적 학습) [독립]
└──→ P4 (워크스페이스 컨텍스트) [독립]
P1 + P2 완료 후 ──→ P6 (폴백 체인)
P1 + 멀티모델 후 ──→ P7 (모델 성격 매칭)
```
### 8-4. 단일 모델에서의 멀티에이전트 원리
> Claude Code, Codex, Cursor 등 주요 AI 코딩 도구는 모두 **단일 모델 + 다른 시스템 프롬프트/도구 권한/temperature** 조합으로 멀티에이전트를 구현합니다.
>
> - 메인 에이전트: 범용 system prompt + 전체 도구 + 중간 temperature
> - 서브에이전트: 특화 system prompt + 제한된 도구 + 작업별 temperature
>
> AX Copilot도 이 패턴을 따릅니다. `SubAgentTool`이 이미 존재하므로, **프로파일 체계화(P2)**만으로 사실상 멀티에이전트가 됩니다.