Skip to content

Codex CLI Complete Guide

Sora 2 Prompt Version Control Implementation: Team Operations & Credit Optimization

This is a follow-up to the morning article

Morning article: Sora 2 Prompt Playbook

Goals

  • Automatically record prompt change history with GitHub Gist and extract improvement patterns from diffs
  • Build a team-wide prompt database with Notion API for instant search and reuse of successful examples
  • Reduce wasted credit consumption by 20%+ through automated diff review

Architecture Overview

[Sora 2 CLI/Web] → (1) GitHub Gist API
                          ↓ (Save as JSON)
                    (2) Notion Database
                          ↓ (Tag search & diff display)
                    (3) Diff Visualization (gh/diffutils)
                          ↓
                    [Review & Improvement]
  1. GitHub Gist: Save prompts in JSON format, record change reasons in commit logs
  2. Notion Database: Centrally manage tags, success/failure flags, and credit consumption
  3. Diff Tools: Visualize modification patterns using gh gist view --diff or git diff

Implementation Steps

Step 1: Prompt History Management with GitHub Gist

Use GitHub Gist to place each prompt under independent version control.

# Create Gist (initial)
gh gist create sora_prompt_v1.json --public

# Update (with comment)
gh gist edit <gist_id> --add sora_prompt_v2.json \
  --description "Fix: Changed camera work to 'gentle handheld' → viewability +15%"

JSON Format Example:

{
  "id": "001",
  "prompt": "A 50-year-old fisherman prepares for fishing at dawn port...",
  "metadata": {
    "resolution": "1080p",
    "length": "12s",
    "credits_used": 45,
    "success": true,
    "tags": ["documentary", "natural-light"]
  }
}

  • Benefits: Track change reasons in commit logs, easy team sharing
  • Note: Don't consolidate massive prompts into one file; split by scene

Step 2: Automated Recording to Notion DB

Batch-register prompts and metadata using Notion API to build a searchable database.

import requests
import json

NOTION_TOKEN = "secret_xxx"
DATABASE_ID = "abc123"

def add_prompt_to_notion(prompt_data):
    url = f"https://api.notion.com/v1/pages"
    headers = {
        "Authorization": f"Bearer {NOTION_TOKEN}",
        "Content-Type": "application/json",
        "Notion-Version": "2022-06-28"
    }
    payload = {
        "parent": {"database_id": DATABASE_ID},
        "properties": {
            "Name": {"title": [{"text": {"content": prompt_data["id"]}}]},
            "Prompt": {"rich_text": [{"text": {"content": prompt_data["prompt"]}}]},
            "Credits": {"number": prompt_data["metadata"]["credits_used"]},
            "Success": {"checkbox": prompt_data["metadata"]["success"]},
            "Tags": {"multi_select": [{"name": t} for t in prompt_data["metadata"]["tags"]]}
        }
    }
    response = requests.post(url, headers=headers, json=payload)
    return response.json()

# Usage example
with open("sora_prompt_v2.json") as f:
    data = json.load(f)
    add_prompt_to_notion(data)
  • Benefits: Instant filtering by tags, credit consumption aggregation
  • Note: Consider Notion API rate limits (3req/sec); batch processing recommended

Step 3: Automated Diff Review

Visualize modifications using GitHub CLI's diff features.

# Display Gist diff (last 2 versions)
gh gist view <gist_id> --files sora_prompt_v1.json,sora_prompt_v2.json | diff -u - -

# Detailed comparison using git diff
git diff --no-index sora_prompt_v1.json sora_prompt_v2.json --word-diff=color

Output Example:

-"Action": "handheld camera, violent shake"
+"Action": "handheld camera, gentle shake"

  • Automation Idea: Notify diff to Slack on commit via GitHub Actions
  • Advanced Use: Analyze correlation between diff line count and credit reduction → target maximum effect with minimal changes

Benchmark: Comparison of Version Control Methods

MethodSetup TimeTeam SharingDiff TrackingCredit Reduction Effect
Text File + Google Drive5 min△ (manual sync)×0%
GitHub Gist10 min15%
Gist + Notion API30 min20-25%

Measurement Conditions: 3-person team, 2 weeks, 120 prompts total. Counted cases where duplicate attempts were avoided through diff review.

Failure Patterns and Countermeasures

SymptomCauseCountermeasure
Gists scattered and unsearchableLack of file naming conventionsUnify to {project}_{scene}_{version}.json format
Notion sync delays / duplicate registrationInsufficient API retry handlingImplement requests.Session() + exponential backoff
Too many diffs to readChanging multiple elements at onceEnforce 1 commit = 1 element change rule
Credit reduction not tangibleMissing baseline measurementWeek 1: logging only, Week 2+: compare improvement effects

Automation & Extension Ideas

  • GitHub Actions Integration: Auto-register to Notion DB on commit, insert diff into PR comments
  • Slack Bot: Retrieve similar prompts from Notion DB with /sora search #documentary
  • Cost Prediction API: Pre-display "This prompt estimated at 50 credits" from historical data
  • A/B Test Support: Generate 2 versions of same scene in parallel, compare viewership & credit efficiency
  • Metadata Expansion: Add generation timestamp, assignee, feedback comments to accelerate team learning

Next Steps