migueldeicaza/agenticswift — explained in plain English
Analysis updated 2026-05-18
Write a function's intended behavior as a plain-English comment and let the @ai macro generate its body.
Prototype Swift functions quickly without hand-writing implementation code.
Run the test suite offline using the stand-in generator, without needing Codex or an API key.
| migueldeicaza/agenticswift | hreinssondev/anypip | insidegui/liquidglassflag | |
|---|---|---|---|
| Stars | 21 | 21 | 21 |
| Language | Swift | Swift | Swift |
| Setup difficulty | moderate | easy | easy |
| Complexity | 3/5 | 1/5 | 2/5 |
| Audience | developer | general | developer |
Figures from each repo's GitHub metadata at analysis time.
Requires Swift 6.4+ and the Codex CLI installed, currently points to a local swift-syntax dependency.
AgenticSwift is a package for the Swift programming language that lets you skip writing the body of a function by describing what you want in plain English. You attach a special label called @ai to a function, write a sentence describing the intended behavior, and the package contacts an AI tool during compilation to generate the actual code for you. The key moment this happens is at "macro expansion time," which just means: when your project is being built, before the final program is produced. The package sends your description and the function's name and types to a command-line AI tool called Codex, which returns Swift statements. Those statements are inserted into your code as if you had written them yourself. A short example from the README shows a function declared with no body, just a label and a description: "Return the minimum and maximum elements in the array. If the array is empty, return nil." The macro handles the rest at build time. The package is structured into a few parts: the public API you import into your own project, the internal machinery that talks to Codex, a small command-line tool for inspecting the package shape, example programs, and a test suite. The tests work without calling any AI service because they use a stand-in generator, so running the test suite does not require internet access or an API key. For people who want to swap out Codex for a different AI backend, the package exposes a protocol called AIBodyGenerating that any custom generator can conform to. This means the @ai macro is not permanently tied to Codex, and could in principle be wired up to other tools. To use it, you need Swift 6.4 or newer and the Codex command-line tool installed on your computer. The README notes that the package currently points to a local copy of a dependency called swift-syntax, so it is not yet ready to be published as a standalone library without adjusting that setting. The project is released under the MIT license.
A Swift package that lets you write only a function's description in plain English and have an AI tool generate the function body automatically at build time.
Mainly Swift. The stack also includes Swift, Codex CLI, swift-syntax.
Use freely for any purpose, including commercial use, as long as you keep the copyright notice.
Setup difficulty is rated moderate, with roughly 30min to a first successful run.
Mainly developer.
This repo across BitVibe Labs
Verify against the repo before relying on details.