{"slug": "ios-26-swift-6-2-agents-md-for-codex", "title": "iOS 26 / Swift 6.2 AGENTS.md for Codex", "summary": "A developer published a starter kit of AGENTS.md and AGENTS.ios.md configuration files that give OpenAI's Codex coding agent persistent project context, alongside optional Paul Hudson SwiftUI/concurrency/testing/SwiftData skills and an XcodeBuildMCP integration for building, running simulators, tapping UI, and capturing screenshots. The setup aims to cut token waste from re-reading code, enforce modern iOS 26 and Swift 6.2 patterns, and let the agent verify its own changes in a running app.", "body_md": "Test: xcodebuild test -scheme <Scheme> -destination 'platform=iOS Simulator,name=<Sim>'\n\nTooling (Codex)\n\nSkills (Paul Hudson, MIT): swiftui-pro, swift-concurrency-pro, swift-testing-pro, swiftdata-pro. Use swiftui-pro to review every SwiftUI change before committing.\nInstall once: for r in SwiftUI Swift-Concurrency Swift-Testing SwiftData; do d=$(mktemp -d); git clone -q https://github.com/twostraws/$r-Agent-Skill $d && cp -R $d/*-pro ~/.codex/skills/; done\n\nXcodeBuildMCP for build, simulator, screenshots, and UI taps instead of raw xcodebuild when available. Use the ios-debugger-agent skill to drive it.\nInstall once: codex mcp add XcodeBuildMCP -- npx -y xcodebuildmcp@latest mcp && mkdir -p ~/.codex/skills/ios-debugger-agent && curl -sL https://gist.githubusercontent.com/NicolasR27/21e1040cbb4e800f494247d23eddc765/raw/xcode-mcp-skill.md -o ~/.codex/skills/ios-debugger-agent/SKILL.md\nSource: https://github.com/cameroncooke/XcodeBuildMCP\n\nFolders: <src>/, <features>/, <core or shared>/, <tests>/\n\nBuild: <build command> 2>&1 | tail -20\n\nTest: <test command> 2>&1 | tail -20\n\nSecrets: <file>, never committed\n\nFeatures\n\n— <path> — live|beta|flagged\n\nDecisions\n\n<Rule an agent would otherwise undo, e.g. keep REST not GraphQL, no new dependencies>\n\nChangelog (newest first, trim >30 days)\n\nYYYY-MM-DD feat: (<path>)\n\nCode\n\nFollow the existing style, names, and folder layout. Match the stack rules below.\n\nNo force-unwraps, no swallowed errors, no TODOs left behind.\n\nLogic lives outside UI. UI stays thin and previewable/testable.\n\nNew code gets a unit test. Fixtures over network calls in tests.\n\nStack rules\n\n<paste the stack file here, or leave empty>\n\nFirst run\n\nIf any <...> placeholder remains, inspect the repo, fill every section from what you find, delete this section, and commit chore: fill AGENTS.md before starting the task.\n\nWork\n\nEdit only what the task needs. No reformatting. Ask before adding a dependency.\n\nReply with the diff only.\n\nSmall task (one file, rename, typo, copy change, obvious fix): no exploring, no plan, no skills, no tests run. Open the file, edit, build, commit. Under 5 tool calls.\n\nRead only the files you touch. Use grep -n, never dump whole files or directories.\n\nDo not re-read a file after editing it. Do not repeat the build output back.\n\nRun the build and test commands above. Fix failures; never return broken code.\n\nThen add a Changelog line (and Features line if new), and commit: git add -A && git commit -m \"<feat|fix|refactor|test|chore>: <what>\". Do not push.\n\nSetup\n\nAny repo: curl -sL https://gist.githubusercontent.com/NicolasR27/21e1040cbb4e800f494247d23eddc765/raw/AGENTS.md -o AGENTS.md\n\niOS: also curl -sL https://gist.githubusercontent.com/NicolasR27/21e1040cbb4e800f494247d23eddc765/raw/AGENTS.ios.md >> AGENTS.md\n\nPer-folder AGENTS.md overrides root. Global defaults: ~/.codex/AGENTS.md.\n\nA starter kit that makes Codex a better coding helper for any project, with extras for iPhone apps.\n\nThe problem. Every time you open Codex, it forgets everything about your project. It wastes tokens re-reading your code, guesses your style, uses old Apple APIs, and writes long replies you don't need.\n\nWhat each file does:\n\nFile\n\nWhat it does\n\nWhy it helps\n\nAGENTS.md\n\nA rules sheet Codex reads at the start of every chat. It holds your app's features, decisions, and recent changes, plus how to work.\n\nCodex remembers your project between chats, stops re-reading everything, sends short diffs, and commits its own work.\n\nAGENTS.ios.md\n\nExtra rules for iPhone apps: iOS 26 APIs, SwiftUI patterns, Swift Testing.\n\nCodex writes modern Swift instead of old code from tutorials.\n\nPaul Hudson skills\n\nExpert checklists for SwiftUI, concurrency, testing, and SwiftData.\n\nCatches mistakes and outdated code before you commit.\n\nxcode-mcp-skill.md + XcodeBuildMCP\n\nLets Codex build your app, open the simulator, tap buttons, take screenshots, and read logs.\n\nCodex checks its own work in the real app instead of asking you to.\n\nIt keeps itself updated. On the first task, Codex fills in the blanks about your project. After each task it adds a line to the changelog, so the next chat already knows what changed.\n\nSetup in 6 steps\n\nYou only do this once. Open the Terminal app on your Mac (press Cmd+Space, type Terminal, hit Enter). Copy each gray box, paste it into Terminal, press Enter.\n\nStep 1. Get Codex\n\nGo to https://chatgpt.com/codex and download the Codex app. Open it and sign in with your ChatGPT login.\n\nStep 2. Put the rules file in your project\n\nThis file tells Codex how to behave in your project.\n\nFirst, go to your project folder. Type cd (with a space), then drag your project folder from Finder into Terminal, and press Enter.\n\nThen paste this:\n\n```\ncurl -sL https://gist.githubusercontent.com/NicolasR27/21e1040cbb4e800f494247d23eddc765/raw/AGENTS.md -o AGENTS.md\n```\n\nMaking an iPhone app? Also paste this:\n\n```\ncurl -sL https://gist.githubusercontent.com/NicolasR27/21e1040cbb4e800f494247d23eddc765/raw/AGENTS.ios.md >> AGENTS.md\n```\n\nDone. Open the project in Codex and give it any task. The first time, Codex fills in the blanks in the file by itself.\n\nStep 3. Add the Swift skills (iPhone apps only)\n\nSkills are extra knowledge packs. These are from Paul Hudson (Hacking with Swift). Paste this whole thing:\n\n```\nmkdir -p ~/.codex/skills\nfor r in SwiftUI Swift-Concurrency Swift-Testing SwiftData; do\n  d=$(mktemp -d); git clone -q https://github.com/twostraws/$r-Agent-Skill $d && cp -R $d/*-pro ~/.codex/skills/\ndone\n```\n\nQuit and reopen the Codex app. You will see them under Settings → Skills.\n\nStep 4. Let Codex use Xcode (iPhone apps only)\n\nThis lets Codex build your app, run the simulator, and take screenshots. Paste:\n\n```\ncodex mcp add XcodeBuildMCP -- npx -y xcodebuildmcp@latest mcp\nmkdir -p ~/.codex/skills/ios-debugger-agent\ncurl -sL https://gist.githubusercontent.com/NicolasR27/21e1040cbb4e800f494247d23eddc765/raw/xcode-mcp-skill.md -o ~/.codex/skills/ios-debugger-agent/SKILL.md\n```\n\nThe first line adds the Xcode tool. The next two add a skill that teaches Codex how to use it (build, run, tap, read logs).\n\nQuit and reopen Codex. Check Settings → MCP servers. You need Xcode installed already.\n\nIf it says codex: command not found, install the command line tool first:\n\n```\nnpm i -g @openai/codex\n```\n\nStep 5. How to use the skills\n\nYou do not have to do anything special. Codex reads the skill descriptions and picks one when your request matches. You can also call one by name.\n\nTwo keys to remember in the Codex chat box:\n\nType /skills and press Enter to see every skill you installed and turn them on or off.\n\nType $ to pick a skill and use it. A list pops up. Pick one with the arrow keys, press Enter, then type what you want.\n\nExamples:\n\nYou type\n\nWhat happens\n\n$swiftui-pro review my changes\n\nChecks your SwiftUI for old APIs, bad patterns, slow views\n\n$swift-concurrency-pro fix the warnings in LoginView\n\nFixes async/await, @MainActor, Sendable errors\n\n$swift-testing-pro write tests for CartViewModel\n\nWrites Swift Testing tests\n\n$swiftdata-pro review my models\n\nChecks SwiftData models and queries\n\n$ios-debugger-agent run the app and screenshot the home tab\n\nBuilds, launches the simulator, taps around, takes screenshots, reads logs\n\nPlain English works too. \"Run the app in the simulator and check the login screen\" triggers the debugger skill on its own.\n\nTip: skills add text to every request that uses them. Call them when you need them, not on every message.\n\nStep 6. Faster replies\n\nPaste this so Codex thinks less hard by default (faster, uses less of your limit):\n\n```\nmkdir -p ~/.codex && echo 'model_reasoning_effort = \"low\"' >> ~/.codex/config.toml\n```\n\nWhen a task is tough, just tell Codex \"think harder on this one\".\n\nUse XcodeBuildMCP to build, run, launch, and debug the current iOS project on a booted simulator. Trigger when asked to run an iOS app, interact with the simulator UI, inspect on-screen state, capture logs/console output, or diagnose runtime behavior using XcodeBuildMCP tools.\n\niOS Debugger Agent\n\nOverview\n\nUse XcodeBuildMCP to build and run the current project scheme on a booted iOS simulator, interact with the UI, and capture logs. Prefer the MCP tools for simulator control, logs, and view inspection.\n\nCore Workflow\n\nFollow this sequence unless the user asks for a narrower action.\n\n1) Discover the booted simulator\n\nCall mcp__XcodeBuildMCP__list_sims and select the simulator with state Booted.\n\nIf none are booted, ask the user to boot one (do not boot automatically unless asked).\n\nIf the build fails, check the error output and retry (optionally with preferXcodebuild: true) or escalate to the user before attempting any UI interaction.\n\nAfter a successful build, verify the app launched by calling mcp__XcodeBuildMCP__describe_ui or mcp__XcodeBuildMCP__screenshot before proceeding to UI interaction.\n\nIf the app is already built and only launch is requested, use mcp__XcodeBuildMCP__launch_app_sim.\n\nIf bundle id is unknown:\n\nmcp__XcodeBuildMCP__get_sim_app_path\n\nmcp__XcodeBuildMCP__get_app_bundle_id\n\nUI Interaction & Debugging\n\nUse these when asked to inspect or interact with the running app.\n\nDescribe UI: mcp__XcodeBuildMCP__describe_ui before tapping or swiping.\n\nTap: mcp__XcodeBuildMCP__tap (prefer id or label; use coordinates only if needed).\n\nType: mcp__XcodeBuildMCP__type_text after focusing a field.\n\nGestures: mcp__XcodeBuildMCP__gesture for common scrolls and edge swipes.\n\nScreenshot: mcp__XcodeBuildMCP__screenshot for visual confirmation.\n\nLogs & Console Output\n\nStart logs: mcp__XcodeBuildMCP__start_sim_log_cap with the app bundle id.\n\nStop logs: mcp__XcodeBuildMCP__stop_sim_log_cap and summarize important lines.\n\nFor console output, set captureConsole: true and relaunch if required.\n\nTroubleshooting\n\nIf build fails, ask whether to retry with preferXcodebuild: true.\n\nIf the wrong app launches, confirm the scheme and bundle id.\n\nIf UI elements are not hittable, re-run describe_ui after layout changes.", "url": "https://wpnews.pro/news/ios-26-swift-6-2-agents-md-for-codex", "canonical_source": "https://gist.github.com/NicolasR27/21e1040cbb4e800f494247d23eddc765", "published_at": "2026-11-05 21:55:28+00:00", "updated_at": "2026-11-05 22:52:17.539751+00:00", "lang": "en", "topics": ["ai-agents", "ai-tools", "developer-tools", "agent-protocols"], "entities": ["Codex", "OpenAI", "XcodeBuildMCP", "Paul Hudson", "SwiftUI", "Swift Testing", "SwiftData", "Xcode"], "also_reported_by": [], "alternates": {"html": "https://wpnews.pro/news/ios-26-swift-6-2-agents-md-for-codex", "markdown": "https://wpnews.pro/news/ios-26-swift-6-2-agents-md-for-codex.md", "text": "https://wpnews.pro/news/ios-26-swift-6-2-agents-md-for-codex.txt", "jsonld": "https://wpnews.pro/news/ios-26-swift-6-2-agents-md-for-codex.jsonld"}}