Skip to content

Bruce-pac/SwiftCodeAgent

Repository files navigation

SwiftCodeAgent

SwiftCodeAgent is a Swift implementation of a Claude Code-style coding agent, built lesson by lesson by following learn-claude-code.

It is a learning and experimentation project for understanding how coding-agent systems are built by rebuilding the runtime in Swift.

What it can do today

The current codebase includes:

  • Agent loop with tool calling
  • File reading, writing, and editing tools
  • Bash execution with permission checks
  • Permission modes such as /mode default, /mode plan, and /mode auto
  • Persistent memory loading and saving
  • Skill loading from .swiftcodeagent/skills
  • Session todo tracking
  • Persistent task records
  • Background task execution and status checks
  • Subagent delegation
  • Context compaction for long conversations

Core Tech Stack

Getting started

Requirements

  • macOS 14+
  • Xcode 16+ or Swift 6.2+

Configure credentials

You can use either environment variables or a local .env file in SwiftCodeAgent/.

Run

git clone https://github.com/Bruce-pac/SwiftCodeAgent.git
cd SwiftCodeAgent

# Set up your API key and model
cp .env.example .env
# Edit .env with your ANTHROPIC_API_KEY 、ANTHROPIC_BASE_URL and MODEL_ID

swift run SwiftCodeAgent

To leave the interactive session, use exit, quit, or q.

Example session

example

SwiftCodeAgent >> inspect the current directory and tell me what kind of project this is
SwiftCodeAgent >> read Package.swift and summarize the dependencies
SwiftCodeAgent >> /mode plan
SwiftCodeAgent >> create a todo list for refactoring the memory manager
SwiftCodeAgent >> exit

Todo

This repository currently covers s01-s13. Remaining topics include:

  • Cron scheduler
  • Multi Agent Team
  • Autonomous agents
  • Worktree isolation
  • MCP plugin
  • Comprehensive integration

About

an agentic coding CLI built with Swift. Swift 实现的命令行编程智能体

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages