Skip to content

The agent that grows with you

refactor(onboarding): the setup command spelling lives in agent/onboarding.py

alt-glitch22344cf7b1d7
diff --git a/agent/onboarding.py b/agent/onboarding.py
index c8afe28a0a0..57fb6604560 100644
--- a/agent/onboarding.py
+++ b/agent/onboarding.py
@@ -143,6 +143,14 @@ SETUP_OFFER_NOTE = (
)
+# Telegram commands take no hyphens, and Slack reaches /initiate-setup through /hermes (50-slash cap).
+_SETUP_COMMAND_BY_PLATFORM = {"telegram": "/initiate_setup", "slack": "/hermes initiate-setup"}
+
+
+def setup_command(platform: str) -> str:
+ """How a platform's user types /initiate-setup."""
+ return _SETUP_COMMAND_BY_PLATFORM.get(platform, "/initiate-setup")
+
def first_contact_turn_note(
config: Mapping[str, Any],
config_path: Path,
@@ -241,7 +249,7 @@ def mark_seen(config_path: Path, flag: str) -> bool:
__all__ = [
"BUSY_INPUT_FLAG", "TOOL_PROGRESS_FLAG", "OPENCLAW_RESIDUE_FLAG", "PROFILE_BUILD_FLAG",
- "PLAIN_INTRO_NOTE", "SETUP_OFFER_NOTE", "first_contact_turn_note",
+ "PLAIN_INTRO_NOTE", "SETUP_OFFER_NOTE", "first_contact_turn_note", "setup_command",
"busy_input_hint_gateway", "busy_input_hint_cli", "tool_progress_hint_gateway", "tool_progress_hint_cli",
"openclaw_residue_hint_cli", "detect_openclaw_residue", "profile_build_mode", "profile_build_directive",
"is_seen", "mark_seen",
diff --git a/gateway/run_turn.py b/gateway/run_turn.py
index 7d54902b6eb..654fd590c8c 100644
--- a/gateway/run_turn.py
+++ b/gateway/run_turn.py
@@ -49,8 +49,6 @@ if TYPE_CHECKING: # string annotations only; never imported at runtime (cycle)
logger = logging.getLogger("gateway.run")
_tool_call_logger_lock = threading.Lock()
-# How the first-contact note spells /initiate-setup: Telegram has no hyphens, and Slack reaches it via /hermes.
-_SETUP_COMMAND_SPELLING = {Platform.TELEGRAM: "/initiate_setup", Platform.SLACK: "/hermes initiate-setup"}
def _tool_call_logger() -> logging.Logger:
@@ -1422,11 +1420,11 @@ class GatewayTurnMixin:
if human_platform and source.chat_type == "dm" and not await self.async_session_store.has_any_sessions():
# Same branch logic as the TUI (offer once when "ask", else plain intro);
# first_contact_turn_note already falls back to the plain intro on error.
- from agent.onboarding import first_contact_turn_note
+ from agent.onboarding import first_contact_turn_note, setup_command
note = first_contact_turn_note(
_load_gateway_config(), _gateway_config_home() / "config.yaml",
session_history_empty=True, install_has_prior_sessions=False, message=message,
- command=_SETUP_COMMAND_SPELLING.get(source.platform, "/initiate-setup"))
+ command=setup_command(source.platform.value))
if note:
turn_sidecar_notes.append(note)