Skip to content

Architecture

Fresh

Source: BIBLE.md (Architecture section), bible/understand-everything.md

Ghost Engine is a unified desktop plus mobile antidetect browser with three I/O backends.

High-level layout

ghost-engine/
├── server.mjs          # HTTP server, 704 routes
├── cli.mjs             # CLI interface (16 subcommands)
├── dashboard.html      # 13-tab dark theme dashboard
├── core/               # 30 core modules
├── plugins/            # 109+ plugins
├── scripts/            # 290+ automation scripts
├── data/               # 21 dirs, 106 files (persistent state)
└── bible/              # Complete documentation

The three modes

Every browser session runs in one of three modes:

flowchart LR
  A[Launch request] --> R{hybrid-router}
  R -- ghost --> O[OS or ADB + vision]
  R -- hybrid --> H[OS clicks + CDP reads]
  R -- speed --> C[Pure CDP / Puppeteer]
  O --> T1[isTrusted: true]
  H --> T2[isTrusted: true on input]
  C --> T3[isTrusted: false]
ModeInput sourceCDP tracesUse case
GhostOS-level (desktop) or ADB (mobile) plus visionZeroReddit, LinkedIn, Facebook, Instagram
HybridOS-level for clicks/typing, CDP for readingMinimal (reads only)Yelp, Substack, Gmail
SpeedPure CDP (same as V1)FullYouTube, Google Search

A component called the hybrid router (hybrid-router.mjs) decides which mode to use per platform. Each platform has a default: Reddit defaults to ghost, YouTube defaults to speed. Override per-session.

The three backends

The I/O path:

BackendUseisTrustedLatency
cdpdesktop, speed modefalse~5 ms/action
osdesktop, ghost/hybrid modetrue~50 ms/action
adbmobile, always ghost modetrue~20 ms/action

ADB always forces ghost mode because there is no CDP on a mobile device. ADB is the only way in.

The four new modules (added on top of V1)

flowchart TB
  HR[hybrid-router.mjs] --> OS[os-input.mjs]
  HR --> ADB[adb-input.mjs]
  HR --> CDP[CDP / Puppeteer]
  OS --> WIN[Windows user32.dll SendInput]
  ADB --> AND[Android Debug Bridge]
  VIS[vision.mjs] --> CL[Claude API]
  VIS --> OL[Ollama]
  VIS --> AI[OpenAI]
  OS --> VIS
  ADB --> VIS
ModuleWhat it does
os-input.mjsWin32 SendInput/SetCursorPos via PowerShell plus inline C#
adb-input.mjsADB touch/keyboard/scroll with Bezier humanization
vision.mjsScreenshot to VLM to coordinates (page or device)
hybrid-router.mjsMode plus backend selection per session

V1 inheritance

Ghost Engine is a clone of V1, not a rewrite. It inherited 13 core modules:

  • Bezier mouse curves
  • Adjacent-key typo simulation
  • Ease-in-out scroll with re-reading
  • Markov behavioral walker
  • 15-vector fingerprint evasion
  • AES-256-GCM cookie encryption
  • 251 US metro geo-profiles
  • GPS driving simulation
  • Cloudflare/DataDome/reCAPTCHA evasion
  • Proxy rotation with marriage
  • CAPTCHA solving (4 services)
  • SERP scraping
  • UULE geo-targeting

V1 vs V2

Mini Engine V1 :4600Ghost Engine V2 :4700
Use it forDaily SEO ops, warming, low-risk platformsReddit, LinkedIn, mobile, any platform that shadow-bans CDP
PlatformsDesktop onlyDesktop (Chrome) + Mobile (Android via ADB)
Input methodCDP Input.dispatchMouseEvent/KeyEventDesktop: Windows SendInput. Mobile: ADB touch
NavigationDOM selectors, CSS queriesVision or DOM
CDP tracesPresent (mitigated by rebrowser)Zero in ghost mode
HumanizationBezier mouse, typo keyboard, Markov walkerSame plus OS-level output plus ADB Bezier swipes
Latency~5 ms per actionDesktop: ~50 ms (PS spawn). Mobile: ~20 ms (ADB shell)
Concurrent sessionsUnlimitedDesktop ghost: one at a time. Mobile: unlimited
VLM costNone~$0.003 per vision call (Claude Sonnet)

Service inventory

PortServiceWhat it does
4700Ghost Engine V2This engine. OS-level input, vision, hybrid routing
4600Mini Engine V1Production workhorse. Daily SEO ops. Read-only
3500Big antidetect engineFull antidetect, shares stealth strategy
3700PonmelliSEO Command Center. Orchestrates cascades, CTR, ranks
11434OllamaVision and content gen (local)

Invariants

yaml
invariants:
  - rule: V1 is untouched
    why: V1 is production. V2 is experimental. Never modify V1 files.

  - rule: Ghost mode = zero CDP Input domain calls
    why: The entire point. If ghost mode still uses CDP for clicks, it is broken.

  - rule: ADB backend always forces ghost mode
    why: No CDP available on mobile. ADB is the only I/O path.

  - rule: Vision is expensive
    why: ~$0.003 per VLM call. Use it only for navigation decisions.

  - rule: Window focus required for OS-level input (desktop only)
    why: SendInput sends events to the foreground window.

  - rule: One desktop ghost session at a time
    why: Only one window can have focus on desktop. ADB targets by serial.

  - rule: Same humanization math across all backends
    why: Desktop Bezier, ADB Bezier, and CDP all use cubic interpolation.

  - rule: Less is more
    why: Every hook is a tell. Adding flags or JS injection lowers scores.