/commit

Operations L2+ Production high usage

/commit

Overview

/commit is a production command in the Operations category of the Prismatic Platform that provides intelligent git commit operations with automatic message generation, mandatory quality gates, conventional commit format enforcement, and GitLab issue reference validation. Every commit processed through this command is guaranteed to pass compilation checks, static analysis, and test verification before being accepted.

The command goes far beyond a simple git commit wrapper. It analyzes staged changes to automatically determine the commit type (feat, fix, refactor, etc.), identifies the affected scope from changed file paths, drafts a concise message describing the changes, and validates that a GitLab issue reference is attached for traceability. Post-commit, it automatically synchronizes with GitLab to update the referenced issue with commit information.

This command operates under the L2+ authority level and is executed by the commit-coordinator agent. It is part of the platform's 216-command slash command registry, built on the AIAD (Autonomous Intelligence Agent Design) standard. The command enforces COSMIC CLEARANCE level GitLab issue tracking -- every commit must reference a valid GitLab issue, and this requirement cannot be bypassed.

The commit workflow implements the platform's Session Discipline Protocol, which mandates continuous, atomic commits with immediate push to remote. Batching multiple changes into single large commits is forbidden. Each commit represents a discrete, tested, and verified unit of work that can be independently reviewed and reverted.

Architecture

The commit system operates through a five-phase pipeline with mandatory validation gates at each stage.

User Request (/commit --issue #XXXX [message or --auto])
    |
    v
PHASE 0: GITLAB ISSUE VALIDATION (mandatory)
    |-- Parse issue reference
    |-- Validate format (#XXXX)
    |-- Query GitLab API
    |-- BLOCK if invalid
    |
PHASE 1: CHANGE ANALYSIS
    |-- git status (untracked files)
    |-- git diff (staged/unstaged)
    |-- git log (recent commit style)
    |
PHASE 2: MESSAGE GENERATION (if --auto)
    |-- Analyze staged changes
    |-- Determine commit type
    |-- Identify scope
    |-- Draft message with issue footer
    |
PHASE 3: QUALITY VALIDATION
    |-- Pre-commit hooks
    |-- Compilation check
    |-- Test execution
    |-- Quality gates
    |-- Secret scanning
    |
PHASE 4: COMMIT EXECUTION
    |-- Stage relevant files
    |-- Create commit with message
    |-- Add co-author footer
    |-- Verify success
    |
PHASE 5: GITLAB SYNC (automatic)
    |-- Update issue with commit reference
    |-- Update issue status
    |-- Log sync result

GitLab Issue Validation Flow

--issue #160
    |
    v
Parse Format Check (#XXXX)
    |
    +-- Valid Format --> GitLab API: GET /issues/{iid}
    |                       |
    |                   +---+---+
    |                   |       |
    |              Issue Exists  404 Not Found
    |              PROCEED       BLOCK
    |
    +-- Invalid Format --> BLOCK

Usage

Standard Commit Operations

# Auto-generate commit message with issue reference
/commit --issue #160 --auto

# Manual message with issue reference
/commit --issue #247 "feat(storage): add Redis caching layer"

# With explicit type and scope
/commit --issue #350 --type feat --scope storage "add Redis caching layer"

# Quick fix
/commit --issue #123 --type fix "resolve null pointer in auth module"

Auto-Generated Messages

# Let the agent analyze changes and generate message
/commit --issue #160 --auto

# Output example:
# Analyzing staged changes...
# Detected: 3 new files, 2 modified files
# Scope: prismatic_perimeter
# Type: feat
# Generated: feat(perimeter): add security rating calculation engine
# Proceed? [Y/n]

Blocked Operations

# BLOCKED - No issue reference
/commit --auto
# ERROR: GitLab issue reference is REQUIRED
# Usage: /commit --issue #XXXX [message or --auto]

# BLOCKED - Invalid issue format
/commit --issue issue-160 --auto
# ERROR: Invalid issue format. Expected #XXXX (e.g., #160, #247)

# BLOCKED - Issue does not exist
/commit --issue #99999 --auto
# ERROR: GitLab issue #99999 does not exist

Options & Parameters

ParameterTypeDefaultDescription
messagestringnoneCommit message or --auto for generation
--issuestringrequiredGitLab issue reference (#XXXX format)
--autobooleanfalseAuto-generate message from changes
--typestringauto-detectedCommit type: feat, fix, docs, style, refactor, perf, test, chore, ci
--scopestringauto-detectedCommit scope (e.g., storage, web, osint)
--skip-hooksbooleanfalseSkip pre-commit hooks (NOT recommended)
--skip-syncbooleanfalseSkip GitLab sync after commit (NOT recommended)

Commit Message Format

The command enforces conventional commit format with mandatory GitLab issue reference:

type(scope): subject

Body explaining the changes in detail.

Closes #XXXX

---
Generated with Claude Code

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

Commit Types

TypeDescriptionExample
featNew featurefeat(perimeter): add security rating engine
fixBug fixfix(web): resolve LiveView socket leak
docsDocumentationdocs(api): update OpenAPI spec for v2 endpoints
styleFormattingstyle(agents): apply mix format to all agent modules
refactorCode restructuringrefactor(storage): extract adapter contract trait
perfPerformanceperf(ets): optimize query path for large result sets
testTest additionstest(perimeter): add property-based rating tests
choreMaintenancechore(deps): update Phoenix to 1.8.0
ciCI/CD changesci(gitlab): add cascade quality check stage

Pre-Commit Checks

The following checks must pass before any commit is accepted:

CheckToolBlockingOrder
GitLab Issue ValidationGitLab APIYes0 (first)
Compilationmix compile --warnings-as-errorsYes1
Testsmix testYes2
Quality Gatesmix quality.gatesYes3
Static Analysismix credo --strictYes4
Secret ScanningPattern-basedYes5

Execution Flow

PHASE 0: GITLAB ISSUE VALIDATION
    |-- Parse --issue parameter
    |-- Validate format: must match #[0-9]+
    |-- API call: GET /projects/{id}/issues/{iid}
    |-- BLOCK if 404 or API error
    |-- Warning if issue is closed (non-blocking)
    |
PHASE 1: CHANGE ANALYSIS
    |-- git status: identify untracked and modified files
    |-- git diff: analyze content of changes
    |-- git log: sample recent commit style for consistency
    |
PHASE 2: MESSAGE GENERATION (if --auto)
    |-- Categorize changes by type and scope
    |-- Draft subject line (< 50 chars)
    |-- Generate body with change details
    |-- Append issue reference footer
    |-- Append co-author footer
    |
PHASE 3: QUALITY VALIDATION
    |-- Execute all pre-commit hooks
    |-- Verify zero warnings compilation
    |-- Run test suite for affected modules
    |-- Execute quality gates
    |-- Scan for secrets and credentials
    |-- BLOCK if any check fails
    |
PHASE 4: COMMIT EXECUTION
    |-- Stage specified files (no `git add -A`)
    |-- Create commit with formatted message
    |-- Verify commit success
    |
PHASE 5: GITLAB SYNC
    |-- POST commit reference to GitLab issue
    |-- Update issue labels if applicable
    |-- Log sync result

Integration Points

ComponentRelationshipDetails
Prismatic AgentsExecuted by commit-coordinatorPrimary orchestration
AIAD RegistryCommand specificationStandard AIAD interface
Quality GatesPre-commit validationMandatory gate execution
TelemetryExecution metricsCommit tracking
GitLab APIIssue validation and syncBidirectional integration
Git HooksPre-commit enforcement.githooks/pre-commit
brutal-gitlab-enforcerEnforcement agentIssue tracking compliance
gitlab-api-specialistAPI operationsIssue CRUD operations

Configuration

Required Environment Variables

export GITLAB_TOKEN="glpat-xxxxxxxxxxxxxxxxxxxxx"
export GITLAB_PROJECT_ID="korczis/prismatic-platform"
export GITLAB_ENFORCEMENT_ENABLED="true"

Best Practices

  1. Always Use Issue References: Every commit must reference a GitLab issue. Create issues first, then commit against them. This creates a complete audit trail.

  2. Prefer --auto for Message Generation: The auto-generated messages are consistent with conventional commit format and include proper scoping based on changed files.

  3. Atomic Commits: Commit frequently with small, focused changes. One feature or fix per commit. Never batch unrelated changes.

  4. Never Skip Hooks: The --skip-hooks flag exists for emergency use only. Hooks protect against regressions, compilation warnings, and secret leakage.

  5. Review Generated Messages: When using --auto, review the generated message before confirming. The agent may occasionally misjudge the scope or type.

  6. Push Immediately: Per the Session Discipline Protocol, push to remote immediately after committing. Unpushed work at session end is a protocol violation.

Error Handling

ErrorCauseResolution
ISSUE_REQUIREDMissing --issue parameterAdd --issue #XXXX to command
INVALID_ISSUE_FORMATIssue reference not in #XXXX formatUse format: --issue #123
ISSUE_NOT_FOUNDGitLab issue does not existVerify issue number at GitLab
API_UNAVAILABLEGitLab API unreachableCheck network, use emergency override
PRE_COMMIT_FAILEDQuality gate or hook failureFix issues, do not use --no-verify
SECRET_DETECTEDCredentials in staged filesRemove sensitive files from staging

Performance

MetricValueNotes
Issue Validation1-2 secondsGitLab API call
Change Analysis< 5 secondsGit operations
Message Generation2-5 secondsAI-powered analysis
Quality Validation30s - 5 minDepends on test suite size
GitLab Sync1-2 secondsPost-commit API call

Doctrine Compliance

All commands operate under the NO MERCY, NO DOUBTS doctrine:

  • NO MERCY: Commits without issue references are BLOCKED. No bypass flags, no exceptions, no emergency workarounds without explicit supreme authority override with 1-hour timeout.
  • NO DOUBTS: Issue existence is verified via GitLab API before any commit proceeds. Every claim about changes is validated through compilation, testing, and quality gates.
  • /code - Core coding implementation and feature development
  • /fix - Bug fix implementation with mandatory regression tests
  • /refactor - Safe refactoring with zero-regression guarantee
  • /debrief - Comprehensive session debrief with platform state analysis
  • /check - Verification and integrity checking command
  • /quality-gates - Enforce quality gate checkpoints with zero-warning compilation validation

Connect & Contribute

Created by Tomáš Korcak (korczis) | Open Source under GHL