AI代码代理CLI

ARC是一个终端本地的AI代码代理工具,支持连接多种AI提供商(如Claude、Gemini、OpenAI等),可离线运行,用于代码库的自主规划、编写和验证。

  • by Ashutosh0x
  • Rust
  • 本地部署
  • 17 星标
  • 更新于
在 GitHub 查看 Ashutosh0x/arc-cli

使用说明

弧

一个对代码库进行推理的本地代理CLI。一个二进制。无运行时。离线工作。


安装

# Linux / macOS
curl -fsSL https://raw.githubusercontent.com/Ashutosh0x/arc-cli/main/install.sh | sh

# Windows
irm https://raw.githubusercontent.com/Ashutosh0x/arc-cli/main/install.ps1 | iex

# From source
cargo install --git https://github.com/Ashutosh0x/arc-cli

它做什么

ARC是一个终端原生AI编码代理。你把它指向一个代码库,描述你想要什么,它就会自主地计划、编写和验证更改。

它连接到Claude、Gemini、OpenAI、Groq、xAI Grok或Ollama(完全离线)。你选择提供者。切换到live with /provider groq如果一个失败了,它就会转移到下一个。

arc chat                    # start a session
/plan "add OAuth2 login"    # generate a plan, review it, accept or reject
/provider groq              # switch to Groq (Llama 3.3 70B)
/model grok-4-1-fast-non-reasoning  # switch model
/checkpoint                 # snapshot current state
/rewind 3                   # undo to checkpoint 3
/compact                    # compress context window
arc review                  # PR critique via 6 specialized agents

为什么不选择Claude Code或Gemini CLI?

ARC 克劳德代码 Gemini CLI
用 Rust Node.js Node.js编写
冷启动 <20ms ~500ms ~400ms
二进制大小 ~15MB ~200MB+ ~150MB+
运行时deps 无 节点18+ 节点18+
离线模式 Ollama 否 否
提供商 6(克劳德、双子座、OpenAI、Groq、xAI、Ollama) 仅限人类 仅限谷歌
不安全代码 #![forbid(unsafe_code)] 不适用 不适用

ARC是一个单一的静态二进制文件,没有解释器、包管理器,也没有 node_modules。它在20毫秒内启动。

运作原理

31箱。 每个板条箱都有一个问题:

arc-cli          REPL, command dispatch, extensions
arc-core         Config, credentials, security, memory
arc-providers    Claude, Gemini, OpenAI, Groq, xAI Grok, Ollama clients
arc-agents       Orchestrator, subagent dispatch, A2A protocol
arc-session      redb checkpointing, fork, rewind
arc-plan         Plan mode, dependency mapping, DAG tracking
arc-tools        File ops, shell exec, MCP client, search
arc-mcp          MCP JSON-RPC client, code intelligence graph integration
arc-policy       Permission engine, sandbox policies
arc-hooks        Event-driven pre/post tool hooks
arc-diff         Structural diffs, patch engine
arc-repomap      tree-sitter AST extraction, context compression
arc-sandbox      Landlock (Linux), shadow workspace isolation
arc-compact      Context compaction, token budgeting
arc-ui           Terminal renderer, statusline, theming
arc-voice        Push-to-talk, 20 languages, multi-backend
arc-plugins      Marketplace, trust levels, manifest validation
arc-remote       WebSocket remote control, JWT auth
arc-a2a          Agent-to-agent HTTP/2 protocol

流动。 基于SIMD构建的自定义SSE解析器 memchr令牌流期间的堆分配为零。跨提供商的HTTP/2连接池。

安全。 每个shell命令在执行前都会经过树保姆(Bash)或PowerShell AST分析。扫描环境变量以查找15个以上的秘密模式。Landlock系统调用过滤Linux上的沙盒文件访问。

记忆。 5层上下文系统(竞技场、工作、短期、长期、压缩器),在接近令牌限制时自动压缩。会话持续到 redb 使用原子快照。

主要特点

代理核心 --接受/拒绝/反馈的计划模式。会话检查点和时间旅行倒退。对话分叉。具有专门子代理的多代理编排。具有完成检测的自主迭代循环。

安全 --三层权限引擎(每个工具允许/询问/拒绝)。Landlock系统调用沙盒。阴影工作区隔离。秘密图案遮挡。MCP清单哈希固定。动态的按请求安全策略。

开发工具 --使用YAML frontmatter删除命令。持久内存存储。20+IDE自动检测。语法突出显示了vim键绑定的diff review。插件市场。语音模式。后台任务管理。与6名专业代理进行公关审查。

平台支持 --Windows(MSVC)、macOS(英特尔+苹果硅)、Linux(x86_64+ARM64,静态musl)。CRLF处理、WSL检测、XDG兼容配置路径。

演出

子系统 测量
配置解析 ~56 us
SSE令牌流 0个分配
冷启动 <20ms
会话检查点(20万个令牌) ~45毫秒

命令

命令 它的作用
arc chat 启动互动会话
arc init 仓库中的Bootstrap ARC配置
arc doctor 在您的设置上运行诊断程序
arc review 人工智能驱动的公关审查
arc --stats 代币使用和成本跟踪
arc graph index 将代码库索引到知识图中(64种语言)
arc graph search <pattern> 结构搜索:函数、类、类型
arc graph trace <function> 调用图——谁调用什么,BFS深度1-5
arc graph architecture 架构概述:层、集群、热点
arc graph impact 地图git diff→ 受影响的符号+风险评分
arc graph query <cypher> 执行类似Cypher的图形查询
/plan [task] 生成并审查修改计划
/provider [name] 交换机提供商直播(anthropic、groq、xai、openai)
/model [name] 切换模型(例如grok-4-1快速推理)
/checkpoint 保存会话状态
/rewind [id] 还原以前的检查点
/compact 压缩上下文窗口
/status 显示当前提供程序、型号、邮件计数
/memory [k] [v] 持久键值存储
/fork [name] 将对话划分为不同的部分
/security-review 扫描差异以查找漏洞模式
/copy 选取并复制代码块

代码智能

ARC与 代码库存储器mcp 通过持久知识图提供结构化代码智能。

arc graph index                                    # index your project (seconds for typical repos)
arc graph search ".*Handler.*"                     # find all handler functions
arc graph trace authenticate --direction inbound   # who calls authenticate()?
arc graph architecture                             # languages, packages, routes, hotspots
arc graph impact                                   # what breaks from your uncommitted changes?
arc graph query 'MATCH (f:Function)-[:CALLS]->(g) WHERE f.name = "main" RETURN g.name'
度量 无图 有图
每个查询的上下文标记 ~412000 ~3400
符号查找 50-500ms(grep) <1ms
解析的语言 5 64
调用图 否 是,BFS深度1-5
死码检测 否 是,~150ms
会话内存 重置 持久化(SQLite)

Diff评论键绑定

当ARC提出文件更改时,您可以交互式地查看它们:

关键 行动
y / Enter 接受此更改
n / Esc 拒绝此更改
a 接受所有剩余
d 拒绝所有剩余的
e 打开 $EDITOR
j / k 滚动浏览较大的差异

文档

贡献

看 贡献.md代码库强制执行 #![forbid(unsafe_code)], cargo fmt,以及 cargo clippy 每一个PR。

许可证

麻省理工学院