Hermes Agent: лайфхаки для ежедневной работы

Hermes Agent имеет скрытые фичи, которые превращают его из чат-бота в полноценный инструмент автоматизации. Разбираем лучшие практики.

1. CLAUDE.md — память проекта (самое важное!)

Создайте файл CLAUDE.md в корне репо — он автоматически подгружается в каждый контекст. Это избавляет от повторных объяснений на каждом запуске.

# CLAUDE.md — пример для TypeScript/React проекта
## Stack
- TypeScript 5.x, React 18, Vite
- Tailwind CSS, shadcn/ui
- Vitest + React Testing Library
- ESLint (flat config), Prettier

## Commands
- dev: npm run dev
- build: npm run build
- test: npm run test
- lint: npm run lint
- typecheck: npm run typecheck

## Code Rules
- Не трогай папку .hermes/ и .github/
- Компоненты в src/components/, хуки в src/hooks/
- Импорты: абсолютные через @/ (tsconfig paths)
- Состояния: useState для UI, Zustand для глобального
- Асинхронность: try/catch + Result pattern

## Git
- Ветки: feature/*, fix/*, chore/*
- Коммиты: Conventional Commits (feat:, fix:, chore:)
- PR: squash merge, delete branch

Про-совет: Держите CLAUDE.md актуальным — агент будет следовать ему буквально.

2. Хуки (Hooks) — автоматизация на событиях

Хуки в .hermes/settings.json запускают команды на событиях.

{
  "hooks": {
    "PostToolUse": [
      {
        "matcher": "Write|Edit|MultiEdit",
        "hooks": [
          {"type": "command", "command": "npm run lint -- --fix"},
          {"type": "command", "command": "npm run format"}
        ]
      }
    ],
    "PreToolUse": [
      {
        "matcher": "Bash",
        "hooks": [
          {"type": "command", "command": "echo 'Running: $TOOL_INPUT'"}
        ]
      }
    ],
    "Notification": [
      {"type": "command", "command": "notify-send 'Hermes' 'Task completed'"}
    ]
  }
}

Типичные кейсы: автоформат после записи, линт перед коммитом, логи при ошибке, уведомления в системе.

3. Headless режим — для CI/CD и скриптов

# Неинтерактивный запуск с JSON выводом
hermes -p "Сделай миграцию БД: добавь поле created_at в users" --output-format json

# В GitHub Actions
- name: Run Hermes
  run: |
    hermes -p "$TASK" --output-format json |
    jq -r '.result' > output.md

# В cron / скриптах
hermes -p "Обнови зависимости и запусти тесты" --output-format text

В headless режиме Hermes становится инструментом автоматизации, а не только интерактивным чатом.

4. MCP Серверы — подключите свои данные

Model Context Protocol позволяет подключить базы, API, браузер, GitHub — один MCP работает и в Cursor, и в Claude Desktop, и в Hermes.

# .hermes/settings.json
{
  "mcpServers": {
    "postgres": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-postgres", "$DATABASE_URL"]
    },
    "github": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-github"]
    },
    "filesystem": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-filesystem", "/path/to/project"]
    },
    "brave-search": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-brave-search", "$BRAVE_API_KEY"]
    }
  }
}

Популярные MCP: mcp servers list | awesome-mcp-servers

5. Profiles — специализация под задачи

Создавайте профили в .hermes/profiles/:

# .hermes/profiles/coder.json
{
  "name": "coder",
  "skills": ["git-workflow", "test-runner", "code-review", "frontend-verify", "api-conventions"],
  "model": "anthropic/claude-3.5-sonnet",
  "tools": ["bash", "read", "write", "edit", "grep", "github"]
}

# .hermes/profiles/writer.json
{
  "name": "writer",
  "skills": ["content-plan", "seo-optimization", "fact-checking"],
  "model": "openai/gpt-4o",
  "tools": ["bash", "read", "write", "web-search"]
}

# .hermes/profiles/devops.json
{
  "name": "devops",
  "skills": ["deploy-pipeline", "debug-playbook", "security-review", "cost-control"],
  "model": "anthropic/claude-3.5-sonnet",
  "tools": ["bash", "read", "write", "docker", "kubernetes"]
}

Переключение: /profile coder в чате или hermes --profile coder в CLI.

6. Slash-команды — переиспользуемые промпты

Файлы в .hermes/commands/ — это шаблоны с параметрами.

# .hermes/commands/deploy.md
---
name: deploy
description: "Deploy to production with checks"
---
1. Run full test suite: npm run test
2. Build: npm run build
3. Check bundle size: npm run analyze
4. Deploy: npm run deploy
5. Verify health endpoint

---
# .hermes/commands/refactor.md
---
name: refactor
description: "Refactor code with safety checks"
args: ["target_file", "goal"]
---
Refactor $ARG_TARGET_FILE to $ARG_GOAL.
Steps:
1. Read file and understand context
2. Write tests if missing
3. Refactor incrementally
4. Run tests after each step
5. Update documentation

Вызов: /deploy или /refactor src/api/users.ts "extract service layer"

7. Permission Modes — настройка доверия

# Режимы (переключаются в UI или флагами)
# default — спрашивает подтверждение для опасных операций
# auto-accept — автоматически соглашается (для доверенных репо)
# plan-only — только показывает план, не выполняет

# В settings.json
{
  "permissions": {
    "default": "default",
    "allow": ["Read", "Grep", "Glob"],
    "deny": ["Bash(rm -rf*)", "Bash(sudo*)"]
  }
}

8. Полезные алиасы и конфиг

# ~/.bashrc или ~/.zshrc
alias hm='hermes'
alias hmp='hermes -p'
alias hma='hermes -a'

# Экспорт переменных для MCP
source ~/.env.mcp  # DATABASE_URL, BRAVE_API_KEY, GITHUB_TOKEN

9. Ссылки и ресурсы

Краткий чек-лист профи
  1. hermes auth login — авторизация
  2. Создайте CLAUDE.md в репо
  3. Настройте .hermes/settings.json (хуки, MCP)
  4. Создайте 2-3 профиля под ваши задачи
  5. Добавьте slash-команды для рутины
  6. Попробуйте headless режим в CI