diff --git a/app/instance_config.py b/app/instance_config.py index 42dacad..c317a30 100644 --- a/app/instance_config.py +++ b/app/instance_config.py @@ -137,6 +137,11 @@ def get_instance_subtitle() -> str: return get_value("instance", "subtitle", default="") +def get_sync_interval() -> str: + """Human-readable refresh cadence shown in the analyst welcome prompt.""" + return get_value("instance", "sync_interval", default="1 hour") + + def get_allowed_domains() -> list: domain = get_value("auth", "allowed_domain", default="") if domain: diff --git a/config/claude_md_template.txt b/config/claude_md_template.txt index 096c133..1e59d2f 100644 --- a/config/claude_md_template.txt +++ b/config/claude_md_template.txt @@ -1,6 +1,22 @@ -# {instance_name} — AI Data Analyst +{# Default analyst-onboarding welcome prompt for "da analyst setup". + Rendered server-side by src/welcome_template.py. Edit this file to change + the OSS default; admins override per-instance via /admin/welcome. -This workspace is connected to {server_url}. + Available context (see docs/welcome-template.md for the full reference): + instance.name, instance.subtitle + server.url, server.hostname + sync_interval — string from instance.yaml + data_source.type — keboola | bigquery | local + tables — list of {name, description, query_mode} + metrics.count, metrics.categories + marketplaces — list of {slug, name, plugins:[name]} + user.email, user.name, user.is_admin, user.groups + now, today — datetime / date string +#} +# {{ instance.name }} — AI Data Analyst + +This workspace is connected to {{ server.url }}. +{% if instance.subtitle %}Operated by **{{ instance.subtitle }}**.{% endif %} ## Rules - Before computing any business metric: run `da metrics show /` @@ -11,8 +27,8 @@ This workspace is connected to {server_url}. - **Personal customizations go in `.claude/CLAUDE.local.md`, NOT here.** This file is regenerated by `da analyst setup --force`; edits here will be lost. CLAUDE.local.md is preserved across regeneration and uploaded on `da sync --upload-only`. ## Metrics Workflow -1. `da metrics list` — find the relevant metric -2. `da metrics show revenue/mrr` — read SQL and business rules +1. `da metrics list` — find the relevant metric ({{ metrics.count }} available, categories: {{ metrics.categories | join(", ") or "none yet" }}) +2. `da metrics show /` — read SQL and business rules 3. Use the canonical SQL from the metric definition, adapt to the question 4. Never invent metric calculations — always check existing definitions first @@ -20,7 +36,21 @@ This workspace is connected to {server_url}. - `da sync` — download current data from server - `da sync --docs-only` — just metadata and metrics (fast refresh) - `da sync --upload-only` — upload sessions and local notes to server -- Data on the server refreshes every {sync_interval} +- Data on the server refreshes every {{ sync_interval }} + +## Available Datasets +{% for t in tables -%} +- `{{ t.name }}`{% if t.description %} — {{ t.description }}{% endif %}{% if t.query_mode == "remote" %} *(remote, queried on demand)*{% endif %} +{% else -%} +- _No tables registered yet — ask an admin to register tables in the dashboard._ +{% endfor %} + +{% if marketplaces -%} +## Plugins available to you +{% for mp in marketplaces -%} +- **{{ mp.name }}** ({{ mp.slug }}): {{ mp.plugins | map(attribute="name") | join(", ") }} +{% endfor %} +{% endif -%} ## Remote Queries (BigQuery) — when data isn't on the laptop @@ -161,3 +191,5 @@ Run `da sync` to refresh. Rules are pruned automatically when items are revoked. - `user/artifacts/` — analysis outputs, reports, charts - `user/sessions/` — Claude Code session logs - `.claude/CLAUDE.local.md` — your personal notes + workspace customizations. **Never overwritten by `da analyst setup --force`.** Uploaded to the server on `da sync --upload-only`. Put any local-only Claude instructions, project-specific reminders, or temporary notes here — NOT in CLAUDE.md (this file is regenerated from a template). + +_Hello {{ user.name or user.email }} — generated {{ today }}._ diff --git a/config/instance.yaml.example b/config/instance.yaml.example index f268959..1af9864 100644 --- a/config/instance.yaml.example +++ b/config/instance.yaml.example @@ -18,6 +18,7 @@ instance: copyright: "Your Organization" # logo_svg: Full element for header logo (optional, default: Keboola logo) # Example: 'Logo' + # sync_interval: "1 hour" # Cadence shown in analyst CLAUDE.md (e.g., "1 hour", "30 minutes", "daily") # --- Server --- server: