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.

docs(watch): steer skill and prompt to vibe watch

cyh5596677ee13e
diff --git a/core/reply_enhancer.py b/core/reply_enhancer.py
index 8a3ae0140..d4b50a587 100644
--- a/core/reply_enhancer.py
+++ b/core/reply_enhancer.py
@@ -189,10 +189,10 @@ Rules:
_SCHEDULED_TASKS_PROMPT = """\
-## 3. Scheduled tasks and hooks
-Use `vibe task add` for actions that should recur or remain saved.
-Use `vibe hook send --session-key ... --prompt ...` for one-shot asynchronous sends without storing a task.
-Use `vibe watch add` when a background waiter should stay managed by Vibe Remote until it emits a follow-up hook.
+## 3. Scheduled tasks, watches, and hooks
+Use `vibe task add` for saved work that should run later on a schedule or at one exact time.
+Use `vibe watch add` for managed background waiters that should keep running until a condition is met and then send a follow-up.
+Use `vibe hook send --session-key ... --prompt ...` for one-shot asynchronous sends without saving a task or watch.
Current conversation targeting:
- Default session key: `{session_key}`
@@ -201,12 +201,14 @@ Current conversation targeting:
Rules:
- The default session key intentionally does not include a thread ID.
- Only append `::thread::<thread_id>` to `--session-key` when the user explicitly wants replies to stay in the current thread.
-- Use `--post-to channel` when the task or hook should keep thread context but publish to the parent channel.
+- Use `--post-to channel` when the task, watch, or hook should keep thread context but publish to the parent channel.
- Use `--cron "<expr>"` for recurring tasks or `--at "<ISO-8601>"` for one-off stored tasks.
+- Use `vibe watch list`, `vibe watch show`, `vibe watch pause`, `vibe watch resume`, and `vibe watch remove` to manage background work after creation.
+- Prefer `vibe watch add` over ad-hoc `nohup` or shell-detached jobs when the user wants a managed background task.
- Use `--timeout <seconds>` on watches for per-cycle timeouts, and `--lifetime-timeout <seconds>` only when a forever watch also needs an overall lifetime cap.
- If `--timezone` is omitted, the task uses the local system timezone at creation time.
- Use `--prompt "..."` or `--prompt-file <path>` for task and hook content.
-- Run `vibe task add --help`, `vibe hook send --help`, or `vibe watch add --help` for the full command reference.
+- Run `vibe task add --help`, `vibe watch add --help`, or `vibe hook send --help` for the full command reference.
"""
diff --git a/skills/background-watch-hook/SKILL.md b/skills/background-watch-hook/SKILL.md
index e9d100c5e..ff2e3b739 100644
--- a/skills/background-watch-hook/SKILL.md
+++ b/skills/background-watch-hook/SKILL.md
@@ -1,8 +1,8 @@
---
name: background-watch-hook
slug: background-watch-hook
-description: Start a background waiter that returns to the same conversation later. Use when the agent needs to wait for reviews, CI, files, logs, or process completion without blocking the current turn.
-version: 0.4.0
+description: Use `vibe watch` to run a background waiter that returns to the same conversation later. Best for reviews, CI, files, logs, and other wait-now-continue-later workflows.
+version: 0.5.0
---
# Background Watch Hook
@@ -11,9 +11,9 @@ Use this skill when the job is "wait now, continue later in the same conversatio
What it gives the agent:
-- the ability to stop manual polling
-- a reusable way to come back to the same channel or thread later
-- a small pattern that works for many external events, not just GitHub
+- a managed background task instead of manual polling
+- a clean way to come back to the same channel or thread later
+- a reusable pattern that works for reviews, CI, files, logs, and process completion
Good trigger scenarios:
@@ -21,20 +21,20 @@ Good trigger scenarios:
- CI, deployments, or exports need time to finish
- a file, log line, or process exit should wake the agent up later
-Do not build a new scheduler or event system when this pattern is enough.
+Prefer `vibe watch` when the wait should be inspectable, pausable, resumable, or removable later.
## Main Tools
-- `scripts/watch_then_hook.sh`
- Main entrypoint. Starts a waiter in the background by default, captures its final `stdout`, and sends one follow-up back to the target session.
-- `scripts/watch_github_pr_then_hook.sh`
- Thin convenience wrapper for one common case: GitHub PR review activity.
+- `vibe watch add`
+ Main entrypoint. Starts a managed background watch and sends a follow-up hook after the waiter succeeds or times out.
+- `vibe watch list`, `vibe watch show`, `vibe watch pause`, `vibe watch resume`, `vibe watch remove`
+ Use these to inspect and manage the watch after creation.
- `scripts/wait_for_github_pr_activity.py`
- Bundled waiter example used by the GitHub wrapper.
+ Bundled waiter example for one common case: GitHub PR review activity.
## Core Pattern
-Use the generic wrapper first. Most tasks only need:
+Use `vibe watch add` first. Most tasks only need:
1. the target `session_key`
2. a short action-oriented prefix
@@ -43,9 +43,10 @@ Use the generic wrapper first. Most tasks only need:
Generic shape:
```bash
-scripts/watch_then_hook.sh \
+vibe watch add \
--session-key "<session-key>" \
--prefix "<what the next turn should do>" \
+ --name "<optional label>" \
-- \
<waiter command ...>
```
@@ -53,11 +54,11 @@ scripts/watch_then_hook.sh \
Default behavior:
- returns immediately
-- keeps the waiter in the background
-- sends a follow-up only after the waiter succeeds
-- sends a timeout follow-up if the waiter times out
+- keeps the waiter managed by Vibe Remote
+- lets the agent inspect or stop the watch later
+- sends a follow-up after the waiter succeeds or times out
-Add `--foreground` only when you explicitly want the low-level synchronous primitive.
+Use `--forever` when the same waiter should re-arm after each detected event instead of exiting after one follow-up.
## Waiter Contract
@@ -77,8 +78,9 @@ Keep the output split clean:
Delay:
```bash
-scripts/watch_then_hook.sh \
+vibe watch add \
--session-key "slack::channel::C123::thread::171717.123" \
+ --name "Delay callback" \
--prefix "The delayed check completed. Continue from the result below." \
-- \
bash -lc 'sleep 120; echo "Timer finished after 120 seconds."'
@@ -87,8 +89,9 @@ scripts/watch_then_hook.sh \
File appears:
```bash
-scripts/watch_then_hook.sh \
+vibe watch add \
--session-key "slack::channel::C123::thread::171717.123" \
+ --name "Wait for export file" \
--prefix "The export file is ready. Inspect it and continue." \
-- \
bash -lc 'while [ ! -f /tmp/export.json ]; do sleep 10; done; echo "Detected /tmp/export.json"'
@@ -97,9 +100,11 @@ scripts/watch_then_hook.sh \
Log match:
```bash
-scripts/watch_then_hook.sh \
+vibe watch add \
--session-key "slack::channel::C123::thread::171717.123" \
+ --name "Watch app log" \
--prefix "The expected log pattern appeared. Inspect the event and continue." \
+ --forever \
-- \
bash -lc 'tail -Fn0 /tmp/app.log | while read -r line; do case "$line" in *READY*) echo "$line"; break;; esac; done'
```
@@ -116,54 +121,63 @@ If the current turn does not expose a usable target, ask instead of guessing.
## Timeout And Lifecycle
-For the generic wrapper:
+For `vibe watch add`:
-- `--timeout` is the waiter timeout
+- `--timeout` is the waiter timeout for one cycle
- default is `21600` seconds
-- `0` means no timeout
-
-For the GitHub convenience wrapper:
-
-- `--timeout` is still the timeout for one waiter cycle
+- `0` means no per-cycle timeout
- `--forever` means re-arm after each detected event
- `--lifetime-timeout` limits the whole long-running watch; default is `0` meaning run until killed
-This separation matters: a forever watcher can still use a bounded timeout for each polling cycle.
+This separation matters: a forever watch can still use a bounded timeout for each cycle.
-## GitHub Convenience Wrapper
+## GitHub Example Waiter
-Use the GitHub wrapper only when the watched thing is PR review activity.
+Use the bundled GitHub waiter only when the watched thing is PR review activity.
One-shot watch:
```bash
-scripts/watch_github_pr_then_hook.sh \
+vibe watch add \
--session-key "slack::channel::C123::thread::171717.123" \
- --repo cyhhao/vibe-remote \
- --pr 151 \
- --interval 60
+ --name "Watch PR 151 reviews" \
+ --prefix "PR #151 has new review activity. Fetch the latest review state, summarize actionable items, and continue handling them if needed." \
+ -- \
+ python3 skills/background-watch-hook/scripts/wait_for_github_pr_activity.py \
+ --repo cyhhao/vibe-remote \
+ --pr 151 \
+ --interval 60
```
Catch up on existing activity first:
```bash
-scripts/watch_github_pr_then_hook.sh \
+vibe watch add \
--session-key "slack::channel::C123::thread::171717.123" \
- --repo cyhhao/vibe-remote \
- --pr 151 \
- --catch-up
+ --name "Catch up PR 151 reviews" \
+ --prefix "PR #151 already has review activity. Fetch the latest review state and continue handling it if needed." \
+ -- \
+ python3 skills/background-watch-hook/scripts/wait_for_github_pr_activity.py \
+ --repo cyhhao/vibe-remote \
+ --pr 151 \
+ --catch-up
```
Stay armed for future activity:
```bash
-scripts/watch_github_pr_then_hook.sh \
+vibe watch add \
--session-key "slack::channel::C123::thread::171717.123" \
- --repo cyhhao/vibe-remote \
- --pr 151 \
+ --name "Monitor PR 151 reviews" \
--forever \
--timeout 21600 \
- --lifetime-timeout 86400
+ --lifetime-timeout 86400 \
+ --prefix "PR #151 has new review activity. Fetch the latest review state, summarize actionable items, and continue handling them if needed." \
+ -- \
+ python3 skills/background-watch-hook/scripts/wait_for_github_pr_activity.py \
+ --repo cyhhao/vibe-remote \
+ --pr 151 \
+ --interval 60
```
GitHub-specific notes:
@@ -176,5 +190,6 @@ GitHub-specific notes:
## Practical Advice
- Keep prefixes action-oriented. Tell the next turn what to do with the waiter result.
-- Prefer the generic wrapper in the skill body. Treat GitHub as just one example.
-- If the execution host reaps detached children, run `--foreground` inside a long-lived terminal session instead of relying on background detaching.
+- Prefer `vibe watch` over ad-hoc detached shells when the wait should survive the current turn cleanly.
+- Treat GitHub as just one example waiter, not the main point of the skill.
+- If a watch is no longer useful, remove it instead of leaving stale background work behind.
diff --git a/tests/test_reply_enhancer_platform.py b/tests/test_reply_enhancer_platform.py
index 60019a103..f58113787 100644
--- a/tests/test_reply_enhancer_platform.py
+++ b/tests/test_reply_enhancer_platform.py
@@ -87,7 +87,7 @@ class ReplyEnhancerPlatformTests(unittest.IsolatedAsyncioTestCase):
self.assertIn("`/tmp/user_preferences.md`", prompt)
self.assertIn("`<platform>/<user_id>`", prompt)
- def test_prompt_includes_scheduled_task_usage_with_threadless_default_session_key(self):
+ def test_prompt_includes_task_watch_and_hook_usage_with_threadless_default_session_key(self):
context = MessageContext(
user_id="U1",
channel_id="C1",
@@ -99,19 +99,27 @@ class ReplyEnhancerPlatformTests(unittest.IsolatedAsyncioTestCase):
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 and hooks", prompt)
+ self.assertIn("## 3. Scheduled tasks, watches, and hooks", prompt)
self.assertIn("`vibe task add`", prompt)
self.assertIn("`vibe hook send --session-key ... --prompt ...`", prompt)
self.assertIn("`vibe watch add`", prompt)
- self.assertIn("Use `vibe task add` for actions that should recur or remain saved.", prompt)
+ self.assertIn("Use `vibe task add` for saved work that should run later on a schedule or at one exact time.", prompt)
self.assertIn(
- "Use `vibe watch add` when a background waiter should stay managed by Vibe Remote until it emits a follow-up hook.",
+ "Use `vibe watch add` for managed background waiters that should keep running until a condition is met and then send a follow-up.",
prompt,
)
self.assertIn("Default session key: `slack::channel::C1`", prompt)
self.assertIn("Current thread ID: `171717.123`", prompt)
self.assertIn(
- "Use `--post-to channel` when the task or hook should keep thread context but publish to the parent channel.",
+ "Use `--post-to channel` when the task, watch, or hook should keep thread context but publish to the parent channel.",
+ prompt,
+ )
+ self.assertIn(
+ "Use `vibe watch list`, `vibe watch show`, `vibe watch pause`, `vibe watch resume`, and `vibe watch remove` to manage background work after creation.",
+ prompt,
+ )
+ self.assertIn(
+ "Prefer `vibe watch add` over ad-hoc `nohup` or shell-detached jobs when the user wants a managed background task.",
prompt,
)
self.assertIn(
@@ -120,7 +128,7 @@ class ReplyEnhancerPlatformTests(unittest.IsolatedAsyncioTestCase):
)
self.assertIn("If `--timezone` is omitted, the task uses the local system timezone at creation time.", prompt)
self.assertIn(
- "Run `vibe task add --help`, `vibe hook send --help`, or `vibe watch add --help` for the full command reference.",
+ "Run `vibe task add --help`, `vibe watch add --help`, or `vibe hook send --help` for the full command reference.",
prompt,
)
self.assertIn("A shared user context and preferences file is available at ", prompt)