Skip to content
shift-labs-aiPublic

About

Code mode for agents: turn any API or host capability into an action that code can call

Topics

Resources

Security policy

Stars

168 stars

Watchers

1 watching

Forks

Latest commit

 

History

1,215 Commits

Folders and files

Repository files navigation

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. 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/codemode-bash The bash plugin as a package, published as @shiftlabs/codemode-bash
packages/codemode-powershell The powershell plugin as a package, published as @shiftlabs/codemode-powershell
packages/codemode-duckdb The duckdb plugin as a package, published as @shiftlabs/codemode-duckdb
packages/codemode-node The node plugin as a package, published as @shiftlabs/codemode-node
packages/codemode-websearch The websearch plugin as a package, published as @shiftlabs/codemode-websearch
packages/package-tests What the tests of those packages share. Not published
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 --filter '@shiftlabs/codemode-*' test
bun run check

License

MIT

About

Code mode for agents: turn any API or host capability into an action that code can call

Topics

Resources

Security policy

Stars

168 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages