From 950c1ea5c3c6d8b6298012a45165a9bc213a5826 Mon Sep 17 00:00:00 2001 From: Wauplin Date: Tue, 2 Jun 2026 14:17:58 +0200 Subject: [PATCH 1/4] Add agent harnesses registry to @huggingface/tasks Single mapping of AI coding agents/harnesses known to use the Hub, so that new harnesses can be registered here rather than hardcoded in huggingface_hub. Co-Authored-By: Claude Opus 4.8 (1M context) --- packages/tasks/src/agent-harnesses.ts | 164 ++++++++++++++++++++++++++ packages/tasks/src/index.ts | 3 + 2 files changed, 167 insertions(+) create mode 100644 packages/tasks/src/agent-harnesses.ts diff --git a/packages/tasks/src/agent-harnesses.ts b/packages/tasks/src/agent-harnesses.ts new file mode 100644 index 0000000000..40460783fa --- /dev/null +++ b/packages/tasks/src/agent-harnesses.ts @@ -0,0 +1,164 @@ +/** + * Registry of AI coding agents / harnesses known to use the Hugging Face Hub. + * + * To add your harness, append an entry below keyed by its `id` (the name used + * when reporting Hub activity), and list the environment variable(s) that + * identify it. + */ +export interface AgentHarness { + /** + * Human-readable name of the harness, e.g. displayed in a leaderboard. + */ + prettyLabel: string; + /** + * URL to the harness's code repository (usually on GitHub). + */ + repoUrl?: string; + /** + * URL to the harness's documentation or website. + */ + docsUrl?: string; + /** + * Short description of the harness. + */ + description?: string; + /** + * Environment variable(s) that identify this harness, mapped to the value + * pattern they must match. Detection matches if ANY entry matches. + * + * The value pattern is one of: + * - `"*"`: the variable is set to any (non-empty) value + * - `""`: the variable equals this exact value + * - `"*"`: the variable value starts with `` (fuzzy match, resolved client-side) + * + * If not provided, the harness is detected through the standard AI_AGENT / AGENT variables only. + */ + envVars?: Record; +} + +/** + * Standard environment variables that any tool can set to identify itself. + * When one of these is set, its value is used directly as the agent `id` + * (matched against the keys of `AGENT_HARNESSES`); unrecognized values are + * reported as `"unknown"`. + */ +export const STANDARD_AGENT_ENV_VARS = ["AI_AGENT", "AGENT"] as const; + +/** + * Add your new agent harness here. + * + * /!\ IMPORTANT + * + * Insertion order matters for detection priority: harnesses are checked from + * top to bottom and the first match wins. In particular, `cowork` must stay + * before `claude-code` so the more specific signal takes priority when both + * `CLAUDE_CODE` and `CLAUDE_CODE_IS_COWORK` are set. + */ +export const AGENT_HARNESSES = { + antigravity: { + prettyLabel: "Antigravity", + docsUrl: "https://antigravity.google", + description: "Agentic development platform from Google built around Gemini.", + envVars: { ANTIGRAVITY_AGENT: "*" }, + }, + "augment-cli": { + prettyLabel: "Augment CLI", + repoUrl: "https://github.com/augmentcode/auggie", + docsUrl: "https://www.augmentcode.com", + description: "Auggie, the command-line coding agent from Augment Code.", + envVars: { AUGMENT_AGENT: "*" }, + }, + cline: { + prettyLabel: "Cline", + repoUrl: "https://github.com/cline/cline", + docsUrl: "https://cline.bot", + description: "Open-source autonomous coding agent for VS Code.", + envVars: { CLINE_ACTIVE: "*" }, + }, + cowork: { // must stay before `claude-code` so the more specific signal takes priority when both `CLAUDE_CODE` and `CLAUDE_CODE_IS_COWORK` are set. + prettyLabel: "Cowork", + docsUrl: "https://claude.com/product/cowork", + description: "Anthropic's agent for autonomous knowledge work, built on top of Claude Code.", + envVars: { CLAUDE_CODE_IS_COWORK: "*" }, + }, + "claude-code": { + prettyLabel: "Claude Code", + repoUrl: "https://github.com/anthropics/claude-code", + docsUrl: "https://code.claude.com/docs", + description: "Anthropic's agentic coding tool that lives in your terminal.", + envVars: { CLAUDECODE: "*", CLAUDE_CODE: "*" }, + }, + codex: { + prettyLabel: "Codex", + repoUrl: "https://github.com/openai/codex", + docsUrl: "https://developers.openai.com/codex", + description: "OpenAI's lightweight coding agent that runs in your terminal.", + envVars: { CODEX_SANDBOX: "*", CODEX_CI: "*", CODEX_THREAD_ID: "*" }, + }, + cursor: { + prettyLabel: "Cursor", + docsUrl: "https://cursor.com", + description: "AI-powered code editor.", + envVars: { CURSOR_TRACE_ID: "*" }, + }, + "cursor-cli": { + prettyLabel: "Cursor CLI", + docsUrl: "https://cursor.com/docs/cli/overview", + description: "Cursor's coding agent for the command line.", + envVars: { CURSOR_AGENT: "*" }, + }, + "github-copilot": { + prettyLabel: "GitHub Copilot", + docsUrl: "https://docs.github.com/copilot", + description: "GitHub's AI coding assistant.", + envVars: { COPILOT_MODEL: "*", COPILOT_ALLOW_ALL: "*", COPILOT_GITHUB_TOKEN: "*" }, + }, + goose: { + prettyLabel: "Goose", + repoUrl: "https://github.com/aaif-goose/goose", + docsUrl: "https://goose-docs.ai/", + description: "Open-source, extensible AI agent, originally from Block and now part of the Agentic AI Foundation.", + envVars: { GOOSE_TERMINAL: "*" }, + }, + openclaw: { + prettyLabel: "OpenClaw", + repoUrl: "https://github.com/openclaw/openclaw", + docsUrl: "https://openclaw.ai", + description: "Open-source, self-hosted personal AI assistant that runs on your own devices.", + envVars: { OPENCLAW_SHELL: "*" }, + }, + opencode: { + prettyLabel: "opencode", + repoUrl: "https://github.com/anomalyco/opencode", + docsUrl: "https://opencode.ai", + description: "Open-source AI coding agent built for the terminal.", + envVars: { OPENCODE_CLIENT: "*" }, + }, + pi: { + prettyLabel: "Pi", + repoUrl: "https://github.com/earendil-works/pi", + docsUrl: "https://pi.dev", + description: "Minimal, self-extensible terminal coding agent with a unified multi-provider LLM API.", + envVars: { PI_CODING_AGENT: "*" }, + }, + replit: { + prettyLabel: "Replit", + docsUrl: "https://replit.com", + description: "Cloud development environment with an AI coding agent.", + envVars: { REPL_ID: "*" }, + }, + trae: { + prettyLabel: "Trae", + docsUrl: "https://trae.ai", + description: "AI-powered IDE from ByteDance.", + envVars: { TRAE_AI_SHELL_ID: "*" }, + }, + devin: { + prettyLabel: "Devin", + docsUrl: "https://devin.ai", + description: "Autonomous AI software engineer from Cognition.", + }, +} satisfies Record; + +/// List of the agent harnesses known to the Hub +export type AgentHarnessKey = keyof typeof AGENT_HARNESSES; diff --git a/packages/tasks/src/index.ts b/packages/tasks/src/index.ts index e0817fbad6..769f6f2488 100644 --- a/packages/tasks/src/index.ts +++ b/packages/tasks/src/index.ts @@ -73,3 +73,6 @@ export type { KernelLibraryKey, KernelLibraryUiElement } from "./kernel-librarie export * from "./inference-providers.js"; export { EVALUATION_FRAMEWORKS } from "./eval.js"; + +export { AGENT_HARNESSES, STANDARD_AGENT_ENV_VARS } from "./agent-harnesses.js"; +export type { AgentHarness, AgentHarnessKey } from "./agent-harnesses.js"; From 1bc6e85021f9130b0ba557621c80606f430dc5b8 Mon Sep 17 00:00:00 2001 From: Wauplin Date: Tue, 2 Jun 2026 14:30:51 +0200 Subject: [PATCH 2/4] lint --- packages/tasks/src/agent-harnesses.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/tasks/src/agent-harnesses.ts b/packages/tasks/src/agent-harnesses.ts index 40460783fa..cdbcb50997 100644 --- a/packages/tasks/src/agent-harnesses.ts +++ b/packages/tasks/src/agent-harnesses.ts @@ -30,7 +30,7 @@ export interface AgentHarness { * - `"*"`: the variable is set to any (non-empty) value * - `""`: the variable equals this exact value * - `"*"`: the variable value starts with `` (fuzzy match, resolved client-side) - * + * * If not provided, the harness is detected through the standard AI_AGENT / AGENT variables only. */ envVars?: Record; @@ -75,7 +75,8 @@ export const AGENT_HARNESSES = { description: "Open-source autonomous coding agent for VS Code.", envVars: { CLINE_ACTIVE: "*" }, }, - cowork: { // must stay before `claude-code` so the more specific signal takes priority when both `CLAUDE_CODE` and `CLAUDE_CODE_IS_COWORK` are set. + cowork: { + // must stay before `claude-code` so the more specific signal takes priority when both `CLAUDE_CODE` and `CLAUDE_CODE_IS_COWORK` are set. prettyLabel: "Cowork", docsUrl: "https://claude.com/product/cowork", description: "Anthropic's agent for autonomous knowledge work, built on top of Claude Code.", From 61b2af9f792cc35d6a83fd963b9a43f48c9e6b85 Mon Sep 17 00:00:00 2001 From: Wauplin Date: Tue, 2 Jun 2026 14:38:22 +0200 Subject: [PATCH 3/4] update codeowners --- CODEOWNERS | 1 + 1 file changed, 1 insertion(+) diff --git a/CODEOWNERS b/CODEOWNERS index 10208069b0..02ae4d1645 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -6,6 +6,7 @@ /packages/tasks/ @SBrandeis @gary149 @Wauplin @julien-c @pcuenca @ngxson /packages/tasks/src/eval.ts @krampstudio @NathanHB @gary149 @julien-c @pcuenca +/packages/tasks/src/agent-harnesses.ts @Wauplin @hanouticelina @davanstrien @gary149 @julien-c @pcuenca # Ownership for the Hub Package From a49be1089f65f34a331c87b854c88154b3d355c1 Mon Sep 17 00:00:00 2001 From: Wauplin Date: Tue, 2 Jun 2026 14:53:09 +0200 Subject: [PATCH 4/4] Order cursor-cli before cursor for detection priority When the Cursor CLI runs inside the Cursor editor's integrated terminal, child processes inherit CURSOR_TRACE_ID and the CLI also sets CURSOR_AGENT. With first-match-wins detection, the more specific cursor-cli must be checked before cursor so it isn't masked by the editor signal. Co-Authored-By: Claude Opus 4.8 (1M context) --- packages/tasks/src/agent-harnesses.ts | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/packages/tasks/src/agent-harnesses.ts b/packages/tasks/src/agent-harnesses.ts index cdbcb50997..b62f63d570 100644 --- a/packages/tasks/src/agent-harnesses.ts +++ b/packages/tasks/src/agent-harnesses.ts @@ -96,18 +96,20 @@ export const AGENT_HARNESSES = { description: "OpenAI's lightweight coding agent that runs in your terminal.", envVars: { CODEX_SANDBOX: "*", CODEX_CI: "*", CODEX_THREAD_ID: "*" }, }, - cursor: { - prettyLabel: "Cursor", - docsUrl: "https://cursor.com", - description: "AI-powered code editor.", - envVars: { CURSOR_TRACE_ID: "*" }, - }, "cursor-cli": { + // must stay before `cursor` so the more specific signal takes priority: when the CLI runs inside + // the Cursor editor's terminal, child processes inherit `CURSOR_TRACE_ID` and the CLI sets `CURSOR_AGENT`. prettyLabel: "Cursor CLI", docsUrl: "https://cursor.com/docs/cli/overview", description: "Cursor's coding agent for the command line.", envVars: { CURSOR_AGENT: "*" }, }, + cursor: { + prettyLabel: "Cursor", + docsUrl: "https://cursor.com", + description: "AI-powered code editor.", + envVars: { CURSOR_TRACE_ID: "*" }, + }, "github-copilot": { prettyLabel: "GitHub Copilot", docsUrl: "https://docs.github.com/copilot",