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:
@@ -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]
|
||||
Reference in New Issue
Block a user