Astreus

命令

Astreus CLI 所有命令和键盘快捷键的完整参考。使用这些命令管理你的 agent 开发会话、切换模型并组织你的工作流。 了解构建可靠的 Astreus 智能体系统所需的设置模式、API 和实用示例。

Astreus CLI 所有命令和键盘快捷键的完整参考。使用这些命令管理你的 agent 开发会话、切换模型并组织你的工作流。

斜杠命令

命令描述
/model [name]更改 AI 模型(未指定名称时打开选择器)
/provider [name]更改 AI 提供商(未指定名称时打开选择器)
/sessions打开会话管理器
/new开始新的聊天会话
/attach <path>附加一个文件或文件夹
/attachments显示当前附件
/clear-attachments清除所有附件
/pwd显示当前工作目录
/tools显示已注册的工具
/graph显示图/会话状态
/settings打开设置面板
/clear清除聊天历史
/help显示可用命令
/exit退出 CLI

命令别名

为了更快输入,你可以使用这些快捷方式:

别名完整命令
/session/sessions
/add/a/attach
/ca/clear-attachments
/status/graph
/quit/q/exit

键盘快捷键

快捷键操作
Ctrl+C退出 CLI
Escape取消当前操作
↑/↓浏览命令历史或建议
Tab自动补全命令
?切换命令快捷方式显示

内置文件工具

CLI 提供强大的文件系统工具来管理你的 agent 项目。AI 使用这些工具来创建 agent、插件、配置并修改你的代码:

工具描述
read_file读取文件内容
write_file向文件写入内容(如需要会创建目录)
edit_file通过替换特定内容来编辑文件
list_directory列出目录内容
create_directory创建新目录
delete_file删除文件或目录
move_file移动或重命名文件或目录
search_files按名称模式搜索文件

会话管理

查看会话

/sessions

打开会话管理器,你可以在这里:

  • 查看所有已保存的会话
  • 在会话之间切换
  • 删除旧会话
  • 查看会话元数据(日期、消息、模型)

开始新会话

/new

在保留之前会话的同时创建一个新会话。

会话自动保存

所有对话都会自动保存。当你重新启动 CLI 时,可以从上次离开的地方继续。

文件附件

附加文件

/attach ./src/index.ts

将文件附加到对话上下文中。AI 可以读取并引用此文件。

附加文件夹

/attach ./src

附加整个文件夹。当附加了文件夹后,它将成为文件操作的工作目录。

拖放

你也可以直接将文件路径拖放到终端中。

查看附件

/attachments

显示当前所有附加的文件和文件夹。

清除附件

/clear-attachments

或使用快捷方式:

/ca

模型切换

快速切换

/model gpt-4o

立即切换到指定的模型。

交互式选择

/model

打开一个交互式模型选择器,显示当前提供商的所有可用模型。

更改提供商

/provider claude

切换到不同的提供商。你需要配置相应的 API 密钥。

示例会话:构建一个 Agent

You: /attach ./my-agent
Attached folder: ./my-agent (working directory set)

You: What's the current agent configuration?

Astreus: Let me check the project structure.

[Tool: list_directory] Listing ./my-agent...
[Tool: read_file] Reading ./my-agent/src/agent.ts...

This is an Astreus agent project with:
- Agent configured with GPT-4o model
- Memory enabled for conversation persistence
- No knowledge base configured yet
- No custom plugins

You: Add a knowledge base and ingest our docs folder

Astreus: I'll add knowledge base support to your agent.

[Tool: edit_file] Updating ./my-agent/src/agent.ts...
[Tool: write_file] Creating ./my-agent/src/ingest-docs.ts...

Done! I've updated your agent with:
- Knowledge base enabled in agent config
- Created ingest-docs.ts script to load your documentation
- Run `npx ts-node src/ingest-docs.ts` to ingest docs

You: Create a plugin for fetching weather data

Astreus: I'll create a weather plugin for your agent.

[Tool: create_directory] Creating ./my-agent/src/plugins...
[Tool: write_file] Creating ./my-agent/src/plugins/weather.ts...
[Tool: edit_file] Updating ./my-agent/src/agent.ts to register plugin...

Done! Weather plugin created with:
- get_weather tool for current conditions
- get_forecast tool for 5-day forecast
- Proper TypeScript types and error handling
- Registered in your agent configuration

示例会话:搭建一个新 Agent

You: Create a code review agent that can analyze PRs

Astreus: I'll create a complete code review agent project.

[Tool: create_directory] Creating ./code-review-agent...
[Tool: write_file] Creating package.json...
[Tool: write_file] Creating tsconfig.json...
[Tool: write_file] Creating .env.example...
[Tool: write_file] Creating src/agent.ts...
[Tool: write_file] Creating src/index.ts...
[Tool: write_file] Creating src/plugins/github.ts...

Done! Code review agent created with:
- Claude model (better for code analysis)
- GitHub plugin for PR fetching
- Memory for tracking reviewed PRs
- System prompt optimized for code review

Run these commands to get started:
cd code-review-agent
npm install
cp .env.example .env  # Add your API keys
npm run dev

最后更新时间:2026年7月6日