Skip to content

nanocoai/nanoclaw / .claude/skills/add-codex

add-codex

Flagged

Use Codex (OpenAI's codex app-server) as a full agent provider — planning, tool orchestration, MCP tools, server-side history, session resume — alongside or instead of Claude. ChatGPT subscription or OpenAI API key, vault-only via the selected gateway. Per-group via `ncl groups config update --provider codex`. Distinct from using OpenAI as an MCP tool (where Claude remains the planner).

payload/container/agent-runner/src/provider-contracts/codex.ts

View on GitHub
import {
  codexExecutionPolicySection,
  codexInferenceSection,
  codexMcpServersSection,
  codexMemorySection,
  codexRuntimeOwnership,
  codexTone,
  type CodexMemorySessionHook,
  writeCodexConfigToml,
} from '../providers/codex-app-server.js';
import { registerProviderContract } from '../providers/provider-registry.js';

import { archiveProviderExchange } from './exchange-archive.js';
import {
  type ProviderRuntimeContract,
  type RuntimeAfterExchangeInput,
  type RuntimeCallbackEffects,
  type RuntimeConfigurationInputs,
} from './registry.js';

const provider = 'codex';
// Pinned literal, not the core's constant: a core seam bump must fail this
// payload's version check until the payload is refreshed to match.
const RUNTIME_SEAM_VERSION = 1;

// This module loading means core runs the contract's beforeQuery before every
// query, so the provider's own direct write must stand down — otherwise the
// files would be written twice per query.
codexRuntimeOwnership.contractOwnsRuntimeFiles = true;

// Keep the payload compatible with cores that predate the optional tone field.
export const codexRuntimeContract: ProviderRuntimeContract & {
  configuration: { tone: typeof codexTone };
} = {
  seamVersion: RUNTIME_SEAM_VERSION,
  configuration: {
    executionPolicy: { constant: codexExecutionPolicySection() },
    inference: codexInferenceSection,
    tone: codexTone,
    // Codex's native memory stays off whatever hook core registers, so the
    // section is a declared constant, not a function of the hook.
    memory: { constant: codexMemorySection() },
    mcpServers: codexMcpServersSection,
  },
  lifecycle: { beforeQuery: writeCodexRuntimeFiles },
  history: { afterExchange: archiveCodexExchange },
  textDelivery: 'result',
  commands: { formatting: 'xml' },
};

// Two-step registration: providers/codex.ts registered the factory; this
// attaches the contract. Order-independent, and neither file imports the other.
registerProviderContract(provider, codexRuntimeContract);

function writeCodexRuntimeFiles(inputs: Partial<RuntimeConfigurationInputs>): void {
  const hook = inputs.memory as CodexMemorySessionHook | undefined;
  if (!hook) throw new Error('Codex provider requires a registered memory hook before query');
  writeCodexConfigToml(inputs.mcpServers ?? {}, hook, codexInferenceSection(inputs.inference ?? {}));
}

function archiveCodexExchange({ exchange }: RuntimeAfterExchangeInput, fx: RuntimeCallbackEffects): string | null {
  return archiveProviderExchange({
    provider,
    prompt: exchange.prompt,
    result: exchange.result,
    continuation: exchange.continuation,
    status: exchange.status,
    timestamp: new Date(fx.now()),
  });
}
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