Skip to content

armgit / avibe

Public Imported from GitHub
0

Make your computer a home for your AI partner. Avibe is the local-first Agent OS: Vibey, its built-in AI partner, works out of the box, and Claude Code, Codex & OpenCode run unchanged beside it — reach them from your browser, phone, or any chat app.

8.5 KB
Raw Blame

Channels, Users, and Routing

Changing one scope

PATCH /api/settings/scope changes only the fields it names on one channel, Telegram topic, or bound DM user. Use it for every single-scope edit:

{
  "platform": "slack",
  "scope": "channel",
  "id": "C123",
  "changes": {
    "enabled": true,
    "routing": {"agent_name": "codex", "model": "gpt-5.4", "reasoning_effort": "high"}
  },
  "expected_agent_name": "<the scope's current expected_agent_name>"
}
  • scope is channel, thread (Telegram topics only; add "thread_id"), or user (the user must already be bound).
  • Channels and topics take enabled, show_message_types, custom_cwd, require_mention, require_bind, routing; users take display_name, enabled, show_message_types, custom_cwd, routing. Admin rights keep POST /api/users/<user_id>/admin.
  • routing merges key by key into the stored route. A request with routing must carry expected_agent_name: copy it from the scope's latest read (null for a scope inheriting the default Agent). If another writer changed the scope's Agent since, the request fails with settings_conflict (409); read again and retry.
  • The response's settings is the stored row; verify from it.

Channel settings

  • GET /api/settings?platform=<platform>
    • returns channel settings, user settings, and bind codes for one platform
  • POST /api/settings
    • payload: {"platform": "<platform>", "channels": {...}}
    • replaces the entire channels map for that platform; keep it for bulk imports and use PATCH /api/settings/scope for anything else

Channel entry shape:

{
  "enabled": true,
  "show_message_types": ["assistant"],
  "custom_cwd": "/path/to/repo",
  "require_mention": null,
  "require_bind": null,
  "routing": {
    "agent_name": "codex",
    "model": "gpt-5.4",
    "reasoning_effort": "high",
    "opencode_agent": null,
    "claude_agent": null,
    "codex_agent": "reviewer"
  },
  "expected_agent_name": "codex"
}

Field meanings:

  • enabled: whether this channel is allowed to use Avibe
  • show_message_types: visible intermediate messages; allowed values are system, assistant, toolcall
  • custom_cwd: scope-level working directory override; empty string or null means use global default
  • require_mention: null inherits the platform default, true requires mention, false disables mention gating for that channel
  • require_bind: null/false lets any channel member use the bot (current default); true gates the channel to bound users only — messages from unbound senders are silently ignored (no denial reply), while the bot's own replies stay visible to everyone. Enforced in the shared auth pipeline, so it applies on every platform. Bind is platform-wide, so require_bind means "is this sender a bound user", not a per-channel allowlist.
  • routing.agent_name: Vibe Agent name for this scope, or null to inherit the default Agent
  • routing.model: scope-level model override for the selected Agent; null uses the Agent's own model
  • routing.reasoning_effort: scope-level reasoning override for the selected Agent; null uses the Agent's own
  • routing.<backend>_agent: the native subagent that backend runs for this scope
  • expected_agent_name (read-only): the Agent this view of the route is based on; send it back with routing changes
  • Older releases also used routing.<backend>_model / routing.<backend>_reasoning_effort. They are retired: never returned or stored, and only read to fill an unset model / reasoning_effort on that built-in backend's route. Do not send them.

DM users and bind codes

  • GET /api/users?platform=<platform>
    • returns bound DM users for one platform
  • POST /api/users
    • payload: {"platform": "<platform>", "users": {...}}
    • writes each included user as a whole row and keeps the others; use PATCH /api/settings/scope with "scope": "user" to change a user's fields
  • POST /api/users/<user_id>/admin
    • payload: {"platform": "<platform>", "is_admin": true}
  • DELETE /api/users/<user_id>?platform=<platform>
    • removes a bound user; this is the reliable way to revoke DM access
  • GET /api/bind-codes
    • returns all bind codes
  • POST /api/bind-codes
    • payload: {"type": "one_time"} or {"type": "expiring", "expires_at": "2026-04-18"}
  • DELETE /api/bind-codes/<code>
    • deactivates a bind code
  • GET /api/setup/first-bind-code
    • returns an existing valid setup bind code or creates a new one-time code

Change a user's routing, cwd, visibility, or enabled flag with PATCH /api/settings/scope ("scope": "user"); POST /api/users is not a field patch.

User entry shape:

{
  "display_name": "Alice",
  "is_admin": false,
  "bound_at": "2026-03-20T12:34:56+00:00",
  "enabled": true,
  "show_message_types": ["assistant"],
  "custom_cwd": "/path/to/repo",
  "routing": {
    "agent_name": "claude",
    "model": "claude-sonnet-4-6",
    "reasoning_effort": "high",
    "opencode_agent": null,
    "claude_agent": "reviewer",
    "codex_agent": null
  },
  "expected_agent_name": "claude"
}

DM caveat: current DM authorization checks whether the user is bound, not whether enabled is true. If the user wants to revoke DM access, use DELETE /api/users/<user_id>?platform=<platform> instead of only setting enabled to false.

Scope and Precedence Rules

Agent selection

Agent resolution priority is:

  1. existing Agent Session backend snapshot, when the message belongs to an existing session/thread
  2. scope-level routing.agent_name of the channel, topic, or DM user, for new sessions
  3. global default Vibe Agent from the Agent catalog
  4. registered backend compatibility fallback, only when no enabled default Agent is available

If the user names a specific channel or DM and wants a specific Agent, use the scope API, not global /api/config. New routing is Agent-based.

Working directory

Working directory resolution is:

  1. custom_cwd on the target channel or user scope
  2. runtime.default_cwd from /api/config

Message visibility

show_message_types is scope-local. Preserve existing values unless the user wants an explicit replacement.

If a user asks for "vault messages", "internal messages", or "tool execution messages", map that request to show_message_types. Current Avibe does not expose a separate vault field.

Mention policy

require_mention works like this:

  • null: inherit platform default from /api/config
  • true: require mention in that channel
  • false: do not require mention in that channel

Recipes

Route one Slack channel to Codex

Goal:

  • enable Slack channel C123
  • route it to Codex
  • use Codex subagent reviewer
  • use model gpt-5.4
  • set reasoning high

API flow:

  1. GET /api/settings?platform=slack and note channels.C123.expected_agent_name (null when the channel has no row yet)
  2. PATCH /api/settings/scope with that expected_agent_name:
{
  "platform": "slack",
  "scope": "channel",
  "id": "C123",
  "changes": {
    "enabled": true,
    "routing": {
      "agent_name": "codex",
      "codex_agent": "reviewer",
      "model": "gpt-5.4",
      "reasoning_effort": "high"
    }
  },
  "expected_agent_name": null
}
  1. verify the response's settings.routing

Route one channel to OpenCode with a subagent

Use PATCH /api/settings/scope and set:

  • routing.agent_name = "opencode"
  • routing.opencode_agent = "<agent>"
  • routing.model = "<model>" if requested
  • routing.reasoning_effort = "<effort>" if requested

If the user wants OpenCode-native defaults, providers, MCP servers, skills, plugins, or API credentials, use OpenCode config instead of Avibe scope routing.

Route one scope to Claude with model and reasoning

Use PATCH /api/settings/scope ("scope": "channel" or "user") and set:

  • routing.agent_name = "claude"
  • routing.claude_agent = "<agent>" if requested
  • routing.model = "<model>"
  • routing.reasoning_effort = "<effort>"

The API normalizes Claude reasoning for incompatible model combinations; verify by reading back the saved payload.

Show tool execution messages in one channel

Use PATCH /api/settings/scope with the target channel's show_message_types plus toolcall.

Preserve existing system and assistant values unless the user asked for a full replacement.

Generate a DM bind code

Use POST /api/bind-codes:

{
  "type": "one_time"
}

For an expiring code:

{
  "type": "expiring",
  "expires_at": "2026-04-18"
}

Do not expose bind codes unless the user explicitly asks for them.