john0123412/PawnLogic

GitHub: john0123412/PawnLogic

PawnLogic是一个模块化AI代理框架,用于自动化安全任务和逻辑推理。

Stars: 2 | Forks: 0

**[English](README.md)** | [中文](README_CN.md) # "PawnLogic" as a term and keep it in English. [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE) [![Version](https://img.shields.io/badge/version-0.0.5-blue.svg)](config/paths.py) [![PyPI](https://img.shields.io/pypi/v/pawnlogic.svg?cache=no)](https://pypi.org/project/pawnlogic/) [![CI](https://static.pigsec.cn/wp-content/uploads/repos/2026/05/efcf15829f000140.svg)](https://github.com/john0123412/PawnLogic/actions/workflows/main_ci.yml) [![Python 3.10+](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org/) [![Platform](https://img.shields.io/badge/Platform-Linux%20%7C%20WSL2-lightgrey.svg)]() ## ⚡ 快速开始 **选项 A — pip 安装(推荐)** ``` pip install pawnlogic pawn # first run launches the API configuration wizard ``` **选项 B — 从源代码安装** ``` git clone https://github.com/john0123412/PawnLogic.git && cd PawnLogic python3 -m venv venv && source venv/bin/activate pip install -r requirements.txt python main.py # first run launches the API configuration wizard ``` 全局 `pawn` 命令: ``` chmod +x pawn.sh && ln -sf "$(pwd)/pawn.sh" ~/.local/bin/pawn ``` **CLI 用法:** ``` pawn # interactive mode pawn --eval "your prompt" # single execution then exit pawn --eval "prompt" --json # JSON output (for scripting) ``` ## v0.0.5 版本更新 - **`--eval` / `--json` / `--session` CLI 标志** — 非交互式单次执行,用于管道的 JSON 输出,恢复指定会话 - **沙箱安全加固** — 所有解释型语言(Python/bash/node/go)现在在隔离的临时目录中执行;增加了 `RLIMIT_FSIZE`(64 MB)写入限制 - **MCP 自动重试** — 外部工具调用在超时/连接错误时最多进行 3 次指数退避重试 - **会话检查点** — 每 5 次迭代自动保存一次;对 SQLite 写入进行 `OperationalError` 重试 - **密钥显示掩码** — 在 `/keys`、`/provider list` 和 `/model` 中统一使用 `mask_key()` ## 核心能力 | 能力 | 描述 | |------|------| | 🔀 **动态 Provider 系统** | 内置 DeepSeek / OpenAI / Anthropic + 通过 `/provider` 添加任何兼容 OpenAI 的 API | | 🧠 **持久化记忆** | SQLite 会话历史、RAG 知识库、跨会话全文搜索 | | 🛠️ **真实工具执行** | Shell、代码沙箱(8 种语言)、网页抓取、文件操作、Docker 容器 | | 👁️ **视觉** | 向 `gpt-4o` 或 `claude-sonnet` 提供屏幕截图进行分析 | | 📋 **规范驱动规划** | 代理在每个操作前输出 `` XML — 无盲目执行 | | 💬 **会话管理** | 使用 `/chat` 命令为对话添加标签、搜索、链接和导出 | | 🔐 **CTF / Pwn 工具链** | GDB 自动化、ROP 链构建、libc 泄漏解决、Docker 隔离 | ## 支持的模型 | Provider | 别名 | 最佳用途 | |----------|------|----------| | DeepSeek | `ds-v4-flash` `ds-v4-pro` | 快速默认选择,旗舰级推理能力 | | OpenAI | `gpt-4o` `gpt-4.1` `o3` | 视觉、代码、复杂推理 | | Anthropic | `claude-sonnet` `claude-haiku` | 平衡、快速、低成本 | 通过 `/provider fetch` 添加的自定义 provider 会自动出现在 `/model` 和 Tab 补全中。 ## Provider 管理 ``` /provider # open interactive TUI panel /provider add [anthropic] /provider fetch # auto-discover models with interactive multi-select /provider list # show all providers and key status /provider test # test connectivity ``` 所有密钥存储在 `~/.pawnlogic/.env`。Provider 配置(不含密钥)保存在 `~/.pawnlogic/custom_providers.json`。 ## 快速命令参考 ``` /model [alias] # switch model /mode # toggle USER / DEV output mode /chat find # full-text search across all sessions /think # single deep-reasoning turn /compact # summarize + clear context /undo [n] # roll back last n turns /deep # switch to deep mode (32k tokens, 50 iter) /init_project # initialize GSD engineering pipeline /pwnenv # check CTF toolchain integrity /keys # show API key status for all providers ``` ## MCP 工具集成 ``` cp mcp_configs.example.json ~/.pawnlogic/mcp_configs.json # Another thought: "PawnLogic" might be a combination of "Pawn" and "Logic". "Pawn" in chess is "兵", but in a technical context, it might be kept as is. Given the instruction, I'll keep it in English. python main.py # MCP servers load automatically ``` 支持的 MCP 服务器:**Tavily**(搜索)、**Playwright**(浏览器自动化)、**Filesystem**(文件桥接)。 ## 数据布局 所有运行时数据和 API 密钥都存储在 `~/.pawnlogic/` — **绝不位于项目目录中**。 ``` ~/.pawnlogic/ ├── .env # ALL API keys (LLM providers + MCP tools) ├── custom_providers.json # user-added provider configs (no keys) ├── mcp_configs.json # MCP server declarations ├── pawn.db # sessions, messages, knowledge base ├── global_skills.md # GSA skill archive ├── workspace/ # per-session working directories └── logs/ # audit logs ``` 项目目录不包含任何敏感信息,可以安全提交或分享。 ## 文档 | 文档 | 描述 | |------|------| | **README.md** | 本页 | | **README_CN.md** | 中文版 | | **GUIDE_EN.md** | 完整参考 — 命令、架构、常见问题 | | **GUIDE_CN.md** | 完整参考手册 — 命令、架构、常见问题 | | **CHANGELOG.md** | 版本历史和发布说明 | | **CONTRIBUTING.md** | 如何贡献、添加 provider、运行测试 | | **SECURITY.md** | 漏洞报告政策 | ## 支持 - **GitHub**:[github.com/john0123412/PawnLogic](https://github.com/john0123412/PawnLogic) - **问题**:GitHub Issues 用于报告 bug 和功能请求
标签:AI代理, API安全, API配置, JSON输出, Python, WSL2, 人工智能, 任务编排, 会话管理, 安全沙箱, 数字取证, 无后门, 智能代理, 模块化框架, 用户模式Hook绕过, 脚本化, 自动化脚本, 请求拦截, 软件开发, 逆向工具, 逻辑推理