Skip to content

Commit 8d86027

Browse files
refactor(agent): rename agent customization dir and DeepSQL Agent branding (#22)
<!-- CURSOR_AGENT_PR_BODY_BEGIN --> ## Summary Renames the in-repo product customization directory from `hermes/` to **`agent/`** and updates branding/docs so the product surface is the **DeepSQL Agent**, not a plain Hermes copy as this is heavily customized for DBA activities. ## What changed - Docs/comments (`AGENTS.md`, `CLAUDE.md`, Java/JS comments) say **DeepSQL Agent** - New [`agent/README.md`](agent/README.md) with an explicit **upstream disclosure**: runtime is a heavily customized [Nous Hermes Agent], while DeepSQL owns the DBA persona, skills, MCP wiring, and branding overlays <!-- CURSOR_AGENT_PR_BODY_END --> <div><a href="https://cursor.com/agents/bc-8ce91e70-c67b-48c6-84b3-05bb9d06231a?cursor_ref=pr_footer&cursor_cta=open_in_web"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/open-in-web-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/open-in-web-light.png"><img alt="Open in Web" width="114" height="28" src="https://cursor.com/assets/images/open-in-web-dark.png"></picture></a>&nbsp;<a href="https://cursor.com/background-agent?bcId=bc-8ce91e70-c67b-48c6-84b3-05bb9d06231a&cursor_ref=pr_footer&cursor_cta=open_in_cursor"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/open-in-cursor-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/open-in-cursor-light.png"><img alt="Open in Cursor" width="131" height="28" src="https://cursor.com/assets/images/open-in-cursor-dark.png"></picture></a>&nbsp;</div>
1 parent a028482 commit 8d86027

22 files changed

Lines changed: 135 additions & 75 deletions

File tree

AGENTS.md

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,9 @@ only covers cloud-specific, non-obvious caveats.
178178
- **Backend** (port 8080, base path `/api`): `bash scripts/start-backend.sh` (wraps
179179
`./mvnw spring-boot:run`; it strips `SPRING_PROFILES_ACTIVE=prod` for local runs → dev mode).
180180
- **Frontend** (port 3000): `npm run dev` (Vite proxies `/api` → 8080 and `/agent-api` → 8787).
181-
- **Hermes Agent webui** (port 8787, optional): needed only for the sidebar **Agent** tab.
182-
See caveats below for install + `HERMES_WEBUI_ALLOWED_ORIGINS`.
181+
- **DeepSQL Agent API** (port 8787, optional): needed for the sidebar **Agent** tab.
182+
Runtime is a customized Nous Hermes Agent; see caveats below for install +
183+
`HERMES_WEBUI_ALLOWED_ORIGINS` (upstream env name).
183184
- A demo target DB `demo_shop` (same Postgres server, sample `customers`/`products`/`orders`)
184185
exists for exercising connection/schema features without an external database.
185186

@@ -207,15 +208,19 @@ only covers cloud-specific, non-obvious caveats.
207208
`DEEPSQL_CHAT_ENDPOINT=https://deepsql-selfhost-resource.cognitiveservices.azure.com/`,
208209
`DEEPSQL_CHAT_MODEL=gpt-5.4` (deployment name), plus matching `DEEPSQL_EMBEDDING_*` with
209210
`text-embedding-3-large`. Also set `AZURE_OPENAI_KEY` / `AZURE_OPENAI_ENDPOINT` aliases —
210-
`hermes/install.sh` reads those. After changing LLM env, restart the backend
211+
`agent/install.sh` reads those. After changing LLM env, restart the backend
211212
(`scripts/start-backend.sh`); `/api/setup/status` should show `hasLlmConfig: true`.
212-
- **Agent tab (Hermes) is optional but required for the in-app Agent chat UI.** Install via
213+
- **Agent tab is optional but required for the in-app Agent chat UI.** The Agent tab
214+
is DeepSQL’s own React (`AgentChatPanel`); it talks to the DeepSQL Agent HTTP API
215+
on `:8787` (a heavily customized [Nous Hermes Agent](https://hermes-agent.nousresearch.com/)
216+
runtime — see [`agent/README.md`](agent/README.md)). Install upstream via
213217
`curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash -s -- --non-interactive --skip-setup`,
214-
symlink `~/.hermes/hermes-agent/.venv``venv` (DeepSQL's `hermes/install.sh` expects `.venv`),
215-
then `bash hermes/install.sh`. Start the webui with
218+
symlink `~/.hermes/hermes-agent/.venv``venv` (DeepSQLs `agent/install.sh` expects `.venv`),
219+
then `bash agent/install.sh`. Start the agent API/webui with
216220
`HERMES_WEBUI_ALLOWED_ORIGINS=http://localhost:3000,http://127.0.0.1:3000`
217-
(without this, Vite's Origin header makes Hermes return **403** "Cross-origin mismatch").
218-
Webui listens on `:8787`; Vite proxies `/agent-api` → there.
221+
(upstream env var; without it Vite’s Origin header yields **403** “Cross-origin mismatch”).
222+
Listens on `:8787`; Vite proxies `/agent-api` → there. Profile cookie name
223+
`hermes_profile` is an upstream contract — do not rename it in DeepSQL clients.
219224
- **Before running backend tests that boot the Spring context** (e.g. `ApiSmokeTest`), stop
220225
the running backend first — both use `ddl-auto=update` on the same `dba_agent` DB and can
221226
deadlock on an `ALTER TABLE`. Test env vars are documented in `CLAUDE.md` (Testing).

CLAUDE.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ src/ # Frontend (React)
9090
9191
docs/ # Documentation
9292
mcp/ # DeepSQL Phase 1 MCP server (Node stdio wrapper around backend APIs)
93+
agent/ # DeepSQL Agent customization (persona, skills, skins; customized Hermes runtime)
9394
```
9495

9596
## MCP Server
@@ -103,10 +104,11 @@ mcp/ # DeepSQL Phase 1 MCP server (Node stdio wrapper around back
103104

104105
## Dashboard Generation (artifact model)
105106

106-
Dashboards are **generated by the embedded Hermes agent acting as a coding agent** — it writes the whole dashboard as a single self-contained HTML document, not a JSON spec. The earlier spec+renderer model (metrics/charts/tables + a `{{placeholder}}` substitution engine + `DashboardBuilder.js`) was thrown away: the rigid `col BETWEEN {{name}}` convention couldn't express real SQL (e.g. a Unix-epoch date filter → `near '{range.start}'` syntax errors) and boxed the agent in.
107+
Dashboards are **generated by the embedded DeepSQL Agent acting as a coding agent**
108+
(customized Hermes runtime — see [`agent/README.md`](agent/README.md)) — it writes the whole dashboard as a single self-contained HTML document, not a JSON spec. The earlier spec+renderer model (metrics/charts/tables + a `{{placeholder}}` substitution engine + `DashboardBuilder.js`) was thrown away: the rigid `col BETWEEN {{name}}` convention couldn't express real SQL (e.g. a Unix-epoch date filter → `near '{range.start}'` syntax errors) and boxed the agent in.
107109

108110
- `DashboardAgentService` is a thin broker: `ensureProfileForUser``ensureSession` (fresh session) → `sendAndAwait` with an **artifact contract**. The agent grounds on the brain/schema, verifies every query with `execute_sql`, then emits ONE HTML doc (in a ` ```html ` block). The broker extracts the HTML and returns `{version:3, renderMode:"artifact", title, html, trace}`, stored verbatim in `saved_dashboards.dashboardConfig`.
109-
- The agent loads the **`dashboard-design` skill** (`hermes/skills/dashboard-design/SKILL.md`, v2 — artifact contract, the `deepsql.query` runtime, composition/UX rules, an **intent checklist**, and Unix-epoch date handling).
111+
- The agent loads the **`dashboard-design` skill** (`agent/skills/dashboard-design/SKILL.md`, v2 — artifact contract, the `deepsql.query` runtime, composition/UX rules, an **intent checklist**, and Unix-epoch date handling).
110112
- **Rendering + data access**: `DashboardArtifact.jsx` renders the HTML in a **sandboxed iframe** (`sandbox="allow-scripts"`, opaque origin + a strict CSP — no external network). The artifact fetches data only through an injected `deepsql.query(sql)` bridge that `postMessage`s to the parent; the parent calls **`POST /api/dashboards/query`** (`DashboardQueryController`), which is **read-only twice over** (`McpSqlGuardService.validateReadOnlySql` + `QueryExecutionContext.api` = `READ_ONLY_ONLY`) and access-scoped via `assertCanReadConnectionContent`. So the agent's code has full creative freedom while every query stays guarded and sandboxed. The bridge also auto-sizes the iframe and forwards runtime errors.
111113
- Generation endpoints unchanged (`POST /api/dashboards/generate` + `/generate/stream`). `DashboardBuilder.js`/`DashboardInputs.js` remain only because `tabs/Core/PreviewTab.js` still uses them — the dashboard *creation* path no longer touches them.
112114
- **Sharing**: both share types render a standalone read-only `DashboardViewer` (title + `DashboardArtifact` with an injected `queryFn`). Internal link `/dashboard-view/:id` (auth) uses the authed broker; public link `/share/dashboard/:token` (permitAll) uses `PublicDashboardController` (`GET /api/public/dashboards/{token}` + `/query`), which resolves only while `saved_dashboards.is_public` is true (revoke = flip it) and runs read-only + connection-scoped. `share_token`/`is_public` are set only via `POST|DELETE /api/saved-dashboards/{id}/share` (access-checked), never a general update. `ShareMenu.jsx` drives the UI. The public query path has its own nginx `dashq` limiter.

agent/README.md

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
# DeepSQL Agent
2+
3+
Source of truth for the **DeepSQL Agent** — DeepSQL’s DBA-specialized agent layer:
4+
persona, skills, skins, and install overlays.
5+
6+
## Upstream disclosure
7+
8+
The runtime is a **heavily customized [Nous Hermes Agent](https://hermes-agent.nousresearch.com/)**
9+
(plus its optional webui/TUI). DeepSQL does not ship a fork of that runtime in this
10+
tree. Instead this directory is the product surface we own:
11+
12+
| DeepSQL customization | Purpose |
13+
|-----------------------|---------|
14+
| `SOUL.md` | DBA persona / always-on system prompt (grounding, RBAC, read-only defaults) |
15+
| `skills/*/SKILL.md` | DBA procedures (BI query, schema, indexes, slow queries, workload, dashboards) |
16+
| `skins/deepsql.yaml` | CLI/TUI skin |
17+
| `webui/` | Optional overlay that rebrands a Hermes webui checkout to DeepSQL |
18+
| `tui/` | Optional overlay that rebrands the Hermes TUI checkout to DeepSQL |
19+
| `install.sh` / `distribution.yaml` | Idempotent install + enterprise profile distribution |
20+
21+
Upstream install paths and CLI names (`~/.hermes`, `hermes` binary, `HERMES_*` env
22+
vars, `hermes_profile` cookie, skill frontmatter `metadata.hermes`) are **unchanged**
23+
those are contracts of the upstream engine. Product UI and docs refer to the
24+
**DeepSQL Agent**, not Hermes.
25+
26+
The in-app Agent tab is DeepSQL’s own React (`AgentChatPanel`); it consumes the
27+
agent HTTP API (`/agent-api/*`), not the Hermes webui skin.
28+
29+
## Contents
30+
31+
- `SOUL.md` — DBA persona. Encodes DeepSQL grounding discipline (`get_brain_context`
32+
before SQL, table-qualified columns, business rules + anti-patterns, read-only by
33+
default, two-step mutation confirm).
34+
- `skills/<name>/SKILL.md` — procedural skills (agentskills.io format):
35+
- `bi-query` — answer a data question with grounded, read-only SQL
36+
- `schema-exploration` — map/describe a database
37+
- `index-advisor` — recommend (and dry-run/apply) indexes via the workload-weighted advisor
38+
- `slow-query-optimize` — diagnose + rewrite one slow query
39+
- `workload-analysis` — hotspots, regressions, per-customer load, growth
40+
- `dashboard-design` — HTML dashboard artifact contract for the coding-agent path
41+
- `distribution.yaml` — profile distribution for `hermes profile install/update`
42+
- `webui/`, `tui/`, `skins/` — optional branding overlays for upstream UIs
43+
44+
These mirror workflows the in-house `AgentOrchestrator` performed, re-expressed as
45+
agent persona + skills over the DeepSQL MCP tools.
46+
47+
## Install (local / self-host)
48+
49+
1. Install the upstream agent runtime (see [AGENTS.md](../AGENTS.md) Cursor Cloud notes
50+
or the [Hermes install docs](https://hermes-agent.nousresearch.com/)).
51+
2. Apply DeepSQL customization (requires `AZURE_OPENAI_KEY` in the environment or
52+
the repo `.env`):
53+
54+
```bash
55+
bash agent/install.sh
56+
```
57+
58+
It configures `~/.hermes/config.yaml` from this repo:
59+
60+
- **model** — Azure OpenAI via its OpenAI-compatible `…/openai/v1` endpoint (key from env/.env, never committed)
61+
- **mcp_servers.deepsql** — this repo’s `mcp/deepsql-phase1-server.js`
62+
- **skills.external_dirs** — this repo’s `agent/skills` (source of truth; must be a YAML list)
63+
- **approvals.mode: smart**, **SOUL.md** persona, and disables host-affecting toolsets
64+
(terminal/file/code/browser/computer_use) → a read-only `deepsql:*` + memory/todo/skills sandbox
65+
66+
Verify:
67+
68+
```bash
69+
cd ~/.hermes/hermes-agent && uv run hermes mcp test deepsql # → Connected, DeepSQL tools
70+
```
71+
72+
The DeepSQL MCP server and the Spring backend remain the DBA brain; the agent consumes them.
73+
Optional upstream webui skin: see [`webui/`](webui/).
74+
75+
### Approval UX (operator note)
76+
77+
Because every exposed tool is read-only (`deepsql:*` reads; the one write tool,
78+
`apply_index_recommendation`, is server-side `confirm`-gated; host toolsets disabled),
79+
webui per-call approval prompts add friction without adding safety for this deployment.
80+
Operators can enable session auto-approve (or per-tool “Always allow”) so DBA turns
81+
flow without clicking. Left as a deliberate operator action, not a baked-in default.

hermes/SOUL.md renamed to agent/SOUL.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,9 @@ before acting: `bi-query` (answer a data question), `schema-exploration`
5555
## Voice
5656

5757
You are **DeepSQL**. Never refer to yourself, your skills, your memory, or your
58-
runtime as "Hermes" — that is the underlying engine and is invisible to the
59-
user. They are **DeepSQL skills**, the **DeepSQL agent**, the **DeepSQL brain**.
58+
runtime as "Hermes" in user-facing replies — users see the **DeepSQL Agent**.
59+
(Operators know the runtime is a customized Nous Hermes Agent; that detail stays
60+
out of chat.) They are **DeepSQL skills**, the **DeepSQL agent**, the **DeepSQL brain**.
6061
Don't surface internal filesystem paths (`~/.hermes/...`) or engine internals;
6162
speak in DeepSQL product terms.
6263

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
# DeepSQL Agent profile distribution.
1+
# DeepSQL Agent profile distribution (runs on the Nous Hermes Agent profile CLI).
22
# Enterprises install this per user: hermes profile install <git-url|dir> --name <profile>
33
# `hermes profile update <profile>` refreshes SOUL.md + skills/ WITHOUT touching
44
# the user's memory, sessions, .env, or config.yaml (their identity + history).
5+
# `hermes_requires` is an upstream schema key — do not rename it.
56
name: deepsql-agent
67
version: 0.1.0
78
description: "DeepSQL DBA agent — grounded, read-only database assistant over the DeepSQL MCP tools (BI queries, schema exploration, index advice, slow-query optimization, workload analysis)."
Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,20 @@
11
#!/usr/bin/env bash
2-
# Reproducibly install the DBA customization into an agent home (~/.hermes).
3-
# Idempotent: safe to re-run. Source of truth is this repo's hermes/ dir.
2+
# Reproducibly install the DeepSQL Agent customization into an agent home (~/.hermes).
3+
# Idempotent: safe to re-run. Source of truth is this repo's agent/ dir.
44
#
55
# Configures:
66
# - model: existing Azure OpenAI gpt-5.4 via its OpenAI-compatible v1 endpoint
77
# - mcp_servers.deepsql: the repo's DeepSQL MCP server (read-only DBA tools)
8-
# - skills.external_dirs: this repo's hermes/skills (source of truth)
8+
# - skills.external_dirs: this repo's agent/skills (source of truth)
99
# - approvals.mode: smart
1010
# - SOUL.md: the DBA persona
1111
# - disables host-affecting toolsets (terminal/file/code/browser/computer_use)
1212
#
1313
# Secrets are read from the environment (or the repo .env), never committed:
1414
# AZURE_OPENAI_KEY, AZURE_OPENAI_ENDPOINT (endpoint defaults to the repo value)
15+
#
16+
# Upstream note: HERMES_HOME / hermes-agent / hermes CLI are contracts of the
17+
# Nous Hermes Agent runtime this customization runs on — do not rename those.
1518
set -euo pipefail
1619

1720
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
@@ -50,14 +53,14 @@ cfg.setdefault("mcp_servers", {})["deepsql"] = {
5053
"env": {"DEEPSQL_API_BASE_URL": "http://localhost:8080/api/",
5154
"DEEPSQL_MCP_USER_ID": "deepsql-agent", "DEEPSQL_MCP_PROJECT_ID": "deepsql-agent"},
5255
}
53-
cfg.setdefault("skills", {})["external_dirs"] = [f"{repo}/hermes/skills"]
56+
cfg.setdefault("skills", {})["external_dirs"] = [f"{repo}/agent/skills"]
5457
cfg.setdefault("approvals", {})["mode"] = "smart"
5558
cfg_path.write_text(yaml.safe_dump(cfg, sort_keys=False))
5659
print(f" config.yaml updated ({cfg_path})")
5760
PY
5861

5962
# Persona
60-
cp "$REPO_ROOT/hermes/SOUL.md" "$HERMES_HOME/SOUL.md"
63+
cp "$REPO_ROOT/agent/SOUL.md" "$HERMES_HOME/SOUL.md"
6164
echo " SOUL.md installed"
6265

6366
# Scope to a read-only sandbox: disable host-affecting toolsets.
@@ -66,4 +69,4 @@ echo " SOUL.md installed"
6669
>/dev/null 2>&1 ) || echo " (toolset disable skipped — disable manually with 'hermes tools disable ...')"
6770
echo " host toolsets disabled (read-only deepsql + memory/todo/skills remain)"
6871

69-
echo "DBA customization installed. Verify: (cd $AGENT_DIR && uv run hermes mcp test deepsql)"
72+
echo "DeepSQL Agent customization installed. Verify: (cd $AGENT_DIR && uv run hermes mcp test deepsql)"
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)