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(vibey): drop clock fields from the environment block and retire user preferences (#3112)

Call Whiteb9b3fb6e6d82
diff --git a/config/paths.py b/config/paths.py
index f76fe0ddf..a635f6796 100644
--- a/config/paths.py
+++ b/config/paths.py
@@ -247,25 +247,6 @@ def get_global_instructions_path() -> Path:
return get_vibe_remote_dir() / GLOBAL_INSTRUCTIONS_FILENAME
-def get_user_preferences_path() -> Path:
- return get_state_dir() / "user_preferences.md"
-
-
-_USER_PREFERENCES_TEMPLATE = """# User Context and Preferences
-
-Use this file for durable user context, stable preferences, and recurring working patterns.
-Prefer adding notes under `## Users`.
-Keep entries short, factual, reusable, deduplicated, and free of secrets unless the user explicitly asks.
-
-## Users
-### platform/user_id
-- Add stable notes about how this user prefers to communicate, work, and make decisions.
-
-## Shared
-- Add cross-user notes here only when they are genuinely reusable.
-"""
-
-
def ensure_data_dirs() -> None:
from storage.migrations import guard_source_checkout_default_state_bootstrap
@@ -278,6 +259,3 @@ def ensure_data_dirs() -> None:
get_attachments_dir().mkdir(parents=True, exist_ok=True)
get_show_pages_dir().mkdir(parents=True, exist_ok=True)
get_state_backups_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/prompt_registry.py b/core/prompt_registry.py
index 4c07835d1..779b53ede 100644
--- a/core/prompt_registry.py
+++ b/core/prompt_registry.py
@@ -87,7 +87,7 @@ PROMPT_MODULES: tuple[PromptModule, ...] = (
PromptModule("vault-routing-prompt", "Vault Routing Prompt", "vault.md", leading_newlines=1, trailing_newlines=1),
PromptModule("harness-routing-prompt", "Harness Routing Prompt", "harness.md", leading_newlines=1, trailing_newlines=1),
PromptModule("harness-agents-prompt", "Harness Agents Prompt", "harness-agents.md", placeholders=("enabled_agents_rows",)),
- PromptModule("preferences-context-prompt", "Preferences and Project Context Prompt", "preferences-context.md", leading_newlines=1, trailing_newlines=1, placeholders=("preferences_path", "platform")),
+ PromptModule("project-context-prompt", "Project Context and History Prompt", "project-context.md", leading_newlines=1, trailing_newlines=1),
PromptModule("mcp-capabilities-prompt", "MCP Capabilities", "mcp.md", leading_newlines=1, trailing_newlines=1),
PromptModule("mcp-pagination-prompt", "MCP Discovery Pagination", "mcp-pagination.md", trailing_newlines=1),
PromptModule("mcp-catalog", "Available MCP Servers", "mcp-catalog.md", trailing_newlines=1, placeholders=("server_rows",)),
diff --git a/core/prompts/preferences-context.md b/core/prompts/preferences-context.md
deleted file mode 100644
index 8bb698b25..000000000
--- a/core/prompts/preferences-context.md
+++ /dev/null
@@ -1,10 +0,0 @@
-## User Preferences and Project Context
-Stable user habits the user asks you to keep go to the shared preferences file; project lessons, conventions, architecture, workflows, and pointers go to the nearest relevant `AGENTS.md`, which future Agents load early.
-
-`AGENTS.md` is an index, not a log. Keep high-level principles there, point to local detail files when needed, and update by consolidating and abstracting instead of merely appending.
-
-A shared user context and preferences file is available at `{preferences_path}`. Read it only when stable cross-project user context would improve the decision, and update it only when the user explicitly asks.
-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.
-
-When the missing context is previous Avibe conversation history, make good use of `vibe data query` to search Sessions and Messages by keyword, time, scope, Agent, or run history; start from its `digests` view to recognize a Session by what it is about and where it stands, then read its `transcript` or `turns`. Query it freely: it reaches beyond this Session to the whole platform's data across every Session, Agent, and channel, and it is the clearest, most direct, and rawest source of memory. Do not rely on vague impressions or ask the user to repeat themselves.
diff --git a/core/prompts/project-context.md b/core/prompts/project-context.md
new file mode 100644
index 000000000..14524627d
--- /dev/null
+++ b/core/prompts/project-context.md
@@ -0,0 +1,6 @@
+## Project Context and History
+Project lessons, conventions, architecture, workflows, and pointers go to the nearest relevant `AGENTS.md`, which future Agents load early.
+
+`AGENTS.md` is an index, not a log. Keep high-level principles there, point to local detail files when needed, and update by consolidating and abstracting instead of merely appending.
+
+When the missing context is previous Avibe conversation history, make good use of `vibe data query` to search Sessions and Messages by keyword, time, scope, Agent, or run history; start from its `digests` view to recognize a Session by what it is about and where it stands, then read its `transcript` or `turns`. Query it freely: it reaches beyond this Session to the whole platform's data across every Session, Agent, and channel, and it is the clearest, most direct, and rawest source of memory. Do not rely on vague impressions or ask the user to repeat themselves.
diff --git a/core/system_prompt_injection.py b/core/system_prompt_injection.py
index 95b62008c..d16937047 100644
--- a/core/system_prompt_injection.py
+++ b/core/system_prompt_injection.py
@@ -9,7 +9,6 @@ from dataclasses import dataclass
from pathlib import Path
from typing import Any, Iterable, Optional
-from config import paths
from core.message_context import resolve_context_platform
from core.prompt_registry import RenderedPromptBlock, join_prompt_blocks, order_prompt_blocks, render_prompt, render_prompt_block
from modules.im import MessageContext
@@ -175,19 +174,6 @@ def get_enabled_agents_for_prompt(controller: Any) -> Optional[list[AgentPromptI
return rows
-def _context_block(
- context: Optional[MessageContext],
- *,
- fallback_platform: Optional[str] = None,
-) -> RenderedPromptBlock:
- platform = resolve_context_platform(context, fallback_platform=fallback_platform, default="<platform>")
- return render_prompt_block(
- "preferences-context-prompt",
- preferences_path=f"`{paths.get_user_preferences_path()}`",
- platform=platform,
- )
-
-
def build_system_prompt_blocks(
*,
agent_instructions: str = "",
@@ -243,10 +229,7 @@ def build_system_prompt_blocks(
if agent_rows:
blocks.append(render_prompt_block("harness-agents-prompt", enabled_agents_rows=agent_rows))
if include_context_guidance:
- blocks.append(_context_block(
- context,
- fallback_platform=fallback_platform,
- ))
+ blocks.append(render_prompt_block("project-context-prompt"))
from core.mcp_hub.prompt import build_mcp_prompt_blocks
blocks.extend(build_mcp_prompt_blocks())
diff --git a/docs/CLI.md b/docs/CLI.md
index 3557b2fee..3c18ef18e 100644
--- a/docs/CLI.md
+++ b/docs/CLI.md
@@ -998,7 +998,6 @@ The web UI (`http://127.0.0.1:5123`) provides the same controls:
| `~/.vibe_remote/state/scheduled_tasks.json` | Legacy scheduled task definitions imported into SQLite on startup |
| `~/.vibe_remote/state/watches.json` | Legacy managed watch definitions imported into SQLite on startup |
| `~/.vibe_remote/state/task_requests/` | Legacy queued task/hook requests imported into SQLite on startup |
-| `~/.vibe_remote/state/user_preferences.md` | Shared long-term user preference notes |
| `~/.vibe_remote/state/backups/` | Automatic state backups taken before migrations |
| `~/.vibe_remote/state/agent_core/model-requests/` | Private copies of Vibey model requests that did not succeed (`vibe model-requests`); kept 7 days, 256 MiB at most |
| `~/.vibe_remote/runtime/remote-access-cloudflared.pid` | cloudflared tunnel PID for Avibe Cloud remote access |
diff --git a/docs/CLI_ZH.md b/docs/CLI_ZH.md
index d66cf2e4a..2a5ca6d22 100644
--- a/docs/CLI_ZH.md
+++ b/docs/CLI_ZH.md
@@ -816,7 +816,6 @@ Web UI (`http://127.0.0.1:5123`) 提供相同的控制功能:
| `~/.vibe_remote/state/settings.json` | 频道路由设置 |
| `~/.vibe_remote/state/scheduled_tasks.json` | 持久化的定时任务定义 |
| `~/.vibe_remote/state/task_requests/` | task run 与 hook 的请求队列 |
-| `~/.vibe_remote/state/user_preferences.md` | 共享的长期用户偏好笔记 |
| `~/.vibe_remote/logs/vibe_remote.log` | 应用日志 |
| `~/.vibe_remote/runtime/opencode/generations/` | 每个运行中的 OpenCode 服务器代各一条记录 |
diff --git a/docs/plans/agent-core-contracts/context.md b/docs/plans/agent-core-contracts/context.md
index 4501e72d6..82682467c 100644
--- a/docs/plans/agent-core-contracts/context.md
+++ b/docs/plans/agent-core-contracts/context.md
@@ -466,9 +466,9 @@ is written, so projection stays a pure function of the rows:
(`kept_inputs`, §5): a mid-turn checkpoint may misstate the Turn (as finished, or as more than was asked), and the
verbatim inputs placed before it must win.
- `state`: texts the adapter rendered from their own stores when the checkpoint was written: the environment's core
- fields (C-7 §8: cwd, os, shell, date, timezone; no Watches; each field displayed as every input's block displays it,
+ fields (C-7 §8: cwd, os, shell; no Watches; each field displayed as every input's block displays it,
the cwd escaped and never cut, every other field cut to 160 UTF-8 bytes (`display`), so the block is the cwd, which
- the OS bounds, plus at most about 4 x 40 tokens; a checkpoint always happens inside
+ the OS bounds, plus at most about 2 x 40 tokens; a checkpoint always happens inside
a run, and a Turn's own input carries only the fields that changed). Pending work is the now's own "Waiting on",
and the in-flight Turn's inputs stay as they were (§5).
- Projection (C-5 §3): the system prompt, hook-rehydrated messages, the kept inputs (§5), one user message
diff --git a/docs/plans/agent-core-contracts/tools.md b/docs/plans/agent-core-contracts/tools.md
index c93f6a8cf..d31b5cedb 100644
--- a/docs/plans/agent-core-contracts/tools.md
+++ b/docs/plans/agent-core-contracts/tools.md
@@ -348,12 +348,14 @@ the projected context no longer shows, because the inputs that carried the earli
cwd: /absolute/path
os: macOS 26.0 (arm64)
shell: /bin/bash
-date: 2026-10-02
-timezone: Asia/Shanghai
watches: wch_8f2k "nightly sync" command running; wch_3c1d job running
</environment>
```
+The date and time are not fields: every input's `[Now: ...]` line (`core/agent_input.py`) already carries the date,
+time, and UTC offset. Blocks stored while the block still had `date` and `timezone` keep replaying; those two lines
+are ignored when the loop reads back what the model was last told.
+
`shell` is the shell the commands run in: the job host's on POSIX (`/bin/bash`, else `bash` on `PATH`, else `sh`), and
on Windows `PowerShell 7 ({path})` or `Windows PowerShell 5.1 ({path})`.
`watches` names the Session's enabled Watches by id, name, and kind, never a command: at most 20, then `and N more`.
diff --git a/modules/agents/vibey/agent.py b/modules/agents/vibey/agent.py
index 6db6dd5b4..617e7fe90 100644
--- a/modules/agents/vibey/agent.py
+++ b/modules/agents/vibey/agent.py
@@ -1689,12 +1689,7 @@ class VibeyAgent(BaseAgent):
def _environment(self, session_id: str) -> dict[str, EnvironmentValue]:
runtime = self._runtimes.get(session_id)
cwd = ((runtime.run.cwd if runtime.run is not None else "") or runtime.cwd) if runtime is not None else ""
- return current_environment(
- cwd,
- self._watch_lines(session_id),
- shell=self._tools().shell,
- include_time=getattr(self.config, "include_time_info", True),
- )
+ return current_environment(cwd, self._watch_lines(session_id), shell=self._tools().shell)
def _watch_lines(self, session_id: str) -> list[str]:
service = getattr(self.controller, "watch_service", None)
diff --git a/modules/agents/vibey/prompt.py b/modules/agents/vibey/prompt.py
index bb6f81c9f..662e2165a 100644
--- a/modules/agents/vibey/prompt.py
+++ b/modules/agents/vibey/prompt.py
@@ -4,9 +4,10 @@ The system prompt is stable so providers can cache it: who the Agent is, Pi's
tool snippets and rules, the user's instruction files (``instructions``, C-7
tools.md section 9), 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
+Facts that change (cwd, shell, 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.
+stored transcript is what the model saw. The date and time are not among them:
+every input's ``[Now: ...]`` line (``core/agent_input.py``) carries them.
Tool snippets and rules ported from Pi (MIT, Copyright (c) 2025 Mario Zechner),
``packages/coding-agent/src/core/system-prompt.ts`` and
@@ -23,11 +24,8 @@ threshold (``core.presentation.interim_worthy``).
from __future__ import annotations
import functools
-import os
import platform
import re
-import time
-from datetime import datetime
from pathlib import Path
from typing import Iterable, Mapping, Optional, Sequence, Union
@@ -122,7 +120,7 @@ def system_prompt(
# --- environment block ---------------------------------------------------------
-ENVIRONMENT_FIELDS = ("cwd", "os", "shell", "date", "timezone", "watches")
+ENVIRONMENT_FIELDS = ("cwd", "os", "shell", "watches")
_BLOCK = re.compile(r"\A<environment>\n(?P<body>(?:[a-z]+: [^\n]*\n)*)</environment>\Z")
@@ -135,19 +133,6 @@ def operating_system() -> str:
return f"{platform.system() or 'unknown'} {platform.release()} ({machine})".strip()
-def local_timezone() -> str:
- zone = os.environ.get("TZ", "").lstrip(":")
- if zone:
- return zone
- try:
- target = os.path.realpath("/etc/localtime")
- if "zoneinfo/" in target:
- return target.split("zoneinfo/", 1)[1]
- except OSError:
- pass
- return time.tzname[0] if time.tzname else "UTC"
-
-
#: The environment block names at most this many Watches (tools.md section 8).
_WATCHES_LISTED = 20
@@ -155,24 +140,19 @@ _WATCHES_LISTED = 20
EnvironmentValue = Union[str, tuple[str, ...]]
-def current_environment(
- cwd: str, watches: Sequence[str], *, shell: str, include_time: bool = True, now: Optional[datetime] = None
-) -> dict[str, EnvironmentValue]:
- """The environment fields, raw; the clock ones follow ``include_time_info``, as every input prefix does.
+def current_environment(cwd: str, watches: Sequence[str], *, shell: str) -> dict[str, EnvironmentValue]:
+ """The environment fields, raw.
Identity is the raw value: only the block the model reads displays them (``render_environment``), and only the
exact display of one can prove it unchanged (``environment_delta``).
"""
- fields: dict[str, EnvironmentValue] = {
+ return {
"cwd": str(Path(cwd).resolve()) if cwd else "",
"os": operating_system(),
# The shell the commands run in (``Shell.describe``), not the user's login shell.
"shell": shell,
+ "watches": tuple(watches),
}
- if include_time:
- fields.update(date=(now or datetime.now()).date().isoformat(), timezone=local_timezone())
- fields["watches"] = tuple(watches)
- return fields
def render_environment(fields: Mapping[str, EnvironmentValue]) -> str:
@@ -206,6 +186,8 @@ def _whole(name: str, value: EnvironmentValue) -> bool:
def parse_environment(text: str) -> Optional[dict[str, str]]:
+ """A block's fields; a name no longer sent, such as ``date`` or ``timezone`` in rows stored before they left the
+ block, is dropped."""
match = _BLOCK.match(text or "")
if match is None:
return None
diff --git a/skills/agent-prompt-audit/SKILL.md b/skills/agent-prompt-audit/SKILL.md
index d478cf400..1d1b64429 100644
--- a/skills/agent-prompt-audit/SKILL.md
+++ b/skills/agent-prompt-audit/SKILL.md
@@ -2,7 +2,7 @@
name: agent-prompt-audit
slug: agent-prompt-audit
description: Audit and improve the prompt surface of Avibe Agents across backends (Claude, Codex/GPT, OpenCode) — global and project rules, Agent system prompts, Skills, delegation briefs, and Task and Watch messages — using real run evidence. Use when an Agent misbehaves (stalls, over-asks, over-reaches, ignores or over-applies a rule), after a model or backend change, or when the user asks to review, clean up, or tighten prompts.
-version: 0.1.0
+version: 0.1.1
---
# Agent Prompt Audit
@@ -83,7 +83,6 @@ actually loads rather than assuming default paths.
| Agent system prompt, model, effort | `vibe agent show <name> --json` | `vibe agent update <name> --system-prompt-file <file>` |
| Skills | user skill dirs (follow symlinks), Avibe `skills/`, project `.agents/skills/` | The directory's owner |
| Task and Watch messages (re-sent every fire) | `vibe task list --session-id <id>` / `vibe watch list --session-id <id>` (or `--global`) for ids, then `vibe task show <id>` / `vibe watch show <id>` for the full text | `vibe task update`, `vibe watch update` |
-| User preferences (read on demand) | `~/.avibe/state/user_preferences.md`; inspect only the reported user's part, and only when the transcript shows it was read | The user |
| Delegation briefs and callbacks | `agent_runs.message` / `result_text` | The prompt or Skill that writes them |
Only Skill descriptions on the first catalog page are loaded every turn;
diff --git a/skills/use-avibe/SKILL.md b/skills/use-avibe/SKILL.md
index bc4b10666..0b0913d92 100644
--- a/skills/use-avibe/SKILL.md
+++ b/skills/use-avibe/SKILL.md
@@ -2,7 +2,7 @@
name: use-avibe
slug: use-avibe
description: Safely inspect and modify local Avibe configuration, routing, runtime settings, watches, scheduled tasks, Avibe Cloud remote access, and operational state. Also use it to report an Avibe bug, send product feedback, or file a feature request from the current conversation.
-version: 0.9.1
+version: 0.9.2
---
# Use Avibe
diff --git a/skills/use-avibe/references/operations.md b/skills/use-avibe/references/operations.md
index 2c08598f9..1a54b75ad 100644
--- a/skills/use-avibe/references/operations.md
+++ b/skills/use-avibe/references/operations.md
@@ -7,7 +7,6 @@ Avibe stores runtime data under `~/.avibe/` by default, or under `AVIBE_HOME` wh
- `~/.avibe/config/config.json` — global config; mutate through `POST /api/config`, not by editing the file
- `~/.avibe/logs/vibe_remote.log` — main application log; read via `POST /api/logs`
- `~/.avibe/screenshots/` — default output directory for `vibe screenshot`
-- `~/.avibe/state/user_preferences.md` — shared long-term preference file (safe to read and update)
Agent harness state is managed through `vibe agent run`, `vibe task`, `vibe watch`, and `vibe runs` (or their API endpoints), not by editing persistence files. Everything else under `state/` and `runtime/` is internal — treat it as opaque.
diff --git a/tests/test_claude_cli_path.py b/tests/test_claude_cli_path.py
index 375bf82d3..c22cbc755 100644
--- a/tests/test_claude_cli_path.py
+++ b/tests/test_claude_cli_path.py
@@ -1474,10 +1474,9 @@ 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 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"]
+ prompt = first_client.options.system_prompt["append"]
+ assert "## Project Context and History" in prompt
+ assert "U123" not in prompt and "U456" not in prompt
def test_session_handler_recreates_cached_claude_client_when_skill_bindings_change(
diff --git a/tests/test_prompt_render_export.py b/tests/test_prompt_render_export.py
index 2bbb1fb20..95920b0b0 100644
--- a/tests/test_prompt_render_export.py
+++ b/tests/test_prompt_render_export.py
@@ -11,7 +11,6 @@ from pathlib import Path
import pytest
from markdown_it import MarkdownIt
-from config import paths
from core.mcp_hub import repository as mcp_repository
from core import managed_skills, show_git
from core.managed_skills import ManagedSkill
@@ -80,6 +79,26 @@ _SESSION_TITLE_STEPS = (
'without waiting for the user:\n`vibe session update --title "<short title>" --if-untitled`\n\n'
"It keeps a title the user or an Agent already set. Do not mention"
)
+_PREVIOUS_PREFERENCES_CONTEXT = (
+ "## User Preferences and Project Context\n"
+ "Stable user habits the user asks you to keep go to the shared preferences file; project lessons, conventions, "
+ "architecture, workflows, and pointers go to the nearest relevant `AGENTS.md`, which future Agents load early.\n\n"
+ "`AGENTS.md` is an index, not a log. Keep high-level principles there, point to local detail files when needed, "
+ "and update by consolidating and abstracting instead of merely appending.\n\n"
+ "A shared user context and preferences file is available at ``/fixture/preferences.md``. Read it only when "
+ "stable cross-project user context would improve the decision, and update it only when the user explicitly asks.\n"
+ "Use the current platform `avibe` and the user id from the current message metadata to choose the appropriate "
+ "user section: `avibe/<user_id>`.\n"
+ "Only record durable, factual, reusable information there. Keep entries short, deduplicated, and free of secrets "
+ "unless the user explicitly asks.\n\n"
+)
+_PROJECT_CONTEXT = (
+ "## Project Context and History\n"
+ "Project lessons, conventions, architecture, workflows, and pointers go to the nearest relevant `AGENTS.md`, "
+ "which future Agents load early.\n\n"
+ "`AGENTS.md` is an index, not a log. Keep high-level principles there, point to local detail files when needed, "
+ "and update by consolidating and abstracting instead of merely appending.\n\n"
+)
_CODEX_SKILL_REUSE_GUIDANCE = (
"Choose skills by task relevance, but load a skill only if it has not already been read "
"in this conversation; reuse already-loaded instructions across turns, callbacks, "
@@ -110,7 +129,6 @@ def _inputs(backend="codex", history="managed", skill_mode="pages"):
def _environment(monkeypatch, history="managed", skill_mode="pages"):
monkeypatch.setenv("CODEX_HOME", "/fixture/codex")
- monkeypatch.setattr(paths, "get_user_preferences_path", lambda: Path("/fixture/preferences.md"))
monkeypatch.setattr(show_git, "show_git_checkpointing_active", lambda: history != "off")
monkeypatch.setattr(show_git, "_workspace_is_self_managed", lambda _: history == "self-managed")
names = [f"skill-{index:02}" for index in range(26)] + ["use-avibe-vault"]
@@ -573,6 +591,8 @@ def test_approved_guidance_changes_preserve_all_other_injection_bytes(monkeypatc
assert text.count(_NEW_SESSION_MODEL_GUIDANCE) == 1
assert text.count(_HARNESS_SOURCE_GUIDANCE) == 1
assert text.count(_SESSION_TITLE_STEPS) == 1
+ assert text.count(_PROJECT_CONTEXT) == 1
+ text = text.replace(_PROJECT_CONTEXT, _PREVIOUS_PREFERENCES_CONTEXT)
text = text.replace(_HARNESS_SOURCE_GUIDANCE, "")
text = text.replace(_SESSION_TITLE_STEPS, _PREVIOUS_SESSION_TITLE_STEPS)
text = text.replace(_NEW_SESSION_MODEL_GUIDANCE, _PREVIOUS_FORK_OVERRIDE_GUIDANCE)
@@ -587,6 +607,7 @@ def test_approved_guidance_changes_preserve_all_other_injection_bytes(monkeypatc
# principle, and the Harness rule that a run's --model applies
# only to forks (now: to any new Session a run creates), and without the
# Harness line that says what a `[Harness: ...]` input is, and restoring the
- # two-call Session Title steps that `--if-untitled` replaced.
+ # two-call Session Title steps that `--if-untitled` replaced, and restoring the
+ # retired shared preferences file paragraphs and their section heading.
# Every other byte/order stays pinned, including all Claude/OpenCode output.
assert digest == "262c7cbabbbb0bfefa4a69511d805d28f76a3559bd511184006242f831b4836e"
diff --git a/tests/test_prompt_studio_catalog.py b/tests/test_prompt_studio_catalog.py
index bfee44ad3..7d41c5c2f 100644
--- a/tests/test_prompt_studio_catalog.py
+++ b/tests/test_prompt_studio_catalog.py
@@ -39,13 +39,13 @@ def test_every_prompt_markdown_file_has_one_stably_ordered_registry_entry() -> N
def test_prompt_rendering_replaces_only_declared_placeholders() -> None:
rendered = render_prompt(
- "preferences-context-prompt",
- preferences_path="`/tmp/preferences.md`",
- platform="avibe",
+ "forked-session-prompt",
+ source_session_id="sessource",
+ default_session_id="sesfork",
)
- assert "`/tmp/preferences.md`" in rendered
- assert "`avibe/<user_id>`" in rendered
+ assert "forked from `sessource`" in rendered
+ assert "this fork is `sesfork`" in rendered
def test_prompt_catalog_export_is_deterministic_and_source_addressable() -> None:
diff --git a/tests/test_reply_enhancer_platform.py b/tests/test_reply_enhancer_platform.py
index 706cb14a0..26fb2884a 100644
--- a/tests/test_reply_enhancer_platform.py
+++ b/tests/test_reply_enhancer_platform.py
@@ -15,7 +15,6 @@ from core.controller import Controller
from core.message_dispatcher import ConsolidatedMessageDispatcher
from core.reply_enhancer import process_reply, strip_silent_blocks
from core.system_prompt_injection import build_system_prompt_injection
-from config import paths
from modules.agents.base import AgentRequest, BaseAgent
from modules.im import MessageContext
@@ -145,8 +144,7 @@ def _resolved_core_skills(*, manual_only: bool = False) -> list[SimpleNamespace]
class ReplyEnhancerPlatformTests(unittest.IsolatedAsyncioTestCase):
def test_prompt_can_exclude_quick_replies(self):
- with patch.object(paths, "get_user_preferences_path", return_value=Path("/tmp/user_preferences.md")):
- prompt = build_system_prompt_injection(include_quick_replies=False)
+ prompt = build_system_prompt_injection(include_quick_replies=False)
self.assertIn("## Silent replies", prompt)
self.assertIn("<silent>reason not shown to the user</silent>", prompt)
@@ -171,16 +169,15 @@ class ReplyEnhancerPlatformTests(unittest.IsolatedAsyncioTestCase):
self.assertIn("Avibe provides optional capabilities:", prompt)
self.assertNotIn("If you generate an image with Codex", prompt)
self.assertNotIn("## Quick-reply buttons", prompt)
- self.assertIn("## User Preferences and Project Context", prompt)
- self.assertIn("`/tmp/user_preferences.md`", prompt)
- self.assertIn("Use the current platform `<platform>`", prompt)
- self.assertIn("`<platform>/<user_id>`", prompt)
+ self.assertIn("## Project Context and History", prompt)
+ self.assertIn("`AGENTS.md` is an index, not a log.", prompt)
+ self.assertIn("make good use of `vibe data query`", prompt)
+ # The shared preferences file is retired: the prompt neither names it nor routes notes to it.
+ self.assertNotIn("user_preferences.md", prompt)
+ self.assertNotIn("preferences file", prompt)
def test_prompt_can_include_codex_generated_image_instructions(self):
- with (
- patch.dict(os.environ, {"CODEX_HOME": "/Users/test/.codex"}),
- patch.object(paths, "get_user_preferences_path", return_value=Path("/tmp/user_preferences.md")),
- ):
+ with patch.dict(os.environ, {"CODEX_HOME": "/Users/test/.codex"}):
prompt = build_system_prompt_injection(
include_quick_replies=False,
include_codex_generated_images=True,
@@ -192,10 +189,7 @@ class ReplyEnhancerPlatformTests(unittest.IsolatedAsyncioTestCase):
self.assertIn("Never emit variables, placeholder paths, or sandbox paths like `/mnt/data/...`", prompt)
def test_prompt_routes_vault_work_to_builtin_skill(self):
- with (
- patch.object(paths, "get_user_preferences_path", return_value=Path("/tmp/user_preferences.md")),
- patch("core.managed_skills.resolve_skills", return_value=_resolved_core_skills()),
- ):
+ with patch("core.managed_skills.resolve_skills", return_value=_resolved_core_skills()):
prompt = build_system_prompt_injection(
include_quick_replies=False,
skills_cwd=Path("/tmp/project"),
@@ -223,10 +217,7 @@ class ReplyEnhancerPlatformTests(unittest.IsolatedAsyncioTestCase):
for platform in ("avibe", "slack")
]
- with (
- patch.object(paths, "get_user_preferences_path", return_value=Path("/tmp/user_preferences.md")),
- patch("core.managed_skills.resolve_skills", return_value=_resolved_core_skills()),
- ):
+ with patch("core.managed_skills.resolve_skills", return_value=_resolved_core_skills()):
prompts = [
build_system_prompt_injection(
include_quick_replies=False,
@@ -249,10 +240,7 @@ class ReplyEnhancerPlatformTests(unittest.IsolatedAsyncioTestCase):
platform="avibe",
platform_specific={"agent_session_id": "sesk8m4q2p7x"},
)
- with (
- patch.object(paths, "get_user_preferences_path", return_value=Path("/tmp/user_preferences.md")),
- patch("core.managed_skills.resolve_skills", return_value=[]),
- ):
+ with patch("core.managed_skills.resolve_skills", return_value=[]):
prompt = build_system_prompt_injection(
include_quick_replies=False,
context=context,
@@ -273,10 +261,7 @@ class ReplyEnhancerPlatformTests(unittest.IsolatedAsyncioTestCase):
platform_specific={"agent_session_id": "sesk8m4q2p7x"},
)
- with (
- patch.object(paths, "get_user_preferences_path", return_value=Path("/tmp/user_preferences.md")),
- patch("core.managed_skills.resolve_skills", return_value=_resolved_core_skills()),
- ):
+ with patch("core.managed_skills.resolve_skills", return_value=_resolved_core_skills()):
prompt = build_system_prompt_injection(
include_quick_replies=False,
context=context,
@@ -297,18 +282,14 @@ class ReplyEnhancerPlatformTests(unittest.IsolatedAsyncioTestCase):
platform_specific={"agent_session_id": "sesk8m4q2p7x"},
)
- with patch.object(paths, "get_user_preferences_path", return_value=Path("/tmp/user_preferences.md")):
- prompt = build_system_prompt_injection(
- include_quick_replies=False,
- include_context_guidance=False,
- context=context,
- )
+ prompt = build_system_prompt_injection(
+ include_quick_replies=False,
+ include_context_guidance=False,
+ context=context,
+ )
self.assertIn("Current session id: `sesk8m4q2p7x`", prompt)
- self.assertNotIn("## Memory and Project Context", prompt)
- self.assertNotIn("## User Preferences and Project Context", prompt)
- self.assertNotIn("/tmp/user_preferences.md", prompt)
- self.assertNotIn("slack/U1", prompt)
+ self.assertNotIn("## Project Context and History", prompt)
def test_process_reply_strips_silent_blocks_before_enhancements(self):
@@ -1585,10 +1566,7 @@ class ReplyEnhancerPlatformTests(unittest.IsolatedAsyncioTestCase):
),
]
- with (
- patch.object(paths, "get_user_preferences_path", return_value=Path("/tmp/user_preferences.md")),
- patch("core.managed_skills.resolve_skills", return_value=_resolved_core_skills()),
- ):
+ with patch("core.managed_skills.resolve_skills", return_value=_resolved_core_skills()):
prompt = build_system_prompt_injection(
include_quick_replies=True,
context=context,
@@ -1612,8 +1590,7 @@ class ReplyEnhancerPlatformTests(unittest.IsolatedAsyncioTestCase):
self.assertIn("| review-bot | codex | Name needs prompt-safe normalization |", prompt)
self.assertLess(prompt.index("| codex |"), prompt.index("| release-auditor |"))
self.assertLess(prompt.index("| release-auditor |"), prompt.index("| review-bot |"))
- self.assertIn("## User Preferences and Project Context", prompt)
- self.assertIn("/tmp/user_preferences.md", prompt)
+ self.assertIn("## Project Context and History", prompt)
skill = (Path(__file__).resolve().parents[1] / "skills" / "use-avibe-harness" / "SKILL.md").read_text()
self.assertIn("Avibe Harness turns user intent into durable Agent work", skill)
@@ -1637,17 +1614,16 @@ class ReplyEnhancerPlatformTests(unittest.IsolatedAsyncioTestCase):
SimpleNamespace(name="beta", normalized_name="beta", backend="opencode", description="Middle"),
]
- with patch.object(paths, "get_user_preferences_path", return_value=Path("/tmp/user_preferences.md")):
- forward = build_system_prompt_injection(
- include_quick_replies=False,
- context=context,
- enabled_agents=enabled_agents,
- )
- reverse = build_system_prompt_injection(
- include_quick_replies=False,
- context=context,
- enabled_agents=reversed(enabled_agents),
- )
+ forward = build_system_prompt_injection(
+ include_quick_replies=False,
+ context=context,
+ enabled_agents=enabled_agents,
+ )
+ reverse = build_system_prompt_injection(
+ include_quick_replies=False,
+ context=context,
+ enabled_agents=reversed(enabled_agents),
+ )
self.assertEqual(forward, reverse)
self.assertLess(forward.index("| alpha |"), forward.index("| beta |"))
@@ -1662,19 +1638,18 @@ class ReplyEnhancerPlatformTests(unittest.IsolatedAsyncioTestCase):
platform_specific={"agent_session_id": "sesk8m4q2p7x"},
)
- with patch.object(paths, "get_user_preferences_path", return_value=Path("/tmp/user_preferences.md")):
- with patch("core.show_git.show_git_checkpointing_active", return_value=False):
- unavailable = build_system_prompt_injection(include_quick_replies=True, context=context)
- with (
- patch("core.show_git.show_git_checkpointing_active", return_value=True),
- patch("core.show_git._workspace_is_self_managed", return_value=False),
- ):
- managed = build_system_prompt_injection(include_quick_replies=True, context=context)
- with (
- patch("core.show_git.show_git_checkpointing_active", return_value=True),
- patch("core.show_git._workspace_is_self_managed", return_value=True),
- ):
- self_managed = build_system_prompt_injection(include_quick_replies=True, context=context)
+ with patch("core.show_git.show_git_checkpointing_active", return_value=False):
+ unavailable = build_system_prompt_injection(include_quick_replies=True, context=context)
+ with (
+ patch("core.show_git.show_git_checkpointing_active", return_value=True),
+ patch("core.show_git._workspace_is_self_managed", return_value=False),
+ ):
+ managed = build_system_prompt_injection(include_quick_replies=True, context=context)
+ with (
+ patch("core.show_git.show_git_checkpointing_active", return_value=True),
+ patch("core.show_git._workspace_is_self_managed", return_value=True),
+ ):
+ self_managed = build_system_prompt_injection(include_quick_replies=True, context=context)
self.assertEqual(managed, self_managed)
self.assertEqual(managed, unavailable)
@@ -1697,17 +1672,16 @@ class ReplyEnhancerPlatformTests(unittest.IsolatedAsyncioTestCase):
platform_specific={"agent_session_id": "sesk8m4q2p7x"},
)
- with patch.object(paths, "get_user_preferences_path", return_value=Path("/tmp/user_preferences.md")):
- missing_store_prompt = build_system_prompt_injection(
- include_quick_replies=False,
- context=context,
- enabled_agents=None,
- )
- empty_store_prompt = build_system_prompt_injection(
- include_quick_replies=False,
- context=context,
- enabled_agents=[],
- )
+ missing_store_prompt = build_system_prompt_injection(
+ include_quick_replies=False,
+ context=context,
+ enabled_agents=None,
+ )
+ empty_store_prompt = build_system_prompt_injection(
+ include_quick_replies=False,
+ context=context,
+ enabled_agents=[],
+ )
self.assertNotIn("### Agents", missing_store_prompt)
self.assertNotIn("### Agents", empty_store_prompt)
@@ -1724,10 +1698,7 @@ class ReplyEnhancerPlatformTests(unittest.IsolatedAsyncioTestCase):
platform_specific={"agent_session_id": "sesk8m4q2p7x"},
)
- with (
- patch.object(paths, "get_user_preferences_path", return_value=Path("/tmp/user_preferences.md")),
- patch("core.managed_skills.resolve_skills", return_value=_resolved_core_skills()),
- ):
+ with patch("core.managed_skills.resolve_skills", return_value=_resolved_core_skills()):
prompt = build_system_prompt_injection(
include_quick_replies=False,
context=context,
@@ -1772,10 +1743,7 @@ class ReplyEnhancerPlatformTests(unittest.IsolatedAsyncioTestCase):
disable_model_invocation=False,
),
]
- with (
- patch.object(paths, "get_user_preferences_path", return_value=Path("/tmp/user_preferences.md")),
- patch("core.managed_skills.resolve_skills", return_value=skills),
- ):
+ with patch("core.managed_skills.resolve_skills", return_value=skills):
prompt = build_system_prompt_injection(
include_quick_replies=False,
context=context,
@@ -1794,7 +1762,6 @@ class ReplyEnhancerPlatformTests(unittest.IsolatedAsyncioTestCase):
platform_specific={"agent_session_id": "sesk8m4q2p7x"},
)
with (
- patch.object(paths, "get_user_preferences_path", return_value=Path("/tmp/user_preferences.md")),
patch(
"core.managed_skills.resolve_skills",
return_value=_resolved_core_skills(manual_only=True),
@@ -1821,16 +1788,11 @@ class ReplyEnhancerPlatformTests(unittest.IsolatedAsyncioTestCase):
platform="avibe",
platform_specific={"agent_session_id": "sesk8m4q2p7x"},
)
- with patch.object(
- paths,
- "get_user_preferences_path",
- return_value=Path("/tmp/user_preferences.md"),
- ):
- prompt = build_system_prompt_injection(
- include_quick_replies=False,
- context=context,
- skills_cwd=None,
- )
+ prompt = build_system_prompt_injection(
+ include_quick_replies=False,
+ context=context,
+ skills_cwd=None,
+ )
self.assertIn("load the `use-show-pages` Skill", prompt)
self.assertNotIn("load the `use-avibe-vault` Skill", prompt)
@@ -1845,13 +1807,12 @@ class ReplyEnhancerPlatformTests(unittest.IsolatedAsyncioTestCase):
platform_specific={"is_dm": False},
)
- with patch.object(paths, "get_user_preferences_path", return_value=Path("/tmp/user_preferences.md")):
- with self.assertRaisesRegex(ValueError, "agent_session_id is required"):
- build_system_prompt_injection(
- include_quick_replies=True,
- context=context,
- fallback_platform="slack",
- )
+ with self.assertRaisesRegex(ValueError, "agent_session_id is required"):
+ build_system_prompt_injection(
+ include_quick_replies=True,
+ context=context,
+ fallback_platform="slack",
+ )
def test_prompt_handles_missing_platform_specific(self):
context = MessageContext(
@@ -1861,13 +1822,12 @@ class ReplyEnhancerPlatformTests(unittest.IsolatedAsyncioTestCase):
platform_specific=None,
)
- with patch.object(paths, "get_user_preferences_path", return_value=Path("/tmp/user_preferences.md")):
- with self.assertRaisesRegex(ValueError, "agent_session_id is required"):
- build_system_prompt_injection(
- include_quick_replies=True,
- context=context,
- fallback_platform="slack",
- )
+ with self.assertRaisesRegex(ValueError, "agent_session_id is required"):
+ build_system_prompt_injection(
+ include_quick_replies=True,
+ context=context,
+ fallback_platform="slack",
+ )
def test_file_links_with_parentheses_are_preserved(self):
enhanced = process_reply("![video](file:///Users/test/SaveTwitter.Net_GABV3XNWYAARAZz(gif).mp4)")
diff --git a/tests/test_v2_paths.py b/tests/test_v2_paths.py
index ab13a5166..083a941e4 100644
--- a/tests/test_v2_paths.py
+++ b/tests/test_v2_paths.py
@@ -11,7 +11,6 @@ def test_paths_are_under_home():
assert paths.get_settings_path().parent == paths.get_state_dir()
assert paths.get_sessions_path().parent == paths.get_state_dir()
assert paths.get_discovered_chats_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):
@@ -22,14 +21,8 @@ def test_ensure_data_dirs(tmp_path, monkeypatch):
assert (tmp_path / ".avibe" / "logs").exists()
assert (tmp_path / ".avibe" / "runtime").exists()
assert (tmp_path / ".avibe" / "attachments").exists()
- preferences_path = tmp_path / ".avibe" / "state" / "user_preferences.md"
- assert preferences_path.exists()
- text = preferences_path.read_text(encoding="utf-8")
- assert "# User Context and Preferences" in text
- assert "Prefer adding notes under `## Users`." in text
- assert "### platform/user_id" in text
- assert "communicate, work, and make decisions." in text
- assert "free of secrets unless the user explicitly asks." in text
+ # The shared preferences file is retired: Avibe no longer creates it.
+ assert not (tmp_path / ".avibe" / "state" / "user_preferences.md").exists()
def test_avibe_home_env_sets_custom_home(tmp_path, monkeypatch):
diff --git a/tests/test_vibey_agent.py b/tests/test_vibey_agent.py
index 6f0c6cba0..17bd216cd 100644
--- a/tests/test_vibey_agent.py
+++ b/tests/test_vibey_agent.py
@@ -532,8 +532,6 @@ async def test_a_turn_commits_its_context_once_and_shows_the_reply_once(
assert environment.text.startswith("<environment>\ncwd: ") and typed == TextBlock(text="看一下目录")
# The shell is the one the commands run in, the job host's, not the user's login shell.
assert f"\nshell: {harness.suite.shell}\n" in environment.text
- # The clock fields follow include_time_info (off here), as every input prefix does.
- assert "date:" not in environment.text and "timezone:" not in environment.text
# The steer identity existed when the Turn owner bound the native start.
[native] = harness.controller.started
assert native.startswith("vibey:") and native.endswith(f":{_turn(request.context)}")
diff --git a/tests/test_vibey_agent_context.py b/tests/test_vibey_agent_context.py
index b3c2d04ac..5979c7112 100644
--- a/tests/test_vibey_agent_context.py
+++ b/tests/test_vibey_agent_context.py
@@ -419,18 +419,16 @@ async def test_the_state_is_the_environment_core_fields_each_bounded_in_bytes(en
fields = {
"cwd": "/工作/" + "目录/" * 1_000,
"os": "macOS " + "x" * 5_000,
- "shell": "/bin/" + "s" * 5_000,
- "date": "2026-10-05",
- "timezone": "Zone/" + "時" * 2_000,
+ "shell": "/bin/" + "時" * 2_000,
"watches": 'wd_1 "CI" command running',
}
host = VibeyContextHost(engine, environment=lambda _: fields)
(environment,) = await host.render_state(StateRequest(SESSION))
lines = environment.splitlines()[1:-1]
- assert [line.split(": ", 1)[0] for line in lines] == ["cwd", "os", "shell", "date", "timezone"]
+ assert [line.split(": ", 1)[0] for line in lines] == ["cwd", "os", "shell"]
assert lines[0] == f"cwd: {fields['cwd']}"
assert all(len(line.split(": ", 1)[1].encode()) <= 160 for line in lines[1:])
- assert text_tokens(environment) <= (len(fields["cwd"].encode()) + 4 * 160 + 80) // 4
+ assert text_tokens(environment) <= (len(fields["cwd"].encode()) + 2 * 160 + 80) // 4
async def test_a_3000_byte_cwd_is_kept_whole_on_every_input_and_in_the_state(engine, session):
@@ -464,6 +462,20 @@ async def test_two_values_that_look_alike_once_cut_are_still_two_environments(en
assert second.startswith("<environment>\nshell: ") # ... yet the second input says the shell changed
+def test_a_block_stored_with_the_retired_clock_fields_still_replays(tmp_path):
+ from core.agent_core.harness.store import ContextEntry
+ from modules.agents.vibey.prompt import current_environment, environment_delta, environment_state, operating_system
+
+ # Blocks stored while the block still had date and timezone (every input's [Now: ...] line carries them now)
+ # replay as what the model was told: those lines are ignored, and the next input repeats nothing unchanged.
+ stored = (
+ f"<environment>\ncwd: {tmp_path.resolve()}\nos: {operating_system()}\nshell: /bin/bash\n"
+ "date: 2026-10-05\ntimezone: Asia/Shanghai\nwatches: none\n</environment>"
+ )
+ entry = ContextEntry(SESSION, 1, "input", "msg_1", UserMessage(content=(text(stored), text("hello"))))
+ assert environment_delta(environment_state([entry]), current_environment(str(tmp_path), [], shell="/bin/bash")) == {}
+
+
async def test_every_skill_a_successful_bash_result_loaded_is_recorded():
# The record is what `vibe skill load` wrote into the result: a compound command, quoting, and a path to `vibe`
# do not matter. A failed command, one that loaded nothing, or a tag with a name no skill can have (any output,
@@ -660,7 +672,7 @@ async def test_the_mind_is_revised_in_the_session_s_scratch_and_a_cut_one_points
]
)
await _turn(harness, tokens(23_700))
- await _turn(harness, tokens(26_000))
+ await _turn(harness, tokens(26_500))
(compaction,) = [row for row in await harness.context_rows() if row.kind == "compaction"]
assert compaction.payload["mind_truncated"] and agreements in compaction.payload["mind"]
(copy,) = (state / "checkpoints" / SESSION).iterdir()