自主人工智能编码助手
一个实用的智能AI编程助手 就像克劳德·科德一样 - 使用纯人工智能,不包含任何硬编码模式。
哲学
“相信大脑,而非模式。”
这个代理使用 纯粹的人工智能 理解自然语言请求并自主执行编码任务。无需正则表达式模式,无需硬编码规则,无需预定义响应——全靠模型的智能。
特点/特性
🧠 纯粹的人工智能
- 无硬编码模式 - 所有理解都来源于人工智能模型
- 自然语言处理 - 天然地问任何问题,人工智能都能理解
- 情境感知规划 - 利用会话内存进行智能决策
- 自适应执行 - 与任何Ollama模型兼容,自动检测功能
🚀 自主执行
- 只读操作自动执行 - 列出文件、阅读代码、搜索、分析时无需确认
- 安全写入操作 - 请求批准文件创建、编辑、命令执行
- 智能后处理 - 分析结果并提供自然语言解释
💾 会话内存
- 文件追踪 - 记住会话期间读取的文件
- 项目背景 - 了解项目类型和结构
- 对话历史 - 在多个请求之间保持上下文
- 智能优化 - 避免重复读取文件
建筑学
User Request
↓
🧠 AI Planning (Pure Intelligence)
├─ Understands intent naturally
├─ Checks session memory
├─ Chooses appropriate tools
└─ Creates execution plan
↓
Execute Plan
├─ Read-only: Auto-execute
└─ Write ops: Ask approval
↓
📊 Post-Processing
└─ AI explains results naturally快速入门
先决条件
- Ollama(注:这是一个专有名词或特定项目名,直接翻译可能无具体含义,故保留原样) 已安装至少一个型号:
# Recommended models
ollama pull qwen2.5-coder:32b-instruct-q4_K_M # Best for coding (32B)
ollama pull qwen2.5:14b-instruct-q4_K_M # Good balance (14B)
ollama pull llama3.2:7b-instruct-q4_K_M # Smaller option (7B)- Python 3.8及以上版本 带有依赖项:
pip install -r requirements.txt运行代理程序
标准I/O模式(默认) - 客户端自动启动服务器:
./start_client.shHTTP 模式 - 服务器独立运行:
# Terminal 1: Start server
./start_server.sh
# Terminal 2: Connect client
./start_client_http.sh使用示例
该代理能够完全理解自然语言。以下是一些示例:
只读操作(自动执行)
You: what directory am i in
🧠 Thinking...
📋 Plan: List files in current directory
🔓 All operations are read-only - executing automatically
⚙️ Step 1/1: List files in current directory
✅ Done
📁 Found 11 items...
💡 You're in the Autonomous-AI-Coding-Assistant project directory.You: read client.py and explain what it does
🧠 Thinking...
📋 Plan: Read client.py and provide analysis
🔓 All operations are read-only - executing automatically
⚙️ Step 1/1: Read file client.py
✅ Done
📄 client.py content: [syntax highlighted preview]
📝 Added to session memory (35,234 chars)
💡 client.py implements the AutonomousCodingAgent class with pure AI
intelligence. It uses Ollama models to understand requests naturally,
plan tasks, and execute them autonomously...You: search for the MCPClient class
🧠 Thinking...
📋 Plan: Search codebase for MCPClient
🔓 All operations are read-only - executing automatically
⚙️ Step 1/1: Search for 'MCPClient' in .
✅ Done
🔍 Found in mcp-client/client.py:61写操作(请求审批)
You: generate a django project on movie recommendations
🧠 Thinking...
📋 Plan:
1. Create project directory structure 🔒
2. Write manage.py and settings.py 🔒
3. Create movies app with models 🔒
4. Write views and templates 🔒
🚀 Execute plan? [y/n]它是如何工作的
1. 纯粹的人工智能规划
人工智能模型接收的不是硬编码的模式,而是:
- 用户请求
- 会话内存(读取的文件、项目上下文、对话历史)
- 可用工具
- 最简指令
人工智能大脑自然地理解了该做什么,并制定了一个计划。
2. 自主执行
只读操作 (安全):
list_files- 列出目录内容read_file- 读取文件内容search_code- 搜索模式analyze_project- 分析项目结构get_file_info- 获取文件信息
→ 无需询问,自动执行
写入操作 (待批准):
write_file- 创建/编写文件edit_file- 编辑现有文件execute_command- 运行Shell命令create_directory- 创建目录
→ 请求用户批准
3. 智能后处理
执行后,AI进行分析:
- 用户的问题
- 被执行的是什么
- 会话内存中的文件
- 项目背景
然后对结果进行自然语言解释。
模型要求
该代理与……合作 任何Ollama模型但智力各不相同:
| 模型大小 | 性能 | 推荐 |
|---|---|---|
| 32B+ | 卓越 - 轻松应对复杂任务 | ✅ 推荐 |
| 14-20B | 良好 - 对于大多数任务来说可靠 | ✅ 好选择 |
| 7-14B | Decent(尚可)- 适用于简单任务 | ⚠️ 基本使用 |
| **\ "test"` |
“工具‘X’不可用”错误
- 检查MCP服务器是否正在运行
- 验证已加载的工具:
/session命令显示工具 - 重启客户端:
./start_client.sh
反应迟钝
- 使用较小的模型(7-140亿参数范围)
- 使用量化模型(q4_K_M 或 q5_K_M)
- 确保有足够的显存可用
贡献
这是一个纯AI代理——其改进来源于:
- 使用更好/更大的模型
- 增强会话记忆系统
- 增加更多MCP工具
- 优化最小AI提示(或:改进最基本的AI提示)
无需维护模式匹配!
许可证
MIT 许可证 - 请参阅 LICENSE 文件
功劳;学分;资历
构建于:
- Ollama(注:这是一个专有名词或特定项目/公司的名称,直接翻译可能无法准确传达其含义,因此在这里保留原样) - 本地大型语言模型(LLM)托管
- FastMCP - MCP服务器框架
- Rich(人名,可译为“里奇”) - 终端用户界面
- Prompt 工具包 - 交互式命令行界面(CLI)
受……的启发 克劳德·科德 - 最棒的AI编程助手。
