Instructions
When working with Git repositories:
Read credentials first using
kybernos/secrets_read:- Read the token from your available secrets (check the system prompt for secret names and keys)
- You will use this token for both git CLI auth and GitHub API calls
Clone the repository using
shell_exec:git clone https://github.com/org/repo.git /workspace/repoFor private repos (or to enable push), embed the token in the URL:
git clone https://<TOKEN>@github.com/org/repo.git /workspace/repoReplace
<TOKEN>with the value you read from secrets.Configure git for push (if you need to push later):
cd /workspace/repo git config user.email "agent@kybernos.io" git config user.name "Kybernos Agent" git remote set-url origin https://<TOKEN>@github.com/org/repo.gitCreate a feature branch before making changes:
cd /workspace/repo && git checkout -b feature/descriptionUse descriptive branch names:
feature/add-auth,fix/login-bug, etc.Make changes using file_write and file_edit tools, then stage and commit:
git add -A git commit -m "descriptive commit message"Write clear, concise commit messages describing why, not just what.
Push to remote:
git push -u origin feature/descriptionCreate a pull request via GitHub API using
http_request:POST https://api.github.com/repos/{owner}/{repo}/pulls Authorization: Bearer <TOKEN> { "title": "Short descriptive title", "body": "## Summary\n- Change 1\n- Change 2", "head": "feature/description", "base": "main" }Use the same token from step 1 in the Authorization header.
Check CI status after creating the PR:
GET https://api.github.com/repos/{owner}/{repo}/commits/{sha}/check-runs Authorization: Bearer <TOKEN>
Error Recovery
- Authentication failures: Re-read the secret using
kybernos/secrets_read. Check that you are using the correct secret name and key (listed in your system prompt under Available Secrets). If the key is wrong, the error will list available keys. - Clone fails: Ensure the token is embedded in the clone URL for private repos. If the repo is public, try cloning without the token first.
- Merge conflicts: Run
git statusto identify conflicting files. Resolve conflicts in each file using file_read + file_edit, thengit addandgit commit. Never force-push without explicit user approval. - Push rejected (non-fast-forward): Pull latest changes first:
git pull --rebase origin main, then push again. - Rate limiting: GitHub API returns 403 with
X-RateLimit-Remaining: 0. Wait untilX-RateLimit-Resettimestamp before retrying.
Example: Full PR Workflow
Here is the complete sequence for "Clone repo X, add a README, and create a PR":
Read credentials:
- Tool:
kybernos/secrets_readwithname: "github-token",key: "token" - Result:
ghp_abc123...
- Tool:
Clone with token:
- Tool:
shell_execwithcommand: "git clone https://ghp_abc123@github.com/org/repo.git /workspace/repo"
- Tool:
Configure git and create branch:
- Tool:
shell_execwithcommand: "cd /workspace/repo && git config user.email 'agent@kybernos.io' && git config user.name 'Kybernos Agent' && git checkout -b docs/add-readme"
- Tool:
Create the file:
- Tool:
file_writewithpath: "/workspace/repo/README.md",content: "# Repo\n\nDescription here."
- Tool:
Stage, commit, push:
- Tool:
shell_execwithcommand: "cd /workspace/repo && git add README.md && git commit -m 'docs: add README' && git push -u origin docs/add-readme"
- Tool:
Create the PR:
- Tool:
http_requestwithmethod: "POST",url: "https://api.github.com/repos/org/repo/pulls",headers: {"Authorization": "Bearer ghp_abc123"},body: {"title": "docs: add README", "body": "Adds a project README.", "head": "docs/add-readme", "base": "main"}
- Tool:
Guardrails
- NEVER commit secrets, credentials, or API keys to version control
- NEVER force-push to main/master branches
- Always create a feature branch — never commit directly to main
- Maximum 10 commits per task
- Always check
git statusbefore committing to avoid staging unwanted files - Use
.gitignoreto exclude build artifacts, dependencies, and secrets
Source: smittysmee/kybernos — distributed by TomeVault.