A GitHub Action to install the Cosine CLI (cos) in your workflows.
The Cosine CLI is a terminal-native AI coding agent that helps you write, review, and optimize code directly from your terminal. This action downloads and caches the cos binary from Cosine's GitHub releases, making it available to all subsequent steps in your workflow.
name: Example Cosine Workflow
on: [push]
jobs:
example:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Cosine CLI
id: setup-cos
uses: cosineai/setup-cos@v1
with:
version: latest
- name: Run a Cosine command
run: cos version
- name: Use the installed binary path explicitly
run: |
echo "Cosine version: ${{ steps.setup-cos.outputs.version }}"
echo "Cosine binary: ${{ steps.setup-cos.outputs.path }}"
"${{ steps.setup-cos.outputs.path }}" versionYou can combine installation and execution into a single step by providing a mode and prompt:
name: Cosine Auto Run
on: [push]
jobs:
example:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Cosine CLI (install only)
uses: cosineai/setup-cos@v1
with:
version: latest
- name: Setup Cosine CLI (install + auto run)
uses: cosineai/setup-cos@v1
with:
version: latest
mode: auto
prompt: "Review this PR for bugs and style issues"
reasoning: highReady-to-use workflow templates are available in examples/. Copy them into your repository under .github/workflows/ and adapt the prompts and triggers to your needs.
| Example | Trigger | Mode | Description |
|---|---|---|---|
| PR Review | pull_request |
auto |
Automated code review on every PR update. |
| Security Audit | push to main/master |
auto |
Deep security audit with extra-high reasoning. |
| Documentation | workflow_dispatch |
plan then auto |
Preview and apply documentation updates. |
| Model Matrix | workflow_dispatch |
auto |
Run the same prompt across multiple models. |
| Input | Description | Required | Default |
|---|---|---|---|
version |
Version to install. Use latest or a specific tag like v0.1.0. |
No | latest |
mode |
Operating mode: auto, plan, manual, swarm. If set, the action runs cos start --mode <mode> after installation. |
No | |
prompt |
Prompt text to pass to cos via --prompt. Required when mode is set. |
No | |
reasoning |
Reasoning depth: none, low, medium, high, xhigh, adaptive. Passed as --reasoning. |
No | |
model |
Model label (e.g. gemini-3.1-pro, sonnet-4.6). Passed as --model. |
No | |
cwd |
Working directory for the cos run. |
No | ${{ github.workspace }} |
auto-accept |
Automatically accept all changes without prompting. | No | false |
disable-discovery |
Disable automatic discovery of project context. | No | false |
disable-intermediate-updates |
Disable intermediate progress updates. | No | false |
origin |
Origin identifier passed as --origin. |
No | gh-actions |
| Output | Description |
|---|---|
version |
The resolved version string that was installed |
path |
Absolute path to the installed cos binary |
- Linux x64 (
ubuntu-latest) - Linux arm64
- macOS arm64 (
macos-latestApple Silicon)
macOS x64 runners are not supported.
For full CLI documentation, head to https://cosine.sh/docs/cli.
This action is built with TypeScript and bundled with @vercel/ncc.
# Install dependencies
npm ci
# Build the action (generates dist/index.js)
npm run build
# Package for production (minified)
npm run packageNote: The
dist/index.jsfile is checked into git because GitHub Actions requires it at runtime. You must runnpm run buildand commit the updateddist/index.jswhenever you modifysrc/main.ts.
This project is licensed under the MIT License.