Profile
Back to NewsBack
GitHub Trending 3 min
Reader Mode
shift-labs-ai/codemode: Code mode for agents: turn any API or host capability into an action that code can call

shift-labs-ai/codemode: Code mode for agents: turn any API or host capability into an action that code can call

Codemode

Codemode turns APIs and host capabilities into actions, and an agent calls them by writing JavaScript.

Each configured plugin is a global in that code. One run can search for an action, check its input, call several services, and return a single value, so an agent needs one tool instead of one per endpoint.

Codemode ships with plugins for more than 200 services. Add your own with a plugin file, install and share them as packages through npm or git, or add an MCP server and call its tools as actions.

Use codemode from the command line, embed it with the TypeScript SDK, or add it to Pi with pi-runline.

Getting started

Install the command-line interface. This requires Node.js 22.12 or newer, or 20.19 or newer on the Node.js 20 line:

npm install -g @shiftlabs/codemode

Create a project and add a connection for the plugin you want to use:

codemode init
codemode connection add gh --plugin github --set token=$GITHUB_TOKEN

Run code that calls its actions:

codemode exec '
  const issue = await github.issue.create({
    owner: "acme",
    repo: "api",
    title: "Login fails for SSO users",
  });
  return issue.number;
'

Code discovers actions from inside a run, without a schema dump in the prompt:

codemode exec 'return actions.find("create issue")'
codemode exec 'return actions.describe("github.issue.create")'

See the documentation for the quickstart, the guides, and the command, configuration, and credentials reference.

Permissions

Codemode is not a sandbox. Plugins run inside the codemode process with its permissions, and the worker thread that runs code can load Node.js modules. Actions that write, send, or delete run without asking.

Codemode loads a project's plugins and packages, and starts its MCP servers, only after you trust the project. Review third-party packages and MCP servers before adding them, and isolate the process when the code is untrusted. See Security.

Related projects

dripline is query mode: SQL tables over live APIs. Codemode is JavaScript actions over the same kind of APIs. Use dripline to select rows, and codemode to create, update, delete, or chain calls.

Development

Codemode is a Bun workspace with three packages. It was called runline through 0.45; see Migrate from runline.

| Package | Contents | |---|---| | packages/codemode | The library and command-line interface, published as @shiftlabs/codemode | | packages/codemode-plugins | The bundled plugins, built into codemode's dist | | packages/runline | The runline package on npm, which forwards to codemode until 0.48.0 |

Install dependencies and run the command-line interface from source:

bun install
bun --filter @shiftlabs/codemode dev -- exec 'return 1 + 2'

Before submitting changes, run:

bun --filter @shiftlabs/codemode build
bun run typecheck
bun --filter @shiftlabs/codemode test
bun run check

License

MIT

Chat with me