Skip to content

oil-oil/codex-team-mode / skills/team-mode

team-mode

Verified

Use when a task may benefit from a bounded subagent for implementation, large-codebase discovery at task start, independent review, requested or pre-commit code simplification, or expert work on complex decisions, modeling, automation, or repeated failures. The main agent chooses whether to delegate and accepts the result. Do not use for simple questions or short work with no meaningful review or delegation.

FileKindSize
README.mdmarkdown1.8 KB
SKILL.mdskill md5.2 KB
agents/openai.yamlconfig410 B
references/custom-agents.mdmarkdown4.1 KB
references/evaluation.mdmarkdown2.3 KB
references/explore.mdmarkdown654 B
references/interactive-testing.mdmarkdown1.4 KB
references/simplify.mdmarkdown2.9 KB
scripts/current_model.pyexecutablescript3.4 KB
scripts/usage_by_model.pyexecutablescript36.0 KB

scripts/current_model.py

View on GitHub
#!/usr/bin/env python3
"""Best-effort lookup of the current task model from local Codex traces."""

from __future__ import annotations

import json
import os
import sys
from datetime import datetime, timezone
from pathlib import Path
from typing import Any


def codex_home() -> Path:
    configured = os.environ.get("CODEX_HOME")
    return Path(configured).expanduser() if configured else Path.home() / ".codex"


def parse_time(value: Any) -> datetime | None:
    if not isinstance(value, str) or not value:
        return None
    try:
        parsed = datetime.fromisoformat(value.replace("Z", "+00:00"))
        return parsed.replace(tzinfo=timezone.utc) if parsed.tzinfo is None else parsed
    except ValueError:
        return None


def emit_unknown(reason: str) -> int:
    print(json.dumps({"status": "unknown", "reason": reason}, ensure_ascii=False))
    return 2


def main() -> int:
    task_id = os.environ.get("CODEX_THREAD_ID")
    if not task_id:
        return emit_unknown("CODEX_THREAD_ID is not set")

    home = codex_home()
    active_root = home / "sessions"
    archived_root = home / "archived_sessions"
    roots = [root for root in (active_root, archived_root) if root.is_dir()]
    candidates: list[tuple[datetime, str, str | None]] = []

    # Match the task ID in filenames before reading traces. Trace formats are internal,
    # so return unknown on failure instead of inferring the runtime model from config.
    for root in roots:
        for path in root.rglob(f"*{task_id}*.jsonl"):
            meta_id: str | None = None
            contexts: list[tuple[datetime, str, str | None]] = []
            try:
                with path.open("r", encoding="utf-8") as trace:
                    for line in trace:
                        try:
                            event = json.loads(line)
                        except json.JSONDecodeError:
                            continue
                        if not isinstance(event, dict):
                            continue
                        payload = event.get("payload") or {}
                        if not isinstance(payload, dict):
                            continue
                        if event.get("type") == "session_meta":
                            meta_id = payload.get("id") or payload.get("session_id")
                        elif event.get("type") == "turn_context":
                            model = payload.get("model")
                            timestamp = parse_time(event.get("timestamp") or payload.get("timestamp"))
                            if isinstance(model, str) and model and timestamp:
                                effort = payload.get("effort")
                                contexts.append((timestamp, model, effort if isinstance(effort, str) else None))
            except OSError:
                continue

            # Exclude subagents whose filename contains the root task ID.
            if meta_id != task_id:
                continue
            candidates.extend(contexts)

    if not candidates:
        return emit_unknown("No model record for the current task was found in local traces")

    observed_at, model, effort = max(candidates, key=lambda item: item[0])
    print(json.dumps({
        "status": "ok",
        "task_id": task_id,
        "model": model,
        "effort": effort,
        "observed_at": observed_at.isoformat(),
        "source": "local_codex_session_trace",
    }, ensure_ascii=False))
    return 0


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