Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,5 @@ __pycache__/
# Docker
.dockerignore.worktrees/
/logs/

.coverage
13 changes: 13 additions & 0 deletions .rtk/filters.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Project-local RTK filters — commit this file with your repo.
# Filters here override user-global and built-in filters.
# Docs: https://github.com/rtk-ai/rtk#custom-filters
schema_version = 1

# Example: suppress build noise from a custom tool
# [filters.my-tool]
# description = "Compact my-tool output"
# match_command = "^my-tool\\s+build"
# strip_ansi = true
# strip_lines_matching = ["^\\s*$", "^Downloading", "^Installing"]
# max_lines = 30
# on_empty = "my-tool: ok"
17 changes: 8 additions & 9 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
<!-- rtk-instructions v2 -->
# Working rules

See [AGENTS.md](AGENTS.md) for agent workflow rules. In particular: **never push
without a green `make check` locally** — CI runs the same target and will fail
on any ruff/pytest regression.

# RTK (Rust Token Killer) - Token-Optimized Commands

## Golden Rule
Expand Down Expand Up @@ -33,11 +27,16 @@ rtk prettier --check # Files needing format only (70%)
rtk next build # Next.js build with route metrics (87%)
```

### Test (90-99% savings)
### Test (60-99% savings)
```bash
rtk cargo test # Cargo test failures only (90%)
rtk vitest run # Vitest failures only (99.5%)
rtk go test # Go test failures only (90%)
rtk jest # Jest failures only (99.5%)
rtk vitest # Vitest failures only (99.5%)
rtk playwright test # Playwright failures only (94%)
rtk pytest # Python test failures only (90%)
rtk rake test # Ruby test failures only (90%)
rtk rspec # RSpec test failures only (60%)
rtk test <cmd> # Generic test wrapper - failures only
```

Expand Down Expand Up @@ -136,4 +135,4 @@ rtk init --global # Add RTK to ~/.claude/CLAUDE.md
| Network | curl, wget | 65-70% |

Overall average: **60-90% token reduction** on common development operations.
<!-- /rtk-instructions -->
<!-- /rtk-instructions -->
23 changes: 20 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,12 @@ schedule-agent session <id> <session_id> # attach a session
schedule-agent session <id> --new # reset to a fresh session

schedule-agent delete <id>
schedule-agent --dry-run # preview without submitting

schedule-agent --dry-run # TUI: creating a job shows preview, skips submission
schedule-agent --dry-run submit <id> # preview the at(1) script for an existing job

schedule-agent edit-prefix {claude|codex} # edit the per-agent prompt prefix in $EDITOR
schedule-agent --version
```

### Safe mutations
Expand Down Expand Up @@ -171,10 +176,22 @@ export EDITOR="code --wait"

| Path | Contents |
|------|----------|
| `~/.local/state/schedule-agent/` | job queue + state |
| `~/.local/state/schedule-agent/` | job queue + state + logs |
| `~/.local/share/schedule-agent/agent_prompts/` | prompt files |
| `~/.config/schedule-agent/prompt-prefix-{claude,codex}.md` | per-agent prefix applied to every scheduled prompt |

`$XDG_STATE_HOME`, `$XDG_DATA_HOME`, and `$XDG_CONFIG_HOME` are honoured if set.

State, logs, and prompt dirs are chmod-ed to `0700` on creation — logs may contain secrets produced by the agent.

### Environment variables

`$XDG_STATE_HOME` and `$XDG_DATA_HOME` are honoured if set.
| Variable | Effect |
|----------|--------|
| `SCHEDULE_AGENT_EDITOR` | Editor for prompt/prefix editing (wins over `$EDITOR`) |
| `SCHEDULE_AGENT_STALE_MINUTES` | Minutes a `running` job must be idle (no log writes) before the recovery path force-marks it failed. Default `60`, minimum `1`. |
| `SCHEDULE_AGENT_POST_HOOK` | Optional shell command fired after every job finishes. Receives `JOB_ID`, `JOB_TITLE`, `JOB_RESULT` (`success`/`failed`), `JOB_EXIT_CODE`, `JOB_LOG_FILE` in its environment. Failures are swallowed. |
| `SCHEDULE_AGENT_MIN_CLAUDE` / `SCHEDULE_AGENT_MIN_CODEX` | Override the preflight minimum known-good version per agent. |

---

Expand Down
25 changes: 8 additions & 17 deletions install.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#!/usr/bin/env bash
set -euo pipefail

check_atd_running() {
if pgrep -x atd >/dev/null 2>&1; then
return 0
Expand All @@ -12,7 +15,6 @@ check_atd_running() {
exit 1
}

check_atd_running
check_prereq() {
local cmd="$1"
local pkg="$2"
Expand All @@ -22,31 +24,28 @@ check_prereq() {
fi
}

# Check prerequisites
check_atd_running

# Find a suitable Python 3 interpreter (>=3.7)
# Find a suitable Python 3 interpreter (>=3.10)
PYTHON_BIN=""
for candidate in python3 python; do
if command -v "$candidate" >/dev/null 2>&1; then
ver=$($candidate -c 'import sys; print("%d.%d" % sys.version_info[:2])' 2>/dev/null)
case "$ver" in
3.[7-9]|3.1[0-9]|[4-9].*)
3.1[0-9]|3.[2-9][0-9]|[4-9].*)
PYTHON_BIN="$candidate"; break;;
esac
fi
done
if [[ -z "$PYTHON_BIN" ]]; then
echo "Error: Python 3.7+ is required (python3 or python not found or too old)." >&2
echo "Error: Python 3.10+ is required (python3 or python not found or too old)." >&2
exit 1
fi

check_prereq pip3 "pip for Python 3"
check_prereq at "at (job scheduler)"
check_prereq atd "atd (daemon)"

#!/usr/bin/env bash
set -e

PREFIX="${HOME}/.local"
BIN_DIR="${PREFIX}/bin"
APP_DIR="${PREFIX}/share/schedule-agent"
Expand All @@ -58,7 +57,6 @@ is_installed() {
if [[ -x "$SCHEDULE_AGENT_BIN" ]]; then
return 0
fi
# Also check if installed via pip in user or system
if "$PYTHON_BIN" -m pip show schedule-agent >/dev/null 2>&1; then
return 0
fi
Expand All @@ -68,37 +66,30 @@ is_installed() {
if is_installed; then
echo "schedule-agent is already installed."
echo "Updating to the latest version..."
# Try to update via pip if installed as a package
if "$PYTHON_BIN" -m pip show schedule-agent >/dev/null 2>&1; then
"$PYTHON_BIN" -m pip install --upgrade --user schedule-agent
echo "schedule-agent updated via pip."
exit 0
fi
# Otherwise, update the local install (reinstall files)
echo "Updating local install..."
rm -rf "$APP_DIR/schedule_agent" "$APP_DIR/pyproject.toml" "$VENV_DIR"
# Continue to install as below
else
echo "schedule-agent not found. Installing..."
fi

mkdir -p "$BIN_DIR"
mkdir -p "$APP_DIR"

# Copy project files
cp -r schedule_agent "$APP_DIR/"
cp pyproject.toml "$APP_DIR/"
cp README.md "$APP_DIR/" 2>/dev/null || true
cp LICENSE "$APP_DIR/" 2>/dev/null || true

# Create venv
"$PYTHON_BIN" -m venv "$VENV_DIR"

# Install package into the venv
"$VENV_DIR/bin/pip" install --upgrade pip
"$VENV_DIR/bin/pip" install "$APP_DIR"

# Create launcher
cat > "$BIN_DIR/schedule-agent" <<EOF
#!/usr/bin/env bash
exec "$VENV_DIR/bin/schedule-agent" "\$@"
Expand All @@ -116,4 +107,4 @@ if [[ ":$PATH:" != *":$BIN_DIR:"* ]]; then
fi

echo ""
echo "Done."
echo "Done."
Loading
Loading