Install OpenClaw and the Predicate Snapshot skill to use ML-powered DOM snapshots that reduce observation tokens by 95%+.
95% Token Reduction — The Predicate Snapshot skill filters out ad iframes, tracking pixels, and decorative elements. Returns only the 50 most actionable elements in a compact, LLM-friendly format.
node --version)npm --version)# Install OpenClaw globally
npm install -g @anthropic/openclaw
# Verify installation
openclaw --versionOr use npx (no global install):
npx @anthropic/openclaw --versionnpx clawdhub@latest install predicate-snapshot# Create skills directory if it doesn't exist
mkdir -p ~/.openclaw/skills/predicate-snapshot
# Install the package
cd ~/.openclaw/skills/predicate-snapshot
npm init -y
npm install @predicatesystems/openclaw-snapshot-skill# Clone the repo
git clone https://github.com/predicate-systems/predicate-snapshot-skill ~/.openclaw/skills/predicate-snapshot
# Build
cd ~/.openclaw/skills/predicate-snapshot
npm install
npm run buildFor ML-powered ranking (95% token reduction), get a free API key:
# Add to ~/.bashrc, ~/.zshrc, or ~/.profile
export PREDICATE_API_KEY="sk-your-api-key-here"
# Reload shell
source ~/.zshrc # or ~/.bashrcOr configure in ~/.openclaw/config.yaml:
skills:
predicate-snapshot:
api_key: "sk-your-api-key-here"Works Without API Key — Without an API key, the skill still works with local heuristic-based pruning (~80% token reduction).
# List installed skills
openclaw skills list
# You should see:
# - predicate-snapshot# Start OpenClaw in browser mode
openclaw --browser
# Or specify a URL to navigate to
openclaw --browser --url "https://amazon.com"Once in the OpenClaw session with a browser:
# Take a snapshot of the current page
/predicate-snapshot
# Take a snapshot with custom limit
/predicate-snapshot --limit=30
# Use local mode (no API key required)
/predicate-snapshot-local
# Click an element by its Predicate ID
/predicate-act click 42
# Type into an element
/predicate-act type 15 "search query"
# Scroll to an element
/predicate-act scroll 23$ openclaw --browser --url "https://amazon.com"
OpenClaw v1.0.0
Browser session started.
Navigated to: https://amazon.com
> /predicate-snapshot
# Predicate Snapshot
# URL: https://www.amazon.com/
# Elements: showing top 50
# Format: ID|role|text|imp|is_primary|docYq|ord|DG|href
42|searchbox|Search Amazon|0.98|true|180|1|search-bar|
15|button|Go|0.95|true|180|2|search-bar|
23|link|Today's Deals|0.89|false|120|1|nav-main|/deals
...
> /predicate-act type 42 "wireless headphones"
Typed "wireless headphones" into element 42
> /predicate-act click 15
Clicked element 15
> /predicate-snapshot
# New snapshot showing search results...To see the difference between default accessibility tree and Predicate Snapshot:
| Metric | Default A11y Tree | Predicate Snapshot | |--------|-------------------|-------------------| | Tokens | ~18,000 | ~800 (95% reduction) | | Elements | ~800 | 50 ranked | | Signal Quality | Low | High |
The skill includes a demo that compares both approaches using a purpose-built test site:
Test Site: https://www.localllamaland.com/login
testuser / password123cd ~/.openclaw/skills/predicate-snapshot
# Set up environment (optional for enhanced features)
export PREDICATE_API_KEY="sk-..."
export ANTHROPIC_API_KEY="sk-..."
# Run the test
./docker-test.shcd ~/.openclaw/skills/predicate-snapshot
# Set up environment
export PREDICATE_API_KEY="sk-..."
export ANTHROPIC_API_KEY="sk-..." # For LLM comparison
# Run the login demo
npm run demo:login
# Run with visible browser
npm run demo:login -- --headed
# Run with element overlay (shows green boxes on captured elements)
npm run demo:login -- --headed --overlayThis will:
# Check skill directory exists
ls -la ~/.openclaw/skills/predicate-snapshot/
# Rebuild if needed
cd ~/.openclaw/skills/predicate-snapshot
npm run build# Verify environment variable is set
echo $PREDICATE_API_KEY
# Test API connectivity
curl -H "Authorization: Bearer $PREDICATE_API_KEY" https://api.predicate.systems/v1/health# Install Playwright browsers
npx playwright install chromium
# Or install all browsers
npx playwright install# Reinstall dependencies
cd ~/.openclaw/skills/predicate-snapshot
rm -rf node_modules package-lock.json
npm install
npm run build