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): avoid user id in preferences instructions

cyh5edcb9c01d7a
diff --git a/core/system_prompt_injection.py b/core/system_prompt_injection.py
index 0912ca428..462f6821f 100644
--- a/core/system_prompt_injection.py
+++ b/core/system_prompt_injection.py
@@ -102,7 +102,7 @@ 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, usually in the current user's section: `{user_section}`.
+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.
Only record durable, factual, reusable information there.
Keep entries short, deduplicated, and free of secrets unless the user explicitly asks.
"""
@@ -121,16 +121,8 @@ def _build_user_preferences_prompt(
*,
fallback_platform: Optional[str] = None,
) -> str:
- platform = fallback_platform
- user_id = "<user_id>"
- if context is not None:
- platform_specific = context.platform_specific or {}
- platform = context.platform or platform_specific.get("platform") or fallback_platform
- user_id = context.user_id or "<user_id>"
- user_section = f"{platform or '<platform>'}/{user_id}"
return _USER_PREFERENCES_PROMPT.format(
preferences_path=f"`{paths.get_user_preferences_path()}`",
- user_section=user_section,
)
diff --git a/tests/test_claude_cli_path.py b/tests/test_claude_cli_path.py
index c18f74160..fed2fb861 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_only_speaker_changes(
assert first_client.disconnects == 0
assert len(captured["clients"]) == 1
assert controller.claude_sessions[composite_key] is first_client
- assert "usually in the current user's section: `slack/U123`" in first_client.options.system_prompt["append"]
+ assert "Use the platform and user id from the current message metadata" 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 7c0930d61..2ca47f863 100644
--- a/tests/test_reply_enhancer_platform.py
+++ b/tests/test_reply_enhancer_platform.py
@@ -90,7 +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("`<platform>/<user_id>`", prompt)
+ self.assertIn("Use the platform and user id from the current message metadata", prompt)
+ self.assertNotIn("<platform>/<user_id>", prompt)
def test_prompt_can_include_codex_generated_image_instructions(self):
with (
@@ -237,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("usually in the current user's section: `slack/U1`.", prompt)
+ self.assertIn("Use the platform and user id from the current message metadata", 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)
@@ -260,7 +262,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("usually in the current user's section: `slack/U1`.", prompt)
+ self.assertIn("Use the platform and user id from the current message metadata", prompt)
+ self.assertNotIn("slack/U1", prompt)
def test_prompt_handles_missing_platform_specific(self):
context = MessageContext(
@@ -277,7 +280,8 @@ class ReplyEnhancerPlatformTests(unittest.IsolatedAsyncioTestCase):
fallback_platform="slack",
)
- self.assertIn("usually in the current user's section: `slack/U1`.", prompt)
+ self.assertIn("Use the platform and user id from the current message metadata", prompt)
+ self.assertNotIn("slack/U1", prompt)
def test_file_links_with_parentheses_are_preserved(self):
enhanced = process_reply("![video](file:///Users/test/SaveTwitter.Net_GABV3XNWYAARAZz(gif).mp4)")