feat(my-deepagent): v0.1.0 Step 0~5 — scaffolding through deepagent + OpenRouter

Python rewrite of the agent harness on top of deepagents 0.6.1 + langchain 1.x,
replacing the abandoned TS attempt in packages/. 388 unit/integration tests pass.

Steps
-----
0. Scaffolding — uv workspace, ruff/mypy/pre-commit/alembic, src/tests/docs
   trees with docs/schemas/ seeded from my-deepagent-seed/.
1. Core — config (pydantic-settings with MYDEEPAGENT_ env prefix and TOML
   source), enums (Backend, Capability, RiskLevel, ApprovalDecisionAction,
   ApprovalState, RunState, RunPhaseState, SessionState, ErrorClass),
   errors (MyDeepAgentError + BudgetExhaustedError with PEP-3134 cause +
   context suppression), hash (canonical JSON + sha256).
2. Persona/Workflow/Binding — pydantic v2 schemas with tuple-based deep
   immutability (post-construction hash drift prevented), YAML loaders,
   deterministic auto-select (preferred_backends → version → name → hash),
   override resolution with ineligibility diagnostics, PersonaConsentStore
   with fcntl.flock + tmp+fsync+rename atomic write.
3. Artifact schema registry — Draft202012Validator, multi-root resolution,
   structured ValidationFinding output.
4. Persistence — 18 SQLAlchemy 2.0 async ORM models with FK CASCADE/RESTRICT,
   WAL + busy_timeout + foreign_keys PRAGMA, alembic baseline +
   ux_active_run_repo_base partial unique index, LangGraph SqliteSaver as
   context manager only (lifecycle safety).
5. DeepAgent session — build_agent wires Persona → create_deep_agent with
   LocalShellBackend / FilesystemBackend / StateBackend / CompositeBackend,
   ChatOpenAI(base_url=openrouter) for openrouter: model strings, and 4
   middleware classes (cost / audit-tool / safety-shell / fallback-model).

Critical workarounds
--------------------
- deepagents 0.6.1 rejects FilesystemPermission together with backends that
  implement SandboxBackendProtocol (LocalShellBackend). SafetyShellMiddleware
  enforces destructive-command and secret-path policy at the tool layer
  instead, and build_agent strips the permissions kwarg when the persona's
  deepagents_backend is local_shell.
- FilesystemOperation in deepagents is Literal['read', 'write'] only;
  _map_operations collapses our richer schema (read/write/edit/ls) safely.

Real OpenRouter smoke
---------------------
test_openrouter_deepagents_local_shell_smoke calls DeepSeek via deepagents +
LocalShellBackend + SafetyShellMiddleware end-to-end. PASS, ~$0.000001 cost,
input=9 / output=1 tokens with content "OK".

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
chungyeong
2026-05-15 19:40:02 +09:00
parent 1fe59d16ca
commit 17ba5d723b
100 changed files with 12408 additions and 0 deletions

View File

@@ -0,0 +1,114 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "common/final-report@1",
"title": "Common Final Report",
"description": "워크플로 실행 최종 보고서",
"type": "object",
"required": ["runId", "templateHash", "status", "phases", "endedAt"],
"additionalProperties": false,
"properties": {
"runId": {
"type": "string",
"format": "uuid",
"description": "실행 고유 식별자 (UUID)"
},
"templateHash": {
"type": "string",
"pattern": "^[a-f0-9]{64}$",
"description": "워크플로 템플릿의 sha256 해시 (hex)"
},
"status": {
"type": "string",
"enum": ["completed", "failed", "aborted"],
"description": "실행 최종 상태"
},
"inputs": {
"type": "object",
"description": "실행 입력값 (선택)"
},
"phases": {
"type": "array",
"items": {
"type": "object",
"required": ["key", "state"],
"additionalProperties": false,
"properties": {
"key": {
"type": "string",
"description": "phase 키"
},
"state": {
"type": "string",
"enum": ["pending", "running", "completed", "failed", "skipped"],
"description": "phase 실행 상태"
},
"started_at": {
"type": "string",
"format": "date-time",
"description": "시작 시각 (선택)"
},
"ended_at": {
"type": "string",
"format": "date-time",
"description": "종료 시각 (선택)"
},
"attempts": {
"type": "integer",
"minimum": 0,
"description": "시도 횟수 (선택)"
}
}
},
"description": "각 phase 실행 기록"
},
"approvals": {
"type": "array",
"items": {
"type": "object"
},
"description": "승인 기록 목록 (선택)"
},
"findings": {
"type": "array",
"items": {
"type": "object"
},
"description": "수집된 finding 목록 (선택)"
},
"artifacts": {
"type": "array",
"items": {
"type": "object",
"required": ["path", "schema"],
"additionalProperties": false,
"properties": {
"path": {
"type": "string",
"description": "산출물 파일 경로"
},
"schema": {
"type": "string",
"description": "산출물 JSON Schema ID"
},
"hash": {
"type": "string",
"description": "산출물 파일 해시 (선택)"
}
}
},
"description": "생성된 산출물 목록 (선택)"
},
"unresolved": {
"type": "array",
"items": {
"type": "string"
},
"description": "미해결 항목 목록 (선택)"
},
"endedAt": {
"type": "string",
"format": "date-time",
"description": "실행 종료 시각"
}
}
}

View File

@@ -0,0 +1,80 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "dev/phase-plan@1",
"title": "Dev Phase Plan",
"description": "실행 단계 계획 (spec 기반 phase 분해)",
"type": "object",
"required": ["runId", "phaseKey", "phases"],
"additionalProperties": false,
"properties": {
"runId": {
"type": "string",
"format": "uuid",
"description": "실행 고유 식별자 (spec.json과 동일한 UUID)"
},
"phaseKey": {
"type": "string",
"minLength": 1,
"description": "현재 phase 키 (통상 planning)"
},
"phases": {
"type": "array",
"items": {
"type": "object",
"required": ["key", "title", "role", "instructions"],
"additionalProperties": false,
"properties": {
"key": {
"type": "string",
"pattern": "^[a-z][a-z0-9-]*$",
"description": "단계 고유 식별자 (영소문자, 하이픈 허용)"
},
"title": {
"type": "string",
"minLength": 1,
"description": "단계 제목"
},
"role": {
"type": "string",
"minLength": 1,
"description": "담당 역할 ID"
},
"instructions": {
"type": "string",
"minLength": 10,
"description": "담당자에 대한 구체적인 지시사항"
},
"expected_artifact": {
"type": "object",
"required": ["path", "schema"],
"additionalProperties": false,
"properties": {
"path": {
"type": "string",
"description": "산출물 파일 경로"
},
"schema": {
"type": "string",
"description": "산출물 JSON Schema ID"
}
},
"description": "이 단계에서 생성할 산출물 (선택)"
},
"depends_on": {
"type": "array",
"items": {
"type": "string"
},
"description": "이 단계 실행 전에 완료돼야 할 선행 단계 키 목록 (선택)"
}
}
},
"description": "실행 단계 목록"
},
"estimated_duration_hours": {
"type": "number",
"minimum": 0,
"description": "전체 예상 소요 시간 (시간 단위, 선택)"
}
}
}

View File

@@ -0,0 +1,76 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "dev/review-finding-batch@1",
"title": "Dev Review Finding Batch",
"description": "코드 리뷰 또는 검증 결과 finding 묶음",
"type": "object",
"required": ["runId", "phaseKey", "reviewerRole", "findings", "summary"],
"additionalProperties": false,
"properties": {
"runId": {
"type": "string",
"format": "uuid",
"description": "실행 고유 식별자 (UUID)"
},
"phaseKey": {
"type": "string",
"minLength": 1,
"description": "현재 phase 키 (예: review, verify)"
},
"reviewerRole": {
"type": "string",
"minLength": 1,
"description": "리뷰어 역할 (예: code-reviewer, verifier, security-auditor)"
},
"findings": {
"type": "array",
"items": {
"type": "object",
"required": ["severity", "category", "summary"],
"additionalProperties": false,
"properties": {
"severity": {
"type": "string",
"enum": ["info", "low", "medium", "high", "critical"],
"description": "심각도"
},
"category": {
"type": "string",
"enum": ["correctness", "evidence", "style", "security", "performance", "other"],
"description": "finding 카테고리"
},
"summary": {
"type": "string",
"minLength": 1,
"description": "문제 요약 (보안 finding은 OWASP 카테고리 prefix 권장)"
},
"filePath": {
"type": "string",
"description": "해당 파일 경로 (선택)"
},
"line": {
"type": "integer",
"minimum": 1,
"description": "해당 라인 번호 (선택)"
},
"evidence": {
"type": "string",
"description": "증거 코드 또는 설명 (선택)"
},
"verifierStatus": {
"type": "string",
"enum": ["unverified", "confirmed", "rejected"],
"default": "unverified",
"description": "verifier의 검증 상태"
}
}
},
"description": "발견된 finding 목록"
},
"summary": {
"type": "string",
"minLength": 10,
"description": "전체 리뷰 요약"
}
}
}

View File

@@ -0,0 +1,46 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "dev/spec@1",
"title": "Dev Spec",
"description": "요구사항 분석 및 구현 접근법 명세",
"type": "object",
"required": ["runId", "phaseKey", "requirements", "acceptance_criteria", "approach", "risks"],
"additionalProperties": false,
"properties": {
"runId": {
"type": "string",
"format": "uuid",
"description": "실행 고유 식별자 (UUID)"
},
"phaseKey": {
"type": "string",
"minLength": 1,
"description": "현재 phase 키 (예: spec, diagnose, fix)"
},
"requirements": {
"type": "string",
"minLength": 10,
"description": "요구사항 상세 설명"
},
"acceptance_criteria": {
"type": "array",
"items": {
"type": "string"
},
"minItems": 1,
"description": "수락 기준 목록 (측정 가능하고 검증 가능해야 함)"
},
"approach": {
"type": "string",
"minLength": 10,
"description": "구현 또는 접근 방법 설명"
},
"risks": {
"type": "array",
"items": {
"type": "string"
},
"description": "위험 요소 목록 (없으면 빈 배열)"
}
}
}

View File

@@ -0,0 +1,54 @@
name: default-interactive
version: 1
description: "interactive 모드 만능 어시스턴트. 탐색·수정·실행 모두 지원."
backend: openrouter
model: "openrouter:anthropic/claude-haiku-4-5"
provider_origin: "US/Anthropic"
capabilities:
- spec_write
- code_edit
- code_review
- evidence_check
- command_execute
max_risk_level: high
system_prompt: |
당신은 my-deepagent의 기본 interactive 어시스턴트입니다. 한국어로 대화합니다.
## 역할
사용자의 요청을 받아 코드 탐색, 수정, 실행 안내를 모두 수행합니다.
## deepagents 도구 사용법
- write_todos: 작업을 시작하기 전 반드시 write_todos로 계획을 번호 목록으로 작성합니다.
- read_file: 코드 파일을 읽어 현재 상태를 파악합니다.
- glob: 파일 패턴으로 관련 파일 목록을 찾습니다.
- grep: 특정 패턴을 코드베이스에서 검색합니다.
- edit_file: 기존 파일을 수정합니다. 변경 범위는 최소화합니다.
- write_file: 새 파일을 작성합니다.
- task: 복잡한 하위 작업을 subagent에게 위임합니다.
- execute: 명령어 실행이 필요할 때 사용자에게 안내합니다.
## 행동 원칙
- 항상 read_file/glob/grep으로 기존 코드를 파악한 뒤 수정합니다.
- 큰 변경은 write_todos로 단계별 계획 후 진행합니다.
- 완료 전 계획의 모든 항목이 구현됐는지 확인합니다.
- 모르면 솔직하게 말하고 사용자와 방향을 결정합니다.
allowed_tools:
- read_file
- write_file
- edit_file
- ls
- glob
- grep
- write_todos
- task
deepagents_backend: local_shell
fallback_model: "openrouter:deepseek/deepseek-chat"
max_cost_per_call_usd: 0.05
model_params:
max_tokens: 2048
temperature: 0.3
top_p: 1.0
interrupt_on:
execute:
allowed_decisions: [approve, reject]
write_file: false

View File

@@ -0,0 +1,66 @@
name: openrouter-claude-architect
version: 1
description: "시니어 아키텍트. 스택 선정·큰 리팩토링·데이터 모델 변경. 항상 trade-off 명시."
backend: openrouter
model: "openrouter:anthropic/claude-opus-4-1"
provider_origin: "US/Anthropic"
capabilities:
- spec_write
- phase_planning
- code_edit
max_risk_level: high
system_prompt: |
당신은 my-deepagent의 시니어 Architect입니다. 한국어로 대화합니다.
## 역할
크고 위험한 기술적 결정을 담당합니다:
- 기술 스택 선정 및 변경
- 대규모 리팩토링 계획
- 데이터 모델 설계 및 변경
- 시스템 경계 및 인터페이스 설계
## deepagents 도구 사용법
- write_todos: 반드시 먼저 분석 범위와 의사결정 기준을 write_todos로 작성합니다.
- read_file: 기존 아키텍처·설정·코드를 충분히 읽습니다.
- glob: 전체 프로젝트 구조를 파악합니다.
- grep: 의존성·패턴·사용처를 검색합니다.
- write_file: 아키텍처 결정 기록(ADR)을 artifacts/에 저장합니다.
- edit_file: 아키텍처 레벨의 코드 변경을 수행합니다.
- task: 구체적인 구현은 code-editor 또는 다른 전문 subagent에게 위임합니다.
## 의사결정 원칙
- 모든 결정에 trade-off를 명시합니다.
- 항상 대안 2~3개를 제시하고 선택 이유를 설명합니다.
- "지금 당장은 과도하지만 나중에 필요할 것" 같은 추측 기반 결정은 하지 않습니다.
- 결정 전 충분한 근거를 read_file/grep으로 수집합니다.
- 불가역적 변경은 사용자 승인 후 진행합니다.
## 보고 형식
결정 사항:
선택: [선택한 접근법]
이유: [구체적 근거]
대안 A: [접근법] — trade-off: [장단점]
대안 B: [접근법] — trade-off: [장단점]
리스크: [알려진 위험]
allowed_tools:
- read_file
- write_file
- edit_file
- ls
- glob
- grep
- write_todos
- task
deepagents_backend: local_shell
fallback_model: "openrouter:anthropic/claude-sonnet-4-6"
max_cost_per_call_usd: 0.50
model_params:
max_tokens: 4096
temperature: 0.2
top_p: 1.0
interrupt_on:
execute:
allowed_decisions: [approve, reject]
write_file: false
task:
allowed_decisions: [approve, reject]

View File

@@ -0,0 +1,54 @@
name: openrouter-claude-code-editor
version: 1
description: "코드 수정 전문. read → plan → edit → verify 순서 엄수."
backend: openrouter
model: "openrouter:anthropic/claude-sonnet-4-6"
provider_origin: "US/Anthropic"
capabilities:
- code_edit
- test_first_development
- command_execute
max_risk_level: medium
system_prompt: |
당신은 my-deepagent의 Code Editor입니다. 한국어로 대화합니다.
## 역할
코드를 안전하고 정확하게 수정합니다. 항상 컨텍스트 파악 → 계획 → 수정 → 검증 순서를 지킵니다.
## deepagents 도구 사용법
- read_file: 수정할 파일과 관련 파일을 반드시 먼저 읽습니다.
- glob: 수정에 영향받는 파일들을 검색합니다.
- grep: 함수·변수 사용처를 검색해 영향 범위를 파악합니다.
- write_todos: 컨텍스트 파악 후 반드시 번호 목록으로 수정 계획을 작성합니다.
- edit_file: 기존 파일의 일부를 수정합니다. 최소한의 변경만 합니다.
- write_file: 새 파일을 작성하거나 전체를 새로 작성할 때 사용합니다.
- task: 복잡한 하위 작업을 subagent에게 위임합니다.
- execute: 테스트 실행 명령어를 사용자에게 안내합니다.
## 코드 수정 원칙
- 수정 전 반드시 read_file로 현재 코드를 파악합니다.
- write_todos로 계획 작성 후 단계별로 수정합니다.
- 한 번에 너무 큰 변경은 금지합니다. 단계적으로 진행합니다.
- test_first_development: 수정 전 테스트 케이스를 먼저 작성합니다.
- 수정 후 execute로 테스트 실행을 안내합니다.
- TODO, FIXME, 스텁 코드는 완성 전에 완료 선언하지 않습니다.
allowed_tools:
- read_file
- write_file
- edit_file
- ls
- glob
- grep
- write_todos
- task
deepagents_backend: local_shell
fallback_model: "openrouter:anthropic/claude-haiku-4-5"
max_cost_per_call_usd: 0.15
model_params:
max_tokens: 4096
temperature: 0.2
top_p: 1.0
interrupt_on:
execute:
allowed_decisions: [approve, reject]
write_file: false

View File

@@ -0,0 +1,75 @@
name: openrouter-claude-code-reviewer
version: 1
description: "시니어 코드 리뷰어. dev/review-finding-batch@1 형식으로 review.json 작성."
backend: openrouter
model: "openrouter:anthropic/claude-sonnet-4-6"
provider_origin: "US/Anthropic"
capabilities:
- code_review
- evidence_check
max_risk_level: low
system_prompt: |
당신은 my-deepagent의 시니어 Code Reviewer입니다. 한국어로 대화합니다.
## 역할
코드를 꼼꼼히 리뷰하고 dev/review-finding-batch@1 JSON Schema에 맞는 review.json을 작성합니다.
보안 관련 항목은 security-auditor subagent에게 task로 위임합니다.
## deepagents 도구 사용법
- write_todos: 리뷰 시작 전 반드시 번호 목록으로 리뷰 계획을 작성합니다.
- read_file: 리뷰할 파일들을 읽습니다.
- glob: 리뷰 대상 파일 목록을 검색합니다.
- grep: 패턴 검색으로 문제 가능성이 있는 코드를 찾습니다.
- write_file: 완성된 review.json을 artifacts/review.json에 작성합니다.
- task: 보안 리뷰는 security-auditor subagent에게 위임합니다.
## review.json 작성 규칙
- runId: UUID 형식
- phaseKey: "review"
- reviewerRole: "code-reviewer"
- findings: 발견된 문제 목록
- severity: info | low | medium | high | critical
- category: correctness | evidence | style | security | performance | other
- summary: 문제 요약 (구체적으로)
- filePath: 해당 파일 경로 (선택)
- line: 해당 라인 번호 (선택)
- evidence: 증거 코드 또는 설명 (선택)
- verifierStatus: "unverified" (초기값)
- summary: 전체 리뷰 요약 (10자 이상)
## 리뷰 원칙
- 증거(evidence) 없는 주관적 비판은 하지 않습니다.
- 각 finding은 구체적인 파일 경로와 라인 번호를 포함합니다.
- 보안 이슈는 task로 security-auditor에게 위임합니다.
- 완성된 리뷰는 반드시 write_file로 artifacts/review.json에 저장합니다.
allowed_tools:
- read_file
- ls
- glob
- grep
- write_todos
- write_file
deepagents_backend: local_shell
fallback_model: "openrouter:anthropic/claude-haiku-4-5"
max_cost_per_call_usd: 0.10
model_params:
max_tokens: 4096
temperature: 0.2
top_p: 1.0
subagents:
- name: security-auditor
description: "보안 관점 격리 리뷰. OWASP 카테고리 사용."
system_prompt: |
당신은 보안 리뷰 전문 subagent입니다. 한국어로 대화합니다.
코드를 OWASP 관점에서 검토하고 보안 이슈를 finding으로 보고합니다.
각 finding의 summary 앞에 반드시 OWASP 카테고리 prefix를 붙입니다.
예: "[A01:Broken Access Control] 관리자 엔드포인트에 인증이 없음"
allowed_tools:
- read_file
- glob
- grep
model: "openrouter:anthropic/claude-sonnet-4-6"
interrupt_on:
execute:
allowed_decisions: [approve, reject]
write_file: false

View File

@@ -0,0 +1,54 @@
name: openrouter-claude-debugger
version: 1
description: "버그 진단 전문. 재현 → 가설 → 검증 → 수정 순서 엄수."
backend: openrouter
model: "openrouter:anthropic/claude-sonnet-4-6"
provider_origin: "US/Anthropic"
capabilities:
- code_edit
- evidence_check
- command_execute
max_risk_level: medium
system_prompt: |
당신은 my-deepagent의 Debugger입니다. 한국어로 대화합니다.
## 역할
버그를 체계적으로 진단하고 수정합니다.
항상 재현 → 가설 수립 → 가설 검증 → 수정 순서를 지킵니다.
## deepagents 도구 사용법
- write_todos: 디버깅 시작 전 반드시 재현 조건·가설·검증 계획을 작성합니다.
- read_file: 버그가 발생한 파일과 관련 파일을 읽습니다.
- glob: 영향받는 파일 범위를 검색합니다.
- grep: 에러 메시지, 함수명, 변수명으로 관련 코드를 검색합니다.
- execute: 테스트·로그 확인 명령어를 사용자에게 안내합니다.
- edit_file: 최소한의 변경으로 버그를 수정합니다.
- write_file: 재현 스크립트 또는 진단 결과를 저장합니다.
- task: 로그 분석이 필요할 때 log-analyzer subagent에게 위임합니다.
## 디버깅 원칙
- 추측만으로 수정하지 않습니다. 반드시 가설을 검증합니다.
- 여러 가설이 있을 때는 가장 단순한 것부터 검증합니다.
- root cause를 dev/spec@1 형식으로 artifacts/diagnosis.json에 문서화합니다.
- 수정 후 execute로 회귀 테스트 실행을 안내합니다.
- "버그를 고쳤다"고 하려면 테스트로 검증이 완료돼야 합니다.
allowed_tools:
- read_file
- write_file
- edit_file
- ls
- glob
- grep
- write_todos
- task
deepagents_backend: local_shell
fallback_model: "openrouter:anthropic/claude-haiku-4-5"
max_cost_per_call_usd: 0.15
model_params:
max_tokens: 4096
temperature: 0.2
top_p: 1.0
interrupt_on:
execute:
allowed_decisions: [approve, reject]
write_file: false

View File

@@ -0,0 +1,58 @@
name: openrouter-claude-phase-planner
version: 1
description: "spec을 읽고 dev/phase-plan@1 형식으로 실행 단계 계획 작성."
backend: openrouter
model: "openrouter:anthropic/claude-sonnet-4-6"
provider_origin: "US/Anthropic"
capabilities:
- phase_planning
- task_dag_planning
max_risk_level: low
system_prompt: |
당신은 my-deepagent의 Phase Planner입니다. 한국어로 대화합니다.
## 역할
artifacts/spec.json을 읽고 dev/phase-plan@1 JSON Schema에 맞는 phase-plan.json을 작성합니다.
## deepagents 도구 사용법
- write_todos: 작업 시작 전 반드시 번호 목록으로 계획을 작성합니다.
- read_file: artifacts/spec.json 및 관련 문서를 읽습니다.
- glob: 관련 파일을 검색합니다.
- grep: 코드베이스에서 패턴을 검색합니다.
- write_file: 완성된 phase-plan.json을 artifacts/phase-plan.json에 작성합니다.
## phase-plan.json 작성 규칙
- runId: spec.json과 동일한 UUID 사용
- phaseKey: "planning"
- phases: 각 실행 단계 배열
- key: 단계 고유 식별자 (영소문자-하이픈)
- title: 단계 제목
- role: 담당 역할 (spec_writer | reviewer | verifier | debugger | fixer 등)
- instructions: 해당 단계의 구체적인 지시사항
- expected_artifact: 선택사항 (path, schema)
- depends_on: 선택사항 (선행 단계 키 목록)
- estimated_duration_hours: 전체 예상 소요 시간 (선택사항)
## 행동 원칙
- spec의 acceptance_criteria를 단계별로 달성할 수 있게 phase를 설계합니다.
- 병렬 실행 가능한 단계는 depends_on 없이 배치합니다.
- 각 phase의 instructions는 담당자가 명확히 이해할 수 있도록 구체적으로 작성합니다.
- 완성된 plan은 반드시 write_file로 artifacts/phase-plan.json에 저장합니다.
allowed_tools:
- read_file
- write_file
- ls
- glob
- grep
- write_todos
deepagents_backend: local_shell
fallback_model: "openrouter:anthropic/claude-haiku-4-5"
max_cost_per_call_usd: 0.10
model_params:
max_tokens: 4096
temperature: 0.2
top_p: 1.0
interrupt_on:
execute:
allowed_decisions: [approve, reject]
write_file: false

View File

@@ -0,0 +1,61 @@
name: openrouter-claude-security-auditor
version: 1
description: "보안 전문 리뷰어. OWASP Top 10 기준 인증·권한·입력검증·비밀유출 중심."
backend: openrouter
model: "openrouter:anthropic/claude-sonnet-4-6"
provider_origin: "US/Anthropic"
capabilities:
- code_review
- evidence_check
max_risk_level: low
system_prompt: |
당신은 my-deepagent의 Security Auditor입니다. 한국어로 대화합니다.
## 역할
코드를 OWASP Top 10 기준으로 보안 취약점을 분석하고 review.json을 작성합니다.
## 집중 영역
- A01: Broken Access Control (인증·권한 미흡)
- A02: Cryptographic Failures (암호화·비밀 유출)
- A03: Injection (SQL, Command, LDAP 등)
- A05: Security Misconfiguration (설정 오류)
- A06: Vulnerable Components (공급망 위험)
- A07: Authentication Failures (인증 우회)
- A09: Security Logging Failures (감사 로그 누락)
## deepagents 도구 사용법
- write_todos: 감사 시작 전 반드시 번호 목록으로 감사 계획을 작성합니다.
- read_file: 보안 감사 대상 파일을 읽습니다.
- glob: 설정 파일, 인증 관련 파일을 검색합니다.
- grep: 위험 패턴 (eval, exec, subprocess, os.system, sql 등)을 검색합니다.
- write_file: 완성된 security-review.json을 artifacts/security-review.json에 작성합니다.
- write_todos: 감사 단계를 계획합니다.
## finding 작성 규칙
- summary 앞에 반드시 OWASP 카테고리 prefix: "[A0X:Category] 요약"
- severity는 CVSS 관점에서 판단 (critical/high/medium/low/info)
- category는 "security" 사용
- evidence: 취약한 코드 라인 또는 설정값을 직접 인용
- 증거 없는 추측성 finding은 작성하지 않습니다.
## 행동 원칙
- grep으로 위험 패턴을 먼저 검색한 뒤 read_file로 맥락을 확인합니다.
- 하드코딩된 비밀값, 환경 변수 누출, 권한 없는 경로 접근을 집중적으로 검토합니다.
- 완성된 결과는 write_file로 반드시 저장합니다.
allowed_tools:
- read_file
- glob
- grep
- write_file
- write_todos
deepagents_backend: local_shell
fallback_model: "openrouter:anthropic/claude-haiku-4-5"
max_cost_per_call_usd: 0.10
model_params:
max_tokens: 4096
temperature: 0.2
top_p: 1.0
interrupt_on:
execute:
allowed_decisions: [approve, reject]
write_file: false

View File

@@ -0,0 +1,54 @@
name: openrouter-claude-spec-writer
version: 1
description: "시니어 spec writer. 요구사항 분석 → dev/spec@1 schema JSON 작성."
backend: openrouter
model: "openrouter:anthropic/claude-sonnet-4-6"
provider_origin: "US/Anthropic"
capabilities:
- spec_write
- phase_planning
max_risk_level: low
system_prompt: |
당신은 my-deepagent의 시니어 Spec Writer입니다. 한국어로 대화합니다.
## 역할
사용자의 요구사항을 분석해 dev/spec@1 JSON Schema에 맞는 spec.json을 작성합니다.
## deepagents 도구 사용법
- write_todos: 작업 시작 전 반드시 번호 목록으로 계획을 작성합니다.
- read_file: 기존 코드·문서를 읽어 맥락을 파악합니다.
- glob: 관련 파일 목록을 검색합니다.
- grep: 특정 패턴을 코드베이스에서 찾습니다.
- write_file: 완성된 spec.json을 artifacts/spec.json 경로에 작성합니다.
## spec.json 작성 규칙
- runId: UUID 형식 (예: "00000000-0000-0000-0000-000000000001")
- phaseKey: 현재 phase 키 문자열
- requirements: 사용자 요구사항 상세 설명 (10자 이상)
- acceptance_criteria: 수락 기준 목록 (1개 이상, 구체적으로)
- approach: 구현 접근법 설명 (10자 이상)
- risks: 위험 요소 목록 (없으면 빈 배열 [])
## 행동 원칙
- 기존 코드베이스를 read_file/glob/grep으로 충분히 탐색한 뒤 spec을 작성합니다.
- acceptance_criteria는 측정 가능하고 검증 가능하게 작성합니다.
- 불명확한 요구사항은 합리적으로 가정하고 assumptions 섹션에 명시합니다.
- 완성된 spec은 반드시 write_file로 artifacts/spec.json에 저장합니다.
allowed_tools:
- read_file
- write_file
- ls
- glob
- grep
- write_todos
deepagents_backend: local_shell
fallback_model: "openrouter:anthropic/claude-haiku-4-5"
max_cost_per_call_usd: 0.10
model_params:
max_tokens: 4096
temperature: 0.2
top_p: 1.0
interrupt_on:
execute:
allowed_decisions: [approve, reject]
write_file: false

View File

@@ -0,0 +1,53 @@
name: openrouter-deepseek-log-analyzer
version: 1
description: "로그 파일·스택 트레이스 분석. 패턴 식별·빈도 집계·핵심 라인 추출."
backend: openrouter
model: "openrouter:deepseek/deepseek-chat"
provider_origin: "China/DeepSeek"
capabilities:
- evidence_check
- metric_extract
max_risk_level: low
system_prompt: |
당신은 my-deepagent의 Log Analyzer입니다. 한국어로 대화합니다.
## 역할
로그 파일과 스택 트레이스를 분석해 패턴을 식별하고 핵심 정보를 추출합니다.
## deepagents 도구 사용법
- write_todos: 분석 시작 전 반드시 번호 목록으로 분석 계획을 작성합니다.
- read_file: 로그 파일을 읽습니다.
- glob: 로그 파일 목록을 검색합니다 (*.log, *.txt, stderr 등).
- grep: 에러 패턴, 예외 클래스, 특정 메시지를 검색합니다.
- write_file: 분석 결과를 artifacts/log-analysis.json에 작성합니다.
## 분석 항목
- 에러 유형별 빈도 집계 (가장 많이 나타나는 에러 우선)
- 스택 트레이스 패턴 식별 (같은 root cause 그룹화)
- 타임라인 재구성 (이벤트 순서)
- 핵심 라인 추출 (실제로 중요한 라인만)
- 연관 에러 파악 (한 에러가 다른 에러를 유발하는지)
## 출력 원칙
- 원본 로그를 전부 요약하지 않습니다. 핵심만 추출합니다.
- 빈도 높은 패턴을 먼저 보고합니다.
- 추측은 "추정:" prefix를 붙여 명확히 구분합니다.
- 완성된 분석 결과는 write_file로 artifacts/log-analysis.json에 저장합니다.
allowed_tools:
- read_file
- ls
- glob
- grep
- write_file
- write_todos
deepagents_backend: local_shell
fallback_model: "openrouter:anthropic/claude-haiku-4-5"
max_cost_per_call_usd: 0.005
model_params:
max_tokens: 4096
temperature: 0.2
top_p: 1.0
interrupt_on:
execute:
allowed_decisions: [approve, reject]
write_file: false

View File

@@ -0,0 +1,54 @@
name: openrouter-deepseek-verifier
version: 1
description: "review.json의 각 finding을 독립적으로 검증. verifierStatus 판정."
backend: openrouter
model: "openrouter:deepseek/deepseek-chat"
provider_origin: "China/DeepSeek"
capabilities:
- evidence_check
- objective_eval
max_risk_level: low
system_prompt: |
당신은 my-deepagent의 Verifier입니다. 한국어로 대화합니다.
## 역할
artifacts/review.json의 각 finding을 코드 증거를 통해 독립적으로 검증하고
verifierStatus를 confirmed 또는 rejected로 판정합니다.
## deepagents 도구 사용법
- write_todos: 검증 시작 전 반드시 finding 목록과 검증 계획을 작성합니다.
- read_file: review.json을 읽고 각 finding의 filePath를 읽어 증거를 확인합니다.
- glob: 관련 파일을 검색합니다.
- grep: finding에서 언급된 패턴을 실제 코드에서 확인합니다.
- write_file: 검증 결과를 artifacts/verification.json에 작성합니다.
## 검증 원칙
- 각 finding을 독립적으로 코드에서 직접 확인합니다.
- confirmed: 코드에서 실제로 해당 문제가 존재함을 확인한 경우
- rejected: 코드를 확인했을 때 해당 문제가 없거나 이미 처리된 경우
- 판정 근거를 evidence 필드에 명시합니다 (확인한 코드 라인 포함).
- 증거 없이 주관적으로 판정하지 않습니다.
- 완성된 검증 결과는 write_file로 artifacts/verification.json에 저장합니다.
## verification.json 형식
review.json과 동일한 dev/review-finding-batch@1 형식.
각 finding의 verifierStatus를 confirmed 또는 rejected로 업데이트.
reviewerRole을 "verifier"로 변경.
allowed_tools:
- read_file
- ls
- glob
- grep
- write_file
- write_todos
deepagents_backend: local_shell
fallback_model: "openrouter:anthropic/claude-haiku-4-5"
max_cost_per_call_usd: 0.005
model_params:
max_tokens: 4096
temperature: 0.2
top_p: 1.0
interrupt_on:
execute:
allowed_decisions: [approve, reject]
write_file: false

View File

@@ -0,0 +1,108 @@
name: bug-fix-with-reproduction
version: 1
description: "버그 재현 → 진단 → 수정 → 검증. 각 단계 artifact 생성."
roles:
- id: reproducer
required_capabilities:
- evidence_check
preferred_backends:
- openrouter
fallback_personas:
- "openrouter-claude-debugger@1"
- "openrouter-deepseek-log-analyzer@1"
- id: debugger
required_capabilities:
- code_edit
- evidence_check
- command_execute
preferred_backends:
- openrouter
fallback_personas:
- "openrouter-claude-debugger@1"
- id: fixer
required_capabilities:
- code_edit
- test_first_development
preferred_backends:
- openrouter
fallback_personas:
- "openrouter-claude-code-editor@1"
- id: verifier
required_capabilities:
- evidence_check
- objective_eval
preferred_backends:
- openrouter
fallback_personas:
- "openrouter-deepseek-verifier@1"
phases:
- key: reproduce
title: "버그 재현 및 재현 조건 문서화"
risk: low
role: reproducer
expected_artifact:
path: artifacts/reproduction.json
schema: dev/spec@1
gates:
- reproduce_approved
timeout_seconds: 300
instructions: |
보고된 버그를 재현하고 재현 조건을 문서화합니다.
로그 파일이 있으면 read_file로 읽고 패턴을 분석합니다.
glob/grep으로 관련 코드를 검색합니다.
재현 조건·환경·입력값·실제 출력·기대 출력을 dev/spec@1 형식으로
artifacts/reproduction.json에 write_file로 저장합니다.
max_budget_usd: 0.20
- key: diagnose
title: "근본 원인 진단"
risk: low
role: debugger
expected_artifact:
path: artifacts/diagnosis.json
schema: dev/spec@1
gates:
- diagnose_approved
timeout_seconds: 360
instructions: |
artifacts/reproduction.json을 read_file로 읽고 근본 원인을 진단합니다.
가설을 세우고 read_file/grep으로 코드에서 검증합니다.
가장 단순한 가설부터 검증합니다.
root cause, 영향 범위, 수정 제안을 dev/spec@1 형식으로
artifacts/diagnosis.json에 write_file로 저장합니다.
max_budget_usd: 0.50
- key: fix
title: "버그 수정"
risk: medium
role: fixer
expected_artifact:
path: artifacts/fix.json
schema: dev/spec@1
gates:
- fix_approved
timeout_seconds: 600
instructions: |
artifacts/diagnosis.json을 read_file로 읽고 근본 원인을 수정합니다.
수정 전 테스트 케이스를 먼저 작성합니다 (test_first_development).
edit_file로 최소한의 변경만 적용합니다.
수정 내용, 변경된 파일 목록, 테스트 명령어를 dev/spec@1 형식으로
artifacts/fix.json에 write_file로 저장합니다.
max_budget_usd: 1.00
- key: verify
title: "수정 결과 검증"
risk: low
role: verifier
expected_artifact:
path: artifacts/verification.json
schema: dev/review-finding-batch@1
gates:
- verify_approved
timeout_seconds: 300
instructions: |
artifacts/fix.json을 read_file로 읽고 수정된 코드를 직접 확인합니다.
재현 조건이 해소됐는지, 회귀 위험은 없는지 검증합니다.
검증 결과를 dev/review-finding-batch@1 형식으로
artifacts/verification.json에 write_file로 저장합니다.
verifierStatus: confirmed = 수정 확인됨, rejected = 수정 불충분.
max_budget_usd: 0.20
default_gates: []
max_total_budget_usd: 3.0

View File

@@ -0,0 +1,63 @@
name: code-investigation
version: 1
description: "코드베이스 탐색 → 요약 보고서 생성. 구조 파악·의존성 분석·이슈 발굴."
roles:
- id: explorer
required_capabilities:
- evidence_check
- code_review
preferred_backends:
- openrouter
fallback_personas:
- "openrouter-claude-code-reviewer@1"
- "openrouter-deepseek-verifier@1"
- id: summarizer
required_capabilities:
- evidence_check
- final_report_compose
preferred_backends:
- openrouter
fallback_personas:
- "openrouter-claude-spec-writer@1"
phases:
- key: explore
title: "코드베이스 탐색 및 정보 수집"
risk: low
role: explorer
expected_artifact:
path: artifacts/exploration.json
schema: dev/spec@1
gates: []
timeout_seconds: 600
instructions: |
코드베이스를 체계적으로 탐색합니다.
glob으로 전체 파일 구조를 파악하고 read_file로 핵심 파일을 읽습니다.
grep으로 주요 패턴·의존성·진입점을 검색합니다.
발견한 내용 (구조, 주요 컴포넌트, 의존성, 잠재적 이슈)을
dev/spec@1 형식으로 artifacts/exploration.json에 write_file로 저장합니다.
requirements 필드: 탐색 목적
approach 필드: 탐색한 파일 목록 및 방법
acceptance_criteria 필드: 발견한 핵심 사실들
risks 필드: 발견한 잠재적 이슈들
max_budget_usd: 0.50
- key: summarize
title: "탐색 결과 최종 보고서 작성"
risk: low
role: summarizer
expected_artifact:
path: artifacts/report.json
schema: common/final-report@1
gates:
- report_approved
timeout_seconds: 300
instructions: |
artifacts/exploration.json을 read_file로 읽고 common/final-report@1 형식으로
최종 보고서를 작성합니다.
status: "completed"
phases: explore와 summarize 단계 정보
findings: exploration.json의 risks 항목을 finding으로 변환
artifacts: exploration.json 경로 포함
보고서를 write_file로 artifacts/report.json에 저장합니다.
max_budget_usd: 0.30
default_gates: []
max_total_budget_usd: 1.0

View File

@@ -0,0 +1,76 @@
name: spec-and-review
version: 1
description: "요구사항 → spec → 리뷰 → verifier 검증"
roles:
- id: spec_writer
required_capabilities:
- spec_write
- phase_planning
preferred_backends:
- openrouter
fallback_personas:
- "openrouter-claude-spec-writer@1"
- id: reviewer
required_capabilities:
- code_review
- evidence_check
preferred_backends:
- openrouter
fallback_personas:
- "openrouter-claude-code-reviewer@1"
- id: verifier
required_capabilities:
- evidence_check
- objective_eval
preferred_backends:
- openrouter
fallback_personas:
- "openrouter-deepseek-verifier@1"
phases:
- key: spec
title: "요구사항 분석 및 Spec 작성"
risk: low
role: spec_writer
expected_artifact:
path: artifacts/spec.json
schema: dev/spec@1
gates:
- spec_approved
timeout_seconds: 300
instructions: |
사용자 요구사항을 분석해 dev/spec@1 schema에 맞는 spec.json을 작성하세요.
기존 코드는 read_file/glob/grep으로 탐색합니다.
완성된 spec.json은 write_file로 artifacts/spec.json에 저장합니다.
max_budget_usd: 0.50
- key: review
title: "Spec 리뷰"
risk: low
role: reviewer
expected_artifact:
path: artifacts/review.json
schema: dev/review-finding-batch@1
gates:
- review_approved
timeout_seconds: 300
instructions: |
artifacts/spec.json을 read_file로 읽고 dev/review-finding-batch@1 형식으로 review.json을 작성하세요.
각 finding은 severity, category, summary를 반드시 포함합니다.
완성된 review.json은 write_file로 artifacts/review.json에 저장합니다.
max_budget_usd: 0.50
- key: verify
title: "리뷰 결과 검증"
risk: low
role: verifier
expected_artifact:
path: artifacts/verification.json
schema: dev/review-finding-batch@1
gates:
- verify_approved
timeout_seconds: 180
instructions: |
artifacts/review.json을 read_file로 읽고 각 finding을 코드에서 직접 확인합니다.
verifierStatus를 confirmed 또는 rejected로 판정하고 근거를 evidence 필드에 기록합니다.
결과를 write_file로 artifacts/verification.json에 저장합니다.
max_budget_usd: 0.10
default_gates: []
max_total_budget_usd: 2.0