openclip AGENTS.md

Repository instructions for OpenClip, a macOS utility that turns selected text into actions. They cover its Swift app, its small Next.js website, and how the project is built and tested.

In plain words
What is it for?
Building, testing, packaging, cleaning, and extending OpenClip, including its optional extension catalogue and separate website instructions.
Why use it?
They give coding agents the project rules and commands needed to change the right files and verify that the app still works. They also explain that the Xcode project is generated, so manual edits there may be lost.

Instructions file for CodexOpenCode

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.

agentmods
npx agentmods add instructions/ganeshmshetty/openclip/agents-md
Clone the repo
git clone --depth 1 https://github.com/ganeshmshetty/openclip

Made for: Codex, OpenCode.

Per session 1,350 This file is loaded in full into every session.
When invoked 1,350 The same file — it is already loaded in full.
Security scan A 0 findings. Scan, not verified.
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 $0.01350 $0.01350
Opus 5 $0.00675 $0.00675
Sonnet 5 $0.00270 $0.00270
Haiku 4.5 $0.00135 $0.00135

Measured 3d ago against content hash 647a21ac4a27, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

openclip AGENTS.md 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 3d 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.

AGENTS.md · 65 lines

How it starts

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

AGENTS.md

OpenClip is a macOS floating-popup utility (Swift 6, macOS 14+, AppKit + SwiftUI) that turns selected text into actions. The repo is a Swift app plus a small Next.js marketing site under web/ (which has its own web/AGENTS.md).

Build & test

The Xcode project is generated by XcodeGen from project.yml, not edited by hand. After adding/removing .swift files, re-run xcodegen generate (the scripts re-run it automatically).

git submodule update --init            # populate Extensions/ catalog submodule (optional, for extension authoring)
./scripts/dev_run.sh                   # build Debug + launch from DerivedData (logs: /tmp/openclip.log)
./scripts/test.sh core                 # fast Core domain test suite (<1s)
./scripts/test.sh                      # full test suite (0 skips, ~45s)
./scripts/test.sh ActionRegistryTests  # single test class
./scripts/package_app.sh               # Release build -> build/OpenClip.zip
./scripts/clean.sh                     # wipe DerivedData/build caches

All Swift is Swift 6 with SWIFT_STRICT_CONCURRENCY: complete. Targets (see project.yml): Core (pure domain framework), OpenClip (app), OpenClipTests. SPM deps: KeyboardShortcuts, SDWebImageSwiftUI/SVGCoder.

Architecture hard rules

  • Core is pure — no AppKit/SwiftUI imports in Sources/Core/, and the boundary is enforced by concept, not just import-grepping: UI-only presentation concerns (popup sizing/timing constants, chrome-style presentation metadata) live in Sources/OpenClip/ — e.g. PopupMetrics holds popup/search sizing and ResultCardView renders action results natively — while Core/Selection/Constants.swift keeps only domain/runtime constants (timeouts, key codes, env vars, manifest keys). Platform side-effects live in Sources/OpenClip/ (runtimes, ActionResultHandler, DefaultActionFactory).
  • No direct UserDefaults.standard in new code — route through SettingsStore + SettingKey. The only remaining raw access is the one-time aiCloudAPIKey migration in AIServiceManager (read-then-delete); don't add more. Secrets (AI API key, secret options) go to SecretStore (~/.openclip/secrets.json with 0600 POSIX permissions), never UserDefaults.
  • ActionCoordinator is the composition root. Managers report registry changes via onRegister/onUnregister callbacks only; nothing else touches ActionRegistry.shared.
  • No switch action.id string-matching in UI/presentation — use ActionChrome / ConfigurableAction.preferenceIconName instead.
  • Any new subprocess-spawning action must kill the child after Constants.scriptTimeout (30 s, the shared watchdog); shell/AppleScript/JS runtimes all join the existing ShellProcessRunner executor rather than spawning their own.
  • Verified current-state details (incl. residual debt and the search/content popup modes) live in docs/architecture/known-debt.md — update it when you touch those areas.

Read the full file on GitHub · 65 lines

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. 3d ago First seen · 65 lines · 1,350 tokens per session scan A 647a21ac4a27

Subscribe to this mod's changes

openclip AGENTS.md is an instructions file published in the GitHub repository ganeshmshetty/openclip (26 stars, last pushed 5d ago), licensed MIT. It adds 1,350 tokens to every session, about $0.0068 per session on Opus 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.