Skip to content

GitLab

Connect Archon to a GitLab instance (gitlab.com or self-hosted) so you can interact with your AI coding assistant from issues and merge requests.

  • Archon server running (see Getting Started)
  • GitLab project with issues and merge requests enabled
  • GitLab Personal Access Token or Project Access Token with api scope
  • Public endpoint for webhooks (see ngrok setup below for local development)
Section titled “Personal Access Token (recommended for getting started)”
  1. Go to GitLab → User Settings → Access Tokens
  2. Create a token with:
    • Name: archon
    • Scopes: api
    • Expiration: Set as needed
  3. Copy the token (starts with glpat-)
Section titled “Project Access Token (recommended for production)”
  1. Go to Project → Settings → Access Tokens
  2. Create a token with:
    • Role: Developer or Maintainer
    • Scopes: api
  3. This creates a bot user scoped to the project
Terminal window
openssl rand -hex 32

Windows (PowerShell):

Terminal window
-join ((1..32) | ForEach-Object { '{0:x2}' -f (Get-Random -Maximum 256) })

Save this secret — you’ll need it for steps 3 and 4.

Step 3: Expose Local Server (Development Only)

Section titled “Step 3: Expose Local Server (Development Only)”
Terminal window
ngrok http 3090
# Copy the HTTPS URL (e.g., https://abc123.ngrok-free.app)

For production, use your deployed server URL directly.

Navigate to Project → Settings → Webhooks → Add new webhook:

FieldValue
URLhttps://your-domain.com/webhooks/gitlab
Secret tokenThe secret from Step 2
TriggersEnable: Comments, Issues events, Merge request events
SSL verificationEnable (recommended)

Click “Add webhook” and use Test → Note events to verify.

GITLAB_URL=https://gitlab.com
GITLAB_TOKEN=glpat-your-token-here
GITLAB_WEBHOOK_SECRET=your-secret-here

Optional:

GITLAB_ALLOWED_USERS=alice,bob
GITLAB_BOT_MENTION=archon

See the full environment variable reference for details.

Mention your bot in issue or MR comments:

@archon can you analyze this bug?
@archon /status
@archon review this implementation

First mention automatically clones the repository to ~/.archon/workspaces/<group>/<project>, detects .archon/commands/ if present, and injects full issue/MR context.

Subsequent mentions resume the existing conversation with full context.

TypeFormatExample
Issuegroup/project#iidmyteam/api#42
Merge Requestgroup/project!iidmyteam/api!15
Nested groupgroup/subgroup/project#iidorg/team/api#7
GitLab EventAction
Note Hook (comment with @mention)Triggers AI conversation
Issue Hook (close)Cleans up isolation environment
MR Hook (close/merge)Cleans up isolation environment
Issue/MR openedIgnored (descriptions are not commands)

Add the same webhook to other projects:

Terminal window
glab api projects/<PROJECT_ID>/hooks \
--method POST \
-f url="https://YOUR_DOMAIN/webhooks/gitlab" \
-f token="YOUR_WEBHOOK_SECRET" \
-f note_events=true \
-f issues_events=true \
-f merge_requests_events=true

Or via GitLab UI with the same secret.

IssueCauseFix
gitlab.invalid_webhook_tokenSecret mismatchEnsure GITLAB_WEBHOOK_SECRET matches the webhook config exactly
Clone hangsmacOS Keychain credential helperThe adapter disables it automatically
404 Project Not FoundToken lacks accessEnsure token has api scope and project access
403 You are not allowedInsufficient permissionsUse a token with Developer role or higher
No webhook deliveryngrok URL changedUpdate the webhook URL after restarting ngrok
Webhook auto-disabled4+ consecutive failuresFix the issue, then send a test event to re-enable

The AI agent uses glab CLI commands. Install and authenticate:

Terminal window
brew install glab
glab auth login
CommandPurpose
glab issue view <IID>View issue details
glab issue note <IID> -m "..."Comment on issue
glab mr view <IID>View merge request
glab mr diff <IID>View MR diff
glab mr note <IID> -m "..."Comment on MR
glab mr create --title "..." --description "..."Create MR