Skip to content

Commit b4dfdf2

Browse files
PatrickFanellaCopilotCopilot
authored
feat: add options scaffold backtests and realtime triage updates (#629)
## Summary - add stock/options strategy scaffold support and richer options backtest artifacts - add API and service coverage for persisted options trade logs, equity curves, and exit reasons - include related realtime triage, TUI, docs, compose, and repo test updates already present in the worktree ## Testing - go test ./... --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
1 parent e7ab3a6 commit b4dfdf2

31 files changed

Lines changed: 2692 additions & 193 deletions
Lines changed: 336 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,336 @@
1+
# Hermes integration proposal for augr
2+
3+
## Goal
4+
5+
Integrate Hermes with the existing `~/.agents` hub and the `augr` repo in a way that is low-risk, operationally useful, and consistent with the hub's documented boundary:
6+
7+
- shared, human-managed assets live in `~/.agents`
8+
- mutable runtime state stays native to each tool
9+
- augr consumes the hub for workspace bootstrapping rather than inventing a parallel agent layout
10+
11+
## What I found
12+
13+
### In `augr`
14+
15+
- The repo already expects the shared agent hub and documents a `~/.agents`-based workflow in `README.md`.
16+
- `Taskfile.yml` defines:
17+
- `task workspace`
18+
- `task workspace:research`
19+
- `task workspace:review`
20+
- `task workspace:ops`
21+
- But those tasks call `./scripts/workspace.sh`, and that file is missing.
22+
- The actual hub workspace launcher exists in `~/.agents/scripts/bootstrap_tmux_workspace.sh`.
23+
- The augr backend already exposes the right operator-facing surfaces for Hermes:
24+
- `GET /api/v1/runs/{id}`
25+
- `GET /api/v1/runs/{id}/decisions`
26+
- `GET /api/v1/runs/{id}/snapshot`
27+
- `GET /api/v1/events`
28+
- `GET /api/v1/memories`
29+
- `POST /api/v1/memories/search`
30+
- `GET/POST /api/v1/conversations`
31+
- `GET/POST /api/v1/conversations/{id}/messages`
32+
- `internal/service/conversation.go` already builds LLM context from decisions, snapshots, and memories, which means augr already has a good "ask the agent why it did that" surface.
33+
34+
### In `~/.agents`
35+
36+
- The hub has a clear pattern for adding managed harnesses via `agents/<name>/agent.yaml`.
37+
- The documented strategies are:
38+
- `symlink-subpaths`
39+
- `template-or-copy`
40+
- `docs-only`
41+
- `native-only`
42+
- The hub script currently opens tmux windows for:
43+
- `edit`
44+
- `deck`
45+
- `claude`
46+
- `opencode`
47+
- `db`
48+
- `ops`
49+
- Agent metadata is validated by schema and hub doctor tooling.
50+
- The hub explicitly warns against centralizing mutable runtime state.
51+
52+
## Recommendation
53+
54+
Use a two-layer integration:
55+
56+
1. `~/.agents` integration for developer workflow
57+
2. augr API integration for operator workflow
58+
59+
Do **not** put Hermes directly into augr's trading runtime first.
60+
61+
That would be the wrong first move because it touches execution-critical code (`internal/agent`, runner wiring, risk flow, provider routing) when augr already exposes a safer control-plane interface for investigation and operations.
62+
63+
## Proposed architecture
64+
65+
### Layer 1: Add Hermes as a managed harness in `~/.agents`
66+
67+
Add a new registry entry:
68+
69+
- `~/.agents/agents/hermes/agent.yaml`
70+
71+
Recommended initial posture:
72+
73+
- `hub_strategy: native-only` or `docs-only`
74+
- keep Hermes runtime state outside the hub
75+
- use the hub only for:
76+
- docs
77+
- prompts
78+
- launcher integration
79+
- discoverability in hub doctor / bootstrap reporting
80+
81+
Why this posture:
82+
83+
- it matches the hub rule: centralize durable assets, not runtime state
84+
- it avoids guessing at Hermes config semantics too early
85+
- it gets Hermes into the standard tooling surface immediately
86+
87+
Suggested initial metadata shape:
88+
89+
```yaml
90+
name: hermes
91+
cli: hermes
92+
config: ~/.hermes
93+
runtime_roots:
94+
- ~/.hermes
95+
- ~/Documents/hermes
96+
config_link: configs/hermes
97+
binary: hermes
98+
binary_type: cli
99+
description: Hermes CLI agent and automation runtime
100+
install_hint: Install Hermes CLI and ensure `hermes` is on PATH.
101+
maturity: experimental
102+
supports_mcp: false
103+
optional: true
104+
hub_strategy: native-only
105+
config_required: true
106+
shared_assets:
107+
- docs
108+
- prompts
109+
bootstrap:
110+
check_paths:
111+
- ~/.hermes
112+
- ~/Documents/hermes
113+
notes:
114+
- Keep Hermes runtime state native; do not centralize sessions, caches, or credentials in the hub.
115+
validated_platforms:
116+
- linux
117+
```
118+
119+
Notes:
120+
121+
- I would start with `supports_mcp: false` unless Hermes has a documented MCP contract you want the hub to validate.
122+
- If Hermes later grows a stable rendered-config surface, you can move from `native-only` to `template-or-copy`.
123+
124+
### Layer 2: Make augr launch Hermes from the shared workspace
125+
126+
Fix the current broken workspace path in augr.
127+
128+
Current problem:
129+
130+
- `Taskfile.yml` points to `./scripts/workspace.sh`
131+
- that file does not exist
132+
133+
Proposed fix:
134+
135+
- add `Code/projects/augr/scripts/workspace.sh` as a thin wrapper over the hub launcher
136+
- wrapper should call:
137+
138+
```bash
139+
~/.agents/scripts/bootstrap_tmux_workspace.sh "$(pwd)" "${1:-$(basename "$(pwd)")}"
140+
```
141+
142+
Then extend the shared hub launcher to support Hermes as an optional extra window:
143+
144+
- add env vars like:
145+
- `HERMES_BIN=${HERMES_BIN:-hermes}`
146+
- `ENABLE_HERMES_WINDOW=${ENABLE_HERMES_WINDOW:-1}`
147+
- if Hermes is installed, open a `hermes` tmux window after `opencode`
148+
149+
Result:
150+
151+
- augr keeps using the shared hub model
152+
- Hermes becomes part of the standard repo workspace
153+
- no augr-specific hardcoding of Hermes internals is needed
154+
155+
## How Hermes should talk to augr
156+
157+
Hermes should integrate with augr as an operator/control-plane client first, not as a runtime trading role.
158+
159+
### Phase A: operator assistant over augr APIs
160+
161+
Create a small Hermes-side augr integration surface that can:
162+
163+
- authenticate with augr using API key or login flow
164+
- list and inspect strategy runs
165+
- fetch run decisions and snapshots
166+
- search memories
167+
- read events
168+
- open or continue agent conversations
169+
- trigger manual actions:
170+
- run strategy
171+
- cancel run
172+
- inspect risk status
173+
- toggle kill switch only with explicit operator confirmation
174+
175+
This can be delivered as either:
176+
177+
1. a Hermes skill/documented workflow, or
178+
2. a lightweight augr client script/CLI wrapper consumed by Hermes
179+
180+
I recommend starting with a thin client wrapper because augr already has stable HTTP surfaces.
181+
182+
### Minimum useful endpoints for Hermes
183+
184+
Read-only:
185+
186+
- `GET /api/v1/strategies`
187+
- `GET /api/v1/runs`
188+
- `GET /api/v1/runs/{id}`
189+
- `GET /api/v1/runs/{id}/decisions`
190+
- `GET /api/v1/runs/{id}/snapshot`
191+
- `GET /api/v1/events`
192+
- `GET /api/v1/memories`
193+
- `POST /api/v1/memories/search`
194+
- `GET /api/v1/conversations`
195+
- `GET /api/v1/conversations/{id}/messages`
196+
197+
Write actions:
198+
199+
- `POST /api/v1/conversations`
200+
- `POST /api/v1/conversations/{id}/messages`
201+
- `POST /api/v1/strategies/{id}/run`
202+
- `POST /api/v1/runs/{id}/cancel`
203+
- `POST /api/v1/risk/killswitch`
204+
205+
### Why this is the right first integration
206+
207+
Because augr already stores and exposes the exact artifacts Hermes needs to be useful:
208+
209+
- decisions
210+
- snapshots
211+
- events
212+
- memories
213+
- conversations
214+
215+
That means Hermes can act as:
216+
217+
- operator copilot
218+
- run investigator
219+
- postmortem assistant
220+
- risk review assistant
221+
222+
without changing augr's execution pipeline.
223+
224+
## Repo changes I would make first
225+
226+
### In `~/.agents`
227+
228+
1. Add `agents/hermes/agent.yaml`
229+
2. Add `docs/HERMES.md` or similar usage doc
230+
3. Update `scripts/bootstrap_tmux_workspace.sh` to optionally open a `hermes` window
231+
4. Update validation/docs if needed
232+
233+
### In `augr`
234+
235+
1. Add `scripts/workspace.sh` wrapper so existing `task workspace*` commands actually work
236+
2. Add `docs/hermes-integration.md` with:
237+
- auth setup
238+
- common Hermes workflows
239+
- safe actions vs dangerous actions
240+
3. Optionally add a small helper script, e.g.:
241+
- `scripts/hermes-augr.sh`
242+
- or `scripts/hermes_api.py`
243+
244+
### Optional UI addition later
245+
246+
In augr web UI, add a "Open in Hermes" affordance from:
247+
248+
- run detail page
249+
- decision timeline
250+
- conversation page
251+
252+
That action could:
253+
254+
- copy a run-focused prompt
255+
- open a local URL/command bridge if you later build one
256+
- or simply render a ready-to-paste Hermes command block
257+
258+
## Concrete first milestone
259+
260+
If I were implementing this in the least risky order, I would do:
261+
262+
1. Fix augr workspace launcher by adding `scripts/workspace.sh`
263+
2. Register Hermes in `~/.agents/agents/hermes/agent.yaml`
264+
3. Extend the hub tmux launcher with an optional `hermes` window
265+
4. Add an augr helper script for read-only inspection:
266+
- get run
267+
- get decisions
268+
- get snapshot
269+
- search memories
270+
- list conversations
271+
5. Add a short repo doc showing example Hermes operator workflows
272+
273+
That gives immediate value with minimal blast radius.
274+
275+
## What I would not do first
276+
277+
I would not start by:
278+
279+
- adding Hermes as a new trading/runtime role inside `internal/agent`
280+
- replacing augr's LLM provider layer with Hermes
281+
- routing execution decisions through Hermes
282+
- storing Hermes runtime state inside `~/.agents`
283+
284+
Those are higher-risk and solve the wrong problem first.
285+
286+
## Validation
287+
288+
### Hub validation
289+
290+
After adding Hermes to `~/.agents`:
291+
292+
```bash
293+
cd ~/.agents
294+
python3 scripts/validate_agent_yaml.py
295+
python3 scripts/validate_hub_metadata.py
296+
python3 scripts/hub_doctor.py
297+
bash scripts/validate-hub.sh
298+
```
299+
300+
### augr validation
301+
302+
After adding the launcher wrapper:
303+
304+
```bash
305+
cd ~/Code/projects/augr
306+
task workspace
307+
```
308+
309+
Expected result:
310+
311+
- tmux session opens successfully
312+
- standard windows appear
313+
- Hermes window appears when enabled and installed
314+
315+
### augr API integration validation
316+
317+
Verify Hermes-side read-only flows against:
318+
319+
- runs
320+
- decisions
321+
- snapshot
322+
- memories search
323+
- conversations
324+
325+
before enabling write actions.
326+
327+
## Final recommendation
328+
329+
Best path:
330+
331+
- integrate Hermes into `~/.agents` as a first-class harness
332+
- fix augr to use the shared hub launcher it already expects
333+
- use augr's existing API/conversation/memory surfaces so Hermes acts as an operator assistant first
334+
- defer deep runtime integration until the workflow proves valuable
335+
336+
This gives you a practical Hermes-on-augr workflow quickly, while staying aligned with both augr's current architecture and the hub's documented boundaries.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ See [`.env.example`](.env.example) for the full list of variables including all
218218

219219
## API Overview
220220

221-
The REST API is served under `/api/v1`. Public HTTP endpoints are `GET /healthz`, `GET /health`, `GET /metrics`, `POST /api/v1/auth/login`, and `POST /api/v1/auth/refresh`. The WebSocket endpoint is `GET /ws`; it is not behind auth middleware in the current server. Backend root `/` is not the frontend SPA in the current Compose or production stack.
221+
The REST API is served under `/api/v1`. Public HTTP endpoints are `GET /healthz`, `GET /health`, `GET /metrics`, `POST /api/v1/auth/login`, and `POST /api/v1/auth/refresh`. The WebSocket endpoint is `GET /ws`; it authenticates the upgrade request before switching protocols and accepts `Authorization: Bearer`, `X-API-Key`, `?token=<jwt>`, or `?api_key=<key>` credentials. Backend root `/` is not the frontend SPA in the current Compose or production stack.
222222

223223
All other `/api/v1/*` routes require either `Authorization: Bearer <jwt>` or `X-API-Key: <api_key>`. Implemented route groups include strategies, runs, portfolio, orders, trades, memories, risk, settings, events, conversations, audit log, and automation health/status.
224224

cmd/tradingagent/docker_compose_prod_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@ func TestProductionDockerComposeContainsRequiredConfiguration(t *testing.T) {
1717
compose := string(contents)
1818
for _, want := range []string{
1919
"services:",
20-
"image: postgres:17",
20+
"image: pgvector/pgvector:pg17",
2121
"postgres_data:/var/lib/postgresql/data",
2222
"POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}",
2323
"pg_isready -U ${POSTGRES_USER:-postgres} -d ${POSTGRES_DB:-tradingagent}",
2424
"image: redis:7-alpine",
2525
"redis_data:/data",
26-
"[\"CMD\", \"redis-cli\", \"ping\"]",
26+
"['CMD', 'redis-cli', 'ping']",
2727
"dockerfile: Dockerfile",
2828
"target: production",
2929
"APP_ENV: production",

0 commit comments

Comments
 (0)