Skip to content

Knowledge System

Knowledge files tell explorbot facts about your app. Agents read them to make better decisions about authentication, special workflows, and app-specific behavior.

Terminal window
npx explorbot learn

Opens a TUI form where you can:

  • Enter a URL pattern
  • See existing knowledge for that URL
  • Add new knowledge
Terminal window
npx explorbot learn "<url-pattern>" "<description>"

Examples:

Terminal window
# Login credentials
npx explorbot learn "/login" "Use credentials: [email protected] / secret123"
# General knowledge (applies to all pages)
npx explorbot learn "*" "This is a React SPA. Wait for loading spinners to disappear."
# Specific page behavior
npx explorbot learn "/checkout" "Credit card field requires format: XXXX-XXXX-XXXX-XXXX"

While exploring, use the /learn command.

/learn # Opens interactive form
/learn Test user: [email protected] # Adds to current page

API testing shares the same knowledge/ directory. npx explorbot api know <endpoint> "<description>" adds endpoint-scoped notes, stored with an endpoint: frontmatter field instead of url:.

PatternMatches
/loginExact path /login
/admin/*Any path starting with /admin/
*All pages (general knowledge)
^/users/\d+Regex: /users/ followed by digits
~dashboard~Regex: “dashboard” anywhere in URL (tilde on both sides)

Knowledge lives in ./knowledge/ as markdown files with frontmatter:

---
url: /login
title: Login Page
---
Test credentials:
- password: secret123
Notes:
- Submit button disabled until email validates
- 3 failed attempts triggers captcha
- "Remember me" checkbox persists session for 30 days
FieldPurpose
urlURL pattern to match (optional, defaults to *)
titleHuman-readable title (optional)
Custom fieldsAny additional metadata for agents

Knowledge files support variable interpolation with ${namespace.key} syntax. Explorbot resolves variables when it loads the knowledge.

Use ${env.VARNAME} to reference environment variables. This keeps secrets out of knowledge files.

---
url: /login
---
Login credentials:
- email: ${env.LOGIN}
- password: ${env.PASSWORD}

Missing environment variables become an empty string.

Use ${config.path} to reference values from explorbot.config.js with dot notation.

---
url: *
---
Base URL: ${config.playwright.url}
Browser: ${config.playwright.browser}

You can reference any scalar config value. Object values become an empty string.

NamespaceSourceExample
envprocess.env${env.API_KEY}
configexplorbot.config.js${config.playwright.url}

Expressions with an unknown namespace (such as ${other.value}) or no namespace (such as ${value}) are left as-is.

Knowledge files can run automation commands when explorbot navigates to a matching page. Use this for loading states, cookie banners, or page-specific setup.

FieldTypeDescription
waitnumberWait for specified seconds after page load
waitForElementstringWait for element to appear (CSS selector)
codestringExecute CodeceptJS code after navigation
statePushbooleanUse history.pushState instead of full navigation
---
url: /dashboard
wait: 2
waitForElement: '.dashboard-loaded'
---
Dashboard requires data to load before interaction.
---
url: /app/*
code: |
I.waitForElement('.app-ready');
I.click('.cookie-accept');
I.wait(1);
---
App pages need cookie consent dismissed and loading complete.

Knowledge code can use CodeceptJS effects for error handling and retries:

EffectPurpose
tryTo(fn)Execute without failing - returns true/false
retryTo(fn, maxTries, interval)Retry on failure with polling
within(context, fn)Execute within a specific element context

Example with effects:

---
url: /dashboard
code: |
await tryTo(() => I.click('.cookie-dismiss'));
await retryTo(() => {
I.click('Reload Data');
I.waitForElement('.data-loaded');
}, 5, 500);
---
Dashboard may show cookie banner. Data loads asynchronously - retry reload if needed.

For single-page apps where a full reload breaks state:

---
url: /settings/*
statePush: true
---
Settings uses client-side routing. Use pushState to preserve app state.

When explorbot navigates to a page, automation runs in this order:

  1. Navigation (I.amOnPage() or history.pushState)
  2. wait (if specified)
  3. waitForElement (if specified)
  4. code (if specified)
---
url: /login
---
Credentials: [email protected] / testpass123
OAuth: Use "Continue with Google" for SSO testing
2FA: Code is always 123456 in test environment
---
url: /checkout
---
Required fields: name, email, card number, expiry, CVV
Card format: XXXX-XXXX-XXXX-XXXX
Test card: 4111-1111-1111-1111, any future expiry, any CVV
Promo code "TEST10" gives 10% discount
---
url: *
---
- App uses React Router, wait for route transitions
- Loading spinner class: .spinner-overlay
- Modals block interaction until dismissed
- Session expires after 15 minutes of inactivity
---
url: /users
---
Test users available:
- [email protected] (admin role)
- [email protected] (standard user)
- [email protected] (view-only permissions)

When an agent works on a page, it gets the knowledge whose URL pattern matches:

  1. Navigator — uses credentials and knows about special interactions
  2. Researcher — reads page structure and hidden elements
  3. Planner — adds edge cases and validation rules to test scenarios
  4. Tester — uses test data and expected behaviors
  1. Start with auth — add login credentials before exploring protected areas
  2. Use * for globals — document app-wide behavior such as loading states and timeouts
  3. Be specific — give exact selectors, formats, and values when you know them
  4. Update as you learn — add knowledge when agents struggle with an interaction
./knowledge/
├── login.md # /login page
├── checkout.md # /checkout page
├── general.md # * (all pages)
└── admin_users.md # /admin/users/*

Files are named after the URL pattern. Multiple entries for the same URL append to the same file.