人机交互代理通知系统

hi 是一个持久化桌面守护进程,为 AI 代理提供统一的人机交互点,支持通过 IPC 或 HTTP 进行请求处理。

  • by jimschubert
  • Go
  • 本地部署
  • 1 星标
  • 更新于
在 GitHub 查看 jimschubert/hi

使用说明

每个代理都有一个单一的通知系统。

hi (“人类智能”)是一个正在开发中的持久桌面守护进程,它为人工智能代理(Claude、Qwen、Copilot和非头韵的其他人)提供了一个单点的人类交互。 作为MCP服务器,这可以避免在可能的情况下结束会话 可能 为您节省学分/请求。

这是它的工作原理。

  1. 任何代理都可以发送 hi_* 请求 hi 守护进程
  2. 守护进程将向用户显示代理正在等待人工输入的通知
  3. 人类(您)点击系统托盘中的“显示下一个请求”
  4. hi 为您提供文本输入、单选或多选、确认等UI,您可以对请求进行响应

免责声明

hi 是一种用于人类在环代理交互的工具。做 不 在没有人工审查的情况下,依靠代理人做出关键决策。

我按原样提供这个工具,只是请不要用它来生成“垃圾”。

看 Anthropic开发安全可信代理的框架 有关负责任的代理AI的详细信息。

[!警告] 请注意,如果您正在运行多个步骤的长时间运行任务,一些代理可能会触发自动禁令。 例如,请参见 这个讨论话题.

安装

go install github.com/jimschubert/hi/cmd/hi@latest

用法

这 hi binary运行守护进程,通过stdio处理MCP请求,并通过IPC管理守护进程。

$ hi --help                       
Usage: hi <command> [flags]

Human Intelligence — MCP server for human-in-the-loop agent interactions

Flags:
  -h, --help       Show context-sensitive help.
  -v, --version    Print version information.

Commands:
  daemon      Run the hi daemon
  status      Query status of the hi daemon
  ping        Ping the hi daemon
  stdio       Query the daemon via stdio over Unix socket
  shutdown    Shutdown the hi daemon (gracefully)
  test        Submit 1+ test requests to the hi daemon over Unix socket

Run "hi <command> --help" for more information on a command.

MCP配置

您可以通过IPC(Unix套接字)、HTTP或两者为MCP提供服务。默认设置为IPC,因为它易于上手。

IPC(Unix套接字)

这就是你所需要的 stdio 子命令将在IPC模式下自动启动守护进程。

{
  "mcpServers": {
    "human-intelligence": {
      "command": "/path/to/hi",
      "args": [
        "stdio"
      ]
    }
  }
}

超文本传输协议

假设你已经开始了 hi daemon 随着 --addr localhost:45678:

{
  "mcpServers": {
    "human-intelligence": {
      "url": "http://localhost:45678/mcp"
    }
  }
}

示例提示

下面是一个示例系统提示,要求您的LLM使用 hi:

When you need user input, decisions, or confirmations, use the human-intelligence MCP server tools
(get_user_input, get_user_choice, show_confirmation_dialog, etc.)
instead of asking me in chat.

This keeps our conversation clean and provides better interaction.

许可证

Apache 2.0-请参阅 许可证