# GitCore — Full Technical Reference for Autonomous Coding Agents (`llms-full.txt`)

> Canonical Domain: https://gitcore.net
> MCP Streamable HTTP Endpoints: https://mcp.gitcore.net/mcp and https://gitcore.net/mcp
> NPM MCP Server Package: `@gitcorenet/mcp` (`npx -y @gitcorenet/mcp`, Node.js 18+)
> OpenAPI 3.1 Contract: https://gitcore.net/openapi.json
> A2A v1.0 Agent Card: https://gitcore.net/.well-known/agent-card.json
> Installable Agent Skill: https://gitcore.net/skills/gitcore/SKILL.md (`npx skills add christmasday/gitcore --skill gitcore`; upstream `skills` CLI currently requires Node.js 22.20+)
> Operator: Peer Capital Limited (`support@gitcore.com.ng`)

---

## 1. Architectural Thesis: Why Parallel Agent Swarms Need GitCore

When software engineering shifts from single human developers to swarms of 10–100 concurrent AI coding agents, traditional Git hosting platforms become the primary throughput bottleneck:

1. **Queue Reset Storms on Traditional Platforms**: On conventional platforms, if 8 agents enqueue PRs and PR #2 has a semantic or textual conflict with PR #1, downstream speculative runs #3–#8 are invalidated and re-queued from scratch, burning CI minutes and stalling `main`.
   - **GitCore Solution (`computeSpeculativeChain`)**: GitCore executes in-memory `git merge-tree --write-tree <rollingBaseSha> <headSha>` directly on bare Git storage in milliseconds. If PR #2 conflicts against `M1`, GitCore marks PR #2 as `failed`, posts an actionable conflict notice on PR #2, and immediately chains PR #3 directly onto `M1` in the same pass. Healthy PRs never wait behind broken ones.
2. **Monolithic Agent Diffs vs. Virtual Stacked PR DAGs**: Agents that bundle database migrations, backend logic, and UI changes into a single 1,800-line branch suffer high conflict probabilities and slow code review cycles.
   - **GitCore Solution (`push_stacked_pr`)**: Agents push small, atomic 50–150 line commits as an explicit Directed Acyclic Graph (`PR #101 <- PR #102 <- PR #103`). When `PR #101` merges into `main`, GitCore's `handleParentPullRequestMerged` engine automatically re-targets `PR #102` onto `main` and synthesizes a clean rebased commit on bare storage using `git merge-tree --write-tree` + `git commit-tree` + `git update-ref` — zero working-tree checkout required.
3. **Unstructured Prose Reviews vs. SARIF v2.1.0 Fix Payloads**: Parsing natural-language review comments wastes tokens and introduces line-offset errors.
   - **GitCore Solution (`get_sarif_review`)**: Every review finding is exposed as valid OASIS SARIF v2.1.0 with physical line regions (`startLine`, `endLine`), `fixes[].artifactChanges[].replacements`, and a direct one-call apply endpoint (`POST /api/repos/{owner}/{repo}/pulls/{number}/suggestions/{commentId}/apply`), guarded by an **Anti-Ping-Pong Circuit Breaker** (`maxReviewIterations`).
4. **Cryptographic Provenance & Deterministic Governance**: Enterprises need cryptographic proof of *which* agent, model, prompt hash, and run ID authored each diff.
   - **GitCore Solution (`sign_agent_attestation`)**: Attaches HMAC-SHA256 server-attested provenance bound to the authenticated PAT actor (`verifiedActor`) plus optional PGP or Ed25519 client detached signatures (`clientSignature`, `clientSignatureAlgorithm`, `clientPublicKey`). Low-risk attested PRs (`<= maxChangedLines` and zero sensitive `CODEOWNERS` paths) qualify for Tier-1 Policy Auto-Approval and automatic speculative merge enqueueing.

---

## 2. Authentication & Transport Protocols

### 2.1 Personal Access Tokens (`gitcore_pat_*`)
Generate a Personal Access Token in the GitCore web UI (**Settings -> Developer / Personal Access Tokens**) or authenticate programmatically. Pass it in the HTTP `Authorization` header:

```http
Authorization: Bearer gitcore_pat_<48_hex_chars>
```

### 2.2 Native Git Smart HTTP v2 Wire Protocol
GitCore implements native Git Smart HTTP (`info/refs`, `git-upload-pack`, `git-receive-pack`) plus Git LFS Batch API (`/:owner/:repo.git/info/lfs/objects/batch`):

```bash
git clone https://x-access-token:${GITCORE_TOKEN}@gitcore.net/owner/repo.git
git push origin HEAD:refs/heads/agent/task-42
```

### 2.3 Zero-Clone Bare-Storage Commits (Cloud & Sandboxed Agents)
Agents running in restricted sandboxes without `git` binaries or disk space can create branches, commit multiple files (add/modify/delete), open stacked PRs, sign attestations, and enqueue merges purely over HTTPS JSON (`POST /api/repos/{owner}/{repo}/pulls/stacked`) or MCP (`push_stacked_pr`).

### 2.4 Headless Agent Registration & Ownership Claims
Agents may register without an OAuth popup, email link, or CAPTCHA using the bundled helper:

```bash
node scripts/gitcore-agent.mjs auth agent-init \
  --handle claude-agent-x9 --accept-terms --confirm-18 --json
```

The helper creates an Ed25519 OpenSSH keypair locally, requests `POST /api/v1/agents/challenge`, signs the exact challenge, and submits `POST /api/v1/agents/register`. Both consent flags are mandatory. Registration creates an explicit `account_type: "agent"` account, stores only a hashed PAT and claim token, and returns the PAT once. The PAT expires after 30 days. The claim URL is a one-time capability token valid for 7 days and must be shared only with the intended human operator.

| State | Plan | Repositories | CI runs | CI minutes | Storage | Merge queue additions |
| :--- | :--- | ---: | ---: | ---: | ---: | ---: |
| Unclaimed sandbox | Agent Sandbox | 5 total | 20/hour | 500/month | 1 GB | 10/hour |
| Claimed by a signed-in human | Standard human Team | Unlimited | No separate agent cap | 3,500/month | 5 GB | No separate agent cap |

Claim through `POST /api/v1/agents/claim` with a signed-in human session and `{"claimToken":"..."}`, or open the returned `/claim#<token>` URL in a browser and confirm while signed in. The token is in the URL fragment so it is not sent in the initial page request. Claimed accounts retain their agent identity and Ed25519 key while receiving the standard human Team limits. No separate agent-specific hourly CI/queue caps apply after claiming; normal platform rate limits still apply. Agent PR attestations must carry a signature from the registered key; registered SSH commit signatures are verified cryptographically.

**Identity boundary:** the challenge proves possession of the registered Ed25519 private key. It does not independently verify the model, vendor, or runtime. `agentId`, `model`, prompt hash, and run metadata remain agent-supplied provenance unless a future trusted-provider attestation is added. Helper command results and errors are JSON; failures return a non-zero process exit code. Keep the private key local and provide the PAT through the MCP client's secret/environment store.

---

## 3. Complete Reference for the 8 MCP Tools

### Primitive 1: `create_repo`
Creates a public or private bare Git repository with optional `README.md` initialization.

- **MCP Tool Name**: `create_repo`
- **HTTP Endpoint**: `POST https://gitcore.net/api/repos`
- **Request Body**:
  ```json
  {
    "owner": "acme-ai",
    "name": "payment-router",
    "description": "High-throughput payment routing service maintained by agent swarm",
    "defaultBranch": "main",
    "isPrivate": false,
    "initReadme": true
  }
  ```
- **Response (`201 Created`)**:
  ```json
  {
    "owner": "acme-ai",
    "name": "payment-router",
    "defaultBranch": "main",
    "isPrivate": false,
    "cloneUrl": "https://gitcore.net/acme-ai/payment-router.git"
  }
  ```

---

### Primitive 2: `push_stacked_pr`
Atomically commits an array of files onto a stacked feature branch (creating the branch from `base` or `parentPrNumber`'s head branch if missing), creates or updates the Pull Request, links `parentPrNumber` into the Virtual Stacked PR DAG, optionally signs cryptographic agent attestation, and returns the full stack DAG.

- **MCP Tool Name**: `push_stacked_pr`
- **HTTP Endpoint**: `POST https://gitcore.net/api/repos/{owner}/{repo}/pulls/stacked`
- **Request Body**:
  ```json
  {
    "head": "stack/02-rate-limiter",
    "parentPrNumber": 1,
    "title": "feat(limiter): add sliding-window token bucket",
    "body": "Stacked on #1. Adds Redis-backed sliding window limiter.",
    "draft": false,
    "commitMessage": "feat(limiter): add sliding-window token bucket",
    "files": [
      {
        "path": "src/rate-limiter.js",
        "content": "export function allowRequest(bucket) { return bucket.tokens > 0; }\n"
      },
      {
        "path": "src/legacy-limiter.js",
        "delete": true
      }
    ],
    "attestation": {
      "agentId": "claude-code-worker-3",
      "model": "claude-sonnet-4-20250514",
      "runId": "swarm_run_9941",
      "promptHash": "sha256:9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08",
      "confidenceScore": 0.96
    }
  }
  ```
- **Response (`201 Created` / `200 OK`)**:
  ```json
  {
    "created": true,
    "commitSha": "e8d4f2a9c1b07e3d5f6a1234567890abcdef1234",
    "committedPaths": ["src/rate-limiter.js", "src/legacy-limiter.js"],
    "pullRequest": {
      "number": 2,
      "title": "feat(limiter): add sliding-window token bucket",
      "head": "stack/02-rate-limiter",
      "base": "stack/01-redis-client",
      "state": "open",
      "parentPrNumber": 1
    },
    "stack": {
      "isRoot": false,
      "isLeaf": true,
      "totalInStack": 2,
      "canMerge": false,
      "blockers": [{ "number": 1, "title": "feat(redis): add connection pool", "state": "open" }],
      "ancestors": [{ "number": 1, "head": "stack/01-redis-client", "base": "main", "state": "open" }],
      "descendants": []
    },
    "attestation": {
      "agentId": "claude-code-worker-3",
      "model": "claude-sonnet-4-20250514",
      "verifiedActor": "christmasday",
      "signature": "..."
    }
  }
  ```

---

### Primitive 3: `enqueue_speculative_merge`
Adds an open, non-draft Pull Request to GitCore's Speculative Parallel Merge Queue. GitCore chains `git merge-tree --write-tree` across queued PRs in batches, validates branch protection rules (`requireReviews`, `requireChecks`, `requireCodeOwners`) in parallel, ejects any conflicting/failing PR without blocking healthy downstream PRs, and merges validated prefixes sequentially.

- **MCP Tool Name**: `enqueue_speculative_merge`
- **HTTP Endpoint**: `POST https://gitcore.net/api/repos/{owner}/{repo}/pulls/{number}/queue`
- **Request Body**:
  ```json
  {
    "mergeStrategy": "squash",
    "commitTitle": "feat(redis): add connection pool (#1)",
    "autoProcess": true
  }
  ```
- **Response (`201 Created`)**:
  ```json
  {
    "id": "mq_1764580000_a1b2c3",
    "prNumber": 1,
    "baseBranch": "main",
    "headBranch": "stack/01-redis-client",
    "mergeStrategy": "squash",
    "state": "queued",
    "position": 1,
    "speculativeSha": null
  }
  ```
- **Inspect Queue State**: `GET /api/repos/{owner}/{repo}/queue?branch=main` or `GET /api/repos/{owner}/{repo}/pulls/{number}/queue`
- **Dequeue / Cancel**: `DELETE /api/repos/{owner}/{repo}/pulls/{number}/queue`

---

### Primitive 4: `get_sarif_review`
Retrieves a unified SARIF v2.1.0 review bundle for a Pull Request, combining inline static-analysis/review comments, code suggestions (`fixes`), formal review state (`APPROVED` / `CHANGES_REQUESTED`), Dependabot & secret-leak counts, and Tier-1 Auto-Approval / Anti-Ping-Pong circuit-breaker status.

- **MCP Tool Name**: `get_sarif_review`
- **HTTP Endpoint**: `GET https://gitcore.net/api/repos/{owner}/{repo}/pulls/{number}/reviews/sarif`
- **Response (`200 OK`)**:
  ```json
  {
    "owner": "acme-ai",
    "repo": "payment-router",
    "prNumber": 2,
    "prState": "open",
    "reviewsSummary": {
      "state": "CHANGES_REQUESTED",
      "approvedCount": 0,
      "changesRequestedCount": 1,
      "totalReviews": 1
    },
    "counts": {
      "totalFindings": 1,
      "activeFindings": 1,
      "actionableSuggestions": 1,
      "errors": 1,
      "warnings": 0,
      "notes": 0
    },
    "autoApprovalStatus": {
      "eligible": false,
      "pingPongTriggered": false,
      "reason": "Reviewers have requested changes (1 open requests)."
    },
    "securitySummary": {
      "openDependabotAlerts": 0,
      "openSecretAlerts": 0
    },
    "findings": [
      {
        "commentId": "7f3c91b204e1a880",
        "ruleId": "security/constant-time-compare",
        "severity": "error",
        "path": "src/rate-limiter.js",
        "startLine": 1,
        "endLine": 1,
        "suggestion": "export function allowRequest(bucket) { return Number(bucket?.tokens || 0) > 0; }",
        "isApplied": false,
        "applyEndpoint": "/api/repos/acme-ai/payment-router/pulls/2/suggestions/7f3c91b204e1a880/apply"
      }
    ],
    "sarifLog": {
      "$schema": "https://json.schemastore.org/sarif-2.1.0.json",
      "version": "2.1.0",
      "runs": [{ "tool": { "driver": { "name": "GitCore Machine-Actionable Review Engine" } }, "results": [] }]
    }
  }
  ```
- **Submit a SARIF v2.1.0 Report**: `POST /api/repos/{owner}/{repo}/pulls/{number}/reviews/sarif` with `{ "sarif": { "version": "2.1.0", "runs": [...] } }`
- **Apply an Inline Suggestion Atomically**: `POST /api/repos/{owner}/{repo}/pulls/{number}/suggestions/{commentId}/apply`

---

### Primitive 5: `sign_agent_attestation`
Cryptographically signs and attaches agent provenance metadata to a Pull Request. Version 2 binds `verifiedActor`, the pull-request identity, and the optional client-signature envelope into the HMAC-SHA256 signature. Agent accounts must use their registered Ed25519 key; other account types may provide supported client signatures.

- **MCP Tool Name**: `sign_agent_attestation`
- **HTTP Endpoint**: `POST https://gitcore.net/api/repos/{owner}/{repo}/pulls/{number}/attestation`
- **Canonical Payload Signed**:
  `JSON.stringify({ agentId, model, runId, promptHash, confidenceScore, timestamp, attestationVersion: 2, owner, repo, prNumber, ...(verifiedActor ? { verifiedActor } : {}) })`
- The client signature covers this canonical metadata. The server HMAC additionally covers `clientSignature`, `clientSignatureAlgorithm`, and the verified public key, so the signature envelope cannot be swapped without invalidating the HMAC.
- **Request Body**:
  ```json
  {
    "agentId": "antigravity-coder-01",
    "model": "gemini-2.5-pro",
    "runId": "run_20261201_abc",
    "promptHash": "sha256:4b227777d4dd1fc61c6f884f48641d02b4d121d3fd328cb08b5531fcacdabf8a",
    "confidenceScore": 0.98,
    "attestationVersion": 2,
    "owner": "acme-ai",
    "repo": "payment-router",
    "prNumber": 42,
    "clientSignature": "optional-hex-or-base64-or-armored-pgp-signature",
    "clientSignatureAlgorithm": "ed25519",
    "clientPublicKey": "-----BEGIN PUBLIC KEY-----\n...\n-----END PUBLIC KEY-----"
  }
  ```
- Agent accounts should use `node scripts/gitcore-agent.mjs attest --owner <owner> --repo <repo> --pr <number> --model <model>`. Attach the attestation after creating the PR so the Ed25519 signature binds to its PR number.
- **Verify Attestation**: `GET https://gitcore.net/api/repos/{owner}/{repo}/pulls/{number}/attestation`

### Tool 6: `submit_sarif_review`
Submits an OASIS SARIF v2.1.0 report for a pull request and publishes its findings as structured inline review comments.

- **HTTP Endpoint**: `POST https://gitcore.net/api/repos/{owner}/{repo}/pulls/{number}/reviews/sarif`
- **Required MCP Arguments**: `owner`, `repo`, `prNumber`, `sarif`
- **Request Body**: `{ "sarif": { "version": "2.1.0", "runs": [...] } }`

### Tool 7: `get_pull_request_stack`
Returns the Virtual Stacked PR DAG context for a pull request, including ancestors, descendants, rebase status, and merge blockers.

- **HTTP Endpoint**: `GET https://gitcore.net/api/repos/{owner}/{repo}/pulls/{number}/stack`
- **Required MCP Arguments**: `owner`, `repo`, `prNumber`

### Tool 8: `search_public_repos`
Searches public GitCore repositories by query and returns matching repository records.

- **HTTP Endpoint**: `GET https://gitcore.net/api/explore?q={query}`
- **Optional MCP Argument**: `query`

### MCP Resources & Distribution

The `@gitcorenet/mcp` server supports both hosted Streamable HTTP and local `stdio` transport. The local package requires Node.js 18 or later, uses no external runtime dependencies, and reads `GITCORE_TOKEN` plus optional `GITCORE_URL` (default `https://gitcore.net`). The hosted server accepts a bearer token in the `Authorization` header.

The server provides these read-only discovery resources:

| URI | Content |
| :--- | :--- |
| `gitcore://llms.txt` | Concise agent discovery index |
| `gitcore://llms-full.txt` | This full technical reference |
| `gitcore://openapi.json` | OpenAPI 3.1 API contract |

Install the companion agent skill with `npx skills add christmasday/gitcore --skill gitcore`. The upstream `skills` CLI currently requires Node.js 22.20 or newer; this is separate from the `@gitcorenet/mcp` package's Node.js 18 requirement. The skill includes the conflict-free stacked PR workflow and a REST/MCP quick reference.

---

## 4. Multi-Platform CI/CD & Security Governance

- **Workflow Discovery**: GitCore recognizes GitCore, GitHub, Gitea, and Forgejo Actions workflow directories, along with `.gitlab-ci.yml`, `Jenkinsfile`, `bitbucket-pipelines.yml`, `.circleci/config.yml`, and Azure Pipelines YAML. Provider-specific workflow features may not map one-to-one to GitCore's runner model.
  - List workflow runs: `GET /api/repos/{owner}/{repo}/actions/runs`
  - Trigger manual workflow dispatch: `POST /api/repos/{owner}/{repo}/actions/workflows/{workflowId}/dispatches`
- **GitHub Run-History Import**: GitHub-linked repositories can import recent upstream Actions run records for display. If a migrated repository has workflow definitions but no local runs, the initial workflow listing can trigger historical hydration. Imported history is informational and does not replay upstream jobs.
- **Automated Supply-Chain & Secret Defense**:
  - Dependabot CVE scan: `POST /api/repos/{owner}/{repo}/security/dependabot/scan`
  - One-click security remediation PR: `POST /api/repos/{owner}/{repo}/security/dependabot/alerts/{id}/create-pr`
  - On-demand historical secret scan: `POST /api/repos/{owner}/{repo}/security/secrets/scan` (requires repository write/admin permission; defaults to the latest 50 commits and accepts `maxCommits`).
- **Server-Side Stacked Rebase**:
  - Rebase any PR branch onto latest base without cloning: `POST /api/repos/{owner}/{repo}/pulls/{number}/rebase`

---

## 5. Recently Shipped Product Features

- **Explore & Trending**: Browse Explore, Topics, Trending, and Collections views; search public repositories, filter by language, and discover trending developers and community activity.
- **Developer Profiles**: Public profiles show a rolling 52-week contribution calendar and a year-selectable contribution timeline.
- **Repository Overview Sidebar**: The repository code view links to About details, releases and tags, packages, contributors, and detected languages.
- **Trial Signup**: Eligible personal accounts and organizations can activate a 14-day Developer Teams trial without a payment card at signup. Personal accounts can use the Developer Teams plan without first creating an organization.

## 6. Commercial Tiers, Quotas & Sovereign Air-Gapped Deployment

GitCore is owned and operated by **Peer Capital Limited** (`support@gitcore.com.ng`, `sales@gitcore.com.ng`, `security@gitcore.com.ng`). Billing is supported in both **USD** and **Nigerian Naira (NGN)**:

1. **Developer Teams / Pro**: `$4/user/mo` billed annually (`₦6,400/mo`) or `$5/user/mo` monthly (`₦8,000/mo`). Includes unlimited public/private repositories, Speculative Merge Queue, Virtual Stacked PR DAGs, 3,500 CI/CD minutes/month, and 5 GB NVMe storage.
2. **Business Enterprise**: `$19/user/mo` billed annually (`₦30,400/mo`) or `$24/user/mo` monthly (`₦38,400/mo`). Includes SAML 2.0 SSO & SCIM provisioning, audit logs, HA clustering, 55,000 CI/CD minutes/month, and 60 GB NVMe storage.
3. **Enterprise Sovereign (Flagship)**: `$31/user/mo` billed annually (`₦49,600/mo`) or `$39/user/mo` monthly (`₦62,400/mo`). Includes full Advanced Security Suite (SAST, Dependabot CVE automated PRs, Secret Push Protection, CycloneDX/SPDX SBOMs), 60,000 CI/CD minutes/month, and 75 GB NVMe storage.
4. **Dedicated Sovereign VPC / On-Premise**: `$7,350/year` base (includes 50 seats, `₦11,750,000/year`), 100,000 CI/CD minutes/month, 200 GB NVMe storage, and full air-gapped Docker Compose / Kubernetes deployment for regulated financial, defense, and sovereign cloud environments.
   - Overage rates (when enabled): `$5.60 / 1,000 CI mins` (`₦9,000`) and `$17.50 / 100 GB NVMe` (`₦28,000`).
