/chatgpt-sync

Development L2+ Production low usage

/chatgpt-sync

Overview

/chatgpt-sync is a production command in the Development category of the Prismatic Platform that synchronizes context and progress between the Claude-driven development environment and ChatGPT project spaces. The command manages the full synchronization lifecycle including project creation, incremental updates, conflict resolution, and status monitoring across AI collaboration boundaries.

In a multi-AI development workflow, maintaining synchronized context is essential for productive consultations. Without synchronization, each ChatGPT session starts from stale context, leading to recommendations based on outdated platform state. The /chatgpt-sync command solves this by providing automated, incremental synchronization that keeps ChatGPT projects current with the latest platform changes while minimizing bandwidth and processing overhead.

This command operates under the L2+ authority level and is executed by the chatgpt-bridge agent, specifically the chatgpt-integration-commander. It is part of the platform's 216-command slash command registry, built on the AIAD (Autonomous Intelligence Agent Design) standard. The command supports five synchronization actions (sync, upload, create, status, list) and three synchronization modes (full, incremental, forced), with GitLab CI/CD integration for automated synchronization on every merge to main.

The synchronization engine uses git-based change detection to identify modified files since the last successful sync, creating minimal delta archives that efficiently update ChatGPT projects without redundant full uploads. Conflict detection and resolution mechanisms handle cases where both Claude and ChatGPT sessions have produced changes that need reconciliation.

Architecture

The synchronization system is built on a change-detection and upload pipeline architecture.

Change Detection (git diff / git log)
    |
    v
Delta Calculator (files added, modified, removed)
    |
    v
Archive Creator (minimal incremental package)
    |
    v
Upload Manager (retry, resume, verify)
    |
    v
State Recorder (sync timestamp, content hash)

Core Components

ComponentResponsibility
Integration CommanderOrchestrates sync lifecycle
Change DetectorGit-based delta calculation
Archive CreatorIncremental archive assembly
Upload ManagerReliable upload with retry logic
Conflict ResolverHandles sync conflicts
State ManagerTracks sync history and timestamps

Usage

Basic Synchronization

# Auto-sync with current project (incremental by default)
/chatgpt-sync

# Sync to specific project
/chatgpt-sync --project "prismatic-platform-v2"

# Full synchronization (complete re-upload)
/chatgpt-sync --mode full

Incremental Updates

# Sync changes since last week
/chatgpt-sync --mode incremental --since "2025-11-28"

# Sync changes since specific commit
/chatgpt-sync --mode incremental --since "a1b2c3d"

# Automatic incremental (detects last sync point)
/chatgpt-sync --mode incremental

Project Management

# Create new ChatGPT project
/chatgpt-sync --action create --project "prismatic-consultation-2025"

# Check sync status
/chatgpt-sync --action status

# List all ChatGPT projects
/chatgpt-sync --action list

Preview and Validation

# Dry run to preview what would be synced
/chatgpt-sync --dry-run

# Forced sync (override conflicts)
/chatgpt-sync --mode forced --project "emergency-consultation"

Combined Workflows

# Pack and sync in one command
/chatgpt-sync --action upload --mode full --auto-create

# Emergency full refresh
/chatgpt-sync --mode forced --action create --project "emergency-$(date +%Y%m%d)"

Options & Parameters

ParameterTypeDefaultDescription
--actionstringsyncAction: sync, upload, create, status, list
--projectstringauto-detectedChatGPT project name
--modestringincrementalMode: full, incremental, forced
--sincestringauto-detectedReference point for incremental sync
--dry-runbooleanfalsePreview changes without uploading
--auto-createbooleantrueCreate project if it does not exist

Synchronization Actions

ActionPurposeMode SupportDuration
syncIntelligent sync of platform statefull, incremental, forced30s - 8min
uploadDirect upload of current statefull, forced3-8 min
createCreate new project with initial contextfull only5-10 min
statusDisplay current sync statusN/A (info only)<5s
listList all ChatGPT projectsN/A (info only)<5s

Synchronization Modes

ModeStrategyPerformanceBandwidthBest For
incrementalOnly changes since last sync30s - 2 minMinimalRegular development
fullComplete re-synchronization3-8 minHighInitial setup, major changes
forcedOverride conflicts and force syncVariableVariableEmergency updates

Execution Flow

PHASE 1: INITIALIZATION
    |-- Parse action and mode parameters
    |-- Resolve target project (auto-detect or specified)
    |-- Load sync state history
    |
PHASE 2: CHANGE DETECTION (sync/upload actions)
    |-- Determine last sync timestamp
    |-- Run git diff for file changes
    |-- Detect documentation updates
    |-- Identify architecture changes
    |-- Calculate configuration deltas
    |
PHASE 3: ARCHIVE PREPARATION
    |-- Build incremental or full archive
    |-- Optimize for target size constraints
    |-- Run security scan
    |-- Generate manifest
    |
PHASE 4: UPLOAD EXECUTION
    |-- Initiate upload with progress tracking
    |-- Handle retries with exponential backoff
    |-- Support resume for interrupted uploads
    |-- Verify upload integrity
    |
PHASE 5: CONFLICT RESOLUTION (if needed)
    |-- Detect synchronization conflicts
    |-- Analyze conflict causes
    |-- Apply resolution strategy (merge/override/manual)
    |-- Validate post-resolution state
    |
PHASE 6: STATE RECORDING
    |-- Record sync timestamp and content hash
    |-- Update sync history
    |-- Emit telemetry events
    |-- Report completion status

GitLab CI/CD Integration

The synchronization runs automatically on every merge to the main branch:

chatgpt:sync:main:
  stage: audit
  script:
    - ./scripts/pack-sources.sh --manifest
    - ./scripts/chatgpt-project-sync.sh --method all --notify
  rules:
    - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'

Required CI/CD Variables

VariableRequiredDescription
OPENAI_API_KEYYesOpenAI API key for project access
PRISMATIC_ASSISTANT_IDNoExisting assistant to update
SLACK_WEBHOOK_URLNoSlack notification webhook
AWS_S3_BUCKETNoS3 bucket for archive backup

Sync Methods (Priority Order)

  1. OpenAI Assistants API - Creates or updates Assistant with project files
  2. S3 Backup - Stores archive for manual retrieval as fallback

Mix Task Interface

mix chatgpt.sync              # Auto-detect method
mix chatgpt.sync --method all # Try all methods
mix chatgpt.sync --notify     # With Slack notifications

Integration Points

ComponentRelationshipDetails
Prismatic AgentsExecuted by chatgpt-bridge agentIntegration commander
AIAD RegistryCommand specification and discoveryStandard AIAD interface
Quality GatesPre/post execution quality validationSync integrity checks
TelemetryCommand execution metricsSync performance tracking
Git IntegrationChange detection enginegit diff, git log for deltas
GitLab CI/CDAutomated sync on merge.gitlab-ci/chatgpt-sync.yml
OpenAI APIAssistant project managementFile upload and project lifecycle
MCP PubSubReal-time event broadcastingchatgpt:sync:* events

Best Practices

  1. Use Incremental Mode for Daily Work: Full syncs are expensive and slow. Incremental mode captures all changes since the last sync point with minimal overhead.

  2. Sync Before Major Consultations: Always run /chatgpt-sync before starting a /chatgpt-consult session to ensure ChatGPT has current platform context.

  3. Set Up CI/CD Auto-Sync: Configure the GitLab CI pipeline to automatically sync on merges to main, ensuring the ChatGPT project is always current without manual intervention.

  4. Monitor Sync Status Regularly: Run /chatgpt-sync --action status periodically to verify sync health and detect any drift between local state and ChatGPT project state.

  5. Use Forced Mode Sparingly: Forced mode overrides conflict detection and can result in data loss. Only use for emergency situations where you are confident about the correct state.

  6. Review Dry Run Output: For full syncs, always use --dry-run first to preview the scope of changes before committing to the upload.

Error Handling

ErrorCauseResolution
NETWORK_TIMEOUTConnection to OpenAI API timed outRetry with --mode forced, check network
AUTH_FAILEDInvalid or expired API keyUpdate OPENAI_API_KEY environment variable
PROJECT_NOT_FOUNDSpecified project does not existUse --auto-create or create manually
CONFLICT_DETECTEDSync conflict between local and remoteReview conflicts, use forced mode or manual resolution
SIZE_EXCEEDEDArchive exceeds project file limitsReduce content with focus filters
PARTIAL_UPLOADUpload interruptedResume automatically on next sync attempt

Advanced Usage

Project Auto-Detection

def detect_chatgpt_project() do
  case load_project_config() do
    {:ok, project} -> {:ok, project}
    {:error, :not_found} -> auto_discover_project()
  end
end

def auto_discover_project() do
  project_name = generate_project_name()
  case find_existing_project(project_name) do
    {:ok, project} -> {:ok, project}
    {:error, :not_found} -> create_project_if_needed(project_name)
  end
end

Change Detection Engine

def detect_changes_since_last_sync(project) do
  last_sync = get_last_sync_timestamp(project)

  %{
    files_changed: detect_file_changes(last_sync),
    documentation_updates: detect_doc_changes(last_sync),
    architecture_changes: detect_arch_changes(last_sync),
    configuration_updates: detect_config_changes(last_sync),
    new_features: detect_feature_additions(last_sync)
  }
end

Performance

MetricValueNotes
Incremental Sync30s - 2 minDelta-only upload
Full Sync3-8 minComplete archive upload
Status Check<5sLocal state query
Project List<5sAPI query
Change Detection~10sGit diff analysis
Upload RetryExponential backoffMax 3 retries

Doctrine Compliance

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

  • NO MERCY: Zero tolerance for incomplete execution or quality violations. Sync operations must complete fully or report failure clearly. Partial syncs are not accepted as success.
  • NO DOUBTS: Full investigation before action, evidence-based results. Change detection provides complete visibility into what will be synchronized before any upload begins.
  • /chatgpt-pack - Context packing for ChatGPT collaboration and knowledge transfer
  • /chatgpt-consult - Consult ChatGPT for alternative perspectives and solutions
  • /commit - Smart commit with quality gates and conventional format
  • /code - Core coding implementation and feature development
  • /fix - Bug fix implementation with mandatory regression tests
  • /debrief - Comprehensive session debrief with platform state analysis

Connect & Contribute

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