Skip to main content

AI-driven self-improving development platform

Project description

🧠 merco — Mercury Code

Mer(cury) + Co(de) = 默客 — 默默写代码的 AI 伙伴。轻量、高效、可落地的 Python 智能开发助手。

Phase 2 深入 — Agent 核心循环 + 工具系统 + CLI 交互 + Session 持久化 + 可观察性 + 安全守卫。

快速开始

# 安装
pip install merco
# 或
uv tool install merco

# 交互式配置(一分钟搞定)
merco setup

# 启动
merco

也支持手动配置:~/.config/merco/config.json 或项目目录 ./merco.json

当前功能

  • REPL 交互: 进度条、上下文用量、会话管理、历史恢复
  • Agent 循环: 用户输入 → LLM → 工具调用 → 循环,tool call + result 完整链路持久化
  • 工具: bashread_file(流式+翻页)、write_fileedit_file(SEARCH/REPLACE+diff)、web_fetch
  • LLM 客户端: OpenAI 兼容接口,5 平台预置(MiniMax/OpenAI/Anthropic/OpenRouter/DeepSeek),自定义 base_url
  • 交互式配置: merco setup 引导选平台→填 key→选模型
  • Session 持久化: SQLite WAL,启动自动恢复,/sessions 列表+切换,/new 新会话
  • 安全守卫: ToolGuard 敏感命令执行前确认,30 条默认规则,可自定义
  • 可观察性: /report 显示 token 统计、LLM 延迟、工具分布、缓存命中率
  • Skill 系统: 自动注入相关项目文档,手动 skill_view 加载
  • Diff 预览: edit_file 执行前展示左右对照 diff,支持 sandbox_mode: show 自动应用

REPL 命令

/new       新会话
/sessions  历史会话列表+切换
/report    会话统计报告
/model     当前模型
/context   上下文用量
/tools     可用工具
/skills    已加载技能
/help      帮助
/exit      退出

架构

状态 说明
core/ 🟢 POLISHED Agent 循环 + LLM + 配置 + Session 持久化
tools/ 🟢 POLISHED Bash + 文件读写 + SEARCH/REPLACE diff + 注册中心
skills/ 🟢 可用 Skill 加载/注册/检索 + 自动注入
sandbox/ 🟢 POLISHED Diff split view + show mode + ToolGuard 守卫
observability/ 🟢 已接线 hooks 驱动 Observer,/report 命令
hooks/ 🟢 已接线 Agent 关键节点 emit 事件
memory/ 🟡 部分 SQLite Session 持久化,搜索/压缩待完善
scheduler/ 🔴 未激活 Cron 实现完整,CLI 未启动
gateway/ 🔴 骨架 多平台网关占位
cli/ 🟢 POLISHED REPL + Dashboard + PromptDecorator 可组合
web/ 🟡 部分 FastAPI 占位

项目文档

详细进展、架构、决策、教训、Bug 追踪见 docs/project-vision/

许可证

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

merco-0.3.0.tar.gz (239.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

merco-0.3.0-py3-none-any.whl (108.8 kB view details)

Uploaded Python 3

File details

Details for the file merco-0.3.0.tar.gz.

File metadata

  • Download URL: merco-0.3.0.tar.gz
  • Upload date:
  • Size: 239.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for merco-0.3.0.tar.gz
Algorithm Hash digest
SHA256 1b21d0568185ad5d9b4275bc11cec7a43b8ef4e021ff2f5cff74165a54e32ef5
MD5 037a46194403581917bc5c565d621436
BLAKE2b-256 dda89a5fe4b0af1a271a0444d3a10b902b2aeb9e4a5e58d19cc2b93979eebe61

See more details on using hashes here.

File details

Details for the file merco-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: merco-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 108.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for merco-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 41cc5d21a8d6f05d8fc12b11bbff301330d7e20578fd97a701af148507edfa40
MD5 11bd7a523b42606111bfc68e2f4373a6
BLAKE2b-256 3ec786f4b21fd7ba0fdf0426fe5de6c0d3daf2ead288d04862c632d020fdfe56

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page