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 上
图片降级成文本占位,其余功能不受影响。
本地开发
日常开发用 conda py12,它同时 editable 装了 mens 和 flexllm——改 flexllm 的代码
立刻在 mens 里生效,两个项目能联调(mens 的语音、多模态都依赖 flexllm 的新能力)。
conda activate py12
pip install -e ".[all,dev]" # 只做一次
pytest -q # 500 passed
.venv(uv)只用于发版前验证,别拿它做日常开发:
uv sync && uv run pytest -q
两者测的不是同一件事:py12 里依赖是本地 editable 的,验证"我改的代码对不对";.venv
按 uv.lock 装 PyPI 版本,验证"用户 pip install mens 拿到的组合能不能跑"——
flexllm>=0.9.0 这类下界是真是假,只有后者测得出来。CI(release.yml)跑的也是 uv。
代价是两套环境会漂移,而且症状是功能静默降级、不是报错:flexllm 本地加了新功能而
.venv 里还是 PyPI 旧版,两边版本号却一样。动手前先确认自己在哪个环境:
python -c "import flexllm, mens; print(flexllm.__file__); print(mens.__file__)"
# 指向 ~/github/... = py12(可联调);指向 .venv/site-packages = 发布形态
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mens-0.1.6.tar.gz.
File metadata
- Download URL: mens-0.1.6.tar.gz
- Upload date:
- Size: 473.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
721f41d2a45de30c8f0a551dc849b176f7ab60e0992f1984732058f8c42adb8f
|
|
| MD5 |
5395e5f8824a40460276ef7b347854fc
|
|
| BLAKE2b-256 |
559d7c16ba98f18646cbbfae3d500d676376c6835372679d886c6343da6f9737
|
Provenance
The following attestation bundles were made for mens-0.1.6.tar.gz:
Publisher:
release.yml on KenyonY/mens
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mens-0.1.6.tar.gz -
Subject digest:
721f41d2a45de30c8f0a551dc849b176f7ab60e0992f1984732058f8c42adb8f - Sigstore transparency entry: 2341917143
- Sigstore integration time:
-
Permalink:
KenyonY/mens@ab0c1e182c884daa3889975323ac339fb032d853 -
Branch / Tag:
refs/tags/v0.1.6 - Owner: https://github.com/KenyonY
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@ab0c1e182c884daa3889975323ac339fb032d853 -
Trigger Event:
push
-
Statement type:
File details
Details for the file mens-0.1.6-py3-none-any.whl.
File metadata
- Download URL: mens-0.1.6-py3-none-any.whl
- Upload date:
- Size: 163.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
42252076aa9188f2194b0e1abe17f2469db2e5ff580354a7eb5c6e4d5c7f332f
|
|
| MD5 |
03e6707557d024ec7f95744031f98e57
|
|
| BLAKE2b-256 |
dbfa9d7f5dea4ac47ac8d12df530f68546dd7dd16c5e34b1e9c1e2a224811e8a
|
Provenance
The following attestation bundles were made for mens-0.1.6-py3-none-any.whl:
Publisher:
release.yml on KenyonY/mens
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mens-0.1.6-py3-none-any.whl -
Subject digest:
42252076aa9188f2194b0e1abe17f2469db2e5ff580354a7eb5c6e4d5c7f332f - Sigstore transparency entry: 2341917146
- Sigstore integration time:
-
Permalink:
KenyonY/mens@ab0c1e182c884daa3889975323ac339fb032d853 -
Branch / Tag:
refs/tags/v0.1.6 - Owner: https://github.com/KenyonY
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@ab0c1e182c884daa3889975323ac339fb032d853 -
Trigger Event:
push
-
Statement type: