๐Ÿ“ฆ RivaanRanawat / ai-coding-agent

Claude Code style AI agent from scratch using Python

โ˜… 68 stars โ‘‚ 30 forks ๐Ÿ‘ 68 watching
๐Ÿ“ฅ Clone https://github.com/RivaanRanawat/ai-coding-agent.git
HTTPS git clone https://github.com/RivaanRanawat/ai-coding-agent.git
SSH git clone git@github.com:RivaanRanawat/ai-coding-agent.git
CLI gh repo clone RivaanRanawat/ai-coding-agent
RivaanRanawat RivaanRanawat removing llm generated files and adding readme b6a8fe0 17 days ago ๐Ÿ“ History
๐Ÿ“‚ main View all commits โ†’
๐Ÿ“ .ai-agent
๐Ÿ“ agent
๐Ÿ“ client
๐Ÿ“ config
๐Ÿ“ context
๐Ÿ“ hooks
๐Ÿ“ prompts
๐Ÿ“ safety
๐Ÿ“ scripts
๐Ÿ“ tools
๐Ÿ“ ui
๐Ÿ“ utils
๐Ÿ“„ .DS_Store
๐Ÿ“„ .gitignore
๐Ÿ“„ main.py
๐Ÿ“„ README.md
๐Ÿ“„ README.md

AI Agent

An AI agent that can execute tasks using tools and manage conversations.

Features

Core Functionality

  • Interactive and single-run modes
  • Streaming text responses
  • Multi-turn conversations with tool calling
  • Configurable model settings and temperature

Built-in Tools

  • File operations: read, write, edit files
  • Directory operations: list directories, search with glob patterns
  • Text search: grep for pattern matching
  • Shell execution: run shell commands
  • Web access: search and fetch web content
  • Memory: store and retrieve information
  • Todo: manage task lists

Context Management

  • Automatic context compression when approaching token limits
  • Tool output pruning to manage context size
  • Token usage tracking

Safety and Approval

  • Multiple approval policies: on-request, auto, never, yolo
  • Dangerous command detection and blocking
  • Path-based safety checks
  • User confirmation prompts for mutating operations

Session Management

  • Save and resume sessions
  • Create checkpoints
  • Persistent session storage

MCP Integration

  • Connect to Model Context Protocol servers
  • Use tools from MCP servers
  • Support for stdio and HTTP/SSE transports

Subagents

  • Specialized subagents for specific tasks
  • Built-in subagents: codebase investigator, code reviewer
  • Configurable subagent definitions with custom tools and limits

Loop Detection

  • Detects repeating actions
  • Prevents infinite loops in agent execution

Hooks System

  • Execute scripts before/after agent runs
  • Execute scripts before/after tool calls
  • Error handling hooks
  • Custom commands and scripts

Configuration

  • Configurable working directory
  • Tool allowlisting
  • Developer and user instructions
  • Shell environment policies
  • MCP server configuration

User Interface

  • Terminal UI with formatted output
  • Command interface: /help, /config, /tools, /mcp, /stats, /save, /resume, /checkpoint, /restore
  • Real-time tool call visualization