Skip to content

Scripts ​

Everything in scripts/, grouped by who runs it. Scripts with a .ps1 twin work the same way on Windows.

Setting up a project ​

ScriptWhat it does
install.sh, install.ps1Sets up a project: MCP config, hooks, commands, rules, profile, git hooks. See Installer
onboard.sh, onboard.ps1Interactive onboarding: asks for the API key, MCP URL and IDEs, writes the MCP config, then hands the hooks and rules to install.sh. --tool claude (or another IDE) skips the prompt; --tool bot prints connection details for a headless agent
uninstall.shRemoves the local Cortex config for every IDE
setup-hooks.shWrites a lefthook.yml from .cortex/project-profile.json, with per-language file filters. Needs python3; installs lefthook if missing
install-extension.sh, install-extension.ps1Installs the cortex-agent VS Code extension into Antigravity, VS Code, Cursor and Windsurf. --ide, --release, --vsix. See Multi-IDE

Setting up a hub ​

ScriptWhat it does
bootstrap.shAsks whether you are an administrator (the whole Docker stack) or a member (connect a project to an existing hub) and runs the matching installer
install-hub.shInstalls the hub: checks dependencies, prepares the directory and environment, starts the stack, builds the shared packages
prune-leaked-images.shEmergency cleanup: removes locally cached Cortex images and the builder cache, in case an image was built with data that should not be in it. Stop the stack first

See Self-host.

Running agents ​

ScriptWhat it does
run-agent.sh, run-agent.ps1The worker bootstrap: downloads the TypeScript worker from your hub, installs cw and starts it. See Run a worker
cortex-agent.sh, cortex-agent.ps1A shell client for the hub's conductor WebSocket that receives tasks and starts an engine. It speaks the hub's first agent protocol
cortex-worker.sh, cortex-worker.ps1A background loop that polls for assigned tasks and runs them with claude -p (or --engine codex). --name, --interval
cortex-listen.shA listener to run in the background inside Claude Code; prints a line when a task arrives
orchestrator-prompt.mdThe prompt that makes an agent the Conductor lead. See Conductor
merge-check.sh <worktree>Checks a parallel agent's worktree before you merge it, ending with an API smoke test when a server is running

Maintaining Cortex ​

ScriptWhat it does
release.shCuts a stable release; see below
bump-version.shChanges version.json: patch (default), minor, major, or set <x.y.z>
sync-install-templates.shCopies the canonical hooks and commands into both installers; --check reports drift and exits 1, for CI. A wrapper around sync_install_templates.py
test-hooks.shTests for the enforcement hooks. Every case is a gap that was open in a shipped version
test-run-agent.shTests for cw as run-agent.sh installs it, against a scratch home folder and a local stand-in hub

Release ​

CI owns the version number. Every merge to master that touches the hub's code claims the next patch version in version.json and publishes the images under it (cortex-api, cortex-hub-web, cortex-mcp, cortex-gitnexus on ghcr.io/lktiep).

A stable release goes through the same workflow:

bash
./scripts/release.sh            # minor (default)
./scripts/release.sh patch      # or major
./scripts/release.sh current    # finish a release whose version was claimed but whose builds failed

The script needs gh. It refuses while another publish run is in progress, asks for confirmation, then runs the Build and Publish Docker Images workflow with stable on. That workflow claims the version, builds every image from one commit, tags them v<version> and :stable, and creates the git tag and a GitHub Release on that same commit. Edit the notes afterwards with:

bash
gh release edit v<version> --notes-file notes.md

A self-hosted stack with Watchtower picks up new images on its own: Watchtower polls every 5 minutes and updates only the containers labelled for it (the Cortex images, not Qdrant or Ollama).

MIT License