agent-desktop-ffi

agent-desktop-ffi is a skill for Claude Code, Codex from lahfir/agent-desktop. It costs 122 tokens per session (2,821 once invoked), scanned A, original, Apache-2.0.

A C-compatible interface for controlling agent-desktop through a shared library instead of starting its command-line program for every action.

In plain words
What is it for?
Use it to build and link the library, connect it from another language, inspect desktop state, and perform platform actions.
Why use it?
It lets programs written in languages such as Python, Swift, Go, or C++ call the platform directly while following a defined observe-and-act process.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it to build and link the library, connect it from another language, inspect desktop state, and perform platform actions.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/lahfir/agent-desktop/agent-desktop-ffi
About the project

agent-desktop is a command-line tool that lets AI agents inspect and control desktop applications through operating-system accessibility data instead of screenshots or pixel matching. It is used to automate applications such as Finder, Safari, Xcode, and Slack with structured JSON commands and results.

lahfir/agent-desktop · 1,816 stars · on GitHub

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add lahfir/agent-desktop --skill agent-desktop-ffi
Clone the repo
git clone --depth 1 https://github.com/lahfir/agent-desktop

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for agent-desktop-ffi

README.md
[![agentmods](https://agentmods.dev/badge/skills/lahfir/agent-desktop/agent-desktop-ffi/github.svg)](https://agentmods.dev/skills/lahfir/agent-desktop/agent-desktop-ffi)
Your own site
<a href="https://agentmods.dev/skills/lahfir/agent-desktop/agent-desktop-ffi"><img src="https://agentmods.dev/badge/skills/lahfir/agent-desktop/agent-desktop-ffi/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for agent-desktop-ffi

Your own site · 80×15
<a href="https://agentmods.dev/skills/lahfir/agent-desktop/agent-desktop-ffi"><img src="https://agentmods.dev/badge/skills/lahfir/agent-desktop/agent-desktop-ffi.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 122 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,821 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector warn 7 Sept 2026
SkillSpector: 1 finding, up to medium

These are SkillSpector’s own severities. On a checked sample its high-severity flags on skills were ~96% false positives — a documented command, a public API, a “never do X” rule — so we show them as a caution to read, not a verdict. Why →

  • medium Rogue Agent · line 88
    Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.
    Fix: Remove any persistence mechanisms (cron jobs, startup scripts, state files). Skills should not maintain state across sessions without explicit user consent.
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00122 $0.02821
Opus 5.5 $0.00049 $0.01128
Sonnet 5.5 $0.00024 $0.00564
Haiku 4.5 $0.00012 $0.00282

Measured 4d ago against content hash e8d51ee3b226, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

agent-desktop-ffi scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 4d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/agent-desktop-ffi/SKILL.md · 208 lines

How it starts

The opening of the file, as written. The whole thing — 208 lines — stays where its author put it; the contents beside it link to each section on GitHub.

agent-desktop-ffi

Direct C-ABI access to every PlatformAdapter operation. Build the cdylib with the workspace's release-ffi profile:

cargo build --profile release-ffi -p agent-desktop-ffi

The output is target/release-ffi/libagent_desktop_ffi.dylib (.so on Linux, .dll on Windows) plus a committed C header at crates/ffi/include/agent_desktop.h.

A Python ctypes smoke harness lives at tests/ffi-python/smoke.py and serves as a worked end-to-end example covering the ABI handshake, struct size validation, ad_version, and the snapshot pipeline leg. See tests/ffi-python/README.md for usage.

Four reference topics, loaded as needed:

  • ownership.md — who allocates / who frees, for every *mut T the FFI hands back to the caller.
  • error-handling.md — errno-style last-error contract, enum validation, panic boundary.
  • threading.md — host-thread contract, cross-process mutation serialization, AXIsProcessTrusted inheritance, and adapter-bound native handles.
  • build-and-link.md — ABI handshake, struct size validation, minimal C and Python examples, observe-act workflow, and prebuilt archive locations.

Observe-act workflow (canonical path)

ad_init(AD_ABI_VERSION_MAJOR)                    // verify header ↔ dylib match
adapter = ad_adapter_create_with_session("s1")   // or ad_adapter_create()
rc = ad_snapshot(adapter, "Finder", 0, 10, false, false, &json_out)
// parse json_out: locate snapshot-qualified refs in data.tree
ad_free_string(json_out)
// build action:
AdAction act = {0}; act.kind = AD_ACTION_KIND_CLICK;
rc = ad_execute_by_ref(adapter, "@s8f3k2p9:e5", &act, 0, &result_out)
ad_free_string(result_out)
ad_adapter_destroy(adapter)

ad_snapshot returns a {version, ok, command, data} JSON envelope identical to the CLI output. The data.tree field contains snapshot-qualified ref IDs for interactive elements. Pass a qualified ref to ad_execute_by_ref to drive the pipeline (RefStore load → strict resolution → actionability preflight → dispatch).

Read the full file on GitHub · 208 lines

Files

What ships with it

4 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 4d ago Changed · +2 lines · +11 tokens per session e8d51ee3b226
  2. 1mo ago First seen · 206 lines · 111 tokens per session scan A fe7a1e08c972

Subscribe to this mod's changes

agent-desktop-ffi is a skill published in the GitHub repository lahfir/agent-desktop (1,816 stars, last pushed today), licensed Apache-2.0. It adds 122 tokens to every session and 2,821 once invoked, about $0.0005 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

wikipedia

Search and read Wikipedia via x wkp — MediaWiki API, no API key, zero install; query, extract, suggest, and DDG route in one module. Load for wiki, wikipedia, encyclopedia lookup, article summary.

x-cmd/x-cmd · 49 tokens

cve

Look up CVE records via x cve — cached, zero-API-key, daily xz TSV. Load for cve, vulnerability id, kev, epss, nvd, cvelist, or security advisory.

x-cmd/x-cmd · 49 tokens

voiden

Create and edit Voiden .void files for API testing. Covers the .void file format and all enabled extension block types.

VoidenHQ/voiden · 28 tokens

lap

LAP CLI -- compile, search, and manage API specs for AI agents. Use when working with API specifications (OpenAPI, GraphQL, AsyncAPI, Protobuf, Postman), compiling specs to LAP format, searching the LAP registry, generating skills from API specs, or publishing APIs. Commands: init, compile, search, get, skill…

Lap-Platform/LAP · 89 tokens

scaffold-project

Scaffold a new app, API, backend, fullstack project, mobile app, polyglot service, monorepo, or starter with Better Fullstack. Use when the user wants to create, start, bootstrap, initialize, or generate a project from a stack description. Prefer the bundled Better Fullstack MCP server: guidance, schema…

Marve10s/Better-Fullstack · 80 tokens

csharp-dotnet

Use when writing, reviewing, testing, or shipping C# / .NET code — ASP.NET Core APIs (minimal APIs vs controllers), EF Core data access, async correctness, solution layout in .cs/.csproj/.sln. NOT a Java/Spring backend (that is spring-boot), NOT a Node/TypeScript backend (that is nestjs), NOT framework-neutral REST…

ericrisco/rsc-harness · 89 tokens