{"data":{"slug":"discovered-29a7f61a96f1e205be256dc52e9726f22b8226e334818fad","title":"Nj Laya \u2014 Local Classifier for Playwright Test Triage and Routing","summary":"Use a local, token-free classifier (Laya) to route free-text choices, triage Playwright\/test failures, or select UI locators. Apply only when no stored field, regex, or lookup answers the question, and only for suggest-only use with \u226410 English options.","url":"https:\/\/skillshunter.net\/skills\/discovered-29a7f61a96f1e205be256dc52e9726f22b8226e334818fad","json_url":"https:\/\/skillshunter.net\/api\/public\/v1\/skills\/discovered-29a7f61a96f1e205be256dc52e9726f22b8226e334818fad","markdown_url":"https:\/\/skillshunter.net\/skills\/discovered-29a7f61a96f1e205be256dc52e9726f22b8226e334818fad.md","download_url":"https:\/\/skillshunter.net\/skills\/discovered-29a7f61a96f1e205be256dc52e9726f22b8226e334818fad\/download","category":{"slug":"software-development","name":"Software & Development"},"editor_note":"Before using Laya, ensure input is free text with no stored field or regex answers, and keep options to 10 or fewer. Use only English input and never let Laya trigger actions on live systems. Run `scripts\/pw_triage.py --self-test` to validate the regex classifier for Playwright test failures.","instructions":"---\nname: nj-laya\ndescription: >\n  Decide whether a local, token-free classifier (Laya) applies before reaching for it \u2014 for\n  routing a free-text choice, triaging a Playwright\/test failure, or picking a UI locator.\n  Use when: a classifier or router is being considered for local\/CPU\/zero-token use, Laya or\n  Jev come up by name, a Playwright test is failing and needs triage, an agent needs to pick\n  an element\/locator from a page, or someone asks \"can this run without tokens\" or \"\u0645\u062d\u0644\u064a \u0628\u062f\u0648\u0646\n  \u062a\u0648\u0643\u0646\u0632\". Routes deterministic-first (regex\/lookup\/stored field) and permits Laya only inside\n  a narrow, evidence-tested envelope (English, \u226410 options, suggest-only, never an action).\n  Covers the PROJ Playwright harvest\u2192script\u2192run\u2192triage loop as a worked example.\n---\n\n# nj-laya \u2014 deterministic first, Laya only inside ADOPT-NARROW\n\nDevil-pass verdict, 2026-09-24: `artifacts\/ops\/laya-devil-2026-09-24.md`. Read it before\nadopting Laya anywhere; do not re-argue it, encode it.\n\n## Decision table\n\n| situation | do this | not Laya because |\n|---|---|---|\n| answer is a stored field \/ DB column \/ foreign key | read the field | it's already known, not a classification |\n| answer matches a regex \/ fixed error shape (timeouts, strict-mode, `expect` diffs) | regex classifier (`scripts\/pw_triage.py`) | Playwright error text is structured |\n| picking a locator while **authoring** a script | Claude writes it from the snapshot already in context | 0 tokens saved \u2014 Claude already has the snapshot |\n| picking a locator or acting **at run time** (self-healing that clicks\/submits\/pays) | never \u2014 hard reject | a wrong pick can pass silently on a live system (rule 1) |\n| routing which skill\/tool to use | Claude's own routing (skill listing already in context) | a hook can only add context, never remove the listing |\n| free-text choice, \u226410 English options, no stored field or regex answers it, wrong answer only costs a re-run | `scripts\/laya_ask.mjs`, suggest-only | the one envelope the evidence supports (EN McNemar p=0.0117) |\n| Arabic input | route away from Laya entirely | AR result not significant (McNemar p=0.453); no multilingual checkpoint hosted at `receptron\/laya-onnx` (verified 2026-09-24, HF tree listing: only `tokenizer\/`, no `multilingual\/`) |\n| triaging 45 motion-reference descriptions into an 8-bucket style shortlist (>10 options, out of envelope) | Haiku, gated behind a 15-label Laya accuracy check first | outside ADOPT-NARROW (rule 5, >10 options); measured 2026-09-25 anyway as a second data point \u2014 see below |\n\n## The 14 rules (imperative, evidence in `laya-devil-2026-09-24.md`)\n\n1. Never let a Laya answer trigger an action on a live system (click, submit, pay, send).\n2. Never use Laya as a gate or verifier; write its answer to a file as a suggestion.\n3. Use Laya only when the input is free text and no stored field\/regex\/lookup answers it.\n4. English input only. No multilingual checkpoint exists at `receptron\/laya-onnx` (verified\n   2026-09-24: HF tree has `tokenizer\/`, no `multilingual\/` folder). A third-party mirror\n   (`mizchi\/laya-multilingual-onnx`) exists but is unverified and out of scope \u2014 do not wire it\n   without a fresh probe.\n5. Keep options at 10 or fewer per call; never pass a whole page snapshot.\n6. Read only `choice` and `confidence`; never use `noul` or `act_probability` (upstream bugs,\n   see research\/laya-jev-2026-09-23.md \u00a72).\n7. Before any adoption claim, measure against a deterministic baseline with stop-words fixed\n   and a synonym table.\n8. Score only on text the scoring worker did not write \u2014 verbatim from SRS\/spec sources.\n9. Report non-quoted-item accuracy and paired McNemar, not headline accuracy.\n10. Do not call Laya from a per-event Claude hook until a warm-cache `Laya.load()` is measured\n    under 1 s (cold load measured 35.7 s, includes a download \u2014 not yet retested warm).\n11. Do not use Laya for skill or tool routing.\n12. Do not use Laya to pick PROJ locators at authoring time.\n13. For Playwright failures: run `scripts\/pw_triage.py` first, hand Laya only the\n    `unclassified` residue, and only after 30+ real failures exist.\n14. Pin the checkpoint (`revision`) and name it (English\/multilingual) in every result.\n\n## Worked example: a Playwright suite (harvest \u2192 script \u2192 run \u2192 triage)\n\n- **Harvest**: Playwright `codegen` or an aria snapshot (`browser_snapshot` \/ accessibility\n  tree) \u2014 role + accessible name per element. Read-only, no Laya.\n- **Author**: Claude writes the Playwright script from the snapshot (`getByRole`, fills,\n  waits, data). Locator picking happens here, by Claude, not Laya (rule 12).\n- **Run**: `npx playwright test`. Deterministic, zero tokens.\n- **Triage a failure**: `python scripts\/pw_triage.py --report <path>` classifies into\n  `locator-changed | timeout-env | auth-session | assertion | unclassified` by regex over\n  Playwright's JSON reporter output or `error-context.md` files. Only the `unclassified`\n  bucket is a Laya candidate (rule 13), and only once \u226530 real failures exist \u2014 the reference suite had zero\n  as of the 2026-09-24 probe.\n- **Self-healing that acts**: rejected outright (rule 1) \u2014 specs that file real requests\n  against a live portal behind reCAPTCHA, and 719 swallowed `.catch(() => {})`\n  mean a wrong click can pass silently.\n\n## Scripts\n\n- `scripts\/laya_ask.mjs` \u2014 English-only, \u226410 options, pinned `revision`, suggest-only JSON to\n  stdout\/file. Never call it inside a per-event hook (rule 10) or on an action path (rule 1).\n- `scripts\/pw_triage.py` \u2014 stdlib regex classifier over a Playwright JSON report or\n  `test-results\/**\/error-context.md`. Self-test: `python scripts\/pw_triage.py --self-test`.\n\n## Evidence outside the envelope: style-triage measurement, 2026-09-25\n\n`kacs-v4` (ACME, `artifacts\/research\/kac-sentinel\/v4\/refs\/`) measured Laya on an\n8-bucket style classification with 45 refs, 15 hand-labelled \u2014 an **out-of-envelope**\ncall (>10 options, rule 5) run anyway as a gate before committing to Laya for a real\ntriage. **Laya accuracy = 0.40 on the 15 labelled rows (`triage.json`), below the 0.70\ngate** \u2014 most wrong answers collapsed onto `kinetic-typography` regardless of the true\nbucket, confidence uncorrelated with correctness (0.99 on a wrong answer, 0.54 on a\nright one). Haiku triaged the same 45 rows at 1.0 against the same 15 labels\n(`triage-haiku.json`) but that number is unguarded: Haiku scored its own labelled set,\nso it may be label-leaked (no held-out split was possible with only 15 gold rows) \u2014 do\nnot cite 1.0 as a clean accuracy figure. Confirms rule 5 from the other side: this is\nexactly the >10-option shape the envelope excludes, and it failed exactly as the\nenvelope predicts. Not a new adopted use \u2014 the entry exists so nobody re-runs this\nexperiment expecting a different result.\n\n## Not yet supported\n\n- Playwright failure triage (candidate 2\/row 2): blocked on data \u2014 0 real failures measured.\n- Locator-drift hint, suggest-only (row 3b): same data gap.\n- Any multilingual Arabic path: no verified hosted checkpoint; third-party mirror unverified.\n- >10-option classification (style\/bucket triage): measured 0.40 accuracy 2026-09-25, fails the envelope \u2014 use Haiku instead, unguarded by a clean held-out score.\n","use_cases":["Triage Playwright\/test failures using regex classification","Route free-text choices with a local classifier (Laya)","Select UI locators during script authoring without token usage","Validate Playwright test results with deterministic classification"],"limitations":[],"compatibility":[],"setup_tip":null,"sample_input":null,"sample_output":null,"source_url":"https:\/\/github.com\/NJ-Burrito\/NJ-Kit\/blob\/2644ffdccb94c9eb0a65b23624abe9795e005faa\/nj-kit\/bundled\/nj-laya\/SKILL.md","source_commit":"2644ffdccb94c9eb0a65b23624abe9795e005faa","license":null,"version":null,"listing_approved_at":"2026-11-29","created_at":"2026-11-28T18:51:09.000000Z","updated_at":"2026-11-29T10:53:27.000000Z","seo_title":"Nj Laya \u2014 Local Classifier for Playwright Test Triage and Routing","seo_description":"Use a local, token-free classifier (Laya) for Playwright test triage, UI locator selection, and routing decisions. Apply only when no stored field, regex, or lookup can\u56de\u7b54","seo_keywords":["playwright test triage","local classifier","token-free ai","playwright locator selection","playwright test failure classification"]}}