Skip to main content

mens

Agent framework with built-in tools, MCP integration, and CLI.

Install

pip install mens[all]

需要 Python 3.12+ 才能在 TUI 里显示图片(textual-image 的下界);3.10/3.11 上 图片降级成文本占位,其余功能不受影响。

本地开发

uv sync                                    # 唯一需要记的命令
ln -sfn "$PWD/.venv/bin/mens" ~/.local/bin/mens   # 只做一次

mens 命令和 uv run pytest同一个 .venv,加依赖只需改 pyproject 再 uv sync。不要另外 pip install -e . 到别的环境——两套环境会出现「代码是新的、 依赖是旧的」,症状是功能静默降级而不是报错。

裸跑 uv sync 就是完整环境:[dependency-groups] dev 自引用了 mens[all,dev], mcp / serve 不会被静默卸掉。

Quick Start

from flexllm import LLMClient
from mens import AgentClient

llm = LLMClient(model="gpt-4o")
agent = AgentClient(llm)
result = await agent.run("读取 main.py 并分析")

CLI

mens run "查一下 cpu 使用率"          # 非交互执行(支持 stdin 管道)
mens run --tools code "读取 main.py"
mens chat                             # 交互式全屏 TUI
mens chat -c                          # 恢复最近会话
mens sessions list                    # 会话管理

程序 / AI Agent 调用

mens run 是给自动化用的入口:stdout 是结果、stderr 是过程,退出码表达成败。

mens info                                          # 自描述:工具/skill/退出码(JSON)
mens run "任务" --format json                       # 完整执行记录
mens run "任务" --format json || echo "失败: $?"    # 0 成功 / 2 参数错 / 5 未完成

跨调用多轮:--session <id> 新建会话、--resume <id> 续接(分开是为了让"撞上同名旧会话" 报错而不是静默接上陌生上下文)。

退出码与 JSON 字段的完整契约见 docs/agent-cli.md

给 Claude Code 等 AI agent 用时,先装 skill 让它一次拿到心智模型,不必逐层 --help 摸索:

mens install-skill        # → 软链到 ~/.claude/skills/mens/(重开会话后生效)

软链而非复制:升级 mens 后 skill 自动跟着更新,不必记得重装。

交互式 TUI(mens chat)

全屏终端界面:流式输出、工具调用卡片、斜杠命令(/help /clear /compact /model /resume …)、 Esc 中断当前任务、↑/↓ 输入历史、Tab @路径 补全。

  • 权限:默认 default 模式(只读放行,写操作弹窗审批),Shift+Tab 随时轮转 default → acceptEdits → bypass(bypass = 不再询问);"总是允许"会把规则持久化到 .mens/settings.json(如 bash(git commit:*))。详见 docs/permissions.md
  • 会话:每轮自动持久化(flaxkv2),-c/--resume 或 TUI 内 /resume 恢复。详见 docs/sessions.md

完整文档见 docs/

Download files

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

Source Distribution

mens-0.1.2.tar.gz (382.1 kB view details)

Uploaded Source

Built Distribution

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

mens-0.1.2-py3-none-any.whl (136.4 kB view details)

Uploaded Python 3

File details

Details for the file mens-0.1.2.tar.gz.

File metadata

  • Download URL: mens-0.1.2.tar.gz
  • Upload date:
  • Size: 382.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for mens-0.1.2.tar.gz
Algorithm Hash digest
SHA256 f9b3671d4792c7e610b1285089a6104072d33d06f187e63bc3baddcff00e1960
MD5 a5abe91b97db6e95b764e83c1cbd6302
BLAKE2b-256 ca435404d92a8771692762e9ed4631ac7ef9a8cdf29de1e6aaa5c03663559f0e

See more details on using hashes here.

Provenance

The following attestation bundles were made for mens-0.1.2.tar.gz:

Publisher: release.yml on KenyonY/mens

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mens-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: mens-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 136.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for mens-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 1610d69cc22f1e7b40e3ccebc6abe1d537cc369e31ee4312502d81d19018c1ea
MD5 c67783d4953e4110cc877ffec77cdd72
BLAKE2b-256 25ac0b6fd6f1402f511f29054d121e51afb627c3dff3504690593cb28bf64646

See more details on using hashes here.

Provenance

The following attestation bundles were made for mens-0.1.2-py3-none-any.whl:

Publisher: release.yml on KenyonY/mens

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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