Profiles
Profile 是一个隔离的 Anyy 身份。它拥有自己的 home directory、configuration、state database、sessions、memory、skills、roles、cron jobs、channel configuration、logs、backups 和 secrets。
当你需要真实的数据隔离时,例如区分个人和工作配置,使用 profiles。当你只想改变同一个 profile 内的人设或语气时,使用 roles。
快速开始
anyy profile create work --display-name "Work"
anyy --profile work setup
anyy --profile work status
anyy profile use work
如果不想改变 active profile,可以用 --profile NAME 只让单条命令使用该 profile:
anyy --profile work chat "Summarize today's notes."
什么是 Profile
Profile 是 storage 和 runtime boundary。选择 profile 会决定命令或 gateway 使用哪个 Anyy
home directory。该 home 又决定加载哪个 config.yaml、state.db、secrets/、memory/、
skills/ 和 channel configuration。
Profile 不会改变 Anyy 的产品身份。Anyy 仍然标识为 Anyy;profile 控制本地 数据和配置。
创建 Profile
创建一个空 profile:
anyy profile create work --display-name "Work"
查看它:
anyy profile get work
列出所有 profiles:
anyy profile list
需要机器可读输出时,给 profile commands 加 --json。
命名规则
Profile names 会规范化为小写。名称必须以字母或数字开头,后面只能使用字母、数字、_ 或 -,
最多 64 个字符。
profile、profiles、gateway、status、doctor、logs、skills、debug 和 channel
names 等保留的 operational names 不能作为 profile name。
空 profile
新创建的 profile 会有自己的目录布局和默认本地文件。正式使用前,为该 profile 运行 setup:
anyy --profile work setup
anyy --profile work status
Clone configuration
当前 anyy profile create 命令没有实现 clone flag。如果你想创建配置相似的另一个
profile,请先创建 profile,再只复制或重建你确实想共享的配置。Secrets 应保持为 secret
references,不要复制为 inline values。
Clone data
Profile data cloning 在本构建中不是一等 CLI 操作。Backups 是导出某个 profile 本地状态的支持路径:
anyy --profile work backup create
anyy --profile work backup list
任何手动复制 state.db、secrets/ 或 channel state 的行为都应视为 operational migration,
而不是常规 profile command。
使用 Profile
切换 profile root 下的 active profile:
anyy profile use work
只让某条命令针对一个 profile 运行,而不改变 active profile:
anyy --profile work status
anyy --profile work chat "What is on my task list?"
接受 --home PATH 的命令可以绕过 profile selection,直接指向一个显式 Anyy home:
anyy status --home /path/to/anyy-home
每次只使用一种 selection mechanism。如果你对某个会把 explicit home 和 profile selection 视为 歧义的命令同时传入两者,Anyy 会报告 mismatch,而不是猜测。
Profile Root
Profile root 是包含 profile homes 和 active-profile state 的目录。可以按命令覆盖:
anyy --profile-root ~/.anyy-profiles profile list
anyy --profile-root ~/.anyy-profiles profile create lab
环境变量也参与 home resolution:
| 变量 | 用途 |
|---|---|
ANYY_HOME | 选择显式 Anyy home。 |
ANYY_DEFAULT_HOME | 覆盖 setup 和 resolution 使用的默认 home。 |
完整列表见环境变量。
每个 Profile 的 Gateway
每个 profile home 都有自己的 runtime files,包括 gateway socket。为指定 profile 启动或检查 gateway:
anyy --profile work gateway start
anyy --profile work gateway status
TUI 可以为其所选 profile 启动 embedded gateway。Resident gateway commands 管理 resolved home 对应的 background service。
Profile deletion 会检查该 profile 的 gateway 是否仍在运行。删除前先停止:
anyy --profile work gateway stop
anyy profile delete work --force
Deletion guards:
| Guard | 行为 |
|---|---|
| Default profile | 拒绝删除。 |
| Active profile | 拒绝删除,直到切换到另一个 active profile。 |
| Profile gateway 正在运行 | 拒绝删除,直到该 profile gateway 停止。 |
| Profile 包含 secrets | 需要 --purge-secrets。 |
Profile Isolation
Profiles 隔离本地 Anyy 状态。work 中的 session 在 default 中不可见;一个 profile
下保存的 secret 不会从另一个 profile 解析;一个 profile 中配置的 channel 不会自动存在于另一个
profile 中。
隔离边界是 Anyy home directory,而不是操作系统本身。Profile 不是 OS sandbox,workspace/
是 context 和 artifact storage,不是权限边界。该目录的文件权限仍然重要。保护 profile homes
的方式应与保护默认 ~/.anyy 一样。
Roles 作用于 profile 内:
anyy --profile work role list
anyy --profile work role use analyst
改变 role 不会在 profiles 之间移动数据。
Profile 命令
Profile command reference:
anyy profile list [--json]
anyy profile get NAME [--json]
anyy profile create NAME [--display-name NAME] [--json]
anyy profile use NAME [--json]
anyy profile delete NAME --force [--purge-secrets] [--json]
删除需要 --force。只有当你希望删除 profile secret material 时才加 --purge-secrets。
完整 CLI 列表见 CLI 命令。