TraceForge is an agentic recording compiler, headless orchestration engine, and code synthesizer implemented in Rust. It captures browser interactions (DOM mutations, input traces, viewport screencasts, and network exchanges) across Chromium and Firefox, runs them through differential analysis & semantic refinement, and compiles them into:
- Typed Zero-Browser API SDKs (Pure async Rust clients with automated cookie/token threading and JA4 TLS mimicry)
- OpenAPI 3.1 Specifications (Private API reverse-engineering with schema inference)
- Headless Browser Scripts (Resilient Playwright TypeScript/JavaScript and Chromiumoxide Rust automation with selector fallback chains)
- Embedded Model Context Protocol (MCP) Server (Exposing recording, code synthesis, challenge solving, and live screencast/HAR streaming directly to AI agents)
The repository is structured as a modular Cargo workspace across 10 crates:
traceforge/
├── crates/
│ ├── traceforge-core/ # Core telemetry models (UserAction, NetworkEvent, ViewportFrame), DriverEngine trait, AF-IR
│ ├── traceforge-transport/ # Mode 1 runtime: NoBrowserEngine, JA4 TLS mimicry, ProxyRouter with sticky sessions, HttpTaskRunner
│ ├── traceforge-browser/ # Mode 2 & 3: Chromium CDP driver (chromiumoxide) & Firefox WebDriver BiDi client (tokio-tungstenite)
│ ├── traceforge-stealth/ # Anti-detection scripts: navigator.webdriver evasion, WebGL spoofing, 2D canvas noise
│ ├── traceforge-solver/ # Pluggable challenge solver trait, TurnstileDetector, TurnstileSolver
│ ├── traceforge-recorder/ # Append-only .tflog storage, temporal-spatial correlator (ActionFlowIR DAG builder)
│ ├── traceforge-codegen/ # Differential token induction, OpenAPI 3.1 generator, Rust SDK generator, Playwright generator, LLM layer
│ ├── traceforge-mcp/ # Model Context Protocol JSON-RPC 2.0 server (tools & streaming resources over stdio/SSE)
│ ├── traceforge-cli/ # Unified CLI suite and browser WebExtension native messaging IPC bridge
│ ├── traceforge-extension/ # Browser WebExtension Rust WASM core (DOM selector induction, telemetry observers, popup dashboard)
│ └── traceforge-cloud/ # Axum REST & WebSocket SaaS Gateway (Scraper API, workflow replay, & extension live-sync)
├── extension/ # Manifest V3 browser extension (loaders, popup UI, dark-mode CSS, icons, LiveSyncManager)
├── scripts/ # Automated build & packaging pipelines (build-extension.sh)
└── docs/ # Technical documentation, SDD plans, and guides
├── CLOUD_API.md # TraceForge Cloud REST & WebSocket API specification
├── EXTENSION.md # In-depth WebExtension UI, metrics, cookie editor & telemetry guide
└── WORKFLOW_REPLICATION.md # Step-by-step Twitter/X action parameterization & replay tutorial
- Rust: 1.80+ (2021 edition)
- Chromium / Chrome: (optional, for Chromium CDP driver & headed recording)
- Firefox: (optional, for Firefox WebDriver BiDi driver)
Clone the repository and build the workspace:
# Build all crates and binaries
cargo build --release
# Run all 127 automated integration & unit tests
cargo test --workspace
# Check clippy linter
cargo clippy --workspace --all-targetsThe compiled binary will be located at target/release/traceforge-cli.
traceforge-cloud is the commercial SaaS execution gateway that turns TraceForge into a Stealth Web Scraping API & Hosted Workflow Replay Platform.
# Run the Axum REST & WebSocket gateway server on http://localhost:8080
cargo run -p traceforge-cloudSend a POST request with X-TraceForge-Key: tf_live_...:
curl -X POST http://localhost:8080/v1/scrape \
-H "X-TraceForge-Key: tf_live_12345" \
-H "Content-Type: application/json" \
-d '{
"url": "https://example.com/data",
"render_js": true,
"bypass_cloudflare": true
}'Execute a reverse-engineered workflow trace on demand:
curl -X POST http://localhost:8080/v1/run/wf_live_987654 \
-H "X-TraceForge-Key: tf_live_12345" \
-H "Content-Type: application/json" \
-d '{
"variables": { "username": "elonmusk" }
}'Stream browser actions from the Manifest V3 extension directly into TraceForge Cloud in real-time.
For detailed request/response schemas, see docs/CLOUD_API.md.
Record user actions, network flows, and screencast frames into durable .tflog traces.
# Record in Mode 1 (Zero-browser fast HTTP recorder)
traceforge-cli record --url https://example.com/login --engine no-browser --output session.tflog
# Record in Mode 2 (Headless Chromium with CDP and screencasting)
traceforge-cli record --url https://example.com/login --engine chromium --output session.tflog --duration-secs 10
# Record in Mode 3 (Firefox WebDriver BiDi)
traceforge-cli record --url https://example.com/login --engine firefox --output session.tflogCompile a recorded .tflog trace into client code or API specifications:
traceforge-cli compile --trace session.tflog --target openapi --output api-spec/
# Emits api-spec/openapi.json with inferred request/response JSON schemas, query params, and headerstraceforge-cli compile --trace session.tflog --target rust-sdk --output src/
# Emits src/client.rs with:
# - Strongly typed request/response structs
# - Automatic cookie jar persistence
# - Token origin discovery (CSRF tokens automatically extracted from cookies or HTML and threaded into mutating requests)# Playwright TypeScript
traceforge-cli compile --trace session.tflog --target playwright-ts --output scripts/
# Emits scripts/script.ts with locator fallback chains (.or()) and load state waits
# Playwright JavaScript
traceforge-cli compile --trace session.tflog --target playwright-js --output scripts/
# Chromiumoxide Rust automation script
traceforge-cli compile --trace session.tflog --target chromiumoxide-rust --output scripts/Execute automated workflows directly from workflow configurations.
Create a workflow config (workflow.json):
{
"steps": [
{
"url": "https://example.com/login",
"method": "GET"
},
{
"url": "https://example.com/api/v1/auth/login",
"method": "POST",
"headers": {
"Content-Type": "application/json",
"X-CSRF-Token": "{{csrf_token}}"
},
"post_data": "{\"username\": \"alice\", \"password\": \"secret\"}"
}
]
}Run via CLI (with optional runtime parameter overrides):
# Basic run
traceforge-cli run --target no-browser --config workflow.json
# Parameterized run with inline token overrides
traceforge-cli run --target no-browser --config workflow.json --param csrf_token="custom_token_123"
# Parameterized run with parameters file
traceforge-cli run --target no-browser --config workflow.json --params-file secrets.jsonFeatures:
- Automated cookie jar synchronization across steps.
- Automatic extraction and injection of dynamic token variables (
{{csrf_token}}). - Command-line parameter overrides (
--param key=valueand--params-file <path>). See WORKFLOW_REPLICATION.md for Twitter/X like and tweet replication examples. - Built-in Cloudflare Turnstile challenge detection and reporting.
- Sticky proxy pool routing via
ProxyRouter.
TraceForge includes a native JSON-RPC 2.0 MCP server that allows AI agents (such as Claude Desktop, Cursor, or custom LLM orchestrators) to control browsers, extract APIs, and stream live screencasts.
Start the server over standard I/O:
traceforge-cli serve-mcp --transport stdioAdd to your claude_desktop_config.json:
{
"mcpServers": {
"traceforge": {
"command": "/path/to/traceforge/target/release/traceforge-cli",
"args": ["serve-mcp", "--transport", "stdio"]
}
}
}record_action_flow: Starts recording a browser session given a target URL, engine (chromium,firefox,no-browser), and viewport.compile_recorded_task: Compiles a recorded session ID into OpenAPI 3.1, typed Rust client SDK, or Playwright script.execute_no_browser: Runs parameterized HTTP steps in zero-browser mode.solve_active_challenge: Intercepts and solves Cloudflare Turnstile / CAPTCHA challenges.
browser://screencast: Real-time JPEG screencast frames from the active browser viewport.browser://live-har: Real-time correlated HTTP transactions formatted as structured JSON.codegen://openapi.json: Live synthesized OpenAPI 3.1.0 document.
TraceForge can bridge directly with Chrome or Firefox browser extensions via 32-bit length-prefixed native messaging:
traceforge-cli native-host
# or run with standard browser extension flags:
traceforge-cli --native-messaging-host chrome-extension://<EXTENSION_ID>/The TraceForge Recorder is a Manifest V3 browser extension powered by a compiled Rust WebAssembly core (traceforge-extension). It performs real-time user interaction capture, resilient selector induction fallback chains, network telemetry interception via chrome.webRequest, and viewport screencasting. Full documentation is available in EXTENSION.md.
- DevTools "TraceForge Blueprint" Panel: Dedicated Chrome DevTools panel providing a live 4-column reactive architecture schematic (
L1: DOM Triggers➔L2: Protocol Endpoints➔L3: Auth Credentials➔L4: Transport/Egress) with SVG Bezier connection wires, 4-Layer Exploded Protocol Assembly Scrubber, and real-time Simulate Pulse dry-run verification. - In-Page X-Ray HUD Overlay (
Ctrl+Shift+X): Shadow-DOM isolated on-page telemetry overlay with real-time hover reticles, animated SVG tether lines connecting DOM elements to their underlying API endpoints, session timers, and threat level readouts. - Disassembly Mastery Gamification Engine: Evaluates targets across a 5-tier Threat Matrix (Class D to Class S Apex Anomalies), tracking an automated 0–100% Deconstruction Meter (Endpoints, Auth Mechanics, Schemas, Transport) and rewarding Technopath XP and achievements.
- Resilient Fallback Selectors: Automatically generates multi-tiered selector chains (
id,data-*,aria-*, name/type, CSS paths, and XPath) for robust automation playback with visual highlight overlays. - In-Popup Cookie Drawer: Inspect, search, edit, add, delete, and export active tab cookies as JSON for instant credential extraction (
auth_token,ct0). - Dual ISP/ASN Network Telemetry: Live badges displaying public IP, ISP name, ASN, and country code for both your egress connection and destination origin servers.
- Domain-Enriched
.tflogExport: Export files named by domain and timestamp (traceforge_<domain>_<id>_<timestamp>.tflog) with metadata-enriched start markers. - Privacy & Password Masking: Automatically detects sensitive inputs (
type="password", card numbers) and redacts values in recorded payloads. - Modern Dark-Mode Dashboard: Popup UI providing live recording status, elapsed time counter, event counters (actions, requests, frames), and one-click
.tflogNDJSON export. - Native Messaging Bridge: Direct streaming to
traceforge-cli native-hostor standalone in-browser buffering.
Run the automated build and packaging pipeline:
# Build optimized release WebAssembly package and validate Manifest V3
./scripts/build-extension.sh
# Or build development mode without wasm-opt
./scripts/build-extension.sh --dev --no-optThe build pipeline:
- Compiles
crates/traceforge-extensiontargetingwasm32-unknown-unknownviawasm-pack. - Optimizes WASM binary footprint with
wasm-opt. - Emits ES module wrappers to
extension/pkg/. - Executes integrity validation on
extension/manifest.json, icon assets, permissions, and bootstrap loaders.
- Navigate to
chrome://extensions(orbrave://extensions,edge://extensions). - Toggle Developer mode in the upper-right corner.
- Click the Load unpacked button in the top-left toolbar.
- Select the
extension/directory in this repository. - Pin TraceForge Recorder to your browser toolbar and click the icon to open the recording popup.
- Navigate to
about:debuggingin the address bar. - Select This Firefox from the left navigation panel.
- Under Temporary Extensions, click Load Temporary Add-on....
- Select
extension/manifest.firefox.json(orextension/manifest.jsonif on Firefox 121+). - The extension will activate with temporary developer permissions.
You can also use TraceForge programmatically in your own Rust projects:
[dependencies]
traceforge-core = { path = "path/to/crates/traceforge-core" }
traceforge-transport = { path = "path/to/crates/traceforge-transport" }
traceforge-codegen = { path = "path/to/crates/traceforge-codegen" }
traceforge-browser = { path = "path/to/crates/traceforge-browser" }
traceforge-stealth = { path = "path/to/crates/traceforge-stealth" }
traceforge-solver = { path = "path/to/crates/traceforge-solver" }
traceforge-mcp = { path = "path/to/crates/traceforge-mcp" }use traceforge_transport::runner::{HttpTaskRunner, TaskStep};
use traceforge_transport::proxy::{ProxyRouter, ProxyEndpoint, ProxyProtocol};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// 1. Setup proxy router (optional)
let router = ProxyRouter::new();
router.add_proxy(ProxyEndpoint::new(ProxyProtocol::Http, "proxy.example.com", 8080))?;
// 2. Build task runner
let runner = HttpTaskRunner::builder()
.with_proxy_router(router)
.build();
// 3. Define steps with dynamic token injection
let steps = vec![
TaskStep::get("https://example.com/login"),
TaskStep::post(
"https://example.com/api/v1/auth/login",
"{\"user\":\"admin\"}",
).with_header("X-CSRF-Token", "{{csrf_token}}"),
];
// 4. Execute workflow
let result = runner.execute(&steps).await?;
println!("Execution status: {:?}, steps completed: {}", result.status, result.steps.len());
Ok(())
}use traceforge_codegen::OpenApiGenerator;
use traceforge_core::model::ActionFlowIR;
fn generate_spec(ir: &ActionFlowIR) {
let generator = OpenApiGenerator::new("Reverse Engineered API", "1.0.0");
let openapi_json = generator.generate_json(ir);
println!("{}", openapi_json);
}TraceForge enforces strict test coverage across every module:
# Run all workspace integration tests (127 tests)
cargo test --workspace
# Run tests for a specific crate
cargo test -p traceforge-transport
cargo test -p traceforge-browser
cargo test -p traceforge-codegen
cargo test -p traceforge-mcp
cargo test -p traceforge-cli
# Run formatting & clippy checks
cargo fmt --check
cargo clippy --workspace --all-targets -- -D warningsLicensed under the Apache License, Version 2.0.