Skip to content

Self-improving AI Employees for everyone

feat(nodes/model): chat-model plugins usable as advisor tools + None-safe resolver

trohitg578443b98199
diff --git a/server/nodes/model/anthropic_chat_model/__init__.py b/server/nodes/model/anthropic_chat_model/__init__.py
index e1eb837a..9a8e81c8 100644
--- a/server/nodes/model/anthropic_chat_model/__init__.py
+++ b/server/nodes/model/anthropic_chat_model/__init__.py
@@ -22,8 +22,20 @@ class AnthropicChatModelNode(ChatModelBase):
type = "anthropicChatModel"
display_name = "Claude"
subtitle = "Chat Model"
- group = ("model",)
+ group = ("model", "tool")
description = "Anthropic Claude models for conversation and analysis"
+ usable_as_tool = True
+ tool_name = "anthropic_chat_model"
+ tool_description = (
+ "Consult Anthropic Claude as an advisor — a stronger model the operator wired in "
+ "to guide your reasoning. Call AT THE START of any complex task to plan your approach, "
+ "WHEN STUCK (errors recurring, approach not converging), and BEFORE DECLARING DONE to "
+ "sanity-check completeness. Pose ONE focused question in `prompt` — include the context "
+ "the advisor needs (the advisor cannot see your conversation). Do NOT set `model`, "
+ "`api_key`, `temperature`, or other fields; the operator configured them. Returns brief "
+ "tactical guidance — you do the work."
+ )
+
credentials = (AnthropicCredential,)
Params = AnthropicChatModelParams
diff --git a/server/nodes/model/gemini_chat_model/__init__.py b/server/nodes/model/gemini_chat_model/__init__.py
index deb85e31..d4a6508b 100644
--- a/server/nodes/model/gemini_chat_model/__init__.py
+++ b/server/nodes/model/gemini_chat_model/__init__.py
@@ -23,8 +23,20 @@ class GeminiChatModelNode(ChatModelBase):
type = "geminiChatModel"
display_name = "Gemini"
subtitle = "Chat Model"
- group = ("model",)
+ group = ("model", "tool")
description = "Google Gemini models for multimodal AI capabilities"
+ usable_as_tool = True
+ tool_name = "gemini_chat_model"
+ tool_description = (
+ "Consult Google Gemini as an advisor — a stronger model the operator wired in to guide "
+ "your reasoning. Call AT THE START of any complex task to plan your approach, WHEN "
+ "STUCK (errors recurring, approach not converging), and BEFORE DECLARING DONE to "
+ "sanity-check completeness. Pose ONE focused question in `prompt` — include the context "
+ "the advisor needs (the advisor cannot see your conversation). Do NOT set `model`, "
+ "`api_key`, `temperature`, or other fields; the operator configured them. Returns brief "
+ "tactical guidance — you do the work."
+ )
+
credentials = (GeminiCredential,)
Params = GeminiChatModelParams
diff --git a/server/nodes/model/openai_chat_model/__init__.py b/server/nodes/model/openai_chat_model/__init__.py
index b7beb2cf..c83a0756 100644
--- a/server/nodes/model/openai_chat_model/__init__.py
+++ b/server/nodes/model/openai_chat_model/__init__.py
@@ -32,8 +32,20 @@ class OpenAIChatModelNode(ChatModelBase):
type = "openaiChatModel"
display_name = "OpenAI"
subtitle = "Chat Model"
- group = ("model",)
+ group = ("model", "tool")
description = "OpenAI GPT models for chat completion and generation"
+ usable_as_tool = True
+ tool_name = "openai_chat_model"
+ tool_description = (
+ "Consult OpenAI GPT as an advisor — a stronger model the operator wired in to guide "
+ "your reasoning. Call AT THE START of any complex task to plan your approach, WHEN "
+ "STUCK (errors recurring, approach not converging), and BEFORE DECLARING DONE to "
+ "sanity-check completeness. Pose ONE focused question in `prompt` — include the context "
+ "the advisor needs (the advisor cannot see your conversation). Do NOT set `model`, "
+ "`api_key`, `temperature`, or other fields; the operator configured them. Returns brief "
+ "tactical guidance — you do the work."
+ )
+
credentials = (OpenAICredential,)
Params = OpenAIChatModelParams
diff --git a/server/services/llm/config.py b/server/services/llm/config.py
index 924ce641..a2ef1f2e 100644
--- a/server/services/llm/config.py
+++ b/server/services/llm/config.py
@@ -173,12 +173,21 @@ def resolve_max_tokens(params: dict, model: str, provider: str) -> int:
def resolve_temperature(params: dict, model: str, provider: str, thinking_enabled: bool) -> float:
- """Resolve temperature with model-specific constraints."""
+ """Resolve temperature with model-specific constraints.
+
+ Default sourced from ``llm_defaults.json`` (``agent.default_temperature``)
+ when the caller passes ``None`` or omits the field — chat-model Params
+ declare ``temperature: Optional[float] = None`` so the merge produced by
+ the default tool-execution service can legitimately carry ``None`` here.
+ """
from services.model_registry import get_model_registry
registry = get_model_registry()
- user_temp = float(params.get("temperature", 0.7))
+ user_val = params.get("temperature")
+ if user_val is None:
+ user_val = registry.get_agent_defaults()["default_temperature"]
+ user_temp = float(user_val)
if registry.is_reasoning_model(model, provider):
return 1.0
diff --git a/server/skills/assistant/advisor/SKILL.md b/server/skills/assistant/advisor/SKILL.md
new file mode 100644
index 00000000..ee0cafdd
--- /dev/null
+++ b/server/skills/assistant/advisor/SKILL.md
@@ -0,0 +1,39 @@
+---
+name: advisor
+description: ALWAYS call the wired chat-model tool (anthropic_chat_model / openai_chat_model / gemini_chat_model) at the START of any complex task to get a plan from a stronger model. Also call when stuck and before declaring done. Pass only the `prompt` field — the operator configured `model` and `api_key`. Returns brief tactical advice; you do the work.
+allowed-tools: anthropic_chat_model openai_chat_model gemini_chat_model
+metadata:
+ author: machina
+ version: "1.0"
+ category: general
+---
+
+# Advisor
+
+A chat-model wired as a tool is your **advisor** — a stronger model configured by the operator. Consult it for strategy, not implementation.
+
+## When to call
+
+- **AT TASK START** — before writing, editing, or committing to an interpretation, ask for an approach. Orientation (reading files, fetching sources) is not substantive work; do that first, then call advisor.
+- **WHEN STUCK** — errors recurring, approach not converging, results that don't fit.
+- **BEFORE DECLARING DONE** — sanity-check completeness. Make your deliverable durable first (save the file, commit the change).
+
+On short reactive tasks dictated by tool output you just read, skip subsequent calls — the advisor adds most of its value on the first call, before the approach crystallizes.
+
+## How to call
+
+- One focused question per call. The advisor has no memory of prior calls.
+- Pass your question in `prompt`. **Do NOT set `model` or `api_key`** — the operator configured them.
+- Include relevant context inside `prompt` (what you tried, what you observed). The advisor does not see your tool calls or memory.
+
+## How to treat the response
+
+- Tactical guidance, not a full solution. You do the work.
+- Give the advice serious weight. If a step fails empirically, surface the conflict in a follow-up call ("I tried X, you suggested Y; here's the result — which constraint breaks the tie?").
+- A passing self-test is not evidence the advice is wrong.
+
+## Operator note (configuring the advisor node)
+
+- **Model**: pick the provider's strongest current model. As of May 2026: `claude-opus-4-7`, `gpt-5.5-pro-2026-04-23`, `gemini-3.1-pro-preview`.
+- **System prompt** (optional): "You are an advisor. Brief tactical guidance only — identify pitfalls, suggest changes, validate the plan. Do NOT write full solutions."
+- **Cost**: advisor models are 3-10× the executor's per-token cost. Use sparingly.
diff --git a/server/skills/assistant/assistant-personality/SKILL.md b/server/skills/assistant/assistant-personality/SKILL.md
index cf9b5543..ef622f0b 100644
--- a/server/skills/assistant/assistant-personality/SKILL.md
+++ b/server/skills/assistant/assistant-personality/SKILL.md
@@ -31,6 +31,10 @@ When a request involves **3 or more steps**, use the `write_todos` tool to plan
For simple requests (1-2 steps), skip the todo list and respond directly.
+## Advisor
+
+If a chat-model is wired as a tool (`anthropic_chat_model` / `openai_chat_model` / `gemini_chat_model`), it's a stronger advisor model. Call it at the start of any complex task for a plan, when stuck, and before declaring done. Pass only `prompt`; the operator configured `model` and `api_key`. See the `advisor` skill for the full playbook.
+
## Communication Style
- Be concise but thorough
diff --git a/server/tests/fixtures/tool_names_snapshot.json b/server/tests/fixtures/tool_names_snapshot.json
index fc2de830..3aa05f7c 100644
--- a/server/tests/fixtures/tool_names_snapshot.json
+++ b/server/tests/fixtures/tool_names_snapshot.json
@@ -74,5 +74,8 @@
"twitterSend": "twitter_send",
"twitterSearch": "twitter_search",
"twitterUser": "twitter_user",
- "httpRequest": "http_request"
+ "httpRequest": "http_request",
+ "anthropicChatModel": "anthropic_chat_model",
+ "openaiChatModel": "openai_chat_model",
+ "geminiChatModel": "gemini_chat_model"
}
diff --git a/server/tests/test_chat_model_dual_purpose.py b/server/tests/test_chat_model_dual_purpose.py
new file mode 100644
index 00000000..1de0fdea
--- /dev/null
+++ b/server/tests/test_chat_model_dual_purpose.py
@@ -0,0 +1,122 @@
+"""Locks the chat-model dual-purpose scope per the advisor-strategy plan.
+
+Exactly three chat-model plugins (anthropic / openai / gemini) are wired
+as standard dual-purpose tools. The other 8 chat-model plugins (groq /
+cerebras / deepseek / kimi / mistral / openrouter / xai / ollama / lmstudio)
+remain single-purpose. Adding usable_as_tool=True to one of the latter
+without explicit plan approval should fail this test.
+"""
+
+from __future__ import annotations
+
+
+def _all_chat_model_classes():
+ """All ChatModelBase subclasses, sourced from the live plugin registry."""
+ import nodes # noqa: F401 (populate registry)
+ from services.node_registry import registered_node_classes
+ from nodes.model._base import ChatModelBase
+
+ return [
+ cls
+ for cls in registered_node_classes().values()
+ if isinstance(cls, type)
+ and issubclass(cls, ChatModelBase)
+ and cls is not ChatModelBase
+ ]
+
+
+_ADVISOR_SUPPORTED = frozenset(
+ {"anthropicChatModel", "openaiChatModel", "geminiChatModel"}
+)
+
+
+class TestAdvisorChatModelScope:
+ """The dual-purpose marker is set on exactly the three supported plugins."""
+
+ def test_supported_plugins_are_tool_eligible(self):
+ by_type = {cls.type: cls for cls in _all_chat_model_classes()}
+ for node_type in _ADVISOR_SUPPORTED:
+ cls = by_type.get(node_type)
+ assert cls is not None, f"Expected chat-model plugin {node_type!r} not in registry"
+ assert cls.usable_as_tool is True, (
+ f"{cls.__qualname__} must set usable_as_tool=True per the advisor plan"
+ )
+ assert "tool" in cls.group, (
+ f"{cls.__qualname__}.group must contain 'tool' "
+ f"(found {cls.group!r}) for palette + dual-purpose dispatch"
+ )
+
+ def test_other_chat_models_are_not_tool_eligible(self):
+ """Lock the V1 scope: the other 8 chat-models stay single-purpose."""
+ for cls in _all_chat_model_classes():
+ if cls.type in _ADVISOR_SUPPORTED:
+ continue
+ assert cls.usable_as_tool is False, (
+ f"{cls.__qualname__} (type={cls.type!r}) sets usable_as_tool=True "
+ f"but is not in the advisor-strategy supported list "
+ f"{sorted(_ADVISOR_SUPPORTED)}. Update the plan + this test together."
+ )
+ assert "tool" not in cls.group, (
+ f"{cls.__qualname__} (type={cls.type!r}) has 'tool' in group "
+ f"but is not in the supported list. Same scope rule applies."
+ )
+
+
+class TestAdvisorToolNames:
+ """The supported plugins use the snake_case-of-type convention per GUIDE.md."""
+
+ EXPECTED = {
+ "anthropicChatModel": "anthropic_chat_model",
+ "openaiChatModel": "openai_chat_model",
+ "geminiChatModel": "gemini_chat_model",
+ }
+
+ def test_tool_names_match_snake_case_convention(self):
+ by_type = {cls.type: cls for cls in _all_chat_model_classes()}
+ for node_type, expected_tool_name in self.EXPECTED.items():
+ cls = by_type[node_type]
+ assert cls.tool_name == expected_tool_name, (
+ f"{cls.__qualname__}.tool_name = {cls.tool_name!r} "
+ f"but expected {expected_tool_name!r} (snake_case of type)"
+ )
+
+
+class TestAdvisorSkillShipped:
+ """The advisor skill must be shipped on disk and discoverable."""
+
+ def test_advisor_skill_exists_on_disk(self):
+ from pathlib import Path
+
+ skill_md = (
+ Path(__file__).parent.parent
+ / "skills"
+ / "assistant"
+ / "advisor"
+ / "SKILL.md"
+ )
+ assert skill_md.is_file(), (
+ f"Advisor skill missing at {skill_md}. "
+ "Ship server/skills/assistant/advisor/SKILL.md per the advisor plan."
+ )
+
+ def test_advisor_skill_lists_supported_tools(self):
+ """`allowed-tools` frontmatter mirrors the supported plugins."""
+ from pathlib import Path
+ import re
+
+ skill_md = (
+ Path(__file__).parent.parent
+ / "skills"
+ / "assistant"
+ / "advisor"
+ / "SKILL.md"
+ )
+ text = skill_md.read_text(encoding="utf-8")
+ match = re.search(r"^allowed-tools:\s*(.+)$", text, re.MULTILINE)
+ assert match, "Advisor SKILL.md must declare an `allowed-tools` frontmatter line"
+ listed = set(match.group(1).strip().split())
+ for tool_name in TestAdvisorToolNames.EXPECTED.values():
+ assert tool_name in listed, (
+ f"Advisor SKILL.md `allowed-tools` is missing {tool_name!r}; "
+ f"found {sorted(listed)}. Keep in sync with the supported plugins."
+ )