@foldspace_npm/harness 0.1.12 → 0.1.14

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.
Files changed (2) hide show
  1. package/CLAUDE.md +69 -18
  2. package/package.json +1 -1
package/CLAUDE.md CHANGED
@@ -35,7 +35,7 @@ something they can **see on their own page** — not at "it builds".
35
35
  Before an unfamiliar harness operation, `npx foldspace help --json` is the
36
36
  current CLI contract — risk, prerequisites, effects, next step.
37
37
 
38
- ## Aim at a level, then choose the cheapest experience that reaches it
38
+ ## The first session has a fixed order
39
39
 
40
40
  | Level | Reached when |
41
41
  |---|---|
@@ -43,15 +43,34 @@ current CLI contract — risk, prerequisites, effects, next step.
43
43
  | **L1 · read settings** | the user's own account, plan or settings in a widget, showing their real values |
44
44
  | **L2 · look up entities** | a search from the user's own words, showing rows |
45
45
 
46
- Navigation, uploads, extraction and anything that writes are a later session.
47
- Say the target out loud, then offer three or four read-only experiences that
48
- reach it, **cheapest first**: an endpoint the profile already verifies the
49
- user's own data with no parameter (L1) a search with one parameter (L2).
50
- `discover_actions` gives candidates, not an inventory.
46
+ 1. **Get the agent live first (L0) - with no actions.** Straight after
47
+ orienting: `npm run build`, `npm run inject`, the human signs in to their
48
+ app, then `npx foldspace attach --daemon`. An empty registry is valid. L0
49
+ is `registration_ok` with the agent visible on their page - tell them to
50
+ look at it and say hello to it. **Do not explore the app first**: no
51
+ reading its bundle, no watching its traffic, no browsing its screens.
52
+ Nothing about L0 needs any of it, and minutes of silent investigation
53
+ before the human has seen anything is the wrong first impression.
54
+ 2. **Then offer experiences - from what you already have.** With the agent on
55
+ their screen, offer three or four read-only experiences as a choice,
56
+ recommended first. Sources: the conversation starters seeded at sign-up,
57
+ `discover_actions`, and `docs/app-profile.md`. `discover_actions` gives
58
+ candidates, not an inventory. Do not investigate the app to build this
59
+ list. Order them cheapest first: the user's own data with no parameter
60
+ (L1) before a search with one parameter (L2).
61
+ 3. **Only then observe - and only what the chosen experience needs** (**Find
62
+ the call yourself**). Check the row count as part of that: an experience
63
+ on a resource the account has zero of is a demo of an empty state, so say
64
+ so and offer the next one. On an empty account the useful first action is
65
+ one that creates data - say so instead.
66
+
67
+ **Say when the test window is yours, and when it is theirs.** You and the
68
+ human share one Chrome window. Before you start looking at the app or testing
69
+ in it: *"I'm going to work in that Chrome window for a few minutes - please
70
+ leave it alone until I tell you it's ready."* When it is their turn: *"It's
71
+ ready. Try asking: <the question this experience answers>."*
51
72
 
52
- **Check row counts before recommending.** An experience on a resource the
53
- account has zero of is a demo of an empty state. On an empty account the useful
54
- first action is one that creates data — say so instead.
73
+ Navigation, uploads, extraction and anything that writes are a later session.
55
74
 
56
75
  ### Ask as a choice, and ask almost nothing
57
76
 
@@ -63,7 +82,7 @@ question. Everything else — attach mode, folder, name, level — you **state a
63
82
  move on**.
64
83
 
65
84
  Then agree the experience in the customer's words, before creating anything:
66
- *"Show my plan and credits needs one thing the agent can call and one card to
85
+ *"Show my plan and credits needs one new action on your agent and one card to
67
86
  show it in. Sound right?"*
68
87
 
69
88
  ## Find the call yourself
@@ -73,10 +92,12 @@ and asking are not the only options — **observing is, and it comes first**:
73
92
 
74
93
  1. **Already known** — `docs/app-profile.md`. A verified endpoint needs no
75
94
  browsing.
76
- 2. **You drive.** `npm run inject`, the human signs in, and *you* go to the
77
- screen: read the app's bundle for API paths and watch the requests it makes
78
- (chrome-devtools MCP against the inject Chrome, or a page-context `fetch`,
79
- **before** `attach` owns the debug port). Read the auth method off a request
95
+ 2. **You drive - once they have chosen an experience.** The agent is already
96
+ attached from L0, and `attach` owns the debug port: `npx foldspace attach
97
+ --stop` first. Then *you* go to the one screen that experience needs: read
98
+ the app's bundle for API paths and watch the requests it makes
99
+ (chrome-devtools MCP against the inject Chrome, or a page-context
100
+ `fetch`). Attach again when you have the call. Read the auth method off a request
80
101
  the page already sent — bearer from `localStorage`, cookie, custom header.
81
102
  Delegate the watching to a read-only subagent so the traffic does not flood
82
103
  your context.
@@ -96,8 +117,13 @@ an assumption by quoting that file later.
96
117
 
97
118
  ## Build: objects first, code second
98
119
 
99
- Four kinds of thing. Never make the customer learn these words describe them
100
- by what they do.
120
+ Four kinds of thing. With the customer, use **Foldspace's own words** for what
121
+ they will see in Agent Studio - **action**, **task agent**, **navigation**,
122
+ **publish** - and say what each does the first time you use it. Never invent a
123
+ substitute: no "skill", "ability", "capability" or "tool", and no "switch on"
124
+ for publish. "Skill" already means something else in Claude, and the customer
125
+ has seen "Actions" at sign-up and in Agent Studio - a new word breaks the link
126
+ to what they know. The action handler is yours: call it "the code behind it".
101
127
 
102
128
  | Thing | Answers | Lives in | You write |
103
129
  |---|---|---|---|
@@ -172,8 +198,9 @@ npx foldspace attach --daemon
172
198
  ```
173
199
 
174
200
  `inject` launches an isolated Chrome profile and records its debug port; it
175
- loads nothing. Observe after inject and **before** attach, while chrome-devtools
176
- MCP can use the same Chrome. `attach` prepares the page and loads the local
201
+ loads nothing. In a first session `attach` comes straight after sign-in (L0);
202
+ to observe afterwards, `attach --stop`, use chrome-devtools MCP against the
203
+ same Chrome, then attach again. `attach` prepares the page and loads the local
177
204
  `dist/index.js` over CDP. Coding agents use `--daemon` so the tool returns after
178
205
  `[lifecycle] inspect_registration:…`. An empty local registry is valid; `npm run
179
206
  build` is still required so `dist/index.js` exists.
@@ -253,6 +280,22 @@ Lint catches some of these in handler code; Agent Studio copy is on you.
253
280
  - **Never send the user out of the host app.** No "open in <product>" button,
254
281
  no pasted URLs — navigate with a route, same tab.
255
282
 
283
+ ## Agentic UI components: what bites
284
+
285
+ An Agentic UI component is the card an action draws in the chat (`render`).
286
+ Each of these cost a real build.
287
+
288
+ - **Every path through `render` draws something.** An action that returns
289
+ without drawing leaves the slot spinning forever: nothing throws, the console
290
+ stays clean, and the action is recorded as succeeded. Only looking at it shows
291
+ the problem. Draw the empty or the failed state (`renderEmpty`,
292
+ `renderFailure`) - never nothing.
293
+ - **Totals and money are never computed by the model.** Compute them in the
294
+ action's code or in the component, from the API's own numbers, and show them
295
+ in the component. The action's instructions tell the model not to restate or
296
+ recompute them: a model that adds up line items will eventually add them up
297
+ wrong.
298
+
256
299
  ## Layout
257
300
 
258
301
  - `agent/actions/` — one handler per action (`execute`, optional `render`),
@@ -321,6 +364,14 @@ export { apiFetch } from "./api";
321
364
 
322
365
  ## Safety
323
366
 
367
+ - **A refusal is an answer.** When a command or tool call is declined - by the
368
+ human or by the session's own safety checks - stop. Say in one plain sentence
369
+ what you wanted it for, or take a narrower read-only route. Never retry it,
370
+ and never try a different command hoping it gets through.
371
+ - **Never create an account or a key** - not in Foldspace, not in the
372
+ customer's product, not anywhere. If one is missing, say which and where it
373
+ goes. **Never widen your own access**: if something is refused for a site or
374
+ a permission, say so and ask; do not try others.
324
375
  - Do not commit secrets, cookies, HAR files, browser storage, or
325
376
  `.foldspace-dev/`. Nothing transient goes in `docs/`.
326
377
  - Local handler changes are not cloud publication.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@foldspace_npm/harness",
3
- "version": "0.1.12",
3
+ "version": "0.1.14",
4
4
  "description": "Build and verify portable Foldspace action artifacts against a live app.",
5
5
  "type": "module",
6
6
  "bin": {