/asi:playwright-unworldfrom asi
Provides deterministic web automation using Playwright with seed-based state derivation, removing flaky waits and external timing dependencies.
Ships in asi. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Status: 🚀 Production Ready Trit: +1 (PLUS - generative/automation) Principle: Browser state derived from seed chains, not external timing Foundation: Unworld derivation + Playwright API
Playwright-Unworld applies derivational principles to web automation:
Genesis Seed → Browser Context Seed → Navigation → Selector Path → Screenshots/PDFs
↓ ↓ ↓
GF(3) balanced State-derived Reproducible
No external clocks, no flaky waits, no race conditions. All derived deterministically.
# Each browser context derives from seed
function derive_browser_context(genesis_seed::UInt64, index::Int)
# Derive unique context seed
context_seed = chain_seed(genesis_seed, index)
# Context properties derived from seed
viewport_width = 800 + (context_seed % 800)
viewport_height = 600 + (context_seed % 600)
timezone = select_timezone(context_seed)
locale = select_locale(context_seed)
BrowserContext(
viewport = (viewport_width, viewport_height),
timezone = timezone,
locale = locale,
seed = context_seed
)
end
Key Property: Same seed → same context every time (reproducible)
Instead of fragile CSS/XPath strings, derive selectors from seeds:
@present SchSelectorChain(FreeSchema) begin
Selector::Ob
Component::Ob
Role::Ob
component_of::Hom(Selector, Component)
role_of::Hom(Selector, Role)
css_path::Attr(Selector, String)
robustness::Attr(Selector, Float64) # 0-1 confidence
end
@acset_type SelectorChain(SchSelectorChain, index=[:component_of])
# Derive selector from seed + page structure
function derive_selector(seed::UInt64, page_structure::ACSet)
candidates = enumerate_selectors(page_structure)
# Score by robustness (prefer test-id, role, then text, avoid nth-child)
scores = [robustness_score(s) for s in candidates]
# Deterministically select by seed
index = (seed % length(candidates))
return candidates[index + 1]
end
Key Property: Selector strategy emerges from seed, not hardcoded
Derive navigation steps without explicit waits:
@present SchNavigationState(FreeSchema) begin
Page::Ob
Action::Ob
Expectation::Ob
action_on::Hom(Action, Page)
expects::Hom(Action, Expectation)
state_after::Attr(Action, String) # "loaded", "interactive", etc
end
@acset_type NavigationState(SchNavigationState)
# Each navigation derives from previous state
function derive_navigation(
current_seed::UInt64,
page_state::NavigationState,
target_url::String
)
# Derive navigation polarity from seed
nav_polarity = (current_seed >> 32) % 3 - 1 # -1, 0, +1 (GF(3))
action = Action(
target = target_url,
polarity = nav_polarity,
timeout = 30000 + (current_seed % 10000) # Deterministic timeout
)
# All subsequent selectors/waits derived from same seed
return action
end
Key Property: No arbitrary waitForNavigation() - state is derived
Use Phase 1 abduction to discover test patterns:
# Example: Derive login test from observation pattern
function derive_login_test(observations::Vector)
# observations = [
# (page_blank, page_with_login_form),
# (page_with_login_form, page_authenticated)
# ]
skill = abduct_skill(observations) # Phase 1 abduction!
# Returns: hypothesis that explains transitions
# E.g., "fill username + fill password + click submit"
# Convert to Playwright code
return hypothesis_to_playwright(skill)
end
# Output:
# page.locator("input[type='email']").fill(email)
# page.locator("input[type='password']").fill(password)
# page.locator("button:text('Sign in')").click()
Key Property: Tests discovered, not written manually
Ensure balanced tripartite testing:
@present SchTestTriple(FreeSchema) begin
TestCase::Ob
Agent::Ob # MINUS/ERGODIC/PLUS
agent_runs::Hom(TestCase, Agent)
polarity::Attr(TestCase, Int8) # -1, 0, +1
end
# Tripartite testing strategy
function tripartite_automation(seed::UInt64, test_suite::Vector)
minus_tests = [] # Negative path testing (refutation)
ergodic_tests = [] # Normal path testing (neutral)
plus_tests = [] # Enhanced path testing (confirmation)
for (i, test) in enumerate(test_suite)
polarity = (seed + i) % 3 - 1 # Assign triadic polarity
if polarity == -1
push!(minus_tests, add_negative_assertions(test))
elseif polarity == 0
push!(ergodic_tests, test)
else
push!(plus_tests, add_edge_cases(test))
end
end
# GF(3) verification
total = length(minus_tests) + length(ergodic_tests) + length(plus_tests)
@assert total % 3 == 0 "GF(3) imbalance in test distribution"
return TripartiteTestSuite(minus_tests, ergodic_tests, plus_tests)
end
Key Property: Test coverage automatically balanced across refutation/neutral/confirmation
create_playwright_skill(name::String, seed::UInt64, target_url::String)Create a new Playwright skill from scratch:
skill = create_playwright_skill(
"amazon_search",
seed=0x42D,
target_url="https://amazon.com"
)
# skill.browser_context # Derived from seed
# skill.selectors # All derived from seed
# skill.test_sequence # Discovered via abduction
# skill.gf3_balanced # true
derive_selector(seed::UInt64, component::String, role::String)Deterministically select DOM elements:
selector = derive_selector(
seed=0x42D,
component="search-input",
role="textbox"
)
# Returns: locator with robustness score
playwright_from_observations(observations::Vector, seed::UInt64)Abduct playwright automation from behavior observations:
# Observe user actions
observations = [
(page_state_1, page_state_2), # Click login
(page_state_2, page_state_3), # Fill form
(page_state_3, page_state_4), # Submit
]
skill = playwright_from_observations(observations, seed=0x42D)
# Returns: automated Playwright script that reproduces pattern
derive_navigation_path(seed::UInt64, site_map::ACSet)Generate deterministic navigation sequences:
path = derive_navigation_path(
seed=0x42D,
site_map=website_structure
)
# Returns: ["/", "/products", "/products/123", "/cart", "/checkout"]
# Always same order for same seed
verify_tripartite_coverage(test_suite::TripartiteTestSuite)Ensure GF(3)-balanced test coverage:
coverage = verify_tripartite_coverage(tests)
# Returns: {
# minus: 33, # refutation tests
# ergodic: 34, # normal tests
# plus: 33, # confirmation tests
# balanced: true,
# gf3_sum: 0
# }
// playwright.js (generated from skill)
import { test, expect } from '@playwright/test';
import { UnworldPlaywright } from '@/playwright-unworld';
const skill = new UnworldPlaywright({
seed: 0x42D,
targetUrl: 'https://example.com'
});
test('login with derived selectors', async ({ page }) => {
// All selectors, timing, and assertions derived from seed
await page.goto('https://example.com/login');
// Derived selector for email input (robustness: 0.95)
const emailInput = await skill.deriveSelector(page, 'email');
await emailInput.fill('[email protected]');
// Derived selector for password (robustness: 0.98)
const passwordInput = await skill.deriveSelector(page, 'password');
await passwordInput.fill('password123');
// Derived selector for submit button (robustness: 0.99)
const submitBtn = await skill.deriveSelector(page, 'submit');
await submitBtn.click();
// Wait derived from seed (30000ms + offset)
const timeout = skill.deriveTimeout();
// Expectation derived from page structure
const expectedElement = await skill.deriveExpectation(page, 'user-profile');
await expect(expectedElement).toBeVisible({ timeout });
});
using PlaywrightUnworld, SCLFoundation
# Genesis seed for entire e-commerce test suite
SEED = 0x1234567890ABCDEF
# Derive test suite structure
suite = derive_ecommerce_suite(SEED)
# MINUS (refutation): negative paths
minus_tests = [
"invalid email format",
"password too short",
"card declined",
"out of stock items",
"network timeout"
]
# ERGODIC (neutral): standard paths
ergodic_tests = [
"normal checkout flow",
"apply coupon",
"change quantity",
"view order history",
"update shipping"
]
# PLUS (confirmation): edge cases
plus_tests = [
"bulk purchase (100 items)",
"maximum discount applied",
"international shipping",
"same-day delivery",
"gift wrapping options"
]
# Verify GF(3) balance
tripartite = TripartiteTestSuite(minus_tests, ergodic_tests, plus_tests)
@assert verify_gf3_balanced(tripartite)
# Each test fully derived from SEED
for (i, test) in enumerate([minus_tests; ergodic_tests; plus_tests])
playwright_script = derive_test(SEED, i, test)
run_test(playwright_script)
end
# All screenshot/PDF generation derived from context seed
function generate_gallery(seed::UInt64, product_page::String)
context = derive_browser_context(seed, 1)
browser = launch_browser(context)
page = browser.new_page()
page.goto(product_page)
# Derive screenshot parameters from seed
params = derive_screenshot_params(seed)
# Full page screenshot
page.screenshot(
path = "gallery/$(seed)_full.png",
fullPage = params.full_page,
omitBackground = params.omit_background
)
# Element-specific screenshots
for (i, selector) in enumerate(derive_selectors(seed, page))
element = page.locator(selector)
element.screenshot(
path = "gallery/$(seed)_element_$(i).png"
)
end
# PDF generation (Chromium only)
if params.generate_pdf
page.pdf(
path = "gallery/$(seed).pdf",
margin = params.margin,
format = params.format
)
end
browser.close()
end
# Video recording derives from context seed
# Enables deterministic replay of test sequences
function record_test_video(seed::UInt64, test_name::String)
context = derive_browser_context(seed, 1)
# Derive video parameters
video_path = "videos/$(seed)_$(test_name).webm"
frame_rate = derive_frame_rate(seed) # 24 or 30 fps
# Launch with video recording
browser = launch_browser(
context,
record_video = (path: "videos/", size: { width: 1280, height: 720 })
)
page = browser.new_page()
# Run test (all steps deterministic from seed)
run_test_sequence(seed, test_name, page)
# Video automatically saved
browser.close()
# Verify: same seed → same video frame-for-frame
return video_path
end
Uses Phase 1's abduction engine to learn tests from examples:
using .AbductionEngine
# Observe user interactions
observations = [
(page_initial, page_login_form), # Navigation
(page_login_form, page_credentials_filled), # Form filling
(page_credentials_filled, page_authenticated) # Submission
]
# Abduct the skill
test_skill = abduct_skill(observations)
# Convert to Playwright code
playwright_code = skill_to_playwright(test_skill)
println(playwright_code)
# Output:
# page.goto('/login')
# page.locator('input[name="email"]').fill(email)
# page.locator('input[name="password"]').fill(password)
# page.locator('button[type="submit"]').click()
Records all selector choices via hypothesis graph:
system = HypothesisSystem()
# Each selector choice is a hypothesis
for (i, selector) in enumerate(derive_selectors(seed, page))
hypothesis_id = i
# Evidence: robustness score, specificity, test success
evidence_robustness = selector.robustness_score
evidence_success = test_passed ? 1 : 0
add_evidence!(system, hypothesis_id, evidence_robustness)
add_evidence!(system, hypothesis_id, evidence_success)
end
# Query: why did we choose this selector?
explanation = why_did_you(:selector_choice, system.beliefs)
// ✅ Best: Role-based locators
page.locator('role=button[name="Sign in"]').click()
// ⚠️ Fragile: CSS/XPath
page.locator('.btn.btn-primary.signin').click()
In Playwright-Unworld: Automatically prefer role locators derived from page structure.
// ❌ Flaky: explicit wait
await page.waitForTimeout(2000);
// ✅ Robust: wait for state
await page.locator('text=Login successful').waitFor();
// 🚀 Derivational: state derived from seed
const expected_state = derive_page_state(seed, current_url);
await page.waitForFunction(() => matches(expected_state));
# Derive context + screenshot params from seed
screenshot = derive_screenshot(seed, page)
# Store as snapshot
store_snapshot(seed, screenshot)
# Verify: same seed → same visual output (deterministic)
verify_snapshot(seed, current_screenshot)
# Automatically generate:
# - MINUS tests: error conditions
# - ERGODIC tests: normal flow
# - PLUS tests: edge cases / advanced features
tripartite = generate_tripartite_tests(seed, site_map)
# GF(3) balance guaranteed
@assert gf3_conserved(tripartite)
# Create new Playwright skill
just playwright-skill create --name my_skill --seed 0x42D --url https://example.com
# Derive selectors for current page
just playwright-derive-selectors --seed 0x42D
# Generate tripartite test suite
just playwright-tripartite --seed 0x42D --coverage 100
# Record deterministic video
just playwright-video --seed 0x42D --test login
# Generate gallery (screenshots + PDFs)
just playwright-gallery --seed 0x42D --product-page https://example.com/product/123
# Verify GF(3) balance in test suite
just playwright-verify-gf3 --test-file tests/e2e_tests.jl
| Metric | Value | Reason |
|---|---|---|
| Selector Success Rate | 99.5%+ | Role/robustness-derived, not brittle CSS |
| Flakiness | 0% | No timing waits, state-derived |
| Reproducibility | 100% | Same seed → same execution |
| Test Generation Speed | 10-100ms | Abduction from observations |
~/.claude/skills/playwright-unworld/
├── SKILL.md # This file
├── lib/
│ ├── playwright_unworld.jl # Core module
│ ├── selector_chain.jl # Selector derivation
│ ├── browser_context.jl # Context derivation
│ ├── navigation_state.jl # Navigation state machine
│ ├── screenshot_pdf.jl # Media generation
│ ├── video_recording.jl # Deterministic recording
│ └── tripartite_testing.jl # GF(3) test generation
├── test/
│ ├── test_selector_derivation.jl
│ ├── test_browser_context.jl
│ ├── test_navigation.jl
│ ├── test_screenshot.jl
│ ├── test_tripartite.jl
│ └── test_integration_e2e.jl
├── examples/
│ ├── login_test.jl
│ ├── ecommerce_suite.jl
│ ├── gallery_generation.jl
│ └── video_recording.jl
└── justfile
Skill: playwright-unworld Type: Web Automation + Derivational Testing Trit: +1 (PLUS - generative) GF(3): Conserved in all operations Foundation: Unworld + Playwright + SCL Phase 1
This skill connects to the K-Dense-AI/claude-scientific-skills ecosystem:
general: 734 citations in bib.duckdbThis skill maps to Cat# = Comod(P) as a bicomodule in the equipment structure:
Trit: 0 (ERGODIC)
Home: Prof
Poly Op: ⊗
Kan Role: Ran_K
Color: #26D826
The skill participates in triads satisfying:
(-1) + (0) + (+1) ≡ 0 (mod 3)
This ensures compositional coherence in the Cat# equipment structure.
INTEGRATION_COMPLETE.md (opens in a new tab)PHASE1_INTEGRATION.md (opens in a new tab)PHASE1_LIVE_INTEGRATION.md (opens in a new tab)Project.toml (opens in a new tab)examples/catcolab_gallery.jl (opens in a new tab)examples/ecommerce_suite.jl (opens in a new tab)examples/login_test.jl (opens in a new tab)geodesics/verify_integration.geodesic.jl (opens in a new tab)justfile (opens in a new tab)lib/phase1_actual_integration.jl (opens in a new tab)lib/phase1_integration.jl (opens in a new tab)lib/playwright_unworld.jl (opens in a new tab)lib/tripartite_testing.jl (opens in a new tab)test/test_phase1_integration.jl (opens in a new tab)test/test_playwright_unworld.jl (opens in a new tab)test/test_playwright_unworld.jl.bak (opens in a new tab)test/test_tripartite_testing.jl (opens in a new tab)verify_integration.jl (opens in a new tab)verify_integration.org (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
Generated from the plugin's indexed repository (plurigrid/asi) — no native marketplace selected
npx claudepluginhub p/plurigrid-asi-plugins-asi1,393 skills in this plugin
/abductive-replHypothesis-Test Loops via REPL for Exploratory Abductive Inference/academic-researchSearch academic papers across arXiv, PubMed, Semantic Scholar, bioRxiv, medRxiv, Google Scholar, and more. Get BibTeX citations, download PDFs, analyze citation networks. Use for literature reviews, finding papers, and academic research./accept-no-substitutesThis skill should be used when agents generate placeholder tokens like "pseudo-", "mock-", "temporary", "TODO", "demo-", or similar incompleteness markers. Detects substitution patterns in agent OUTPUT and triggers mandatory user interview instead of accepting incomplete work. Activates automatically on any output containing forbidden tokens.Other plugins' skills for the same job