HN 표시: Claude Code의 /loop 스케줄러용 커서 스킬
hackernews
|
|
🔬 연구
#/loop
#claude
#claude code
#cursor
#review
#스케줄러
#크론탭
#crontab
#루프
원문 출처: hackernews · Genesis Park에서 요약 및 분석
요약
Claude Code의 `/loop` 스케줄러에서 효율적인 루프 처리를 위해 커서(Cursor)를 활용하는 기술을 개발한 사람이 이를 공개했습니다. 이 기술은 스케줄러의 성능을 향상시키는 데 기여할 것으로 예상됩니다. 개발자는 이 기술을 통해 루프 실행 시간을 줄이고, 시스템 자원 활용도를 높이는 것을 목표로 합니다. 이 프로젝트는 Claude Code의 스케줄링 시스템 개선에 도움이 될 수 있을 것으로 보입니다.
본문
| name | loop | |---|---| | description | Documents /loop-style recurring reminders and Claude Code's built-in scheduler. In Cursor: /loop [interval] adds a crontab entry (macOS + Linux); one-shot uses background sleep + notify. List/cancel via crontab. In Claude Code: use built-in /loop. Use when the user asks for /loop, scheduled reminders, or recurring prompts. | When the user asks for a recurring reminder in Cursor (e.g. /loop 5m remind me to stand up or loop every 1m remind me to stand up ), do not ask them to use Claude Code. Implement it with crontab so reminders persist across sessions and work on macOS and Linux. - Interval: leading ( /loop 5m ... ) or trailing (... every 2 hours ). Units:s ,m ,h ,d . Default if missing: 10 minutes. Cron has 1-minute granularity; round seconds up to 1m. - Message: the reminder text (e.g. "remind me to stand up" → "Stand up"). - Unique ID: generate a short id (e.g. 8 alphanumeric, like standup5 ora1b2c3d4 ) and use it asCURSOR_LOOP_ so the reminder can be listed and cancelled later. Comment format: Every crontab entry for /loop must end with a structured comment so scheduled tasks can be listed and deleted by id. Use: # CURSOR_LOOP_ | | Example: # CURSOR_LOOP_standup5 | 5m | Stand up . The agent parses this to show a tasks table and to remove by id. | Interval | Cron (minute hour day month dow) | |---|---| | 1m | * * * * * | | 5m | */5 * * * * | | 15m | */15 * * * * | | 1h | 0 * * * * | | 2h | 0 */2 * * * | | 1d | 0 0 * * * | For other values: Nm → */N * * * * , Nh → 0 */N * * * . Round to a supported step if needed. macOS (notification when user is logged in): ( crontab -l 2>/dev/null; echo "CRON_EXPR osascript -e 'display notification \"MESSAGE\" with title \"Reminder\"' # CURSOR_LOOP_ID | INTERVAL | MESSAGE" ) | crontab - Linux (needs notify-send , often from libnotify-bin ): ( crontab -l 2>/dev/null; echo "CRON_EXPR DISPLAY=:0 notify-send 'Reminder' 'MESSAGE' # CURSOR_LOOP_ID | INTERVAL | MESSAGE" ) | crontab - - Replace CRON_EXPR with the cron expression (5 fields). - Replace MESSAGE with the user's message; escape inner single/double quotes for the shell. - Replace CURSOR_LOOP_ID with the unique id (e.g.CURSOR_LOOP_standup5 ). - Replace INTERVAL with the interval string (e.g.5m ,1h ) and keepMESSAGE in the comment so the line is parseable when listing. Detect OS with uname -s (Darwin → macOS, Linux → Linux). After adding: "Reminder every added. To remove: crontab -l | grep -v CURSOR_LOOP_ | crontab - " or "Cancel with: cancel the reminder." When the user asks "what scheduled tasks do I have" or "list my reminders": crontab -l 2>/dev/null | grep CURSOR_LOOP - Each line ends with a comment # CURSOR_LOOP_ | | . - Parse the comment: split on | (space-pipe-space) to get id, interval, message. - Display as a table, e.g.: | ID | Interval | Message | |---|---|---| | standup5 | 5m | Stand up | - For each row, to cancel: crontab -l | grep -v CURSOR_LOOP_ | crontab - (use the ID from the table). - If there are no lines, say "No scheduled tasks." When the user says "cancel the stand up reminder" or "remove reminder ": crontab -l 2>/dev/null | grep -v CURSOR_LOOP_ | crontab - - Use the id from the comment (the part after CURSOR_LOOP_ and before the first| ). If the user names the message, find the line whose comment contains that message and use its id. "Remind me in 30 minutes to ..." or "in 45 minutes ..." cannot use cron (no "run once in N min"). Run in background: macOS: ( sleep SECONDS && osascript -e 'display notification "MESSAGE" with title "Reminder"' ) & Linux: ( sleep SECONDS && DISPLAY=:0 notify-send 'Reminder' 'MESSAGE' ) & Report PID and when it will fire. User can stop with kill . On Linux, notify-send is often in the libnotify-bin package. If the user doesn't have it, suggest installing it (e.g. sudo apt install libnotify-bin or equivalent). Claude Code can run prompts on a schedule: recurring loops, one-time reminders, or cron-style tasks. Tasks are session-scoped; they stop when you exit. For durable scheduling across restarts, use Desktop scheduled tasks or GitHub Actions. Source: Run prompts on a schedule /loop [interval] - Interval is optional. Default: every 10 minutes. - Leading: /loop 5m check if the deployment finished - Trailing: /loop check the build every 2 hours - No interval: /loop check the build → every 10 minutes Units: s (seconds), m (minutes), h (hours), d (days). Seconds round up to the nearest minute (cron granularity). Odd intervals (e.g. 7m, 90m) are rounded; Claude reports what was chosen. Loop over a command/skill: /loop 20m /review-pr 1234 Natural language; single-fire, then the task deletes itself. remind me at 3pm to push the release branch in 45 minutes, check whether the integration tests passed - List: what scheduled tasks do I have? - Cancel: cancel the deploy check job or by task ID Underlying tools: CronCreate , CronList , CronDelete . Each task has an 8-character ID. Max 50 tasks per session. - Scheduler checks every secon
Genesis Park 편집팀이 AI를 활용하여 작성한 분석입니다. 원문은 출처 링크를 통해 확인할 수 있습니다.
공유