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.

feat(prompt): add user preference file guidance

cyh7400eb22f440
diff --git a/config/paths.py b/config/paths.py
index 90dd3ab33..23356c828 100644
--- a/config/paths.py
+++ b/config/paths.py
@@ -57,9 +57,36 @@ def get_sessions_path() -> Path:
return get_state_dir() / "sessions.json"
+def get_user_preferences_path() -> Path:
+ return get_state_dir() / "user_preferences.md"
+
+
+_USER_PREFERENCES_TEMPLATE = """# User Preferences
+
+Use this file for stable user-specific habits, preferences, and recurring rules.
+Keep it concise, factual, and deduplicated.
+Do not store secrets here unless the user explicitly asks.
+
+## Communication
+- Add stable communication preferences here.
+
+## Engineering Habits
+- Add stable workflow preferences here.
+
+## Project Rules
+- Add recurring project or repo rules here.
+
+## Avoid
+- Add stable things to avoid here.
+"""
+
+
def ensure_data_dirs() -> None:
get_config_dir().mkdir(parents=True, exist_ok=True)
get_state_dir().mkdir(parents=True, exist_ok=True)
get_logs_dir().mkdir(parents=True, exist_ok=True)
get_runtime_dir().mkdir(parents=True, exist_ok=True)
get_attachments_dir().mkdir(parents=True, exist_ok=True)
+ preferences_path = get_user_preferences_path()
+ if not preferences_path.exists():
+ preferences_path.write_text(_USER_PREFERENCES_TEMPLATE, encoding="utf-8")
diff --git a/core/reply_enhancer.py b/core/reply_enhancer.py
index 4757819ea..4e4407611 100644
--- a/core/reply_enhancer.py
+++ b/core/reply_enhancer.py
@@ -19,6 +19,7 @@ from dataclasses import dataclass, field
from typing import List, Optional, Tuple
from urllib.parse import unquote, urlparse
+from config import paths
from modules.im import MessageContext
logger = logging.getLogger(__name__)
@@ -213,6 +214,16 @@ Use that skill for configuration file locations, scope rules, routing behavior,
"""
+_USER_PREFERENCES_PROMPT = """\
+
+## 5. User preference file
+A shared user preference file is available at `{preferences_path}`.
+When useful, you may read it to learn the user's stable habits, preferences, and recurring rules.
+You may also update it as you learn durable preferences from repeated interactions.
+Keep it short, factual, deduplicated, and free of secrets unless the user explicitly asks.
+"""
+
+
def _build_scheduled_tasks_prompt(context: MessageContext, *, fallback_platform: Optional[str] = None) -> str:
from core.scheduled_tasks import build_session_key_for_context
@@ -247,6 +258,7 @@ def build_reply_enhancements_prompt(
if context is not None:
prompt += _build_scheduled_tasks_prompt(context, fallback_platform=fallback_platform)
prompt += _VIBE_SKILL_PROMPT
+ prompt += _USER_PREFERENCES_PROMPT.format(preferences_path=f"`{paths.get_user_preferences_path()}`")
return prompt
diff --git a/skills/use-vibe-remote/SKILL.md b/skills/use-vibe-remote/SKILL.md
index 7850d15c3..5fa6ce180 100644
--- a/skills/use-vibe-remote/SKILL.md
+++ b/skills/use-vibe-remote/SKILL.md
@@ -2,7 +2,7 @@
name: use-vibe-remote
slug: use-vibe-remote
description: Safely inspect and modify local Vibe Remote configuration, routing, runtime settings, scheduled tasks, and operational state.
-version: 0.1.3
+version: 0.1.4
---
# Use Vibe Remote
@@ -43,6 +43,7 @@ Important paths:
- `~/.vibe_remote/config/config.json`: global config
- `~/.vibe_remote/state/settings.json`: per-channel and per-user overrides
- `~/.vibe_remote/state/scheduled_tasks.json`: persisted scheduled tasks
+- `~/.vibe_remote/state/user_preferences.md`: stable user habits, preferences, and recurring rules
- `~/.vibe_remote/state/sessions.json`: runtime session state
- `~/.vibe_remote/logs/vibe_remote.log`: main application log
- `~/.vibe_remote/runtime/status.json`: runtime status file
diff --git a/tests/test_reply_enhancer_platform.py b/tests/test_reply_enhancer_platform.py
index eac589fac..94bc72604 100644
--- a/tests/test_reply_enhancer_platform.py
+++ b/tests/test_reply_enhancer_platform.py
@@ -1,11 +1,13 @@
import sys
import unittest
from pathlib import Path
+from unittest.mock import patch
sys.path.insert(0, str(Path(__file__).resolve().parents[1]))
from core.message_dispatcher import ConsolidatedMessageDispatcher
from core.reply_enhancer import build_reply_enhancements_prompt, process_reply
+from config import paths
from modules.im import MessageContext
@@ -61,11 +63,14 @@ class _StubController:
class ReplyEnhancerPlatformTests(unittest.IsolatedAsyncioTestCase):
def test_prompt_can_exclude_quick_replies(self):
- prompt = build_reply_enhancements_prompt(include_quick_replies=False)
+ with patch.object(paths, "get_user_preferences_path", return_value=Path("/tmp/user_preferences.md")):
+ prompt = build_reply_enhancements_prompt(include_quick_replies=False)
self.assertIn("## 1. Send files", prompt)
self.assertNotIn("## 2. Quick-reply buttons", prompt)
self.assertIn("https://github.com/cyhhao/vibe-remote/raw/master/skills/use-vibe-remote/SKILL.md", prompt)
+ self.assertIn("## 5. User preference file", prompt)
+ self.assertIn("`/tmp/user_preferences.md`", prompt)
def test_prompt_includes_scheduled_task_usage_with_threadless_default_session_key(self):
context = MessageContext(
@@ -76,7 +81,8 @@ class ReplyEnhancerPlatformTests(unittest.IsolatedAsyncioTestCase):
platform_specific={"is_dm": False},
)
- prompt = build_reply_enhancements_prompt(include_quick_replies=True, context=context)
+ with patch.object(paths, "get_user_preferences_path", return_value=Path("/tmp/user_preferences.md")):
+ prompt = build_reply_enhancements_prompt(include_quick_replies=True, context=context)
self.assertIn("## 3. Scheduled tasks", prompt)
self.assertIn("`vibe task add`", prompt)
@@ -85,6 +91,8 @@ class ReplyEnhancerPlatformTests(unittest.IsolatedAsyncioTestCase):
self.assertIn("slack::channel::C1::thread::171717.123", prompt)
self.assertIn("If `--timezone` is omitted, the task uses the local system timezone at creation time.", prompt)
self.assertIn("https://github.com/cyhhao/vibe-remote/raw/master/skills/use-vibe-remote/SKILL.md", prompt)
+ self.assertIn("When useful, you may read it to learn the user's stable habits, preferences, and recurring rules.", prompt)
+ self.assertIn("Keep it short, factual, deduplicated, and free of secrets unless the user explicitly asks.", prompt)
def test_prompt_uses_fallback_platform_for_unannotated_context(self):
context = MessageContext(
@@ -94,11 +102,12 @@ class ReplyEnhancerPlatformTests(unittest.IsolatedAsyncioTestCase):
platform_specific={"is_dm": False},
)
- prompt = build_reply_enhancements_prompt(
- include_quick_replies=True,
- context=context,
- fallback_platform="slack",
- )
+ with patch.object(paths, "get_user_preferences_path", return_value=Path("/tmp/user_preferences.md")):
+ prompt = build_reply_enhancements_prompt(
+ include_quick_replies=True,
+ context=context,
+ fallback_platform="slack",
+ )
self.assertIn("Default session key: `slack::channel::C1`", prompt)
diff --git a/tests/test_v2_paths.py b/tests/test_v2_paths.py
index b702f5896..42a5aa3ed 100644
--- a/tests/test_v2_paths.py
+++ b/tests/test_v2_paths.py
@@ -7,6 +7,7 @@ def test_paths_are_under_home():
assert paths.get_config_path().parent == paths.get_config_dir()
assert paths.get_settings_path().parent == paths.get_state_dir()
assert paths.get_sessions_path().parent == paths.get_state_dir()
+ assert paths.get_user_preferences_path().parent == paths.get_state_dir()
def test_ensure_data_dirs(tmp_path, monkeypatch):
@@ -17,3 +18,8 @@ def test_ensure_data_dirs(tmp_path, monkeypatch):
assert (tmp_path / ".vibe_remote" / "logs").exists()
assert (tmp_path / ".vibe_remote" / "runtime").exists()
assert (tmp_path / ".vibe_remote" / "attachments").exists()
+ preferences_path = tmp_path / ".vibe_remote" / "state" / "user_preferences.md"
+ assert preferences_path.exists()
+ text = preferences_path.read_text(encoding="utf-8")
+ assert "# User Preferences" in text
+ assert "Do not store secrets here unless the user explicitly asks." in text