-
Notifications
You must be signed in to change notification settings - Fork 1
Add wait skill and AI writing guard #101
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| --- | ||
| name: wait | ||
| description: Pause execution for a requested number of minutes by sleeping one-minute increments to avoid exceeding shell timeouts. | ||
| user_invocable: true | ||
| triggers: | ||
| - /wait | ||
| - wait | ||
| --- | ||
|
|
||
| # Wait Skill | ||
|
|
||
| Use this skill whenever the user asks the assistant to pause or wait for a few minutes during a task. Instead of issuing a single long `sleep` command (which often hits the 2-minute shell timeout), run one-minute sleeps repeatedly for the requested duration. | ||
|
|
||
| ## Workflow | ||
|
|
||
| 1. **Determine the wait time.** Parse the user’s request for a duration expressed in minutes. If the request is vague, ask a clarifying question (e.g., “How many minutes should I wait?”) before running commands. | ||
| 2. **Enforce sane limits.** If the user requests a very large number of minutes, warn them and offer to break the wait into smaller chunks or confirm before proceeding. | ||
| 3. **Execute sequential Bash sleeps.** For each of the requested N minutes, issue a separate `bash` tool call with `sleep 60`. Before each call, report the upcoming iteration as `executing sleep: i/N: bash sleep 60` so observers know how many sleeps will run. Avoid bundling the sleeps into a single script; the goal is to keep every sleeping command under the 2-minute timeout. | ||
|
|
||
| 4. **Report completion.** Once the loop finishes, notify the user that the wait is over and resume the primary task. | ||
|
|
||
| ## Error handling | ||
|
|
||
| - If the shell command fails (e.g., `sleep` unavailable), report the failure and stop waiting. | ||
| - If the user changes their mind mid-wait, cancel the remaining iterations and explain how much time was actually spent waiting. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,101 @@ | ||
| from __future__ import annotations | ||
|
|
||
| import pathlib | ||
| from collections.abc import Iterable, Sequence | ||
|
|
||
| REPO_ROOT = pathlib.Path(__file__).resolve().parent.parent | ||
| EM_DASH = chr(0x2014) | ||
| ROOT_SKIP_DIRS = { | ||
| ".git", | ||
| ".venv", | ||
| ".uv_cache", | ||
| ".uv-cache", | ||
| ".uv_tools", | ||
| ".uv-tools", | ||
| ".cache", | ||
| "node_modules", | ||
| ".next", | ||
| } | ||
| RECURSIVE_SKIP_DIRS = {"__pycache__", ".pytest_cache"} | ||
| SKIP_PATH_PREFIXES = { | ||
| ("docs", ".next"), | ||
| ("docs", "node_modules"), | ||
| } | ||
| SKIP_SUFFIXES = { | ||
| ".png", | ||
| ".jpg", | ||
| ".jpeg", | ||
| ".gif", | ||
| ".webp", | ||
| ".ico", | ||
| ".mp4", | ||
| ".mov", | ||
| ".mp3", | ||
| ".woff", | ||
| ".woff2", | ||
| ".ttf", | ||
| ".otf", | ||
| ".eot", | ||
| ".pdf", | ||
| ".zip", | ||
| ".tar", | ||
| ".gz", | ||
| ".bz2", | ||
| ".7z", | ||
| ".ckpt", | ||
| ".bin", | ||
| ".pyc", | ||
| ".pyo", | ||
| ".db", | ||
| } | ||
|
|
||
|
|
||
| def iter_text_files(root: pathlib.Path) -> Iterable[pathlib.Path]: | ||
| for path in root.rglob("*"): | ||
| if not path.is_file(): | ||
| continue | ||
| rel = path.relative_to(root) | ||
| rel_parts = rel.parts | ||
| if rel_parts and rel_parts[0] in ROOT_SKIP_DIRS: | ||
| continue | ||
| if any(rel_parts[: len(prefix)] == prefix for prefix in SKIP_PATH_PREFIXES): | ||
| continue | ||
| dir_parts = rel_parts[:-1] | ||
| if any(part in RECURSIVE_SKIP_DIRS for part in dir_parts): | ||
| continue | ||
| if path.suffix.lower() in SKIP_SUFFIXES: | ||
| continue | ||
| yield path | ||
|
|
||
|
|
||
| def find_em_dashes(path: pathlib.Path) -> Sequence[tuple[int, str]]: | ||
| try: | ||
| text = path.read_text(encoding="utf-8", errors="ignore") | ||
| except OSError: | ||
| return [] | ||
| lines: list[tuple[int, str]] = [] | ||
| for lineno, line in enumerate(text.splitlines(), start=1): | ||
| if EM_DASH in line: | ||
| lines.append((lineno, line)) | ||
| return lines | ||
|
|
||
|
|
||
| def main() -> int: | ||
| violations: list[tuple[pathlib.Path, int, str]] = [] | ||
| for path in iter_text_files(REPO_ROOT): | ||
| for lineno, line in find_em_dashes(path): | ||
| violations.append((path.relative_to(REPO_ROOT), lineno, line.strip())) | ||
| if violations: | ||
| print( | ||
| f"AI writing check failed: {EM_DASH!r} (em dash) detected in the repository" | ||
| ) | ||
| for rel_path, lineno, snippet in violations: | ||
| print(f"{rel_path}:{lineno}: {snippet}") | ||
| print("Please remove the em dash or explain why it is acceptable.") | ||
| return 1 | ||
| print("AI writing check passed (no em dash found).") | ||
| return 0 | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| raise SystemExit(main()) | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.