Files
AX-Copilot-Codex/src/AxCopilot/Services/Agent/ModelExecutionProfileCatalog.cs
lacvet 4db75d46cd 코워크 문서 생성 게이트와 코드 후속 검증 게이트를 claw-code 기준으로 경량화
- balanced/tool_call_strict 프로필의 document_plan 재시도와 공격적 문서 fallback 개입을 줄여 Cowork 루프를 더 얇게 정리함

- document_plan 성공 직후 강제 user follow-up 주입을 제거하고 terminal 문서 도구 성공 시 Cowork에서 바로 종료할 수 있게 조정함

- CodeDiffGate, RecentExecutionGate, ExecutionSuccessGate를 review 작업 중심으로 제한해 일반 코드 수정의 과검증을 완화함

- TaskTypePolicy, SystemPromptBuilder, cowork preset을 함께 맞춰 문서 생성/분석형 요청의 종료 조건을 일관되게 정리함

- README.md 및 docs/DEVELOPMENT.md를 2026-04-12 23:05 (KST) 기준으로 갱신함

- 검증: dotnet build src/AxCopilot/AxCopilot.csproj -c Release -v minimal -p:OutputPath=bin\\verify\\ -p:IntermediateOutputPath=obj\\verify\\ (경고 0, 오류 0)
2026-04-12 22:15:26 +09:00

180 lines
7.8 KiB
C#

namespace AxCopilot.Services.Agent;
public static class ModelExecutionProfileCatalog
{
public sealed record ExecutionPolicy(
string Key,
string Label,
bool ForceInitialToolCall,
bool ForceToolCallAfterPlan,
double? ToolTemperatureCap,
int NoToolResponseThreshold,
int NoToolRecoveryMaxRetries,
int PlanExecutionRetryMax,
int DocumentPlanRetryMax,
bool PreferAggressiveDocumentFallback,
bool ReduceEarlyMemoryPressure,
bool EnablePostToolVerification,
bool EnableCodeQualityGates,
bool EnableDocumentVerificationGate,
bool EnableParallelReadBatch,
int MaxParallelReadBatch,
int CodeVerificationGateMaxRetries,
int HighImpactBuildTestGateMaxRetries,
int FinalReportGateMaxRetries,
int CodeDiffGateMaxRetries,
int RecentExecutionGateMaxRetries,
int ExecutionSuccessGateMaxRetries,
int DocumentVerificationGateMaxRetries,
int TerminalEvidenceGateMaxRetries,
/// <summary>
/// true이면 첫 번째 LLM 호출 직전 마지막 user 메시지로 도구 호출 강제 reminder를 주입합니다.
/// IBM Qwen 등 system prompt instruction을 약하게 따르는 chatty 모델용.
/// </summary>
bool InjectPreCallToolReminder = false);
public static string Normalize(string? key)
{
var normalized = (key ?? "").Trim().ToLowerInvariant();
return normalized switch
{
"tool_call_strict" => "tool_call_strict",
"reasoning_first" => "reasoning_first",
"fast_readonly" => "fast_readonly",
"document_heavy" => "document_heavy",
_ => "balanced",
};
}
public static ExecutionPolicy Get(string? key)
=> Normalize(key) switch
{
"tool_call_strict" => new ExecutionPolicy(
"tool_call_strict",
"도구 호출 우선",
ForceInitialToolCall: true,
ForceToolCallAfterPlan: true,
ToolTemperatureCap: 0.2,
NoToolResponseThreshold: 1,
NoToolRecoveryMaxRetries: 4, // IBM/Qwen 등 chatty 모델: 재시도 횟수 늘려 도구 호출 강제
PlanExecutionRetryMax: 2,
DocumentPlanRetryMax: 0,
PreferAggressiveDocumentFallback: false,
ReduceEarlyMemoryPressure: true,
EnablePostToolVerification: false,
EnableCodeQualityGates: true,
EnableDocumentVerificationGate: false,
EnableParallelReadBatch: true,
MaxParallelReadBatch: 8,
CodeVerificationGateMaxRetries: 1,
HighImpactBuildTestGateMaxRetries: 1,
FinalReportGateMaxRetries: 1,
CodeDiffGateMaxRetries: 1,
RecentExecutionGateMaxRetries: 0,
ExecutionSuccessGateMaxRetries: 0,
DocumentVerificationGateMaxRetries: 0,
TerminalEvidenceGateMaxRetries: 1,
InjectPreCallToolReminder: true), // IBM/Qwen: 첫 호출 직전 reminder 주입으로 이중 강제
"reasoning_first" => new ExecutionPolicy(
"reasoning_first",
"추론 우선",
ForceInitialToolCall: false,
ForceToolCallAfterPlan: false,
ToolTemperatureCap: 0.45,
NoToolResponseThreshold: 2,
NoToolRecoveryMaxRetries: 2,
PlanExecutionRetryMax: 2,
DocumentPlanRetryMax: 2,
PreferAggressiveDocumentFallback: false,
ReduceEarlyMemoryPressure: false,
EnablePostToolVerification: false,
EnableCodeQualityGates: true,
EnableDocumentVerificationGate: false,
EnableParallelReadBatch: true,
MaxParallelReadBatch: 6,
CodeVerificationGateMaxRetries: 1,
HighImpactBuildTestGateMaxRetries: 1,
FinalReportGateMaxRetries: 0,
CodeDiffGateMaxRetries: 0,
RecentExecutionGateMaxRetries: 0,
ExecutionSuccessGateMaxRetries: 0,
DocumentVerificationGateMaxRetries: 0,
TerminalEvidenceGateMaxRetries: 1),
"fast_readonly" => new ExecutionPolicy(
"fast_readonly",
"읽기 속도 우선",
ForceInitialToolCall: true,
ForceToolCallAfterPlan: false,
ToolTemperatureCap: 0.25,
NoToolResponseThreshold: 1,
NoToolRecoveryMaxRetries: 1,
PlanExecutionRetryMax: 1,
DocumentPlanRetryMax: 1,
PreferAggressiveDocumentFallback: false,
ReduceEarlyMemoryPressure: true,
EnablePostToolVerification: false,
EnableCodeQualityGates: false,
EnableDocumentVerificationGate: false,
EnableParallelReadBatch: true,
MaxParallelReadBatch: 10,
CodeVerificationGateMaxRetries: 0,
HighImpactBuildTestGateMaxRetries: 0,
FinalReportGateMaxRetries: 0,
CodeDiffGateMaxRetries: 0,
RecentExecutionGateMaxRetries: 0,
ExecutionSuccessGateMaxRetries: 0,
DocumentVerificationGateMaxRetries: 0,
TerminalEvidenceGateMaxRetries: 0),
"document_heavy" => new ExecutionPolicy(
"document_heavy",
"문서 생성 우선",
ForceInitialToolCall: false,
ForceToolCallAfterPlan: false,
ToolTemperatureCap: 0.35,
NoToolResponseThreshold: 1,
NoToolRecoveryMaxRetries: 1,
PlanExecutionRetryMax: 1,
DocumentPlanRetryMax: 0,
PreferAggressiveDocumentFallback: true,
ReduceEarlyMemoryPressure: true,
EnablePostToolVerification: false,
EnableCodeQualityGates: false,
EnableDocumentVerificationGate: false,
EnableParallelReadBatch: true,
MaxParallelReadBatch: 6,
CodeVerificationGateMaxRetries: 0,
HighImpactBuildTestGateMaxRetries: 0,
FinalReportGateMaxRetries: 0,
CodeDiffGateMaxRetries: 0,
RecentExecutionGateMaxRetries: 0,
ExecutionSuccessGateMaxRetries: 0,
DocumentVerificationGateMaxRetries: 0,
TerminalEvidenceGateMaxRetries: 1),
_ => new ExecutionPolicy(
"balanced",
"균형",
ForceInitialToolCall: true,
ForceToolCallAfterPlan: false,
ToolTemperatureCap: 0.35,
NoToolResponseThreshold: 2,
NoToolRecoveryMaxRetries: 2,
PlanExecutionRetryMax: 2,
DocumentPlanRetryMax: 0,
PreferAggressiveDocumentFallback: false,
ReduceEarlyMemoryPressure: false,
EnablePostToolVerification: false,
EnableCodeQualityGates: true,
EnableDocumentVerificationGate: false,
EnableParallelReadBatch: true,
MaxParallelReadBatch: 6,
CodeVerificationGateMaxRetries: 1,
HighImpactBuildTestGateMaxRetries: 1,
FinalReportGateMaxRetries: 0,
CodeDiffGateMaxRetries: 0,
RecentExecutionGateMaxRetries: 0,
ExecutionSuccessGateMaxRetries: 0,
DocumentVerificationGateMaxRetries: 0,
TerminalEvidenceGateMaxRetries: 1),
};
}