Sync all projects in an organization with codex repository (with parallel execution). Delegates to fractary CLI for organization-wide sync operations.
Syncs all projects in an organization with the codex repository, handling parallel execution and bidirectional updates. Use when you need to synchronize multiple repositories at once, with dry-run support to preview changes before executing.
/plugin marketplace add fractary/claude-plugins/plugin install fractary-codex@fractaryThis skill inherits all available tools. When active, it can use any tool Claude has access to.
Your responsibility is to orchestrate synchronization of ALL projects in an organization with the central codex repository by delegating to the cli-helper skill which invokes the fractary codex sync org CLI command.
Architecture (v4.0):
org-syncer skill
↓ (delegates to)
cli-helper skill
↓ (invokes)
fractary codex sync org
↓ (uses)
@fractary/codex SDK (SyncManager, GitHandler, parallel execution)
This provides organization-wide synchronization with:
All via the TypeScript SDK. </CONTEXT>
<CRITICAL_RULES>
Output:
🎯 STARTING: Organization Sync
Organization: {organization}
Environment: {environment} (branch: {target_branch})
Direction: {direction}
Parallel: {parallel} projects at a time
Dry Run: {yes|no}
───────────────────────────────────────
Construct arguments array from inputs:
args = ["sync", "org"]
// Add organization if provided (otherwise uses config default)
if (organization) {
args.push("--org", organization)
}
// Add environment or target branch
if (environment) {
args.push("--environment", environment)
} else if (target_branch) {
args.push("--branch", target_branch)
}
// Add direction
args.push("--direction", direction)
// Add exclude patterns if provided
if (exclude && exclude.length > 0) {
exclude.forEach(e => args.push("--exclude", e))
}
// Add parallel setting
if (parallel) {
args.push("--parallel", parallel)
}
// Add dry-run flag
if (dry_run) {
args.push("--dry-run")
}
USE SKILL: cli-helper Operation: invoke-cli Parameters:
{
"command": "sync",
"args": ["org", ...organization, ...environment, ...direction, ...exclude, ...parallel, ...dry_run],
"parse_output": true
}
The cli-helper will:
fractary codex sync org [--org <org>] [--environment <env>|--branch <branch>] --direction <direction> [--exclude <pattern>] [--parallel <n>] [--dry-run] --jsonThe CLI handles:
The CLI returns JSON like:
Successful Sync:
{
"status": "success",
"operation": "sync-org",
"organization": "fractary",
"environment": "test",
"target_branch": "test",
"direction": "bidirectional",
"discovered": {
"total_repositories": 42,
"excluded": 3,
"to_sync": 39
},
"phase1_to_codex": {
"succeeded": 37,
"failed": 2,
"files_synced": 1247,
"files_deleted": 23,
"failed_projects": [
{
"project": "legacy-service",
"error": "Branch not found"
}
]
},
"phase2_from_codex": {
"succeeded": 38,
"failed": 1,
"files_synced": 892,
"files_deleted": 5,
"failed_projects": [
{
"project": "readonly-repo",
"error": "Permission denied"
}
]
},
"overall": {
"total_succeeded": 36,
"total_failed": 3,
"total_files_synced": 2139,
"total_files_deleted": 28
},
"dry_run": false,
"duration_seconds": 145.7
}
Dry-Run Preview:
{
"status": "success",
"operation": "sync-org",
"organization": "fractary",
"environment": "test",
"direction": "bidirectional",
"dry_run": true,
"discovered": {
"total_repositories": 42,
"excluded": 3,
"to_sync": 39,
"repositories": ["project1", "project2", ...]
},
"would_sync": {
"phase1_to_codex": {
"projects": 39,
"estimated_files": 1200,
"estimated_deletions": 20
},
"phase2_from_codex": {
"projects": 39,
"estimated_files": 900,
"estimated_deletions": 5
}
},
"recommendation": "Safe to proceed",
"estimated_duration_minutes": 3
}
IF status == "success":
IF status == "failure":
Output:
✅ COMPLETED: Organization Sync
Organization: {organization}
Environment: {environment} (branch: {target_branch})
Direction: {direction}
Discovery:
- Total repositories: {total}
- Excluded: {excluded}
- Synced: {to_sync}
Phase 1 (Projects → Codex):
- Succeeded: {count}
- Failed: {count}
- Files synced: {total}
Phase 2 (Codex → Projects):
- Succeeded: {count}
- Failed: {count}
- Files synced: {total}
Overall:
- Total succeeded: {count}
- Total failed: {count}
- Total files synced: {total}
Duration: {duration}s
───────────────────────────────────────
Next: Review failed projects (if any)
Return structured JSON with sync results (pass through from CLI).
COMPLETION: Operation complete when sync results shown.
</WORKFLOW><COMPLETION_CRITERIA> Operation is complete when:
✅ For successful sync:
✅ For failed sync:
✅ For dry-run:
✅ In all cases:
{
"status": "success",
"operation": "sync-org",
"organization": "fractary",
"environment": "test",
"target_branch": "test",
"direction": "bidirectional",
"discovered": {
"total_repositories": 42,
"excluded": 3,
"to_sync": 39
},
"phase1_to_codex": {
"succeeded": 37,
"failed": 2,
"files_synced": 1247,
"files_deleted": 23,
"failed_projects": [...]
},
"phase2_from_codex": {
"succeeded": 38,
"failed": 1,
"files_synced": 892,
"files_deleted": 5,
"failed_projects": [...]
},
"overall": {
"total_succeeded": 36,
"total_failed": 3,
"total_files_synced": 2139,
"total_files_deleted": 28
},
"dry_run": false,
"duration_seconds": 145.7
}
{
"status": "success",
"operation": "sync-org",
"organization": "fractary",
"environment": "test",
"direction": "bidirectional",
"dry_run": true,
"discovered": {
"total_repositories": 42,
"excluded": 3,
"to_sync": 39,
"repositories": ["project1", "project2", ...]
},
"would_sync": {
"phase1_to_codex": {
"projects": 39,
"estimated_files": 1200,
"estimated_deletions": 20
},
"phase2_from_codex": {
"projects": 39,
"estimated_files": 900,
"estimated_deletions": 5
}
},
"recommendation": "Safe to proceed",
"estimated_duration_minutes": 3
}
{
"status": "failure",
"operation": "sync-org",
"organization": "fractary",
"environment": "test",
"error": "Organization access denied",
"cli_error": {
"message": "Failed to list repositories in organization",
"suggested_fixes": [
"Check GitHub token has 'repo' and 'read:org' permissions",
"Verify organization name is correct",
"Test access: gh repo list <org> --limit 1"
]
}
}
{
"status": "success",
"operation": "sync-org",
"organization": "fractary",
"environment": "test",
"direction": "bidirectional",
"overall": {
"total_succeeded": 36,
"total_failed": 3
},
"failed_projects": [
{
"project": "legacy-service",
"phase": "to-codex",
"error": "Branch not found"
},
{
"project": "readonly-repo",
"phase": "from-codex",
"error": "Permission denied"
}
],
"note": "Some projects failed but overall sync succeeded"
}
{
"status": "failure",
"operation": "sync-org",
"error": "CLI not available",
"suggested_fixes": [
"Install globally: npm install -g @fractary/cli",
"Or ensure npx is available"
]
}
</OUTPUTS>
<ERROR_HANDLING>
When CLI reports access issues:
gh repo listWhen CLI finds no repositories:
When some projects fail but others succeed:
When all projects fail:
When CLI reports parallel execution errors:
When cli-helper reports CLI unavailable:
When CLI returns error:
</ERROR_HANDLING>
<DOCUMENTATION> Upon completion, output:Success:
🎯 STARTING: org-syncer
Organization: {organization}
Environment: {environment} (branch: {target_branch})
Direction: {direction}
Parallel: {parallel} projects at a time
Dry Run: {yes|no}
───────────────────────────────────────
[Sync execution via CLI with progress tracking]
✅ COMPLETED: org-syncer
Organization: {organization}
Environment: {environment}
Direction: {direction}
Discovery:
- Total repositories: {total}
- Excluded: {excluded}
- Synced: {to_sync}
Results:
- Overall succeeded: {count}
- Overall failed: {count}
- Total files synced: {total}
- Duration: {duration}s
Source: CLI (via cli-helper)
───────────────────────────────────────
Next: Review failed projects (if any)
Dry-Run:
🎯 STARTING: org-syncer (DRY-RUN)
Organization: {organization}
Environment: {environment} (branch: {target_branch})
Direction: {direction}
───────────────────────────────────────
[Preview from CLI]
✅ COMPLETED: org-syncer (dry-run)
Would discover: {count} repositories
Would sync:
- Phase 1: {projects} projects, ~{files} files
- Phase 2: {projects} projects, ~{files} files
Estimated duration: {minutes} minutes
Recommendation: {Safe to proceed}
Source: CLI (via cli-helper)
───────────────────────────────────────
Run without --dry-run to execute
Failure:
🎯 STARTING: org-syncer
───────────────────────────────────────
❌ FAILED: org-syncer
Error: {error_message}
Phase: {discovery|phase1|phase2}
Suggested fixes:
- {fix 1}
- {fix 2}
───────────────────────────────────────
</DOCUMENTATION>
<NOTES>
v3.0 (manual orchestration):
org-syncer
├─ calls repo-discoverer skill
├─ orchestrates parallel execution (GNU parallel or bash)
├─ calls project-syncer for each project
├─ manages phase sequencing
├─ aggregates results
└─ handles per-project errors
v4.0 (CLI delegation):
org-syncer
└─ delegates to cli-helper
└─ invokes: fractary codex sync org
Benefits:
This skill delegates to:
fractary codex sync org \
[--org <organization>] \
[--environment <env>|--branch <branch>] \
--direction <to-codex|from-codex|bidirectional> \
[--exclude <pattern>]... \
[--parallel <number>] \
[--dry-run] \
--json
Via the CLI, this skill benefits from:
SyncManager.syncOrganization() - Main orchestrationGitHubClient.listRepos() - Repository discoveryParallelExecutor.run() - Concurrent sync executionPhaseSequencer.execute() - Sequential phase orderingResultAggregator.collect() - Cross-project aggregationProgressTracker.update() - Real-time progressThe CLI guarantees proper phase sequencing:
Phase 1 (to-codex) - Parallel within phase:
Phase 2 (from-codex) - Parallel within phase:
Sequential Execution:
Default Settings:
Adjustable:
{
"parallel": 10 // Increase for faster sync
}
Limits:
Per-Project Errors:
Common Errors:
To test this skill:
# Ensure CLI installed
npm install -g @fractary/cli
# Initialize codex config
fractary codex init --org fractary
# Test dry-run
USE SKILL: org-syncer
Parameters: {
"organization": "fractary",
"environment": "test",
"direction": "bidirectional",
"parallel": 3,
"dry_run": true
}
# Test actual sync (careful!)
USE SKILL: org-syncer
Parameters: {
"organization": "fractary",
"environment": "test",
"direction": "to-codex",
"parallel": 5
}
If org sync fails:
fractary --version.fractary/codex.yamlfractary codex sync org --dry-rungh repo list <org> --limit 1fractary codex healthLarge Organizations (100+ repos):
Small Organizations (< 20 repos):