SightFlow Desktop Agent

repository·main·Indexed 18 days ago

https://github.com/sightflow-dev/sightflow-desktop-agent

An open-source, AI-powered cross-platform desktop RPA client built with Electron, React, and TypeScript. It utilizes Vision-Language Models (VLMs) to interact with desktop software by converting screen pixels into structured semantic actions. Features a working memory engine that records reasoning via 'work-traces' and a 'Learn' capability to distill human actions into reusable Experience Cards and SOPs.

Tokens
21.7K
Snippets
62
Records
88
Agent score
70%

What's inside sightflow-desktop-agent

  1. Understand the Agent/Provider Hub architecture

    main

    SightFlow abstracts the ability to 'analyze screenshots and generate replies' into independent Providers.

    • Manifests: Providers declare their configuration structure via a manifest.json.
    • Bundles: Providers implement logic via a provider.bundle.js entry point, which receives chat screenshots and returns events like reply_text, skip, or error.
    • Discovery: The client pulls a list of available Providers from https://sightflow.dev/provider-hub.json.
    • Caching: The list is cached locally. You can refresh it manually using the refresh button next to the Agent title.
    • Fallback: The built-in 豆包 Seed provider is always available locally as a fallback.
  2. How SightFlow works: See, Think, Do, Learn

    main

    SightFlow operates as a 'Work Memory Engine' that enables AI to interact with desktop software by following a four-stage lifecycle:

    1. See (GUI Understanding): Uses visual models to understand any software interface and its current state.
    2. Think (Planning): Combines context and history to decide on the next logical step.
    3. Do (Execution): Performs actions like clicking, typing, switching windows, or sending messages, mimicking a human operator.
    4. Learn (Trace Recording): Writes every execution into a structured work-trace, which serves as reusable work memory.

    This approach differs from traditional RPA by recording not just the steps taken, but the rationale (the 'why') behind them, enabling replay, evaluation, and inheritance of expertise.

  3. The structure of a work-trace

    main

    Every execution in SightFlow is recorded as a structured work-trace. This allows for replaying actions, evaluating model performance, and inheriting decision-making logic. A work-trace object contains:

    • timestamp: The time of execution.
    • ui_state: The state of the interface at that moment.
    • rationale: The reasoning behind the action (why it was taken).
    • action: The specific operation performed (e.g., click, input, switch, send).
    • result: The outcome of the action.
    work-trace = {
      timestamp,    # Timestamp
      ui_state,     # UI state
      rationale,    # Rationale (why this was done)
      action,       # Click / Input / Switch / Send
      result        # Result
    }
  4. Understand the SightFlow 'Learn' (Work Memory) Capability

    main

    The 'Learn' capability (Work Memory Engine) transforms raw agent execution into structured, actionable knowledge. It moves beyond simple logging to provide a three-layer product capability:

    1. L1 Record Trace: Every execution is captured as a structured work trajectory (local, append-only, and privacy-preserving).
    2. L2 Replay/Evaluate: A timeline-based replay of trajectories allows for quantitative comparison across different models or versions within the same scenario.
    3. L3 Inherit Memory: Trajectories and human interventions are distilled into 'Experience Cards' (SOPs), which are then injected into the runtime to improve future performance.

    This creates a closed loop of: Demonstration → SOP Induction → Execution → Refinement.

  5. Understand the Work Memory Runtime and work-trace

    main

    Unlike traditional RPA that only records steps, SightFlow is a working memory engine that records the reasoning behind actions. Every execution is captured as a structured work-trace.

    A work-trace consists of:

    • timestamp: When the action occurred.
    • ui_state: A description/snapshot of what the screen looked like.
    • rationale: The reasoning (WHY) behind the decision.
    • action: The specific operation (e.g., click, type, switch, send).
    • result: The outcome of the action.

    This structure enables three core capabilities:

    • Replay: Review every step and decision when something breaks.
    • Eval: Compare different models or versions by evaluating their outcomes consistently.
    • Inherit: Capture and reuse human-like judgment for future tasks.
  6. Required capabilities for the Task Layer

    main

    To move from a passive "receive message $\rightarrow$ reply" loop to an active outreach system (like Influencer Outreach), the following capabilities must be implemented in the Task Layer:

    • Campaign / Outreach Lists: Importing lists (CSV/API) to batch-create tasks.
    • Contact State Machine: Managing statuses: 待触达 (To be reached) $\rightarrow$ 已触达 (Reached) $ ightarrow$ 已回复 (Replied) $ ightarrow$ 洽谈中 (Negotiating) $ ightarrow$ 成单/流失 (Closed/Lost).
    • Active Session Primitives: New RPA actions for searching contacts, adding friends, or initiating new sessions (requiring VLM to locate search boxes).
    • Multi-day Follow-up Scheduling: Supporting long-lifecycle tasks (e.g., if no reply after N days, select a follow-up strategy from a card).
    • Result Signal Labeling: Automatic detection of replies/friend additions and manual marking of successful deals to feed back into card statistics.
  7. Understand the Learning Mode pipeline

    main

    Learning Mode is a feature designed to convert screen recordings or live sessions into executable knowledge. It functions as an input adapter for the Work Memory system, allowing an Agent to observe human actions, understand them, and extract structured knowledge (strategies, SOPs, and red lines) that can later be retrieved or executed.

    The pipeline consists of five steps:

    1. Collection: Either via in-app recording (1-2fps screenshots + uiohook keyboard/mouse events) or importing existing MP4 recordings.
    2. Keyframe Extraction: Uses ffmpeg for scene detection and pixel difference (via pixelmatch) to identify significant changes, such as new chat bubbles.
    3. Visual Understanding: Uses a VLM (Vision Language Model) to analyze frames and produce a structured TraceStep (e.g., actor: 'human', source: 'video').
    4. Knowledge Induction: An LLM segments the session into episodes and generates three types of knowledge artifacts with evidence frame references:
      • Communication Strategy Cards: Scenarios/intent $\rightarrow$ phrasing patterns $\rightarrow$ reasoning.
      • Operation SOPs: Non-trivial UI workflows.
      • Red Line Lists: Actions experts avoid (e.g., "never send three messages in a row").
    5. Human Review: A quality gate where business owners confirm, modify, or reject knowledge in a "Pending Review" queue before it enters the permanent memory.
  8. Knowledge types in Learning Mode: Strategy Cards

    main

    In the context of specialized scenarios like Influencer Outreach (达人建联), the most valuable knowledge extracted is phrasing and judgment, rather than simple UI clicks. Knowledge is organized into "Strategy Cards" categorized by:

    • Opening Scripts (开场话术): Segmented by influencer type, platform, or follower count.
    • Objection Handling (异议处理): How to respond to high quotes, being ignored (read-only), or price negotiations.
    • Rhythm Judgment (节奏判断): When to send case studies, when to provide quotes, or when to escalate to a phone call.
    • Red Lines (红线): Prohibited actions (e.g., "never impersonate official staff", "never start with a price cut").
  9. How SightFlow's See-Think-Do-Learn loop works

    main

    SightFlow operates through a continuous four-stage loop that transforms visual input into actionable intelligence:

    1. See: A vision model understands the GUI and its current state.
    2. Think: The agent plans its next move using the current context and historical work-traces.
    3. Do: The agent performs human-like operations: clicking, typing, switching windows, or sending messages.
    4. Learn: The execution is written as a structured work-trace, which compounds into the agent's long-term memory to improve future Think stages.
  10. Integrate a Chat Provider

    main

    The SightFlow desktop client allows external integrators to add chat capabilities (analyzing screenshots and generating replies) by supplying a Provider. A Provider consists of a manifest.json file and a bundled entry file (e.g., provider.bundle.js). The app handles downloading, installation, configuration UI generation, and passing the necessary screenshot and context to your code.

    Provider Package Structure:
    ```text
    provider-root/
      manifest.json
      provider.bundle.js
  11. Install and run SightFlow Desktop Agent

    main

    SightFlow is a cross-platform desktop client built on Electron, React, and TypeScript. To set up a development environment, ensure you have Node.js (LTS) and npm installed.

    Installation steps

    1. Install dependencies: Run npm install to set up the project.
    2. Run in development: Use npm run dev to start the development server.
    3. Build a release: Use the platform-specific build commands to generate executable files:
      • Windows: npm run build:win
      • macOS: npm run build:mac
      • Linux: npm run build:linux

    On the first launch, you must select your target application and complete the region selection. Then, navigate to Settings to configure your API keys.

    npm install
    npm run dev
    # For builds:
    npm run build:win
    npm run build:mac
    npm run build:linux
  12. Install a Provider in the SightFlow App

    main

    To install a new Provider:

    1. Open the SightFlow app settings page.
    2. Locate the "Chat service config manifest URL" field.
    3. Enter the URL or file path to your manifest.json.
    4. Click Install.

    Supported Address Formats:

    • HTTPS: https://example.com/provider/manifest.json
    • Local File: file:///absolute/path/to/provider/manifest.json

    Note: Provide the path to the manifest.json, not the bundle file. The app will resolve the bundle path using the entry field in the manifest.