Skip to content

ethanplusai/codex-on-crack / plugins/codex-on-crack/skills/crack

Lead substantial Codex builds with one configured implementation worker and lead acceptance. Use when the user requests codex-on-crack, names a model to delegate work to, asks to run subagents through Claude, or requests a lead/worker split. Keep host-only work direct; honor explicit external model choices. Workers must not invoke this orchestrator.

FileKindSize
SKILL.mdskill md8.0 KB
agents/openai.yamlconfig300 B
references/build-records.mdmarkdown2.7 KB
references/checkpoint.mdmarkdown1.3 KB
references/external-lead.mdmarkdown13.9 KB
references/measurement.mdmarkdown1.8 KB
references/model-selection.mdmarkdown2.2 KB
references/parallel.mdmarkdown1.7 KB
references/policy.mdmarkdown494 B
references/replay.mdmarkdown3.2 KB
references/verification.mdmarkdown2.1 KB
references/worker-contract.mdmarkdown1.3 KB
scripts/doctor.mjsscript608 B
scripts/lead.mjsscript26.0 KB
scripts/lib/catalog.mjsscript5.6 KB
scripts/lib/changes.mjsscript13.3 KB
scripts/lib/config.mjsscript6.5 KB
scripts/lib/external-lead.mjsscript56.7 KB
scripts/lib/io.mjsscript3.8 KB
scripts/lib/lead-protocol.mjsscript25.9 KB
scripts/lib/plan.mjsscript9.2 KB
scripts/lib/readiness.mjsscript6.0 KB
scripts/lib/report.mjsscript10.7 KB
scripts/lib/roles.mjsscript8.9 KB
scripts/lib/routing.mjsscript2.7 KB
scripts/lib/toml.mjsscript785 B
scripts/lib/trial.mjsscript12.4 KB
scripts/report.mjsscript2.7 KB
scripts/select.mjsscript3.9 KB
scripts/setup.mjsscript7.0 KB
scripts/trial.mjsscript1.8 KB
scripts/validate-plan.mjsscript2.6 KB
scripts/worktree.mjsscript7.8 KB
templates/checkpoint.mdmarkdown903 B
templates/plan.jsonconfig680 B
templates/spec.mdmarkdown742 B
templates/task-brief.mdmarkdown2.5 KB
templates/task-report.mdmarkdown1.5 KB
viewer/README.mdmarkdown5.9 KB
viewer/bridge.mjsscript16.6 KB
viewer/fixtures/sample.jsonconfig8.2 KB
viewer/package.jsonmanifest187 B
viewer/public/app.mjsscript8.8 KB
viewer/public/index.htmlother1.8 KB
viewer/public/style.cssother4.4 KB
viewer/serve.mjsscript11.2 KB
viewer/src/adapter.mjsscript9.9 KB
viewer/src/emit.mjsscript992 B
viewer/src/model.mjsscript8.9 KB
viewer/src/server.mjsscript4.1 KB
viewer/src/tail.mjsscript1.9 KB
viewer/test/browser.mjsscript2.6 KB
viewer/test/server.test.mjsscript3.2 KB
viewer/test/usage.test.mjsscript9.0 KB
viewer/test/viewer.test.mjsscript5.1 KB

scripts/lib/config.mjs

View on GitHub
// Read Codex configuration. Nothing in codex-on-crack ever writes config.toml.
import fs from 'node:fs';
import os from 'node:os';
import path from 'node:path';
import { CrackError, readIfExists, readInput, sha256 } from './io.mjs';
import { parseToml } from './toml.mjs';

// Keys Codex reads as scalar settings directly under [agents]. Every other key
// there is an agent NAME whose value must be a role table, so a scalar under an
// unrecognized name makes Codex reject the whole config ("expected struct
// AgentRoleToml"), which takes down the App and the CLI together.
export const AGENT_SCALAR_SETTINGS = new Set([
  'enabled',
  'default_subagent_model',
  'default_subagent_reasoning_effort',
  'interrupt_message',
  'max_concurrent_threads_per_session',
  'max_threads',
  'max_depth',
  'job_max_runtime_seconds',
]);

export function isTable(value) {
  return value !== null && typeof value === 'object' && !Array.isArray(value) && !(value instanceof Date);
}

function expandHome(value, home) {
  if (value === '~') return home;
  if (value.startsWith('~/')) return path.join(home, value.slice(2));
  return value;
}

function realOrResolved(value) {
  const resolved = path.resolve(value);
  try {
    return fs.realpathSync(resolved);
  } catch {
    return resolved;
  }
}

export function locations({ home, codexHome } = {}) {
  const resolvedHome = realOrResolved(expandHome(home ?? os.homedir(), os.homedir()));
  const codex = codexHome ?? process.env.CODEX_HOME ?? path.join(resolvedHome, '.codex');
  return { home: resolvedHome, codexHome: realOrResolved(expandHome(codex, resolvedHome)) };
}

export function resolvePath(value, { home, codexHome }) {
  const expanded = expandHome(value
    .replaceAll('${CODEX_HOME}', codexHome).replaceAll('$CODEX_HOME', codexHome)
    .replaceAll('${HOME}', home).replaceAll('$HOME', home), home);
  return path.isAbsolute(expanded) ? expanded : path.join(codexHome, expanded);
}

export function mergeTables(base, overlay) {
  const result = { ...base };
  for (const [key, value] of Object.entries(overlay)) {
    result[key] = isTable(value) && isTable(result[key]) ? mergeTables(result[key], value) : value;
  }
  return result;
}

function readTomlFile(file, label) {
  const data = readInput(file);
  if (data === null) return null;
  return { data, doc: parseToml(data.toString('utf8'), label) };
}

export function readConfig({ codexHome, profile } = {}) {
  const configPath = path.join(codexHome, 'config.toml');
  const base = readTomlFile(configPath, 'config.toml');
  let config = base?.doc ?? {};
  const inputHashes = { [configPath]: sha256(base?.data ?? null) };
  const warnings = [];
  const selected = profile ?? config.profile ?? null;
  if (selected !== null) {
    if (typeof selected !== 'string' || !/^[A-Za-z0-9_-]+$/.test(selected)) {
      throw new CrackError('unsupported_profile', 'Unsupported profile name.', 'Inspect the active profile manually.');
    }
    const standalonePath = path.join(codexHome, `${selected}.config.toml`);
    const standalone = readTomlFile(standalonePath, `${selected}.config.toml`);
    const legacy = isTable(config.profiles) ? config.profiles[selected] : undefined;
    if (standalone && legacy !== undefined) {
      throw new CrackError('ambiguous_profile', 'Both a standalone file and a legacy [profiles] entry define this profile.',
        'Remove one of them first.');
    }
    if (standalone) {
      config = mergeTables(config, standalone.doc);
      inputHashes[standalonePath] = sha256(standalone.data);
    } else if (isTable(legacy)) {
      config = mergeTables(config, legacy);
      warnings.push('A legacy inline profile was inspected; confirm your client still applies it.');
    } else {
      throw new CrackError('profile_missing', 'The selected profile is not available as a readable configuration file.',
        'Pass an existing --profile, or none.');
    }
  }
  return { config, inputHashes, profile: selected, warnings };
}

export function checkAgentsShape(config) {
  const warnings = [];
  const agents = config.agents ?? {};
  if (!isTable(agents)) {
    throw new CrackError('agents_not_table', 'The existing [agents] setting is not a TOML table.', 'Repair config.toml, then retry.');
  }
  // Checking shape rather than a list of known top-level names catches any
  // absorbed key, not just the handful an installer happens to anticipate.
  const misplaced = Object.entries(agents)
    .filter(([key, value]) => !AGENT_SCALAR_SETTINGS.has(key) && !isTable(value))
    .map(([key]) => key)
    .sort();
  if (misplaced.length) {
    throw new CrackError('agents_absorbed_keys',
      `Setting(s) that do not belong under [agents] were found there: ${misplaced.join(', ')}. `
      + 'In TOML, a table header remains active until the next table header, so a top-level key written after '
      + '[agents] is absorbed into it; Codex then reads that key as an agent name and refuses to load the whole config.',
      'Move those keys above the first table header, or under the agent role they belong to. If your Codex build '
      + 'documents one of them as a genuine [agents] setting, it is newer than this check; verify with `codex doctor` '
      + 'rather than editing around this error.');
  }
  if (agents.enabled === false) {
    throw new CrackError('subagents_disabled', 'Subagents are disabled in this config ([agents] enabled = false).',
      'codex-on-crack will not enable them silently. Change it yourself if you want delegation.');
  }
  if ('default_subagent_model' in agents) {
    warnings.push('The global default_subagent_model is neither used nor changed; each codex-on-crack role pins its own model.');
  }
  if (isTable(config.features) && config.features.multi_agent === false) {
    warnings.push('A legacy features.multi_agent = false flag exists; check whether your client honors it.');
  }
  return warnings;
}

// Reuse the selected profile/export; never infer another backend during updates.
export function installationContext(codexHome, profile, catalog) {
  const file = path.join(codexHome, 'crack', 'crack.toml');
  const data = readIfExists(file);
  const saved = data === null ? {} : parseToml(data.toString('utf8'), 'crack.toml').installation ?? {};
  if (saved.profile !== undefined && typeof saved.profile !== 'string') throw new CrackError('invalid_installation', 'Invalid recorded profile.', 'Review crack.toml.');
  if (saved.catalog !== undefined && typeof saved.catalog !== 'string') throw new CrackError('invalid_installation', 'Invalid recorded catalog.', 'Review crack.toml.');
  return { profile: profile ?? (saved.profile || undefined), catalog: catalog ?? saved.catalog };
}
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