Skip to content

About

legends-firecrawl: Firecrawl v2 & Alexandria CLI for coding agents (lfc & lax) with fail-closed SERP handoff, PDF/DOCX parsing, 43M papers & SHA-256 evidence

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

4 stars

Watchers

0 watching

Forks

Latest commit

 

History

47 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

legends-firecrawl

release checks python node routes license

Firecrawl v2 and Alexandria CLI engine (lfc and lax) for coding agents: scrape, map, crawl, parse local PDFs and Office docs, search 43M research papers and 114 Alexandria data providers, enforce fail-closed SERP verification with /goto platform resolution, and bank every response on disk with SHA-256 provenance.

Agent Handoff

Install or update legends-firecrawl via cto-legends (https://github.com/avalonreset/cto-legends): run `cto-legends install legends-firecrawl --apply`, then `cto-legends handoff legends-firecrawl` and follow the returned JSON recipe to verify `lfc` and `lax`.

Three Pillars: 22-route Firecrawl v2 CLI, Fail-closed SERP handoff, Alexandria & evidence bank

Why legends-firecrawl exists

Most agent scraping setups treat web extraction as disposable chat output:

  1. Streaming raw HTML or Markdown into the context window: An ambient daemon dumps a 40 KB scrape straight into your active conversation. Five minutes later, when your agent needs a second section from the same URL or you start a new session, it has to pay for and re-scrape the page all over again.
  2. Scraping decoy SERPs and opaque google.com/goto wrappers: When an upstream search tool pulls an unverified SERP or returns Google's google.com/goto?url=... redirect wrappers, a naive scraper either wastes credits scraping poisoned URLs or hits Google's interstitial redirect wall instead of the real inner thread.
  3. Unbounded recursive crawls and uncapped extraction loops: Turning an agent loose on /v2/crawl or /v2/agent without a map-first preview, explicit confirmation gate, or hard credit ceiling can burn hundreds of credits in a single background loop.

legends-firecrawl pairs two focused CLIs (lfc for the 22-route Firecrawl v2 catalog and lax for the 114-provider Alexandria data catalog) behind a collect-once, inspect-offline architecture. Every live response is archived as untouched JSON (var/captures/firecrawl/) plus a Markdown vault card (vault/captures/firecrawl/) under ~/.legends-firecrawl/research so your coding agent can inspect, slice, and verify saved captures offline without spending another credit.

Ask in plain english

Once cto-legends is installed, you ask your coding agent in plain english. It maps the site or previews the route first, enforces credit caps and SERP integrity gates, and banks the capture on disk:

Say the job in plain words

Architecture: fail-closed SERP gate and collect-once banking

How fail-closed SERP handoff and collect-once banking work

1. Fail-closed SERP integrity gate and /goto platform resolution (lfc scrape-serp)

When chaining search rankings from legends-dataforseo into page-level Markdown extraction, lfc scrape-serp enforces two strict safety layers before making a single HTTP scrape call:

  • Decoy SERP refusal (serp_integrity.verified: true): lfc scrape-serp inspects the saved SERP envelope and refuses to scrape if serp_integrity.verified=true with verified_basis in {'independent_consensus', 'independent_consensus_repaired'} is not present on every organic block, or if any organic block is flagged suspect_decoy, suspect_poisoned, unverified_decoy, unresolved, or unprotected. Your agent never burns Firecrawl credits scraping a poisoned SERP.
  • Zero-credit homepage short-circuit and /goto thread resolution (--resolve-goto): When Google wraps organic SERP links in google.com/goto?url=..., lfc inspects the item's breadcrumb and website_name. Bare domain breadcrumbs (https://www.example.com) short-circuit directly to the canonical homepage for 0 extra map credits. Social and community threads with engagement breadcrumbs (Reddit · r/Phoenixville or 30+ reactions) resolve through a closed 13-platform allowlist (WEBSITE_NAME_PLATFORMS: Reddit, YouTube, Facebook, Instagram, X/Twitter, LinkedIn, TikTok, Yelp, Nextdoor, Quora, Pinterest, Tripadvisor, Medium) with require_candidate=True so failed resolution raises SafetyError instead of silently scraping a bare platform homepage, and automatically falls back from /v2/map HTTP 403 blocks to /v2/search (site:<domain>).

2. The 22-route Firecrawl v2 CLI (lfc)

Every route in python/legends_firecrawl/routes.json maps to a deterministic lfc subcommand with --dry-run, --confirm, SSRF redirect/proxy hardening (_NoRedirect, public-IP DNS verification), and automatic local capture banking:

Surface lfc Subcommands What It Does
Web Extraction & Discovery scrape, batch-scrape, map, search, resolve, scrape-serp Clean Markdown/JSON extraction (/v2/scrape), spend-capped multi-URL batch scraping (/v2/batch/scrape), fast URL discovery (/v2/map), web search (/v2/search), breadcrumb-to-URL resolution (resolve), and fail-closed SERP batch scraping (scrape-serp).
Bounded Site Crawling crawl-preview, crawl, crawl-status, crawl-cancel, crawl-errors, crawl-active Offline scope preview or prompt parameter preview (crawl-preview / /v2/crawl/params-preview), depth- and page-bounded crawling (/v2/crawl with --limit, --max-depth, and mandatory --confirm), active crawl inspection, error diagnostics, and runaway crawl cancellation (DELETE /v2/crawl/{id}).
Local Document Parsing parse Multipart local document upload (/v2/parse) converting local PDF, DOCX, DOC, XLSX, XLS, ODT, RTF, and HTML files into clean Markdown and structured links with symlink refusal.
Research, Dev & Government Index research, developer, gov Search ~43M academic papers across arXiv, PubMed, bioRxiv, and medRxiv (/v2/search/research/papers plus inspect, related, read modes), query Firecrawl's curated developer documentation index (/v2/search/developer), and search the Government Index (/v2/search/gov).
AI Agent, Monitors & Telemetry agent, agent-status, interact, monitor, search-feedback, team-usage Autonomous extraction agent (/v2/agent, spark-2 default) gated by a mandatory --max-credits ceiling, interactive page sessions (/v2/scrape/{id}/interact), scheduled page-change monitors (/v2/monitor), search rating feedback (/v2/search/{id}/feedback), and free team credit/queue telemetry (team-usage).

3. Alexandria 114-provider catalog (lax) and SHA-256 evidence bank (lfc evidence)

  • Offline catalog discovery & preview-first queries (lax): Search 114 structured data providers and 797 capabilities offline (lax search, lax inspect <provider> --full, lax audit). Every lax query defaults to a zero-charge preview (--preview); live submission requires explicit --confirm.
  • External SHA-256 evidence bank (~/.legends-firecrawl/research): Captures are stored outside replaceable module checkouts so upgrading legends-firecrawl never overwrites your research archive. Use lfc evidence inventory, find, view, reuse, export-capture, and verify to check exact-scope freshness before re-querying or to hand off a verified evidence package into legends-empire.

Disposable scrapes vs legends-firecrawl

Comparison: Disposable scrapes & MCPs vs Collect-once evidence // legends-firecrawl

Quick start

# 1. Check account credits and runtime health
lfc doctor --offline
lfc credits

# 2. Map a domain first, then scrape or resolve specific inner pages
lfc map https://example.com --limit 100
lfc scrape https://example.com
lfc resolve "https://example.com" --path-hint "pricing" --scrape

# 3. Scrape page 1 of a verified legends-dataforseo SERP (refuses decoy SERPs fail-closed)
lfc scrape-serp serp.json --limit 10 --resolve-goto --confirm

# 4. Parse local PDFs/DOCX, search 43M research papers, or query developer docs
lfc parse ./report.pdf --formats markdown,links --dry-run
lfc research "CRISPR base editing off-target effects" --limit 10 --dry-run
lfc developer "axum middleware ordering" --limit 10 --dry-run

# 5. Preview and run a bounded crawl or credit-capped extraction agent
lfc crawl-preview https://example.com --limit 25 --max-depth 2
lfc crawl https://example.com --limit 25 --max-depth 2 --confirm
lfc agent "Extract pricing tiers" --urls https://example.com/pricing --max-credits 25 --dry-run

# 6. Search the 114-provider Alexandria catalog offline, preview, and confirm
lax search "treasury"
lax inspect treasury-fiscal-data
lax query treasury-fiscal-data debt/to-the-penny
lax query treasury-fiscal-data debt/to-the-penny --confirm

Optional MCP Plug-In: Legends Gambit (Open Beta)

Want competitor page teardowns and market dossiers without running your own crawling setup?

This module stays 100% local, free, and MIT open source on your own accounts. That does not change.

If you want pay-per-run audits without vendor accounts or subscriptions, Legends Gambit (Legends Gambit: SEO MCP Server & Market Intelligence (by CTO Legends), open beta) is one optional MCP intelligence plug-in beside it:

  • One Streamable HTTP endpoint (https://gambit.cto-legends.com/mcp) and one Bearer API key. Works in Claude Code, Cursor, Antigravity, Claude Desktop, and OpenCode (open read-only initialize and tools/list discovery)
  • Non-expiring prepaid wallet ($10 starter top-up), zero vendor accounts, zero subscriptions
  • From $0.05/run: verified SERP ($0.05), keyword demand ($0.05 for up to 25 keywords), competitor teardown ($0.15), market dossier ($0.50), and circular hexagonal Google Maps rank grids ($0.04/hex point: $0.76 for 19 pts, $1.48 for 37 pts, up to $6.76 for 169 pts across 0.5-50 km radius, with a 19-page vector hex PDF)
  • Anything above your per-call limit (default $0.25) is quoted first. Failed runs and 24-hour same-wallet repeats cost $0.00, and verified cache hits are at least 60% off
claude mcp add --transport http legends-gambit https://gambit.cto-legends.com/mcp --header "Authorization: Bearer YOUR_API_KEY"

Create an API key at gambit.cto-legends.com/wallet or read the docs at cto-legends.com/gambit. Prefer to run 100% locally? Keep reading. Everything below needs nothing from us.

Reference

Capture storage, offline evidence reuse, and Empire handoff (lfc evidence)

Live lfc API operations and confirmed lax query runs automatically save:

  • Untouched JSON response: var/captures/firecrawl/ under ~/.legends-firecrawl/research (or the workspace selected by LEGENDS_FIRECRAWL_CAPTURE_ROOT).
  • Markdown vault reference card: vault/captures/firecrawl/ with request provenance, capture paths (_capture), and content hashes.
# Export a saved capture into a portable SHA-256 evidence bank and verify it
lfc evidence export-capture <capture.raw.json> ./evidence-bank --workspace client-a
lfc evidence verify ./evidence-bank/<package_id>

# List, search, inspect, and check exact-scope freshness across an exported evidence bank
lfc evidence inventory ./evidence-bank --workspace client-a --limit 50
lfc evidence find ./evidence-bank --query "pricing"
lfc evidence view ./evidence-bank/<package_id> --select data.markdown
lfc evidence reuse ./evidence-bank/<package_id> --workspace client-a --endpoint scrape --request-file request.json --max-age-hours 24

Pass --no-save to opt out of local capture on an individual call, or --receipt to print only the saved capture paths. Read the research-memory guide, search strategy, and release scope for complete provenance and freshness rules.

Agent setup (via cto-legends) and standalone installation

Agent setup (via cto-legends)

Part of cto-legends. The central router skill is vendored at skills/cto-legends/SKILL.md; this module is not a separate registered skill and does not require an ambient MCP daemon.

Run cto-legends handoff legends-firecrawl and read the returned installed recipe and task-readiness checks. If the module is missing, preview setup with cto-legends install legends-firecrawl, perform the authorized setup, then repeat the handoff. Use cto-legends check-updates to compare your installed version with the catalog and published release. See docs/AGENT-RECIPE.md for the standalone recipe.

npm install -g firecrawl-cli
python -m pip install -e .
lfc doctor --offline

Set FIRECRAWL_API_KEY in your environment or point FIRECRAWL_API_KEY_FILE at a local key file (symlinks are refused fail-closed).

Repository layout, verification, and scope limits
Agent / CLI (`lfc` or `lax`)
  -> Fail-closed SERP integrity gate & Alexandria preview gate (`--preview` default)
  -> Official Firecrawl v2 API / CLI execution (SSRF & redirect hardened)
  -> Full JSON capture (`var/captures/firecrawl/`) + Markdown vault card
  -> Portable SHA-256 evidence export, verification, and legends-empire handoff
python -m pytest tests -v
python scripts/run_behavioral_evals.py
python scripts/check_release.py

Offline tests verify command contracts, SERP integrity gates, and evidence packaging, not the live availability of every external provider. All queries execute through official Firecrawl v2 routes; cached Alexandria catalog descriptions and prices may change upstream.

Contributing, security, and license

See CONTRIBUTING.md, SUPPORT.md, and SECURITY.md.

MIT License. See LICENSE and THIRD_PARTY_NOTICES.md. Copyright (c) 2026 Avalon Reset.

Start here

Paste the agent handoff block at the top of this page into your coding agent, let it wire the cto-legends router skill, and speak your task in plain English.

Running a company and not a terminal? Founders and operators who want this way of working applied directly to their own business stack have one route: message Avalon Reset at cto-legends.com/dm or start with a 48-hour diagnostic at cto-legends.com/home#home-offer. The desk is async, so the conversation starts the moment you write and nobody forces you onto a sales call.

Want this way of working applied to your own stack? Message Avalon Reset at cto-legends.com/dm

GitHub Star List: The complete cto-legends collection on one page. Bookmark or star the router and every module from a single GitHub list.

Specification & benchmarks on cto-legends.com:

About

legends-firecrawl: Firecrawl v2 & Alexandria CLI for coding agents (lfc & lax) with fail-closed SERP handoff, PDF/DOCX parsing, 43M papers & SHA-256 evidence

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

4 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages