diff --git a/infra/compute/hermes.md b/infra/compute/hermes.md index bbd7dca..793319d 100644 --- a/infra/compute/hermes.md +++ b/infra/compute/hermes.md @@ -1,7 +1,7 @@ --- title: hermes updated: 2026-06-09 -tags: [infra, incus, nixos, hermes, agent, seoul] +tags: [infra, incus, debian, hermes, agent, seoul] type: container host_kind: container location: seoul @@ -10,8 +10,8 @@ status: active parent_host: incus-hp2 incus_project: default tailscale_ip: null -lan_ip: 10.100.2.77 -os: NixOS 25.11 +lan_ip: 10.100.2.235 +os: Debian 13 cpu_cores: 2 ram_gb: 4 disk_gb: 20 @@ -20,59 +20,51 @@ monthly_cost_usd: 0 ## 개요 -[[incus-hp2]] `default` 프로젝트의 **NixOS incus 컨테이너**. NousResearch **Hermes Agent**(self-improving 자율 AI 에이전트, persistent memory, 멀티채널 게이트웨이)를 호스팅한다. macmini(주 개발기)의 민감 데이터(SSH 키·Vault·nixos-infra)와 분리하기 위해 격리 컨테이너로 운영. NixOS 동류는 [[zlambda]]. +[[incus-hp2]] `default` 프로젝트의 **Debian 13 incus 컨테이너**. NousResearch **Hermes Agent**(self-improving 자율 AI 에이전트, persistent memory, 멀티채널 게이트웨이)를 호스팅한다. macmini(주 개발기)의 민감 데이터(SSH 키·Vault·nixos-infra)와 분리하기 위해 격리 컨테이너로 운영. + +> **이력:** 2026-06-09 NixOS 25.11로 처음 구축했으나 운영 친숙성(다른 incus 컨테이너는 모두 Debian)·설치 단순성 위해 **Debian 13으로 재구성**(`hermes2`→검증→교체). NixOS판은 nix-ld/sandbox/PATH mkForce 특수설정이 필요했고 flake 미통합 반쪽 선언적이었음. ## 인프라 | 항목 | 값 | |---|---| | 호스트 | [[incus-hp2]] (`default` 프로젝트) | -| OS | NixOS 25.11 (Xantusia), channel 기반 | -| IP | 10.100.2.77 (eth0, 10.100.2.0/24) | +| OS | Debian 13.5 | +| IP | 10.100.2.235 (eth0, 10.100.2.0/24) | | 스펙 | 2 vCPU / 4GB RAM / 20GB disk | -| 생성 | 2026-06-09, `images:nixos/25.11` | +| 자동시작 | `boot.autostart=true` (hp2 재부팅 시 기동) | ## Hermes Agent -- 버전: v0.16.0 (2026.6.5) -- 설치: `/usr/local/lib/hermes-agent`, config `/root/.hermes/`, 런처 `/usr/local/bin/hermes` -- **백엔드: OpenAI Codex OAuth (ChatGPT Plus 구독)** — API 키 종량제가 아닌 구독 정액제. provider `openai-codex`, 모델 `gpt-5.4` -- 인증 토큰: `/root/.hermes/auth.json` (device_code OAuth). **구독 계정/시크릿은 컨테이너 로컬, repo·Obsidian에 평문 없음** -- 검증: `hermes -z '...'` 단발 추론 정상 응답 확인 (2026-06-09) +- 버전: v0.16.0, `/usr/local/lib/hermes-agent`, config `/root/.hermes/`, 런처 `/usr/local/bin/hermes` +- 설치: `curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash -s -- --skip-setup` (Debian은 nix-ld 등 불필요, 단 `xz-utils` 선설치 필요 — Node tar.xz 추출용) ### 모델 분리 (메인 vs 보조) | 용도 | 모델 | 비고 | |---|---|---| -| 메인 추론 | `openai-codex/gpt-5.4` (ChatGPT Plus) | 복잡한 대화·도구 호출 | +| 메인 추론 | `openai-codex/gpt-5.4` (ChatGPT Plus OAuth) | 복잡한 대화·도구 호출. 구독 정액제 | | 보조 (auxiliary) | kr1 [[ollama]] `qwen3:4b-instruct-2507-q4_K_M` | context compression·web_extract | -보조를 로컬 ollama로 분리한 이유: ① Plus 5h/주간 한도를 보조 작업이 잠식하지 않음 ② 데이터 주권(보조는 내부 LAN 처리) ③ 비용 0. config.yaml `auxiliary.` 에 `provider: custom` + `base_url: http://192.168.9.214:11434/v1`(LAN 직결, tailscale 우회) + `model` 지정. ollama는 auth 불필요. ⚠️ 메인 Codex OAuth는 Hermes의 auxiliary 폴백 체인에서 의도적으로 제외됨(OpenAI 비공개 model allow-list) → 보조는 반드시 명시 지정해야 nous/openrouter probe 경고가 안 뜸. +보조를 로컬 ollama로 분리한 이유: ① Plus 한도를 보조 작업이 잠식 안 함 ② 데이터 주권(보조는 내부 LAN) ③ 비용 0. config.yaml `auxiliary.`에 `provider: custom` + `base_url: http://192.168.9.214:11434/v1`(LAN 직결) + `model`. ⚠️ 메인 Codex는 Hermes auxiliary 폴백 체인에서 제외되므로(OpenAI 비공개 allow-list) 보조는 명시 지정 필수. ### Telegram 게이트웨이 - 봇: **HermesBot** (`@HermesTest71Bot`), 토큰·allowed_users는 Vault `secret/apps/hermes` -- `.env`: `TELEGRAM_BOT_TOKEN`, `TELEGRAM_ALLOWED_USERS`(접근 허용 단일 사용자), `TELEGRAM_HOME_CHANNEL` -- 서비스: systemd `hermes-gateway.service` (configuration.nix에 선언, `hermes gateway run`). `systemctl --user`는 incus 비대화형 root 환경에서 불가 → **system 서비스로 선언**. boot 자동시작 + `Restart=always` + `TimeoutStopSec=210`(drain 180s 대비) -- ⚠️ 보안: ALLOWED_USERS 미설정 시 봇 주소만 알면 누구나 터미널 권한 에이전트 조작 가능 → 게이트웨이 시작 전 반드시 잠글 것 +- `.env`: `TELEGRAM_BOT_TOKEN`, `TELEGRAM_ALLOWED_USERS`(단일 사용자 잠금), `TELEGRAM_HOME_CHANNEL` +- 서비스: **`/etc/systemd/system/hermes-gateway.service`** (수동 작성, `ExecStart=/usr/local/bin/hermes gateway run`, `Restart=always`, `TimeoutStopSec=210`, `enable --now`). `hermes gateway install`은 `systemctl --user`를 써서 incus 비대화형 root 환경에선 실패 → system 서비스로 직접 작성. +- ⚠️ ALLOWED_USERS 미설정 시 봇 주소만 알면 누구나 터미널 권한 에이전트 조작 가능 → 시작 전 반드시 잠글 것 -## NixOS 설정 (정본) +## graphify (인프라 지식 그래프) -선언적 정본은 Gitea `kaffa/nixos-infra` → `hosts/hermes/configuration.nix`. 적용 절차: - -1. repo의 `hosts/hermes/configuration.nix`를 컨테이너 `/etc/nixos/configuration.nix`로 push -2. `incus exec hp2:hermes -- nixos-rebuild switch` - -핵심 설정: -- `programs.nix-ld.enable = true` — uv가 받는 prebuilt(standalone) Python·Node 바이너리가 NixOS에서 동작하게 함. Hermes 구동의 필수 전제. -- `nix.settings.sandbox = false` — incus(비특권) 컨테이너는 user namespace 제약으로 nix 빌드 sandbox 불가 -- `environment.extraInit`로 `/usr/local/bin`을 PATH에 추가 (Hermes 런처 위치) -- 의존성: `git curl cacert nodejs_22 python311 uv ripgrep ffmpeg` - -⚠️ **flake 미통합**: nixos-infra flake는 nixpkgs-25.05 핀, hermes는 25.11 타깃이라 현재 channel 기반으로만 빌드. flake 통합(별도 25.11 input + `nixosConfigurations.hermes`)은 향후 정리 과제. +- 설치: `uv tool install 'graphifyy[mcp]'` (uv는 `/root/.hermes/bin/uv`), 스킬 `~/.hermes/skills/graphify/` +- 데이터: `/root/obsidian` (Gitea `kaffa/obsidian` clone). **remote URL에 토큰 미포함**(clone 후 `git remote set-url`로 제거 — 평문 노출 방지) +- 그래프: `graphify update /root/obsidian` → **구조추출만(LLM 없이)**, 1560 nodes. 의미추출(외부 LLM)은 주권 위해 미사용. Obsidian은 위키링크 중심이라 구조추출로 충분 +- 조회: `graphify query "<질문>"` (BFS, 로컬, 외부 전송 없음). 단 Hermes가 결과를 Codex로 답 생성하면 그 컨텍스트는 OpenAI로 감 +- 갱신: docs 변경 시 `graphify update` 재실행(코드 AST, no LLM) ## 관련 - [[incus-hp2]] — 부모 호스트 -- [[zlambda]] — NixOS 동류 (flake 기반 베어메탈) +- [[ollama]] — 보조 모델(kr1) + 인프라 그래프 대상 - [[infra-hosts]] — 인프라 토폴로지 정본