docs(roadmap): 실행 프리셋과 Hot Path 계획을 정리한다

This commit is contained in:
toki 2026-08-02 17:13:35 +09:00
parent 6d6bb3a44d
commit c3a24ec5fe
8 changed files with 494 additions and 239 deletions

View file

@ -18,7 +18,7 @@
IOP(Inference Operations Platform)는 Control Plane - Edge - IOP Node 계층 구조를 기반으로 모델·provider·device의 서빙과 운영을 담당하는 추론 운영 플랫폼을 만든다.
내부 실행 모델은 `adapter + target`을 기준으로 하며, Edge가 로컬 provider 실행 그룹의 상태와 라우팅을 소유하고 Control Plane은 Edge를 통해 IOP 시스템을 관찰하고 제어한다.
IOP는 특정 agent 제품에 종속된 Shell이 아니라, 외부 agent·client·자동화 도구가 추론 API를 통해 소비할 수 있는 범용 추론 운영 엔진이다. 장기 작업 루프, workspace·terminal orchestration, 스케줄링과 durable review 상태는 IOP의 요청 실행 경계에 포함하지 않는다.
IOP는 특정 agent 제품에 종속된 Shell이 아니라, 외부 agent·client·자동화 도구가 추론 API를 통해 소비할 수 있는 범용 추론 운영 엔진이다. execution preset이 여러 model call과 agent tool round-trip을 하나의 논리 요청으로 조정할 수는 있지만, 실제 workspace·terminal 실행 소유권, 독립 automation process, scheduler와 사람 승인 workflow는 IOP 제품 경계에 포함하지 않는다.
로드맵 전반에서 OpenAI-compatible API와 Anthropic-compatible Messages API는 외부 클라이언트의 모델 기반 호출 표면으로, IOP native protocol은 provider 실행·취소·상태·usage와 provider/device/model lifecycle 같은 IOP 고유 운영 기능의 기준으로 둔다.
OpenAI-compatible API는 현재 chat completions baseline을 넘어 Responses API 호환 표면까지 지원해야 한다.
Anthropic-compatible Messages API는 Edge가 직접 제공해 Claude Code를 포함한 client가 별도 agent-client gateway 없이 IOP를 호출하게 하며, Chat-only upstream은 IOP의 protocol bridge로 연결한다.
@ -26,9 +26,9 @@ IOP의 외부 추론 호출 계약은 OpenAI-compatible API 방식을 기본 표
IOP native protocol은 proto-socket을 기본으로 하며, HTTP는 OpenAI-compatible/A2A/health/bootstrap처럼 필요한 경계에서만 사용한다.
A2A는 provider-backed 요청을 수용하는 호환 표면으로 유지하며, workflow 의미를 도입하지 않는다.
현재 제1 active delivery는 완료된 `iop-agent` 자산을 Chronos 수용 bundle로 전달한 뒤 IOP의 workspace agent·CLI agent session·terminal 및 Chronos 연결 surface를 제거하고, IOP Node에는 추론 provider 운영에 필요한 경계만 남기는 것이다. 이 분리 작업의 진행 내용은 별도 작업 checkout의 활성 Milestone을 원본으로 동기화한다.
IOP 내부 라우팅 축은 Hot Path에서 request-local 실행 형태와 Edge 라우팅 판단의 기준선을 세운 뒤 단계 호출·검증 최적화, cloud-first 하이브리드 라우팅, routing evidence 기반 local model 전환으로 확장한다.
IOP 내부 라우팅 축은 외부 model을 전체 execution preset에 매핑하고 `direct/light` Hot Path와 논리 `request_id` coordinator를 구축한 뒤, `heavy` Plan/Review, cloud-first preset mode 라우팅과 routing evidence 기반 local selector 전환으로 확장한다.
모델 선택, 요청 난이도에 따른 request-local 실행 형태, 로컬/클라우드 라우팅, 모델별 profile, token/속도/품질 최적화, 모델 호출 로그와 품질 평가는 IOP 책임으로 둔다. Edge가 model advisory와 deterministic hard gate를 결합해 최종 route를 확정하고 Node는 확정된 adapter/target stage를 실행한다. Control Plane은 principal과 IOP token, 사용자별 provider credential slot의 원장을 소유하고 Edge는 principal별 route와 제한된 credential lease를 실행에 사용한다.
모델 선택, 요청 난이도에 따른 execution mode, 로컬/클라우드 라우팅, 외부 model별 execution preset, token/속도/품질 최적화, 모델 호출 로그와 품질 평가는 IOP 책임으로 둔다. 외부 model 선택이 preset을 고정하고 Edge가 model advisory와 deterministic hard gate를 결합해 allowed mode와 stage binding을 확정하며, Node는 확정된 provider stage를 실행한다. Control Plane은 principal과 IOP token, 사용자별 provider credential slot의 원장을 소유하고 Edge는 principal별 route와 제한된 credential lease를 실행에 사용한다.
또한 원격지와 로컬의 Ollama, vLLM, SGLang, Lemonade 같은 추론 엔진은 단순 endpoint가 아니라 provider/device/model 조합으로 관리하고, provider별 lifecycle capability, device 상태, 모델 qualification, 테스트 결과 리포트를 운영 데이터로 축적하는 방향을 목표로 한다.
초기 하이브리드 라우팅은 cloud frontier model을 semantic judge/teacher로 활용해 route evidence를 축적하고, 충분한 품질·규모 gate를 통과하면 RAG 기반 local routing model을 운영 기본으로 점진 전환하되 cloud fallback과 품질 평가를 유지한다.
RAG, context 구성/압축, web search, MCP 정책, tool policy, output validation, retry/fallback은 기본 모델 서빙과 부하 라우팅이 가능해진 뒤 확장한다.
@ -81,7 +81,7 @@ Phase는 실행 순서가 아니라 도메인/책임 영역의 구조적 지도
- [계획] 지식과 도구 최적화 확장
- 경로: [PHASE.md](phase/knowledge-tool-optimization-extension/PHASE.md)
- 요약: Hot Path에서 model advisory·Edge arbiter·고정 실행 profile의 기본을 구축하고, request-local analysis/generation/verification과 cloud-first 하이브리드 라우팅으로 일반화한다. 운영 evidence가 충분해지면 routing 전용 RAG local model로 점진 전환하며, repository 장기 기억 RAG와 Advisor/Context Hook은 별도 책임으로 유지한다.
- 요약: 외부 model에 연결되는 execution preset과 `request_id` coordinator를 만들고 `direct/light` Hot Path, `heavy` Plan/Review, cloud-first preset mode 라우팅으로 확장한다. 운영 evidence가 충분해지면 routing 전용 RAG local selector로 점진 전환하며, repository 장기 기억 RAG와 Advisor/Context Hook은 별도 책임으로 유지한다.
- [스케치] Personal Edge 패키징과 배포 프로파일
- 경로: [PHASE.md](phase/personal-edge-packaging-deployment/PHASE.md)

View file

@ -6,10 +6,10 @@
## 목표
Ollama serving 경로와 운영 기반이 안정화된 뒤, 단계 호출, tool/schema 강제, output validation, retry/fallback과 누적 요청 컨텍스트 구성을 IOP의 추론 최적화 계층으로 확장한다.
첫 vertical slice인 IOP Hot Path는 OpenAI-compatible `model=iop` 한 번의 요청 안에서 빠른 cloud `Gemini 3.6 Flash`와 RTX 5090 local target `ornith-fast`를 조합하고, model advisory와 Edge 최종 판정, request-local execution profile, route evidence의 기본을 구축한다.
그 다음 analysis directive/generation/verification을 올바른 request-local plan/review 단계로 일반화하고, Edge가 요청 난이도·기능·예산에 따라 실행 형태와 stage별 adapter/target을 고르는 cloud-first 하이브리드 라우팅으로 연결한다.
cloud-first 운영 근거가 충분히 쌓이면 동일한 decision contract를 쓰는 RAG 기반 local routing model을 shadow/canary로 검증해 운영 기본 경로로 점진 전환한다.
Ollama serving 경로와 운영 기반이 안정화된 뒤, execution preset, 단계 호출, tool/schema 강제, output validation, retry/fallback과 누적 요청 컨텍스트 구성을 IOP의 추론 최적화 계층으로 확장한다.
첫 vertical slice는 외부 model을 fused selector/planner·허용 mode·downstream ordered stage/model/options 전체를 소유하는 execution preset에 매핑하고, 하나의 `request_id` 아래 `direct` 또는 cloud plan → local agent work → cloud review/repair인 `light` Hot Path를 Claude/Pi streaming에 구현한다.
그 다음 lightweight Plan/Review를 장기 작업에 맞는 `heavy` mode로 확장하고, Edge가 외부 model에 매핑된 preset의 허용 mode 중 요청 난이도·기능·예산에 맞는 실행 경로를 고르는 cloud-first 하이브리드 라우팅으로 연결한다.
cloud-first route evidence가 충분히 쌓이면 동일한 mode decision contract를 쓰는 RAG 기반 local routing model을 shadow/canary로 검증해 운영 기본 경로로 점진 전환한다.
caller-neutral 누적 요청 컨텍스트 최적화, repository 장기 기억 RAG, advisor와 Context Hook은 routing evidence RAG와 서로 다른 후속 기능으로 분리한다.
이 Phase는 특정 Agent Shell에 종속되지 않고 OpenAI-compatible, A2A, IOP native protocol 중 맞는 표면에서 공통 최적화 책임을 제공하는 방향을 다룬다.
@ -52,17 +52,17 @@ Phase를 가로지르는 실제 다음 작업 선택은 [전역 마일스톤 실
- 경로: [[judge-01] LLM 판별 기반 Missing Tool Call 재시도 Gate](milestones/llm-judged-missing-tool-call-retry-gate.md)
- 요약: Pi/dev-corp 같은 tool-bearing 요청에서 provider가 tool 사용 의도를 reasoning했지만 tool call 없이 종료하는 케이스를 LLM judge와 buffered retry 후보로 재검토하고, 정확한 종료/재시도 정책이 정의될 때까지 구현을 잠근다.
- [스케치] [route-01] IOP Hot Path One-shot 실행 경로
- 경로: [[route-01] IOP Hot Path One-shot 실행 경로](milestones/iop-hot-path-one-shot-execution.md)
- 요약: 외부 `model=iop` 요청을 Gemini 3.6 Flash 즉답 또는 micro-plan, RTX 5090 `ornith-fast` 실행, Gemini 단일 리뷰·보정으로 처리하면서 model advisory, Edge arbiter, request-local profile과 route evidence의 첫 vertical slice를 구축한다.
- [계획] [route-01] IOP 실행 프리셋과 Hot Path
- 경로: [[route-01] IOP 실행 프리셋과 Hot Path](milestones/iop-hot-path-one-shot-execution.md)
- 요약: 외부 model을 execution preset에 매핑하는 기반과 cross-call `request_id` coordinator를 만들고, Claude/Pi agent tool round-trip에서 Plan/Review artifact 없는 `direct`와 cloud plan → local work → cloud review/repair인 `light`를 구현한다.
- [스케치] [route-02] 단계 호출과 검증 최적화 MVP
- 경로: [[route-02] 단계 호출과 검증 최적화 MVP](milestones/knowledge-tool-validation-optimization.md)
- 요약: Hot Path의 micro-plan/review를 analysis directive, generation, verification의 bounded request-local 실행 형태로 일반화하고 Edge가 선택할 stage binding 계약을 스케치한다.
- [스케치] [route-02] Heavy Plan/Review 실행과 검증 MVP
- 경로: [[route-02] Heavy Plan/Review 실행과 검증 MVP](milestones/knowledge-tool-validation-optimization.md)
- 요약: Hot Path의 lightweight Plan/Review를 `heavy` mode로 확장해 `heavy-only` preset에서 장기 작업의 plan 갱신, 검증, review/repair cycle, 중단·재개와 stage binding을 먼저 검증한다. mixed mode 선택은 route-03에서 연결한다.
- [스케치] [route-03] OpenAI-compatible 하이브리드 요청 수준·실행 형태 라우팅
- 경로: [[route-03] OpenAI-compatible 하이브리드 요청 수준·실행 형태 라우팅](milestones/openai-compatible-hybrid-request-execution-routing.md)
- 요약: 폐기된 하이브리드 라우팅 설계에서 IOP Edge 책임만 복원해 cloud model advisory와 deterministic hard gate를 결합하고, Edge가 요청 난이도에 맞는 execution shape와 stage별 adapter/target을 최종 결정한다.
- [스케치] [route-03] Execution Preset 하이브리드 Mode 라우팅
- 경로: [[route-03] Execution Preset 하이브리드 Mode 라우팅](milestones/openai-compatible-hybrid-request-execution-routing.md)
- 요약: 폐기된 하이브리드 라우팅 설계에서 IOP Edge 책임만 복원해 cloud advisory와 deterministic hard gate를 결합하고, 이미 선택된 preset의 allowed mode 중 요청 수준에 맞는 실행 경로를 최종 결정한다.
- [스케치] [route-04] RAG 기반 Local Routing Model 운영 전환
- 경로: [[route-04] RAG 기반 Local Routing Model 운영 전환](milestones/rag-local-routing-model-operations.md)
@ -90,8 +90,10 @@ Phase를 가로지르는 실제 다음 작업 선택은 [전역 마일스톤 실
- 이 Phase는 Control Plane/Client 운영 기반과 운영 관측 MVP 없이 현재 provider 확장 Phase 안으로 당겨 구현하지 않는다.
- 기본 `/v1/models`, `/v1/chat/completions`, Edge-Node relay, Ollama option/API passthrough 안정화는 `Ollama 서빙 안정화 기반` Phase 책임이다.
- 추가 추론 서버 provider의 adapter/config/target/model 매핑 표준화는 `추론 서버 provider 확장` Phase 책임이다.
- Hot Path, request-local 단계 호출, 하이브리드 라우팅은 순서대로 첫 profile, 올바른 실행 형태 일반화, Edge 범용 선택 정책을 구성한다.
- IOP Edge는 요청 사실과 model advisory를 바탕으로 execution shape와 stage별 adapter/target을 최종 확정한다. IOP Node는 확정된 stage 실행·취소·상태·usage 보고만 담당한다.
- 이 Phase의 plan/review는 하나의 요청 안에서만 유지되는 transient inference stage다. durable Plan/Milestone/CODE_REVIEW artifact, 승인·continuation·workspace mutation 같은 workflow process는 범위 밖이다.
- execution preset Hot Path, heavy Plan/Review, 하이브리드 라우팅은 순서대로 공통 preset/coordinator와 `direct/light`, 장기 작업용 `heavy`, Edge 범용 mode 선택 정책을 구성한다.
- 외부 model 선택이 execution preset을 고정하고, IOP Edge는 요청 사실과 model advisory를 바탕으로 그 preset의 allowed mode와 stage별 canonical model binding을 최종 확정한다. IOP Node는 확정된 provider stage 실행·취소·상태·usage 보고만 담당한다.
- plan-bearing mode는 agent의 기존 workspace-capable tool call로 사용자 workspace의 `.iop/job/<request_id>/plan.md``review.md`를 사용한다. write tool이 missing parent를 만들지 못하면 같은 cloud stage의 tool continuation으로 request directory를 먼저 준비한다. IOP는 tool call을 생성·검증하고 논리 요청 state와 terminal을 제어하지만 workspace나 agent runtime을 직접 소유하지 않는다.
- 각 stage의 routing, plan, work, review, defect와 repair 출력은 사용자 stream에 유지한다. 내부 control prompt, credential과 protocol metadata만 공개하지 않는다.
- target agent나 외부 workflow 제품의 process, state, contract 또는 runtime을 이 Phase에 연결하지 않는다. endpoint-native tool call 실행은 호출 agent가 소유한다.
- cloud model은 초기 semantic judge/teacher 역할을 하고, 충분한 정제 evidence가 쌓인 뒤 RAG local router로 운영 기본을 전환한다. 두 경우 모두 최종 권한은 deterministic hard gate를 적용하는 Edge arbiter에 남는다.
- routing evidence RAG는 route 판정 전용이고, repository 장기 기억 RAG·누적 요청 context·advisor·Context Hook과 corpus/index/평가를 공유하지 않는다.

View file

@ -1,128 +1,149 @@
# Milestone: [route-01] IOP Hot Path One-shot 실행 경로
# Milestone: [route-01] IOP 실행 프리셋과 Hot Path
## 위치
- Roadmap: [ROADMAP.md](../../../ROADMAP.md)
- Phase: [PHASE.md](../PHASE.md)
- SDD: [SDD.md](../../../sdd/knowledge-tool-optimization-extension/iop-hot-path-one-shot-execution/SDD.md)
## 목표
OpenAI-compatible 경계에 외부 `model=iop`으로 보이는 단일 one-shot 실행 표면을 제공하고, 내부에서는 빠른 cloud `Gemini 3.6 Flash`와 RTX 5090 local target `ornith-fast`를 조합하는 Hot Path를 스케치한다.
단순 요청은 Gemini가 즉시 완료하고, 일정 볼륨과 난이도가 있는 요청은 짧은 micro-plan, `ornith-fast` 실행, Gemini 리뷰와 최대 1회의 보정으로 끝낸다.
이 경로의 1차 목적은 최대 품질이 아니라 end-to-end 속도를 최대화하면서 실사용에 충분한 품질을 확보하는 것이다.
동시에 이 마일스톤은 후속 [`OpenAI-compatible 하이브리드 요청 수준·실행 형태 라우팅`](openai-compatible-hybrid-request-execution-routing.md)의 첫 vertical slice로서, model advisory와 Edge 최종 판정, request-local 실행 profile, route evidence의 기본 계약을 세운다.
외부에 노출하는 IOP model을 단일 provider target이 아니라 **실행 방식 전체를 정의하는 execution preset**에 연결한다.
각 preset은 허용 execution mode, fused selector/planner, mode별 downstream stage 순서와 stage별 model/options를 소유하며, 외부 호출자는 preset에 매핑된 model만 선택한다.
초기 Hot Path preset은 `direct`와 lightweight Plan/Review인 `light`를 제공한다. `direct`는 고성능·high-thinking·tool 사용도 가능한 Plan/Review 없는 경로이고, `light`는 cloud plan, local agent work, cloud review와 defect repair를 하나의 논리적 `request_id`로 연결한다.
이 마일스톤은 후속 `heavy` Plan/Review와 cloud-first 하이브리드 라우팅, RAG local router가 같은 preset·mode·decision contract를 확장할 수 있는 첫 vertical slice다.
## 상태
[스케치]
## 승격 조건
- [ ] Hot Path가 지원할 OpenAI-compatible endpoint, streaming 여부와 외부 `model=iop` 응답 계약을 확정한다.
- [ ] Gemini triage가 사용할 2~3단계 난이도·볼륨 등급, 등급별 허용 범위와 Hot Path 제외 조건을 확정한다.
- [ ] 사용자 요청을 `ornith-fast` 실행 입력으로 바꾸는 micro-plan의 최소 구조와 context 상한을 확정한다.
- [ ] Gemini 리뷰와 최대 1회 보정의 입력, 종료 판정, timeout·실패·부분 결과 처리 방식을 확정한다.
- [ ] 최대 속도를 1차 목표로 측정할 latency budget과 실사용 품질 하한을 함께 확정한다.
- [ ] provider/model alias, route policy, stage budget과 관측 항목의 설정 소유권을 확정한다.
- [ ] Hot Path decision/evidence envelope가 후속 범용 하이브리드 라우팅과 호환되도록 `execution_shape`, advisory, Edge override, fallback과 policy version을 확정한다.
- [ ] API/config/composite lifecycle 계약 구현으로 승격할 때 SDD와 후속 구현 단위를 확정한다.
[계획]
## 구현 잠금
- 상태: 잠금
- SDD: 필요
- SDD 문서: 없음
- SDD 사유: 현재는 Hot Path의 제품 목적과 후보 경계를 정리하는 스케치이며, OpenAI-compatible API, config와 복합 호출 lifecycle을 구현 가능한 계획으로 승격할 때 SDD가 필요하다.
- 잠금 해제 조건: 아래 체크리스트
- [ ] 승격 조건의 미정 항목이 해소되어 있다.
- [ ] 구현 가능한 MVP 범위와 후속 확장 범위가 분리되어 있다.
- [ ] 계획 승격 시 필요한 SDD가 작성되고 잠금이 해제되어 있다.
- 결정 필요: 아래 체크리스트
- [ ] Hot Path 내부 등급을 2단계와 3단계 중 어느 형태로 고정하고 각 경계를 어떤 신호로 판정할지 결정한다.
- [ ] 첫 MVP가 Chat Completions, Responses, streaming과 workspace/tool 실행 중 어디까지 지원할지 결정한다.
- [ ] Hot Path 범위 초과, target unavailable, timeout 또는 보정 실패 시 같은 요청 안에서 허용할 terminal fallback을 결정한다. 자동으로 durable 작업 루프에 진입시키지는 않는다.
- [ ] latency SLO, 요청·출력·context·도구 실행 상한과 대표 품질 평가의 최소 통과선을 결정한다.
- 상태: 해제
- SDD: 필요
- SDD 문서: [IOP 실행 프리셋과 Hot Path SDD](../../../sdd/knowledge-tool-optimization-extension/iop-hot-path-one-shot-execution/SDD.md)
- SDD 사유: config/API schema, cross-call state machine, request identity/idempotency, streaming terminal과 artifact lifecycle을 함께 변경한다.
- SDD 상태: 승인됨
- SDD 잠금: 해제
- SDD 사용자 리뷰: 없음
- 잠금 해제 근거:
- [x] execution preset이 외부 model에 매핑되는 전체 실행 정책이라는 경계를 확정했다.
- [x] 현재 구현 범위를 `direct + light`와 Claude/Pi streaming으로 한정하고 `heavy`와 추가 mode의 확장 지점을 분리했다.
- [x] `request_id`, workspace Plan/Review pair, stage 전이, 전체 사용자 출력, 오류·취소와 cleanup 기준을 확정했다.
- [x] 필수 SDD를 작성하고 사용자 결정 사항을 반영했다.
- 결정 필요: 없음
## 범위
- OpenAI-compatible 외부 `model=iop`을 실제 단일 provider 모델이 아니라 IOP가 소유하는 composite Hot Path route로 노출하는 방향
- cloud target `Gemini 3.6 Flash`가 최초 triage, 단순 요청의 직접 응답, micro-plan 생성과 local 결과 리뷰를 담당하는 고정 baseline
- RTX 5090에서 제공되는 local target `ornith-fast`가 micro-plan에 따라 일정 볼륨의 one-shot 작업을 수행하는 고정 baseline
- 요청의 볼륨, 난이도, context, tool/workspace capability와 위험 신호를 이용한 2~3단계 내부 등급 후보
- deterministic request facts/hard gate를 먼저 계산하고 Gemini가 의미·난이도 advisory를 반환한 뒤 Edge arbiter가 최종 route를 확정하는 권한 경계
- 단순 요청은 local hop과 review 없이 Gemini 응답으로 바로 종료하는 최단 경로
- local 실행 요청은 durable Plan 문서가 아닌 bounded micro-plan prompt를 만들고 `ornith-fast` 결과를 Gemini가 리뷰한 뒤 필요한 경우 최대 1회만 보정하는 경로
- 품질 향상을 위한 추가 model hop보다 end-to-end latency, time-to-first-useful-result와 bounded completion을 우선하는 stage budget
- 외부에는 한 번의 `iop` model 요청과 최종 응답으로 보이되 내부에는 triage, direct/local route, review, correction, latency와 terminal outcome을 안전하게 관측하는 방향
- 후속 cloud-first/Local RAG router가 재사용할 수 있는 versioned decision/evidence envelope의 최소 형태
### 1. Execution preset과 외부 model
- top-level model catalog의 외부 model id는 기존 provider pool route 또는 execution preset 중 정확히 하나를 가리킨다.
- preset은 mode 내부의 model 묶음이 아니라 fused selector/planner, 허용 mode 집합, mode별 downstream stage 순서, 각 stage의 model reference와 옵션을 포함하는 전체 실행 정책이다.
- 현재 handler에서 `direct`는 selector/planner 결과와 tool loop를 그대로 사용해 downstream model stage가 없고, `light`는 downstream `local`, `review` stage를 순서대로 사용한다. `review` binding은 review 작성, 결과 확인과 defect repair가 끝날 때까지 고정한다.
- stage model reference는 raw provider/target이 아니라 기존 canonical model/resource를 가리킨다. managed credential mode에서는 각 reference가 같은 principal의 기존 projected route에 정확히 하나로 해석될 때만 virtual preset model을 노출·실행하며, 각 stage dispatch가 최신 route/credential binding을 재검증한다.
- 초기 mode 이름은 `direct`, `light`, `heavy`지만 config와 runtime은 등록된 mode handler를 조회하는 확장 가능한 key를 사용한다. 알 수 없거나 아직 구현되지 않은 mode는 시작 시 검증 오류로 거부한다.
- 같은 mode라도 preset마다 cloud/local model 배치와 thinking·timeout·token 옵션을 다르게 구성할 수 있다.
- `plan-only` preset은 `direct`를 제외할 수 있고, `high-think-one-shot` preset은 `direct`만 허용할 수 있다. 현재 구현에서는 등록된 `direct``light` 조합만 실행 가능하다.
- current fused selector/planner는 별도 hidden marker나 mode-only 응답을 만들지 않는다. issued request path의 정확한 prepare/Plan·Review control tool-call shape가 `light` 후보이고 reserved artifact call이 없는 정상 content/reasoning/일반 작업 tool call은 `direct` 후보이며, Edge가 preset allowlist, capability, health와 config를 검증해 최종 mode와 stage binding을 확정한다. 자연어 reasoning은 route 권한으로 파싱하지 않는다.
- preset catalog와 model→preset mapping은 logical request 시작 시 immutable generation으로 고정한다. config refresh는 새 request에만 적용하고 진행 중인 tool round-trip의 mode/stage/model binding을 바꾸지 않는다.
### 2. 논리 요청과 workspace artifact
- 최초 사용자 요청에 IOP가 caller가 덮어쓸 수 없는 path-safe opaque `request_id`를 발급하고, 이후 endpoint call, public/provider tool call/result, stage, provider attempt와 session id를 그 하위 identity로 연결한다. 이 id는 권한 증명이 아니며 Hot Path 전용 id를 별도로 만들지 않는다.
- logical request 시작 시 endpoint별 normalized request lineage와 선택 workspace tool binding fingerprint를 고정한다. continuation은 과거 request/tool transcript와 선택 tool schema를 그대로 보존해야 하며 변조·교체된 history는 같은 `request_id`에 연결하지 않는다.
- 현재 coordinator state는 Edge-local transient state다. tool continuation은 같은 Edge로 돌아와야 하며 state가 없는 failover/restart 요청을 새 `request_id`로 시작하지 않고 표준 오류로 닫는다. cross-Edge/durable resume은 현재 범위가 아니다.
- plan-bearing mode는 agent에 이미 제공된 structured file 또는 command tool을 정상 tool call로 사용해 현재 workspace의 `.iop/job/<request_id>/plan.md``review.md`를 pair로 만든다.
- preset은 canonical workspace prepare-directory/read/write/delete operation과 caller tool schema를 양방향 변환하는 declarative ordered binding alternatives를 가진다. binding은 actual tool schema matcher, argument encoder, result success/error matcher와 missing parent 생성 보장 여부를 명시한다. Claude/Pi별 이름을 route 조건으로 쓰지 않고 실제 `tools[]` schema로 request-local binding을 고정하며, parent 생성 가능 write 또는 별도 prepare role과 deterministic result 판별을 포함한 조합이 맞지 않으면 admission error로 닫는다.
- plan/review stage model은 canonical artifact operation을 호출하고 Edge가 이를 caller의 실제 tool call로 변환해 사용자 stream에 내보낸 뒤 result를 원 stage call로 역매핑한다. 일반 작업 tool은 caller schema를 그대로 통과시키며 Edge가 실제 tool/workspace operation을 실행하지 않는다. command tool mapping은 fixed path/content, workspace containment와 exact success receipt를 Edge가 합성·검증한다.
- `plan.md`는 작업 목표·제약·검증 기준을 담고, `review.md`는 최초 생성 시 비어 있거나 pending 상태이며 cloud review가 결과·결함·후속 작업을 기록한다.
- manifest, revision 디렉터리, 미래용 빈 구조는 만들지 않는다.
- `direct``.iop/job/<request_id>/`를 만들지 않는다.
- `.iop/job/<request_id>/`는 해당 logical request의 reserved namespace다. write binding이 missing parent 생성을 보장하지 않으면 최초 `light` tool turn은 이 directory를 준비하는 정확히 하나의 tool call로 제한한다. 그 뒤 Plan/Review 생성 turn은 정확한 pair tool call만 허용하고 같은 응답의 다른 작업 tool call이나 임의 sibling path는 거부한다.
- pair tool result는 다음 continuation frontier 하나에서 순서와 무관하게 각각 한 번만 소비하며, 둘 다 성공할 때만 local stage를 시작한다. 누락·중복·unknown result는 표준 validation error다.
- IOP Edge/Node는 agent workspace를 직접 소유하지 않는다. 실제 file/tool 실행은 Claude/Pi 같은 호출 agent가 자신에게 전달된 tool call을 수행한다.
### 3. `direct``light` 실행 흐름
- 최초 cloud selector/planner stage는 사용자 요청과 preset control을 한 번에 받아 `direct` 응답·tool 작업을 시작하거나, `light`를 선택해 artifact 작성을 수행한다. 현재 Hot Path에서 mode 판정만을 위한 별도 model stage를 추가하지 않는다. missing parent 준비가 필요하면 `light`를 고정한 채 같은 selector/planner stage의 정상 tool continuation으로 처리하고 mode를 다시 판정하지 않는다.
- `direct`는 같은 logical request에서 직접 응답하거나 agent tool을 사용해 작업하고, Plan/Review stage 없이 완료한다. 빠르거나 약한 model만을 뜻하지 않는다.
- `light`는 최초 stage가 낸 두 artifact tool result가 성공한 뒤 local worker로 전환한다.
- local prompt는 immutable 사용자 작업과 `plan.md`·paired `review.md` 경로를 명시한다. local model은 두 파일을 agent tool로 읽고 정상 tool round-trip을 반복하며 작업·검증한 뒤 completion candidate를 낸다. IOP가 workspace 파일을 대신 읽어 prompt에 복제하지 않는다.
- Stream Evidence Gate가 local completion terminal을 판정하면 cloud reviewer로 전환한다. reviewer는 필요한 inspection tool round-trip 뒤 `review.md`를 채운다.
- reviewer는 immutable 사용자 작업, artifact path와 committed local 결과 correlation을 입력으로 받는다. review write tool result가 돌아오면 같은 cloud `review` stage/model이 `review.md`를 읽는다. pass이면 cleanup으로 진행하고, defect이면 agent와 정상 tool round-trip으로 수정·검증한 뒤 cleanup으로 진행한다. Edge가 workspace file 내용을 직접 읽거나 review text를 파싱해 verdict를 재판정하지 않는다.
- 현재 `light`는 review transition을 한 번만 수행한다. repair 완료 뒤 두 번째 review loop를 만들지 않으며, repair stage의 정상 tool turn 수를 별도 “수정 횟수” 성공 상태로 제한하지 않는다.
### 4. Streaming, terminal과 오류
- routing, plan, local work, local completion candidate, review, defect, repair와 최종 결과의 의미 있는 content/reasoning/tool-call 출력은 모두 사용자에게 endpoint-native streaming으로 보인다.
- credential, 내부 control prompt와 protocol metadata만 사용자 출력에서 제외한다.
- Stream Evidence Gate는 terminal event만 hold 대상으로 삼고 stage content delta는 release한다. agent가 tool을 실행해야 하는 tool-use/tool-call terminal은 각 HTTP turn을 exactly-once로 정상 종료하고, 다음 ingress를 같은 `request_id`에 연결한다.
- 여러 internal stage가 같은 HTTP turn에서 이어지면 endpoint codec이 internal response-start/terminal을 transition evidence로 소비하고 공개 block/tool id를 충돌 없이 다시 매겨 하나의 outer response envelope로 encode한다. 내부 provider 응답 envelope를 중첩해서 내보내지 않는다.
- 각 HTTP turn은 endpoint-native terminal을 하나씩 갖지만, 한 `request_id`의 logical completion은 마지막 turn에서 한 번만 확정된다. 완료·실패·취소 뒤 같은 request가 stage를 다시 실행하거나 두 번째 completion을 만들지 않는다.
- endpoint usage와 caller output cap은 같은 HTTP turn에서 실행한 internal stage 전체를 기준으로 중복 없이 집계·적용하고, logical request 전체 usage는 `request_id` observability로 별도 연결한다.
- workspace/file-write capability가 없거나 read-only이면 preset admission을 거부하고 해당 endpoint의 표준 API 오류를 반환한다. server-only artifact나 cloud-direct 대체 경로로 조용히 우회하지 않는다.
- timeout, provider/context/config/internal execution 실패는 표준 API 오류, 사용자 abort는 표준 cancellation, 출력 상한은 endpoint-native length terminal로 처리한다. partial-success 전용 상태를 추가하지 않는다.
- 성공한 `light` 요청은 agent tool 경계에서 request directory cleanup을 확인한 뒤 최종 성공하고 server state를 즉시 제거한다. 오류 중 tool round-trip이 가능한 경우 artifact cleanup을 best-effort로 시도한다.
- caller cancel/연결 단절 뒤에는 hidden cleanup 작업을 계속하지 않는다. server state TTL은 IOP state만 회수하며 workspace artifact 삭제를 보장하지 않으므로, 남을 수 있는 orphan request id와 reserved relative path를 raw content 없이 관측 가능하게 한다.
## 기능
### Epic: [hot-entry] IOP Model과 Hot Path 진입
### Epic: [preset-surface] Execution Preset 표면
외부의 단일 모델 호출을 내부 composite route와 속도 우선 등급 판정으로 연결하는 capability를 묶는다.
- [ ] [preset-model] 외부 model catalog entry가 provider route 또는 virtual execution preset 중 하나에 매핑되고, principal별 stage route 해석·authorization과 성공·오류·model echo의 외부 identity를 유지한다.
- [ ] [preset-schema] preset이 fused selector/planner, 허용 mode, mode별 downstream ordered stage와 stage별 model reference/options를 소유하고 logical request가 immutable config generation을 고정한다.
- [ ] [route-selector] fused selector/planner의 structural direct/light output shape를 Edge가 preset allowlist와 deterministic capability/health gate로 검증해 별도 marker·자연어 parsing 없이 최종 mode와 stage binding을 확정한다.
- [ ] [hot-preset] 초기 Hot Path preset이 `direct``light`를 실행하고 등록되지 않았거나 구현되지 않은 `heavy`/추가 mode binding을 시작 시 거부한다.
- [ ] [iop-model-surface] OpenAI-compatible `model=iop`이 기존 model route 규칙을 보존하면서 Hot Path composite execution으로 진입하고 `/v1/models`와 성공·오류 응답에서 일관된 외부 identity를 제공한다.
- [ ] [gemini-triage] `Gemini 3.6 Flash`가 요청 볼륨, 난이도, context, capability와 위험 신호를 bounded advisory로 반환하고, Edge arbiter가 hard gate와 live capability를 적용해 direct 또는 guided-local profile을 최종 확정한다.
- [ ] [direct-complete] direct 등급은 local 호출과 별도 review 없이 같은 Gemini 호출의 결과를 최종 응답으로 사용해 가장 짧은 종료 경로를 제공한다.
- [ ] [route-boundary] invalid·불확실·범위 초과 판정이 Hot Path 안에서 무제한 추론이나 durable workflow 진입을 만들지 않고 계약된 terminal 결과로 끝난다.
### Epic: [request-flow] Request Coordinator와 Plan/Review
### Epic: [local-work] Micro-plan과 RTX 5090 실행
- [ ] [request-identity] 하나의 `request_id`가 같은 principal의 여러 endpoint call, public/provider tool call/result, stage, provider attempt와 session을 연결하고 immutable request lineage/tool binding을 보존하면서 반복되는 전체 history와 새 continuation frontier를 구분한다.
- [ ] [artifact-pair] 최초 cloud selector/planner가 `light`를 선택하면 canonical artifact operation을 실제 caller tool로 양방향 매핑해 필요할 때 reserved request directory를 먼저 준비하고 정확한 Plan/Review pair만 만든 뒤, 각 expected result frontier와 deterministic success를 검증하고 pair 결과를 순서와 무관하게 확인한 뒤 local stage로 전환한다.
- [ ] [direct-flow] `direct`가 Plan/Review artifact 없이 응답·high-thinking·agent tool 작업을 수행하고 정상 완료한다.
- [ ] [light-flow] `light`가 cloud plan → local agent work → cloud review write → cloud review-resolution/repair를 수행하고 Edge의 review file 직접 읽기나 두 번째 review loop 없이 완료한다.
- [ ] [cleanup] 성공 시 agent tool result로 request artifact 삭제를 확인하고 server state를 정리하며, cancel/연결 단절에서는 server TTL과 workspace orphan 관측의 책임을 분리한다.
일정 볼륨의 요청을 긴 계획 없이 local model에 넘겨 속도와 작업 성능을 함께 확보하는 capability를 묶는다.
### Epic: [stream-protocol] Stream과 Agent Protocol
- [ ] [micro-plan] Gemini가 목표, 필요한 입력, 산출물, 제약과 짧은 검증 기준만 포함한 bounded micro-plan을 만들며 이를 durable Plan/Milestone artifact로 저장하지 않는다.
- [ ] [ornith-execute] `ornith-fast`가 선택된 RTX 5090 local route에서 micro-plan과 허용된 요청 context를 받아 one-shot 결과를 생성한다.
- [ ] [execution-budget] local 실행은 요청별 context, 출력, 도구, timeout과 cancellation 상한 안에서 끝나며 session continuation이나 background task queue를 요구하지 않는다.
- [ ] [terminal-control] Stream Evidence Gate를 terminal-only hold로 재사용하고 cross-stage response envelope, block/tool id, usage/output cap을 endpoint codec에서 일관되게 합성해 HTTP turn terminal과 logical completion의 exactly-once 경계를 분리한다.
- [ ] [anthropic-gate] Claude가 사용하는 native Anthropic `/v1/messages` streaming에 normalized event codec, terminal gate와 request continuation correlation을 연결한다.
- [ ] [chat-gate] Pi가 사용하는 OpenAI `/v1/chat/completions` streaming에서 tool call/result와 stage 전이를 동일한 `request_id`로 연결한다.
- [ ] [error-cancel] endpoint별 표준 오류, timeout, cancellation과 length terminal을 유지하고 custom partial-success 상태를 만들지 않는다.
### Epic: [review-correct] 단일 리뷰와 보정
### Epic: [quality-ops] 검증과 운영
추가 지연을 제한하면서 local 결과의 실사용 품질을 보완하는 capability를 묶는다.
- [ ] [gemini-review] Gemini가 원 요청, micro-plan, `ornith-fast` 결과와 허용된 검증 evidence를 함께 보고 pass, correction 또는 terminal failure를 판정한다.
- [ ] [single-correction] correction이 필요하면 계약된 방식으로 최대 1회만 보정하고 추가 review loop나 재계획을 만들지 않는다.
- [ ] [terminal-result] pass, 보정 완료, timeout, unavailable과 실패가 하나의 외부 응답 또는 오류로 끝나며 내부 stage 상태가 사용자 응답에 누출되지 않는다.
### Epic: [speed-balance] 속도 우선 품질·운영 기준
Hot Path가 최대 품질 경쟁이 아니라 빠른 실용 경로라는 목표를 측정하고 유지하는 capability를 묶는다.
- [ ] [latency-budget] direct와 local-work 등급별 전체 latency, cloud/local stage timeout과 추가 hop 상한이 정의되고 속도 회귀를 검출할 수 있다.
- [ ] [quality-floor] 대표 one-shot 요청 세트에서 허용 가능한 정확성·완결성 하한을 정의하되 품질 점수를 높이기 위한 추가 stage는 latency budget을 넘지 않는다.
- [ ] [route-observability] route id, target identity, model advisory, Edge override, execution shape, stage timing, review/correction 여부와 terminal outcome을 raw prompt·output·credential 없이 관측할 수 있다.
- [ ] [hot-path-smoke] 실제 Gemini cloud target과 RTX 5090 `ornith-fast`를 사용해 direct, local pass, 단일 보정, 범위 초과와 target unavailable 경로를 검증한다.
- [ ] [preset-validation] model/preset one-of, stage route authorization, mode handler, declarative workspace tool schema·argument·result·containment binding, reserved path와 option 범위를 load/admission에서 fail-closed 검증한다.
- [ ] [route-observability] request/preset/mode/stage/attempt identity, route 근거, timing과 terminal outcome을 raw prompt·output·credential 없이 관측한다.
- [ ] [hot-smoke] Claude Messages와 Pi Chat에서 direct, light pass, defect repair, write unavailable, timeout·cancel과 cleanup을 실제 streaming smoke로 검증한다.
## 완료 리뷰
- 상태: 없음
- 요청일: 없음
- 완료 근거: 방향성 스케치이며 승격 조건, 기능 Task와 실제 검증이 아직 충족되지 않았다.
- 완료 근거: 구현 가능한 계획과 승인된 SDD로 승격했으며 기능 Task와 검증 evidence는 아직 완료되지 않았다.
- 검토 항목: 없음
- 리뷰 코멘트: 없음
## 범위 제외
- 최대 품질을 위해 강한 cloud 모델을 여러 번 호출하거나 reviewer ensemble, debate, self-consistency를 수행하는 경로
- durable Plan/Milestone/CODE_REVIEW artifact 생성, 여러 task 연결, background 실행, 중단 후 재개와 완료 알림을 담당하는 에이전트 작업 루프 오케스트레이션
- Hot Path 실패나 범위 초과 요청을 자동으로 Plan/Milestone 작업 루프에 편입하는 동작
- 여러 번의 review·repair, 무제한 retry, 장기 session과 사람 승인 대기 상태
- 모든 cloud/local model을 동적으로 조합하는 범용 planner/generator/verifier framework. 이는 후속 하이브리드 라우팅 마일스톤에서 다룬다.
- provider 설치, 모델 다운로드, RTX 5090 lifecycle·qualification과 credential 관리
- RAG, 장기 기억, 누적 대화 context 최적화와 학습 기반 route threshold 자동 조정. route evidence 기반 Local RAG 전환은 별도 후속 마일스톤에서 다룬다.
- `heavy`의 장기 Plan/Review lifecycle, 재계획, 여러 review cycle와 사람 승인
- cloud evidence를 학습 corpus로 승격하거나 RAG local router를 운영하는 기능
- 범용 DAG/workflow/plugin engine과 미래 mode를 위한 manifest·revision·빈 디렉터리
- target agent별 hook/adapter 설치, Claude/Pi 프로세스 패치 또는 agent update 수명주기 추적
- target agent 또는 외부 workflow 제품의 process/state/contract, terminal/PTY/workspace runtime을 IOP에 포함하거나 연결하는 작업
- `/v1/responses`, A2A와 IOP native protocol의 execution preset 지원
- cross-Edge state replication, Edge restart 뒤 continuation과 durable resume
- provider 설치, model 다운로드, hardware qualification과 credential 관리
## 작업 컨텍스트
- 관련 경로: `apps/edge/internal/openai`, `apps/edge/internal/service`, `packages/go/config`, `configs/edge.yaml`, `packages/go/streamgate`
- 관련 계약: [OpenAI-Compatible API Contract](../../../../agent-contract/outer/openai-compatible-api.md), [Edge Config And Runtime Refresh Contract](../../../../agent-contract/inner/edge-config-runtime-refresh.md)
- 표준선(선택): 외부 호출자는 OpenAI-compatible `model=iop`만 선택하고 내부 실행은 기존 원칙대로 `adapter + target + execution`으로 기록한다. Hot Path stage 선택을 위한 별도 root-level `iop` wrapper나 caller metadata selector를 요구하지 않는다.
- 표준선(선택): `Gemini 3.6 Flash``ornith-fast`는 Hot Path baseline target으로 설정에서 명시하고, core 내부에는 외부 `model` id와 provider id, target 문자열의 의미를 섞어 하드코딩하지 않는다.
- 표준선(선택): end-to-end 속도와 bounded completion이 1차 최적화 목표이며, 품질은 정한 하한을 만족하는 범위에서 최대한 확보한다. 미미한 품질 향상을 위해 stage 수를 늘리지 않는다.
- 표준선(선택): micro-plan은 한 요청 안의 transient directive이며 durable Plan/Milestone artifact가 아니다. review와 correction을 포함해 전체 실행은 one-shot terminal lifecycle 안에서 닫힌다.
- 표준선(선택): Hot Path는 외부 workflow product의 요청 분류, 계약, 상태, 실행과 연결하지 않는다. 여기서 plan/review는 오직 하나의 IOP 요청 안에서 닫히는 transient inference stage다.
- 표준선(선택): [단계 호출과 검증 최적화 MVP](knowledge-tool-validation-optimization.md)는 request-local staged profile을 올바르게 일반화하고, Hot Path는 고정 target 조합과 latency budget을 먼저 검증하는 첫 profile이다. 두 결과는 후속 [하이브리드 요청 수준·실행 형태 라우팅](openai-compatible-hybrid-request-execution-routing.md)에서 연결한다.
- 표준선(선택): model은 route advisory만 제공하고 Edge arbiter가 hard gate, capability, health, budget을 적용해 execution shape와 stage target을 최종 결정한다. Node는 확정된 stage 실행만 담당한다.
- 큐 배치: 현재 전역 실행 순서 2번이다. 이 번호는 dependency가 아니라 기본 선택 우선순위다.
- 선행 작업: 없음
- 참조·연결 작업: [단계 호출과 검증 최적화 MVP](knowledge-tool-validation-optimization.md), [요청 실행 로그와 Usage Ledger 기반](../../operational-observability-provider-management/milestones/request-execution-log-usage-ledger-foundation.md)
- 후속 작업: Hot Path 구현 계획과 SDD, [단계 호출과 검증 최적화 MVP](knowledge-tool-validation-optimization.md), [하이브리드 요청 수준·실행 형태 라우팅](openai-compatible-hybrid-request-execution-routing.md), [RAG 기반 Local Routing Model 운영 전환](rag-local-routing-model-operations.md)
- 확인 필요: `구현 잠금 > 결정 필요`
- 관련 경로: `apps/edge/internal/openai`, `apps/edge/internal/service`, `apps/edge/internal/authprojection`, `apps/edge/internal/controlplane`, `packages/go/config`, `packages/go/streamgate`, `configs/edge.yaml`
- 관련 계약: [OpenAI-Compatible API Contract](../../../../agent-contract/outer/openai-compatible-api.md), [Anthropic-Compatible Messages API Contract](../../../../agent-contract/outer/anthropic-compatible-api.md), [Edge Config And Runtime Refresh Contract](../../../../agent-contract/inner/edge-config-runtime-refresh.md), [Control Plane-Edge Wire Contract](../../../../agent-contract/inner/control-plane-edge-wire.md), [Edge-Node Runtime Wire Contract](../../../../agent-contract/inner/edge-node-runtime-wire.md)
- 현재 구현 기준: [Stream Evidence Gate 구현 스펙](../../../../agent-spec/runtime/stream-evidence-gate.md)
- 표준선(선택): preset stage의 model reference는 기존 canonical model/provider resolution을 재사용하며 provider id나 target 의미를 core에 하드코딩하지 않는다.
- 표준선(선택): `request_id`는 하나의 사용자 작업 identity이고 각 HTTP call의 endpoint request id, tool call id와 provider session/attempt id는 그 하위 correlation이다.
- 표준선(선택): agent tool round-trip 때문에 개별 HTTP stream은 endpoint-native terminal로 닫힐 수 있다. “하나의 model”은 하나의 논리 요청과 외부 identity·오류 의미를 뜻하며 하나의 TCP/SSE 연결을 강제하지 않는다.
- 표준선(선택): workspace 변경은 IOP가 생성한 정상 tool call을 외부 agent가 실행하며 IOP는 agent/workflow process나 workspace runtime을 소유하지 않는다.
- 선행 작업: [Stream Evidence Gate Core](../../../archive/phase/knowledge-tool-optimization-extension/milestones/stream-evidence-gate-core.md)
- 후속 작업: [Heavy Plan/Review 실행과 검증 MVP](knowledge-tool-validation-optimization.md), [Execution Preset 하이브리드 Mode 라우팅](openai-compatible-hybrid-request-execution-routing.md), [RAG 기반 Local Routing Model 운영 전환](rag-local-routing-model-operations.md)
- 큐 배치: `[route-01]` 1번이다. `[output-01]`과의 동시 변경은 차단한다.
- 확인 필요: 없음

View file

@ -1,4 +1,4 @@
# Milestone: [route-02] 단계 호출과 검증 최적화 MVP
# Milestone: [route-02] Heavy Plan/Review 실행과 검증 MVP
## 위치
@ -7,86 +7,96 @@
## 목표
요청 난이도와 작업 특성에 맞춰 analysis directive, generation, verification을 분리할 수 있는 request-local 단계 호출 실행 형태를 스케치한다.
이 마일스톤은 폐기된 범용 단계 호출 아이디어를 단순히 되살리는 것이 아니라, [`IOP Hot Path One-shot 실행 경로`](iop-hot-path-one-shot-execution.md)의 micro-plan/review를 일반화해 후속 Edge 하이브리드 라우터가 선택할 수 있는 올바른 실행 profile로 정의한다.
각 단계는 같은 요청의 bounded lifecycle 안에서 끝나며, durable Plan/Review artifact나 workflow 상태를 만들지 않는다.
[`IOP 실행 프리셋과 Hot Path`](iop-hot-path-one-shot-execution.md)가 구현한 preset/coordinator와 lightweight Plan/Review를 장기·고난도 작업용 `heavy` execution mode로 확장한다.
`heavy`는 별도 제품이나 고정 model 조합이 아니라 execution preset이 선택적으로 포함할 수 있는 mode handler다. preset마다 planner, worker, reviewer와 repair model/options를 다르게 배치할 수 있다. 이 마일스톤에서는 `heavy-only` preset으로 lifecycle을 먼저 검증하고, `direct/light/heavy` 혼합 선택은 후속 route-03에서 연결한다.
이 마일스톤은 Plan/Review 갱신, 검증, 여러 work/review 전이와 중단·재개가 필요한 작업을 IOP의 하나의 논리 `request_id` 수명으로 다루되 target agent나 외부 workflow 제품의 adapter, process 또는 state를 공유하지 않는다.
## 상태
[스케치]
## 선행 작업
- [`IOP 실행 프리셋과 Hot Path`](iop-hot-path-one-shot-execution.md)
## 승격 조건
- [ ] analysis directive, generation, verification의 MVP 역할과 단계 생략 조건을 확정한다.
- [ ] tool call/schema 강제와 output validation의 최소 책임 경계를 결정한다.
- [ ] 검증 실패 시 어느 단계로 회귀할지와 요청 전체 retry·latency budget을 결정한다.
- [ ] `execution_shape`와 stage binding을 Edge가 명시하고 Node가 그대로 실행하는 계약을 확정한다.
- [ ] Hot Path profile과 staged profile이 공유할 decision/stage evidence 최소 schema를 확정한다.
- [ ] API/config/event schema 구현으로 승격할 때 필수 SDD를 작성·승인한다.
- [ ] `light`에서 `heavy`로 구분되는 작업 규모·위험·검증 요구와 mode 선택 기준을 확정한다.
- [ ] heavy plan의 갱신 단위, review 기록, work/review/repair 전이와 완료 판정을 확정한다.
- [ ] 여러 agent tool turn, process restart와 중단 후 재개에 필요한 state/artifact 최소 범위를 확정한다.
- [ ] 검증 실패 시 재계획·수정·재검토의 budget, timeout, cancel과 표준 오류 경계를 확정한다.
- [ ] Claude/Pi 이후 endpoint 확장과 workspace capability admission 범위를 확정한다.
- [ ] API/config/event/artifact lifecycle 구현 전 필수 SDD를 작성·승인한다.
## 구현 잠금
- 상태: 잠금
- SDD: 불필요
- SDD 문서: 없음
- SDD 사유: 현재는 request-local 단계 역할과 하이브리드 라우팅 연결을 바로잡는 스케치다. 실행 shape, stage binding, validation/retry 계약 구현으로 승격할 때 SDD가 필요하다.
- SDD 사유: 현재는 `heavy` mode의 책임과 `light`와의 경계를 정리한 후속 스케치다. 장기 state, artifact 갱신, retry/review와 resume 계약을 구현하기 전에 필수 SDD가 필요하다.
- 잠금 해제 조건: 아래 체크리스트
- [ ] 승격 조건의 미정 항목이 해소되어 있다.
- [ ] Hot Path에서 재사용할 계약과 이 마일스톤에서 일반화할 계약이 분리되어 있다.
- [ ] 구현 가능한 MVP와 후속 profile 확장 범위가 분리되어 있다.
- [ ] 승격 조건의 lifecycle·artifact·budget·resume 결정이 모두 해소되어 있다.
- [ ] 현재 Hot Path에 추가할 부분과 공통 coordinator를 변경할 부분이 분리되어 있다.
- [ ] 구현 가능한 첫 heavy profile과 후속 확장 범위가 분리되어 있다.
- [ ] 필요한 SDD가 작성·승인되어 있다.
- 결정 필요: 아래 체크리스트
- [ ] analysis/generation/verification 각 단계의 입력·출력과 생략 가능 조건을 결정한다.
- [ ] runtime schema 강제를 Edge validator, Node adapter, 별도 validation stage 중 어디에서 시작할지 결정한다.
- [ ] validation failure 시 generation correction, analysis 재생성, terminal failure 중 허용할 경로와 최대 횟수를 결정한다.
- [ ] 명시적 client profile 선택을 허용할지, Edge route decision만 허용할지, 둘을 허용하면 우선순위를 어떻게 둘지 결정한다.
- 결정 필요: `승격 조건`과 동일
## 범위
- 한 IOP 요청 안에서만 유지되는 analysis directive, generation, verification의 bounded stage contract
- 단순 요청에서는 analysis/review 단계를 생략하고 필요한 요청에만 단계 호출을 적용하는 execution profile
- 각 stage에 대한 Edge의 명시적 adapter/target/capability binding과 Node의 실행-only 책임
- validation failure 시 bounded correction, 이전 단계 회귀, fallback, terminal failure 정책
- tool call/schema 강제와 output validation의 적용 지점 및 stage evidence
- Hot Path의 direct/guided-local profile과 호환되는 공통 decision/stage envelope
### 1. Heavy mode contract
- `heavy`는 preset `allowed_modes`와 registered handler로 추가하며 외부 model에 별도 하드코딩하지 않는다.
- preset stage binding은 기존 canonical model/provider resolution을 사용하고 planner/worker/reviewer/repair 역할의 model과 옵션을 operator가 구성한다.
- 이 마일스톤의 실행 검증은 `allowed_modes=[heavy]`인 unambiguous preset에서 fused selector/planner가 heavy plan을 작성하는 경로로 한정한다. selector가 `light/heavy` 난이도를 비교하거나 mixed mode를 고르는 계약은 도입하지 않는다.
- schema는 후속 `plan-only(light/heavy)`, balanced와 custom 조합을 막지 않지만, 둘 이상의 실행 가능한 mode 중 semantic selection을 요구하는 preset은 route-03 handler가 생기기 전 fail-closed한다.
### 2. Plan/Review lifecycle
- 기본 workspace root와 identity는 `.iop/job/<request_id>/``request_id`를 그대로 재사용한다.
- route-01의 `plan.md`/`review.md` pair를 최소 기반으로 삼고, 실제 필요가 확정될 때만 추가 파일·revision·checkpoint를 설계한다.
- plan 갱신, work progress, review defect와 repair 결과는 agent의 기존 tool call로 workspace에 반영한다. IOP는 stage와 terminal을 조정하지만 workspace를 직접 소유하지 않는다.
- long-running tool round-trip과 재연결에서도 동일 request identity, idempotency와 exactly-once final을 유지한다.
### 3. 검증과 회귀
- plan의 목표·제약·검증 기준과 실제 결과를 reviewer가 비교하고 pass, repair, replan 또는 terminal error를 결정한다.
- model 판단은 Edge가 검증하는 advisory이며 preset 밖 target/mode, 임의 path와 capability를 실행 권한으로 사용하지 않는다.
- review/replan/repair는 합의된 request budget 안에서만 반복하며 한도 초과는 별도 성공 상태가 아니라 표준 timeout/execution error다.
- routing, plan 갱신, work, review, defect, replan과 repair 출력은 사용자에게 endpoint-native stream으로 모두 보인다.
## 기능
### Epic: [stage-validate] Request-local Staged Validation Profile
### Epic: [heavy-lifecycle] Heavy Plan/Review Lifecycle
단계 호출과 검증을 Edge 하이브리드 라우터가 안전하게 선택할 수 있는 실행 profile로 구체화하는 산출물을 묶는다.
- [ ] [role-split] analysis directive, generation, verification의 입력·출력·생략 조건과 transient 책임 경계가 정리되어 있다.
- [ ] [schema-policy] tool call과 runtime schema 강제의 최소 적용 지점과 실패 evidence가 정리되어 있다.
- [ ] [retry-route] validation failure 시 correction, 이전 단계 회귀, fallback과 terminal failure가 요청 전체 budget 안에서 정리되어 있다.
- [ ] [shape-contract] Edge가 execution shape와 stage별 adapter/target을 확정하고 Node가 이를 재판정 없이 실행하는 계약 후보가 정리되어 있다.
- [ ] [mvp-review] Hot Path 공통 부분, staged profile 고유 부분, 후속 하이브리드 라우터 연결 범위를 사용자가 검토했다.
- [ ] [heavy-handler] preset registry에 `heavy` handler와 stage role contract를 추가하고 `heavy-only` preset에서 model/options를 바인딩·검증한다.
- [ ] [plan-lifecycle] plan 생성·갱신·검증 기준과 최소 artifact evolution을 정의한다.
- [ ] [review-cycle] reviewer verdict에 따른 repair, replan, re-review와 완료 state machine을 정의한다.
- [ ] [resume-state] 여러 tool turn, reconnect/restart의 correlation, idempotency와 cleanup 경계를 정의한다.
- [ ] [heavy-review] 대표 장기 작업에서 `light` 대비 mode 경계, 품질·지연·비용과 오류 처리를 사용자 검토 가능한 evidence로 남긴다.
## 완료 리뷰
- 상태: 없음
- 요청일: 없음
- 완료 근거: 스케치 Milestone이며 기능 Task가 아직 충족되지 않았다.
- 리뷰 필요:
- [ ] 사용자가 완료 결과를 확인했다
- [ ] archive 이동을 승인했다
- 완료 근거: 후속 `heavy` 방향 스케치이며 승격 조건, SDD와 기능 Task가 아직 충족되지 않았다.
- 검토 항목: 없음
- 리뷰 코멘트: 없음
## 범위 제외
- durable Plan/Review 문서, task graph, 승인 상태, 중단 후 재개, background workflow
- 외부 workflow product와의 호출, 상태, 계약, artifact 또는 lifecycle 공유
- local routing model 학습·RAG index·shadow/canary 운영 전환
- 장기 기억/RAG update loop 구현
- 누적 요청 컨텍스트 구성·압축과 target별 token budget 최적화
- 모든 route를 model이 최종 결정하거나 Node가 execution shape를 자율 판정하는 설계
- execution preset과 무관한 별도 heavyweight 제품/API
- target agent나 외부 workflow 제품의 process/state/contract, terminal/PTY 또는 agent별 adapter와의 runtime 연결
- 모든 미래 mode를 미리 수용하는 범용 DAG/plugin engine
- 하이브리드 mode selector의 production evidence 정책과 RAG local router 운영
- `direct/light/heavy` 혼합 preset의 난이도 기반 mode 선택
- repository 장기 기억 RAG와 누적 대화 context 최적화
## 작업 컨텍스트
- 관련 경로: `apps/edge`, `apps/node`, `packages/go/policy`, `proto/iop`, [OpenAI-Compatible API Contract](../../../../agent-contract/outer/openai-compatible-api.md)
- 표준선(선택): 이 마일스톤의 plan/review는 하나의 요청 안에서만 존재하는 analysis directive와 verification stage다. durable artifact나 workflow process와 개념·상태·계약을 공유하지 않는다.
- 표준선(선택): Edge가 요청 사실, hard gate와 route policy에 따라 execution shape 및 stage별 adapter/target을 확정한다. Node는 전달받은 stage를 실행·취소하고 상태·usage를 보고한다.
- 표준선(선택): 외부 client의 명시적 profile 선택을 지원하더라도 최종 허용 여부와 stage binding은 Edge arbiter가 결정한다.
- 선행 작업: [IOP Hot Path One-shot 실행 경로](iop-hot-path-one-shot-execution.md)
- 후속 작업: [OpenAI-compatible 하이브리드 요청 수준·실행 형태 라우팅](openai-compatible-hybrid-request-execution-routing.md), [RAG 기반 Local Routing Model 운영 전환](rag-local-routing-model-operations.md)
- 관련 경로: `apps/edge/internal/openai`, `apps/edge/internal/service`, `packages/go/config`, `packages/go/streamgate`
- 선행 SDD: [IOP 실행 프리셋과 Hot Path SDD](../../../sdd/knowledge-tool-optimization-extension/iop-hot-path-one-shot-execution/SDD.md)
- 표준선(선택): `light`의 request coordinator, endpoint-native tool call, visible stage stream와 표준 오류 계약을 깨지 않고 `heavy` state만 확장한다.
- 표준선(선택): artifact 구조는 필요가 확정된 시점에만 확장하며 route-01에 manifest/revision/empty directory를 선반영하지 않는다.
- 후속 작업: [Execution Preset 하이브리드 Mode 라우팅](openai-compatible-hybrid-request-execution-routing.md), [RAG 기반 Local Routing Model 운영 전환](rag-local-routing-model-operations.md)
- 큐 배치: `[route-01]` 바로 뒤인 `[route-02]` 2번이다.
- 확인 필요: `구현 잠금 > 결정 필요`

View file

@ -1,12 +1,13 @@
# Milestone: [route-03] OpenAI-compatible 하이브리드 요청 수준·실행 형태 라우팅
# Milestone: [route-03] Execution Preset 하이브리드 Mode 라우팅
## 목표
- 폐기된 [`OpenAI-compatible Hybrid Routing · Context Optimization`](../../../archive/phase/routing-policy-model-orchestration/milestones/openai-compatible-hybrid-routing-context-optimization.md)의 핵심 의도 중 **IOP 내부 요청 난이도·실행 형태·모델 조합 라우팅**만 현재 책임 경계에 맞게 복원한다.
- IOP Edge가 요청의 난이도, 기능 요구, 컨텍스트 규모, 지연·비용 예산, 장치·모델 가용성을 종합해 요청-local `execution_shape`와 각 단계의 adapter/target을 최종 결정한다.
- 초기 운영에서는 cloud frontier model이 의미 분류와 난이도 판정의 advisory를 제공하고, deterministic hard gate와 Edge arbiter가 최종 결정을 소유한다.
- [`IOP Hot Path One-shot Execution`](iop-hot-path-one-shot-execution.md)이 구축한 고정 profile과 [`Knowledge/Tool 단계 호출 · 검증 최적화`](knowledge-tool-validation-optimization.md)가 정리한 request-local plan/review 단계를 하나의 일반화된 하이브리드 라우팅 정책으로 연결한다.
- route decision/evidence를 축적해 후속 [`RAG 기반 Local Routing Model 운영 전환`](rag-local-routing-model-operations.md)이 동일한 decision contract를 대체 구현할 수 있게 한다.
- 폐기된 [`OpenAI-compatible Hybrid Routing · Context Optimization`](../../../archive/phase/routing-policy-model-orchestration/milestones/openai-compatible-hybrid-routing-context-optimization.md)의 핵심 의도 중 **IOP 내부 요청 난이도·실행 형태 라우팅과 학습 가능한 decision evidence**만 현재 책임 경계에 맞게 복원한다.
- 외부 호출자가 선택한 model이 execution preset을 먼저 고정하고, IOP Edge가 요청 난이도, 기능 요구, 컨텍스트 규모, 지연·비용 예산과 model 가용성을 종합해 그 preset의 `allowed_modes` 안에서 최종 mode를 결정한다.
- 초기 운영에서는 cloud model이 의미·난이도 advisory를 제공하고 deterministic hard gate와 Edge arbiter가 최종 권한을 갖는다. cloud selector의 timeout/schema/provider 실패는 다른 mode로 조용히 우회하지 않고 표준 model/API 오류로 종료한다.
- [`IOP 실행 프리셋과 Hot Path`](iop-hot-path-one-shot-execution.md)의 `direct/light`와 [`Heavy Plan/Review 실행과 검증 MVP`](knowledge-tool-validation-optimization.md)의 `heavy`를 같은 preset mode contract로 연결한다.
- route-01의 fused selector/planner preset은 그대로 지원한다. 이 마일스톤은 advisory-only selector와 mode별 entry stage를 분리하는 explicit selection strategy를 추가하며 기존 fused preset의 의미를 암묵적으로 바꾸지 않는다.
- route decision/evidence를 축적해 후속 [`RAG 기반 Local Routing Model 운영 전환`](rag-local-routing-model-operations.md)이 selector 구현만 대체하고 preset/runtime은 그대로 재사용할 수 있게 한다.
## 상태
@ -15,23 +16,24 @@
## 복원 원칙
- archive의 폐기 문서는 당시 스냅샷으로 유지하고 직접 수정하지 않는다.
- [`Knowledge/Tool 단계 호출 · 검증 최적화`](knowledge-tool-validation-optimization.md)는 폐기본 전체의 대체가 아니라 request-local plan/review 실행 형태만 이어받은 부분 후속이다. 요청 수준 route selection, cloud-first evidence, local router 전환은 이 마일스톤과 그 후속에서 복원한다.
- 복원 범위에는 과거 설계의 artifact lane, grade, workflow lifecycle, 자동화 런타임 소유권을 포함하지 않는다.
- 이 마일스톤의 `plan/review`는 단일 IOP 요청 안에서 끝나는 transient inference stage다. 저장형 계획 문서, 승인 상태, continuation, workspace mutation을 만들지 않는다.
- 외부 workflow product는 IOP Edge/Node 라우팅 계약, 상태, 실행 흐름에 연결하지 않는다.
- IOP Node는 Edge가 확정한 stage별 adapter/target을 실행·취소하고 상태·usage를 보고할 뿐, 요청 난이도나 실행 형태를 판정하지 않는다.
- 폐기 설계의 artifact lane, grade와 자동화 runtime을 복원하지 않는다. 현재 기준은 exposed model → execution preset → allowed mode decision이다.
- preset은 selection strategy, selector와 mode별 model/stage 조합을 소유한다. 이 milestone의 router는 preset을 바꾸거나 preset 밖 model/target을 만들지 않는다. route-01의 fused strategy와 새 advisory-then-dispatch strategy는 config에서 명시적으로 구분한다.
- Plan/Review artifact와 agent tool round-trip은 선택된 `light/heavy` handler가 소유한다. route evidence에는 raw plan/review, prompt, output과 tool argument/result를 저장하지 않는다.
- target agent나 외부 workflow 제품의 process, state, contract나 runtime은 연결하지 않는다.
- IOP Node는 Edge가 확정한 stage model을 provider에서 실행·취소하고 상태·usage를 보고할 뿐, preset이나 mode를 판정하지 않는다.
## 선행 작업
- [`IOP Hot Path One-shot Execution`](iop-hot-path-one-shot-execution.md)
- [`Knowledge/Tool 단계 호출 · 검증 최적화`](knowledge-tool-validation-optimization.md)
- [`IOP 실행 프리셋과 Hot Path`](iop-hot-path-one-shot-execution.md)
- [`Heavy Plan/Review 실행과 검증 MVP`](knowledge-tool-validation-optimization.md)
## 승격 조건
- `execution_shape`, stage binding, advisory, hard-gate reason, confidence/fallback을 포함한 route decision contract가 확정된다.
- cloud judge와 Edge arbiter 사이의 권한 경계 및 model output 불신 원칙이 확정된다.
- `direct`, Hot Path guided-local, request-local plan/generate/review 형태의 최소 profile taxonomy가 확정된다.
- route 판단 실패, timeout, low-confidence, target unavailable에 대한 deterministic fallback이 확정된다.
- `preset_id`, allowed mode, advisory, hard-gate reason, confidence와 policy version을 포함한 mode decision contract가 확정된다.
- cloud selector와 Edge arbiter 사이의 권한 경계 및 model output 불신 원칙이 확정된다.
- 여러 preset이 `direct/light/heavy/추가 mode`를 서로 다르게 조합할 때 selector input과 mode handler registry 경계가 확정된다.
- 기존 fused preset 호환성, advisory-only selector와 mode별 direct-executor/planner entry stage schema가 확정된다.
- selector/target unavailable, timeout, low-confidence와 schema failure가 표준 오류로 수렴하는 규칙이 확정된다.
- route evidence의 저장 위치, 보존 기간, 민감정보 제거, 학습 후보 승격 기준이 확정된다.
- API/config/event schema가 수반되는 구현 전 필수 SDD가 작성·승인된다.
@ -40,92 +42,94 @@
- 상태: 잠금
- SDD: 불필요
- SDD 문서: 없음
- SDD 사유: 현재는 복원 범위와 후속 마일스톤 관계만 재정의하는 개념 스케치다. 구현 마일스톤 승격 시 API/config/event schema와 라우팅 권한 경계를 다루는 SDD가 필요하다.
- SDD 사유: 현재는 복원된 cloud-first mode router와 후속 local selector의 경계를 정의하는 개념 스케치다. decision/evidence schema와 운영 policy 구현 전에 필수 SDD가 필요하다.
- 잠금 해제 조건: 아래 체크리스트
- [ ] 승격 조건의 미정 항목이 모두 해소되어 있다.
- [ ] Hot Path/staged profile에서 재사용할 계약과 이 마일스톤의 일반화 범위가 분리되어 있다.
- [ ] cloud-first MVP와 RAG local router 후속 범위가 분리되어 있다.
- [ ] 승격 조건의 decision·failure·evidence 항목이 모두 해소되어 있다.
- [ ] route-01/02에서 재사용할 preset/mode 계약과 이 milestone의 일반화 범위가 분리되어 있다.
- [ ] 기존 fused preset을 재해석하지 않는 selection strategy와 mode entry migration/validation이 확정되어 있다.
- [ ] cloud-first 운영과 RAG local selector 후속 범위가 분리되어 있다.
- [ ] 필요한 SDD가 작성·승인되어 있다.
- 결정 필요: 아래 체크리스트
- [ ] 초기 `execution_shape` taxonomy와 profile별 난이도·비용·지연 임계값을 결정한다.
- [ ] cloud judge model, 호출 budget, timeout 및 judge 부재 시 기본 profile을 결정한다.
- [ ] cloud selector model, 입력 feature, confidence 의미와 stage budget을 결정한다.
- [ ] preset별 mode 난이도·비용·지연 policy와 deterministic hard gate를 결정한다.
- [ ] route evidence 최소 표본·품질·보존 기간과 민감정보 제거 기준을 결정한다.
## 범위
### 1. Route decision contract
### 1. Mode decision contract
- 모든 route decision은 provider-specific 응답이 아니라 IOP 공통 envelope로 정규화한다.
- 최소 필드는 `route_id`, `execution_shape`, stage별 `adapter_id/target_id`, hard-gate reason, advisory 요약, confidence, fallback, timing, policy version이다.
- cloud judge는 난이도·능력 적합성·예상 작업 형태를 제안할 수 있지만 최종 target과 실행 권한을 갖지 않는다.
- Edge arbiter는 policy/config, live capability, qualification, health, budget으로 advisory를 검증하고 최종 결정을 확정한다.
- 모든 decision은 provider-specific 응답이 아니라 IOP 공통 envelope로 정규화한다.
- 최소 필드는 `decision_id`, `request_id`, `preset_id`, `allowed_modes`, selected `mode`, hard-gate reason, advisory 요약, confidence, timing과 policy version이다.
- cloud selector는 mode와 난이도 근거를 제안할 수 있지만 preset, stage target, tool parameter와 실행 권한을 갖지 않는다.
- Edge arbiter는 preset snapshot, capability, health, context와 budget으로 advisory를 검증하고 최종 mode를 확정한다.
- advisory-then-dispatch strategy에서 mode가 확정되면 해당 preset의 mode별 entry stage부터 ordered stage/model/options를 handler에 전달한다. `direct`는 direct executor, `light/heavy`는 각 planner entry를 가질 수 있다.
- 기존 fused strategy는 route-01/02 의미대로 selector output이 direct 결과 또는 plan 작성까지 담당하며, 운영자가 명시적으로 migration하지 않는 한 advisory-only로 바뀌지 않는다.
### 2. Request-local execution profile
### 2. Preset별 mode 조합
- `direct`: 단일 model call로 충분한 단순 요청이다.
- `guided-local`: cloud model이 짧은 analysis directive를 만들고 local worker가 생성하며 cloud model이 결과를 검토한다. Hot Path가 이 profile의 첫 vertical slice다.
- `staged`: analysis/generation/verification을 서로 다른 adapter/target에 명시적으로 바인딩하는 일반 request-local 형태다.
- 각 profile은 단계 수, 최대 재시도, review budget, timeout, fallback을 bounded contract로 가진다.
- profile 종료와 함께 transient stage state를 폐기하고 durable workflow state를 남기지 않는다.
- balanced preset은 `direct/light/heavy`, plan-only preset은 `light/heavy`, high-think one-shot preset은 `direct`만 허용할 수 있다.
- `direct`는 fast/weak와 동의어가 아니며 preset stage binding에 따라 strong cloud와 high thinking을 사용할 수 있다.
- `light/heavy`의 차이는 model 강도가 아니라 Plan/Review lifecycle과 작업 형태다.
- 미래 mode는 registered handler가 있을 때 같은 decision contract에 추가하고, 알 수 없는 mode는 config validation에서 거부한다.
### 3. Cloud-first 판단과 안전 장치
### 3. Cloud-first 판단과 오류
- request facts와 deterministic hard gate를 먼저 계산한 뒤 cloud judge에 필요한 최소 semantic context만 전달한다.
- hard gate는 secret policy, unsupported capability, context overflow, deadline, cost ceiling, target health를 포함한다.
- cloud judge timeout·오류·low-confidence·schema failure는 Edge의 보수적 기본 profile로 수렴한다.
- model이 반환한 target, tool, parameter는 capability registry와 정책을 통과하기 전까지 실행하지 않는다.
- request facts와 deterministic hard gate를 먼저 계산한 뒤 cloud selector에는 필요한 최소 semantic context와 preset allowed mode만 전달한다.
- hard gate는 endpoint/tool/workspace capability, context ceiling, deadline, cost ceiling과 target health를 포함한다.
- cloud selector timeout·provider 오류·low-confidence·schema failure, 선택 mode의 capability/target unavailable은 endpoint 표준 오류로 종료한다.
- fallback이나 default mode가 필요하면 preset에 명시된 별도 policy로만 추가할 수 있으며 이 milestone의 암묵 기본값으로 두지 않는다.
### 4. Route evidence
- request 원문 전체가 아니라 feature snapshot, judge advisory, arbiter override, 선택 결과, latency/cost, 검증 결과, fallback reason을 학습 가능한 evidence로 정규화한다.
- [`요청 실행 로그와 Usage Ledger 기반`](../../operational-observability-provider-management/milestones/request-execution-log-usage-ledger-foundation.md)과 [`Provider-Device-Model Qualification 리포트와 Lifecycle 관리`](../../operational-observability-provider-management/milestones/provider-device-model-qualification-report.md)의 운영 지표를 참조하되, 라우팅 정책 소유권은 Edge에 유지한다.
- evidence schema는 후속 local router가 같은 입력·출력 계약을 shadow replay할 수 있어야 한다.
- request 원문 전체가 아니라 redacted feature snapshot, selector advisory, Edge override, selected mode, stage outcome, latency/cost와 error reason을 학습 가능한 evidence로 정규화한다.
- [`요청 실행 로그와 Usage Ledger 기반`](../../operational-observability-provider-management/milestones/request-execution-log-usage-ledger-foundation.md)과 [`Provider-Device-Model Qualification 리포트와 Lifecycle 관리`](../../operational-observability-provider-management/milestones/provider-device-model-qualification-report.md)의 운영 지표를 참조하되 mode policy 소유권은 Edge에 유지한다.
- evidence schema는 후속 local selector가 같은 입력·출력 계약을 shadow replay할 수 있어야 한다.
- 민감정보 제거와 retention을 통과하지 못한 기록은 학습 corpus 후보에 포함하지 않는다.
## 기능
### Epic: [route-decision] Route Decision
### Epic: [mode-decision] Preset Mode Decision
- [ ] [decision-contract] 공통 decision/evidence envelope와 versioning을 정의한다.
- [ ] [hard-gates] capability·security·context·budget·health 기반 deterministic gate를 정의한다.
- [ ] [cloud-judge] cloud model advisory 입력/출력, timeout, confidence 계약을 정의한다.
- [ ] [edge-arbiter] advisory 검증, override reason, 최종 profile/target 확정 정책을 구현한다.
- [ ] [decision-contract] selection strategy, preset/allowed mode/selected mode/advisory/hard-gate를 연결하는 versioned decision envelope를 정의한다.
- [ ] [cloud-selector] cloud model selector의 최소 입력/출력, timeout, confidence와 표준 오류 계약을 구현한다.
- [ ] [edge-arbiter] preset allowlist, capability, health, context와 budget으로 advisory를 검증하고 최종 mode를 확정한다.
- [ ] [mode-dispatch] 확정 mode를 registered handler와 preset의 mode entry/ordered stage binding에 연결하고 기존 fused preset 호환성을 유지한다.
### Epic: [execution-shape] Execution Shape
### Epic: [preset-policy] Preset Policy
- [ ] [shape-registry] request-local execution profile registry와 bounded stage contract를 구현한다.
- [ ] [hot-path-profile] Hot Path의 direct/guided-local 경로를 profile로 편입한다.
- [ ] [staged-profile] analysis/generation/verification 단계를 일반 profile로 편입한다.
- [ ] [stage-binding] 각 stage를 adapter/target/capability에 명시적으로 바인딩한다.
- [ ] [preset-composition] direct-only, plan-only, balanced와 custom mode 조합을 검증한다.
- [ ] [mode-threshold] preset별 난이도·기능·지연·비용 threshold와 hard-gate reason을 정의한다.
- [ ] [failure-policy] selector/mode/target 실패가 암묵 fallback 없이 표준 API 오류로 닫히는 정책을 구현한다.
### Epic: [route-evidence] Route Evidence
- [ ] [route-events] judge/arbiter/실행 결과를 연결하는 route event를 기록한다.
- [ ] [dataset-curation] redaction, retention, 중복 제거, 품질 label 규칙을 정의한다.
- [ ] [eval-gate] cloud 판단과 실제 결과의 일치도·비용·지연 평가 기준을 정의한다.
- [ ] [local-handoff] 후속 RAG local router가 소비할 corpus/export contract를 고정한다.
- [ ] [route-events] selector/arbiter/stage outcome을 하나의 request/decision identity로 연결한다.
- [ ] [dataset-curation] redaction, retention, 중복 제거와 outcome label 규칙을 정의한다.
- [ ] [eval-gate] cloud 판단과 실제 결과의 일치도·regret·비용·지연 평가 기준을 정의한다.
- [ ] [local-handoff] 후속 RAG local selector가 소비할 corpus/export contract를 고정한다.
## 제외 범위
- 외부 workflow lifecycle, plan artifact, review artifact, workspace 상태와의 연동
- IOP Node가 요청 난이도, execution shape, model 정책을 자율 판정하는 기능
- 이 마일스톤에서 local routing model을 production primary로 승격하는 작업
- 장기 기억용 repository RAG와 routing evidence corpus의 통합
- 사용자 승인 없는 irreversible side effect 자동 실행
- 외부 model 선택을 무시하고 router가 다른 preset으로 전환하는 기능
- preset 밖 model/target/tool을 cloud model이 직접 선택하는 기능
- target agent나 외부 workflow 제품과의 상태·artifact·process 공유
- IOP Node가 preset, 요청 난이도 또는 mode policy를 자율 판정하는 기능
- 이 milestone에서 RAG local selector를 production primary로 승격하는 작업
- repository 장기 기억 RAG와 routing evidence corpus의 통합
## 완료 리뷰
- 상태: 없음
- 요청일: 없음
- 완료 근거: 복원 범위와 선후 관계를 정리한 스케치이며 승격 조건과 기능 Task가 아직 충족되지 않았다.
- 완료 근거: 복원 범위와 preset 중심 선후 관계를 정리한 스케치이며 승격 조건과 기능 Task가 아직 충족되지 않았다.
- 검토 항목: 없음
- 리뷰 코멘트: 없음
## 작업 컨텍스트
- Phase: [`Knowledge / Tool 최적화 확장`](../PHASE.md)
- Phase: [`지식과 도구 최적화 확장`](../PHASE.md)
- 복원 근거: [`OpenAI-compatible Hybrid Routing · Context Optimization`](../../../archive/phase/routing-policy-model-orchestration/milestones/openai-compatible-hybrid-routing-context-optimization.md)
- 선행: [`IOP Hot Path One-shot Execution`](iop-hot-path-one-shot-execution.md), [`Knowledge/Tool 단계 호출 · 검증 최적화`](knowledge-tool-validation-optimization.md)
- 선행: [`IOP 실행 프리셋과 Hot Path`](iop-hot-path-one-shot-execution.md), [`Heavy Plan/Review 실행과 검증 MVP`](knowledge-tool-validation-optimization.md)
- 후속: [`RAG 기반 Local Routing Model 운영 전환`](rag-local-routing-model-operations.md)
- 큐 배치: [`Knowledge/Tool 단계 호출 · 검증 최적화`](knowledge-tool-validation-optimization.md) 바로 뒤에 배치한다.
- 큐 배치: `[route-02]` 바로 뒤인 `[route-03]` 3번이다.
- 확인 필요: `구현 잠금 > 결정 필요`

View file

@ -2,9 +2,9 @@
## 목표
- [`OpenAI-compatible 하이브리드 요청 수준·실행 형태 라우팅`](openai-compatible-hybrid-request-execution-routing.md)의 cloud-first 운영에서 충분한 route evidence가 축적되면, 동일한 decision contract를 반환하는 RAG 기반 local routing model을 운영한다.
- [`Execution Preset 하이브리드 Mode 라우팅`](openai-compatible-hybrid-request-execution-routing.md)의 cloud-first 운영에서 충분한 route evidence가 축적되면, 동일한 preset mode decision contract를 반환하는 RAG 기반 local routing model을 운영한다.
- cloud judge의 과거 판단만 복제하지 않고 실제 실행 품질·지연·비용·fallback 결과가 결합된 curated corpus를 retrieval 근거로 사용한다.
- local router를 shadow → canary → primary 순으로 승격하고, 불확실하거나 분포 밖인 요청은 cloud judge 또는 deterministic Edge policy로 fallback한다.
- local router를 shadow → canary → primary 순으로 승격하고, 불확실하거나 분포 밖인 요청은 cloud judge 또는 preset에 명시된 deterministic Edge policy로 fallback한다. 둘 다 허용되지 않으면 표준 오류로 닫는다.
- cloud model은 초기 teacher와 장기 fallback·drift 재평가 역할을 유지하며, 운영 기본 경로는 검증된 local router로 점진 전환한다.
## 상태
@ -15,12 +15,12 @@
- 이 마일스톤의 RAG는 **라우팅 판정 evidence 검색**을 위한 것으로, [`Long-term Memory RAG 2nd Wave`](long-term-memory-rag-second-wave.md)의 repository 장기 기억·작업 컨텍스트 RAG와 corpus, index, retention, 평가 지표를 공유하지 않는다.
- local model은 advisory를 반환하며 최종 결정 권한은 계속 IOP Edge arbiter에 있다.
- 저장형 Plan/Review artifact와 외부 workflow 상태는 입력 feature나 retrieval corpus에 포함하지 않는다.
- IOP Node는 확정된 stage target을 실행할 뿐 local router를 호스팅하거나 라우팅을 판정하지 않는다.
- raw Plan/Review artifact, prompt/output, tool argument/result와 외부 workflow 상태는 입력 feature나 retrieval corpus에 포함하지 않는다. redacted mode·stage outcome은 route evidence로 사용할 수 있다.
- Edge가 local router 호출과 최종 mode 판정을 소유한다. IOP Node는 선택된 local router model을 일반 provider stage로 실행할 수 있지만 corpus, policy 또는 판정 권한을 소유하지 않는다.
## 선행 작업
- [`OpenAI-compatible 하이브리드 요청 수준·실행 형태 라우팅`](openai-compatible-hybrid-request-execution-routing.md)
- [`Execution Preset 하이브리드 Mode 라우팅`](openai-compatible-hybrid-request-execution-routing.md)
- [`요청 실행 로그와 Usage Ledger 기반`](../../operational-observability-provider-management/milestones/request-execution-log-usage-ledger-foundation.md)
- [`Provider-Device-Model Qualification 리포트와 Lifecycle 관리`](../../operational-observability-provider-management/milestones/provider-device-model-qualification-report.md)
@ -53,7 +53,7 @@
### 1. Routing corpus
- route feature, cloud advisory, Edge override, 선택 profile/target, 실제 품질·지연·비용, validation/fallback 결과를 연결한다.
- route feature, cloud advisory, Edge override, preset/allowed mode/selected mode, 실제 품질·지연·비용과 validation/error 결과를 연결한다.
- request 원문과 secret을 기본 저장하지 않고, redaction된 feature와 필요한 최소 retrieval evidence만 보존한다.
- 오래된 policy/model/version에 종속된 evidence는 freshness와 drift 정책에 따라 감쇠하거나 제외한다.
- corpus eligibility와 index deletion은 retention 삭제를 정확히 전파한다.
@ -61,8 +61,8 @@
### 2. RAG local router
- 현재 request feature로 유사 route evidence를 검색하고, local model이 근거·confidence·abstain을 포함한 advisory를 반환한다.
- local advisory는 cloud judge와 같은 decision envelope를 사용해 Edge arbiter와 profile registry를 변경하지 않고 교체 가능해야 한다.
- retrieval miss, low-confidence, out-of-distribution, index unavailable은 cloud judge 또는 deterministic default로 fallback한다.
- local advisory는 cloud selector와 같은 decision envelope를 사용해 Edge arbiter, execution preset과 mode handler를 변경하지 않고 교체 가능해야 한다.
- retrieval miss, low-confidence, out-of-distribution, index unavailable은 cloud judge 또는 preset에 명시된 deterministic policy로만 fallback하고 허용된 경로가 없으면 표준 오류로 닫는다.
- retrieved evidence와 model output은 실행 권한이 아니며 hard gate를 우회할 수 없다.
### 3. 운영 전환
@ -84,7 +84,7 @@
- [ ] [rag-input] request feature와 retrieval evidence 조합 입력을 정의한다.
- [ ] [decision-parity] cloud/local judge가 공유하는 decision envelope 호환성을 구현한다.
- [ ] [uncertainty-fallback] confidence, abstain, OOD, cloud/default fallback을 구현한다.
- [ ] [uncertainty-fallback] confidence, abstain, OOD, cloud/preset-declared fallback과 no-fallback 표준 오류를 구현한다.
### Epic: [route-rollout] Route Rollout
@ -97,7 +97,7 @@
- repository 장기 기억·코드 검색·사용자 지식 검색을 위한 일반 RAG
- cloud model을 즉시 제거하거나 모든 요청을 local router로 강제하는 전환
- Edge hard gate와 arbiter를 local model output으로 대체하는 설계
- Edge hard gate, preset allowlist와 arbiter를 local model output으로 대체하는 설계
- 외부 workflow 상태를 학습 feature로 사용하는 설계
- IOP Node가 corpus/index/model policy를 관리하는 기능
@ -112,7 +112,7 @@
## 작업 컨텍스트
- Phase: [`Knowledge / Tool 최적화 확장`](../PHASE.md)
- 선행: [`OpenAI-compatible 하이브리드 요청 수준·실행 형태 라우팅`](openai-compatible-hybrid-request-execution-routing.md), [`요청 실행 로그와 Usage Ledger 기반`](../../operational-observability-provider-management/milestones/request-execution-log-usage-ledger-foundation.md), [`Provider-Device-Model Qualification 리포트와 Lifecycle 관리`](../../operational-observability-provider-management/milestones/provider-device-model-qualification-report.md)
- 선행: [`Execution Preset 하이브리드 Mode 라우팅`](openai-compatible-hybrid-request-execution-routing.md), [`요청 실행 로그와 Usage Ledger 기반`](../../operational-observability-provider-management/milestones/request-execution-log-usage-ledger-foundation.md), [`Provider-Device-Model Qualification 리포트와 Lifecycle 관리`](../../operational-observability-provider-management/milestones/provider-device-model-qualification-report.md)
- 구분 대상: [`Long-term Memory RAG 2nd Wave`](long-term-memory-rag-second-wave.md)
- 큐 배치: [`Provider-Device-Model Qualification 리포트와 Lifecycle 관리`](../../operational-observability-provider-management/milestones/provider-device-model-qualification-report.md) 바로 뒤에 배치한다.
- 확인 필요: `구현 잠금 > 결정 필요`

View file

@ -6,14 +6,14 @@
### route
1. [[route-01] IOP Hot Path One-shot 실행 경로](phase/knowledge-tool-optimization-extension/milestones/iop-hot-path-one-shot-execution.md)
외부 `model=iop` 요청을 Gemini 3.6 Flash와 RTX 5090 `ornith-fast`의 bounded one-shot 경로로 처리하면서 model advisory, Edge arbiter와 route evidence의 첫 profile을 구축한다.
1. [[route-01] IOP 실행 프리셋과 Hot Path](phase/knowledge-tool-optimization-extension/milestones/iop-hot-path-one-shot-execution.md)
외부 model을 전체 execution preset에 매핑하는 기반과 `request_id` coordinator를 만들고, Claude/Pi agent tool round-trip에서 `direct` 또는 cloud plan → local work → cloud review/repair인 `light`를 실행한다.
2. [[route-02] 단계 호출과 검증 최적화 MVP](phase/knowledge-tool-optimization-extension/milestones/knowledge-tool-validation-optimization.md)
Hot Path의 micro-plan/review를 bounded analysis/generation/verification profile로 일반화하고 Edge가 선택할 stage binding을 스케치한다.
2. [[route-02] Heavy Plan/Review 실행과 검증 MVP](phase/knowledge-tool-optimization-extension/milestones/knowledge-tool-validation-optimization.md)
Hot Path의 lightweight Plan/Review를 장기 작업용 `heavy` mode로 확장해 `heavy-only` preset에서 재계획·검증·review/repair·resume 경계를 먼저 검증한다.
3. [[route-03] OpenAI-compatible 하이브리드 요청 수준·실행 형태 라우팅](phase/knowledge-tool-optimization-extension/milestones/openai-compatible-hybrid-request-execution-routing.md)
cloud model advisory와 deterministic hard gate를 결합해 Edge가 요청 난이도에 맞는 execution shape와 stage target을 최종 결정하고 route evidence를 축적한다.
3. [[route-03] Execution Preset 하이브리드 Mode 라우팅](phase/knowledge-tool-optimization-extension/milestones/openai-compatible-hybrid-request-execution-routing.md)
cloud model advisory와 deterministic hard gate를 결합해 Edge가 외부 model에 매핑된 preset의 허용 mode 중 요청 난이도에 맞는 실행 경로를 고르고 route evidence를 축적한다.
4. [[route-04] RAG 기반 Local Routing Model 운영 전환](phase/knowledge-tool-optimization-extension/milestones/rag-local-routing-model-operations.md)
cloud-first route evidence가 품질·규모 gate를 통과하면 RAG local router를 shadow/canary로 검증해 운영 기본 경로로 점진 전환한다.

View file

@ -0,0 +1,218 @@
# SDD: [route-01] IOP 실행 프리셋과 Hot Path
## 위치
- Milestone: [IOP 실행 프리셋과 Hot Path](../../../phase/knowledge-tool-optimization-extension/milestones/iop-hot-path-one-shot-execution.md)
- Phase: [PHASE.md](../../../phase/knowledge-tool-optimization-extension/PHASE.md)
## 상태
[승인됨]
## SDD 잠금
- 상태: 해제
- 사용자 리뷰: 없음
- 잠금 항목:
- [x] [D01] 외부 model은 mode별 model 묶음이 아니라 전체 execution preset에 매핑한다.
- [x] [D02] preset은 fused selector/planner, 허용 mode와 mode별 downstream ordered stage/model/options를 소유한다.
- [x] [D03] mode key는 확장 가능하게 두되 현재 구현 handler는 `direct``light`로 제한한다.
- [x] [D04] `request_id`를 여러 HTTP/tool/provider 호출을 묶는 사용자 작업 identity로 사용한다.
- [x] [D05] plan-bearing route는 `.iop/job/<request_id>/plan.md``review.md` pair만 만든다.
- [x] [D06] workspace artifact는 caller tool schema에 대한 IOP의 declarative binding과 agent의 기존 workspace-capable tool call로 준비·생성·갱신·삭제하며 agent adapter를 설치하지 않는다.
- [x] [D07] routing부터 repair까지 의미 있는 모든 stage 출력을 사용자 stream에 표시한다.
- [x] [D08] IOP는 하나의 model처럼 endpoint 표준 성공·오류·취소·length 의미를 유지한다.
- [x] [D09] 현재 target protocol은 Claude native Messages streaming과 Pi Chat Completions streaming이다.
- [x] [D10] target agent나 외부 workflow 제품의 runtime·config·contract를 IOP 실행 의존성으로 연결하지 않는다.
## 문제 / 비목표
- 문제: 현재 Stream Evidence Gate는 한 ingress request의 terminal을 제어하지만, Hot Path는 agent tool round-trip으로 나뉜 여러 endpoint call과 cloud/local stage를 하나의 논리 요청으로 묶어야 한다. 동시에 exposed model별 실행 방식과 model 배치를 operator가 preset으로 구성할 수 있어야 하며, Plan/Review artifact는 agent workspace에 최소 구조로 남겼다가 완료 시 제거해야 한다.
- 비목표:
- `heavy` Plan/Review handler, 재계획, 반복 review와 사람 승인
- 범용 DAG/workflow/plugin runtime
- target agent별 hook/adapter 설치나 agent process 수정
- target agent나 외부 workflow 제품의 runtime, terminal/PTY 또는 workspace owner를 IOP에 도입
- `/v1/responses`, A2A와 IOP native protocol 지원
- route evidence 학습, RAG local router와 production rollout
## Source of Truth
| 영역 | 기준 | 메모 |
|------|------|------|
| Roadmap | [Milestone 문서](../../../phase/knowledge-tool-optimization-extension/milestones/iop-hot-path-one-shot-execution.md) | 범위, Task와 완료 상태 원장 |
| Config | `packages/go/config`, `configs/edge.yaml` | model/preset one-of, stage canonical model/resource reference와 load validation |
| Edge Runtime | `apps/edge/internal/openai`, `apps/edge/internal/service` | endpoint codec, logical request coordinator, route/stage dispatch |
| Stream Runtime | `packages/go/streamgate` | normalized event, release queue, terminal hold와 exactly-once commit |
| Current Spec | [Stream Evidence Gate 구현 스펙](../../../../agent-spec/runtime/stream-evidence-gate.md) | 이미 구현된 request-local gate와 이번 cross-call coordinator의 경계 |
| API Contract | [OpenAI-Compatible API](../../../../agent-contract/outer/openai-compatible-api.md), [Anthropic-Compatible Messages API](../../../../agent-contract/outer/anthropic-compatible-api.md) | 외부 success/error/tool/stream terminal 원문 |
| Runtime Contract | [Edge Config And Runtime Refresh](../../../../agent-contract/inner/edge-config-runtime-refresh.md), [Control Plane-Edge Wire](../../../../agent-contract/inner/control-plane-edge-wire.md), [Edge-Node Runtime Wire](../../../../agent-contract/inner/edge-node-runtime-wire.md) | config generation, managed principal projection/lease와 stage별 provider dispatch 원문 |
| User Decision | D01-D10 | 본 설계 대화에서 확정, 추가 사용자 결정 없음 |
## State Machine
| 상태 | 진입 조건 | 다음 상태 | 근거 |
|------|-----------|-----------|------|
| `accepted` | preset-backed model의 새 사용자 작업을 admission하고 `request_id`, request lineage, tool binding과 immutable preset generation을 고정 | `selecting`, `failed`, `cancelled` | ingress/toolset fingerprint, preset id/config generation |
| `selecting` | 최초 cloud selector/planner stage가 direct 결과·작업 tool call 또는 light artifact 준비·Plan/Review control tool call을 반환 | `direct_active`, `workspace_prepare_pending`, `plan_pair_pending`, `failed` | structural mode candidate, Edge gate reason, artifact tool-call ids |
| `direct_active` | Edge가 `direct`를 확정 | `agent_tool_wait`, `completed`, `failed`, `cancelled` | endpoint event/tool call/terminal |
| `workspace_prepare_pending` | `light`를 확정했고 선택된 write binding이 missing parent 생성을 보장하지 않아 고정 request directory 준비 tool call을 반환 | `agent_tool_wait`, `failed`, `cancelled` | prepare tool-call id와 issued relative path |
| `plan_pair_pending` | 최초 stage가 고정 request path의 Plan/Review pair 생성 tool call을 반환 | `agent_tool_wait`, `failed`, `cancelled` | paired tool-call ids와 expected paths |
| `agent_tool_wait` | agent가 실행해야 하는 tool call을 내보내고 endpoint turn을 정상 종료 | 저장된 resume stage, `failed`, `cancelled` | 다음 continuation frontier의 expected tool result set |
| `local_active` | Plan/Review pair의 성공 tool result를 모두 확인 | `agent_tool_wait`, `review_active`, `failed`, `cancelled` | local content/tool/terminal events |
| `review_active` | local completion candidate terminal을 hook하고 cloud reviewer를 dispatch | `agent_tool_wait`, `review_write_wait`, `failed`, `cancelled` | reviewer output, inspection tool과 review write tool call |
| `review_write_wait` | agent가 `review.md` 갱신 tool result를 반환 | `review_resolution_active`, `failed`, `cancelled` | review write tool result |
| `review_resolution_active` | cloud stage가 `review.md`를 읽어 pass면 finalize하고 defect면 수정·검증 | `agent_tool_wait`, `cleanup_pending`, `failed`, `cancelled` | review-resolution content/tool/terminal events |
| `cleanup_pending` | 저장된 success/error terminal intent를 확정하기 전에 request directory 삭제 tool call을 실행 | `completed`, `failed`, `cancelled` | pending terminal intent, cleanup tool result, server state release |
| `completed` | 최종 stage와 필수 cleanup이 성공 | 종료 | logical completion record와 마지막 HTTP turn terminal |
| `failed` | validation, write, timeout, provider/context/internal 실행 실패 | 종료 | endpoint-native 표준 error |
| `cancelled` | caller disconnect/abort 또는 표준 cancel | 종료 | endpoint-native cancellation |
State invariant:
- 한 `request_id`에는 동시에 하나의 active stage만 있고 preset/model/stage binding은 시작 시 고정한 config generation을 끝까지 사용한다.
- `light`가 확정된 뒤 directory 준비 continuation은 같은 selector/planner stage의 plan-authoring subphase로만 돌아간다. mode를 다시 선택하거나 `direct`로 전환하지 않는다.
- `review_active`, `review_write_wait`, `review_resolution_active`는 같은 `review` stage/model binding의 subphase다. review write result 뒤 새 reviewer를 선택하거나 다른 model로 전환하지 않는다.
- endpoint request가 이전 전체 conversation을 다시 포함해도 coordinator는 마지막 assistant tool-call 이후의 continuation frontier만 새 입력으로 소비한다. 이미 완료된 history의 tool result는 correlation evidence일 뿐 다시 실행하지 않는다.
- continuation은 endpoint별 canonical form으로 고정한 initial request prefix, 이미 commit된 assistant/tool transcript와 workspace tool binding fingerprint를 보존해야 한다. 과거 message, issued tool call argument나 선택된 tool schema가 바뀌면 새 작업으로 해석하지 않고 표준 validation error로 닫는다.
- 하나의 expected set에 속한 tool result는 바로 다음 continuation frontier 하나에서 순서와 무관하게 각각 한 번만 수락한다. 누락·unknown·중복 result는 stage를 재실행하지 않고 표준 validation error로 닫는다.
- `agent_tool_wait`는 resume stage를 함께 저장한다. tool-use/tool-call terminal은 agent 실행을 위해 각 HTTP turn에서 exactly-once commit하지만 논리 요청 state는 유지한다.
- local completion처럼 agent tool 실행이 필요 없는 stage terminal만 다음 stage 전환을 위해 보류한다. terminal gate는 content/reasoning/tool delta를 full-buffering하지 않는다.
- 각 HTTP turn에는 endpoint-native terminal이 하나씩 존재하고, logical success/error/cancel은 request state에서 한 번만 확정한다. 확정 뒤 active state를 즉시 제거하고 연결 단절 state에는 bounded TTL을 적용한다.
- 여러 internal stage가 같은 HTTP turn에서 이어져도 endpoint codec은 최초 outer response envelope 하나만 열고 provider response-start/terminal을 내부 transition evidence로 소비한다. 공개 content block index와 tool call id를 turn 범위에서 충돌 없이 재발급하고 마지막 외부 terminal만 commit한다.
## Interface Contract
- 계약 원문: [OpenAI-Compatible API](../../../../agent-contract/outer/openai-compatible-api.md), [Anthropic-Compatible Messages API](../../../../agent-contract/outer/anthropic-compatible-api.md), [Edge Config And Runtime Refresh](../../../../agent-contract/inner/edge-config-runtime-refresh.md), [Control Plane-Edge Wire](../../../../agent-contract/inner/control-plane-edge-wire.md), [Edge-Node Runtime Wire](../../../../agent-contract/inner/edge-node-runtime-wire.md)
- config 입력:
- `models[].id`: 외부에 노출되는 model identity다.
- `models[].execution_preset`: provider mapping과 상호 배타적인 virtual preset reference다. 이 entry 자체에 provider credential slot을 부여하지 않는다.
- `execution_presets[].id`: stable preset identity다.
- `execution_presets[].selector`: `direct` 결과 또는 `light` artifact 작성을 같은 cloud stage에서 수행할 fused selector/planner model reference와 옵션이다. mode 판정 전용 stage는 추가하지 않으며, directory 준비가 필요하면 이 stage 안의 정상 tool continuation으로 처리한다.
- `execution_presets[].allowed_modes[]`: selector가 선택할 수 있는 mode allowlist다.
- `execution_presets[].routes.<mode>.stages[]`: fused selector/planner 뒤 mode handler가 소비하는 순서 있는 downstream role, canonical model/resource reference와 stage option이다. current `direct` handler는 downstream model stage가 없고 current `light` handler는 `local`, `review`를 순서대로 요구한다. raw provider id, principal route id, credential slot이나 target URL을 직접 가리키지 않는다.
- `execution_presets[].workspace_tools`: plan-bearing mode의 canonical prepare-directory/read/write/delete operation을 caller `tools[]`에 양방향 매핑하는 ordered binding alternatives를 선언한다. write alternative는 missing parent 생성 보장 여부를 명시한다. 각 alternative는 actual tool name/schema matcher, argument encoder, result success/error matcher와 path/content/command 위치를 가지며 target agent 설치물이나 agent 이름 selector가 아니다.
- preset catalog와 `models[].execution_preset` refresh는 기존 model catalog처럼 새 logical request에 live-apply할 수 있지만, active request는 시작 시 snapshot generation을 고정한다.
- runtime 입력:
- 외부 `model`, messages, tools와 endpoint-native option을 보존한다.
- 새 작업이면 Edge가 caller 입력으로 덮어쓸 수 없는 path-safe opaque `request_id`를 만들고, continuation이면 이전에 IOP가 발행한 public tool call id와 request history의 마지막 미소비 frontier를 active state에 대조한다. 공개 id는 최소 128-bit 충돌 저항성을 가지며 active id 충돌 시 재발급하고 authorization secret으로 사용하지 않는다.
- admission 때 endpoint별 canonical request lineage와 선택된 workspace role의 tool name/schema fingerprint를 고정한다. continuation은 committed transcript와 이 fingerprint를 보존해야 하며 provider-native tool id는 public issued id와 별도 내부 mapping으로만 연결한다.
- active coordinator는 current milestone에서 Edge-local transient state다. deployment는 continuation을 같은 Edge로 보내는 affinity를 제공해야 하며 다른 Edge/restart로 state가 사라진 continuation은 새 request로 재해석하지 않고 표준 invalid-state/API error로 닫는다.
- `request_id`는 최초 authenticated `principal_ref`를 고정한다. continuation token이 달라도 같은 principal로 검증되어야 하며 cross-principal continuation은 provider/tool dispatch 전에 endpoint auth error로 닫는다.
- managed mode에서 Edge는 각 stage의 canonical model/resource reference를 authenticated principal projection의 existing route `resource_selector`에 대조한다. selector와 모든 allowed mode stage가 각각 정확히 하나의 active projected route에 해석될 때만 virtual preset model을 list/admit하고, zero/ambiguous match는 authorization/config error다.
- virtual preset authorization을 위해 새 projection message나 credential slot을 만들지 않는다. stage dispatch마다 해석된 existing route의 current revision/credential binding과 lease를 재검증하고 revoke/expiry를 다른 slot·route·mode로 우회하지 않는다.
- legacy mode에서도 stage model/resource reference는 기존 model catalog/provider resolution을 거치며 preset config가 raw caller credential이나 provider target을 삽입하지 않는다.
- current `direct/light` mode candidate는 selector 자연어나 숨은 marker를 파싱하지 않고 output shape으로 판정한다. issued request path의 정확한 prepare/pair control tool call이면 `light`, reserved artifact control call이 없는 정상 content/reasoning/일반 작업 tool call이면 `direct` 후보이고, partial pair·충돌 shape·다른 reserved path는 validation error다. Edge가 preset allowlist와 capability gate를 적용해 최종 확정한다.
- plan-bearing internal stage에는 IOP canonical artifact operation schema를 제공한다. Edge는 model의 canonical call을 선택된 caller tool name/arguments와 public tool call id로 변환해 stream에 내보내고, continuation의 endpoint-native result를 original stage call로 역매핑한다. 일반 작업 tool call은 caller schema를 그대로 사용하며 IOP가 실제 tool이나 workspace operation을 실행하지 않는다.
- plan-bearing mode admission은 declared tools 중 workspace file write/read/delete와, write가 missing parent를 만들지 못할 때 directory prepare를 수행할 role binding을 요구한다. Edge는 Claude/Pi 이름이 아니라 실제 tool name과 JSON schema로 request-local ordered alternative를 선택해 해당 binding을 logical request에 고정하고, 맞는 조합이 없거나 deterministic result success/error를 판별할 수 없거나 continuation에서 schema가 바뀌면 provider dispatch 전에 오류로 닫는다.
- structured tool binding은 workspace-relative path와 no-escape 의미를 보장해야 한다. canonical operation이 command tool에 바인딩되면 Edge가 issued relative path와 write content로 command를 결정적으로 합성하고 shell-safe content encoding, canonical cwd containment, symlink escape 거부와 exact success receipt를 적용한다. model이 임의 artifact command/path를 만들거나 opaque command result를 성공으로 확정하게 하지 않는다.
- 내부 identity:
- `request_id`: 하나의 사용자 작업과 preset state machine identity다. server-generated path-safe opaque id이며 노출 가능하지만 권한 증명으로 사용하지 않는다.
- `principal_ref`: request 시작 시 고정하는 owner identity이며 request id 재사용과 cross-principal continuation을 차단한다.
- `call_id`: 개별 inbound HTTP turn identity다.
- `stage_id`: selector-planner/local/review/cleanup identity다. state machine subphase를 별도 model stage identity로 만들지 않는다.
- `lineage_hash`, `toolset_fingerprint`: normalized immutable request prefix/committed transcript와 선택 workspace tool binding의 continuation fence다.
- `attempt_id`, provider session/run id와 tool call id는 `request_id + stage_id` 하위 correlation이다.
- stage 입력:
- selector/planner는 immutable caller request/history, caller tool schema, preset control과 issued artifact path를 받는다.
- `local`은 같은 immutable 사용자 작업과 committed selector/planner 결과, issued `plan.md`·`review.md` 경로를 받고 두 파일을 agent tool로 읽은 뒤 작업·검증하도록 지시받는다. IOP가 파일 내용을 대신 읽어 prompt에 복제하지 않는다.
- `review`는 immutable 사용자 작업, issued artifact path와 committed local completion/output correlation을 받고 필요한 workspace inspection, `review.md` 작성, 같은 stage의 review read와 pass 또는 defect repair를 수행한다.
- stage input builder는 이전 internal control prompt, credential/provider target과 다른 principal/request의 transcript를 포함하지 않는다. active request 중 새 user instruction이 섞인 continuation은 tool-result frontier로 수락하지 않는다.
- artifact 출력:
- 상대 workspace root: `.iop/job/<request_id>/`
- 파일: `plan.md`, `review.md`만 사용한다.
- selected write binding이 missing parent 생성을 보장하지 않으면 최초 `light` tool turn에는 issued request directory를 준비하는 정확히 하나의 tool call만 허용한다. 그 성공 result 뒤 같은 selector/planner stage의 plan-authoring subphase를 재개한다.
- Plan/Review 생성 tool turn은 issued `request_id`의 두 파일을 만드는 expected set만 허용한다. 같은 응답의 다른 작업 tool call, 다른 request id, sibling file과 path traversal은 release하지 않고 표준 validation error로 닫는다.
- Edge는 declarative binding으로 tool argument의 reserved relative suffix와 content field를 검증하고, 실제 workspace root 해석·권한·실행은 caller agent가 소유한다.
- 두 create/write tool result는 바로 다음 continuation frontier에 임의 순서로 함께 있어야 한다. pinned binding의 endpoint error flag, result matcher 또는 Edge-issued exact receipt로 둘 다 성공이 확정될 때만 local stage를 dispatch한다. opaque result, 일부 생성이나 실패는 local로 넘기지 않고 가능한 범위에서 cleanup을 시도한다.
- stream 출력:
- routing, plan, local work/completion candidate, review, defect, repair와 final의 content/reasoning/tool call을 endpoint-native 순서로 release한다. terminal-only hold가 이 delta를 숨기거나 전체 stage를 buffer하지 않는다.
- 한 HTTP turn 안에서 stage/provider가 바뀌어도 Anthropic message/content-block 순서와 Chat chunk/tool-call 순서를 하나의 outer response로 다시 encode한다. 내부 response id, response-start, finish reason과 terminal을 그대로 중첩하지 않는다.
- stage/model/provider 내부 id, control prompt, credential과 raw observation payload는 공개 stream에 합성하지 않는다.
- exposed response model identity는 내부 stage target과 관계없이 caller가 선택한 model id를 유지한다.
- endpoint usage는 해당 HTTP turn에서 실제 소비한 internal stage usage를 중복 없이 합산하고, logical request 전체 합계는 `request_id` observability에서 별도로 집계한다. caller output cap은 한 outer response의 공개 출력 전체에 적용해 stage 전환으로 우회하지 않는다.
- route 의미:
- `direct`: fused selector/planner가 reserved artifact control call 없이 낸 결과와 일반 작업 tool loop를 그대로 실행하고 별도 downstream model stage나 Plan/Review artifact를 만들지 않는다. model의 강도, thinking 또는 agent tool 사용 여부와 독립적이다.
- `light`: fused selector/planner의 Plan/Review pair, `local` worker와 하나의 cloud `review` stage 안에서 review write·review-resolution/repair를 수행한다. Edge는 `review.md`를 직접 읽거나 text parsing으로 verdict를 판정하지 않는다.
- `heavy`: 예약된 초기 vocabulary지만 이번 milestone에는 handler가 없으므로 binding 시 validation error다.
- 추가 mode: 등록된 handler가 생기기 전에는 config validation error다.
- 후속 advisory-only selector는 이 fused selector의 의미를 조용히 바꾸지 않는다. route-03에서 explicit selection strategy와 mode별 entry stage 계약을 추가해 기존 fused preset과 구분하며, 이번 milestone에는 그 미래 필드나 빈 stage를 선반영하지 않는다.
- 오류와 종료:
- principal/preset/stage route authorization 실패, file/tool capability 부재, pair 생성/갱신/cleanup 실패, missing Edge-local state, 잘못된 continuation, stage timeout과 provider 실패는 endpoint 표준 오류다.
- 별도 partial-success, review-unavailable 또는 repair-limit 성공 상태를 만들지 않는다.
- success는 delete tool result를 확인한 뒤 확정한다. 오류 중 agent round-trip이 가능한 경우 primary error를 pending terminal intent로 보존한 채 cleanup은 best-effort로 수행하고, cleanup 결과 뒤 primary error를 표준 오류로 확정한다. cleanup 실패가 primary error를 성공이나 다른 mode로 바꾸지 않는다.
- caller abort/연결 단절 뒤에는 hidden repair/cleanup model call을 계속하지 않는다. server TTL은 IOP state만 회수하며 workspace artifact 삭제를 보장하지 않는다. orphan request id와 reserved relative path는 raw file content 없이 관측하되 자동 삭제를 성공으로 가장하지 않는다.
- caller의 output cap은 endpoint-native length terminal 의미를 유지한다.
- 금지:
- caller/agent 이름을 route selector로 사용하거나 Claude/Pi binary를 patch하지 않는다.
- `direct` 실패를 `light`로, write 불가 `light`를 server-only/cloud-direct로 조용히 바꾸지 않는다.
- model이 임의 path, preset 밖 mode, provider credential 또는 stage target을 실행 권한으로 확정하게 하지 않는다.
- virtual preset을 단일 provider credential route처럼 projection에 합성하거나 principal별 route id를 static preset config에 하드코딩하지 않는다.
- artifact manifest, revision tree, durable workflow state 또는 외부 workflow contract를 만들지 않는다.
## Acceptance Scenarios
| ID | Milestone Task | Given | When | Then |
|----|----------------|-------|------|------|
| S01 | `preset-model` | provider model과 principal별 zero/one/multiple stage route match가 함께 설정됨 | virtual preset model list/admission/response를 조회 | 모든 stage가 unique-authorized인 preset만 노출되고 내부 stage target 대신 외부 model id가 유지된다. |
| S02 | `preset-schema` | 서로 다른 allowed mode/stage binding을 가진 preset과 active request | config를 refresh | 새 request만 새 generation을 사용하고 active tool round-trip은 기존 immutable snapshot을 유지한다. |
| S03 | `route-selector` | selector가 direct content/일반 tool, 정확한 prepare/pair, partial·충돌 artifact shape를 각각 반환 | Edge가 output shape와 preset allowlist로 decision을 확정 | 자연어 route parsing 없이 허용된 direct/light만 통과하고 malformed·금지 mode는 deterministic reason의 표준 오류가 된다. |
| S04 | `hot-preset` | `direct/light` Hot Path와 `heavy/custom` binding | startup validation | direct/light만 실행 가능하고 구현되지 않은 handler는 fail-closed된다. |
| S05 | `request-identity` | 전체 history를 반복하는 same-principal call, 과거 message/tool schema 변조, cross-principal 또는 missing-Edge-state continuation | 새 tool result frontier를 수신 | immutable lineage/tool binding을 보존한 active frontier만 exactly-once 연결하고 나머지는 새 request나 stage로 재실행하지 않는다. |
| S06 | `artifact-pair` | parent 생성 가능 structured binding 또는 receipt 가능한 command/prepare binding이 있는 light 요청 | missing parent 준비와 한 continuation의 역순 pair result가 왕복 | canonical call이 actual tool로 매핑되고 exact 성공이 확인된 reserved path의 두 파일 뒤에만 local stage가 시작된다. |
| S07 | `direct-flow` | direct로 판정된 text/high-think/tool 요청 | stage가 완료 | Plan/Review 경로 없이 작업하며 `.iop/job/<request_id>`를 만들지 않는다. |
| S08 | `light-flow` | immutable user task와 artifact path를 받은 local 결과가 pass 또는 defect인 light 요청 | review write result 뒤 같은 cloud review stage를 재개 | stage별 input이 격리되고 cloud stage가 review를 읽어 finalize 또는 repair하며 Edge file read/text verdict나 두 번째 review는 없다. |
| S09 | `cleanup` | artifact가 생성된 성공·오류·연결 단절 요청 | cleanup/terminal/TTL을 수행 | 성공은 delete result 뒤 닫히고 server TTL과 workspace orphan 보장 범위가 구분되어 관측된다. |
| S10 | `terminal-control` | 한 HTTP turn의 여러 stage가 response-start, content와 completion/tool terminal을 생성 | terminal-only Stream Evidence Gate와 endpoint codec이 release/hold/re-encode | outer envelope, block/tool id와 usage는 한 번만 일관되게 보이고 각 HTTP turn terminal과 logical completion이 각각 exactly-once다. |
| S11 | `anthropic-gate` | Claude native `/v1/messages` streaming과 `tool_use/tool_result` | direct/light를 실행 | Anthropic event ordering과 stop/error shape를 유지하며 stage continuation이 연결된다. |
| S12 | `chat-gate` | Pi `/v1/chat/completions` streaming과 `tool_calls/tool` result | direct/light를 실행 | Chat delta/finish/[DONE] 규약을 유지하며 stage continuation이 연결된다. |
| S13 | `error-cancel` | write 불가, timeout, provider error, context error, cancel과 output cap | 각 경로가 terminal | endpoint 표준 error/cancel/length 의미만 반환하고 partial-success 상태가 없다. |
| S14 | `preset-validation` | dangling/unauthorized stage route, one-of 위반, unsupported mode 또는 workspace tool schema/path/result/containment contract | load/admission을 수행 | credential/provider dispatch나 reserved namespace tool release 전에 validation/auth error로 거부된다. |
| S15 | `route-observability` | direct/light와 실패 요청 | metric/log를 수집 | raw prompt/output/credential 없이 request/preset/mode/stage/attempt와 outcome을 연결한다. |
| S16 | `hot-smoke` | 실제 Claude와 Pi agent가 writable test workspace 사용 | direct, pass, repair, failure/cancel smoke 실행 | 두 protocol에서 visible stage output, artifact lifecycle와 표준 terminal을 재현한다. |
## Evidence Map
| Scenario | Required Evidence | `agent-task` 연결 | 완료 Evidence 기대 |
|----------|-------------------|------------------|---------------------------|
| S01 | config/catalog, managed projection zero/one/ambiguous stage match와 model echo API test | `agent-task/m-iop-hot-path-one-shot-execution/preset-model/` | `preset-model` virtual authorization·identity evidence |
| S02 | preset decode/normalize와 refresh generation-isolation unit test | `agent-task/m-iop-hot-path-one-shot-execution/preset-schema/` | `preset-schema` snapshot/refresh fixture 집계 |
| S03 | structural output-shape, allowlist와 hard-gate table test | `agent-task/m-iop-hot-path-one-shot-execution/route-selector/` | `route-selector` no-marker/no-natural-language-parse 결정 reason 검증 |
| S04 | direct/light 성공과 heavy/custom startup rejection test | `agent-task/m-iop-hot-path-one-shot-execution/hot-preset/` | `hot-preset` handler registry evidence |
| S05 | full-history/frontier, lineage·tool schema mutation, public/provider tool-id mapping, cross-principal/missing-state rejection와 concurrency race test | `agent-task/m-iop-hot-path-one-shot-execution/request-identity/` | `request-identity` owner/affinity/lineage/frontier evidence |
| S06 | canonical↔actual mapping, parent-capable write/별도 prepare, exact receipt/opaque result, reversed pair result, missing/extra tool와 path traversal rejection integration test | `agent-task/m-iop-hot-path-one-shot-execution/artifact-pair/` | `artifact-pair` mapping·directory prepare·result/expected-set/path evidence |
| S07 | direct text/high-think/tool integration test와 artifact absence | `agent-task/m-iop-hot-path-one-shot-execution/direct-flow/` | `direct-flow` no-artifact evidence |
| S08 | stage-input isolation과 pass/defect review-write/resolution state-machine integration test | `agent-task/m-iop-hot-path-one-shot-execution/light-flow/` | `light-flow` immutable-task/no-Edge-file-read/one-review evidence |
| S09 | success delete acknowledgement, error best-effort와 disconnect TTL test | `agent-task/m-iop-hot-path-one-shot-execution/cleanup/` | `cleanup` server/workspace 책임 분리 evidence |
| S10 | cross-stage response-start suppression, block/tool id remap, usage/output-cap 집계, normalized delta ordering, per-turn terminal과 logical completion race test | `agent-task/m-iop-hot-path-one-shot-execution/terminal-control/` | `terminal-control` single-envelope/terminal-only hold evidence |
| S11 | Anthropic fragmented SSE/tool_use/error fixture와 handler integration test | `agent-task/m-iop-hot-path-one-shot-execution/anthropic-gate/` | `anthropic-gate` native Messages wire evidence |
| S12 | Chat fragmented SSE/tool_calls/error fixture와 handler integration test | `agent-task/m-iop-hot-path-one-shot-execution/chat-gate/` | `chat-gate` Pi-compatible wire evidence |
| S13 | endpoint별 error/cancel/length table test | `agent-task/m-iop-hot-path-one-shot-execution/error-cancel/` | `error-cancel` no-custom-status evidence |
| S14 | invalid config/route authorization/tool-schema/result matcher/reserved-path/containment admission table test | `agent-task/m-iop-hot-path-one-shot-execution/preset-validation/` | `preset-validation` fail-closed evidence |
| S15 | raw-free log/metric field allowlist test | `agent-task/m-iop-hot-path-one-shot-execution/route-observability/` | `route-observability` redaction evidence |
| S16 | actual Claude/Pi streaming smoke log와 workspace before/after evidence | `agent-task/m-iop-hot-path-one-shot-execution/hot-smoke/` | `hot-smoke` 양 protocol 최종 검증 |
공통 완료 검증은 최소 `go test -race -count=1 ./packages/go/streamgate ./packages/go/config ./apps/edge/internal/openai ./apps/edge/internal/service``git diff --check`를 포함한다. 실제 provider/agent smoke는 credential과 writable test workspace를 갖춘 환경에서 별도 실행 evidence로 남긴다.
`agent-task/m-iop-hot-path-one-shot-execution/<task-id>/complete.log`는 동일한 Milestone Task id와 최종 검증 결과를 기록하고, 완료 리뷰에서 S01-S16 Evidence Map과 대조한다.
## Cross-repo Dependencies
- 없음
- `.agent-roadmap-sync/locks.yaml`에 이 milestone을 잠그는 항목이 없다.
## Drift Check
- [x] Milestone 기능 Task와 Acceptance Scenario가 일치한다.
- [x] Evidence Map이 code-review/complete.log에서 검증 가능하다.
- [x] agent-contract를 쓰는 경우 SDD에 계약 원문을 복제하지 않았다.
- [x] 사용자 리뷰가 필요한 항목은 남아 있지 않으며 `USER_REVIEW.md`를 만들지 않았다.
## 사용자 리뷰 이력
- 2026-08-02: execution preset, direct/light 현재 범위, heavy/추가 mode 확장, request identity, workspace artifact, visible streaming, 오류·취소와 외부 workflow 비의존 경계를 대화에서 확정했다.
## 작업 컨텍스트
- 표준선: 기존 top-level model catalog/provider pool, endpoint-native tool call/result, Stream Evidence Gate의 normalized event·terminal gate·exactly-once commit을 재사용한다.
- 구현 순서: config/preset catalog → request coordinator → direct → workspace prepare/Plan·Review pair → local/review/repair → protocol gate → cleanup/observability/smoke 순이다.
- 후속 SDD: [Heavy Plan/Review 실행과 검증 MVP](../../../phase/knowledge-tool-optimization-extension/milestones/knowledge-tool-validation-optimization.md), [Execution Preset 하이브리드 Mode 라우팅](../../../phase/knowledge-tool-optimization-extension/milestones/openai-compatible-hybrid-request-execution-routing.md), [RAG 기반 Local Routing Model 운영 전환](../../../phase/knowledge-tool-optimization-extension/milestones/rag-local-routing-model-operations.md)