agentleFS
kentcdoddskentcdodds/kcd-skills/skills/prefer-local-kody-execute/SKILL.md

prefer-local-kody-execute

Skill47 starsChanged 2 months agoMITView on GitHub

Prefer @kodycodes/cli execute --local over hosted MCP execute when the agent has shell + Node. Use when running Kody execute / calling Kody from an agent that can run local commands.

The file

We split this skill into the rules it gives an agent

6 rules. About 0 are common, 1 is distinctive, and 5 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 5

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Default: run execute modules on the agent machine with @kodycodes/cli execute --local.

    line 11
  2. Very specific:

    After kody login, skip minting a temporary API token for local execute.

    line 33
  3. Distinctive:

    No Node / CLI on the machine

    line 39
  4. Very specific:

    Only when interactive kody login is not available (CI, Cloud Agents without a provisioned secret, other headless hosts).

    line 64
  5. Very specific:

    Add other scopes the module needs (for example packages:read).

    line 77
  6. Very specific:

    Prefer a provisioned KODY_API_TOKEN secret / env var in the cloud environment before --local works.

    line 90

≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Prefer local Kody execute

Default: run execute modules on the agent machine with @kodycodes/cli execute --local. Hosted MCP execute is the fallback.

Public docs: https://kody.codes/docs/open-api

Prefer local when

  • Node.js ≥ 22 is available
  • @kodycodes/cli can be run (npx is fine)
  • Auth is available via kody login and/or KODY_API_TOKEN (see below)
  • The work does not require the hosted cloud workerd

Auth for --local

Priority:

  1. --token / KODY_API_TOKEN (scoped kody_at_…) when set — typical for CI and Cloud Agents
  2. Else the stored CLI MCP OAuth access token from kody login (no under-the-hood tokenCreate) — default for interactive agents
  3. Else a clear “login or provide a token” error

After kody login, skip minting a temporary API token for local execute. CapabilityProxy and package-graph accept that OAuth Bearer when the local-execute flag is on.

Use hosted MCP execute when

  • No Node / CLI on the machine
  • The module must run in Kody's cloud workerd
  • Neither login nor a token is available (kody login not possible and KODY_API_TOKEN missing)

Feature flags

Open API and local execute need mcp-api-tool and local-execute (experiments cohort, or per-user opt-in on the docs page). Without them, --local will not work.

Run locally (default)

kody login   # once, if not already logged in
npx @kodycodes/cli execute --local --code 'export default async function main() { return await kody.metaGetCurrentUser({}) }'

Omit --token when using login OAuth. Prefer KODY_API_TOKEN in the environment over --token when a scoped token is already set, so the secret is not visible in process arguments. --file works the same as --code for longer modules.

Mint a token (CI / headless only)

Only when interactive kody login is not available (CI, Cloud Agents without a provisioned secret, other headless hosts). Call MCP api (or Open API) with:

{
	"operationId": "tokenCreate",
	"params": {
		"name": "kody-cli",
		"scopes": ["local-execute", "account:read"]
	}
}

Add other scopes the module needs (for example packages:read). The token value is returned once. Store it as KODY_API_TOKEN or pass --token. Never paste the token into chat.

Revoke with MCP api tokenRevoke when done with a short-lived token.

Metering

Local CPU is not counted as execute or dynamic_worker_day. Capabilities called through the proxy still meter normally.

Cloud agents

Prefer a provisioned KODY_API_TOKEN secret / env var in the cloud environment before --local works. Do not treat interactive mint as the first path for desktop agents — those should use kody login + execute --local (omit --token). If the cloud secret is missing and MCP api can mint one for the session, mint, export into the shell, and do not echo it. If neither path is available, fall back to hosted MCP execute.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.