diff --git a/tools/kanban_tools.py b/tools/kanban_tools.py index de5d180c83..d0023a3078 100644 --- a/tools/kanban_tools.py +++ b/tools/kanban_tools.py @@ -40,13 +40,31 @@ logger = logging.getLogger(__name__) # --------------------------------------------------------------------------- def _check_kanban_mode() -> bool: - """Tools are available iff the current process has ``HERMES_KANBAN_TASK`` - set in its env, which the dispatcher sets when spawning a worker. + """Tools are available when: - Humans running ``hermes chat`` see zero kanban tools. Workers spawned - by the kanban dispatcher (gateway-embedded by default) see all seven. + 1. ``HERMES_KANBAN_TASK`` is set (dispatcher-spawned worker), OR + 2. The current profile has ``kanban`` in its toolsets config + (orchestrator profiles like techlead that route work via Kanban). + + Humans running ``hermes chat`` without the kanban toolset see zero + kanban tools. Workers spawned by the kanban dispatcher (gateway- + embedded by default) and orchestrator profiles with the kanban + toolset enabled see all seven. """ - return bool(os.environ.get("HERMES_KANBAN_TASK")) + if os.environ.get("HERMES_KANBAN_TASK"): + return True + + # Check if the current profile has the kanban toolset enabled. + # Uses load_config() which has mtime-based caching, so this adds + # negligible overhead. The check_fn results are further TTL-cached + # (~30s) by the tool registry. + try: + from hermes_cli.config import load_config + cfg = load_config() + toolsets = cfg.get("toolsets", []) + return "kanban" in toolsets + except Exception: + return False # ---------------------------------------------------------------------------