-
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
Open
Miyamura80
wants to merge
1
commit into
main
Choose a base branch
from
ai-writing-guard
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
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,92 @@ | ||
| from __future__ import annotations | ||
|
|
||
| import pathlib | ||
| from collections.abc import Iterable, Sequence | ||
|
|
||
| REPO_ROOT = pathlib.Path(__file__).resolve().parent.parent | ||
| EM_DASH = chr(0x2014) | ||
| SKIP_DIRS = { | ||
| ".git", | ||
| ".venv", | ||
| ".uv_cache", | ||
| ".uv-cache", | ||
| ".uv_tools", | ||
| ".uv-tools", | ||
| ".cache", | ||
| ".pytest_cache", | ||
| "__pycache__", | ||
| "node_modules", | ||
| ".next", | ||
| } | ||
| 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) | ||
| if any(part in SKIP_DIRS for part in rel.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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
iter_text_files()skips any file whose relative path parts contain a name inSKIP_DIRS. This will also skip user/source directories that happen to share a name with these entries (e.g., a package namedcache/,node_modules/, etc.), not just the intended hidden/tooling dirs at repo root. If the intent is to skip only top-level tool directories, this will produce false negatives where em dashes in those directories are never checked.Also appears in the same function at
scripts/check_ai_writing.py:55.Prompt To Fix With AI