Skip to content

Commit ffaa1f1

Browse files
committed
docs: add PR plan for Hermes integration (3 PRs, per Yif-Yang review)
1 parent 19bcb0a commit ffaa1f1

1 file changed

Lines changed: 93 additions & 0 deletions

File tree

‎HERMES_PR_PLAN.md‎

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
# Plano de correção: PR Hermes Agent para SkillOpt
2+
3+
## Contexto
4+
5+
Review de Yif-Yang identificou 9 issues na integração Hermes Agent. A branch
6+
`feat/hermes-agent-backend` está 158 commits atrás do upstream/main.
7+
8+
## Estratégia
9+
10+
Refazer sobre upstream/main em vez de rebase (muita divergência).
11+
12+
## PR #1: Core Model Backend
13+
14+
**Arquivos afetados:**
15+
- `skillopt/model/common.py` — aliases, default models, tracker
16+
- `skillopt/model/backend_config.py` — is_*_chat_backend, validation sets
17+
- `skillopt/model/hermes_backend.py` — reescrita completa
18+
- `skillopt/model/__init__.py` — routing dispatch, token summary
19+
- `tests/test_hermes_backend.py` — novos testes de contrato
20+
21+
### Issues e correções
22+
23+
| # | Issue | Local | Correção |
24+
|---|-------|-------|----------|
25+
| 1 | Backend não registrado em `_BACKEND_ALIASES` | `common.py:31-47` | Adicionar `"hermes": "hermes_chat"` |
26+
| 2 | Backend sem default model | `common.py:19-29` | Adicionar `"hermes_chat": "hermes"` |
27+
| 3 | `is_optimizer_chat_backend()` retorna `false` para `hermes_chat` | `backend_config.py:83-88` | Adicionar `"hermes_chat"` nos sets |
28+
| 4 | `is_target_chat_backend()` retorna `false` para `hermes_chat` | `backend_config.py:87-88` | Adicionar `"hermes_chat"` nos sets |
29+
| 5 | Setters `set_target/optimizer_deployment` não disparam no Hermes | `hermes_backend.py:175-184` | Setters alteram `HERMES_TARGET_PROFILE`/`HERMES_OPTIMIZER_PROFILE` via vars mutáveis, não constantes de módulo |
30+
| 6 | Token tracker compartilhado = double-count | `hermes_backend.py:68,84,101` + `__init__.py:402-461` | `hermes_backend` usa `TokenTracker` próprio separado do global |
31+
| 7 | Message APIs descartam `tools`, `tool_choice`, `retries`, `return_message` | `hermes_backend.py:111-160` | Respeitar `retries`, retornar `CompatAssistantMessage` quando `return_message=True`, propagar tools no prompt |
32+
| 8 | `chat_with_deployment`/`chat_messages_with_deployment` sem dispatch pro Hermes | `__init__.py:331-399` | Já funciona condicionalmente, mas precisa separar por `is_optimizer_chat_backend()`/`is_target_chat_backend()` |
33+
34+
## PR #2: Sleep CLI Backend
35+
36+
**Arquivos afetados:**
37+
- `skillopt_sleep/backend.py` — `HermesBackend._call()`
38+
- `tests/test_sleep_engine.py` — `TestHermesBackendCli`
39+
40+
### Issues e correções
41+
42+
| # | Issue | Local | Correção |
43+
|---|-------|-------|----------|
44+
| 1 | Exceções engolidas sem `last_call_error` | `backend.py:1404` | Capturar exceção, setar `self.last_call_error` |
45+
| 2 | Output "Exception" filtrado mesmo quando legítimo | `backend.py:1432-1434` | Filtro mais específico: só detectar traceback com padrão `File "...", line N` |
46+
47+
## PR #3: Transcript Harvester
48+
49+
**Arquivos afetados:**
50+
- `skillopt_sleep/harvest_hermes.py` — reescrita
51+
- `skillopt_sleep/harvest_sources.py` — já ok
52+
- `skillopt_sleep/config.py` — `hermes_home`
53+
54+
### Issues e correções
55+
56+
| # | Issue | Local | Correção |
57+
|---|-------|-------|----------|
58+
| 1 | Filtra `/tmp` projects legítimos | `harvest_hermes.py:35-37` | Remover filtro `/tmp` ou tornar configurável |
59+
| 2 | `limit=0` vira 200 (alias LIMIT 200) | `harvest_hermes.py:208` | `limit=0` = sem limite (não passar LIMIT) |
60+
| 3 | Mensagens `tool` role descartadas | `harvest_hermes.py:51` | Incluir `role IN ('user', 'assistant', 'tool')` |
61+
| 4 | Feedback signals nunca produzidos | `harvest_hermes.py:131` | Detectar feedback igual ao harvest do Claude |
62+
63+
---
64+
65+
## Etapas de implementação (PR #1 — Core Model Backend)
66+
67+
### Passo 1: Sincronizar fork com upstream
68+
```
69+
git fetch upstream
70+
git checkout main
71+
git reset --hard upstream/main
72+
git push --force fork main
73+
```
74+
75+
### Passo 2: Aplicar Hermes sobre base atual
76+
Arquivos a modificar:
77+
- `skillopt/model/common.py` (aliases + default models)
78+
- `skillopt/model/backend_config.py` (is_*_chat)
79+
- `skillopt/model/hermes_backend.py` (reescrita)
80+
- `skillopt/model/__init__.py` (routing + token summary)
81+
82+
### Passo 3: Testes de contrato
83+
- `tests/test_hermes_backend.py`
84+
- `test_backend_alias_normalized`
85+
- `test_set_target_backend_accepts_hermes`
86+
- `test_is_chat_backend_includes_hermes`
87+
- `test_chat_target_dispatches_to_hermes`
88+
- `test_chat_optimizer_dispatches_to_hermes`
89+
- `test_token_tracker_separate_from_claude`
90+
- `test_chat_target_messages_forwards_retries`
91+
- `test_chat_target_messages_return_message`
92+
- `test_set_target_deployment_updates_profile`
93+
- `smoke test real Hermes` (opt-in, via fixture)

0 commit comments

Comments
 (0)