Skip to content

Git and GitHub

CortexPrism edited this page Jun 17, 2026 · 1 revision

Git & GitHub Integration

CortexPrism provides full git workspace management and GitHub integration for both the CLI and agent tools.

Git Workspace

Architecture

Agent workspace:   ~/.cortex/data/workspaces/<agent-id>/
Global workspace:  Current working directory

Every agent workspace is automatically git init'd on first access with path traversal protection.

Auto-Commit

Every file write/edit triggers an automatic git commit:

agent/<agent-id>: <tool> <file-path>

Committed on a dedicated workspace/<agent-id> branch.

Git CLI

cortex git status [--agent <id>]
cortex git log [--agent <id>] [--limit 20]
cortex git diff [--agent <id>] [--stat] [--file <path>]
cortex git add <files> [--agent <id>]
cortex git add --all [--agent <id>]
cortex git commit <message> [--agent <id>]
cortex git push [--agent <id>] [--remote origin] [--branch <name>]
cortex git pull [--agent <id>]
cortex git clone <url> <dest> [--branch <name>]
cortex git branch [--agent <id>]
cortex git branch --create <name> [--agent <id>]
cortex git branch --checkout <name> [--agent <id>]
cortex git remote --add <name> --url <url> [--agent <id>]

GitHub Integration

Token Resolution

GitHub token is resolved in order:

  1. githubToken in ~/.cortex/config.json
  2. GITHUB_TOKEN or GH_TOKEN environment variable
  3. github_token entry in the encrypted credential vault

GitHub CLI

cortex github pr list <repo> [--state open] [--limit 10]
cortex github pr create <repo> <title> <head> <base> [--body "..."] [--draft]
cortex github pr merge <repo> <number> [--method merge|squash|rebase]
cortex github issue list <repo> [--state open]
cortex github issue create <repo> <title> [--body "..."] [--labels a,b]
cortex github repo list [--type all|owner|public|private]

Agent Tools

Tool Description
git_push Stage, commit, and push to remote
github_pr_create Create a pull request
github_pr_list List pull requests
github_issue_create Create an issue
github_issue_list List issues

REST API

Endpoint Method Description
/api/workspace/git/status GET Git status
/api/workspace/git/log GET Commit log
/api/workspace/git/branches GET List branches
/api/workspace/git/commit POST Stage all and commit
/api/workspace/git/push POST Push to remote
/api/workspace/git/pull POST Pull from remote
/api/github/token GET Token status
/api/github/repos GET List repos
/api/github/repos/:owner/:name GET Repo details
/api/github/repos/:owner/:name/pulls GET List PRs
/api/github/repos/:owner/:name/issues GET List issues

Web UI

The Web UI includes:

  • Git tab — Visual status, stage, commit, push, pull
  • GitHub tab — PR management, issue tracking, repository browser

See Also

Clone this wiki locally