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.

fix(prompt): keep platform hint without user id

cyh68f881199629
diff --git a/core/system_prompt_injection.py b/core/system_prompt_injection.py
index 462f6821f..20d4d591f 100644
--- a/core/system_prompt_injection.py
+++ b/core/system_prompt_injection.py
@@ -102,7 +102,8 @@ Use this file proactively when it is helpful, especially when it can help you un
You do not need to read it for every simple request; but if consulting it could improve personalization, efficiency, or continuity, prefer checking it early.
-You may also update it when explicitly asked. Use the platform and user id from the current message metadata to choose the appropriate user section.
+You may also update it when explicitly asked.
+Use the current platform `{platform}` and the user id from the current message metadata to choose the appropriate user section: `{platform}/<user_id>`.
Only record durable, factual, reusable information there.
Keep entries short, deduplicated, and free of secrets unless the user explicitly asks.
"""
@@ -121,8 +122,13 @@ def _build_user_preferences_prompt(
*,
fallback_platform: Optional[str] = None,
) -> str:
+ platform = fallback_platform or "<platform>"
+ if context is not None:
+ platform_specific = context.platform_specific or {}
+ platform = context.platform or platform_specific.get("platform") or fallback_platform or "<platform>"
return _USER_PREFERENCES_PROMPT.format(
preferences_path=f"`{paths.get_user_preferences_path()}`",
+ platform=platform,
)
diff --git a/tests/test_claude_cli_path.py b/tests/test_claude_cli_path.py
index 9f2dbc679..dd28de0d7 100644
--- a/tests/test_claude_cli_path.py
+++ b/tests/test_claude_cli_path.py
@@ -335,7 +335,8 @@ def test_session_handler_reuses_cached_claude_client_when_system_prompt_is_uncha
assert first_client.disconnects == 0
assert len(captured["clients"]) == 1
assert controller.claude_sessions[composite_key] is first_client
- assert "Use the platform and user id from the current message metadata" in first_client.options.system_prompt["append"]
+ assert "Use the current platform `slack`" in first_client.options.system_prompt["append"]
+ assert "`slack/<user_id>`" in first_client.options.system_prompt["append"]
assert "slack/U123" not in first_client.options.system_prompt["append"]
assert "slack/U456" not in first_client.options.system_prompt["append"]
diff --git a/tests/test_reply_enhancer_platform.py b/tests/test_reply_enhancer_platform.py
index 2ca47f863..c0475cfb1 100644
--- a/tests/test_reply_enhancer_platform.py
+++ b/tests/test_reply_enhancer_platform.py
@@ -90,8 +90,8 @@ class ReplyEnhancerPlatformTests(unittest.IsolatedAsyncioTestCase):
self.assertNotIn("## 2. Quick-reply buttons", prompt)
self.assertIn("## 4. User Context and Preferences", prompt)
self.assertIn("`/tmp/user_preferences.md`", prompt)
- self.assertIn("Use the platform and user id from the current message metadata", prompt)
- self.assertNotIn("<platform>/<user_id>", prompt)
+ self.assertIn("Use the current platform `<platform>`", prompt)
+ self.assertIn("`<platform>/<user_id>`", prompt)
def test_prompt_can_include_codex_generated_image_instructions(self):
with (
@@ -238,7 +238,8 @@ class ReplyEnhancerPlatformTests(unittest.IsolatedAsyncioTestCase):
self.assertIn("From first principles, serving the user better means thinking proactively about how to make full use of the available context", prompt)
self.assertIn("Use this file proactively when it is helpful", prompt)
self.assertIn("You do not need to read it for every simple request; but if consulting it could improve personalization, efficiency, or continuity, prefer checking it early.", prompt)
- self.assertIn("Use the platform and user id from the current message metadata", prompt)
+ self.assertIn("Use the current platform `slack`", prompt)
+ self.assertIn("`slack/<user_id>`", prompt)
self.assertNotIn("slack/U1", prompt)
self.assertIn("Only record durable, factual, reusable information there.", prompt)
self.assertIn("Keep entries short, deduplicated, and free of secrets unless the user explicitly asks.", prompt)
@@ -262,7 +263,8 @@ class ReplyEnhancerPlatformTests(unittest.IsolatedAsyncioTestCase):
self.assertIn("do not guess a target", prompt)
self.assertNotIn("Legacy session key:", prompt)
self.assertNotIn("Channel-level session key:", prompt)
- self.assertIn("Use the platform and user id from the current message metadata", prompt)
+ self.assertIn("Use the current platform `slack`", prompt)
+ self.assertIn("`slack/<user_id>`", prompt)
self.assertNotIn("slack/U1", prompt)
def test_prompt_handles_missing_platform_specific(self):
@@ -280,7 +282,8 @@ class ReplyEnhancerPlatformTests(unittest.IsolatedAsyncioTestCase):
fallback_platform="slack",
)
- self.assertIn("Use the platform and user id from the current message metadata", prompt)
+ self.assertIn("Use the current platform `slack`", prompt)
+ self.assertIn("`slack/<user_id>`", prompt)
self.assertNotIn("slack/U1", prompt)
def test_file_links_with_parentheses_are_preserved(self):