MCP HubMCP Hub
스킬 목록으로 돌아가기

choose-loop-wakeup-interval

pjt222
업데이트됨 Yesterday
1 조회
17
2
17
GitHub에서 보기
디자인design

정보

이 스킬은 Claude에서 스케줄링된 루프 웨이크업을 위한 최적의 `delaySeconds` 값을 개발자가 선택할 수 있도록 돕습니다. 캐시를 고려한 3단계 전략을 제공하며, 런타임 클램핑과 반올림 특성을 처리하고 적절한 원격 측정 로깅을 보장합니다. 자율 루프 설계, 하트비트 주기 계획 또는 폴링 간격 조정 시 사용하세요.

빠른 설치

Claude Code

추천
기본
npx skills add pjt222/agent-almanac -a claude-code
플러그인 명령대체
/plugin add https://github.com/pjt222/agent-almanac
Git 클론대체
git clone https://github.com/pjt222/agent-almanac.git ~/.claude/skills/choose-loop-wakeup-interval

Claude Code에서 이 명령을 복사하여 붙여넣어 스킬을 설치하세요

문서

Choose Loop Wakeup Interval

Pick delaySeconds for ScheduleWakeup. Respect prompt cache 5-minute TTL, scheduler whole-minute granularity, [60, 3600] runtime clamp. Instinct "wait about 5 minutes" lands in worst-of-both zone — pay cache miss without amortizing wait.

Reasoning travels with ScheduleWakeup tool description at call time, but by then loop already scheduled. This skill hoists reasoning to planning time, where it belongs.

When Use

  • Designing autonomous /loop or ScheduleWakeup-driven continuation. Pick per-tick delay.
  • Planning heartbeat cadence for long-running agent. Poll, watch, iterate.
  • Tuning polling cadence against cost or cache-warmth pressure
  • Post-hoc review of loop costs → interval mis-sized
  • Writing guide, runbook, worked example involving delaySeconds

Inputs

  • Required: What loop waits for (specific event, state transition, idle tick, periodic check)
  • Required: Next tick needs fresh context (cache-warm)? Or cold re-read OK (cache-miss acceptable)?
  • Optional: Known lower bound on when awaited event could occur (e.g., "build takes at least 4 minutes")
  • Optional: Cost ceiling on total loop (ticks × per-tick cost)

Steps

Step 1: Classify the Wait

Pick tier:

  • Active watch (cache-warm): something expected to change within 5 minutes — build nearing completion, state transition polled, process just kicked off
  • Cache-miss wait: nothing worth checking sooner than 5 minutes; context cache goes cold, acceptable
  • Idle: no specific signal; loop checks in because might find something, not because will

Got: Clear classification: active-watch, cache-miss, or idle.

If fail: Cannot classify? No honest answer to "what am I waiting for?" → loop probably should not exist. Skip to Step 5. Consider not scheduling at all.

Step 2: Apply the Three-Tier Decision

Pick delaySeconds from classification:

TierRangeCache behaviourUse when
Cache-warm60 – 270 sCache stays warm (under 5-minute TTL)Active watch — next tick needs fast, cheap re-entry
Cache-miss1200 – 3600 sCache goes cold; one miss buys long waitGenuinely idle, or awaited event cannot happen sooner
Idle default1200 – 1800 s (20–30 min)Cache goes coldNo specific signal; periodic check, user can interrupt

Do not pick 300 s. Worst-of-both interval: cache misses, but wait too short to amortize miss. Reaching for "about 5 minutes"? Drop to 270 s (stay warm) or commit to 1200 s+ (amortize miss).

Got: Specific delaySeconds from one of three tiers. Not round-number-minute picked from habit.

If fail: Choice keeps landing on 300 s? Underlying question: "should this loop exist at this cadence at all?" Re-examine Step 1.

Step 3: Size for the Minute Boundary

Scheduler fires on whole-minute boundaries. delaySeconds of N produces actual delay of N to N + 60 s. Depends on what second of minute you call tool.

Worked example:

ScheduleWakeup({delaySeconds: 90}) at HH:MM:40 → target HH:(MM+2):00. Actual wait 140 s, not 90 s.

Consequence: sub-minute intent meaningless. Treat value as floor, not precise schedule. If minute of skew matters, loop cadence too tight for this mechanism.

Got: Accepted: actual wait up to 60 s longer than requested delaySeconds. Cache-warm ticks affected — 270 s can become ~330 s in practice, tipping into cache-miss territory.

If fail: Near-ceiling values (e.g., 265 s targeting cache-warmth) common? Pad downward. Use 240 s instead of 270 s. Preserves cache-warm guarantee under worst-case skew.

Step 4: Respect the Clamp

Runtime clamps delaySeconds to [60, 3600]. Outside range silently adjusted. Telemetry distinguishes chosen_delay_seconds from clamped_delay_seconds. Sets was_clamped: true on mismatch.

Plan against clamped value, not requested:

  • Request below 60 → actual wait 60 s plus minute-boundary skew (up to 120 s in practice)
  • Request above 3600 → actual wait 3600 s (1 hour)
  • No runtime extends ceiling. Multi-hour waits require multiple ticks.

Got: Chosen value falls inside [60, 3600]. Or clamped behaviour deliberately accepted.

If fail: Need genuinely multi-hour (e.g., "wake me in 4 hours")? Chain wakeups — schedule 3600 s tick that reschedules itself. Or use cron-based loop (CronCreate with kind: "loop").

Step 5: Write a Specific reason

reason field = telemetry + user-visible status + prompt-cache warmth reasoning. One line. Truncated to 200 chars. Make specific.

  • Good: checking long bun build, polling for EC2 instance running-state, idle heartbeat — watching the feed
  • Bad: waiting, loop, next tick, continuing

Reader: user trying to understand what loop is doing without predicting cadence in advance. Write for them.

Got: Concrete, one-phrase reason. Makes sense to user glancing at status.

If fail: No specific reason available? Revisit whether loop should exist (Step 1, Step 6).

Step 6: Recognize the Don't-Loop Case

Not every "come back later" impulse warrants scheduled wakeup. Do NOT schedule tick when:

  • User actively watching — their input is right trigger, not timer
  • No convergence criterion — loop has no definition of "done"
  • Task interactive (asks user questions between ticks)
  • Cadence shorter than clamp floor (60 s) — polling that tight belongs to event-driven mechanism, not loop

Got: Conscious choice between scheduling wakeup and not looping. "Because I could" not a reason.

If fail: Keep scheduling wakeups user interrupts before they fire? Pattern is wrong — not interval.

Checks

  • Wait classified as active-watch, cache-miss, or idle
  • Chosen delaySeconds falls in one of three tier ranges (60–270, 1200–3600, or 1200–1800 for idle)
  • Value is not 300 (worst-of-both)
  • Value inside [60, 3600] or clamped behaviour explicitly accepted
  • Minute-boundary skew accounted for (value as floor)
  • reason concrete, under 200 chars
  • Don't-loop check performed — wakeup actually warranted

Pitfalls

  • Round-minute default (300 s): Single most common mistake. "About 5 minutes" feels natural, exactly wrong. Drop to 270 s or commit to 1200 s+.
  • Ignoring minute-boundary skew: Request 60 s near end of minute → ~120 s actual delay. Cache-warm ticks: can push past 5-minute TTL.
  • Chasing sub-minute precision: Scheduler has minute granularity. 85 vs 90 vs 95 s is noise. Pick value, move on.
  • Opaque reason fields: "waiting" tells user nothing. Telemetry useless. Write reason as if user reads it on status line.
  • Using this skill to justify unnecessary loop: Honest answer to "what am I watching for?" vague? No interval choice helps. Loop should not exist.
  • Hand-clamping in prompt: Do not clamp in model reasoning ("I'll cap at 3600 to be safe"). Runtime clamps. Let it.
  • Forgetting 7-day age-out: Dynamic loop reaped after 7 days default (user-configurable up to 30). Long loops designed to end well before ceiling, not race it.

Examples

Example 1 — Cache-warm active watch

bun build kicked off. Agent wants to check in quickly, cache still warm when results arrive.

  • Classification: active watch (Step 1)
  • Tier: cache-warm (Step 2), pick 240 s
  • Minute boundary (Step 3): worst-case actual wait ~300 s — still under 5-minute TTL with 60 s buffer
  • Reason (Step 5): checking long bun build

Example 2 — Idle heartbeat

Autonomous agent watches low-volume feed once an hour for anything worth acting on.

  • Classification: idle (Step 1)
  • Tier: idle default (Step 2), pick 1800 s (30 min)
  • Minute boundary (Step 3): irrelevant — 60 s skew negligible at this cadence
  • Reason (Step 5): idle heartbeat — watching the feed

Example 3 — The anti-pattern

Agent wants to "wait 5 minutes" while remote API retries. Request is 300 s.

  • Problem: cache goes cold at 5 minutes. 300 s pays miss — but 300 s too short to amortize miss.
  • Fix: drop to 270 s (stay warm) or commit to 1500 s (amortize miss). Do not pick 300.

See Also

  • manage-token-budget — cost ceilings for long-lived agent loops; cache-aware sizing one lever
  • du-dum — observe/act separation pattern; sizes observe-clock interval when loop is cron-less
  • read-continue-here — cross-session handoff; this skill covers within-session wakeups
  • write-continue-here — complement of read-continue-here
<!-- Keep under 500 lines. Current: ~200 lines. -->

GitHub 저장소

pjt222/agent-almanac
경로: i18n/caveman/skills/choose-loop-wakeup-interval
0
agentsagentskillsai-assisted-developmentclaude-codeskillsteams

연관 스킬

executing-plans

디자인

executing-plans 스킬은 검토 체크포인트가 포함된 통제된 배치로 실행할 완전한 구현 계획이 있을 때 사용합니다. 이 스킬은 계획을 불러와 비판적으로 검토한 후, 소규모 배치(기본값 3개 작업)로 작업을 실행하면서 각 배치 사이에 진행 상황을 아키텍트 검토를 위해 보고합니다. 이를 통해 내재된 품질 관리 체크포인트를 갖춘 체계적인 구현이 보장됩니다.

스킬 보기

requesting-code-review

디자인

이 스킬은 코드 변경 사항을 요구 사항에 따라 분석하기 위해 코드 리뷰어 하위 에이전트를 호출합니다. 작업 완료 후, 주요 기능 구현 후, 또는 메인 브랜치에 병합하기 전에 사용해야 합니다. 이 리뷰는 현재 구현체와 원래 계획을 비교하여 문제를 조기에 발견하는 데 도움이 됩니다.

스킬 보기

connect-mcp-server

디자인

이 스킬은 개발자들이 HTTP, stdio 또는 SSE 전송 방식을 통해 MCP 서버를 Claude Code에 연결하는 포괄적인 가이드를 제공합니다. GitHub, Notion 및 사용자 정의 API와 같은 외부 서비스를 통합하기 위한 설치, 구성, 인증 및 보안을 다룹니다. MCP 통합 설정, 외부 도구 구성 또는 Claude의 모델 컨텍스트 프로토콜 작업 시 활용하세요.

스킬 보기

web-cli-teleport

디자인

이 스킬은 작업 분석을 기반으로 개발자가 Claude Code 웹 인터페이스와 CLI 인터페이스 중 선택할 수 있도록 돕고, 두 환경 간 원활한 세션 텔레포트를 가능하게 합니다. 웹, CLI 또는 모바일 환경 전환 시 세션 상태와 컨텍스트를 관리하여 워크플로를 최적화합니다. 다양한 단계에서 서로 다른 도구가 필요한 복잡한 프로젝트에 사용하세요.

스킬 보기