FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Dev-Intelligence/coding-agent: 基于 Claude Code 架构学习的 AI 编程助手 · GitHub

 
 

Repository files navigation

🤖 Coding Agent

Coding Agent

基于 Claude Code 架构学习的 AI 编程助手实现。支持文件操作、命令执行、任务管理、会话持久化和权限控制。

✨ 功能特性

功能 说明
🤖 核心 Agent 循环 自动调用 LLM 并执行工具
📁 文件操作 读取、写入、编辑、搜索文件
🔧 命令执行 执行系统命令(支持 Windows/Linux)
📋 任务管理 Todo 列表,支持多步骤任务规划
💾 会话持久化 自动保存对话历史,支持断点续传
🔐 权限系统 危险操作需要用户确认
🗜️ 上下文压缩 自动压缩历史对话,节省 token(压缩率 80%+)
💿 文件缓存 缓存读取过的文件,加速重复访问
🧹 缓存清理 自动清理过期缓存(7天)和限制大小(100MB)
📊 命令历史 上下箭头查看历史命令
⚡ 错误重试 API 调用失败自动重试
⚙️ 配置文件 支持 .codeagentrc.json 配置

🛠️ 内置工具

工具 功能 权限
bash 执行系统命令 ⚠️ 需要确认
read_file 读取文件 ✅ 自动允许
write_file 写入文件 ⚠️ 需要确认
file_edit 编辑文件 ⚠️ 需要确认
glob 搜索文件 ✅ 自动允许
grep 搜索内容 ✅ 自动允许
todo_write 任务管理 ✅ 自动允许
web_fetch 网络请求 ✅ 自动允许
ask_user_question 询问用户 ⚠️ 需要确认
web_search 网络搜索 ⚠️ 需要确认

🚀 快速开始

安装依赖

npm install### 配置API key

配置 API Key

创建 .env 文件:

DEEPSEEK_API_KEY=your_api_key
OPENAI_BASE_URL=https://api.deepseek.com/v1

运行

npm run dev

📋命令列表

命令 功能
/sessions 查看所有会话
/save 保存当前会话
/resume <id> 切换会话
/rename <名称> 重命名当前会话
/session-info 查看会话详情
/delete <id> 删除会话
exit 退出会话

📁项目结构

src/
├── agent/           # Agent 核心
│   ├── loop.ts      # 核心循环
│   └── types.ts     # 类型定义
├── api/             # LLM 客户端
│   └── client.ts    # DeepSeek API
├── tools/           # 工具实现
│   ├── base.ts      # 工具基类
│   ├── registry.ts  # 工具注册
│   └── *.ts         # 具体工具
├── permissions/     # 权限系统
│   ├── types.ts     # 权限类型
│   └── checker.ts   # 权限检查
├── state/           # 会话管理
│   └── session.ts   # 会话存储
└── index.ts         # 入口文件

📚学习笔记

本项目基于对 Claude Code 源码的学习,实现了其核心架构:

  • 核心循环 - while + needsFollowUp 模式
  • 工具系统 - 统一的 Tool 接口 + 能力标记
  • 权限控制 - 工具级别 + 命令级别双重检查
  • 会话管理 - JSON 文件持久化 + 会话隔离
  • 分层存储 - L1-L3 架构,压缩率 80%+

📄 License

MIT License

Copyright (c) 2026

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

About

基于 Claude Code 架构学习的 AI 编程助手

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages


Back | FazBrowse Home | New Git URL