Skip to main content
Glama

Pure-Gemini (V4.7.1)

为 Gemini Desktop、Claude Code、Antigravity、Cursor 与 Codex 打造的确定性本地工程护栏 + 默认内置研发工作流套件

English README | 架构规范 (ARCHITECTURE.md) | 安全与威胁边界 (SECURITY.md) | 更新日志 (CHANGELOG.md) | 默认核心技能 (skills/pure-gemini-v4)


为什么做 Pure-Gemini?

AI 编程助手在真实工程里最常见的 5 个翻车点,单靠写 Prompt 永远拦不住:

  1. 只问一句意见,模型直接动手改代码(没有物理刹车)

  2. 改歪了很难秒退回,或者在主仓库里直接裸改污染现场

  3. 贴 API Key 进对话触发云端 DLP 拦截,或者密钥漏进日志

  4. 多窗口并发开干互不知道进度,浏览器互相抢标签页,或者每次重连弹窗点 Allow

  5. 模型口头宣称“改好了”,实际漏跑测试、自己审自己放水、甚至带脏文件提交

Pure-Gemini V4.7 用「零外部依赖 Python 标准库底座 + macOS 原生菜单栏助手 + 内置类 Superpowers 核心工作流技能」,把软件工程纪律从“口头约定”升级成操作系统与 Git 级别的硬门禁:

研发环节

纯 Prompt 约束的局限

Pure-Gemini V4.7 硬底座闭环

头脑风暴 / 问询讨论

模型聊着聊着忍不住直接改文件、点浏览器

内核级只读讨论锁(Plan Mode):macOS chflags uchg 物理禁写 + 浏览器写动作门禁(放行截屏/快照,硬拦点击/输入)+ 按项目限时放行(如 30 分钟到期自动复锁)

执行契约与悔棋保护

长对话越界改文件、改歪难回滚

写入 SESSION_LEDGER.md 契约(approved_goal / approved_files / non_goals),越界标红 SCOPE DRIFT;解锁/开槽自动打 Git / APFS cp -cR 写时复制快照,菜单栏 0.1 秒无损撤销

系统性排错与大仓导航

日志爆上下文、大仓符号找漏调用方

SQLite WAL 增量 AST + FTS5/Trigram 毫秒检索 + PageRank 脏文件加权精简地图(CODE_MAP_COMPACT.md) + 测试失败报错脱水

个人浏览器登录态复用

每次重连弹 Allow、多窗口抢页或回退 Computer Use

零依赖本地 CDP 单连接常驻多路复用桥,同时独立支持日常 Chrome(chrome)与 Chrome Beta(chrome_beta),按 session 独立 --pin-tab 隔离标签页

密钥与环境隔离

聊天贴 Key 触发 DLP 或泄露进回执

本机密钥保险箱(0o600):经 stdin 录入,子进程自动注入、动态精确值脱敏([REDACTED_SECRET_VAULT]),密钥全程不进云端对话框

验证、盲审与干净交付

自己审自己放水、漏测或带未提交脏文件

自动嗅探测试配方(verify="auto")→ 波及单测(test_impact)→ 全量 verify → 零断连本机只读盲审(blind_review) → 无软链干净快照复验提交(checkpoint)

声明:Pure-Gemini 是独立的本地开源工程护栏套件(MIT 协议),非 Google 官方产品,不会修改 Gemini 客户端私有配置或绕过宿主权限提示。


Related MCP server: Local Ops MCP

核心特性一览(V4.7.1)

  • 全隔离工作区与非 Git 目录纳管:

    • Git 项目自动创建独立 git worktree 槽位(绝不碰人类主工作区);

    • 任意非 Git 普通文件夹支持就地纳管或无软链 APFS 克隆进 ~/ag-workspaces,改完一键安全回写原目录(自动备份)。

  • 按项目内核只读锁 + 后台守护自动豁免:

    • 菜单栏可按单个项目上锁、长期解锁或「⏳ 放行 30 分钟(到期自动复锁)」;

    • 含 .pure-gemini-daemon / *.pid 或配置 daemon_exempt: true 的后台守护目录自动豁免全局锁,支持 .pure-gemini-lockignore 精细放行状态文件。

  • 默认内置核心研发工作流技能包(单包渐进加载):

  • 三模统一接入(macOS / Linux / Windows):

    • 原生 MCP Server(pure_gemini_mcp.py / pure-gemini-mcp,提供 28 个 pg_* 工具,支持 Claude Code / Antigravity / Cursor / Codex / Windsurf);

    • 一步同步 CLI(pure_gemini_supervisor.py call / pure_gemini_v4.py call);

    • 零终端文件信箱 + 原生文件夹客户端(专为 Gemini Desktop Connected Folders 设计,macOS kqueue 0% 空闲 CPU,槽位守护 15 分钟空闲自动休眠)。


3 步快速上手

方式 A:Gemini Desktop + macOS 原生菜单栏助手(推荐)

  1. 安装 macOS 助手(Apple Silicon arm64):

    • 从 Releases 下载 PureGemini-4.7.1-macos-arm64.zip(或本地执行 python3 scripts/package_release.py 构建);

    • 解压后若 macOS 提示未公证,执行一次 xattr -dr com.apple.quarantine PureGemini.app 后打开,点击「安装」并运行「诊断」。

  2. 上传默认核心技能包:

    • 在 Gemini Desktop 左侧 Skills Manager 上传发布的 pure-gemini-v4-skill.zip(单包已内置协议 + 头脑风暴 / 系统性排错 / 验收盲审全套工作流);

    • 在 Gemini Tasks 的 Connected Folders 挂载 ~/ag-workspaces。

  3. 开始使用:

    • 点击菜单栏「进入项目…」或「纳管普通目录…」,再点「📋 复制续接口令 ▸」粘贴到 Gemini 即可开干;

    • 讨论方案前点「🔒 只读讨论锁 ▸」锁住目标项目,拍板后点「⏳ 放行 30 分钟」自动打快照并执行。

方式 B:Claude Code / Antigravity / Cursor / Codex(原生 MCP + 插件)

本仓库根目录已提供标准插件清单 .claude-plugin/plugin.json 与可安装的 Python 包:

# 克隆并直接以 stdio MCP 启动(零外部 PyPI 依赖,Python >= 3.9)
git clone https://github.com/SHKAI0/pure-gemini.git
cd pure-gemini
python3 pure_gemini_mcp.py --workspaces-root ~/ag-workspaces --state-root ~/ag-runner-state

或在客户端的 MCP 配置中加入:

{
  "mcpServers": {
    "pure-gemini": {
      "command": "python3",
      "args": ["-B", "/path/to/pure-gemini/pure_gemini_mcp.py"]
    }
  }
}

方式 C:跨平台本地 CLI / 守护进程(macOS / Linux / Windows)

# 运行全量自动化测试(400 项,零外部依赖)
PYTHONWARNINGS=error python3 -m unittest discover -s tests -q

# 打包 Skill ZIP(及可选 macOS App ZIP + SHA256SUMS)
python3 scripts/package_release.py

Windows 用户可使用 scripts/install_windows.ps1;Linux / macOS CLI 用户可使用 scripts/install_local.sh。


本地安全与目录边界

  • 工作区根目录(~/ag-workspaces):AI 可挂载目录,包含隔离槽位与控制信箱;

  • 私有状态根目录(~/ag-runner-state):永不挂载给 AI,存放权威回执、锁文件、改前快照与 0o600 密钥保险箱;

  • 详细安全模型见 SECURITY.md 与 ARCHITECTURE.md。

开源协议

本项目基于 MIT License 开源。

Available Tools

31 tools
pg_blind_reviewB

Run zero-disconnect independent local read-only blind review on a slot diff (security/hygiene/scope-drift + optional read-only CLI), writing ctl/BLIND_REVIEW.md and optionally ctl/REVIEW_FEEDBACK.json.

Inputs: slot, reviewer_cli, write_feedback.

pg_browserA

Operate the persistent Pure-Gemini browser (default target="managed") or attach to an already-open personal browser with remote debugging enabled: target="chrome" for daily Google Chrome, target="chrome_beta" for Google Chrome Beta, or target="user_chrome" (auto). Pass optional session (e.g. "flow") to isolate concurrent tasks into separate --pin-tab tabs; close is forbidden on personal targets.

Inputs: steps (required), target, session, visible.

pg_checkpointA

Deterministic commit gatekeeper: blocks on open must_fix review comments, strips cache files, commits, re-verifies a clean symlink-free git archive snapshot, and auto-rolls back HEAD if clean verification fails.

Inputs: msg (required), slot.

pg_code_graphC

Rebuild incremental AST & bidirectional import/blast-radius dependency graph (Python, TS/JS barrel re-exports, Go, Rust).

Inputs: slot, focus_files.

pg_connection_probeB

Respond to or confirm the one-time connection test created by the local helper. Success proves a transport roundtrip, not caller identity.

Inputs: op (required), probe_id (required), challenge, response_nonce.

pg_detect_recipesB

Safely inspect a local repository manifest (read-only) to detect suggested verify and quick_verify recipes.

Inputs: repo_path (required).

pg_diagnoseB

Run static syntax/type/lint diagnostics (Python AST, ruff, pyright, tsc, or custom diag_cmd).

Inputs: slot, sub_id, targets.

pg_epochB

Mark a safe working-tree epoch or rollback uncommitted edits with automatic .tar backup.

Inputs: op (required), slot.

pg_folder_adoptB

Adopt a non-Git folder inside ~/ag-workspaces in-place, APFS-clone an external folder into ~/ag-workspaces, or sync an imported clone back to its origin.

Inputs: op (required), folder, dry_run, project.

pg_githubA

Execute guardrail-protected GitHub operations (auth status, private-only repo creation, hookless push, draft PR) using host credentials.

Inputs: op (required), base, body, name, +7 more.

pg_healthC

Check the actual runtime version and process with a bounded local round trip.

Inputs: no named parameters.

pg_host_execB

Execute a pinned system developer binary (shell=False, guardrail-checked against destructive flags/paths) inside a project directory.

Inputs: cwd (required), argv (required), timeout.

pg_ledgerC

Read or update the cross-window per-project task blackboard (SESSION_LEDGER.md) with progress, Grill-Me execution contract (approved_goal/approved_files/non_goals), pending decisions, pitfalls, and browser session bindings.

Inputs: op (required), goal, project, pitfalls, +10 more.

pg_memoryA

Persist or recall cross-slot repository engineering rules & pitfalls (stored in knowledge.db + .agents/rules).

Inputs: op (required), slot, query, title, +3 more.

pg_plan_modeC

Inspect or toggle kernel-level Read-Only Discussion Lock (Plan Mode: macOS chflags uchg, browser write gate, daemon exemption, pre-unlock snapshot, optional timed unlock ttl_minutes).

Inputs: op (required), reason, project, ttl_minutes, +1 more.

pg_probe_uiB

Two-stage frontend verifier: static HTML/JS asset check + Headless Chromium viewport PNG screenshot & post-JS DOM/console capture.

Inputs: slot, width, height, sub_id, +2 more.

pg_project_taskA

Start, inspect, read bounded logs or stop a registered prepare/build/dev task in its slot worktree. Start currently requires POSIX host isolation.

Inputs: op (required), name, slot, run_id, +1 more.

pg_reviewC

Manage interactive line-level code review workbench (REVIEW_DIFF.html), cloud blind-review DIFF_BUNDLE.md, or resolve must_fix comments.

Inputs: op (required), note, slot, comment_ids, +1 more.

pg_search_codeC

Hybrid SQLite FTS5 (BM25 symbol + trigram substring RRF) code search across Python, TS/JS, Go, Rust, etc.

Inputs: query (required), slot, limit.

pg_secretsC

List key names (never plaintext values) or delete keys in the local 0o600 Secret Vault.

Inputs: op (required), key, scope.

pg_slot_closeA

Stop a managed background watcher daemon for a workspace slot (worktree files are preserved).

Inputs: slot (required).

pg_slot_listB

List all provisioned workspace slots and active background slot daemons.

Inputs: no named parameters.

pg_slot_openC

Provision or attach an isolated Git worktree slot under ~/ag-workspaces// without touching the user's main repo.

Inputs: main_repo (required), slot, branch, verify, +8 more.

pg_slot_statusB

Read structured workspace slot status, verify state, dirty files, active rules/memory, and open review comments.

Inputs: slot.

pg_sub_worktreeC

Manage isolated module sub-worktrees with in-memory git merge-tree --write-tree 3-way conflict preflight.

Inputs: sub_action (required), msg, slot, sub_id, +1 more.

pg_supervisor_pingB

Check Pure-Gemini host capabilities (GitHub CLI auth, Headless Chrome, Docker/Podman container runtime, macOS Seatbelt).

Inputs: no named parameters.

pg_task_statusB

Read continuation state, interruptions, verification and receipt metadata. Does not retry commands.

Inputs: slot.

pg_test_impactC

Trace affected tests and run them in batches; fall back to the full recipe when dependency coverage is incomplete.

Inputs: slot, runner, sub_id, dry_run, +2 more.

pg_test_targetB

Run targeted unit tests on specific relative files/directories with optional test-name filter.

Inputs: slot, runner, sub_id, targets, +1 more.

pg_undo_turnC

Create a manual pre-edit snapshot or one-click restore a Git slot or non-Git folder back to its pre-unlock/baseline snapshot.

Inputs: op (required), project (required).

pg_verifyB

Run the slot's registered deterministic verification recipe ('full' or 'quick') and refresh CODE_GRAPH.md + REVIEW_DIFF.html.

Inputs: slot, sub_id, recipe_id.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.2/5.0

    Scored across 31 tools

    Disambiguation4/5

    Most tools map to distinct lifecycle actions, and the detailed descriptions clarify boundaries. However, several clusters could still be confused without close reading: health/probe tools, verification/test/diagnostic tools, review vs blind review, and epoch/checkpoint/undo snapshot tools.

    Naming Consistency4/5

    All tools use a consistent pg_ snake_case prefix, which makes the set readable. The action pattern is not fully uniform, though, mixing noun-style names like pg_health, pg_memory, and pg_checkpoint with verb_noun names like pg_slot_open and noun_verb names like pg_folder_adopt.

    Tool Count3/5

    The 31-tool surface is heavy and exceeds the typical well-scoped range, creating real selection and cognitive-load costs. The broad local-development orchestration domain justifies many tools, but several could likely be consolidated.

    Completeness4/5

    The set covers a wide lifecycle: workspace provisioning, verification, testing, code search, diagnostics, review, commit gating, rollback, GitHub, host execution, tasks, memory, and secrets. A minor gap is that pg_secrets can list key names and delete keys but does not expose setting or reading secret values, and some edge operations may still require host execution.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables AI clients to safely read, search, understand, and edit local project code and files, with Git inspection, code indexing, and controlled command execution within permissioned workspaces.
      6
      MIT
    • A
      license
      A
      quality
      C
      maintenance
      Enables AI clients like ChatGPT or Codex to manage files and local Git repositories within an explicitly authorized workspace, with server-enforced path boundary checks and optional remote Git operations.
      18
      1
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables AI clients to securely inspect and edit approved code, use semantic code intelligence, run builds/tests, supervise bounded processes, inspect Git, and execute owner-approved SSH commands on engineering workstations.
      2
      Apache 2.0
    • A
      license
      A
      quality
      B
      maintenance
      Enables coding agents to browse, read, search, and write files inside a locked workspace, run asynchronous shell commands, and batch read operations, all with validated caching, health diagnostics, and a SQLite audit trail.
      30
      1,437 npm
      1
      AGPL 3.0