# letterligo/agent-webcloak architecture

> Architecture diagram of the GitHub repository letterligo/agent-webcloak, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-07). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/letterligo/agent-webcloak
- Repository: https://github.com/letterligo/agent-webcloak

## Overview

WebCloak is a research artifact for defending webpages against LLM-driven scraping and evaluating scraper behavior on LLMCrawlBench. Its main workflow applies Stage 1 structural obfuscation or Stage 2 semantic defenses to HTML, then evaluates LLM scraper implementations against original or defended pages. The tree also contains Crawl4AI and browser-agent experiment implementations. Stage 2 source references identify its orchestration dependencies; several experiment internals are unsampled, so their detailed runtime links are omitted.

Main entry points: [`artifact/experiments/crawl4ai_package/async_webcrawler.py`](https://github.com/letterligo/agent-webcloak/blob/main/artifact/experiments/crawl4ai_package/async_webcrawler.py) (Async Crawler), [`artifact/source_code/stage2/main_stage2.py`](https://github.com/letterligo/agent-webcloak/blob/main/artifact/source_code/stage2/main_stage2.py) (Semantic Defense), [`artifact/source_code/stage1/defend.py`](https://github.com/letterligo/agent-webcloak/blob/main/artifact/source_code/stage1/defend.py) (Structural Defense), [`artifact/experiments/run_browser_use.py`](https://github.com/letterligo/agent-webcloak/blob/main/artifact/experiments/run_browser_use.py) (Browser-Use Runner)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_defense["WebCloak Defense"]
  node_stage1["Structural Defense<br/>[defend.py]"]
  node_stage1_iter["Page Iteration<br/>[iterate.py]"]
  node_stage2_main["Semantic Defense<br/>[main_stage2.py]"]
  node_stage2_prompts["Defense Prompts<br/>[prompts.py]"]
  node_stage2_models["LLM Providers<br/>[language_models.py]"]
  node_stage2_eval["Defense Evaluators<br/>[evaluators.py]"]
  node_stage2_config["Defense Config<br/>[config.py]"]
  node_stage2_utils["Defense Utilities<br/>[utils.py]"]
end

subgraph group_evaluation["Scraper Evaluation"]
  node_browser_agent["Browser-Use Runner<br/>[run_browser_use.py]"]
  node_browser_util["Browser-Use Adapter"]
  node_crawl_runner["Crawl4AI Runner<br/>[run_crawl4ai.py]"]
  node_crawl_util["Crawl4AI Adapter<br/>[util_crawl4ai.py]"]
  node_l2s_runner["LLM-to-Script Runner<br/>[llm2script.py]"]
  node_l2s_variants["Script Variants<br/>[l2s_3.py]"]
end

subgraph group_crawl["Crawl4AI Runtime"]
  node_crawl_entry["Async Crawler"]
  node_browser_manager["Browser Manager<br/>[browser_manager.py]"]
  node_crawl_config["Crawler Configuration<br/>[async_configs.py]"]
  node_scraping["Content Scraping"]
  node_extraction["Content Extraction"]
  node_markdown["Markdown Generation"]
  node_text_convert["HTML-to-Text<br/>[__init__.py]"]
  node_crawl_models["Crawl Results<br/>[models.py]"]
  node_crawl_database[("Crawl Cache<br/>[async_database.py]")]
end

subgraph group_support["Shared Support"]
  node_crawl_log["Crawl Logging<br/>[async_logger.py]"]
  node_crawl_utils["Crawl Utilities<br/>[utils.py]"]
  node_crawl_prompts["Extraction Prompts<br/>[prompts.py]"]
end

node_researcher(("Researcher"))
node_html_pages["HTML Pages"]
node_dataset[("LLMCrawlBench")]
node_scraper_result["Scraper Results"]

node_researcher -->|"runs defense"| node_stage1
node_html_pages -->|"provides pages"| node_stage1
node_stage1 -->|"delegates iteration"| node_stage1_iter
node_stage1 -->|"writes defended pages"| node_html_pages
node_researcher -->|"runs defense"| node_stage2_main
node_html_pages -->|"provides input"| node_stage2_main
node_stage2_main -->|"uses prompts"| node_stage2_prompts
node_stage2_main -->|"calls models"| node_stage2_models
node_stage2_main -->|"evaluates variations"| node_stage2_eval
node_stage2_main -->|"reads settings"| node_stage2_config
node_stage2_main -->|"uses utilities"| node_stage2_utils
node_researcher -->|"runs experiment"| node_browser_agent
node_browser_agent -->|"uses adapter"| node_browser_util
node_researcher -->|"runs experiment"| node_crawl_runner
node_crawl_runner -.->|"uses adapter"| node_crawl_util
node_researcher -->|"runs experiment"| node_l2s_runner
node_l2s_runner -.->|"dispatches scripts"| node_l2s_variants
node_dataset -->|"supplies benchmark pages"| node_browser_agent
node_dataset -->|"supplies benchmark pages"| node_crawl_runner
node_dataset -->|"supplies benchmark pages"| node_l2s_runner
node_browser_agent -.->|"produces results"| node_scraper_result
node_crawl_runner -.->|"produces results"| node_scraper_result
node_l2s_runner -.->|"produces results"| node_scraper_result
node_crawl_entry -.->|"accepts settings"| node_crawl_config
node_crawl_entry -.->|"drives browser"| node_browser_manager
node_crawl_entry -.->|"scrapes content"| node_scraping
node_crawl_entry -.->|"extracts content"| node_extraction
node_crawl_entry -.->|"generates markdown"| node_markdown
node_markdown -.->|"converts HTML"| node_text_convert
node_crawl_entry -.->|"reads and writes cache"| node_crawl_database
node_crawl_database -->|"serializes results"| node_crawl_models
node_crawl_entry -.->|"logs activity"| node_crawl_log
node_crawl_entry -.->|"uses helpers"| node_crawl_utils
node_extraction -.->|"uses prompts"| node_crawl_prompts

click node_stage1 "https://github.com/letterligo/agent-webcloak/blob/main/artifact/source_code/stage1/defend.py"
click node_stage1_iter "https://github.com/letterligo/agent-webcloak/blob/main/artifact/source_code/stage1/iterate.py"
click node_stage2_main "https://github.com/letterligo/agent-webcloak/blob/main/artifact/source_code/stage2/main_stage2.py"
click node_stage2_prompts "https://github.com/letterligo/agent-webcloak/blob/main/artifact/source_code/stage2/prompts.py"
click node_stage2_models "https://github.com/letterligo/agent-webcloak/blob/main/artifact/source_code/stage2/language_models.py"
click node_stage2_eval "https://github.com/letterligo/agent-webcloak/blob/main/artifact/source_code/stage2/evaluators.py"
click node_stage2_config "https://github.com/letterligo/agent-webcloak/blob/main/artifact/source_code/stage2/config.py"
click node_stage2_utils "https://github.com/letterligo/agent-webcloak/blob/main/artifact/source_code/stage2/utils.py"
click node_browser_agent "https://github.com/letterligo/agent-webcloak/blob/main/artifact/experiments/run_browser_use.py"
click node_browser_util "https://github.com/letterligo/agent-webcloak/blob/main/artifact/experiments/util_browser_use.py"
click node_crawl_runner "https://github.com/letterligo/agent-webcloak/blob/main/artifact/experiments/run_crawl4ai.py"
click node_crawl_util "https://github.com/letterligo/agent-webcloak/blob/main/artifact/experiments/util_crawl4ai.py"
click node_l2s_runner "https://github.com/letterligo/agent-webcloak/blob/main/artifact/experiments/llm2script.py"
click node_l2s_variants "https://github.com/letterligo/agent-webcloak/blob/main/artifact/experiments/LLM-to-Script/l2s_3.py"
click node_crawl_entry "https://github.com/letterligo/agent-webcloak/blob/main/artifact/experiments/crawl4ai_package/async_webcrawler.py"
click node_browser_manager "https://github.com/letterligo/agent-webcloak/blob/main/artifact/experiments/crawl4ai_package/browser_manager.py"
click node_crawl_config "https://github.com/letterligo/agent-webcloak/blob/main/artifact/experiments/crawl4ai_package/async_configs.py"
click node_scraping "https://github.com/letterligo/agent-webcloak/blob/main/artifact/experiments/crawl4ai_package/content_scraping_strategy.py"
click node_extraction "https://github.com/letterligo/agent-webcloak/blob/main/artifact/experiments/crawl4ai_package/extraction_strategy.py"
click node_markdown "https://github.com/letterligo/agent-webcloak/blob/main/artifact/experiments/crawl4ai_package/markdown_generation_strategy.py"
click node_text_convert "https://github.com/letterligo/agent-webcloak/blob/main/artifact/experiments/crawl4ai_package/html2text/__init__.py"
click node_crawl_models "https://github.com/letterligo/agent-webcloak/blob/main/artifact/experiments/crawl4ai_package/models.py"
click node_crawl_database "https://github.com/letterligo/agent-webcloak/blob/main/artifact/experiments/crawl4ai_package/async_database.py"
click node_crawl_log "https://github.com/letterligo/agent-webcloak/blob/main/artifact/experiments/crawl4ai_package/async_logger.py"
click node_crawl_utils "https://github.com/letterligo/agent-webcloak/blob/main/artifact/experiments/crawl4ai_package/utils.py"
click node_crawl_prompts "https://github.com/letterligo/agent-webcloak/blob/main/artifact/experiments/crawl4ai_package/prompts.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_stage1,node_stage1_iter,node_stage2_main,node_stage2_prompts,node_stage2_models,node_stage2_eval,node_stage2_config,node_stage2_utils toneBlue
class node_browser_agent,node_browser_util,node_crawl_runner,node_crawl_util,node_l2s_runner,node_l2s_variants,node_dataset toneAmber
class node_crawl_entry,node_browser_manager,node_crawl_config,node_scraping,node_extraction,node_markdown,node_text_convert,node_crawl_models,node_crawl_database toneMint
class node_crawl_log,node_crawl_utils,node_crawl_prompts toneRose
class node_researcher,node_html_pages,node_scraper_result toneIndigo
```

## Components

### WebCloak Defense

- [Structural Defense](https://github.com/letterligo/agent-webcloak/blob/main/artifact/source_code/stage1/defend.py): `artifact/source_code/stage1/defend.py`
- [Page Iteration](https://github.com/letterligo/agent-webcloak/blob/main/artifact/source_code/stage1/iterate.py): `artifact/source_code/stage1/iterate.py`
- [Semantic Defense](https://github.com/letterligo/agent-webcloak/blob/main/artifact/source_code/stage2/main_stage2.py): `artifact/source_code/stage2/main_stage2.py`
- [Defense Prompts](https://github.com/letterligo/agent-webcloak/blob/main/artifact/source_code/stage2/prompts.py): `artifact/source_code/stage2/prompts.py`
- [LLM Providers](https://github.com/letterligo/agent-webcloak/blob/main/artifact/source_code/stage2/language_models.py): `artifact/source_code/stage2/language_models.py`
- [Defense Evaluators](https://github.com/letterligo/agent-webcloak/blob/main/artifact/source_code/stage2/evaluators.py): `artifact/source_code/stage2/evaluators.py`
- [Defense Config](https://github.com/letterligo/agent-webcloak/blob/main/artifact/source_code/stage2/config.py): `artifact/source_code/stage2/config.py`
- [Defense Utilities](https://github.com/letterligo/agent-webcloak/blob/main/artifact/source_code/stage2/utils.py): `artifact/source_code/stage2/utils.py`

### Scraper Evaluation

- [Browser-Use Runner](https://github.com/letterligo/agent-webcloak/blob/main/artifact/experiments/run_browser_use.py): `artifact/experiments/run_browser_use.py`
- [Browser-Use Adapter](https://github.com/letterligo/agent-webcloak/blob/main/artifact/experiments/util_browser_use.py): `artifact/experiments/util_browser_use.py`
- [Crawl4AI Runner](https://github.com/letterligo/agent-webcloak/blob/main/artifact/experiments/run_crawl4ai.py): `artifact/experiments/run_crawl4ai.py`
- [Crawl4AI Adapter](https://github.com/letterligo/agent-webcloak/blob/main/artifact/experiments/util_crawl4ai.py): `artifact/experiments/util_crawl4ai.py`
- [LLM-to-Script Runner](https://github.com/letterligo/agent-webcloak/blob/main/artifact/experiments/llm2script.py): `artifact/experiments/llm2script.py`
- [Script Variants](https://github.com/letterligo/agent-webcloak/blob/main/artifact/experiments/LLM-to-Script/l2s_3.py): `artifact/experiments/LLM-to-Script/l2s_3.py`

### Crawl4AI Runtime

- [Async Crawler](https://github.com/letterligo/agent-webcloak/blob/main/artifact/experiments/crawl4ai_package/async_webcrawler.py): `artifact/experiments/crawl4ai_package/async_webcrawler.py`
- [Browser Manager](https://github.com/letterligo/agent-webcloak/blob/main/artifact/experiments/crawl4ai_package/browser_manager.py): `artifact/experiments/crawl4ai_package/browser_manager.py`
- [Crawler Configuration](https://github.com/letterligo/agent-webcloak/blob/main/artifact/experiments/crawl4ai_package/async_configs.py): `artifact/experiments/crawl4ai_package/async_configs.py`
- [Content Scraping](https://github.com/letterligo/agent-webcloak/blob/main/artifact/experiments/crawl4ai_package/content_scraping_strategy.py): `artifact/experiments/crawl4ai_package/content_scraping_strategy.py`
- [Content Extraction](https://github.com/letterligo/agent-webcloak/blob/main/artifact/experiments/crawl4ai_package/extraction_strategy.py): `artifact/experiments/crawl4ai_package/extraction_strategy.py`
- [Markdown Generation](https://github.com/letterligo/agent-webcloak/blob/main/artifact/experiments/crawl4ai_package/markdown_generation_strategy.py): `artifact/experiments/crawl4ai_package/markdown_generation_strategy.py`
- [HTML-to-Text](https://github.com/letterligo/agent-webcloak/blob/main/artifact/experiments/crawl4ai_package/html2text/__init__.py): `artifact/experiments/crawl4ai_package/html2text/__init__.py`
- [Crawl Results](https://github.com/letterligo/agent-webcloak/blob/main/artifact/experiments/crawl4ai_package/models.py): `artifact/experiments/crawl4ai_package/models.py`
- [Crawl Cache](https://github.com/letterligo/agent-webcloak/blob/main/artifact/experiments/crawl4ai_package/async_database.py): `artifact/experiments/crawl4ai_package/async_database.py`

### Shared Support

- [Crawl Logging](https://github.com/letterligo/agent-webcloak/blob/main/artifact/experiments/crawl4ai_package/async_logger.py): `artifact/experiments/crawl4ai_package/async_logger.py`
- [Crawl Utilities](https://github.com/letterligo/agent-webcloak/blob/main/artifact/experiments/crawl4ai_package/utils.py): `artifact/experiments/crawl4ai_package/utils.py`
- [Extraction Prompts](https://github.com/letterligo/agent-webcloak/blob/main/artifact/experiments/crawl4ai_package/prompts.py): `artifact/experiments/crawl4ai_package/prompts.py`

### Other components

- **Researcher**
- **HTML Pages**
- **LLMCrawlBench**
- **Scraper Results**

## Connections

- Researcher → Structural Defense: runs defense
- HTML Pages → Structural Defense: provides pages
- Structural Defense → Page Iteration: delegates iteration (evidence: `artifact/source_code/stage1/defend.py`)
- Structural Defense → HTML Pages: writes defended pages
- Researcher → Semantic Defense: runs defense
- HTML Pages → Semantic Defense: provides input
- Semantic Defense → Defense Prompts: uses prompts (evidence: `artifact/source_code/stage2/main_stage2.py`)
- Semantic Defense → LLM Providers: calls models (evidence: `artifact/source_code/stage2/main_stage2.py`)
- Semantic Defense → Defense Evaluators: evaluates variations (evidence: `artifact/source_code/stage2/main_stage2.py`)
- Semantic Defense → Defense Config: reads settings (evidence: `artifact/source_code/stage2/main_stage2.py`)
- Semantic Defense → Defense Utilities: uses utilities (evidence: `artifact/source_code/stage2/main_stage2.py`)
- Researcher → Browser-Use Runner: runs experiment
- Browser-Use Runner → Browser-Use Adapter: uses adapter (evidence: `artifact/experiments/util_browser_use.py`)
- Researcher → Crawl4AI Runner: runs experiment
- Crawl4AI Runner → Crawl4AI Adapter: uses adapter
- Researcher → LLM-to-Script Runner: runs experiment
- LLM-to-Script Runner → Script Variants: dispatches scripts
- LLMCrawlBench → Browser-Use Runner: supplies benchmark pages
- LLMCrawlBench → Crawl4AI Runner: supplies benchmark pages
- LLMCrawlBench → LLM-to-Script Runner: supplies benchmark pages
- Browser-Use Runner → Scraper Results: produces results
- Crawl4AI Runner → Scraper Results: produces results
- LLM-to-Script Runner → Scraper Results: produces results
- Async Crawler → Crawler Configuration: accepts settings
- Async Crawler → Browser Manager: drives browser
- Async Crawler → Content Scraping: scrapes content
- Async Crawler → Content Extraction: extracts content
- Async Crawler → Markdown Generation: generates markdown
- Markdown Generation → HTML-to-Text: converts HTML
- Async Crawler → Crawl Cache: reads and writes cache
- Crawl Cache → Crawl Results: serializes results (evidence: `artifact/experiments/crawl4ai_package/async_database.py`)
- Async Crawler → Crawl Logging: logs activity
- Async Crawler → Crawl Utilities: uses helpers
- Content Extraction → Extraction Prompts: uses prompts
