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.
Python agentagent-osaiai-agentsai-partnerchatopsclaudeclaude-codecodexdevtoolsdiscord-botlark-botllmlocal-firstlong-term-memoryopencodeslack-botvibe-codingvibeywechat
feat(vibey): the built-in Agent knows it is Vibey (#2432)
Call White8a2caae4375b
diff --git a/modules/agents/vibey/agent.py b/modules/agents/vibey/agent.pyindex 7a15c89fc..2e5f2880a 100644--- a/modules/agents/vibey/agent.py+++ b/modules/agents/vibey/agent.py@@ -274,8 +274,9 @@ class VibeyAgent(BaseAgent):if turn.stop_requested:return await self._settle_stopped(turn)sections, skill_catalog = await self._avibe_sections(request, cwd)+ builtin_agent = await asyncio.to_thread(self._is_builtin_agent, request)environment = await asyncio.to_thread(self._turn_environment, request, cwd)- self._start_agent(turn, cwd, sections, environment)+ self._start_agent(turn, cwd, sections, environment, builtin_agent=builtin_agent)runtime.cwd = cwd# Prepared before anything is dispatched (``core.native_dispatch_phase``).message = await self._render_input(session_id, request.message, request.files, request.input_metadata)@@ -526,7 +527,9 @@ class VibeyAgent(BaseAgent):return HubModelRouter(resolve, self._providers, first=await resolve())- def _start_agent(self, turn: _Run, cwd: str, sections: str, environment: Mapping[str, str]) -> None:+ def _start_agent(+ self, turn: _Run, cwd: str, sections: str, environment: Mapping[str, str], *, builtin_agent: bool+ ) -> None:"""The Turn's loop, over its router, tools, system prompt, and the environment its commands run in.The bash rule names ``rg`` only when that environment's PATH finds it. That PATH is the service's@@ -553,7 +556,9 @@ class VibeyAgent(BaseAgent):tools = mark_skill_loads(tuple(suite.create_tools(agent.jobs, self.media.image_sink(session_id))))agent.set_tools(tools)finds_rg = shutil.which("rg", path=environment.get("PATH", "")) is not None- agent.system = system_prompt([tool.spec.name for tool in tools], sections, rg=finds_rg)+ agent.system = system_prompt(+ [tool.spec.name for tool in tools], sections, builtin_agent=builtin_agent, rg=finds_rg+ )turn.agent, turn.cwd = agent, cwdasync def _on_event(self, run: _Run, event: AgentEvent) -> None:@@ -991,6 +996,19 @@ class VibeyAgent(BaseAgent):sections = await asyncio.to_thread(build)return sections, (skill_catalog_sink[0] if skill_catalog_sink else None)+ def _is_builtin_agent(self, request: AgentRequest) -> bool:+ """Whether the Turn runs as the backend's built-in Agent, the one the system prompt names Vibey.++ Read from the Agent record (the store's one owner of built-in identity), never from a name, so every Turn a+ Session runs as that Agent gets the same preamble and no other Agent is told it is Vibey. A Turn with no+ Agent record gets the neutral preamble.+ """+ store = getattr(self.controller, "vibe_agent_store", None)+ if store is None or not request.vibe_agent_id:+ return False+ builtin = store.get_builtin_default_agent_for_backend(BACKEND, enabled_only=False)+ return builtin is not None and builtin.id == request.vibe_agent_id+def _turn_environment(self, request: AgentRequest, cwd: str) -> dict[str, str]:"""The environment a Turn's commands run in, from the owners the other backends' shells use.diff --git a/modules/agents/vibey/prompt.py b/modules/agents/vibey/prompt.pyindex a48d29767..a59dfbfab 100644--- a/modules/agents/vibey/prompt.py+++ b/modules/agents/vibey/prompt.py@@ -1,16 +1,21 @@"""Vibey's system prompt and the environment block of each consumed input.-The system prompt is stable so providers can cache it: Pi's coding-agent framing-and tool snippets, then Avibe's injected sections. Facts that change (cwd, date,-live Watches) travel in an ``<environment>`` block rendered into each consumed-input instead (C-7 tools.md section 8), so the stored transcript is what the-model saw.--Preamble, tool snippets, and rules ported from Pi (MIT, Copyright (c) 2025 Mario-Zechner), ``packages/coding-agent/src/core/system-prompt.ts`` and+The system prompt is stable so providers can cache it: who the Agent is, Pi's+tool snippets and rules, then Avibe's injected sections. Who the Agent is comes+from its record, so it is the same on every Turn the Session runs as that Agent.+Facts that change (cwd, date, live Watches) travel in an ``<environment>`` block+rendered into each consumed input instead (C-7 tools.md section 8), so the+stored transcript is what the model saw.++Tool snippets and rules ported from Pi (MIT, Copyright (c) 2025 Mario Zechner),+``packages/coding-agent/src/core/system-prompt.ts`` and``packages/coding-agent/src/core/tools/{read,write,edit,bash}.ts`` at ``7fbbd5f``;-Pi-specific lines (its docs, ``PI_*`` variables) are left out. ``FINAL_REPLY_RULE`` is-Avibe's: text between tool calls reaches the user only above the shared interim+Pi-specific lines (its docs, ``PI_*`` variables) are left out. Avibe's deviations:+the preamble (owner product decision, 2026-10-10) replaces Pi's coding-assistant+framing. The backend's built-in Agent is Vibey, Avibe's own agent+(``VIBEY_PREAMBLE``); any other Agent on the backend gets ``AGENT_PREAMBLE``, and its+own definition, in the Avibe sections, says who it is. ``FINAL_REPLY_RULE`` is+Avibe's too: text between tool calls reaches the user only above the shared interimthreshold (``ConsolidatedMessageDispatcher._is_interim_worthy``)."""@@ -29,10 +34,12 @@ from core.agent_core.harness.context import display, escapefrom core.agent_core.harness.store import ContextEntryfrom core.agent_core.messages import TextBlock, UserMessage-PREAMBLE = (- "You are an expert coding assistant operating inside Avibe, a local-first agent runtime. You help users by "- "reading files, executing commands, editing code, and writing new files."+VIBEY_PREAMBLE = (+ "You are Vibey, the official agent of Avibe, a local-first Agent OS that runs on the user's own machine. You help "+ "the user with whatever they are working on: you read files, run commands, edit and write files, and coordinate "+ "work through Avibe.")+AGENT_PREAMBLE = "You are an agent running inside Avibe, a local-first Agent OS on the user's machine."TOOL_SNIPPETS: dict[str, str] = {"read": "Read file contents","bash": "Execute bash commands (ls, grep, find, etc.)",@@ -69,8 +76,13 @@ FORK_HISTORY = "the conversation above is that Session's history through contextFORK_NO_HISTORY = "it starts empty, before that Session's first finished Turn, so no history is inherited"-def coding_prompt(tool_names: Iterable[str], *, rg: bool) -> str:- """Pi's preamble, tool list, and rules for the tools actually offered.+def preamble(builtin_agent: bool) -> str:+ """Who the Agent is: Vibey for the backend's built-in Agent, else a neutral line its own definition completes."""+ return VIBEY_PREAMBLE if builtin_agent else AGENT_PREAMBLE+++def coding_prompt(tool_names: Iterable[str], *, builtin_agent: bool, rg: bool) -> str:+ """The Agent's preamble, then Pi's tool list and rules for the tools actually offered.``rg`` is whether the Session's commands find ripgrep; the bash rule names it only then, and ``grep`` otherwise."""@@ -87,15 +99,16 @@ def coding_prompt(tool_names: Iterable[str], *, rg: bool) -> str:rules += ["Be concise in your responses", "Show file paths clearly when working with files", FINAL_REPLY_RULE]return "\n\n".join((- PREAMBLE,+ preamble(builtin_agent),f"Available tools:\n{tools}","Guidelines:\n" + "\n".join(f"- {rule}" for rule in rules),))-def system_prompt(tool_names: Iterable[str], avibe_sections: str, *, rg: bool) -> str:- return "\n\n".join(part for part in (coding_prompt(tool_names, rg=rg), avibe_sections.strip()) if part)+def system_prompt(tool_names: Iterable[str], avibe_sections: str, *, builtin_agent: bool, rg: bool) -> str:+ head = coding_prompt(tool_names, builtin_agent=builtin_agent, rg=rg)+ return "\n\n".join(part for part in (head, avibe_sections.strip()) if part)# --- environment block ---------------------------------------------------------diff --git a/tests/test_vibey_agent.py b/tests/test_vibey_agent.pyindex 07ac36f90..4281852b8 100644--- a/tests/test_vibey_agent.py+++ b/tests/test_vibey_agent.py@@ -1526,6 +1526,66 @@ async def test_the_bash_rule_names_rg_only_when_the_turns_commands_find_it(assert ("- Use bash for file operations like ls, grep, find" in system) is not finds_rg+def _agent_store(engine):+ from core.vibe_agents import VibeAgentStore++ store = VibeAgentStore(Path(engine.url.database))+ store.ensure_builtin_default_agents([])+ return store+++def _as_agent(request: AgentRequest, agent) -> AgentRequest:+ """``request`` running as ``agent``, as the message handler resolves the Session's Agent."""+ request.vibe_agent_id, request.vibe_agent_name = agent.id, agent.name+ request.vibe_agent_system_prompt = agent.system_prompt+ return request+++async def test_the_built_in_agent_knows_it_is_vibey_on_every_turn(engine, session, tmp_path, published) -> None:+ # Owner decision (2026-10-10): the backend's built-in Agent is Vibey. Its preamble comes from the Agent record, so+ # the Session's system prompt is the same on every Turn, which keeps the provider's cache.+ from modules.agents.vibey.prompt import CONCURRENT_CALLS_RULE++ store = _agent_store(engine)+ vibey = store.get_builtin_default_agent_for_backend("vibey", enabled_only=False)+ harness = _Harness(+ engine, tmp_path, "avibe", [[Done(assistant("ok"))], [Done(assistant("again"))]],+ tools=[FakeTool("read"), FakeTool("bash")],+ )+ harness.controller.vibe_agent_store = store++ await harness.agent.handle_message(_as_agent(harness.request("who are you?"), vibey))+ await harness.agent.handle_message(_as_agent(harness.request("and now?"), vibey))++ first, second = (request.system for request in harness.provider.requests)+ head = first.split("\n\nAvailable tools:", 1)[0]+ # The owner's wording, stated here rather than read from the constant it checks.+ assert head.startswith("You are Vibey, the official agent of Avibe, a local-first Agent OS")+ assert "expert coding assistant" not in first and f"- {CONCURRENT_CALLS_RULE}" in first+ assert second == first+++async def test_another_agent_on_the_backend_is_not_told_it_is_vibey(engine, session, tmp_path, published) -> None:+ # Its own definition says who it is; the preamble only places it in Avibe. The roster of Agents may still list+ # the built-in one by name, which is not an identity.+ from modules.agents.vibey.prompt import CONCURRENT_CALLS_RULE++ store = _agent_store(engine)+ reviewer = store.create(name="reviewer", backend="vibey", system_prompt="You are Rex, a careful code reviewer.")+ harness = _Harness(+ engine, tmp_path, "avibe", [[Done(assistant("ok"))]], tools=[FakeTool("read"), FakeTool("bash")]+ )+ harness.controller.vibe_agent_store = store++ await harness.agent.handle_message(_as_agent(harness.request("who are you?"), reviewer))++ system = harness.provider.requests[0].system+ head = system.split("\n\nAvailable tools:", 1)[0]+ assert head == "You are an agent running inside Avibe, a local-first Agent OS on the user's machine."+ assert "You are Vibey" not in system and "expert coding assistant" not in system+ assert "You are Rex, a careful code reviewer." in system and f"- {CONCURRENT_CALLS_RULE}" in system++async def test_the_system_prompt_offers_no_computer_use_it_cannot_call(engine, session, tmp_path, published, monkeypatch) -> None: