Files
obsidian/infra/compute/hermes.md

84 lines
5.2 KiB
Markdown

---
title: hermes
updated: 2026-06-09
tags: [infra, incus, debian, hermes, agent, seoul]
type: container
host_kind: container
location: seoul
provider: self-hosted
status: active
parent_host: incus-hp2
incus_project: default
tailscale_ip: null
lan_ip: 10.100.2.235
os: Debian 13
cpu_cores: 2
ram_gb: 4
disk_gb: 20
monthly_cost_usd: 0
---
## 개요
[[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 | Debian 13.5 |
| IP | 10.100.2.235 (eth0, 10.100.2.0/24) |
| 스펙 | 2 vCPU / 4GB RAM / 20GB disk |
| 자동시작 | `boot.autostart=true` (hp2 재부팅 시 기동) |
## Hermes Agent
- 버전: 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 보조)
원칙: **추론·판단이 필요하면 Codex, 단순 작업만 ollama.**
| 용도 | task | 모델 |
|---|---|---|
| 메인 추론 | (대화) | `openai-codex/gpt-5.4` (ChatGPT Plus OAuth, 구독 정액제) |
| **보조 — 단순** (제목·압축·웹추출, 자주 발동) | `title_generation, compression, web_extract` | kr1 [[ollama]] `qwen3:4b-instruct-2507-q4_K_M` (**실호출 검증 2026-06-09**) |
| **보조 — 추론·판단** (분류·분해·승인·큐레이션) | `triage_specifier, kanban_decomposer, approval, profile_describer, curator, skills_hub, mcp` | `provider: main` (Codex) |
| 보조 — vision | `vision` | `provider: main` (Codex) |
ollama로 보낸 건 **자주 발동하면서 품질 민감도가 낮은 단순 작업뿐** — Plus 한도 보존 + 주권 + 비용 0. 판단이 필요한 보조는 작은 4B 모델 품질로는 부족하므로 메인 Codex 재사용.
**설정 (config.yaml `auxiliary:`):**
- 명명된 custom provider: `custom_providers: [{name: ollama, base_url: http://192.168.9.214:11434/v1}]`
- 단순 3종 → `provider: ollama` + `model: qwen3:4b-...`
- 추론 7종 + vision → `provider: main` (메인 Codex 재사용, 폴백 안 탐)
- ⚠️ **전역 default가 없음 — task를 하나라도 빠뜨리면 `auto`로 발동해 nous/openrouter 폴백 시도하며 경고 폭주**. 발동 task 전수 지정 필수. 목록은 `awk`로 config `auxiliary:` 섹션에서 추출하거나 `hermes model` → "Configure auxiliary models" UI.
- ⚠️ 메인 Codex는 auxiliary 폴백 체인에서 의도적 제외(OpenAI 비공개 allow-list)라, codex로 보조를 쓰려면 `provider: main` 명시 필요(`auto`로는 codex 안 감).
**검증 방법:** 컨테이너 트래픽은 **hp2 호스트 IP `192.168.9.134`로 NAT**되어 나간다(컨테이너 IP `10.100.2.77`/`.235` 아님). 따라서 kr1 ollama 로그(`ssh kaffa@192.168.9.214 "sudo journalctl -u ollama"`)에서 `192.168.9.134 | POST /v1/chat/completions`가 보이면 병행 작동. 2026-06-09 새 대화 시 4.79s qwen3 추론 확인.
### Telegram 게이트웨이
- 봇: **HermesBot** (`@HermesTest71Bot`), 토큰·allowed_users는 Vault `secret/apps/hermes`
- `.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 미설정 시 봇 주소만 알면 누구나 터미널 권한 에이전트 조작 가능 → 시작 전 반드시 잠글 것
## graphify (인프라 지식 그래프)
- 설치: `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]] — 부모 호스트
- [[ollama]] — 보조 모델(kr1) + 인프라 그래프 대상
- [[infra-hosts]] — 인프라 토폴로지 정본