### Recommended First Run: Quickstart Constructor Source: https://github.com/just-every/code/blob/main/sdk/python/examples/README.md Run the recommended first examples for a quickstart constructor sanity check, covering both synchronous and asynchronous flows. ```bash python examples/01_quickstart_constructor/sync.py ``` ```bash python examples/01_quickstart_constructor/async.py ``` -------------------------------- ### Install SDK Dependencies Source: https://github.com/just-every/code/blob/main/sdk/python/examples/README.md Install SDK dependencies using uv and activate the virtual environment. This is a recommended setup step before running examples. ```bash uv sync source .venv/bin/activate ``` -------------------------------- ### Clone and Setup Project Source: https://github.com/just-every/code/blob/main/README.md Clone the repository, navigate into the directory, and install dependencies. ```bash git clone https://github.com/just-every/code.git cd code npm install ``` -------------------------------- ### windowsSandbox/setupStart Source: https://github.com/just-every/code/blob/main/codex-rs/app-server/README.md Starts Windows sandbox setup for the selected mode ('elevated' or 'unelevated'). Accepts an optional absolute `cwd` to target setup for a specific workspace. Returns `{ started: true }` immediately and later emits `windowsSandbox/setupCompleted`. ```APIDOC ## windowsSandbox/setupStart ### Description Starts Windows sandbox setup for the selected mode. ### Method POST ### Endpoint `/windowsSandbox/setupStart` ### Parameters #### Request Body - **mode** (string) - Required - The mode for sandbox setup (`elevated` or `unelevated`). - **cwd** (string) - Optional - The absolute path to the workspace directory. ### Response #### Success Response (200) - **started** (boolean) - Indicates if the setup process has started. ``` -------------------------------- ### Quickstart: Basic SDK Usage Source: https://github.com/just-every/code/blob/main/sdk/python/README.md Initialize the Codex client, start a thread, run a prompt, and print the final response and item count. Ensure to use a context manager for proper shutdown. ```python from codex_app_server import Codex with Codex() as codex: thread = codex.thread_start(model="gpt-5") result = thread.run("Say hello in one sentence.") print(result.final_response) print(len(result.items)) ``` -------------------------------- ### Example Usage Source: https://github.com/just-every/code/blob/main/sdk/python/docs/api-reference.md A basic example demonstrating how to use the Codex SDK to start a thread and get a response. ```APIDOC ## Example ```python from codex_app_server import Codex with Codex() as codex: thread = codex.thread_start(model="gpt-5.4", config={"model_reasoning_effort": "high"}) result = thread.run("Say hello in one sentence.") print(result.final_response) ``` **Description**: This example shows the typical workflow of initializing the `Codex` client, starting a new thread with specific model configuration, running a task on that thread, and printing the final response. ``` -------------------------------- ### Start Realtime Communication with WebRTC - Server Responses Source: https://github.com/just-every/code/blob/main/codex-rs/app-server/README.md Example server responses for starting a WebRTC realtime session, including an empty result and an SDP answer for setting the remote description. ```json { "id": 40, "result": {} } ``` ```json { "method": "thread/realtime/sdp", "params": { "threadId": "thr_123", "sdp": "v=0\r\no=..." } } ``` -------------------------------- ### Run Example Scripts Source: https://github.com/just-every/code/blob/main/sdk/python/README.md Execute example Python scripts for the SDK from the command line. These examples demonstrate various functionalities. ```bash cd sdk/python python examples/01_quickstart_constructor/sync.py python examples/01_quickstart_constructor/async.py ``` -------------------------------- ### Initialize Skill (Example Usage) Source: https://github.com/just-every/code/blob/main/code-rs/core/src/skills/assets/samples/skill-creator/SKILL.md Example command to initialize a skill named 'my-skill' within the 'skills/public' directory. ```bash scripts/init_skill.py my-skill --path skills/public ``` -------------------------------- ### Package Skill (Example Usage) Source: https://github.com/just-every/code/blob/main/code-rs/core/src/skills/assets/samples/skill-creator/SKILL.md Example command to package a skill located at 'skills/public/my-skill'. ```bash python scripts/package_skill.py skills/public/my-skill ``` -------------------------------- ### Bootstrap SDK Imports and Runtime Setup Source: https://github.com/just-every/code/blob/main/sdk/python/notebooks/sdk_walkthrough.ipynb Initializes the SDK by setting up Python path, ensuring the runtime package is installed, and handling fresh imports. This cell is crucial for preparing the environment before using the SDK. ```python # Cell 1: bootstrap local SDK imports + pinned runtime package import os import sys from pathlib import Path if sys.version_info < (3, 10): raise RuntimeError( f'Notebook requires Python 3.10+; current interpreter is {sys.version.split()[0]}. ') try: _ = os.getcwd() except FileNotFoundError: os.chdir(str(Path.home())) def _is_sdk_python_dir(path: Path) -> bool: return (path / 'pyproject.toml').exists() and (path / 'src' / 'codex_app_server').exists() def _iter_home_fallback_candidates(home: Path): # bounded depth scan under home to support launching notebooks from unrelated cwd values patterns = ('sdk/python', '*/sdk/python', '*/*/sdk/python', '*/*/*/sdk/python') for pattern in patterns: yield from home.glob(pattern) def _find_sdk_python_dir(start: Path) -> Path | None: checked = set() def _consider(candidate: Path) -> Path | None: resolved = candidate.resolve() if resolved in checked: return None checked.add(resolved) if _is_sdk_python_dir(resolved): return resolved return None for candidate in [start, *start.parents]: found = _consider(candidate) if found is not None: return found for candidate in [start / 'sdk' / 'python', *(parent / 'sdk' / 'python' for parent in start.parents)]: found = _consider(candidate) if found is not None: return found env_dir = os.environ.get('CODEX_PYTHON_SDK_DIR') if env_dir: found = _consider(Path(env_dir).expanduser()) if found is not None: return found for entry in sys.path: if not entry: continue entry_path = Path(entry).expanduser() for candidate in (entry_path, entry_path / 'sdk' / 'python'): found = _consider(candidate) if found is not None: return found home = Path.home() for candidate in _iter_home_fallback_candidates(home): found = _consider(candidate) if found is not None: return found return None repo_python_dir = _find_sdk_python_dir(Path.cwd()) if repo_python_dir is None: raise RuntimeError('Could not locate sdk/python. Set CODEX_PYTHON_SDK_DIR to your sdk/python path.') repo_python_str = str(repo_python_dir) if repo_python_str not in sys.path: sys.path.insert(0, repo_python_str) from _runtime_setup import ensure_runtime_package_installed runtime_version = ensure_runtime_package_installed( sys.executable, repo_python_dir, ) src_dir = repo_python_dir / 'src' examples_dir = repo_python_dir / 'examples' src_str = str(src_dir) examples_str = str(examples_dir) if src_str not in sys.path: sys.path.insert(0, src_str) if examples_str not in sys.path: sys.path.insert(0, examples_str) # Force fresh imports after SDK upgrades in the same notebook kernel. for module_name in list(sys.modules): if module_name == 'codex_app_server' or module_name.startswith('codex_app_server.'): sys.modules.pop(module_name, None) print('Kernel:', sys.executable) print('SDK source:', src_dir) print('Runtime package:', runtime_version) ``` -------------------------------- ### Full openai.yaml Example Source: https://github.com/just-every/code/blob/main/codex-rs/skills/src/assets/samples/skill-creator/references/openai_yaml.md A complete example of the openai.yaml configuration file, demonstrating all available fields for defining a skill's interface, dependencies, and policies. ```yaml interface: display_name: "Optional user-facing name" short_description: "Optional user-facing description" icon_small: "./assets/small-400px.png" icon_large: "./assets/large-logo.svg" brand_color: "#3B82F6" default_prompt: "Optional surrounding prompt to use the skill with" dependencies: tools: - type: "mcp" value: "github" description: "GitHub MCP server" transport: "streamable_http" url: "https://api.githubcopilot.com/mcp/" policy: allow_implicit_invocation: true ``` -------------------------------- ### Run a New Shell in a Basic Sandbox Source: https://github.com/just-every/code/blob/main/codex-rs/vendor/bubblewrap/README.md A trimmed-down example demonstrating how to run a new bash shell within a sandbox. This setup reuses the host's /usr directory and configures essential virtual filesystems like /proc and /dev. ```sh bwrap \ --ro-bind /usr /usr \ --symlink usr/lib64 /lib64 \ --proc /proc \ --dev /dev \ --unshare-pid \ --new-session \ bash ``` -------------------------------- ### Example Skill Frontmatter and Content Source: https://github.com/just-every/code/blob/main/code-rs/core/src/skills/assets/samples/skill-creator/SKILL.md An example of a SKILL.md file, including frontmatter with name and description, and basic markdown content for a skill. ```markdown --- name: pdf-processing description: Extract text and tables from PDFs; use when PDFs, forms, or document extraction are mentioned. --- # PDF Processing - Use pdfplumber to extract text. - For form filling, see FORMS.md. ``` -------------------------------- ### Install Skill from GitHub URL Source: https://github.com/just-every/code/blob/main/codex-rs/skills/src/assets/samples/skill-installer/SKILL.md Install a skill by providing its direct GitHub URL. This method allows for installation from a specific branch or commit by including the ref in the URL. ```bash scripts/install-skill-from-github.py --url https://github.com///tree// ``` -------------------------------- ### Run Synchronous Example Source: https://github.com/just-every/code/blob/main/sdk/python/examples/README.md Execute a synchronous example script. Ensure you are in the 'sdk/python' directory. The SDK source is used for local imports. ```bash python examples//sync.py ``` -------------------------------- ### Install Codex App Server Python SDK Source: https://github.com/just-every/code/blob/main/sdk/python/README.md Navigate to the SDK directory, install dependencies using uv, and activate the virtual environment. ```bash cd sdk/python uv sync source .venv/bin/activate ``` -------------------------------- ### Run Asynchronous Example Source: https://github.com/just-every/code/blob/main/sdk/python/examples/README.md Execute an asynchronous example script. Ensure you are in the 'sdk/python' directory. The SDK source is used for local imports. ```bash python examples//async.py ``` -------------------------------- ### Install Skill from GitHub Repository Source: https://github.com/just-every/code/blob/main/codex-rs/skills/src/assets/samples/skill-installer/SKILL.md Install one or more skills from a specified GitHub repository and path. This command supports installing skills from any public or private GitHub repository. ```bash scripts/install-skill-from-github.py --repo / --path [ ...] ``` -------------------------------- ### Install Non-Default Local Marketplace Source: https://github.com/just-every/code/blob/main/codex-rs/skills/src/assets/samples/plugin-creator/references/installing-and-updating.md Command to install a non-default local marketplace before adding plugins from it. ```bash codex plugin marketplace add ``` -------------------------------- ### Install OpenAI MCP Documentation Source: https://github.com/just-every/code/blob/main/codex-rs/skills/src/assets/samples/openai-docs/SKILL.md Run this command to install the OpenAI documentation for the MCP server. If it fails due to permissions, retry with escalated permissions. ```bash codex mcp add openaiDeveloperDocs --url https://developers.openai.com/mcp ``` -------------------------------- ### Install Experimental Skill from GitHub Source: https://github.com/just-every/code/blob/main/codex-rs/skills/src/assets/samples/skill-installer/SKILL.md Install an experimental skill from the openai/skills repository. This command targets skills located within the `.experimental` path of the repository. ```bash scripts/install-skill-from-github.py --repo openai/skills --path skills/.experimental/ ``` -------------------------------- ### YAML Frontmatter Example for SKILL.md Source: https://github.com/just-every/code/blob/main/code-rs/core/src/skills/assets/samples/skill-creator/SKILL.md Provides an example of the required YAML frontmatter for a SKILL.md file, including 'name' and 'description' fields. ```yaml --- name: my-skill description: Use when the user requests XYZ or mentions ABC workflows. --- ``` -------------------------------- ### View Available Options Source: https://github.com/just-every/code/blob/main/code-rs/responses-api-proxy/npm/README.md Run the installed command-line proxy with the --help flag to see all available configuration options and commands. ```bash node ./bin/codex-responses-api-proxy.js --help ``` -------------------------------- ### Async Operations Source: https://github.com/just-every/code/blob/main/sdk/python/docs/getting-started.md Utilize the asynchronous client for non-blocking operations. This example shows how to start a thread and run a turn asynchronously. ```python import asyncio from codex_app_server import AsyncCodex async def main() -> None: async with AsyncCodex() as codex: thread = await codex.thread_start(model="gpt-5.4", config={"model_reasoning_effort": "high"}) result = await thread.run("Continue where we left off.") print(result.final_response) asyncio.run(main()) ``` -------------------------------- ### Get Thread Goal Source: https://github.com/just-every/code/blob/main/codex-rs/app-server/README.md Use `thread/goal/get` to retrieve the current goal of a thread without modifying it. The example shows a case where the goal is null. ```json { "method": "thread/goal/get", "id": 29, "params": { "threadId": "thr_123" } } { "id": 29, "result": { "goal": null } } ``` -------------------------------- ### Build Project from Source Source: https://github.com/just-every/code/blob/main/docs/install.md Clone the repository, install Rust, and build the project. This is the same check performed by CI. ```bash # Clone the repository and navigate to the workspace root. git clone https://github.com/just-every/code.git cd code # Install the Rust toolchain, if necessary. curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y source "$HOME/.cargo/env" # Build everything (CLI, TUI, MCP servers). This is the same check CI runs. ./build-fast.sh # Launch the TUI with a sample prompt. ./target/debug/code -- "explain this codebase to me" ``` -------------------------------- ### Run First Turn (Sync) Source: https://github.com/just-every/code/blob/main/sdk/python/docs/getting-started.md Initialize the Codex client and run a single turn. This example demonstrates starting a thread, sending a message, and retrieving the final response. ```python from codex_app_server import Codex with Codex() as codex: server = codex.metadata.serverInfo print("Server:", None if server is None else server.name, None if server is None else server.version) thread = codex.thread_start(model="gpt-5.4", config={"model_reasoning_effort": "high"}) result = thread.run("Say hello in one sentence.") print("Thread:", thread.id) print("Text:", result.final_response) print("Items:", len(result.items)) ``` -------------------------------- ### Run Every Code CLI Source: https://github.com/just-every/code/blob/main/README.md Execute the Every Code command-line interface using npx. This is a quick way to start using the tool without a global installation. ```bash npx -y @just-every/code ``` -------------------------------- ### Main Configuration File Example Source: https://github.com/just-every/code/blob/main/README.md Example of the main Every Code configuration file (`~/.code/config.toml`). Includes model settings, behavior policies, and theme preferences. ```toml # Model settings model = "gpt-5.1" model_provider = "openai" # Behavior approval_policy = "on-request" # untrusted | on-failure | on-request | never model_reasoning_effort = "medium" # low | medium | high sandbox_mode = "workspace-write" # UI preferences see THEME_CONFIG.md [tui.theme] name = "light-photon" # Add config for specific models [profiles.gpt-5] model = "gpt-5.1" model_provider = "openai" approval_policy = "never" model_reasoning_effort = "high" model_reasoning_summary = "detailed" ``` -------------------------------- ### Control Working Directory and Git Check Source: https://github.com/just-every/code/blob/main/sdk/typescript/README.md Configure the working directory for Codex or skip the Git repository check when starting a new thread. This provides flexibility in project setup. ```typescript const thread = codex.startThread({ workingDirectory: "/path/to/project", skipGitRepoCheck: true, }); ``` -------------------------------- ### Initialize New Skill with init_skill.py Source: https://github.com/just-every/code/blob/main/codex-rs/skills/src/assets/samples/skill-creator/SKILL.md Use this script to create a new skill directory with a template structure. Specify the skill name, output path, and optionally include resource directories or example files. ```bash scripts/init_skill.py --path [--resources scripts,references,assets] [--examples] ``` ```bash scripts/init_skill.py my-skill --path "${CODEX_HOME:-$HOME/.codex}/skills" ``` ```bash scripts/init_skill.py my-skill --path "${CODEX_HOME:-$HOME/.codex}/skills" --resources scripts,references ``` ```bash scripts/init_skill.py my-skill --path ~/work/skills --resources scripts --examples ``` -------------------------------- ### Basic Thread Interaction Example Source: https://github.com/just-every/code/blob/main/sdk/python/docs/api-reference.md Demonstrates starting a new thread with a specific model and configuration, sending a message, and printing the final response. Uses a context manager for the Codex instance. ```python from codex_app_server import Codex with Codex() as codex: thread = codex.thread_start(model="gpt-5.4", config={"model_reasoning_effort": "high"}) result = thread.run("Say hello in one sentence.") print(result.final_response) ``` -------------------------------- ### Initialize and Run Network Proxy Library Source: https://github.com/just-every/code/blob/main/codex-rs/network-proxy/README.md Demonstrates how to build and run the NetworkProxy library. The policy decider can be customized to automatically allow commands starting with 'curl '. ```rust use codex_network_proxy::{NetworkProxy, NetworkDecision, NetworkPolicyRequest}; let proxy = NetworkProxy::builder() .http_addr("127.0.0.1:8080".parse()?) .policy_decider(|request: NetworkPolicyRequest| async move { // Example: auto-allow when exec policy already approved a command prefix. if let Some(command) = request.command.as_deref() { if command.starts_with("curl ") { return NetworkDecision::Allow; } } NetworkDecision::Deny { reason: "policy_denied".to_string(), } }) .build() .await?; let handle = proxy.run().await?; handle.shutdown().await?; ``` -------------------------------- ### Skill File Structure Example Source: https://github.com/just-every/code/blob/main/code-rs/core/src/skills/assets/samples/skill-creator/SKILL.md Illustrates the basic directory structure for a skill, including the required SKILL.md file and optional resource directories. ```text skill-name/ SKILL.md scripts/ (optional) references/ (optional) assets/ (optional) ``` -------------------------------- ### Bootstrap Flow for New Remote Machines Source: https://github.com/just-every/code/blob/main/codex-rs/app-server-daemon/README.md This sequence installs the standalone managed version of Codex and then bootstraps the app server daemon with remote control enabled. The bootstrap process records settings, starts the app server as a detached process, and launches an updater loop. ```sh curl -fsSL https://chatgpt.com/codex/install.sh | sh $HOME/.codex/packages/standalone/current/codex app-server daemon bootstrap --remote-control ``` -------------------------------- ### Install Codex CLI Source: https://github.com/just-every/code/blob/main/code-rs/README.md Install the Codex CLI globally using npm. This is the easiest method for installation. ```shell npm i -g @openai/codex codex ``` -------------------------------- ### Build and Run App Server Test Client Source: https://github.com/just-every/code/blob/main/codex-rs/app-server-test-client/README.md Build the codex binary, start the websocket app-server in the background, and then call the app-server with a model list command. ```bash # 1) Build debug codex binary cargo build -p codex-cli --bin codex # 2) Start websocket app-server in background cargo run -p codex-app-server-test-client -- \ --codex-bin ./target/debug/codex \ serve --listen ws://127.0.0.1:4222 --kill # 3) Call app-server (defaults to ws://127.0.0.1:4222) cargo run -p codex-app-server-test-client -- model-list ``` -------------------------------- ### Install Companion AI CLIs Source: https://github.com/just-every/code/blob/main/README.md Installs Node.js 20+, sets up environment variables for npm global packages, and installs companion AI CLIs like Claude, Gemini, and Qwen. Includes smoke tests to verify installations. ```bash # Ensure Node.js 20+ is available locally (installs into ~/.n) npm install -g n export N_PREFIX="$HOME/.n" export PATH="$N_PREFIX/bin:$PATH" n 20.18.1 # Install the companion CLIs export npm_config_prefix="${npm_config_prefix:-"$HOME/.npm-global"}" mkdir -p "$npm_config_prefix/bin" export PATH="$npm_config_prefix/bin:$PATH" npm install -g @anthropic-ai/claude-code @google/gemini-cli @qwen-code/qwen-code curl -fsSL https://antigravity.google/cli/install.sh | bash # Quick smoke tests claude --version agy --version gemini --version qwen --version ``` -------------------------------- ### Install Skill from GitHub URL Source: https://github.com/just-every/code/blob/main/code-rs/core/src/skills/assets/samples/skill-installer/SKILL.md Installs a skill from a specific URL on GitHub. This method is useful for installing skills from branches or specific commits. ```python scripts/install-skill-from-github.py --url https://github.com///tree// ``` -------------------------------- ### MCP Server Configuration Example Source: https://github.com/just-every/code/blob/main/README.md Configure Model Context Protocol (MCP) servers in `~/.code/config.toml`. This example shows how to set up a filesystem server using npx. ```toml [mcp_servers.filesystem] command = "npx" args = ["-y", "@modelcontextprotocol/server-filesystem", "/path/to/project"] ``` -------------------------------- ### Create and Update Task Plan with update_plan Source: https://github.com/just-every/code/blob/main/code-rs/core/gpt_5_2_prompt.md Shows how to initialize a task plan with pending steps and how to update the status of steps to 'in_progress' or 'completed'. ```json [ {"step": "Write code", "status": "pending"}, {"step": "Test code", "status": "pending"}, {"step": "Deploy code", "status": "pending"} ] ``` ```json [ {"step": "Write code", "status": "in_progress"}, {"step": "Test code", "status": "pending"}, {"step": "Deploy code", "status": "pending"} ] ``` ```json [ {"step": "Write code", "status": "completed"}, {"step": "Test code", "status": "in_progress"}, {"step": "Deploy code", "status": "pending"} ] ``` ```json [ {"step": "Write code", "status": "completed"}, {"step": "Test code", "status": "completed"}, {"step": "Deploy code", "status": "completed"} ] ``` -------------------------------- ### Start Process Response Source: https://github.com/just-every/code/blob/main/codex-rs/exec-server/README.md Confirms the process has been started, returning its assigned ID. ```json { "processId": "proc-1" } ``` -------------------------------- ### Create, Write, and Read Filesystem Entries Source: https://github.com/just-every/code/blob/main/codex-rs/app-server/README.md Demonstrates creating a directory, writing data to a file, and reading data from a file using JSON-RPC methods. Ensure paths are absolute. ```json { "method": "fs/createDirectory", "id": 40, "params": { "path": "/tmp/example/nested", "recursive": true } } { "id": 40, "result": {} } { "method": "fs/writeFile", "id": 41, "params": { "path": "/tmp/example/nested/note.txt", "dataBase64": "aGVsbG8=" } } { "id": 41, "result": {} } { "method": "fs/readFile", "id": 43, "params": { "path": "/tmp/example/nested/note.txt" } } { "id": 43, "result": { "dataBase64": "aGVsbG8=" } } ``` -------------------------------- ### Structured JSON output example Source: https://github.com/just-every/code/blob/main/docs/exec.md Example of the JSON output when using `--output-schema`. ```json {"project_name":"Every Code CLI","programming_languages":["Rust","TypeScript","Shell"]} ``` -------------------------------- ### Install @just-every/code Source: https://github.com/just-every/code/blob/main/docs/release-notes/RELEASE_NOTES.md Installs the latest version of the @just-every/code package globally and then runs the code command. ```sh npm install -g @just-every/code@latest code ``` -------------------------------- ### Build Bubblewrap from Source Source: https://github.com/just-every/code/blob/main/codex-rs/vendor/bubblewrap/README.md Instructions for building Bubblewrap using Meson. Ensure you have Meson installed for this process. ```sh meson _builddir meson compile -C _builddir Meson test -C _builddir Meson install -C _builddir ```