Skip to content

tjl8787/mycodex-skills / skills/multi-codex-orchestration

multi-codex-orchestration

Verified

Use when the user explicitly wants multiple Codex agents or a virtual team, the work can be decomposed into safe parallel roles, and tgtool should coordinate a Ruflo-backed orchestration path.

scripts/ensure_ruflo_init.py

View on GitHub
#!/usr/bin/env python3
import argparse
import json
import subprocess
import sys
from pathlib import Path


def detect_state(project_dir: Path) -> dict:
    codex_initialized = (
        (project_dir / 'AGENTS.md').exists()
        and (project_dir / '.agents' / 'config.toml').exists()
    )
    runtime_initialized = (project_dir / '.claude-flow' / 'config.yaml').exists()
    return {
        'project_dir': str(project_dir),
        'codex_initialized': codex_initialized,
        'runtime_initialized': runtime_initialized,
    }


def command_for_target(target: str) -> list[str]:
    if target == 'codex':
        return ['ruflo', 'init', '--codex']
    if target == 'runtime':
        return ['ruflo', 'init', '--minimal', '--force']
    raise ValueError(f'unsupported target: {target}')


def recommend_target(state: dict) -> str:
    if not state['codex_initialized']:
        return 'codex'
    if not state['runtime_initialized']:
        return 'runtime'
    return 'none'


def run_command(project_dir: Path, cmd: list[str]) -> int:
    shell_cmd = (
        'source /home/jetio/.nvm/nvm.sh '
        '&& nvm use 20 >/dev/null '
        f"&& cd {project_dir} && {' '.join(cmd)}"
    )
    return subprocess.run(['/bin/bash', '-lc', shell_cmd]).returncode


def main() -> int:
    parser = argparse.ArgumentParser(
        description='Check or initialize Ruflo integration/runtime for a project.'
    )
    parser.add_argument('--project-dir', default='.')
    parser.add_argument(
        '--target',
        choices=['auto', 'codex', 'runtime'],
        default='auto',
        help='codex = AGENTS/.agents integration, runtime = .claude-flow runtime',
    )
    parser.add_argument('--execute', action='store_true')
    args = parser.parse_args()

    project_dir = Path(args.project_dir).resolve()
    state = detect_state(project_dir)
    target = args.target
    if target == 'auto':
        target = recommend_target(state)

    result = {
        **state,
        'requested_target': args.target,
        'selected_target': target,
        'action_needed': target != 'none',
        'recommended_command': None,
        'executed': False,
        'exit_code': 0,
    }

    if target != 'none':
        cmd = command_for_target(target)
        result['recommended_command'] = (
            'source /home/jetio/.nvm/nvm.sh && nvm use 20 >/dev/null && cd '
            + str(project_dir)
            + ' && '
            + ' '.join(cmd)
        )
        if args.execute:
            result['executed'] = True
            result['exit_code'] = run_command(project_dir, cmd)

    print(json.dumps(result, indent=2, sort_keys=True))
    return int(result['exit_code'])


if __name__ == '__main__':
    sys.exit(main())
reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis.Stars: 471kUpdated Claude CodeCodexVerifiedInstall
diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness.Stars: 322kUpdated Claude CodeCodexVerifiedInstall
dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependenciesStars: 322kUpdated Claude CodeCodexVerifiedInstall
executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is availableStars: 322kUpdated Claude CodeCodexVerifiedInstall