Swift Coding Agent

A staged Swift rebuild of a Claude Code-style coding agent, built to find the minimum architecture the job needs.

Stars
★ 185
Last updated
5mo ago
FARS reviewed
Nov 23, 2026
License
MIT
Primary language
Swift

At a glance

How it runs
CLILibrary / SDK
Works with
Platform-specificClaude API
Cost
Free software; you pay for model usage
Setup effort
Medium · a few setup steps
You'll need
Swift 6.2ANTHROPIC_API_KEYAsyncHTTPClientShell / CLINetwork accessLocal filesystem
Typical use
Swift developers who want to read agent internals stage by stage using the git tags as a syllabus
Not a fit if
  • Teams wanting a mature, ready-to-use coding assistant
  • Users expecting a drop-in Claude Code replacement
  • Developers not comfortable with Swift and SwiftPM tooling
Website
ivanmagda.dev ↗ set on GitHub
Maintenance
Commits in the last 6 monthslast commit 2026-06-26

What does this agent do, and when should you use it?

swift-coding-agent is a from-scratch implementation of a Claude Code-style CLI coding agent written in Swift 6.2, built one stage at a time to study which design choices actually matter. It is a two-target Swift Package Manager project: Core is a library holding the API client, shell executor, agent loop and tools, while the CLI target produces an executable named agent. The agent talks to POST https://api.anthropic.com/v1/messages over raw HTTP via AsyncHTTPClient, runs on macOS and Linux, and executes shell commands with Foundation Process. Git tags mark nine stages split into core loop mechanics (bash, file tools, todo reminders) and product mechanics (subagents, skill loading, three-layer context compaction, a file-based task DAG, background tasks). The author states it is deliberately not a Claude Code clone or production tool; it is MIT licensed.

Running swift run agent starts an async loop: it appends the user query to messages, builds an APIRequest with model, systemPrompt, messages and toolDefinitions, and calls createMessage against the Anthropic Messages API. If stopReason is toolUse, it walks the response content for tool_use blocks, runs each through executeTool (bash, read_file, write_file, edit_file and later-stage tools), appends the tool_result blocks as a user message and iterates; otherwise it returns the response text. Shell execution uses Foundation Process, transport and streaming SSE use AsyncHTTPClient on SwiftNIO, and background stages use Swift Task {} with an actor-based notification queue. Additional stages inject todo reminders, run subagents with fresh context, load .md skill files as tool results, apply micro/auto/manual context compaction, and provide file-based task CRUD with a dependency DAG. The loop body itself never changes — only the tool handler dictionary and pre-call injection points grow.

  1. Swift developers who want to read agent internals stage by stage using the git tags as a syllabus
  2. Engineers standing up a self-hosted CLI agent on macOS or Linux that calls the Anthropic API directly
  3. Teaching or writing about tool_use and tool_result protocol with a minimal, readable loop
  4. Researchers who want to import the Core library into their own Swift project
  5. Experimenters comparing context-compaction and task-state designs across stages

Key setup facts

Pulled from the install and usage notes below. The project README has the current values.

Environment variables
ANTHROPIC_API_KEY MODEL_ID
Config files
.env.example .env

How do you install or deploy this agent?

You need a Swift 6.2 toolchain, network access to api.anthropic.com, and an Anthropic API key.

git clone https://github.com/ivan-magda/swift-coding-agent.git
cd swift-coding-agent
cp .env.example .env
# edit .env with your ANTHROPIC_API_KEY and MODEL_ID
swift build

How do you use this agent?

After the build, launch the CLI executable named agent:

swift run agent

The program reads ANTHROPIC_API_KEY and MODEL_ID from .env, sends requests to POST https://api.anthropic.com/v1/messages, and loops between tool calls and final text. Check out git tags (00-bootstrap, 01-agent-loop, … 08-background-tasks) to compare each stage's implementation. Treat it as staged experimental code rather than a production utility.

Safety boundaries, hardening & integrations

Operational blast radius, source-verified safety controls, and first-run hardening steps before connecting this agent to real workspaces.

Declared capability surface (blast radius)

Local shell command execution

Can run terminal commands; pair with approval gates or container/OS sandboxing.

Local filesystem read/write

Modifies local files; work on a clean Git branch or dedicated worktree.

Outbound network access

Makes outbound requests; verify telemetry settings and model data routing on private repos.

FARS trust-control audit

Not found in source — apply before daily use
  • confirmation before acting — Turn on (or add) a confirmation step before it acts, and try it in a sandbox or test environment before real data.
  • rollback or recovery path — Back up first, or work on a git branch or snapshot, so its changes can be undone.

What are this agent's strengths and limitations?

Pros
  • One mechanism per git-tagged stage makes the architecture readable in order
  • Fixed loop with variable tools; the executeTool boundary and injection points are easy to modify
  • Core library separated from the CLI executable, so Core can be reused as a SwiftPM dependency
  • AsyncHTTPClient provides cross-platform HTTP and streaming SSE on both macOS and Linux
  • Covers real product mechanics — context compaction, subagents, skill loading, task DAGs — not just a demo
Limitations
  • Talks to a single endpoint, the Anthropic Messages API, with no multi-provider abstraction
  • Requires your own ANTHROPIC_API_KEY and MODEL_ID, billed per use
  • Depends on the Swift 6.2 toolchain, a heavy lift for non-Swift teams
  • Author states it is not a Claude Code clone and not production IDE tooling; gaps are intentional
  • Configuration surface is limited to the two .env values; no other repository guidance ships in the repo

How does this agent compare with similar options?

The project explicitly uses Claude Code as its reference model and tries to reproduce its tool surface and loop, and the README notes that most coding agents lean on larger orchestration layers; it does not name specific competing projects.

Key facts side by side with the most closely related agents.

Agent Source review Form / cost Stars Updated Language Full support on
Swift Coding Agent This agent 39 · Major gaps CLIFree + model costs ★ 185 5mo ago Swift Claude API
3code Economical Coding Agent 59 · Major gaps CLIFree + model costs ★ 123 2d ago Nim OpenAI API
rpi: Rust Coding-Agent Runtime 71 · Some gaps CLIFree + model costs ★ 298 today Rust OpenAI API · Claude API
Claude Code From Scratch 62 · Some gaps CLIFree + model costs ★ 2.8k 14d ago Python OpenAI API · Claude API

How does FollowAgents rate this agent?

FollowAgents source review · FARS-2.1
Major gaps
39/ 100 5-point scale 2.0 / 5
Trust 7/29
Reliability 6/14
Adaptability 10/18
Convention 9/18
Effectiveness 4/13
Verifiability 3/8
Why each dimension lost points
Trust7 / 29 · 1.2/5

README claims path safety at stage 02 but no source is in the packet to verify least-privilege enforcement; no user confirmation mechanism is described; data flow only names the Anthropic Messages API without stating what content is sent; API key via .env but no sensitive-data handling detail; AsyncHTTPClient dependency has no pinned version evidence; bash tool and file writes are external effects with no rollback or undo; attribution limited to Anthropic doc references. Each deducted for missing or merely asserted evidence.

Reliability6 / 14 · 2.1/5

The README agent-loop code is self-consistent with the architecture description and CI covers macOS/Linux build and test, so self-consistency scores 2; dependency availability only lists AsyncHTTPClient and Swift 6.2 with no Package.resolved evidence; failure messages are not shown in the sample.

Adaptability10 / 18 · 2.8/5

README clearly frames the project as a learning/exploration tool with explicit Non-Goals, so scenario boundaries are clear; trigger precision (when tools fire, skill-load conditions) is only briefly described in the example skill with no system-prompt or tool-definition source to corroborate; environment fit is stated as macOS/Linux and backed by CI.

Convention9 / 18 · 2.5/5

README is well-structured with complete install steps, Non-Goals as known limitations, and a full MIT license; but versioning relies only on git tags with no changelog, naming stability is unevidenced, examples are a single placeholder skill, and maintenance responsibility is unclear (publisher unverified).

Effectiveness4 / 13 · 1.5/5

As a teaching project output usability is limited; README shows the core loop but no complete runnable artifact evidence; marginal value is architectural explanation rather than a production tool; cost-benefit is moderate given a self-supplied API key and incomplete features.

Verifiability3 / 8 · 1.9/5

README claims are mostly design intent without source cross-corroboration; the roadmap-to-tag mapping cannot be checked in the sample; facts and inferences (e.g. 'Claude Code wins through restraint') are mixed in the README without separation.

Risks and how to mitigate them
  • Not found in source: confirmation before actingTurn on (or add) a confirmation step before it acts, and try it in a sandbox or test environment before real data.
  • Not found in source: rollback or recovery pathBack up first, or work on a git branch or snapshot, so its changes can be undone.
  • Core source is absent from the sample, so least-privilege, path-safety, and failure-handling claims cannot be statically verified.
  • No user confirmation or rollback mechanism; bash and file writes may cause irreversible side effects.
  • Dependency versions are not pinned, raising build reproducibility concerns.
  • Publisher identity is unverified; maintenance responsibility and update path are unclear.
Evidence confidence: Low Reviewed Nov 23, 2026 Reviewed revision 88ed290dff95
See the full review method →
Maintain this project? Add the FARS badge to your README

The badge shows the current review score and verdict and links back to this page. It refreshes about once an hour after a re-review.

FARS

[![FARS review](https://followagents.com/badge/swift-coding-agent.svg)](https://followagents.com/en/agents/swift-coding-agent)
<a href="https://followagents.com/en/agents/swift-coding-agent"><img src="https://followagents.com/badge/swift-coding-agent.svg" alt="FARS review"></a>

FAQ

Does it cost anything to run?
The code is MIT licensed and free, but every run calls the Anthropic Messages API, so you pay per API usage and must supply your own ANTHROPIC_API_KEY.
Can it replace Claude Code?
No. The README states it is not a full clone or drop-in replacement; it is a staged exploration of coding-agent architecture.
Can I plug in OpenAI or other models?
Not as shipped. The client targets POST https://api.anthropic.com/v1/messages and the tool_use protocol in Anthropic's format; switching providers requires rewriting the API client and request/response types.
Will it modify files or run commands on my machine?
Yes. It ships a bash tool plus path-safe read_file, write_file and edit_file, executing shell commands through Foundation Process and reading/writing the filesystem, so run it in a controlled directory.
Which operating systems are supported?
macOS 10.15+ and Linux, per the README, using Swift 6.2 strict concurrency and cross-platform AsyncHTTPClient.
Is Swift Coding Agent open source?
Yes. The source code is on GitHub (ivan-magda/swift-coding-agent) under the MIT licence.
Is Swift Coding Agent safe to use?
FollowAgents' FARS review (Nov 23, 2026) scored Swift Coding Agent 7/29 on trust and safety. The review did not find these safety controls in the source: confirmation before acting, rollback or recovery path. Before giving it real accounts or data: Turn on (or add) a confirmation step before it acts, and try it in a sandbox or test environment before real data.
Is Swift Coding Agent still maintained?
Development has slowed: the latest commit on GitHub is from 2026-06-26, within the last six months but not the last 30 days.
Who makes Swift Coding Agent?
Swift Coding Agent is published on GitHub by the account ivan-magda. FollowAgents has not verified which person or company is behind that account.
What is Swift Coding Agent's official website?
The project's GitHub repository lists https://ivanmagda.dev/posts/s00-bootstrapping-the-project/ as its website. That link is set by the repository owner; the source code itself is on GitHub (ivan-magda/swift-coding-agent).
Was this page helpful?
View on GitHub ↗ Install ↓

Compare agents like this one

The same FARS review applied across the shortlist this agent qualifies for.

Related concepts