@iamu-dev/iamu 0.2.0-beta.5 → 0.2.0-beta.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.
@@ -127,19 +127,30 @@ Record it as a target string the run can carry, for example `sim://<device-name>
127
127
 
128
128
  **Then verify the starting state before spawning anyone.** Launch the app and take ONE screenshot confirming the product is where the scenario assumes it starts. Wait a few seconds after launch first: a screen rendered before its state lands shows the wrong thing, and verifying too early makes the verification itself lie — in the direction of "the harness is broken", which costs a debugging detour or, worse, waves a real seeding bug through.
129
129
 
130
- **Web: check the product is ready, not just up.** A server that answers is not a product that has its data. Before spawning the walker, confirm the thing the scenario depends on actually exists — the list the persona will open is populated, the seeded records are there, background setup (seeding, migrations, indexing) has finished. Use the project's documented readiness signal if it has one; otherwise look at one screen or one API response yourself. A walk started too early reports "the feature is missing" as a critical finding, and nothing in the walker's view distinguishes that from a real defect.
130
+ **Expected State & Semantic Squinting — verify environment before walking.** A scenario testing triage, review, or audits requires a populated, realistic system.
131
+ 1. **Expected State:** If the scenario defines `state.description`, verify the landing screen matches what the persona expects to see (e.g. populated register, open incidents). If the screen is completely blank and the persona cannot self-seed, stop early and report the run as blocked by missing preconditions rather than logging false product bugs.
132
+ 2. **Data Squinting & Approximation:** If the exact record described in the narrative is absent (e.g. no "damaged conveyor belt" hazard), the walker must follow `state.approximation` — "squint" at the real data, pick the closest plausible record (e.g. an active mechanical or safety hazard), and proceed with the evaluation/delegation workflow.
133
+ - **Squinting Guardrail:** Squinting is bounded to semantically related items within the same domain workflow. It does NOT permit drifting to unrelated modules (e.g. switching from risk assessment to user profile settings). If no plausible record exists, declare the run blocked.
134
+ 3. **Empty State Fallback:**
135
+ - If the database is empty and the persona role has creation rights (e.g. Manager or Reporter), the persona may create the minimal viable record in-character to proceed with the core test.
136
+ - If the persona role is read-only or subordinate (cannot self-seed), stop and report the run as blocked by preconditions.
131
137
 
132
138
  **Access — how the walker becomes this persona.** A walk as a forklift driver that runs with an administrator's session reports nothing true about what the driver can see or reach. Access is recorded in two places, and `iamu instructions walk` (step 4) returns both as `access`:
133
139
 
134
140
  - `access.project` — from `iamu/context.yml` `access`: HOW switching user is done in this product (a dev persona switcher, a storage key, seeded test accounts, a login form). Written once per project.
135
141
  - `access.persona` — from the persona file's `access`: WHICH user this persona is (an account name, a role, a switcher key).
136
142
 
137
- If both are present, use them as they are. If either is missing, fill the gap now and SAVE it so no later run has to ask:
143
+ **Interactive Auth Handshake (for enterprise auth, SSO, 2FA, BankID):**
144
+ If the product is behind enterprise login where automated dev persona switching is not configured:
145
+ 1. Open the browser to the target URL (`iamu browse start --run <run-id>` or browser tool).
146
+ 2. Prompt the human user:
147
+ > 👉 **Please log in as `<persona.role>` (`<persona.name>`) in the opened browser window.** Press Enter once you reach the dashboard to hand control to the walker...
148
+ 3. Wait for the user to confirm, then let the walker drive the authenticated session.
138
149
 
139
- 1. Check the project's own agent docs (`CLAUDE.md`, `AGENTS.md`, anything they point to for the dev environment) for a documented way to switch user or role.
140
- 2. Map the persona to the closest account or role the product actually has. If nothing fits, say so — a persona the product cannot represent is itself worth telling the user.
141
- 3. If the docs are silent, ask the user once. "No login, everyone is the same user" is a valid answer.
142
- 4. Write what you learned: the mechanism into `iamu/context.yml` as `access:`, the persona's own key into `iamu/personas/<slug>.md` frontmatter as `access:`. Passwords and tokens never go in either — name where they live (an env var, a vault entry) instead.
150
+ If automated switching exists:
151
+ 1. Check the project's own agent docs (`CLAUDE.md`, `AGENTS.md`) for a documented way to switch user or role.
152
+ 2. Map the persona to the closest account or role the product actually has. If nothing fits, say so.
153
+ 3. Write what you learned: the mechanism into `iamu/context.yml` as `access:`, the persona's own key into `iamu/personas/<slug>.md` frontmatter as `access:`. Passwords and tokens never go in either — name where they live (an env var, a vault entry) instead.
143
154
 
144
155
  Carry the result into the walking prompt as the `## Access` section: the exact steps to become the persona, with the instruction to do them BEFORE the first recorded step.
145
156
 
@@ -185,12 +196,16 @@ The result's `walker_prompt` is the walker's entire prompt. Pass it verbatim —
185
196
 
186
197
  A fresh subagent is NOT blind by default. On most hosts it still loads the project's agent instructions and can read files in the repo, so it may know the domain model, the route table, and why a screen was built the way it was — none of which the persona knows. The methodology's "Stay outside the product" rule is what keeps it honest; it is part of `walker_prompt` — never remove or soften it. If the host lets you restrict a subagent's tools, give the walker only the driving surface, file write/edit, and a shell for `iamu` commands.
187
198
 
199
+ **Model tiering & subagent dispatch:**
200
+ - **Walker (Browser Navigation):** High turn count, mechanical tool-use. Use the **fast** model tier (`flash` or `haiku`) by default to cut walk time by ~60% and conserve session quota.
201
+ - **Matcher & Judge:** Broad synthesis and semantic comparison. Use the **thorough** frontier tier (`pro`, `sonnet`, or active model) to prevent severity inflation.
202
+
188
203
  ```
189
204
  # In Claude Code:
190
- Agent({ description: "Walk <scenario-slug> as <persona.name>", prompt: "<walker_prompt, verbatim>" })
205
+ Agent({ description: "Walk <scenario-slug> as <persona.name>", model: "haiku", prompt: "<walker_prompt, verbatim>" })
191
206
 
192
207
  # In Antigravity / generic subagent hosts:
193
- invoke_subagent(Role="Persona Walker", Prompt="<walker_prompt, verbatim>")
208
+ invoke_subagent(Role="Persona Walker", Model="flash", Prompt="<walker_prompt, verbatim>")
194
209
  ```
195
210
 
196
211
  The subagent inherits the driving-surface tools and drives the product independently. It does not see this conversation.
@@ -202,7 +217,7 @@ The subagent inherits the driving-surface tools and drives the product independe
202
217
  - **Screenshot every 3-4 taps at most.** Batching more desyncs the moment an answer opens a screen she did not expect.
203
218
  - **Coordinates are device points, origin top-left.** A scaled screenshot must be mapped back to that space before tapping.
204
219
 
205
- **If subagent dispatch is not supported by your host editor** (e.g. standard Cursor without subagent tools), fall back to walking in the same context — but strictly adhere to the persona behavioral constraints in `walker_prompt`.
220
+ **If subagent dispatch or model-switching is not supported by your host editor** (e.g. standard Cursor / Windsurf single-session mode), fall back to walking directly in the current session (inheriting the active model) — but strictly adhere to the persona behavioral constraints in `walker_prompt`.
206
221
 
207
222
  After the walker returns, continue to the post-walk pipeline below.
208
223
 
@@ -269,7 +284,7 @@ This reads all steps, findings, and entity files, assembles `canonical.json`, ge
269
284
  iamu match <run-id> --json
270
285
  ```
271
286
 
272
- If `needed` is `false` (no earlier findings for this scenario, or none this run), skip to C. Otherwise, read the prompt from `iamu/.runs/<run-id>/match_prompt.md` directly and dispatch a matcher subagent with it as its only context. Write its JSON answer to `<matches.json>` and record it:
287
+ If `needed` is `false` (no earlier findings for this scenario, or none this run), skip to C. Otherwise, read the prompt from `iamu/.runs/<run-id>/match_prompt.md` directly and dispatch a matcher subagent with it as its only context (use the **thorough** model tier, e.g. `Model="pro"` in Antigravity, to accurately evaluate semantic equivalence). Write its JSON answer to `<matches.json>` and record it:
273
288
 
274
289
  ```bash
275
290
  iamu match-record <run-id> --file <matches.json>
@@ -283,7 +298,7 @@ This links recurrences to their earlier canonical finding, marks earlier finding
283
298
  iamu evaluate <run-id> --json
284
299
  ```
285
300
 
286
- Read the evaluation prompt from `iamu/.runs/<run-id>/judge_prompt.md` directly. Dispatch the evaluator as a subagent with that prompt. After the evaluator returns verdicts, record them locally with `--no-push`:
301
+ Read the evaluation prompt from `iamu/.runs/<run-id>/judge_prompt.md` directly. Dispatch the evaluator as a subagent with that prompt (use the **thorough** model tier, e.g. `Model="pro"` in Antigravity, to prevent severity inflation). After the evaluator returns verdicts, record them locally with `--no-push`:
287
302
 
288
303
  ```bash
289
304
  iamu evaluate-record <run-id> --file <verdicts.json> --no-prompt --no-push
@@ -34,7 +34,7 @@ Check whether `iamu/config.json` already exists:
34
34
 
35
35
  ### 2. Understand the project
36
36
 
37
- Explore the codebase automatically — do NOT ask the user what files to read. Build a **project-context summary** (3–6 sentences) the downstream skills will use as grounding. Read the following files when present:
37
+ Explore the codebase automatically — do NOT ask the user what files to read. Build a **substantive project description** that serves as the foundation for all downstream analysis (personas, scenarios, and walkthroughs). Read the following files when present:
38
38
 
39
39
  - `README.md`, `CLAUDE.md`, `agents.md`
40
40
  - Package manifests — `package.json`, `Cargo.toml`, `pyproject.toml`, `go.mod`
@@ -42,114 +42,131 @@ Explore the codebase automatically — do NOT ask the user what files to read. B
42
42
  - `docs/`, OpenAPI / JSON / GraphQL schemas, `src/`-style source directories
43
43
  - `.env.example`
44
44
 
45
- Extract these key dimensions:
45
+ **Quality Standard for Project Context (Knowledgeable Observer):**
46
+ Write as an objective domain expert describing the business and its users, NOT marketing jargon, cookie notices, or tech stack. Do NOT hedge with "appears to be" or "seems to".
46
47
 
47
- 1. **Domain & Purpose** — what this product does, core workflows, and problem space (mandatory).
48
- 2. **Jurisdiction & Regulations (`governed_by`)** — country/region and specific compliance frameworks (AFS 2023:2, GDPR, HIPAA, ISO 27001, etc.). **Strictly optional:** only extract if the repo explicitly references legal or compliance standards. Do NOT invent regulations for standard apps.
49
- 3. **Key Actors & Roles** — the main user archetypes and roles discovered in the codebase (auth models, routes, permissions).
50
- 4. **Dev Access & Auth** — how personas switch or log in during local dev/test (e.g. dev persona switcher, seeded accounts, storage key, mock headers). Essential for walkthrough automation.
51
- 5. **Key Terminology (`glossary`)** — 2–4 domain-specific terms or acronyms found in the codebase.
52
- 6. **Primary Personas** — determine the 1–2 most critical user archetypes that stress-test this product (e.g. End User / Frontline vs. Admin / Compliance, or First-Timer vs. Power User). Propose:
53
- - Name and Role
54
- - Disposition / perspective (patience level, tech literacy, primary friction triggers)
48
+ The description MUST capture four substantive dimensions:
49
+ 1. **What the product fundamentally IS** — core workflow, product type, and problem space.
50
+ 2. **Who actually uses it and what they come here to do** — enumerate the real user journeys (e.g. reporting incidents, triaging risks, delegating actions, auditing).
51
+ 3. **What makes THIS product specific** — geography, jurisdiction, regulatory mandates, or business model.
52
+ 4. **Operational characteristics** — how users physically and organizationally encounter the software (e.g. deskless frontline mobile workers in high-hazard environments, strict statutory completion deadlines, immutable audit trails).
55
53
 
56
- Do NOT collect code architecture (agent reads the codebase directly — tech stack doesn't affect walkthroughs).
54
+ *Example of target substance:*
55
+ > "IA-systemet is Sweden's national work environment and safety incident management platform, utilized by thousands of Swedish enterprises to comply with statutory systematic work environment requirements (AML / AFS). It enables frontline employees to quickly log near-misses (tillbud), workplace accidents (olycksfall), and risk observations from desktop or mobile devices in the field. Core user journeys include real-time hazard reporting, line manager root-cause investigations, safety committee review, and action plan delegation with statutory compliance tracking."
57
56
 
58
- **If there is no code (greenfield, design phase):** ask the user: what does this project do, who are the users, what domain, and are there any specific regulations?
57
+ Synthesize the project into a cohesive, substantive narrative (1–2 paragraphs):
58
+ - What the product fundamentally is, its primary domain, and who uses it.
59
+ - Key user journeys and operational characteristics (e.g. mobile floor use, audit deadlines).
60
+ - Market, geography, and specific compliance frameworks (only if evident).
59
61
 
60
- **Present the proposal with clean, structured Markdown for confirmation:**
62
+ Do NOT collect code architecture (agent reads the codebase directly — tech stack doesn't affect walkthroughs).
61
63
 
62
- ```markdown
63
- ### 📋 Discovered Project Context
64
+ **If there is no code (greenfield, design phase, or test sandbox):** do NOT interrogate the user with a multi-part survey or ask for dev auth plumbing. Ask for a single entry point:
65
+ > No local codebase detected. To seed context, provide one of:
66
+ > - A target URL (staging, production, or docs — e.g., `https://app.example.com`)
67
+ > - A one-sentence description of what this product does
68
+ > - Or type `"sandbox"` to seed a pre-configured B2B SaaS demo
64
69
 
65
- - **Domain & Purpose:** <Concise description of the product and problem space>
66
- - **Jurisdiction & Rules:** <Country/region and compliance frameworks, or "None identified">
67
- - **Key Roles Identified:** <List of detected roles and their responsibilities>
68
- - **Dev Access & Auth:** <Detected mechanism to switch/assume personas in dev, or "Standard login">
69
- - **Domain Terminology:** <2–4 key terms/acronyms found in the codebase, if any>
70
+ **Autonomous Enrichment:**
71
+ - **URL provided:** Fetch or search public marketing/docs for that site. Automatically extract the substantive narrative, core user journeys, and key actors. If industry regulations are obvious (e.g., healthcare/HIPAA, Swedish workplace safety/AML), include them in the narrative.
72
+ - **One-sentence summary provided:** Immediately expand into a full substantive narrative using domain knowledge.
73
+ - **"sandbox" provided:** Seed a standard B2B SaaS narrative with Admin and End-User roles.
74
+ - **Do NOT ask upfront about auth mechanics (`access`) or compliance frameworks (`governed_by`).** Infer if obvious, otherwise leave them blank.
70
75
 
71
- ---
76
+ **Present ONLY the narrative description for user confirmation (Do NOT include metadata bullets or personas):**
72
77
 
73
- ### 🎭 Proposed Primary Personas
74
-
75
- #### 1. <Name> — *<Role / Title>*
76
- - **Context & Usage:** <Where and how they use the app (e.g., mobile on the floor vs. desktop in office)>
77
- - **Disposition:** <Patience level, technical confidence, key motivations>
78
- - **Friction Triggers:** <Specific interactions that cause friction, drop-off, or failure>
78
+ ```markdown
79
+ ### 📋 Discovered Project Context
79
80
 
80
- #### 2. <Name> — *<Role / Title>*
81
- - **Context & Usage:** <Where and how they use the app>
82
- - **Disposition:** <Patience level, technical confidence, key motivations>
83
- - **Friction Triggers:** <Specific interactions that cause friction, drop-off, or failure>
81
+ <1–2 cohesive paragraphs written as a knowledgeable observer: what the product fundamentally is, who actually uses it, key user journeys, operational reality (e.g. mobile floor use, audit deadlines), and regulatory/market context. No marketing fluff, no hedging, no tech stack descriptions, and no bullet points.>
84
82
 
85
83
  ---
86
84
 
87
85
  **Next step:**
88
- Reply **"yes"** to save this context to `iamu/context.yml` and scaffold these personas, or tell me what to adjust (e.g., change roles, edit domain, or add/skip personas).
86
+ Reply **"yes"** to save this context to `iamu/context.yml`, or tell me what to adjust.
89
87
  ```
90
88
 
91
- Wait for the user to confirm or correct before writing. The user only needs to verify domain and choose whether to accept, edit, suggest alternative personas, or defer persona creation.
89
+ Wait for the user to confirm or correct before writing. The user only needs to verify the narrative description and choose whether to accept or edit.
92
90
 
93
- ### 3. Capture domain context and scaffold personas
91
+ ### 3. Capture domain context and seed personas (Two-Phase Confirmation)
94
92
 
95
- Persist the step-2 summary as structured fields so every scenario draft and walkthrough loads the same grounding. Downstream skills auto-read this file.
96
-
97
- 1. Check existing state by reading `iamu/context.yml` directly.
98
-
99
- 2. **Branch on what you find:**
100
-
101
- - **Empty / not present** → synthesize structured fields from step 2 and write `iamu/context.yml` with your file-editing tool (not a shell heredoc — it avoids permission prompts).
102
- - **Present but thin** (missing domain) → show what's missing and offer to fill it. User picks **refine** or **replace**.
103
- - **Present and complete** (domain set) → show summary and ask "Use as-is, refine, or replace?" Default is **skip**.
104
-
105
- 3. **Write `iamu/context.yml`**:
93
+ #### Phase A: Persist Context
94
+ Once the user confirms the narrative description:
95
+ 1. Derive the structured frontmatter fields (`domain`, `actors`, `jurisdiction`, `governed_by`) from the confirmed text, and write `iamu/context.yml` with your file-editing tool. Put structured fields in frontmatter and the substantive narrative in the markdown body below the `---`:
106
96
 
107
97
  ```yaml
108
98
  ---
109
99
  schema_version: 1
110
- domain: e-commerce storefront
111
- # jurisdiction: EU / US # optional
112
- # governed_by: # strictly optional - omit if not regulated
113
- # - name: GDPR
100
+ domain: workplace safety management
101
+ # jurisdiction: Sweden / EU # optional
102
+ # governed_by: # strictly optional - omit if not regulated
103
+ # - name: AFS 2023:2
114
104
  # authority_level: regulation
115
105
  actors:
116
106
  - name: Store Admin
117
107
  role: Manages catalog, inventory, and order fulfillment
118
108
  - name: First-Time Buyer
119
109
  role: Explores products, adds to cart, and checks out
120
- glossary:
121
- - term: SKU
122
- definition: Stock Keeping Unit
123
110
  access: >-
124
111
  No login in dev. In the page, set localStorage "dev_persona" to the
125
112
  persona's access value and reload.
126
113
  ---
114
+
115
+ <The substantive 1–2 paragraph project description and core user journeys>
127
116
  ```
128
117
 
129
118
  Rules:
130
119
  - `domain` — one line. Mandatory.
120
+ - Body markdown (below `---`) — substantive description and user journeys. Downstream skills read this as extended grounding.
131
121
  - `jurisdiction` — optional. Only if evident or relevant.
132
- - `governed_by[]` — strictly optional. Order by authority (legislation > regulation > standard > company_policy > guideline > informational). Specific names, not categories. Omit entirely if no regulations apply.
122
+ - `governed_by[]` — strictly optional. Order by authority. Omit entirely if no regulations apply.
133
123
  - `actors[]` — all identified roles and their responsibilities.
134
- - `glossary[]` — domain terms only. Thin is better than padded with generic terms.
135
- - `access` — optional. Only what the docs actually say; leave it out rather than guess. `iamu-run` fills it in on the first walk if it is missing.
124
+ - `access` — optional. Only what the docs actually say; leave it out rather than guess.
136
125
  - Do NOT add `industry` or `architecture` — these don't affect walkthroughs.
137
126
 
138
- 4. **Scaffold confirmed personas (unless `skip-personas` selected):**
127
+ #### Phase B: Persona Casting (Opt-In & Separate Confirmation)
128
+ Immediately after saving `iamu/context.yml`, ask the user if they want to seed baseline personas:
139
129
 
140
- Use the CLI to scaffold valid persona entities with schema-compliant UUIDs, slugs, frontmatter, and narrative body in a single command:
130
+ > Context saved to `iamu/context.yml`.
131
+ >
132
+ > Would you like to seed 1–2 baseline personas to your casting panel now?
133
+ > Reply **"yes"** to propose personas, or **"skip"** to create scenarios directly via `iamu-new`.
134
+
135
+ **If the user chooses "yes":**
136
+ Propose 1–2 primary personas grounded in the confirmed actors and operational characteristics:
137
+
138
+ ```markdown
139
+ ### 🎭 Proposed Primary Personas
140
+
141
+ #### 1. <Name> — *<Role / Title>*
142
+ - **Context & Usage:** <Where and how they use the app (e.g. mobile on the floor vs. desktop in office)>
143
+ - **Disposition:** <Patience level, technical confidence, key motivations>
144
+ - **Friction Triggers:** <Specific interactions that cause friction, drop-off, or failure>
145
+
146
+ #### 2. <Name> — *<Role / Title>*
147
+ - **Context & Usage:** <Where and how they use the app>
148
+ - **Disposition:** <Patience level, technical confidence, key motivations>
149
+ - **Friction Triggers:** <Specific interactions that cause friction, drop-off, or failure>
150
+
151
+ ---
152
+
153
+ **Next step:**
154
+ Reply **"yes"** to scaffold these personas into `iamu/personas/`, or tell me what to adjust.
155
+ ```
156
+
157
+ Wait for the user to confirm or adjust. Once confirmed:
158
+ 1. Scaffold personas using the CLI:
141
159
  ```bash
142
160
  iamu new persona --name "<Name>" --role "<Role>" --disposition "<Disposition>" --body "<2-4 sentence narrative detailing technical habits, patience level, and specific friction triggers>" [--access "<account-or-role>"] --json
143
161
  ```
144
-
145
- If `iamu/context.yml` specifies an `access` mechanism, pass `--access "<role>"` matching an existing product account/role.
146
-
147
- Once all confirmed personas are created, run validation once:
162
+ 2. Validate once:
148
163
  ```bash
149
164
  iamu validate --all
150
165
  ```
166
+ 3. Confirm: "Context saved and personas seeded in iamu/personas/. Run `iamu-new` to draft your first scenario."
151
167
 
152
- 5. Confirm: "Context saved and personas seeded in iamu/personas/. Run `iamu-new` to draft your first scenario." (or "Context saved. Run `iamu-new` to draft your first scenario." if personas were skipped).
168
+ **If the user chooses "skip":**
169
+ Confirm: "Context saved. Run `iamu-new` to draft your first scenario."
153
170
 
154
171
  ### 4. Offer cloud link (optional)
155
172
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iamu-dev/iamu",
3
- "version": "0.2.0-beta.5",
3
+ "version": "0.2.0-beta.7",
4
4
  "type": "module",
5
5
  "description": "Test your product as realistic personas — scenario-driven development CLI",
6
6
  "license": "UNLICENSED",
@@ -54,12 +54,13 @@
54
54
  "devDependencies": {
55
55
  "@types/node": "^22.0.0",
56
56
  "@vitest/coverage-v8": "^4.1.11",
57
+ "google-auth-library": "^11.1.0",
57
58
  "tsup": "^8.5.1",
58
59
  "typescript": "^5.8.0",
59
60
  "vitest": "^4.1.11",
60
61
  "@iamu-dev/local-store": "0.1.0",
61
- "@iamu/tsconfig": "0.1.0",
62
- "@iamu-dev/protocol": "0.1.0"
62
+ "@iamu-dev/protocol": "0.1.0",
63
+ "@iamu/tsconfig": "0.1.0"
63
64
  },
64
65
  "scripts": {
65
66
  "build": "tsup && tsc -b tsconfig.build.json --emitDeclarationOnly && node scripts/copy-assets.mjs",
@@ -67,6 +68,8 @@
67
68
  "typecheck": "tsc --noEmit",
68
69
  "test": "vitest run",
69
70
  "test:coverage": "vitest run --coverage",
71
+ "eval:walkthroughs": "vitest run --config vitest.benchmark.config.ts",
72
+ "eval:gemini": "node dist/eval/gemini-eval-cli.js",
70
73
  "pack:dry-run": "npm pack --dry-run"
71
74
  }
72
75
  }