agent-desktop-ffi

Provides C-ABI bindings to access agent-desktop's PlatformAdapter for low-level application interaction.

1.0k|64|Updated Feb 19, 2026
One-click install
npx skills add https://github.com/lahfir/agent-desktop --skill agent-desktop-ffi
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: agent-desktop-ffi
Source: https://github.com/lahfir/agent-desktop/tree/main/skills/agent-desktop-ffi
Command: npx skills add https://github.com/lahfir/agent-desktop --skill agent-desktop-ffi

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires agent-desktop, and includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill provides direct C-ABI bindings to agent-desktop's PlatformAdapter, allowing for low-level interaction with applications via OS accessibility trees, without the need for spawning the CLI binary per call.

Core Features & Use Cases

  • C-ABI Bindings: Consumers can link to libagent_desktop_ffi and call ad_* functions directly.
  • Observe-Act Workflow: Supports the canonical observe-act workflow with ad_init, ad_snapshot, ad_execute_by_ref, and ad_free_string.
  • Session Adapters: Manages session namespaces for refmap persistence using ad_adapter_create_with_session.
  • Structured Session Trace: Enables file-based JSONL tracing for debugging and analysis.
  • Main Thread Requirement: Ensures that all adapter-touching entrypoints are called from the main thread on macOS.

Quick Start

Initialize the adapter and create a session:

ad_init(AD_ABI_VERSION_MAJOR)
adapter = ad_adapter_create_with_session("s1")

Frequently Asked Questions about agent-desktop-ffi

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I interact with OS accessibility trees without spawning a CLI binary per call?

Direct C-ABI bindings to the agent-desktop PlatformAdapter allow low-level application interaction via OS accessibility trees, eliminating the overhead of spawning a CLI binary per call. You link to libagent_desktop_ffi and invoke ad_* functions directly.

What is the observe-act workflow for C-ABI application interaction?

The observe-act workflow uses ad_init for initialization, ad_snapshot to capture state, ad_execute_by_ref to perform actions, and ad_free_string to release memory. This canonical sequence manages low-level application interaction through the PlatformAdapter.

Does agent-desktop C-ABI require a specific thread for macOS accessibility?

Yes, macOS requires all adapter-touching entrypoints to be called from the main thread. This constraint ensures stable low-level application interaction and proper communication with the OS accessibility tree.

How do I persist refmaps across multiple application interaction sessions?

You persist refmaps by managing session namespaces with ad_adapter_create_with_session. This function initializes a dedicated session adapter that maintains refmap state for consistent low-level application interaction.

Can I trace and debug C-ABI application interaction calls?

Yes, structured session tracing enables file-based JSONL tracing for debugging and analysis. This records the C-ABI application interaction calls made through the PlatformAdapter, allowing you to inspect the execution flow.

What prerequisites do I need to use C-ABI bindings for agent-desktop?

Using these C-ABI bindings requires agent-desktop installed and a C-ABI compatible environment. It is designed for advanced users familiar with C-ABI and application accessibility concepts.