@overscore/cli 0.11.6 → 0.11.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@overscore/cli",
3
- "version": "0.11.6",
3
+ "version": "0.11.7",
4
4
  "description": "CLI for deploying Overscore dashboards and publishing analyses",
5
5
  "bin": {
6
6
  "overscore": "dist/index.js"
@@ -1,27 +1,25 @@
1
1
  # Overscore Analysis: {{TITLE}}
2
2
 
3
+ @this-analysis.md
4
+ @.claude/knowledge/INDEX.md
5
+
3
6
  This is an **Overscore Analysis** — a one-off, frozen investigation that produces a single self-contained `report.html` you can share in Slack and reopen later to refresh.
4
7
 
5
8
  Analyses are NOT dashboards. No React, no `package.json`, no `useQuery`, no scheduled refreshes. The numbers are baked into `report.html` at publish time.
6
9
 
7
10
  ## First steps — interview before you query
8
11
 
9
- **Before running any SQL, check `analysis-log.md`.** If it has no queries logged yet and the user hasn't already provided specific tables, questions, and context in their message, invoke the **`start-analysis`** skill to interview them first. If the user has already given you detailed context (tables, time windows, hypotheses), skip the interviewsummarize what they told you in the Key Findings section and propose a query plan directly.
12
+ **Before running any SQL, check `this-analysis.md`.** If it's empty (just the stub), invoke the **`start-analysis`** skill to interview the user first — then check `analysis-log.md` to see what's already been tried. If `this-analysis.md` is filled in, you have the context you need read `analysis-log.md` to pick up where the last session left off.
10
13
 
11
- The interview takes 2 minutes and gives you:
12
- - The real question (often different from the title)
13
- - Which BigQuery tables matter (so you don't probe them all)
14
- - What success looks like (a number? a chart? a go/no-go?)
15
- - 1–3 hypotheses to test
16
- - Time window and filters
14
+ If the user has already given you detailed context in their message (tables, time windows, hypotheses), skip the interview write `this-analysis.md` from what they told you and propose a query plan directly.
17
15
 
18
- After the interview, draft an initial entry in `analysis-log.md` and propose a query plan for the user to approve.
16
+ ## Two files, two purposes
19
17
 
20
- ## Always maintain analysis-log.md
18
+ **`this-analysis.md`** is the **context file** — loaded automatically every session. It answers: what question is this analysis trying to answer, for whom, using what data, with what hypotheses. Written once after the interview, updated only if scope changes. Keep it short and stable.
21
19
 
22
- `analysis-log.md` is the **recoverable session state** for this analysis. Future sessions (including yourself, weeks from now, after the user runs `analysis pull`) read it to know what's been done. **Append to it as you work**, not at the end.
20
+ **`analysis-log.md`** is the **work journal** append-only record of every query run, every observation, every conclusion. Future sessions read this to know what's already been tried. **Append to it as you work**, not at the end.
23
21
 
24
- Every meaningful exploration step is a new entry: the question being investigated, the SQL you ran (paste it verbatim), what you observed, the conclusion you drew, and any open questions for the next pass.
22
+ Every meaningful exploration step in the log is a new entry: the question being investigated, the SQL you ran (paste it verbatim), what you observed, the conclusion you drew, and any open questions for the next pass.
25
23
 
26
24
  ## How to run BigQuery queries
27
25
 
@@ -57,12 +55,17 @@ The `queries/` directory is for SQL files you want to keep around — the canoni
57
55
  business logic, metric formulas, data quirks. **Read INDEX.md before starting any data work.**
58
56
  Only read the specific files relevant to your current task.
59
57
 
60
- When you discover something non-obvious (a timezone gotcha, a dedup rule, a column that means
61
- something unexpected), **propose adding it to the knowledge base**:
58
+ When you learn something worth keeping anything about how the business works, how their data is structured, or what they care about — add it to the knowledge base. The test: **is this a reusable fact, or is it specific to this session?**
59
+
60
+ Save it: business context ("Dam Filters is a drop shipping company"), table quirks, metric definitions, join rules, data quality issues, stakeholder preferences. Skip it: session decisions ("I used a 30-day window"), analysis conclusions ("revenue was up 20%"), transient states ("migration is running").
61
+
62
62
  - Create a new `.claude/knowledge/{topic}.md` file (one topic per file, 20-80 lines)
63
63
  - Or append to an existing file if the topic matches
64
+ - Surgically edit specific lines to correct wrong facts — never overwrite a file wholesale
64
65
  - Update INDEX.md when you add or remove a file
65
66
 
67
+ Write to the knowledge base during the session, not only at publish time. If the session ends before publishing, context written only to `analysis-log.md` won't make it to the Hub.
68
+
66
69
  Knowledge files sync to the Hub on `analysis publish` and are shared with every artifact
67
70
  in this project. Good knowledge notes help every future session.
68
71
 
@@ -95,6 +98,8 @@ npx @overscore/cli analysis publish
95
98
 
96
99
  This uploads `report.html` and the entire bundle (this CLAUDE.md, `analysis-log.md`, the `.claude/` tree, etc.) to Overscore. The analysis becomes available at `https://<project>.overscore.dev/analysis/{{SLUG}}`. Re-publishing overwrites the previous version. **Always preview `report.html` in a browser and get the user's approval before publishing.**
97
100
 
101
+ After publish succeeds and you've shared the link, invoke the **`save-knowledge`** skill. It shows what's already in the context files, proposes specific additions from this session, and lets the user accept or adjust before anything is written. Don't skip it — it's a short conversation, and it's what makes the next session start informed instead of blank.
102
+
98
103
  ## When the user wants to turn this into a dashboard
99
104
 
100
105
  Analyses are static. If the user asks to "make this a real dashboard" or "turn this into something that updates," **do NOT add React code to this folder** — it would corrupt the artifact. Use the global `scaffold-overscore-artifact` skill to route them to a fresh dashboard scaffold that lives as a sibling of this analysis.
@@ -107,4 +112,4 @@ The following files in `.claude/rules/` load automatically when you touch matchi
107
112
  - **`report-html.md`** — Self-contained HTML rules and dark-theme spec (loads when editing `report.html`)
108
113
  - **`report-components.md`** — Copy-paste HTML/SVG component snippets: KPI cards, charts, tables, heatmaps (loads when editing `report.html`)
109
114
  - **`analysis-methodology.md`** — Investigation loop, when to ask vs query (loads when editing `analysis-log.md`)
110
- - **`knowledge/INDEX.md`** — Project knowledge base catalog (read before data work)
115
+ - **`knowledge/INDEX.md`** — Project knowledge base catalog (auto-loaded every session via @import above)
@@ -1,41 +1,79 @@
1
1
  ---
2
2
  name: save-knowledge
3
- description: Reviews data insights discovered during analysis work and proposes additions to the project knowledge base. Use before publishing an analysis, when the user says "save what you learned", or after discovering non-obvious data facts like timezone quirks, column semantics, dedup rules, or metric definitions.
3
+ description: Collaborative debrief after publishing an analysis. Reviews what was learned this session, shows what's already in the knowledge base and analysis context, proposes specific additions and edits, and waits for the user to accept or adjust before writing anything. Run after publishing, or when the user says "save what we learned".
4
4
  ---
5
5
 
6
6
  # Save Knowledge
7
7
 
8
- Run before publishing an analysis or whenever you discover something non-obvious about the data.
8
+ A short debrief after publishing. The goal is to make sure what you learned this session doesn't disappear when the conversation ends.
9
9
 
10
- ## Process
10
+ ## The flow
11
11
 
12
- 1. Review `analysis-log.md` look for non-obvious data facts you discovered:
13
- - Column semantics that weren't obvious from the name
14
- - Timezone, dedup, or join gotchas
15
- - Metric definitions or business rules
16
- - Data quality issues or known gaps
12
+ ### 1. Review what's already documented
17
13
 
18
- 2. **Read the existing knowledge files before proposing anything.** Read `.claude/knowledge/INDEX.md`, then read the specific files relevant to what you discovered. You need to know what's already there before you can know what's new.
14
+ Read the current state of the context files before proposing anything:
15
+ - `this-analysis.md` — already in context via @import, but re-read with fresh eyes for gaps or things that changed
16
+ - `.claude/knowledge/INDEX.md` — what knowledge files exist
17
+ - Any knowledge files relevant to what you worked on this session
19
18
 
20
- 3. For each insight, decide what action to take:
19
+ ### 2. Identify what's new from this session
21
20
 
22
- | Situation | Action |
23
- |---|---|
24
- | New topic, no existing file covers it | Create a new `.claude/knowledge/{topic}.md`; add entry to INDEX.md |
25
- | New fact that belongs in an existing knowledge file | Append a new line or section to that file — do not rewrite what's there |
26
- | Fact that refines or corrects something already documented | Edit that specific line/section only — do not duplicate it |
27
- | Already documented accurately | Skip entirely |
28
- | Analysis-specific (only relevant to this investigation) | Leave in analysis-log.md — don't promote to project knowledge |
21
+ Think through the queries you ran, what the user told you, what you discovered about the data. Cross-reference against what's already in the files. Look for:
22
+ - Things the user mentioned that aren't written down anywhere
23
+ - Data facts that would save a future session from re-discovering them
24
+ - Join logic, dedup rules, timezone quirks, schema surprises
25
+ - Anything that corrects or refines what's already documented
29
26
 
30
- **Never overwrite a file wholesale. Never duplicate a fact that's already accurate. Only write what's genuinely new or changed.**
27
+ ### 3. Show existing context and propose additions
31
28
 
32
- 4. Present proposed changes to the user. Show the exact text you'd add or the exact edit you'd make not a summary of what you intend to write.
29
+ Lead with what's already there, then show exactly what you'd change. Use file links so the user can open them:
33
30
 
34
- 5. After approval, write the files and update INDEX.md.
31
+ > Here's what's already saved:
32
+ > - [this-analysis.md](this-analysis.md) — question, hypotheses, data sources, known quirks
33
+ > - [company.md](.claude/knowledge/company.md) — company context
34
+ >
35
+ > Based on this session, here's what I'd suggest adding:
36
+ >
37
+ > **[this-analysis.md](this-analysis.md)** — under Known Quirks:
38
+ > _"Shopify order_id and QuickBooks invoice_id join via the orders_bridge table, not directly"_
39
+ >
40
+ > **[company.md](.claude/knowledge/company.md)** — new file:
41
+ > _"Dam Filters sells pool filters via drop shipping. Primary sales channel is Shopify; QuickBooks handles accounting."_
42
+ >
43
+ > Accept these, or want to change anything?
35
44
 
36
- ## What qualifies as project knowledge
37
- - "unique_page_views is already COUNT(DISTINCT domain_userid)" → YES
38
- - "date_az is America/Phoenix UTC-7, no DST" → YES
39
- - "affiliate_id = 0 is unattributed, usually exclude" → YES
40
- - "Q1 churn spiked because of the pricing change" → NO (analysis conclusion, not a data fact)
41
- - "I used a 90-day window for this analysis" → NO (analysis-specific decision)
45
+ Show the exact text you'd write — not a description of what you intend to write. Keep it tight. If there's nothing worth adding, say so.
46
+
47
+ ### 4. Let the user respond
48
+
49
+ - "Looks good" → write everything as proposed
50
+ - "Also note that we exclude test orders" → incorporate and confirm
51
+ - "That's not right, it's actually..." → update the proposal, confirm before writing
52
+ - "Don't bother with that one" → drop it
53
+
54
+ Don't write anything until you have confirmation on the full set of changes.
55
+
56
+ ### 5. Write the files
57
+
58
+ Once confirmed, write exactly what was agreed:
59
+ - Append new sections or lines — never overwrite a file wholesale
60
+ - Surgically edit specific lines to correct wrong facts
61
+ - Create new knowledge files if needed, update INDEX.md
62
+ - Skip anything already accurately documented
63
+
64
+ ## What's worth saving
65
+
66
+ **Save it** — reusable facts about the business or data:
67
+ - "Dam Filters sells pool filters via drop shipping" — business context, Claude starts blank every session
68
+ - "Shopify order_id joins to QuickBooks invoice_id via orders_bridge" — saves re-discovering this join
69
+ - "unique_page_views is COUNT(DISTINCT domain_userid)" — saves re-discovering this
70
+ - "date_az is America/Phoenix, UTC-7, no DST" — prevents timezone mistakes
71
+ - "affiliate_id = 0 is unattributed, usually exclude" — prevents wrong counts
72
+ - "fiscal year ends March 31" — affects every period comparison
73
+ - "orders table has one row per line item, not per order" — would produce wrong counts without this
74
+
75
+ **Skip it** — session-specific decisions and transient states:
76
+ - "Q1 churn spiked because of the pricing change" — analysis conclusion, belongs in the report
77
+ - "I used a 90-day window for this analysis" — session decision, not a reusable fact
78
+ - "The migration is still running" — transient state, will be wrong tomorrow
79
+ - "I ran 3 queries to explore this" — process note, not a fact about the data
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: start-analysis
3
- description: Interviews the user before querying data at the start of a new Overscore analysis. Captures the real question, known tables, success criteria, hypotheses, time window, and data quirks, then writes an initial analysis-log.md entry and proposes a query plan for approval. Use when analysis-log.md has no queries logged yet, or when the user says "investigate", "look into", or "analyze" something for the first time.
3
+ description: Interviews the user before querying data at the start of a new Overscore analysis. Captures the real question, known tables, success criteria, hypotheses, time window, and data quirks, then writes this-analysis.md and proposes a query plan for approval. Use when this-analysis.md is empty, or when the user says "investigate", "look into", or "analyze" something for the first time.
4
4
  allowed-tools:
5
5
  - Read
6
6
  - Write
@@ -38,15 +38,23 @@ Ask these one or two at a time conversationally — don't dump all 6 at once lik
38
38
  ## After the interview
39
39
 
40
40
  1. **Read `.claude/knowledge/INDEX.md`** and any relevant knowledge files to understand what previous sessions have already documented about this project's data. Cross-reference what the user said against what's already known.
41
- 2. **Draft an initial entry in `analysis-log.md`** with:
42
- - The clarified question (not the original title)
43
- - The tables the user named, with what each contains
44
- - The success criteria (literally quote the user)
45
- - The hypotheses (numbered)
46
- - The time window and any filters
47
- - Any quirks the user mentioned
48
- 3. **Propose a prioritized query plan** — 3-5 queries that test the highest-priority hypothesis first. For each query, write the SQL, what hypothesis it tests, and what result would confirm or refute it. Do NOT run any of them yet.
49
- 4. **Get approval.** Show the user the plan and ask them to confirm or revise before you run anything.
41
+
42
+ 2. **Write `this-analysis.md` immediately** before proposing a query plan. Fill in every section:
43
+ - **Question** the clarified question, not the original title
44
+ - **Audience** who asked and what they'll do with the answer
45
+ - **Data Sources** — the tables the user named, with what each contains
46
+ - **Hypotheses** numbered list of what they suspect is true
47
+ - **Success Criteria** — quote the user on what "done" looks like
48
+ - **Time Window & Filters** — the date range, cohort, what to include/exclude
49
+ - **Known Quirks** anything about the data the user flagged upfront
50
+
51
+ This is the context file that loads automatically every future session. Don't skip it.
52
+
53
+ 3. **Write business context to the knowledge base** — if the user told you anything about the company, their business model, or their data sources that would help any future artifact in this project, write it to `.claude/knowledge/company.md` (create it if it doesn't exist, add to INDEX.md). This is separate from `this-analysis.md` — it's project-wide, not analysis-specific.
54
+
55
+ 4. **Propose a prioritized query plan** — 3-5 queries that test the highest-priority hypothesis first. For each query, write the SQL, what hypothesis it tests, and what result would confirm or refute it. Do NOT run any of them yet.
56
+
57
+ 5. **Get approval.** Show the user the plan and ask them to confirm or revise before you run anything.
50
58
 
51
59
  ## What this skill does NOT do
52
60
 
@@ -1,4 +1,4 @@
1
- # {{TITLE}}
1
+ # {{TITLE}} — Query Log
2
2
 
3
3
  ## Key Findings
4
4
  _(Updated as the analysis progresses — this is what the report is built from)_
@@ -12,9 +12,4 @@ _(Updated as the analysis progresses — this is what the report is built from)_
12
12
 
13
13
  ## Query Log
14
14
 
15
- ### {{DATE}} Initial exploration
16
-
17
- **Tables identified:**
18
- - _(see `.claude/rules/company-context.md`)_
19
-
20
- <!-- Append new query entries below this line -->
15
+ <!-- Append new entries below. Format: Q1, Q2, Q3... cross-referenced with Key Findings above. -->
@@ -0,0 +1,17 @@
1
+ # {{TITLE}}
2
+
3
+ <!-- Written by Claude after the start-analysis interview. Update if scope changes. -->
4
+
5
+ ## Question
6
+
7
+ ## Audience
8
+
9
+ ## Data Sources
10
+
11
+ ## Hypotheses
12
+
13
+ ## Success Criteria
14
+
15
+ ## Time Window & Filters
16
+
17
+ ## Known Quirks