tornikegomareli

Swift AI Agent β€” AI skill for Claude Code

AI community

Simple AI agent based on Claude LLM in Swift programming language πŸ¦β€πŸ”₯.

How to install Swift AI Agent

This entry records only its repository, not the path inside it, so there is no exact command to give. Open tornikegomareli/swift-ai-agent and copy the folder into ~/.claude/skills/, or the file into ~/.claude/agents/.

What Swift AI Agent does

Simple AI agent based on Claude LLM in Swift programming language πŸ¦β€πŸ”₯.

Alternatives in AI

  • AI Dev Tasks β€” A simple task management system for managing AI dev agents 7.8k β˜…
  • Osaurus β€” Own your AI. The native macOS harness for AI agents -- any model, persistent memory, autonomous execution, cry 5.1k β˜…
  • Agent Rules Books β€” AGENTS.md rules / skills for AI coding agents: Codex, Cursor & Claude Code 2.6k β˜…

README

Swift AI Agent

![t-rec-ezgif com-optimize](https://github.com/user-attachments/assets/3b834572-c39f-4b31-931c-9a3ba75e5d15)

A command-line interface (CLI) tool for interacting with the Anthropic Claude API, featuring a robust agent system with tool capabilities.

Project is running inside terminal application and allows you to chat with Claude and enable it to perform actions in your environment using tools. It demonstrates how to build an agent system with the ability to use tools to interact with the local file system.

Motivation

This project was created to understand how AI agents work and to explore the architecture of agent systems. The goal was to build a simple but functional agent system in Swift that can interact with the Claude API and execute tools based on Claude's decisions.

Key learning objectives:

  • Understanding how to structure an agent system
  • Implementing tool definitions and execution flows
  • Managing conversation context between the agent and the AI

Functionality

  • Interactive terminal-based chat with Claude LLM
  • Tool execution capabilities:
    • Read files
    • List files and directories
    • Find and read files
    • Edit existing files
    • Create new files
  • Conversation management with slash commands:
    • /exit - Exit the application
    • /clear - Clear conversation history
    • /tools - List available tools
    • /help - Show help message

Requirements

  • macOS 13.0+
  • Swift 6.0+
  • Anthropic API key

Getting Started

  1. Clone the repository
  2. Open the project in Xcode or your favorite editor
  3. Replace "your-api-key" in main.swift with your actual Anthropic API key
  4. Build and run the project:
swift build
swift run

Architecture

The project is organized into several components:

Agent System

  • Agent.swift: Core agent implementation with conversation loop and tool handling
  • ToolDefinition: Structure to define tools with implementation functions

Anthropic API Client

  • `AnthropicCl