studioflow 0.1.5 → 0.2.1

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 StudioFlow contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,16 +1,18 @@
1
1
  # StudioFlow
2
2
 
3
- StudioFlow turns a plain-language demo request into a deterministic recorded run.
3
+ StudioFlow turns a plain-language demo request into a deterministic recorded product run.
4
4
 
5
5
  This package includes:
6
6
  - a CLI runtime (`studioflow`) for deterministic artifact execution
7
- - bundled agent skills for Codex and Claude (`studioflow-investigate`, `studioflow-cli`)
7
+ - bundled agent skills for Codex and Claude (`studioflow-investigate`, `studioflow-author`, `studioflow-cli`)
8
+
9
+ StudioFlow supports both QuickTime Player and Screen Studio recording backends.
8
10
 
9
11
  ## Requirements
10
12
 
11
- - macOS (Screen Studio automation)
12
- - Screen Studio installed
13
+ - macOS (recorder automation is macOS-only)
13
14
  - Node.js 22+
15
+ - QuickTime Player (built into macOS) or Screen Studio
14
16
 
15
17
  ## Install
16
18
 
@@ -18,69 +20,123 @@ This package includes:
18
20
  npm install -g studioflow
19
21
  ```
20
22
 
21
- ## Setup Runtime + Skills
23
+ ## Quickstart (2 Minutes)
22
24
 
23
- `setup` installs Playwright Chromium, installs bundled skills for Codex and Claude, and checks permissions.
25
+ 1. Setup runtime dependencies and bundled skills:
24
26
 
25
27
  ```bash
26
28
  studioflow setup
29
+ studioflow doctor
30
+ studioflow config check
27
31
  ```
28
32
 
29
- ## Default Workflow (Agent-First)
30
-
31
- You should not need to manually invoke multiple skills or manually run CLI commands for a normal demo request.
32
- Open Codex or Claude in your project and describe the demo you want.
33
-
34
- 1. Start your agent from the project root.
35
-
36
- Codex:
33
+ 2. Open Codex or Claude from your project root:
37
34
 
38
35
  ```bash
39
36
  cd /path/to/your/project
40
37
  codex
38
+ # or
39
+ claude
41
40
  ```
42
41
 
43
- Claude Code:
42
+ 3. Ask in plain language:
44
43
 
45
- ```bash
46
- cd /path/to/your/project
47
- claude
44
+ ```text
45
+ Record a demo for onboarding and billing.
48
46
  ```
49
47
 
50
- If your launcher command differs, start your usual Codex or Claude session in this repo root.
48
+ or
51
49
 
52
- 2. Ask for the demo in plain language.
50
+ ```text
51
+ Record a demo for onboarding and billing using Screen Studio.
52
+ ```
53
53
 
54
- Example:
54
+ 4. Expected successful run output includes:
55
55
 
56
56
  ```text
57
- Record a demo for onboarding and billing.
57
+ Run completed successfully.
58
+ Run ID: <timestamp-id>
59
+ Artifacts: <path-to-run-dir>
58
60
  ```
59
61
 
60
- 3. StudioFlow skills + CLI handle the rest:
61
- - investigate the codebase
62
- - generate deterministic artifacts (`artifacts/flow.json`, related context artifacts)
63
- - validate the flow
64
- - execute recording through the CLI runtime
62
+ ## Recorder Backends
63
+
64
+ - `quicktime` (default): no extra app install required.
65
+ - `screenstudio`: just specify Screen Studio in your agent request.
66
+
67
+ Manual CLI mode still supports `--recorder screenstudio` when you want direct runtime control.
68
+
69
+ ## What `setup` Changes
70
+
71
+ `studioflow setup`:
72
+ - installs Playwright Chromium runtime
73
+ - installs StudioFlow skills into:
74
+ - Codex: `$CODEX_HOME/skills` or `~/.codex/skills`
75
+ - Claude: `$CLAUDE_HOME/skills` or `~/.claude/skills`
76
+ - runs permission diagnostics
77
+ - writes setup state under `~/.studioflow` (or `$STUDIOFLOW_DATA_DIR`)
78
+
79
+ ## Command Cheat Sheet
80
+
81
+ | Task | Command |
82
+ | --- | --- |
83
+ | Setup runtime + skills | `studioflow setup` |
84
+ | Check permissions | `studioflow doctor` |
85
+ | Show effective config | `studioflow config show` |
86
+ | Validate config health | `studioflow config check` |
87
+ | Validate flow artifact | `studioflow validate --flow artifacts/flow.json` |
88
+ | Run deterministic demo | `studioflow demo --flow artifacts/flow.json --intent "your demo intent"` |
89
+ | List built-in flows | `studioflow list-flows` |
90
+ | QuickTime diagnostics | `studioflow quicktime-prep` |
91
+ | Screen Studio diagnostics | `studioflow screenstudio-prep` |
92
+
93
+ ## Minimal Manual Flow (Optional)
94
+
95
+ If you want to run the CLI directly without agent authoring first, start with a minimal artifact:
96
+
97
+ ```json
98
+ {
99
+ "id": "landing_capture",
100
+ "description": "Capture the landing page",
101
+ "tags": ["smoke"],
102
+ "steps": [
103
+ { "id": "open-home", "action": "goto", "value": "/" },
104
+ { "id": "capture-home", "action": "screenshot", "value": "home" }
105
+ ]
106
+ }
107
+ ```
108
+
109
+ Then run:
110
+
111
+ ```bash
112
+ studioflow validate --flow artifacts/flow.json
113
+ studioflow demo --flow artifacts/flow.json --intent "landing page smoke"
114
+ ```
65
115
 
66
- `run`/`demo` automatically performs Screen Studio preflight checks. Use manual prep only for troubleshooting.
67
- Headed runs auto-open a maximized browser window for cleaner recording composition.
68
- Runs do not auto-export by default; include `recorder_export` in flow steps only when export is explicitly needed.
116
+ ## Quick Troubleshooting
69
117
 
70
- ## Advanced Manual Mode (Optional)
118
+ - Permission failures:
119
+ - `studioflow doctor` and approve macOS prompts.
120
+ - QuickTime preflight failures:
121
+ - `studioflow quicktime-prep`
122
+ - Screen Studio preflight failures:
123
+ - `studioflow screenstudio-prep`
124
+ - App health timeout:
125
+ - `studioflow config show` and verify `baseUrl`, `startCommand`, `healthPath`.
126
+ - Flow validation failures:
127
+ - `studioflow validate --flow <path>`
71
128
 
72
- If you want to run the runtime yourself:
129
+ ## Uninstall / Cleanup
73
130
 
74
131
  ```bash
75
- studioflow validate --flow artifacts/flow.json
76
- studioflow demo --flow artifacts/flow.json --intent "onboarding and billing demo"
132
+ npm uninstall -g studioflow
77
133
  ```
78
134
 
79
- ## Documentation
135
+ Optional local cleanup:
136
+ - remove `~/.studioflow` (or `$STUDIOFLOW_DATA_DIR`)
137
+ - remove installed skill folders under `~/.codex/skills` and `~/.claude/skills` if you no longer want them
138
+
139
+ ## Contact
80
140
 
81
- - Day 0 runbook: https://github.com/ydarar/studioflow/blob/main/docs/day0-runbook.md
82
- - CLI reference: https://github.com/ydarar/studioflow/blob/main/docs/cli-reference.md
83
- - Configuration: https://github.com/ydarar/studioflow/blob/main/docs/configuration.md
84
- - Smoke checklist: https://github.com/ydarar/studioflow/blob/main/docs/testing-manual-smoke.md
85
- - Open intent tests: https://github.com/ydarar/studioflow/blob/main/docs/studioflow-open-intent-tests.md
86
- - Full docs map: https://github.com/ydarar/studioflow/blob/main/docs/README.md
141
+ - X: https://x.com/Ydarar_dev (@Ydarar_dev)
142
+ - GitHub: https://github.com/ydarar/studioflow/issues
Binary file
@@ -0,0 +1,17 @@
1
+ {
2
+ "schemaVersion": 1,
3
+ "packageName": "studioflow",
4
+ "packageVersion": "0.2.1",
5
+ "generatedAt": "2026-02-15T00:48:20.093Z",
6
+ "skills": {
7
+ "studioflow-cli": {
8
+ "hash": "ff59e41a56a6f1289c37e4d167d62eb00f80442fca08f571297444e45aa0e747"
9
+ },
10
+ "studioflow-investigate": {
11
+ "hash": "8e3034b43ea84834008900886e94a744f3bf22e7b05d2548c0123492f694f693"
12
+ },
13
+ "studioflow-author": {
14
+ "hash": "cd42e054957736b1d1d47e93839a5daf40bfe40cafda0c8d26380c0ac63d078d"
15
+ }
16
+ }
17
+ }
@@ -0,0 +1,86 @@
1
+ ---
2
+ name: studioflow-author
3
+ description: Create or repair deterministic StudioFlow artifacts for a clarified demo intent. Use when `studioflow-investigate` routes to `patch-existing` or `create-new`, or when the user explicitly asks to generate/edit `artifacts/flow.json` and runtime handoff.
4
+ ---
5
+
6
+ # StudioFlow Author
7
+
8
+ Author and validate deterministic artifacts for runtime execution.
9
+
10
+ ## Workflow
11
+
12
+ 1. Consume clarified intent + routing context.
13
+
14
+ Expected upstream context:
15
+ - resolved anchors (`target_route`, `user_goal`, `done_assertion`)
16
+ - recorder preference (`quicktime` or `screenstudio`)
17
+ - route decision (`patch-existing` or `create-new`)
18
+
19
+ 2. Collect project context artifacts automatically. Do not ask the user to run these commands manually.
20
+
21
+ ```bash
22
+ pnpm bootstrap -- --out artifacts/bootstrap.json
23
+ pnpm discover -- --out artifacts
24
+ ```
25
+
26
+ Fallback if workspace scripts are unavailable:
27
+
28
+ ```bash
29
+ studioflow bootstrap --out artifacts/bootstrap.json
30
+ studioflow discover --out artifacts
31
+ ```
32
+
33
+ 3. Review:
34
+ - `artifacts/bootstrap.json`
35
+ - `artifacts/structure-report.json`
36
+ - `artifacts/navigation-graph.json`
37
+ - existing `artifacts/flow.json` if present
38
+
39
+ 4. Author `artifacts/flow.json` for the clarified intent.
40
+
41
+ Rules:
42
+ - Deterministic steps only.
43
+ - Prefer stable selectors (`data-testid`).
44
+ - Include clear step IDs and assertions at key transitions.
45
+ - Always synthesize pacing fields (`preDelayMs`, `postDelayMs`, `mouseMoveMs`, `highlightMs`, `dwellMs`) for interaction-heavy steps to keep demos human-looking.
46
+ - Model scroll risk explicitly. For below-fold or overflow-container targets, add deterministic setup/wait steps before interaction.
47
+ - Add `recorder_export` only when user explicitly asks for export at run completion.
48
+ - If clarification context is still incomplete, generate best-effort deterministic flow with explicit assumptions.
49
+
50
+ 5. Validate the authored artifact:
51
+
52
+ ```bash
53
+ pnpm validate -- --flow artifacts/flow.json
54
+ ```
55
+
56
+ 6. If validation fails, patch flow selectors/actions/pacing and rerun validation.
57
+
58
+ 7. Emit runtime handoff for `studioflow-cli`.
59
+
60
+ Write:
61
+ - `artifacts/studioflow-cli-handoff.json`
62
+
63
+ Use `references/cli-handoff-spec.md`.
64
+ Always include:
65
+ - `runtimePacing`
66
+ - `recorder`
67
+
68
+ 8. Handoff to `studioflow-cli` immediately when the user intent is to run/record now.
69
+
70
+ ## Output Requirements
71
+
72
+ Always produce:
73
+ 1. `artifacts/bootstrap.json`
74
+ 2. `artifacts/structure-report.json`
75
+ 3. `artifacts/navigation-graph.json`
76
+ 4. `artifacts/flow.json`
77
+ 5. `artifacts/studioflow-cli-handoff.json`
78
+
79
+ Include a concise authoring summary:
80
+ - what changed (new vs patched)
81
+ - assumptions
82
+ - confidence (`high|medium|low`)
83
+
84
+ Use references in:
85
+ - `references/artifact-spec.md`
86
+ - `references/cli-handoff-spec.md`
@@ -32,10 +32,16 @@ Flow steps may include pacing fields:
32
32
  - dwellMs
33
33
  - narrativeCheckpoint
34
34
 
35
+ Authoring intelligence rules:
36
+ - Prefer setting pacing fields for click/type/assert transition steps by default, not only on outliers.
37
+ - Anticipate scroll-sensitive interactions (below fold, nested overflow containers) and add deterministic setup steps (`wait_for` container/section) before click/type actions.
38
+ - Keep selectors stable (`data-testid`) and avoid positional selectors for scroll-sensitive regions.
39
+
35
40
  Recorder note:
36
41
  - Include `recorder_export` only when user explicitly asks to export at run completion.
37
42
  - Without `recorder_export`, StudioFlow stops recording and completes the run without export.
43
+ - Recorder software selection is not encoded in `flow.json`; include it in `studioflow-cli-handoff.json` as `recorder`.
38
44
 
39
- ## Open-intent fallback note
45
+ ## Fallback note
40
46
 
41
- When the user intent remains open after clarification rounds, the assistant should still generate deterministic `flow.json` and include assumptions + confidence in the response handoff.
47
+ When clarification inputs remain incomplete, still generate deterministic `flow.json` and include assumptions + confidence in handoff summary.
@@ -0,0 +1,60 @@
1
+ # CLI Handoff Spec
2
+
3
+ Use this artifact to hand execution from `studioflow-author` to `studioflow-cli`.
4
+
5
+ Path:
6
+
7
+ - `artifacts/studioflow-cli-handoff.json`
8
+
9
+ ## JSON shape
10
+
11
+ ```json
12
+ {
13
+ "version": 1,
14
+ "intentSummary": "Record only onboarding + CRM in Demo Lab",
15
+ "flowPath": "artifacts/flow.json",
16
+ "recorder": "screenstudio",
17
+ "baseUrl": "http://localhost:4280",
18
+ "startCommand": "pnpm dev:demo-lab",
19
+ "healthPath": "/",
20
+ "runtimePacing": {
21
+ "profile": "standard",
22
+ "cursorMoveMs": 430,
23
+ "cursorHighlightMs": 170,
24
+ "typingDelayMs": 55,
25
+ "clickPulseMs": 220,
26
+ "stepPreDelayMs": 90,
27
+ "stepPostDelayMs": 130,
28
+ "stepDwellMs": 180
29
+ },
30
+ "notes": [
31
+ "Use deterministic artifact execution only."
32
+ ]
33
+ }
34
+ ```
35
+
36
+ ## Field rules
37
+
38
+ - `version`: integer, currently `1`.
39
+ - `intentSummary`: concise run label for CLI `--intent`.
40
+ - `flowPath`: deterministic artifact path. Default: `artifacts/flow.json`.
41
+ - `recorder`: recorder backend used by CLI `--recorder`.
42
+ - Allowed values: `quicktime`, `screenstudio`.
43
+ - Selection rule: if user explicitly requests Screen Studio/QuickTime, preserve that; otherwise default `quicktime`.
44
+ - `baseUrl`: runtime host URL.
45
+ - `startCommand`: command used when app is not already healthy.
46
+ - `healthPath`: health probe path used by runtime.
47
+ - `runtimePacing`: required runtime timing overrides derived from authored flow pacing.
48
+ - Allowed fields: `profile`, `cursorMoveMs`, `cursorHighlightMs`, `typingDelayMs`, `clickPulseMs`, `stepPreDelayMs`, `stepPostDelayMs`, `stepDwellMs`.
49
+ - `profile` values: `fast`, `standard`, `cinematic`.
50
+ - `notes`: optional operator notes.
51
+
52
+ ## Invocation contract
53
+
54
+ When handoff artifact is written and the user asked to run/record now, invoke `studioflow-cli` (or equivalent runtime workflow in same agent) to execute:
55
+
56
+ 1. `pnpm validate -- --flow <flowPath>`
57
+ 2. `pnpm demo -- --flow <flowPath> --intent "<intentSummary>" --recorder <recorder> --base-url <baseUrl> --start-command "<startCommand>" --health-path <healthPath>`
58
+ 3. Set matching `STUDIOFLOW_*` env vars from `runtimePacing` on the demo command.
59
+
60
+ Do not ask the user to translate handoff into commands.
@@ -7,12 +7,28 @@ description: Execute validated demo artifacts with StudioFlow CLI. Use when the
7
7
 
8
8
  Run validated artifacts through deterministic execution.
9
9
 
10
+ ## Sandbox Escalation (Required)
11
+
12
+ When executing StudioFlow CLI commands from Codex tool environments, run the commands below with `sandbox_permissions: require_escalated` on the first attempt. Do not run them in sandbox first and retry after failure.
13
+
14
+ - `pnpm install` (when dependencies are missing)
15
+ - `pnpm run setup`
16
+ - `pnpm run doctor`
17
+ - `pnpm quicktime-prep`
18
+ - `pnpm screenstudio-prep`
19
+ - `pnpm validate -- --flow <flowPath>`
20
+ - `pnpm demo -- --flow <flowPath> --intent "<intent-summary>" --recorder <recorder> --base-url <baseUrl> --start-command "<startCommand>" --health-path <healthPath>`
21
+
22
+ Reason: these commands can require network access, local IPC sockets (`tsx`), GUI automation, recorder control, and app process orchestration that are commonly blocked in sandboxed execution.
23
+
10
24
  ## Workflow
11
25
 
12
26
  0. Resolve handoff input (if present):
13
27
  - `artifacts/studioflow-cli-handoff.json`
14
28
 
15
29
  If handoff exists, use it as the source of truth for `flowPath`, `intentSummary`, `baseUrl`, `startCommand`, and `healthPath`.
30
+ Handoff may be produced by `studioflow-author`, or reused by `studioflow-investigate` when routing to execute-existing.
31
+ If handoff includes `recorder`, treat it as source of truth and preserve explicit user recorder choice.
16
32
  If present, also consume `runtimePacing` from handoff for runtime timing env values.
17
33
 
18
34
  1. Confirm artifact presence:
@@ -29,7 +45,14 @@ pnpm run setup
29
45
  pnpm run doctor
30
46
  ```
31
47
 
32
- If run preflight fails, collect explicit Screen Studio diagnostics:
48
+ If run preflight fails, collect recorder-specific diagnostics:
49
+ - For `recorder=quicktime`:
50
+
51
+ ```bash
52
+ pnpm quicktime-prep
53
+ ```
54
+
55
+ - For `recorder=screenstudio`:
33
56
 
34
57
  ```bash
35
58
  pnpm screenstudio-prep
@@ -44,10 +67,11 @@ pnpm validate -- --flow artifacts/flow.json
44
67
  4. Execute recording run from artifact:
45
68
 
46
69
  ```bash
47
- STUDIOFLOW_CURSOR_MOVE_MS=<cursorMoveMs> STUDIOFLOW_CURSOR_HIGHLIGHT_MS=<cursorHighlightMs> STUDIOFLOW_TYPING_DELAY_MS=<typingDelayMs> STUDIOFLOW_CLICK_PULSE_MS=<clickPulseMs> STUDIOFLOW_STEP_PRE_DELAY_MS=<stepPreDelayMs> STUDIOFLOW_STEP_POST_DELAY_MS=<stepPostDelayMs> STUDIOFLOW_STEP_DWELL_MS=<stepDwellMs> pnpm demo -- --flow <flowPath> --intent "<intent-summary>" --base-url <baseUrl> --start-command "<startCommand>" --health-path <healthPath>
70
+ STUDIOFLOW_CURSOR_MOVE_MS=<cursorMoveMs> STUDIOFLOW_CURSOR_HIGHLIGHT_MS=<cursorHighlightMs> STUDIOFLOW_TYPING_DELAY_MS=<typingDelayMs> STUDIOFLOW_CLICK_PULSE_MS=<clickPulseMs> STUDIOFLOW_STEP_PRE_DELAY_MS=<stepPreDelayMs> STUDIOFLOW_STEP_POST_DELAY_MS=<stepPostDelayMs> STUDIOFLOW_STEP_DWELL_MS=<stepDwellMs> pnpm demo -- --flow <flowPath> --intent "<intent-summary>" --recorder <recorder> --base-url <baseUrl> --start-command "<startCommand>" --health-path <healthPath>
48
71
  ```
49
72
 
50
73
  Only set timing env vars that are provided (or implied by selected run-feel profile) in handoff.
74
+ If `recorder` is missing from handoff, default to `quicktime`.
51
75
 
52
76
  5. Inspect outputs:
53
77
  - `<runsDir>/<run-id>/run.json`
@@ -1,6 +1,6 @@
1
1
  # Handoff Input Spec
2
2
 
3
- `studioflow-cli` accepts a runtime handoff file from `studioflow-investigate`:
3
+ `studioflow-cli` accepts a runtime handoff file from `studioflow-author` (or from `studioflow-investigate` when reusing existing artifacts):
4
4
 
5
5
  - `artifacts/studioflow-cli-handoff.json`
6
6
 
@@ -11,11 +11,12 @@
11
11
  "version": 1,
12
12
  "intentSummary": "Record only onboarding + CRM in Demo Lab",
13
13
  "flowPath": "artifacts/flow.json",
14
+ "recorder": "screenstudio",
14
15
  "baseUrl": "http://localhost:4280",
15
16
  "startCommand": "pnpm dev:demo-lab",
16
17
  "healthPath": "/",
17
18
  "runtimePacing": {
18
- "profile": "balanced",
19
+ "profile": "standard",
19
20
  "cursorMoveMs": 430,
20
21
  "cursorHighlightMs": 170,
21
22
  "typingDelayMs": 55,
@@ -33,18 +34,22 @@
33
34
  - `version`
34
35
  - `intentSummary`
35
36
  - `flowPath`
37
+ - `recorder`
36
38
  - `baseUrl`
37
39
  - `healthPath`
38
40
 
39
41
  `startCommand` is recommended. If omitted, runtime can still proceed when app is already healthy.
40
- `runtimePacing` is optional for conversation-driven speed tuning.
42
+ `recorder` values: `quicktime`, `screenstudio`. If missing, default to `quicktime`.
43
+ When intent explicitly names recorder software, preserve that recorder in handoff and execution.
44
+ `runtimePacing` should be present for investigate-generated handoff and should drive timing env vars directly.
45
+ Use `runtimePacing.profile` values `fast`, `standard`, `cinematic`.
41
46
 
42
47
  ## Execution mapping
43
48
 
44
49
  From payload, execute:
45
50
 
46
51
  1. `pnpm validate -- --flow <flowPath>`
47
- 2. `pnpm demo -- --flow <flowPath> --intent "<intentSummary>" --base-url <baseUrl> --start-command "<startCommand>" --health-path <healthPath>`
52
+ 2. `pnpm demo -- --flow <flowPath> --intent "<intentSummary>" --recorder <recorder> --base-url <baseUrl> --start-command "<startCommand>" --health-path <healthPath>`
48
53
  3. If `runtimePacing` exists, set mapped env vars on the `pnpm demo` command:
49
54
  - `STUDIOFLOW_CURSOR_MOVE_MS`
50
55
  - `STUDIOFLOW_CURSOR_HIGHLIGHT_MS`
@@ -54,4 +59,8 @@ From payload, execute:
54
59
  - `STUDIOFLOW_STEP_POST_DELAY_MS`
55
60
  - `STUDIOFLOW_STEP_DWELL_MS`
56
61
 
62
+ Preflight diagnostics mapping:
63
+ - `recorder=quicktime` -> `pnpm quicktime-prep`
64
+ - `recorder=screenstudio` -> `pnpm screenstudio-prep`
65
+
57
66
  If payload is missing, fall back to explicit user arguments or repo defaults.
@@ -0,0 +1,85 @@
1
+ ---
2
+ name: studioflow-investigate
3
+ description: Intake and route StudioFlow demo requests. Use when the user asks to run or record a demo from natural language and you must (1) clarify intent anchors, (2) decide whether existing artifacts already fit the request, and (3) route to `studioflow-author` (create/repair) or `studioflow-cli` (execute existing artifacts).
4
+ ---
5
+
6
+ # StudioFlow Investigate
7
+
8
+ Resolve intent and route execution to the right downstream skill.
9
+
10
+ ## Workflow
11
+
12
+ 1. Resolve intent specificity first.
13
+
14
+ Open-intent detection:
15
+ - Treat intent as open when one or more anchors are missing:
16
+ - `target_route`: where the flow should navigate
17
+ - `user_goal`: what user action/outcome to demonstrate
18
+ - `done_assertion`: what text/element proves completion
19
+
20
+ Recorder selection:
21
+ - Detect explicit recorder preference from user wording before authoring handoff:
22
+ - If intent says `screen studio` (or equivalent), set recorder to `screenstudio`.
23
+ - If intent says `quicktime` or `quicktime player`, set recorder to `quicktime`.
24
+ - If not specified, default to `quicktime`.
25
+ - Treat explicit user recorder wording as authoritative over defaults.
26
+
27
+ Clarification loop:
28
+ - Max 2 rounds.
29
+ - Ask 1-3 questions per round (adaptive; only missing high-impact fields).
30
+ - Question priority: `done_assertion` -> `target_route` -> `user_goal` -> optional inputs/scope.
31
+ - Infer run feel and pacing automatically from user intent + discovered UI complexity.
32
+ - Ask about run-feel preferences only when user intent explicitly asks for a style (for example: `fast`, `standard`, `cinematic`).
33
+ - If host supports structured question-card requests, emit payloads from `references/question-card-spec.md`.
34
+ - If structured cards are not supported, ask equivalent plain-language questions.
35
+ - Track known/missing fields using `references/clarification-state.md`.
36
+ - If anchors remain unclear after round 2, make a best-effort route decision with explicit assumptions.
37
+
38
+ 2. Evaluate current artifact readiness after clarification.
39
+
40
+ Check for:
41
+ - `artifacts/flow.json`
42
+ - optional `artifacts/studioflow-cli-handoff.json`
43
+ - optional `artifacts/bootstrap.json`
44
+ - optional `artifacts/structure-report.json`
45
+ - optional `artifacts/navigation-graph.json`
46
+
47
+ 3. Run intent-to-artifact fit evaluation using `references/artifact-fit-spec.md`.
48
+
49
+ Classify route:
50
+ - `execute-existing`: artifacts are present and intent fit is high enough to run safely.
51
+ - `patch-existing`: artifacts exist but require targeted edits.
52
+ - `create-new`: artifacts are missing or intent fit is low.
53
+
54
+ Write decision trace to:
55
+ - `artifacts/intent-fit-report.json`
56
+
57
+ 4. Route deterministically based on classification.
58
+
59
+ - For `execute-existing`:
60
+ - Invoke `studioflow-cli` immediately with existing artifacts and handoff/default runtime anchors.
61
+ - For `patch-existing` or `create-new`:
62
+ - Invoke `studioflow-author` to create/repair deterministic artifacts for this intent.
63
+ - After `studioflow-author` completes, invoke `studioflow-cli` in the same turn.
64
+
65
+ 5. Do not stop at command suggestions when the user asked to run/record a demo.
66
+
67
+ - If your host supports explicit skill invocation, invoke downstream skills directly.
68
+ - If explicit invocation is unavailable, execute equivalent workflows directly.
69
+
70
+ ## Output Requirements
71
+
72
+ Always produce:
73
+ 1. `artifacts/intent-fit-report.json`
74
+ 2. concise route decision (`execute-existing|patch-existing|create-new`)
75
+
76
+ Always include a concise handoff summary in the response:
77
+ - resolved intent anchors
78
+ - route decision and reason
79
+ - unresolved assumptions (if any)
80
+ - confidence (`high|medium|low`)
81
+
82
+ Use references in:
83
+ - `references/question-card-spec.md`
84
+ - `references/clarification-state.md`
85
+ - `references/artifact-fit-spec.md`
@@ -0,0 +1,73 @@
1
+ # Artifact Fit Spec
2
+
3
+ Use this rubric to decide whether existing artifacts satisfy the clarified demo intent.
4
+
5
+ ## Inputs
6
+
7
+ - Clarified intent anchors:
8
+ - `target_route`
9
+ - `user_goal`
10
+ - `done_assertion`
11
+ - `recorder_backend`
12
+ - optional run-feel/profile
13
+ - Existing artifacts (if present):
14
+ - `artifacts/flow.json`
15
+ - `artifacts/studioflow-cli-handoff.json`
16
+ - `artifacts/bootstrap.json`
17
+ - `artifacts/structure-report.json`
18
+ - `artifacts/navigation-graph.json`
19
+
20
+ ## Fit dimensions
21
+
22
+ Score each dimension as `pass|partial|fail`.
23
+
24
+ 1. Route coverage:
25
+ - `flow.json` steps reach the intended route/workspace.
26
+
27
+ 2. Goal coverage:
28
+ - Steps demonstrate the requested business outcome, not just generic navigation.
29
+
30
+ 3. Completion evidence:
31
+ - Assertions/screenshots prove the requested done state.
32
+
33
+ 4. Runtime anchors:
34
+ - `baseUrl`, `healthPath`, `startCommand` can be resolved from handoff/bootstrap/config.
35
+
36
+ 5. Recorder and style alignment:
37
+ - Recorder preference (`quicktime|screenstudio`) and pacing profile are preserved.
38
+
39
+ ## Route decision rules
40
+
41
+ - `execute-existing`:
42
+ - no `fail` dimensions
43
+ - at most one `partial`
44
+ - `patch-existing`:
45
+ - artifacts exist and deterministic edits are enough (selectors, assertions, pacing, minor scope drift)
46
+ - `create-new`:
47
+ - artifacts missing
48
+ - or core route/goal/done coverage is `fail`
49
+
50
+ ## Required output
51
+
52
+ Write `artifacts/intent-fit-report.json`:
53
+
54
+ ```json
55
+ {
56
+ "version": 1,
57
+ "decision": "execute-existing",
58
+ "confidence": "high",
59
+ "intentAnchors": {
60
+ "targetRoute": "/flows/crm",
61
+ "userGoal": "advance and create a CRM lead",
62
+ "doneAssertion": "Created L-300 for Aurora Systems.",
63
+ "recorder": "quicktime"
64
+ },
65
+ "dimensions": [
66
+ { "name": "route_coverage", "result": "pass", "notes": "Flow reaches /flows/crm." },
67
+ { "name": "goal_coverage", "result": "pass", "notes": "Includes lead advance and creation." }
68
+ ],
69
+ "reasons": ["Existing flow already matches clarified scope."]
70
+ }
71
+ ```
72
+
73
+ Keep notes concrete and tie them to selectors/steps whenever possible.