Skip to content

d87skg/ngc-claw

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NGC-Claw

本地优先的安全 Agent Runtime —— BusyBox for AI

特性

  • 单二进制:一个文件,双击运行,零外部依赖
  • 本地优先:SQLite 持久化,数据不出境
  • 安全默认:路径沙箱、Shell 白名单、SSRF 防护、O_NOFOLLOW
  • 可审计:Replay Log 记录完整执行轨迹
  • 跨平台:Rust 原生,支持 x86/ARM/国产 CPU

快速开始

# 1. 配置
cp config.example.toml ~/.config/claw/config.toml
# 编辑 config.toml 填入你的 API Key

# 2. 运行
cargo run --release

# 3. 使用
> 读取 Cargo.toml 并列出依赖
> /clear      # 清空记忆
> /quit       # 退出

📖 详细文档用户指南 | 工具列表

项目结构

ngc-claw/
├── src/              # Runtime 核心(< 600 LOC)
│   ├── main.rs       # CLI 入口 + Exit Code
│   ├── agent.rs      # 单 Agent Loop(最多两轮 LLM)
│   ├── llm.rs        # OpenAI 兼容 Provider(无抽象层)
│   ├── tools.rs      # Tool Registry(match arm,无 trait)
│   ├── memory.rs     # SQLite + 滑动窗口 + Token Budget
│   ├── replay.rs     # JSONL 审计日志
│   ├── config.rs     # TOML 配置
│   └── exit.rs       # Exit Code Contract
├── examples/         # 5 个验证场景
├── tests/replays/    # Golden Corpus 协议回归
├── scripts/          # 压力/崩溃/浸泡测试
└── SPEC.md           # v0.1 冻结协议

配置示例

api_base = "https://api.deepseek.com/v1"
api_key = "sk-xxxxxxxx"
model = "deepseek-chat"
max_tokens = 4096
max_turns = 20
max_context_chars = 100000

shell_whitelist = ["ls", "cat", "echo", "grep", "find", "git", "cargo", "python", "node", "pwd", "wc", "head", "tail"]
work_dir = "/home/user/claw-workspace"

验证

# 协议回归测试
bash scripts/validate_replay_corpus.sh

# 崩溃注入测试
bash scripts/crash_test.sh

# 崩溃恢复测试(Windows PowerShell)
powershell -ExecutionPolicy Bypass -File tests/crash_recovery_test.ps1

# 压力测试(Windows PowerShell)
powershell -ExecutionPolicy Bypass -File tests/pressure_test.ps1

# 示例验证
bash examples/01_summarize_repo/verify.sh

文档

路线图

详见 ROADMAP.md

许可

MIT

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages