Skip to main content

Code Triggers

Code triggers let you configure a prompt that runs against a repository — on a schedule, or manually — without keeping a local CLI session open. Each run spins up a real agent that executes your prompt against the repo and branch you specify.

Creating a trigger

curl -X POST https://api.ainative.studio/v1/code/triggers \
-H "Authorization: Bearer $AINATIVE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "nightly-dependency-check",
"schedule": "manual",
"prompt": "Check for outdated dependencies and open a PR if any are more than one major version behind.",
"repo": "your-org/your-repo",
"branch": "main",
"github_token": "ghp_..."
}'
FieldRequiredDescription
nameYesA label for the trigger
scheduleYesCron expression, or "manual" for on-demand only
promptYesThe task to run against the repo
repoYesorg/repo
branchYesBranch to target
github_tokenYes, to runA token with access to repo — used to read files and open a PR. Required for a run to actually execute — a trigger without one will fail with a clear error rather than silently doing nothing. Write-only: never returned by any response.
use_memoryNo, default trueSee Project memory below

Running a trigger

curl -X POST https://api.ainative.studio/v1/code/triggers/<id>/run \
-H "Authorization: Bearer $AINATIVE_API_KEY"

Runs bill to your own account — a trigger only ever executes with your own GitHub token and on your own usage.

Project memory

By default (use_memory: true), each run automatically:

  • Recalls relevant context from your project's memory before starting — the same automatic project memory described in Memory, scoped to the trigger's repo.
  • Stores a summary of what the run did after it finishes.

This means a scheduled trigger and your local Cody CLI sessions on the same repo build up and draw from the same project memory over time. Set use_memory: false on a trigger if you'd rather it run without any memory context.

Listing and deleting

# List
curl https://api.ainative.studio/v1/code/triggers \
-H "Authorization: Bearer $AINATIVE_API_KEY"

# Delete
curl -X DELETE https://api.ainative.studio/v1/code/triggers/<id> \
-H "Authorization: Bearer $AINATIVE_API_KEY"