Skip to content

Commit 1c1c898

Browse files
authored
Rename skill from hotdata-cli to hotdata
1 parent 39a3376 commit 1c1c898

11 files changed

Lines changed: 134 additions & 20 deletions

File tree

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ tempfile = "3"
4545
pre-release-hook = ["git", "cliff", "-o", "CHANGELOG.md", "--tag", "{{version}}" ]
4646
publish = false
4747
pre-release-replacements = [
48-
{ file = "skills/hotdata-cli/SKILL.md", search = "^version: .+", replace = "version: {{version}}", exactly = 1 },
48+
{ file = "skills/hotdata/SKILL.md", search = "^version: .+", replace = "version: {{version}}", exactly = 1 },
4949
{ file = "README.md", search = "version-[0-9.]+-blue", replace = "version-{{version}}-blue", exactly = 1 },
5050
]
5151

README.md

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,8 @@ API key priority (lowest to highest): config file → `HOTDATA_API_KEY` env var
7171
| `indexes` | `list`, `create` | Manage indexes on a table |
7272
| `results` | `list` | Retrieve stored query results |
7373
| `jobs` | `list` | Manage background jobs |
74-
| `skills` | `install`, `status` | Manage the hotdata-cli agent skill |
74+
| `sessions` | `list`, `new`, `set`, `read`, `update`, `run` | Manage work sessions |
75+
| `skills` | `install`, `status` | Manage the hotdata agent skill |
7576

7677
## Global options
7778

@@ -225,6 +226,28 @@ hotdata jobs <job_id> [--workspace-id <id>] [--format table|json|yaml]
225226
- `--job-type` accepts: `data_refresh_table`, `data_refresh_connection`, `create_index`.
226227
- `--status` accepts: `pending`, `running`, `succeeded`, `partially_succeeded`, `failed`.
227228

229+
## Sessions
230+
231+
Sessions group related CLI activity (queries, dataset operations, etc.) under a single context.
232+
233+
```sh
234+
hotdata sessions list [-w <id>] [-o table|json|yaml]
235+
hotdata sessions <session_id> [-w <id>] [-o table|json|yaml]
236+
hotdata sessions new [--name "My Session"] [-o table|json|yaml]
237+
hotdata sessions set [<session_id>]
238+
hotdata sessions read
239+
hotdata sessions update [<session_id>] [--name "New Name"] [--markdown "..."] [-o table|json|yaml]
240+
hotdata sessions run <cmd> [args...]
241+
hotdata sessions <session_id> run <cmd> [args...]
242+
```
243+
244+
- `list` shows all sessions with a `*` marker on the active one.
245+
- `new` creates a session and sets it as active.
246+
- `set` switches the active session. Omit the ID to clear the active session.
247+
- `read` prints the markdown content of the current session.
248+
- `update` modifies the name or markdown of a session (defaults to the active session).
249+
- `run` runs a command with the hotdata CLI sandboxed in a session. Creates a new session unless a session ID is provided before `run`. Useful for launching an agent that can only access session data. Nesting sessions is not allowed.
250+
228251
## Configuration
229252

230253
Config is stored at `~/.hotdata/config.yml` keyed by profile (default: `default`).

dist-workspace.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,4 @@ build = ["tar", "-czf", "skills.tar.gz", "skills/"]
2626

2727
[[dist.extra-artifacts]]
2828
artifacts = ["SKILL.md"]
29-
build = ["cp", "skills/hotdata-cli/SKILL.md", "SKILL.md"]
29+
build = ["cp", "skills/hotdata/SKILL.md", "SKILL.md"]
Lines changed: 65 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
2-
name: hotdata-cli
3-
description: Use this skill when the user wants to run hotdata CLI commands, query the Hotdata API, list workspaces, list connections, create connections, list tables, manage datasets, execute SQL queries, manage saved queries, search tables, manage indexes, or interact with the hotdata service. Activate when the user says "run hotdata", "query hotdata", "list workspaces", "list connections", "create a connection", "list tables", "list datasets", "create a dataset", "upload a dataset", "execute a query", "search a table", "list indexes", "create an index", "list saved queries", "run a saved query", or asks you to use the hotdata CLI.
2+
name: hotdata
3+
description: Use this skill when the user wants to run hotdata CLI commands, query the Hotdata API, list workspaces, list connections, create connections, list tables, manage datasets, execute SQL queries, manage saved queries, search tables, manage indexes, manage sessions, or interact with the hotdata service. Activate when the user says "run hotdata", "query hotdata", "list workspaces", "list connections", "create a connection", "list tables", "list datasets", "create a dataset", "upload a dataset", "execute a query", "search a table", "list indexes", "create an index", "list saved queries", "run a saved query", "list sessions", "create a session", "run a session", or asks you to use the hotdata CLI.
44
version: 0.1.8
55
---
66

@@ -276,6 +276,69 @@ hotdata auth status # Check current auth status
276276
hotdata auth logout # Remove saved auth for the default profile
277277
```
278278

279+
### Sessions
280+
281+
Sessions are for **ad-hoc, exploratory work** that does not need to be long-lived. They group related CLI activity (queries, dataset operations, etc.) under a single context so it can be tracked and cleaned up together. **Datasets created inside a session are tied to that session and will be removed when the session ends.** If you need data to persist beyond the session, create datasets outside of a session context.
282+
283+
> **IMPORTANT: If `HOTDATA_SESSION` is set in the environment, you are inside an active session. NEVER attempt to unset, override, or work around this variable. Do not clear it, do not start a new session, do not run `sessions run` or `sessions new` or `sessions set`. All your work should be attributed to the current session. Attempting to nest or escape a session will fail with an error.**
284+
285+
```
286+
hotdata sessions list [-w <workspace_id>] [-o table|json|yaml]
287+
hotdata sessions <session_id> [-w <workspace_id>] [-o table|json|yaml]
288+
hotdata sessions new [--name "Session Name"] [-o table|json|yaml]
289+
hotdata sessions set [<session_id>]
290+
hotdata sessions read
291+
hotdata sessions update [<session_id>] [--name "New Name"] [--markdown "..."] [-o table|json|yaml]
292+
hotdata sessions run <cmd> [args...]
293+
hotdata sessions <session_id> run <cmd> [args...]
294+
```
295+
296+
- `list` shows all sessions with a `*` marker on the active one.
297+
- `new` creates a session and sets it as active. Blocked inside an existing session.
298+
- `set` switches the active session. Omit the ID to clear. Blocked inside an existing session.
299+
- `read` prints the markdown content of the current session. Use this to retrieve session state at the start of work or between steps.
300+
- `update` modifies a session's name or markdown. Defaults to the active session if no ID is given. The `--markdown` field is for writing details about the work being done in the session — observations, intermediate findings, next steps, etc. This state persists for the life of the session and is the primary way to record context that should survive across commands or agent invocations within the session.
301+
- `run` launches a command with `HOTDATA_SESSION` and `HOTDATA_WORKSPACE` set in the child process environment. Creates a new session unless a session ID is provided before `run`. Blocked inside an existing session.
302+
- When inside a session (HOTDATA_SESSION is set), all API requests automatically include the session ID — no extra flags needed.
303+
304+
#### Example: Building a data model in a session
305+
306+
Use a session to explore tables and iteratively build a model description in the session markdown.
307+
308+
1. Start a session:
309+
```
310+
hotdata sessions new --name "Model: sales pipeline"
311+
```
312+
2. Inspect tables and columns:
313+
```
314+
hotdata tables list --connection-id <connection_id>
315+
```
316+
3. Run exploratory queries to understand relationships, cardinality, and key columns:
317+
```
318+
hotdata query "SELECT DISTINCT status FROM sales.public.deals LIMIT 20"
319+
hotdata query "SELECT count(*), count(DISTINCT account_id) FROM sales.public.deals"
320+
```
321+
4. Write findings into the session markdown as you go:
322+
```
323+
hotdata sessions update --markdown "## sales pipeline model
324+
325+
### deals (sales.public.deals)
326+
- PK: id
327+
- FK: account_id -> accounts.id
328+
- status: open | won | lost
329+
- ~50k rows, one row per deal
330+
331+
### accounts (sales.public.accounts)
332+
- PK: id
333+
- name, industry, created_at
334+
- ~12k rows, one row per company
335+
336+
### TODO
337+
- check how line_items joins to deals
338+
- confirm revenue column semantics"
339+
```
340+
5. Continue exploring and update the markdown as the model takes shape. The markdown is the living artifact — when the session ends, its content captures what was learned.
341+
279342
Other commands (not covered in detail above): `hotdata connections new` (interactive connection wizard), `hotdata skills install|status`, `hotdata completions <bash|zsh|fish>`.
280343

281344
## Workflow: Running a Query

skills/hotdata-cli/references/DATA_MODEL.template.md renamed to skills/hotdata/references/DATA_MODEL.template.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
> Copy this file to your **project** directory (e.g. `./DATA_MODEL.md`, `./data_model.md`, or `./docs/DATA_MODEL.md`).
44
> Do not commit workspace-specific content into agent skill folders.
5-
> For a **full** build (per-table detail, connector enrichment, index summary), follow [MODEL_BUILD.md](MODEL_BUILD.md) from the installed skill’s `references/` (or this repo’s `skills/hotdata-cli/references/`). Relative links to `MODEL_BUILD.md` below work only while this file lives next to those references; in your project, open that path separately if the link 404s.
5+
> For a **full** build (per-table detail, connector enrichment, index summary), follow [MODEL_BUILD.md](MODEL_BUILD.md) from the installed skill’s `references/` (or this repo’s `skills/hotdata/references/`). Relative links to `MODEL_BUILD.md` below work only while this file lives next to those references; in your project, open that path separately if the link 404s.
66
77
**Workspace (Hotdata):** `<workspace name or id>`
88
**Last catalog refresh:** `<YYYY-MM-DD>`
File renamed without changes.
File renamed without changes.

src/command.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ pub enum Commands {
7575
command: TablesCommands,
7676
},
7777

78-
/// Manage the hotdata-cli agent skill
78+
/// Manage the hotdata agent skill
7979
Skills {
8080
#[command(subcommand)]
8181
command: SkillCommands,
@@ -446,13 +446,13 @@ pub enum ConnectionsCommands {
446446

447447
#[derive(Subcommand)]
448448
pub enum SkillCommands {
449-
/// Install or update the hotdata-cli skill into agent directories
449+
/// Install or update the hotdata skill into agent directories
450450
Install {
451451
/// Install into the current project directory instead of globally
452452
#[arg(long)]
453453
project: bool,
454454
},
455-
/// Show the installation status of the hotdata-cli skill
455+
/// Show the installation status of the hotdata skill
456456
Status,
457457
}
458458

@@ -597,6 +597,9 @@ pub enum SessionsCommands {
597597
output: String,
598598
},
599599

600+
/// Print the markdown content of the current session
601+
Read,
602+
600603
/// Set the active session (omit ID to clear)
601604
Set {
602605
/// Session ID to set as active (omit to clear)

src/main.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,20 @@ fn main() {
358358
}
359359
}
360360
}
361+
Some(SessionsCommands::Read) => {
362+
let session_id = id.or_else(|| {
363+
std::env::var("HOTDATA_SESSION").ok()
364+
}).or_else(|| {
365+
config::load("default").ok().and_then(|p| p.session)
366+
});
367+
match session_id {
368+
Some(sid) => sessions::read(&sid, &workspace_id),
369+
None => {
370+
eprintln!("error: no active session. Use 'sessions new' or 'sessions set <id>'.");
371+
std::process::exit(1);
372+
}
373+
}
374+
}
361375
Some(SessionsCommands::Set { id: set_id }) => {
362376
sessions::set(set_id.as_deref(), &workspace_id)
363377
}

src/sessions.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,17 @@ pub fn get(session_id: &str, workspace_id: &str, format: &str) {
7878
}
7979
}
8080

81+
pub fn read(session_id: &str, workspace_id: &str) {
82+
let api = ApiClient::new(Some(workspace_id));
83+
let path = format!("/sessions/{session_id}");
84+
let body: DetailResponse = api.get(&path);
85+
if body.session.markdown.is_empty() {
86+
eprintln!("{}", "Session markdown is empty.".dark_grey());
87+
} else {
88+
print!("{}", body.session.markdown);
89+
}
90+
}
91+
8192
fn check_session_lock() {
8293
if std::env::var("HOTDATA_SESSION").is_ok() || find_session_run_ancestor().is_some() {
8394
eprintln!("error: session is locked");

0 commit comments

Comments
 (0)