@nurix/etna 0.15.6 → 0.15.8
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/bin/etna.js +64 -13
- package/data/harness-index.json +7 -5
- package/data/harnesses/code/CLAUDE.md +3 -7
- package/data/harnesses/code/agents/harness-manager.md +4 -4
- package/data/harnesses/code/agents/maintenance.md +1 -1
- package/data/harnesses/code/harness.json +4 -3
- package/data/harnesses/code/hooks/hooks.json +3 -17
- package/data/harnesses/code/hooks/prompt-recall.js +157 -0
- package/data/harnesses/code/hooks/session-reflect.js +283 -0
- package/data/harnesses/code/skills/distiller/SKILL.md +62 -60
- package/data/harnesses/code/skills/distiller/references/docs-mode.md +21 -21
- package/data/harnesses/code/skills/distiller/references/method.md +41 -41
- package/data/harnesses/code/skills/documentation/references/templates.md +20 -27
- package/data/harnesses/code-fable/CLAUDE.md +138 -0
- package/data/harnesses/code-fable/agents/brainstorm.md +35 -0
- package/data/harnesses/code-fable/agents/change-review.md +249 -0
- package/data/harnesses/code-fable/agents/harness-manager.md +193 -0
- package/data/harnesses/code-fable/agents/maintenance.md +123 -0
- package/data/harnesses/code-fable/agents/performance-review.md +218 -0
- package/data/harnesses/code-fable/agents/spec-mode.md +56 -0
- package/data/harnesses/code-fable/harness.json +7 -0
- package/data/harnesses/code-fable/hooks/hooks.json +27 -0
- package/data/harnesses/code-fable/hooks/lib/redact.js +37 -0
- package/data/harnesses/code-fable/hooks/prompt-recall.js +157 -0
- package/data/harnesses/code-fable/hooks/session-reflect.js +283 -0
- package/data/harnesses/code-fable/rules/general.md +96 -0
- package/data/harnesses/code-fable/rules/nomenclature.md +34 -0
- package/data/harnesses/code-fable/skills/boundary/SKILL.md +262 -0
- package/data/harnesses/code-fable/skills/boundary/references/boundary-taxonomy.md +734 -0
- package/data/harnesses/code-fable/skills/brainstorm/README.md +136 -0
- package/data/harnesses/code-fable/skills/brainstorm/SKILL.md +135 -0
- package/data/harnesses/code-fable/skills/brainstorm/harvest.md +26 -0
- package/data/harnesses/code-fable/skills/brainstorm/templates/backlog.md +39 -0
- package/data/harnesses/code-fable/skills/brainstorm/templates/build.md +37 -0
- package/data/harnesses/code-fable/skills/brainstorm/templates/decisions.md +29 -0
- package/data/harnesses/code-fable/skills/brainstorm/templates/doctrine.md +31 -0
- package/data/harnesses/code-fable/skills/brainstorm/templates/domain-model.md +25 -0
- package/data/harnesses/code-fable/skills/brainstorm/templates/glossary.md +19 -0
- package/data/harnesses/code-fable/skills/brainstorm/templates/milestones.md +43 -0
- package/data/harnesses/code-fable/skills/brainstorm/templates/non-goals.md +21 -0
- package/data/harnesses/code-fable/skills/brainstorm/templates/plan-doc.md +61 -0
- package/data/harnesses/code-fable/skills/brainstorm/templates/questions.md +35 -0
- package/data/harnesses/code-fable/skills/brainstorm/templates/references.md +28 -0
- package/data/harnesses/code-fable/skills/brainstorm/templates/rejected.md +29 -0
- package/data/harnesses/code-fable/skills/brainstorm/templates/state.md +8 -0
- package/data/harnesses/code-fable/skills/brainstorm/templates/tech.md +23 -0
- package/data/harnesses/code-fable/skills/brainstorm/templates/thesis.md +21 -0
- package/data/harnesses/code-fable/skills/distiller/SKILL.md +219 -0
- package/data/harnesses/code-fable/skills/distiller/references/docs-mode.md +526 -0
- package/data/harnesses/code-fable/skills/distiller/references/method.md +166 -0
- package/data/harnesses/code-fable/skills/documentation/SKILL.md +127 -0
- package/data/harnesses/code-fable/skills/documentation/references/examples.md +193 -0
- package/data/harnesses/code-fable/skills/documentation/references/style-guide.md +288 -0
- package/data/harnesses/code-fable/skills/documentation/references/templates.md +942 -0
- package/data/harnesses/code-fable/skills/workflow-mapper/SKILL.md +430 -0
- package/data/harnesses/code-fable/skills/workflow-mapper/references/patterns.md +214 -0
- package/data/harnesses/discover/CLAUDE.md +180 -0
- package/data/harnesses/{re → discover}/agents/api.md +3 -3
- package/data/harnesses/{re → discover}/agents/codebase.md +3 -3
- package/data/harnesses/{re → discover}/agents/community.md +3 -3
- package/data/harnesses/{re → discover}/agents/deployed-client-bundle.md +21 -15
- package/data/harnesses/{re → discover}/agents/distribution-artifacts.md +13 -12
- package/data/harnesses/{re → discover}/agents/docs.md +3 -3
- package/data/harnesses/{re → discover}/agents/infra-backend-fingerprint.md +3 -3
- package/data/harnesses/{re → discover}/agents/packages.md +3 -3
- package/data/harnesses/{re → discover}/agents/session.md +29 -11
- package/data/harnesses/{re → discover}/agents/website.md +3 -3
- package/data/harnesses/{re → discover}/agents/wire-capture.md +14 -10
- package/data/harnesses/discover/harness.json +7 -0
- package/data/harnesses/{re/rules/re-discovery.md → discover/rules/discovery.md} +86 -17
- package/data/harnesses/{re/rules/re-evaluation.md → discover/rules/evaluation.md} +40 -4
- package/data/harnesses/discover/rules/ingestion.md +551 -0
- package/data/harnesses/discover/rules/self-correction.md +177 -0
- package/data/harnesses/discover/rules/tradecraft.md +532 -0
- package/data/harnesses/hr/CLAUDE.md +91 -0
- package/data/harnesses/hr/harness.json +7 -0
- package/data/harnesses/hr/skills/interview-eval/SKILL.md +118 -0
- package/data/harnesses/hr/skills/interview-eval/TEMPLATE.md +124 -0
- package/data/harnesses/hr/skills/interview-eval/extract_session.py +418 -0
- package/data/harnesses/hr/skills/interview-eval/rubric.md +219 -0
- package/data/harnesses/kb-agi/harness.json +1 -0
- package/package.json +1 -1
- package/data/harnesses/code/hooks/post-commit.js +0 -136
- package/data/harnesses/code/hooks/post-tool-failure.js +0 -136
- package/data/harnesses/code/hooks/session-stop.js +0 -207
- package/data/harnesses/re/CLAUDE.md +0 -146
- package/data/harnesses/re/harness.json +0 -6
- package/data/harnesses/re/rules/re-ingestion.md +0 -327
|
@@ -0,0 +1,551 @@
|
|
|
1
|
+
# Ingestion Contract — Capture Shape · Provenance · Ethics · Session Playbook
|
|
2
|
+
|
|
3
|
+
The reference knowledge for **Ingestion** (`discover` harness, Mode 2). Every dimension capture obeys the
|
|
4
|
+
contract in §1–8 so (a) the **evaluation** mode can rely on a stable shape and weight each claim by
|
|
5
|
+
*how it was obtained*, and (b) a future agent can reproduce or extend any capture. §9 carries the
|
|
6
|
+
deepest, gated dimension's method — the logged-in browser-session playbook — which the `session`
|
|
7
|
+
agent follows.
|
|
8
|
+
|
|
9
|
+
This contract generalizes the source playbook's three-format contract (`captures/*.md` narrative +
|
|
10
|
+
`raw/*.json` verbatim + `curls.md`) to *any* dimension.
|
|
11
|
+
|
|
12
|
+
> **Contract style = "lighter".** Provenance ("how it was captured") lives in the
|
|
13
|
+
> **`_summary.md` frontmatter**, not a separate `manifest.yaml`. There is no parallel YAML
|
|
14
|
+
> machine-spine — everything stays markdown-with-frontmatter. Evaluation reads the frontmatter
|
|
15
|
+
> to weight claims; self-correction reads it to detect under-delivery.
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## 1. Folder layout
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
research/<target>/dimensions/
|
|
23
|
+
├── _shared/ ← cross-dimension seam artifacts, ONE physical copy (see §6)
|
|
24
|
+
│ ├── api-path-catalog.md
|
|
25
|
+
│ └── feature-flags.md
|
|
26
|
+
└── <dimension>/
|
|
27
|
+
├── _summary.md ← decoded narrative + provenance frontmatter (human + machine read this)
|
|
28
|
+
└── raw/ ← verbatim artifacts, DIMENSION-PRIVATE (the reproducer reads these)
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Richer dimensions inherit the playbook contract (extra files, same `_summary.md` provenance):
|
|
32
|
+
- **session**: `dimensions/session/{_summary.md, captures/p*.md, raw/*.json, curls.md}`
|
|
33
|
+
- **wire-capture**: `dimensions/wire-capture/{_summary.md, captures/wire-narrative.md, raw/flows.json, curls.md}`
|
|
34
|
+
|
|
35
|
+
Two layout rules the seam and the "absence is a finding" principle depend on:
|
|
36
|
+
- **Shared-seam files live in `dimensions/_shared/`, one physical copy each — never under a single
|
|
37
|
+
dimension's `raw/`** (§6). Everything else under a dimension's `raw/` is **dimension-private by
|
|
38
|
+
default**; only the §6 allowlist (`api-path-catalog.md`, `feature-flags.md`) is shared.
|
|
39
|
+
- **A folded or absent dimension still leaves a record.** When a dimension is folded into another or
|
|
40
|
+
is absent, write a one-paragraph `_summary.md` with `status: folded` (naming the fold target) or
|
|
41
|
+
`status: absent` (+ the cheap evidence). "An absent dimension is a finding" must be **materialized
|
|
42
|
+
as a file**, never a silent drop.
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## 2. `_summary.md` — required shape (with provenance frontmatter)
|
|
47
|
+
|
|
48
|
+
```markdown
|
|
49
|
+
---
|
|
50
|
+
dimension: <codebase|docs|packages|api|website|community|session|deployed-client-bundle|infra-backend-fingerprint|wire-capture|distribution-artifacts>
|
|
51
|
+
target: <slug>
|
|
52
|
+
status: complete | partial | blocked
|
|
53
|
+
# --- provenance (the "how it was captured" layer evaluation weights on) ---
|
|
54
|
+
access_grade_used: <source:full | runtime:reachable | auth:have-login | presence:rich | ...>
|
|
55
|
+
method: <the ACTUAL extraction method — see §3 vocabulary>
|
|
56
|
+
completeness_pct: <0-100, honest self-estimate of reachable surface captured>
|
|
57
|
+
confidence: high | medium | low # how much to TRUST what was captured (see §3)
|
|
58
|
+
captured_at: <YYYY-MM-DD>
|
|
59
|
+
sources: [<urls / paths actually consulted>]
|
|
60
|
+
gaps: [<structured — each is a thing evaluation must NOT treat as covered>]
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
# <Target> — <Dimension> capture
|
|
64
|
+
|
|
65
|
+
## Method
|
|
66
|
+
Exactly what was done, which tools, what was skipped and why. (The prose behind the frontmatter `method`.)
|
|
67
|
+
|
|
68
|
+
## Findings
|
|
69
|
+
Ordered, concrete observations — real values (package names, versions, endpoint paths, file
|
|
70
|
+
paths, page URLs, prices). Tables liberally. The load-bearing section.
|
|
71
|
+
|
|
72
|
+
## Inferences
|
|
73
|
+
What the findings imply. Mark inference vs. fact.
|
|
74
|
+
|
|
75
|
+
## Open questions
|
|
76
|
+
What couldn't be captured and why. Never fabricate to fill a gap.
|
|
77
|
+
|
|
78
|
+
## Artifacts
|
|
79
|
+
Index of `raw/` files, one line each.
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Keep `status` and `confidence` honest — they drive the entire evaluation weighting.
|
|
83
|
+
|
|
84
|
+
---
|
|
85
|
+
|
|
86
|
+
## 3. Method & confidence vocabulary (drives evaluation weighting)
|
|
87
|
+
|
|
88
|
+
`method` is one of: `clone-and-map`, `source-map-reassembly`, `registry-metadata`,
|
|
89
|
+
`openapi-verbatim`, `graphql-introspection`, `crawl-clip`, `docs-reconstructed`,
|
|
90
|
+
`bundle-string-mine`, `dns-ct-fingerprint`, `wire-tap-browser`, `wire-har`, `wire-mitmproxy`,
|
|
91
|
+
`binary-extract` (asar/apk/crx), `session-playbook`, `sdk-harness`, `inferred`.
|
|
92
|
+
|
|
93
|
+
**Confidence is a function of method** (evaluation relies on this mapping):
|
|
94
|
+
- **high** — verbatim machine artifacts: `openapi-verbatim`, `graphql-introspection`, `registry-metadata`, `clone-and-map`, `binary-extract`.
|
|
95
|
+
- **medium** — `crawl-clip`, `docs-reconstructed`, `bundle-string-mine`, `dns-ct-fingerprint`, `wire-har`.
|
|
96
|
+
- **low** — `inferred`, `session-playbook` Pass-1-only, `wire-tap-browser` shapes-only, any wire-drift observation without a spec.
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
## 4. `raw/*` — required shape
|
|
101
|
+
|
|
102
|
+
Structured captures (API responses, registry metadata, schemas) → JSON with a `_meta` header:
|
|
103
|
+
```json
|
|
104
|
+
{
|
|
105
|
+
"_meta": { "source": "...", "captured_at": "YYYY-MM-DD", "kind": "...", "byte_length": 0, "redactions": ["field → <REDACTED:...>"] },
|
|
106
|
+
"body": { /* verbatim, PII + secrets redacted */ },
|
|
107
|
+
"_decoded": { "field": "meaning + observed values" },
|
|
108
|
+
"_observation": "optional — what's load-bearing"
|
|
109
|
+
}
|
|
110
|
+
```
|
|
111
|
+
Prose captures (doc/marketing pages, structure maps, catalogs) → markdown with a metadata line:
|
|
112
|
+
`<!-- source: <url-or-path> · captured_at: YYYY-MM-DD · method: <method> -->`
|
|
113
|
+
|
|
114
|
+
**One file per logical artifact**, named by what it is (`endpoint-catalog.md`, `react-exports.md`,
|
|
115
|
+
`pricing.md`, `structure-map.md`).
|
|
116
|
+
|
|
117
|
+
---
|
|
118
|
+
|
|
119
|
+
## 5. Size discipline — reduce, don't dump
|
|
120
|
+
|
|
121
|
+
Large artifacts (a 3 MB bundle, a 5 MB response, a 700-page sitemap) are **digested**, not pasted:
|
|
122
|
+
the schema/shape, enum distributions, one redacted representative sample, counts. A `raw/` file is
|
|
123
|
+
readable, not a memory dump. Set `digested: true` context in the artifact's `_meta`.
|
|
124
|
+
|
|
125
|
+
---
|
|
126
|
+
|
|
127
|
+
## 6. The shared-surface seam rule (bundle ↔ session ↔ wire-capture)
|
|
128
|
+
|
|
129
|
+
`deployed-client-bundle` (static unauth SPA), `session` (authenticated browser runtime), and
|
|
130
|
+
`wire-capture` (non-browser client) can all surface the same **API path catalog** and **feature
|
|
131
|
+
flags**. To keep them consumable instead of triplicated **N times** (a real run forked
|
|
132
|
+
`api-path-catalog.md` up to 7×, and "two copies agree" then mis-reads as corroboration):
|
|
133
|
+
|
|
134
|
+
- **One physical file, one canonical location, append-only.** The seam files live at
|
|
135
|
+
`dimensions/_shared/api-path-catalog.md` and `dimensions/_shared/feature-flags.md` — **Ingestion
|
|
136
|
+
seeds the two empty files (with a header) once, before the collector fan-out.** Every contributing
|
|
137
|
+
dimension **appends a `source:`-tagged section** (`source: bundle | session | wire | distribution`)
|
|
138
|
+
and **never creates its own copy**; each collector's `_summary.md` Artifacts list **links** the shared
|
|
139
|
+
file rather than duplicating it. **Shared-seam allowlist:** these two filenames are the *only*
|
|
140
|
+
shared/single-physical artifacts — every other `raw/*` is dimension-private.
|
|
141
|
+
- Evaluation owns the **API-path diff** (an *adaptive N-way* diff over whichever runtime sources were
|
|
142
|
+
actually run — see evaluation template 3) in `data-model-api-surface.md`. A path that appears in
|
|
143
|
+
`bundle` but never in `session`/`wire` is a dormant/unshipped route — a finding, not noise.
|
|
144
|
+
|
|
145
|
+
> **Same artifact ⇒ ONE source (never independent corroboration).** Two dimensions that string-mine
|
|
146
|
+
> the *same* static asset (one bundle / one spec / one binary) are **one source** for the promotion
|
|
147
|
+
> rule — never a confidence band-bump — and their divergent counts are a **reported range, not a
|
|
148
|
+
> flagged conflict.** Name **one owner dimension per asset**: when `source:none` and no machine spec
|
|
149
|
+
> is served, `deployed-client-bundle` **owns** the app-API bundle mine, and `api` is re-scoped to the
|
|
150
|
+
> *published/partner* spec only (or marked `partial` if none is served) — the others **cite the owner
|
|
151
|
+
> by path and do not re-mine**.
|
|
152
|
+
|
|
153
|
+
> **Published API ≠ the app's own API.** A product's developer/REST/MCP surface (`api`/`docs`/`packages`
|
|
154
|
+
> dims) is frequently *not* the API its own app runs on (`session`/`bundle` dims) — different protocol,
|
|
155
|
+
> host, and operation set. Always diff the two: operations the app uses but the public API omits, **and**
|
|
156
|
+
> public operations the app never calls, are both findings. The published surface is the integration
|
|
157
|
+
> story; the runtime surface is the real architecture. When a published API exists, Evaluation emits
|
|
158
|
+
> this split as a *named* output, not inline prose (evaluation template 3).
|
|
159
|
+
|
|
160
|
+
---
|
|
161
|
+
|
|
162
|
+
## 7. Ethics & redaction (non-negotiable — binds EVERY dimension)
|
|
163
|
+
|
|
164
|
+
Violating them voids the work. Rules 2–3 are enforced by the **runnable redaction layer in §7.0** —
|
|
165
|
+
install it inside the tap wrapper so no secret can reach `raw/` in the first place.
|
|
166
|
+
|
|
167
|
+
1. **Never enter credentials.** The user signs into any logged-in surface beforehand.
|
|
168
|
+
2. **Storage: shape, not values.** No raw cookies/tokens/JWT-signatures. Decode JWT *structure* with identity claims (`sub`,`email`,`phone`,`user_id`,`uid`,`sid`) redacted.
|
|
169
|
+
3. **Never save secrets.** Before any `raw/` write, redact every credential-shaped field → `<REDACTED:...>` + log in `_meta.redactions`. Field patterns: `api_key`,`*_secret`,`client_secret`,`webhook_secret`,`signing_*`,`password`,`private_key`,`access_token`/`refresh_token` in bodies, vendor-named secrets. Value patterns: `sk_live_…`/`pk_live_…` (Stripe), `sk-…` (OpenAI), `xox[bp]-…` (Slack), `AKIA…` (AWS), `gh[ps]_…` (GitHub), `AIza…` (Google), `eyJ…` (JWT), opaque base64 ≥32 chars in a credential field. Over-redact when unsure. **The executable scrubbers that enforce this rule are in §7.0 below** (`SCRUB` / `redactSecrets` / `ULTRA`); the full keyboard layer lives in `tradecraft.md`.
|
|
170
|
+
4. **Confirm before state changes** — anything that creates state, costs money, or is visible to others (even a draft toggle). State the exact action + estimated cost.
|
|
171
|
+
5. **No destructive actions.** Document the absence; move on.
|
|
172
|
+
6. **No bypassing safety harnesses** — redact, never evade.
|
|
173
|
+
7. **No exfiltration.** Captures stay local under `research/<target>/`.
|
|
174
|
+
8. **Respect TOS & robots.** For spec-writing / integration / competitive analysis — not credential theft, rate-limit bypass, or scraping.
|
|
175
|
+
9. **One browser-driving dimension at a time.** Chrome MCP is a shared singleton. Only the gated `session`/`wire-capture` dimensions drive the browser; parallel non-browser collectors use WebFetch/curl, or — if a page genuinely needs a real browser — create their **own** tab and never touch the session tab. Never run two browser-driving collectors concurrently.
|
|
176
|
+
10. **Verify an absence before asserting it.** A "host is NXDOMAIN / dimension is absent / endpoint 404s everywhere" claim that would *contradict another dimension* must be re-checked by a **second method** (alternate resolver, direct HTTP probe, second source) before it is written as fact. A single-resolver/single-probe negative is recorded as *tentative*, never as a cross-dimension directive. (An HTTP 4xx/5xx means the host **resolves** — present, not absent.) **Feedback-channel / changelog absence (`community`): a 404 on the marketing host's `/changelog` is NOT proof of "no public feedback loop"** — before asserting it, probe the common alternate homes: `feedback.`/`changelog.`/`updates.`/`roadmap.` subdomains, hosted boards (FeatureOS/Canny/Featurebase), a status-page "announcements" tab, and `<link rel="alternate" type="application/rss+xml">` autodiscovery on the docs/blog. Only after those miss is the closed-feedback cap (evaluation) warranted; a wrong-host 404 alone leaves it *tentative*.
|
|
177
|
+
11. **Bounded live-token use (read-only, in-page only).** To fill a Pass-1 capture gap you MAY read the live token from its store and replay a **read-only** request with it — *only* if the token is used **in-page / in-process only**, is **never written to `raw/`, never returned, never logged**, and the replay changes no state. This is the single permitted touch of a live credential; rules 2–3 (shape-not-values, never-save-secrets) still bind everything written to disk.
|
|
178
|
+
|
|
179
|
+
### 7.0 Redaction — runnable (the executable layer behind rule 3)
|
|
180
|
+
|
|
181
|
+
These are **executable guardrails**, not prose policy. Install them **inside the tap/fetch wrapper** so every captured string is scrubbed *before it reaches the harness or disk* — credentials never reach `raw/`, and the browser MCP's content-block (`[BLOCKED: Cookie/query string data]`) never fires on a legitimate capture. Run `SCRUB(value)` on every string returned from a `javascript_tool` capture; run `redactSecrets(body, redactions)` on every object before any `Write` of `raw/*.json`; fall back to `ULTRA` only when the harness still blocks output.
|
|
182
|
+
|
|
183
|
+
#### 1. `SCRUB` — the value-shape scrubber (run on every captured string)
|
|
184
|
+
|
|
185
|
+
Combine into one `SCRUB` function and apply to every string returned from `javascript_tool`. It neutralises PII + provider-credential value shapes regardless of field name (catches credentials embedded in string concatenations like a deep-link URL or a log line):
|
|
186
|
+
|
|
187
|
+
```js
|
|
188
|
+
const SCRUB = (s) => String(s||'')
|
|
189
|
+
.replace(/eyJ[A-Za-z0-9_\-]+\.[A-Za-z0-9_\-]+\.[A-Za-z0-9_\-]+/g, '<jwt>')
|
|
190
|
+
.replace(/[A-Za-z0-9+/]{40,}={0,2}/g, '<b64>')
|
|
191
|
+
.replace(/data:image\/[^"]+/g, '<data-image>')
|
|
192
|
+
.replace(/\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}\b/g, '<email>')
|
|
193
|
+
.replace(/[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}/g, '<uuid>')
|
|
194
|
+
.replace(/[a-f0-9]{32,}/g, '<hex>')
|
|
195
|
+
.replace(/(user|org|ins|sess|cli)_[A-Za-z0-9]{20,}/g, '.$1id.') // Clerk-style IDs
|
|
196
|
+
.replace(/\+91\d{10}/g, '<phone-in>') // Indian phone numbers
|
|
197
|
+
.replace(/\+1\d{10}/g, '<phone-us>') // US phone numbers
|
|
198
|
+
.replace(/\b\d{10,15}\b/g, '<phone>') // generic numeric phone
|
|
199
|
+
.replace(/[?&]([a-z_]+)=([^&\s"]+)/gi, (_,k,v) => '?'+k+'=<v>');
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
The regex table behind `SCRUB` (PII value shapes + known provider-key prefixes), so a new run can extend it:
|
|
203
|
+
|
|
204
|
+
| Pattern | Replacement | Catches |
|
|
205
|
+
|---------|-------------|---------|
|
|
206
|
+
| `eyJ[A-Za-z0-9_\-]+\.[A-Za-z0-9_\-]+\.[A-Za-z0-9_\-]+` | `<jwt>` | JWT tokens (3-segment base64) |
|
|
207
|
+
| `[A-Za-z0-9+/]{40,}={0,2}` | `<b64>` | Long base64 |
|
|
208
|
+
| `data:image/[^"]+` | `<data-image>` | Inline image data URIs |
|
|
209
|
+
| `[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}` | `<uuid>` | UUIDs |
|
|
210
|
+
| `[a-f0-9]{32,}` | `<hex>` | Long hex strings (hashes) |
|
|
211
|
+
| `(user\|org\|ins\|sess\|cli)_[A-Za-z0-9]{20,}` | `.<group>id.` | Clerk-style IDs |
|
|
212
|
+
| `\+91\d{10}` | `<phone-in>` | Indian phone numbers |
|
|
213
|
+
| `\+1\d{10}` | `<phone-us>` | US phone numbers |
|
|
214
|
+
| `\b\d{10,15}\b` | `<phone>` | Generic numeric phone |
|
|
215
|
+
| `\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}\b` | `<email>` | Email addresses |
|
|
216
|
+
| `[?&]([a-z_]+)=([^&\s"]+)` | `?$1=<v>` | Query string values |
|
|
217
|
+
| `sk_(live\|test)_[A-Za-z0-9]{16,}` | `<REDACTED:STRIPE_SK>` | Stripe secret key |
|
|
218
|
+
| `(rk\|pk)_(live\|test)_[A-Za-z0-9]{16,}` | `<REDACTED:STRIPE_KEY>` | Stripe restricted / publishable key |
|
|
219
|
+
| `sk-(proj-)?[A-Za-z0-9_\-]{20,}` | `<REDACTED:OPENAI>` | OpenAI API key (incl. project-scoped) |
|
|
220
|
+
| `xox[bpoars]-[A-Za-z0-9-]{10,}` | `<REDACTED:SLACK>` | Slack token |
|
|
221
|
+
| `\b(AKIA\|ASIA)[A-Z0-9]{16}\b` | `<REDACTED:AWS_KEY_ID>` | AWS access key ID (long-lived + temporary) |
|
|
222
|
+
| `gh[pousr]_[A-Za-z0-9]{30,}` | `<REDACTED:GITHUB>` | GitHub PAT / OAuth / refresh / server token |
|
|
223
|
+
| `AIza[0-9A-Za-z_\-]{35}` | `<REDACTED:GOOGLE>` | Google API key |
|
|
224
|
+
|
|
225
|
+
#### 2. `redactSecrets` — the field-name walker (run before every `raw/*.json` write)
|
|
226
|
+
|
|
227
|
+
`SCRUB` catches known value *shapes*; some providers use opaque base64 tokens with **no recognisable prefix**, so you also need a recursive walker that redacts by **key name** regardless of value shape. Run both — `SCRUB` on captured strings, `redactSecrets` on the parsed object before any `Write`:
|
|
228
|
+
|
|
229
|
+
```js
|
|
230
|
+
const SECRET_KEY_RE = /(api[_-]?key|apikey|secret|password|passphrase|pwd|client[_-]?secret|webhook[_-]?secret|signing[_-]?(?:key|secret)|private[_-]?key|service[_-]?account[_-]?key|access[_-]?token|refresh[_-]?token|bearer[_-]?token|auth[_-]?token)$/i;
|
|
231
|
+
|
|
232
|
+
function redactSecrets(obj, redactions) {
|
|
233
|
+
if (obj === null || typeof obj !== 'object') return obj;
|
|
234
|
+
if (Array.isArray(obj)) return obj.map(v => redactSecrets(v, redactions));
|
|
235
|
+
const out = {};
|
|
236
|
+
for (const [k, v] of Object.entries(obj)) {
|
|
237
|
+
if (typeof v === 'string' && SECRET_KEY_RE.test(k) && v.length > 0) {
|
|
238
|
+
redactions.push(`${k} → <REDACTED:SECRET> (was ${v.length} chars)`);
|
|
239
|
+
out[k] = '<REDACTED:SECRET>';
|
|
240
|
+
} else {
|
|
241
|
+
out[k] = redactSecrets(v, redactions);
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
return out;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
// Use:
|
|
248
|
+
const redactions = [];
|
|
249
|
+
const safeBody = redactSecrets(rawBody, redactions);
|
|
250
|
+
// Then write { _meta: { ..., redactions }, body: safeBody, _decoded_fields: {...} }
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
At run time, append the **current session's** own identifiers (your user UUID, email, display name,
|
|
254
|
+
org slug) as explicit `.replace(...)` lines in a final pass over the serialized output — but **never
|
|
255
|
+
commit those literal values into this file.** The generic UUID / email / phone / Clerk-ID patterns
|
|
256
|
+
above already neutralise them; the explicit pass is a belt-and-suspenders step that stays local to the
|
|
257
|
+
run.
|
|
258
|
+
|
|
259
|
+
For a logged-in session, also redact: the user's display name, the user's avatar URL, any organisation slug (`org_slug` claim) the user might want hidden, and phone numbers at any masking level. Over-redaction is cheap; a leaked partner API key is not.
|
|
260
|
+
|
|
261
|
+
#### 3. `ULTRA` — the last-resort scrubber (when the harness still blocks output)
|
|
262
|
+
|
|
263
|
+
When `SCRUB` isn't enough (e.g. the body has agent-generated content with patterns that match the blocklist), drop to a regex that strips everything except readable ASCII:
|
|
264
|
+
|
|
265
|
+
```js
|
|
266
|
+
const ULTRA = (s) => String(s||'').replace(/[^a-zA-Z0-9 _.,:!?\-/]/g,'.');
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
You lose JSON braces and special characters, but you keep the **structural information** (field names, enum values, lengths) — useful for getting any output at all when the body is irretrievably full of blocked patterns.
|
|
270
|
+
|
|
271
|
+
#### 4. PII / value-shape coverage (what these patterns neutralise)
|
|
272
|
+
|
|
273
|
+
- **JWTs** — 3-segment base64 `eyJ…` anywhere (body fields, not just `Authorization`).
|
|
274
|
+
- **Phone numbers** — Indian `+91` (10 digits), US `+1` (10 digits), and generic 10–15-digit numeric.
|
|
275
|
+
- **Emails** — `local@domain.tld` (and the user's own specific address explicitly).
|
|
276
|
+
- **UUIDs** — canonical `8-4-4-4-12` hex (and the user's own specific user UUID explicitly).
|
|
277
|
+
- **Clerk-style IDs** — `user_` / `org_` / `ins_` / `sess_` / `cli_` + 20+ chars.
|
|
278
|
+
- **Query-string values** — every `?k=v` / `&k=v` value collapsed to `?k=<v>`.
|
|
279
|
+
- **Long base64 / long hex** — `≥40`-char base64 and `≥32`-char hex (hashes, opaque tokens).
|
|
280
|
+
- **Inline image data URIs** — `data:image/…`.
|
|
281
|
+
- **Provider key prefixes** — Stripe (`sk_`/`rk_`/`pk_`), OpenAI (`sk-`/`sk-proj-`), Slack (`xox*`), AWS (`AKIA`/`ASIA`), GitHub (`gh[pousr]_`), Google (`AIza`).
|
|
282
|
+
|
|
283
|
+
#### 5. Maintenance loop
|
|
284
|
+
|
|
285
|
+
When a run uncovers a new key or value shape (a regional BSP / telephony token, a niche analytics SDK key, an internal-tool API, an opaquely-named credential field), **add the regex to the `SCRUB` table here** (and the field name to `SECRET_KEY_RE` if it's name-based) — the layer only stays a real guardrail if every new shape is folded back in.
|
|
286
|
+
|
|
287
|
+
### 7.1 wire-capture & active-interception ethics (the strictest tier)
|
|
288
|
+
|
|
289
|
+
The `wire-capture` dimension climbs a **3-rung ladder, lowest privilege first**, and records the
|
|
290
|
+
chosen rung in `_meta`:
|
|
291
|
+
|
|
292
|
+
1. **Browser network tap (default, unauth).** Chrome `read_network_requests` + the in-page
|
|
293
|
+
fetch/XHR interceptor on the **public** surface only. Capture request/response *shapes*; redact
|
|
294
|
+
in the wrapper before disk. No login. → `method: wire-tap-browser`.
|
|
295
|
+
2. **HAR export.** Export DevTools HAR of the unauth SPA's XHRs, digest to an endpoint catalog,
|
|
296
|
+
scrub `Authorization`/`Cookie`/secret-shaped values. → `method: wire-har`.
|
|
297
|
+
3. **mitmproxy / intercepting proxy — GATED, opt-in, user-run.** ONLY first-party traffic the
|
|
298
|
+
**user owns** (their own desktop/mobile/CLI client), ONLY with explicit chat authorization, ONLY
|
|
299
|
+
TOS-checked. The harness NEVER stands up a proxy against a third party's infra unattended; the
|
|
300
|
+
*user* installs the CA and routes their client — the agent only ingests exported flows. →
|
|
301
|
+
`method: wire-mitmproxy`. Same explicit-authorization loop as session Pass-2.
|
|
302
|
+
|
|
303
|
+
> **Rung 3+ — the first-party SDK-harness lane (the deepest method for a closed runtime that PUBLISHES
|
|
304
|
+
> an SDK).** When the product ships an official client SDK (npm / PyPI / Maven / …) and the *user* can
|
|
305
|
+
> provision credentials (free tier / trial), the deepest no-source method is not to intercept the
|
|
306
|
+
> *vendor's* app but to **scaffold a minimal throw-away app with the product's OWN SDK + the user's keys,
|
|
307
|
+
> run it, and instrument the client you control**: inject fetch/WS/EventSource taps at `document_start`
|
|
308
|
+
> (so there is **no interceptor-timing problem** — you wrap the constructors before any connection
|
|
309
|
+
> opens), observe every request/response shape, and — with the user routing it through *their own*
|
|
310
|
+
> mitmproxy — the fully-decoded wire. Because you **own** the client, there is no third-party-traffic
|
|
311
|
+
> concern and no missed on-load socket. **Gated exactly like rung 3 / session Pass-2:** the *user*
|
|
312
|
+
> provisions the account + keys and runs any proxy; the **agent never self-signs-up and never enters
|
|
313
|
+
> credentials**, only scaffolds + instruments, and confirms any cost/quota first. → `method: sdk-harness`
|
|
314
|
+
> (a first-party runtime lane; confidence = what is actually observed, typically high since you control
|
|
315
|
+
> the client). Especially powerful for `runtime:reachable + source:none` targets whose published SDK is
|
|
316
|
+
> the only public mirror of the runtime — and it independently corroborates the `api`/`packages` lanes.
|
|
317
|
+
|
|
318
|
+
> **Never fold a browser-rung into a non-browser (curl/WebFetch) collector.** Rung 1 *is* a browser tap,
|
|
319
|
+
> and the browser is a singleton owned by `session`/`wire-capture` — routing it to a curl collector
|
|
320
|
+
> produces zero `source: wire` rows (a real run did exactly this). When `wire-capture` is **folded**,
|
|
321
|
+
> the rung-1 tap is the **in-page interceptor that `session` already installs**: `session` appends its
|
|
322
|
+
> observed paths to `dimensions/_shared/api-path-catalog.md` as `source: wire`. A folded `wire-capture`
|
|
323
|
+
> still leaves a one-paragraph `_summary.md` (`status: folded`, naming the fold target) per §1 —
|
|
324
|
+
> "folded" is recorded, never silently dropped.
|
|
325
|
+
|
|
326
|
+
> Wireshark / packet capture is explicitly **not** used: for HTTPS it yields only TLS ciphertext,
|
|
327
|
+
> and a packet sweep of a third party is the bright line this harness will not cross.
|
|
328
|
+
|
|
329
|
+
### 7.2 distribution-artifacts ethics
|
|
330
|
+
Downloading a public binary (CRX/`.asar`/`.ipa`/`.apk`) and reading its manifest/strings is fine.
|
|
331
|
+
But binary **decompilation** can cross from "inspect" to "decompile in violation of EULA":
|
|
332
|
+
the agent reads the artifact's own license/EULA first and records a restrictive one as an Open
|
|
333
|
+
question rather than silently decompiling.
|
|
334
|
+
|
|
335
|
+
---
|
|
336
|
+
|
|
337
|
+
## 8. Completeness check
|
|
338
|
+
A capture is complete when: `_summary.md` exists with full provenance frontmatter + honest `status`;
|
|
339
|
+
every Finding is backed by a `raw/` artifact or inline value; `raw/` artifacts have `_meta` +
|
|
340
|
+
decoding (large ones digested); redaction pass run; `gaps` recorded (never fabricated).
|
|
341
|
+
|
|
342
|
+
**Summary-first + bounded, visible fan-out (never go silent long enough to look dead).** Write a
|
|
343
|
+
`status: partial` `_summary.md` with whatever is mined so far **before** any long-tail fetch loop
|
|
344
|
+
(downloading many chunks, crawling many pages, deep pagination), then enrich it in place and flip to
|
|
345
|
+
`complete`. **Bound** every fan-out — cap it by count / total bytes / wall-time (e.g. ≤40 items or
|
|
346
|
+
≤90 s) and record the remainder as a `gap` rather than fetching exhaustively; emit a progress note per
|
|
347
|
+
batch. A collector that fetches everything before writing anything can run many times longer than its
|
|
348
|
+
siblings and read as hung to the orchestrator, forcing a needless salvage. Partial-but-finalized beats
|
|
349
|
+
complete-but-silent.
|
|
350
|
+
|
|
351
|
+
**Capability gap = a checkpoint, not a silent fallback.** When a *preferred* capture capability is found
|
|
352
|
+
**unavailable at runtime** — a CDP/remote-debugging port is closed, Chrome / the browser MCP is unreachable,
|
|
353
|
+
a gated proxy or tool can't be stood up — such that you would proceed on a **materially weaker** method
|
|
354
|
+
(e.g. source-only or a digest instead of a live wire tap), **pause and confirm with the user before
|
|
355
|
+
continuing.** State plainly: what is unavailable, the degraded method you would fall back to, and the
|
|
356
|
+
coverage that would be lost. This is distinct from a *planned* method pre-grade (e.g. `openapi-verbatim` →
|
|
357
|
+
`docs-reconstructed` when no spec is served), which is **recorded, not confirmed** — the checkpoint is for an
|
|
358
|
+
*infrastructure/capability* gap discovered mid-run, where silently degrading hides a real coverage loss
|
|
359
|
+
behind a confident-looking capture. (A real run found the CDP port closed and silently fell back to a
|
|
360
|
+
browser-MCP tap; it worked, but the degradation should have been surfaced first.)
|
|
361
|
+
|
|
362
|
+
---
|
|
363
|
+
|
|
364
|
+
## 9. The session dimension — logged-in browser-session playbook
|
|
365
|
+
|
|
366
|
+
The method for the **session** dimension: discovering the *authenticated runtime* of a
|
|
367
|
+
product by driving it through a browser (Chrome MCP) and instrumenting it. It produces a
|
|
368
|
+
section-by-section understanding of a product's wire protocol, auth, and state model **without
|
|
369
|
+
source-code access**. The `session` agent follows this section.
|
|
370
|
+
|
|
371
|
+
This is the deepest and most sensitive dimension. The ethics in §7 above bind hardest here.
|
|
372
|
+
|
|
373
|
+
### 9.1 Prerequisites (verify before anything else — all three non-negotiable)
|
|
374
|
+
|
|
375
|
+
| # | Precondition | How to verify |
|
|
376
|
+
|---|--------------|---------------|
|
|
377
|
+
| 1 | Target is **pre-logged-in** in Chrome | open the target URL in the connected tab → an authenticated surface (a dashboard, not a sign-in page). The agent never enters credentials. |
|
|
378
|
+
| 2 | **Claude Chrome extension** installed | `mcp__claude-in-chrome__tabs_context_mcp` returns live tabs |
|
|
379
|
+
| 3 | **Chrome CDP** connected | the same call returns stable tab IDs |
|
|
380
|
+
|
|
381
|
+
If any fails, return `blocked` naming the missing precondition.
|
|
382
|
+
|
|
383
|
+
### 9.2 The three-pass strategy
|
|
384
|
+
|
|
385
|
+
A single linear sweep wastes context on things you can read for free and wastes credits on
|
|
386
|
+
actions whose response shape you could infer. Use three passes.
|
|
387
|
+
|
|
388
|
+
**Pass 1 — read-only mining (no money, no state change).** If the user already has data (a
|
|
389
|
+
project, conversation, account, order), mine it first. Hit every list/state/history endpoint with
|
|
390
|
+
the existing token; capture verbatim bodies. This yields ~70% of the spec for free. Mine, by role:
|
|
391
|
+
identity (`/me`, `/account`, `/workspaces`), list (the canonical taxonomy), single-resource state
|
|
392
|
+
(server-injected vs client-sent fields), history/event-log (a whole trajectory in one call),
|
|
393
|
+
runtime/preview state, per-resource billing, account billing, feature flags/cohort, **the account's
|
|
394
|
+
`entitlements`/`permissions` arrays** (the single richest data-model artifact — `entitlements`/`features`
|
|
395
|
+
enumerate every gated feature *including ones your plan hides*; `permissions` are CRUD-verbs-per-entity,
|
|
396
|
+
so the verb set enumerates the domain entity set — `X_CREATE/VIEW/EDIT/DELETE` ⇒ entity `X`; mine these
|
|
397
|
+
first), integration
|
|
398
|
+
catalog (`/mcp/`, `/integrations/`), and schema/capabilities (`/openapi.json`, `/.well-known/*`,
|
|
399
|
+
`/page-metadata`).
|
|
400
|
+
|
|
401
|
+
**Pass 2 — fresh-run validation (with explicit cost/state-change confirmation).** Only after
|
|
402
|
+
Pass 1, and only with explicit user OK stating the exact action + cheapest mode + estimated cost.
|
|
403
|
+
Catches what Pass 1 can't: the submit/write request body, live state-machine transitions, the
|
|
404
|
+
completion event, server-side resolution of shorthand, ID/slug-generation, the real iteration
|
|
405
|
+
endpoint, and the full realtime event catalog. **Legitimate to skip** if the user opts out — leave
|
|
406
|
+
write-side shapes as open questions; never fabricate them.
|
|
407
|
+
|
|
408
|
+
> **Record the write-side decision as a machine flag, not re-derived prose.** A Pass-1-only run leaves
|
|
409
|
+
> the *entire* write/generate/launch surface unobserved — feature *existence/gating* is solid, but
|
|
410
|
+
> feature *execution behavior* rests on marketing/docs and must never be promoted to fact (this caveat
|
|
411
|
+
> otherwise gets re-hedged across 3–4 rollups every cost-gated run). So the session `_summary.md`
|
|
412
|
+
> frontmatter carries `write_side_observed: <true|false>` and `pass2: <not-applicable | offered-pending
|
|
413
|
+
> | declined-by-user | deferred | done>` (this flag is the load-bearing part — it lets Evaluation render
|
|
414
|
+
> the write-side gap *once*). When it would help a later run resume, optionally add
|
|
415
|
+
> `captures/pass2-followup.md` listing the **exact cheapest-mode write actions + est. cost** that would
|
|
416
|
+
> close the gap. Discovery seeds the `pass2:` decision in `00-recon-plan.md` for any `auth:have-login`
|
|
417
|
+
> target.
|
|
418
|
+
|
|
419
|
+
**Pass 3 — synthesis.** Walk the captures, pull each finding into the dimension's `_summary.md`,
|
|
420
|
+
note the cleverest design choices, defaults imposed, performance characteristics, and open
|
|
421
|
+
questions.
|
|
422
|
+
|
|
423
|
+
### 9.3 The P0 → P6 phases
|
|
424
|
+
|
|
425
|
+
The same phases apply whether the target is an AI builder, analytics dashboard, CRM, or collab tool:
|
|
426
|
+
|
|
427
|
+
| Phase | Focus |
|
|
428
|
+
|-------|-------|
|
|
429
|
+
| **P0 Surface** | routes, bundles, storage shape, the API host(s), the auth tell; build the **coverage checklist** from any route/op catalog a sibling declared (§9.4) |
|
|
430
|
+
| **P1 Auth** | token type + issuer + storage location + refresh path; tenancy model; **disambiguate the transport by omission** (replay one authed read with each credential mechanism dropped) — and never test auth with a schema-only field |
|
|
431
|
+
| **P2 Core action** | the primary write — the submit/create body and its server resolution |
|
|
432
|
+
| **P3 Streaming** | the realtime transport (WS / SSE / WebChannel / Pusher / none) + event catalog; **fingerprint binary frames by signature, never log them as opaque** (§9.4) |
|
|
433
|
+
| **P4 Runtime/state** | sandbox/preview/build/deploy state; the live result surface |
|
|
434
|
+
| **P5 Iteration** | the follow-up/edit endpoint (often surprisingly named) + any auto-iteration loop |
|
|
435
|
+
| **P6 Synthesis** | reconcile into the dimension's `_summary.md` + `captures/` + `curls.md` |
|
|
436
|
+
|
|
437
|
+
### 9.4 Runtime taps (Pass-1 instrumentation, run in-page)
|
|
438
|
+
|
|
439
|
+
> **The runnable taps + the ~27-entry Chrome-MCP gotcha catalogue + the dead-end recovery table + the
|
|
440
|
+
> Apollo read-side recipe + the fingerprint tables live in `tradecraft.md`** — paste them, do
|
|
441
|
+
> not re-derive. The prose below is the *why*; that file is the *keyboard layer*. The §7.0 redaction
|
|
442
|
+
> scrubbers (`SCRUB`/`redactSecrets`/`ULTRA`) install inside these tap wrappers.
|
|
443
|
+
|
|
444
|
+
> **Install the in-page interceptor FIRST, then move section-to-section WITHOUT a full reload.**
|
|
445
|
+
> CDP `read_network_requests` is unreliable for an already-loaded single-page app: it starts tracking
|
|
446
|
+
> only when first called and silently misses requests already in flight or served from cache (seen on a
|
|
447
|
+
> real run where only a third-party analytics beacon was captured while the app's own API calls went
|
|
448
|
+
> unseen). Treat it as a *supplement*; the in-page interceptor is the primary capture. A full-page
|
|
449
|
+
> `navigate` wipes the interceptor, so traverse the app using whatever it exposes — **clicking in-app
|
|
450
|
+
> nav works on any stack**; or call the client router if one is reachable (`history.pushState`+`popstate`,
|
|
451
|
+
> React Router / Vue Router / Angular Router, or a globally-exposed router such as `window.next.router`
|
|
452
|
+
> on Next.js). The principle is framework-agnostic; the specific call is just whatever that app ships.
|
|
453
|
+
|
|
454
|
+
- **WebSocket / EventSource / fetch+XHR interceptors** — wrap the constructors/methods to log
|
|
455
|
+
URLs, frames, and bodies (shapes, not secrets — redact in the wrapper before anything reaches
|
|
456
|
+
disk). Add a `SCRUB(value)` step inside the fetch wrapper so credentials never reach the harness.
|
|
457
|
+
**Never log a binary frame as opaque `<binary>`.** Any realtime/streaming/collab layer (token
|
|
458
|
+
streams, CRDT/OT edits, presence, telemetry, game or market state) may ship `ArrayBuffer`/`Blob`
|
|
459
|
+
frames; for each *distinct* frame capture its **byte-length + a hex dump of the first ~16 bytes** —
|
|
460
|
+
enough to fingerprint the wire format (protobuf, MessagePack, CBOR, Yjs/CRDT, gRPC-web, or a
|
|
461
|
+
text/topic-prefixed channel protocol) without recording content. **Decode the signature as ASCII
|
|
462
|
+
first** — many "binary" protocols are framed text (STOMP, Phoenix, Centrifugo, a `+topic` channel
|
|
463
|
+
prefix), so a legible prefix names the protocol in one step before a binary-codec guess. The frame
|
|
464
|
+
*signature* is the finding; the payload is not.
|
|
465
|
+
- **Realtime-on-load capture (the connection that opens before you can wrap it).** The "install the
|
|
466
|
+
interceptor FIRST" rule assumes you are *already on* the target surface; it does **not** cover a
|
|
467
|
+
realtime connection that fires during the **initial load of a page you `navigate` to** (or a
|
|
468
|
+
lazy-loaded/`iframe`d live demo). A post-load interceptor **cannot** wrap a `WebSocket`/`EventSource`
|
|
469
|
+
constructed before injection, and an `offline`→`online`/`focus` reconnect-trigger may spawn no new
|
|
470
|
+
connection on such a demo — so frame capture comes back empty (a real run got 0 frames on a
|
|
471
|
+
collab-demo this way). When that happens: (a) capture the **CDP-visible auth/token-mint fetch** that
|
|
472
|
+
precedes the socket (it names the realtime host/handshake); (b) **the technique that works —
|
|
473
|
+
client-side-navigate within the SPA** (a router `<Link>` click, not a full reload): the in-page
|
|
474
|
+
wrapper **survives client-side nav**, and the next route **mounts a fresh room → a new socket through
|
|
475
|
+
your wrapper** (this captures the handshake + frames where `offline`/`online` reconnect-triggers
|
|
476
|
+
don't — a real run decoded Liveblocks' v8 JSON protocol this way after a 0-frame first pass); (c) if a
|
|
477
|
+
raw **CDP `Network.webSocketFrameReceived`** tap is reachable, it captures frames protocol-level with
|
|
478
|
+
no injection-timing problem at all (the browser MCP's HTTP-only `read_network_requests` does **not**
|
|
479
|
+
surface WS frames — that gap is what forces (b)); and (d) fall back to the `codebase`/`distribution`
|
|
480
|
+
lanes for the wire format — record it as a *folded* gap, not a silent miss, since the protocol is then
|
|
481
|
+
sourced independently rather than live-observed. **Decode captured frames against any in-repo protocol
|
|
482
|
+
enums** (message-code / op-code tables) so the live wire *validates* the source read.
|
|
483
|
+
- **Storage shape inspector** — enumerate localStorage / sessionStorage / cookies / IndexedDB
|
|
484
|
+
**key names + lengths**, never raw values.
|
|
485
|
+
- **JWT decoder** — decode the token *structure* (alg, claim names, exp) with identity claims
|
|
486
|
+
(`sub`, `email`, `phone`, `user_id`, `uid`, `sid`) redacted.
|
|
487
|
+
- **Auth-channel disambiguation.** Token *location* is itself a tell: not in localStorage ⇒ an httpOnly
|
|
488
|
+
cookie **or** an SDK store (IndexedDB — Firebase/Auth0/Supabase/Cognito keep tokens there, which is why
|
|
489
|
+
a "no JWT in localStorage" result is a finding, not a dead end). Determine the *required* transport by
|
|
490
|
+
**omission**: replay one harmless authed read — using a field that needs the authed context (`viewer`/
|
|
491
|
+
`me`), **never** a schema-only field (GraphQL `__typename`, a health route) that resolves
|
|
492
|
+
unauthenticated — with each candidate credential dropped (cookie-only, then header-only); whichever
|
|
493
|
+
response comes back unauthorized names the channel the app actually requires.
|
|
494
|
+
- If a realtime SDK is loaded (Pusher, Ably, Socket.IO, Centrifugo, Phoenix, …), bind a global listener
|
|
495
|
+
to capture the event/channel catalog.
|
|
496
|
+
- **Third-party-SDK fingerprint** (cross-checks `infra-backend-fingerprint`). Storage key names + the
|
|
497
|
+
network host list name the embedded vendor stack — auth (Firebase/Auth0), flags (LaunchDarkly/Statsig),
|
|
498
|
+
support (Intercom/Zendesk/Ada), analytics (Segment/Amplitude/Datadog), payments (Stripe). Record them;
|
|
499
|
+
they corroborate the sub-processor list *independently* (a different dimension → promotes confidence).
|
|
500
|
+
- **Drive op coverage from any catalog a sibling declared.** If `deployed-client-bundle` (or `api`/`docs`)
|
|
501
|
+
recovered a declared **route / endpoint / operation catalog** — a REST path table, a GraphQL operation
|
|
502
|
+
set, an RPC/tool method list — consume it as a **coverage checklist**: walk the routes/actions that
|
|
503
|
+
trigger the un-observed entries so the declared-vs-observed diff (§6) reflects a real walk, not just the
|
|
504
|
+
landing page.
|
|
505
|
+
- **Server-side-read (RSC) check — don't mis-record "no read API."** In a modern Next.js App-Router /
|
|
506
|
+
React-Server-Components app (and similar SSR/streaming stacks), the initial **read** data is fetched
|
|
507
|
+
*server-side* with the session and streamed — so the client wire shows only mutations, asset/media
|
|
508
|
+
fetches, telemetry, and token-mints, and **no client-side data-read XHRs fire on load even though the
|
|
509
|
+
UI is fully populated.** Before recording "read API not observed," check for the server-side path: a
|
|
510
|
+
document/`?_rsc=` response with `text/x-component`, embedded `__next_f`/flight payloads, `_next/data`
|
|
511
|
+
JSON, or server actions. When reads are server-resolved, say so — and note that a sibling
|
|
512
|
+
bundle's app-own *path count* then **overstates the client read surface** (fold this into the
|
|
513
|
+
published-vs-app-own diff, §6, rather than reporting a phantom "unused routes" gap). (Writes can be
|
|
514
|
+
off-main-thread too — a generate POST issued from a **Web Worker** won't appear in a main-thread fetch
|
|
515
|
+
tap; corroborate via CDP / Performance resource timing.)
|
|
516
|
+
|
|
517
|
+
### 9.5 The capture contract (richer than a standard dimension capture)
|
|
518
|
+
|
|
519
|
+
Under `research/<target>/dimensions/session/`:
|
|
520
|
+
|
|
521
|
+
- **`captures/p*.md`** — per-phase narrative for the human: frontmatter (title, summary, scope,
|
|
522
|
+
status), **Method** (taps run, actions taken), **Findings** (concrete values — URLs, fields,
|
|
523
|
+
status codes), **Inferences**, **Diff vs reference**, **Open questions**. Decoded, opinionated;
|
|
524
|
+
don't paste raw bodies here.
|
|
525
|
+
- **`raw/*.json`** — verbatim endpoint captures for the reproducer: a `_meta` header
|
|
526
|
+
(endpoint, auth-shape, captured_at, status, byte_length, redactions) + `body` (PII + secrets
|
|
527
|
+
redacted) + `_decoded_fields`. Digest bodies > 50 KB into a structured summary.
|
|
528
|
+
- **`curls.md`** — reproducible curl per endpoint, the auth model documented, a variables block,
|
|
529
|
+
and an endpoint-catalog table.
|
|
530
|
+
- **Visual / surface map** — `captures/screens/` (**preferred when available**): one annotated
|
|
531
|
+
screenshot per primary surface (each major nav section), redact visible PII before saving. **When
|
|
532
|
+
screenshot capture is unavailable** (e.g. the runtime lacks an image tool, or the app holds a
|
|
533
|
+
persistent connection that never reaches page-idle), a **textual `captures/surface-map.md` is the
|
|
534
|
+
accepted substitute** and satisfies this visual-map requirement — and the **visual-coverage gap is
|
|
535
|
+
recorded in the `gaps:` frontmatter** so Evaluation reads a *known constraint*, not a silent miss.
|
|
536
|
+
- **`captures/pass2-followup.md`** (optional, when Pass 2 is deferred/declined and it would help a
|
|
537
|
+
later run resume) — the exact cheapest-mode write/generate actions + estimated cost that would close
|
|
538
|
+
the write-side gap (§9.2). The `write_side_observed`/`pass2` frontmatter flags are mandatory; this
|
|
539
|
+
file is the convenience.
|
|
540
|
+
- **`_summary.md`** — the standard dimension bridge file (provenance frontmatter per §2) pointing
|
|
541
|
+
into the above, so Evaluation treats session like any other dimension. `method: session-playbook`,
|
|
542
|
+
`confidence: low` for Pass-1-only/inferred. **Session frontmatter additionally carries
|
|
543
|
+
`write_side_observed: <true|false>` and `pass2: <not-applicable | offered-pending | declined-by-user
|
|
544
|
+
| deferred | done>`** (§9.2) so Evaluation renders the write-side gap once, machine-readably.
|
|
545
|
+
|
|
546
|
+
### 9.6 Session ethics (binds hardest here — see §7 above)
|
|
547
|
+
|
|
548
|
+
Never enter credentials; storage shape not values; redact every secret **inside the tap wrapper**
|
|
549
|
+
before it reaches disk; **confirm before any Pass-2 state change or cost** (exact action + exact
|
|
550
|
+
cost); no destructive actions; no bypassing the harness (redact, never evade); captures stay local;
|
|
551
|
+
respect TOS. The provenance/redaction rules in §1–8 apply to everything written here.
|