Share
## https://sploitus.com/exploit?id=36AA27FD-BA61-57E7-9397-ACEB99296753
# Hermes PoC β€” Pod + Nacos + Math microservice (Dubbo Triple)

Simulate the Kubernetes Pod using Docker Compose and integrate it with the **Nacos** registry and the independent **Math microservice** (Dubbo Triple). **Architecture and implementation guide** (technologies, processes, memory management, Dubbo/Skills, production migration checklist): see [guide.md](guide.md).  
External β†’ Go Sidecar:9000 (/chat)  
         ↓ HTTP  
       Hermes:8642 (Agent)  
         ↓ curl /api/math/*  
       Go Sidecar (HTTP adaptation)  
         ↓ Dubbo Triple + Nacos  
       math-service  

## Prerequisites  
1. Docker Desktop / Docker Engine  
2. `~/.hermes` has been configured with the LLM API key  
3. Stop the old Hermes stack to avoid port conflicts:  
   ```powershell  
   cd hermes-agent; docker compose down; cd ..  
   ```  

## Quick Start  
```powershell  
Copy-Item .env.example .env  
# Edit HERMES_DATA_DIR, e.g., C:/Users/you/.hermes  

docker compose up -d --build  
```  

## Memory System (PostgreSQL + Redis)  
| Component | Description  
|------|------  
| `postgres` | Long-term memory table `agent_long_memory` (UPSERT by `user_id` + `category`)  
| `redis` | Short-term session messages `session:{userID}:{sessionID}`, TTL 2 hours  
| `POST /chat` | Injects long-term memory into system prompts; writes to Redis after each request  
| `POST /session/end` | Asynchronously extracts and writes to PostgreSQL by LLM  

The `.env` file should contain `PG_PASSWORD`, `JWT_SECRET`, and `JWT_ENABLED` (see `.env.example`). For the PoC, `JWT_ENABLED=false`, and the body should contain `user_id`.  
```powershell  
# Verify table structure  
docker exec hermes-poc-postgres psql -U hermes -d hermes -c "\d agent_long_memory"  
```  

## Verification  
| Step | Command/Address  
|------|------  
| Check health of Go Sidecar | `Invoke-RestMethod http://localhost:9000/health`  
| Test Math via Sidecar (Dubbo chain) | `.\poc\scripts\test-math.ps1`  
| Nacos console | http://localhost:8848/nacos (standalone lacks authentication)  
| Service list | Should show `math.v1.MathService` provider  
| End-to-end chat | Postman `POST http://localhost:9000/chat` (see below JSON)  

Example of a chat request:  
```json
{
  "user_id": "user1",
  "message": "Calculate 3 plus 5 for me",
  "token": "test"
}
```  

## Component Descriptions  
| Service | Description  
|------|------  
| `nacos` | Registry center `nacos/nacos-server:v2.5.2` (standalone)  
| `math-service` | Four arithmetic operations Dubbo provider, Triple `:20001`  
| `go-sidecar` | External HTTP service; Consumer calls Math; forwards `/chat` to Hermes  
| `hermes` | `network_mode: service:go-sidecar`; Skill still accesses `127.0.0.1:9000`  

## Skills  
Edit [`skills/productivity/platform-math/SKILL.md`](skills/productivity/platform-math/SKILL.md) to update them (mounted at `/opt/data/skills/`).  
### Directory Structure  
```
hermes_poc/  
β”œβ”€β”€ api/proto/math/v1/math.proto   # Shared Dubbo contract  
β”œβ”€β”€ api/gen/math/v1/           # Triple generation code (POC handwritten skeleton)  
β”œβ”€β”€ services/math-service/     # Math provider  
β”œβ”€β”€ poc/                         # Go Sidecar + Consumer  
β”œβ”€β”€ docker-compose.yml        # Docker Compose file  
β”œβ”€β”€ skills/                   # Skills  
```  

## Stopping  
```powershell  
docker compose down  
```

[source-iocs-preserved url=http://localhost:9000/chat`οΌˆθ§δΈ‹ζ–Ή,http://localhost:9000/session/end]