Skip to content

hmmhmmhm/ax-grep

 
 

Repository files navigation

ax-grep

ax-grep promo image

npm version coverage: 100% license: MIT

Compact semantic trees and agent-ready page checks from HTML, URLs, WebViews, and live browser pages.

Core features:

  • readable semantic trees from URLs, files, stdin, or captured browser HTML
  • compact --agent JSON for search, page checks, and browser handoff loops

1. Use The CLI Skill

npx --yes ax-grep@latest https://example.com --agent-brief
curl -fsSL https://raw.githubusercontent.com/hmmhmmhm/ax-grep/main/skills.sh | sh

The first command verifies the CLI. The second installs the Codex skill prompt so subagents know to inspect pages with ax-grep before opening a browser. Restart Codex after installing a new skill if it is not listed immediately.

ax-grep https://example.com --agent
npx --yes ax-grep@latest https://example.com --agent

Agents should read agent.executor, agent.handoff, agent.readTargets, pageCheck, and verification first. Open a browser only when the handoff fields say static HTML is not enough.

2. Use From A Server

npm install ax-grep
import { extract, formatSemanticTreeText } from "ax-grep";

const html = await fetch("https://example.com").then((r) => r.text());
const tree = extract(html);
const promptText = formatSemanticTreeText(tree);

ax-grep is ESM-only and requires Node 18 or newer. CommonJS services can use const { extract } = await import("ax-grep").

3. Use In WebViews Or Pages

import { createExtractorScript } from "ax-grep";

const script = createExtractorScript({ format: "text" });
const text = await page.evaluate(script);
// iOS/Android WebView: evaluateJavaScript(script) returns the same text value.

Docs