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(cli): add visible session sugar (#969)
Call Whitea92748c75e3a
diff --git a/core/system_prompt_injection.py b/core/system_prompt_injection.pyindex 496058225..e319800bf 100644--- a/core/system_prompt_injection.py+++ b/core/system_prompt_injection.py@@ -251,13 +251,13 @@ Useful Harness queries include schema discovery, current session lookup, existin`vibe watch add` creates a managed monitor, usually backed by a small script or command, for any observable condition that must be watched until true: product signals, business events, files, logs, CI/reviews/deploys, service health, data freshness, and similar signals. Watches created from an Avibe Agent shell follow up in this conversation by default. If `--cwd` is omitted, Avibe runs the waiter from the caller working directory when available.-Use `vibe agent run --agent <agent-name> --message ...` when one Agent delegates work to another Agent. By default this creates a background Session in the caller's scope, returns immediately, and sends the final result back to this conversation. Outside an Agent shell, a caller-less run creates a standalone background Session with its own Show workspace. Avibe records caller provenance for both async and `--sync` runs. Pass `--visibility foreground` only when the new Session should deliver outward. Pass `--sync` only when the current process must wait for the result. Pass `--no-callback` only when you intentionally want no automatic follow-up and will inspect the run later; pass `--callback-session-id <id>` only to route the final result elsewhere. Add `--same-scope` to require the caller/source scope. Add `--scope-id <scopes.id>` only when placing the new Session in a specific existing scope.+Use `vibe agent run --agent <agent-name> --message ...` when one Agent delegates work to another Agent. By default this creates a background Session in the caller's scope and returns immediately; when the run completes, the final result is sent back to this conversation. Background Sessions stay out of the session list and never deliver outward, but remain visible in the Agents run graph, where the user can open their full chat history or promote them at any time. Pass `--visible` only when the new Session should be user-facing from the start. Pass `--sync` only when the current process must wait for the result. Pass `--no-callback` only when you intentionally want no automatic follow-up and will inspect the run later; pass `--callback-session-id <id>` only to route the final result elsewhere. Add `--scope-id <scopes.id>` only when placing the new Session in a specific existing scope.Use `vibe agent run --fork-self --message ...` when work should branch from this current Session's native backend context without mutating it. Use `--fork-session <source-session-id>` only when branching from a different explicit Session. Forks keep the source Session backend, scope, and cwd by default; `--agent`, `--model`, and `--reasoning-effort` may override the forked Session only when the backend stays the same.When `vibe agent run --session-id <id>` targets an existing Session, it sends a new message into that Session. It does not change that Session's cwd, scope, Agent, model, or reasoning settings; those properties belong to the Session itself. Use a new Session or a fork when those properties need to differ.-Use `vibe session update --visibility foreground|background` to promote or hide a persisted Session independently of its scope. Use `--scope-id <scopes.id>` to move it to another scope or `--scope-id none` to make it standalone; moving scope never changes its stored workdir.+Use `vibe session update --visible|--hidden` (`--visibility foreground|background`) to promote or hide a persisted Session independently of its scope. Use `--scope-id <scopes.id>` to move it to another scope or `--scope-id none` to make it standalone; moving scope never changes its stored workdir.For tasks, use `--message "..."` or `--message-file <path>` as the stored message. For watches, use `--message "..."` or `--message-file <path>` as the follow-up instruction template sent with waiter output. Prefer `--same-scope` or `--scope-id <scopes.id>` for new Session placement.diff --git a/tests/test_cli_task_command.py b/tests/test_cli_task_command.pyindex ccbac5e53..90c321d72 100644--- a/tests/test_cli_task_command.py+++ b/tests/test_cli_task_command.py@@ -285,6 +285,7 @@ def test_agent_run_help_includes_fork_session_guidance(capsys) -> None:assert "--sync" in captured.outassert "--same-scope" in captured.outassert "--scope-id" in captured.out+ assert "--visible" in captured.outassert "--deliver-key" not in captured.outassert "Avibe Agent shell examples:" in captured.outassert "Normal terminal examples:" in captured.out@@ -294,7 +295,7 @@ def test_agent_run_help_includes_fork_session_guidance(capsys) -> None:assert "Agent runs are async by default. From an Avibe Agent shell, they return their final result to this conversation by default." in captured.outassert "vibe agent run --agent release-reviewer --message 'Review the latest deployment result.'" in captured.outassert (- "vibe agent run --agent release-reviewer --same-scope --message 'Review this project in a visible sibling Session.'"+ "vibe agent run --agent release-reviewer --visible --message 'Review this project in a visible sibling Session.'"in captured.out)assert (@@ -323,6 +324,37 @@ def test_agent_run_rejects_async_and_sync_together(capsys) -> None:assert "not allowed with argument --async" in payload["error"]+def test_agent_run_visible_sugar_sets_foreground_visibility() -> None:+ args = _parse_agent_run(["--agent", "worker", "--visible", "--message", "hello"])++ assert args.visibility == "foreground"+++def test_agent_run_visible_conflicts_with_explicit_visibility(capsys) -> None:+ parser = cli.build_parser()++ with pytest.raises(SystemExit) as exc:+ parser.parse_args(+ [+ "agent",+ "run",+ "--agent",+ "worker",+ "--visible",+ "--visibility",+ "background",+ "--message",+ "hello",+ ]+ )++ assert exc.value.code == 2+ payload = json.loads(capsys.readouterr().err)+ assert payload["code"] == "invalid_arguments"+ assert "--visibility" in payload["error"]+ assert "--visible" in payload["error"]++def test_agent_run_runtime_rejects_async_and_sync_together() -> None:args = SimpleNamespace(agent="worker",diff --git a/tests/test_reply_enhancer_platform.py b/tests/test_reply_enhancer_platform.pyindex 1f2ebe329..2ca410ae5 100644--- a/tests/test_reply_enhancer_platform.py+++ b/tests/test_reply_enhancer_platform.py@@ -424,11 +424,21 @@ class ReplyEnhancerPlatformTests(unittest.IsolatedAsyncioTestCase):self.assertIn("Watches created from an Avibe Agent shell follow up in this conversation by default", prompt)self.assertIn("`vibe watch add` creates a managed monitor", prompt)self.assertIn("product signals, business events, files, logs, CI/reviews/deploys", prompt)- self.assertIn("Use `vibe agent run --agent <agent-name> --message ...` when one Agent delegates work", prompt)- self.assertIn("creates a background Session in the caller's scope, returns immediately", prompt)- self.assertIn("a caller-less run creates a standalone background Session with its own Show workspace", prompt)+ delegate_guidance = (+ "Use `vibe agent run --agent <agent-name> --message ...` when one Agent delegates work to another Agent. "+ "By default this creates a background Session in the caller's scope and returns immediately; when the run "+ "completes, the final result is sent back to this conversation. Background Sessions stay out of the session "+ "list and never deliver outward, but remain visible in the Agents run graph, where the user can open their "+ "full chat history or promote them at any time. Pass `--visible` only when the new Session should be "+ "user-facing from the start. Pass `--sync` only when the current process must wait for the result. Pass "+ "`--no-callback` only when you intentionally want no automatic follow-up and will inspect the run later; "+ "pass `--callback-session-id <id>` only to route the final result elsewhere. Add `--scope-id <scopes.id>` "+ "only when placing the new Session in a specific existing scope."+ )+ self.assertIn(delegate_guidance, prompt)+ self.assertNotIn("Outside an Agent shell, a caller-less run", prompt)self.assertIn("Pass `--sync` only when the current process must wait for the result", prompt)- self.assertIn("Add `--same-scope` to require the caller/source scope", prompt)+ self.assertNotIn("Add `--same-scope` to require the caller/source scope", prompt)self.assertIn("Use `vibe agent run --fork-self --message ...` when work should branch from this current Session", prompt)self.assertIn("Forks keep the source Session backend, scope, and cwd by default", prompt)self.assertIn("It does not change that Session's cwd, scope, Agent, model, or reasoning settings", prompt)@@ -452,7 +462,10 @@ class ReplyEnhancerPlatformTests(unittest.IsolatedAsyncioTestCase):self.assertIn("Use the `Agent Name` value exactly as listed in shell commands", prompt)self.assertIn("`--session-id <id>` resumes that exact Agent Session and its transcript, backend identity, Show Page, and routing", prompt)self.assertIn("Without `--session-id`, `--fork-self`, or `--fork-session`, `vibe agent run --agent <agent-name>` creates a separate background Session", prompt)- self.assertIn("Use `vibe session update --visibility foreground|background`", prompt)+ self.assertIn(+ "Use `vibe session update --visible|--hidden` (`--visibility foreground|background`)",+ prompt,+ )self.assertIn("`--fork-self` creates a new Agent Session from this current Session's native backend context", prompt)self.assertIn("`--fork-session <id>` creates a new Agent Session from that explicit source Session's native backend context", prompt)self.assertIn("vibe agent run --agent <agent-name> --message ...", prompt)diff --git a/tests/test_session_cli.py b/tests/test_session_cli.pyindex c7ff37c5a..57bcd9be1 100644--- a/tests/test_session_cli.py+++ b/tests/test_session_cli.py@@ -2,6 +2,8 @@ from __future__ import annotationsimport json+import pytest+from config import pathsfrom storage.db import create_sqlite_enginefrom storage.importer import ensure_sqlite_state@@ -243,6 +245,49 @@ def test_update_empty_title_clears(monkeypatch, tmp_path, capsys):assert payload["session"]["title"] is None+def test_update_help_teaches_visibility_sugar(capsys):+ parser = cli.build_parser()++ with pytest.raises(SystemExit) as exc:+ parser.parse_args(["session", "update", "--help"])++ assert exc.value.code == 0+ help_text = capsys.readouterr().out+ assert "--visible" in help_text+ assert "--hidden" in help_text+ assert "--visibility {foreground,background}" in help_text+++ ("flag", "expected"),+ [("--visible", "foreground"), ("--hidden", "background")],+)+def test_update_visibility_sugar_parses(flag, expected):+ args = cli.build_parser().parse_args(["session", "update", "sesaaa", flag])++ assert args.visibility == expected+++ "visibility_args",+ [+ ["--visible", "--hidden"],+ ["--visible", "--visibility", "background"],+ ["--hidden", "--visibility", "foreground"],+ ],+)+def test_update_visibility_sugar_rejects_conflicts(visibility_args, capsys):+ parser = cli.build_parser()++ with pytest.raises(SystemExit) as exc:+ parser.parse_args(["session", "update", "sesaaa", *visibility_args])++ assert exc.value.code == 2+ payload = json.loads(capsys.readouterr().err)+ assert payload["code"] == "invalid_arguments"+ assert "not allowed with argument" in payload["error"]++def test_update_visibility_and_make_standalone_keeps_workdir(monkeypatch, tmp_path, capsys):engine = _setup(monkeypatch, tmp_path)original_scope_id = _seed(engine, "sesaaa", title="Old")diff --git a/vibe/cli.py b/vibe/cli.pyindex 3d755fe51..2653958ea 100644--- a/vibe/cli.py+++ b/vibe/cli.py@@ -1048,7 +1048,7 @@ def _agent_run_examples_text() -> str:Inside an Agent shell it inherits the caller scope and invocation cwd; outside one it is standalone with its own Show workspace.Use --same-scope to explicitly place a new Session in the caller/source Session's scope.Use --scope-id <scopes.id> to place a new Session in a specific existing scope.- New and forked delegated Sessions default to --visibility background; pass foreground to enable outward delivery.+ New and forked delegated Sessions are background by default; pass --visible to make them user-facing and enable outward delivery.--cwd only applies to new Sessions; existing Sessions keep their own cwd.Callback:@@ -1067,7 +1067,7 @@ def _agent_run_examples_text() -> str:Avibe Agent shell examples:vibe agent run --agent release-reviewer --message 'Review the latest deployment result.'- vibe agent run --agent release-reviewer --same-scope --message 'Review this project in a visible sibling Session.'+ vibe agent run --agent release-reviewer --visible --message 'Review this project in a visible sibling Session.'Normal terminal examples:vibe agent run --sync --agent release-reviewer --message 'Review the latest CI result and print it here.'@@ -3553,9 +3553,9 @@ def _validate_run_session_policy(args, *, help_command: str) -> str:)if session_id and visibility:raise TaskCliError(- "--visibility only applies when creating or forking a Session",+ "visibility options only apply when creating or forking a Session",code="visibility_with_existing_session",- hint="Use `vibe session update --visibility ...` to change an existing Session.",+ hint="Use `vibe session update --visible|--hidden` (or `--visibility ...`) to change an existing Session.",help_command=help_command,)if session_id and (create_session or create_per_run):@@ -4788,7 +4788,7 @@ def cmd_session_update(args):raise TaskCliError("no update field supplied",code="missing_session_update",- hint="Pass --title, --visibility, or --scope-id.",+ hint="Pass --title, --visible/--hidden, --visibility, or --scope-id.",help_command="vibe session update --help",)session_id, session_default_notice = _resolve_caller_session_id(@@ -11926,11 +11926,19 @@ def build_parser():agent_run_parser.add_argument("--create-session-per-run", action="store_true", help=argparse.SUPPRESS)agent_run_parser.add_argument("--same-scope", action="store_true", help="Place a new or forked Session in the caller/source Session scope")agent_run_parser.add_argument("--scope-id", help="Existing scopes.id that should own the new or forked Session")- agent_run_parser.add_argument(+ agent_visibility_group = agent_run_parser.add_mutually_exclusive_group()+ agent_visibility_group.add_argument("--visibility",choices=("foreground", "background"),help="Visibility for the new or forked Session (default: background)",)+ agent_visibility_group.add_argument(+ "--visible",+ dest="visibility",+ action="store_const",+ const="foreground",+ help="Make the new or forked Session user-facing from the start",+ )agent_run_parser.add_argument("--deliver-key", help=argparse.SUPPRESS)agent_run_parser.add_argument("--model", help="Model override for the new forked Session")agent_run_parser.add_argument("--reasoning-effort", help="Reasoning effort override for the new forked Session")@@ -12042,11 +12050,26 @@ def build_parser():session_update_parser.add_argument("--title", help="New title. Pass an empty string to clear it (reverts to id-based display).")- session_update_parser.add_argument(+ session_visibility_group = session_update_parser.add_mutually_exclusive_group()+ session_visibility_group.add_argument("--visibility",choices=("foreground", "background"),help="Show the Session in normal chat lists or keep it background-only.",)+ session_visibility_group.add_argument(+ "--visible",+ dest="visibility",+ action="store_const",+ const="foreground",+ help="Promote the Session into normal chat lists.",+ )+ session_visibility_group.add_argument(+ "--hidden",+ dest="visibility",+ action="store_const",+ const="background",+ help="Hide the Session from normal chat lists and suppress outward delivery.",+ )session_update_parser.add_argument("--scope-id",help="Move to an existing scopes.id, or pass 'none' to make the Session standalone.",