daemon-loop

GitHub

将工作流转化为持久化后台守护进程,支持定时自动执行。提供Cron、会话内循环及异步集成三种架构,适用于记忆同步、代码审查等场景,具备安全限制与状态追踪功能。

examples/skills/workflow/daemon-loop/SKILL.md winstonkoh87/Athena-Public

Trigger Scenarios

需要定期自动执行任务(如记忆同步、代码审查) 用户请求在后台持续运行某个工作流

Install

npx skills add winstonkoh87/Athena-Public --skill daemon-loop -g -y
More Options

Non-standard path

npx skills add https://github.com/winstonkoh87/Athena-Public/tree/main/examples/skills/workflow/daemon-loop -g -y

Use without installing

npx skills use winstonkoh87/Athena-Public@daemon-loop

指定 Agent (Claude Code)

npx skills add winstonkoh87/Athena-Public --skill daemon-loop -a claude-code -g -y

安装 repo 全部 skill

npx skills add winstonkoh87/Athena-Public --all -g -y

预览 repo 内 skill

npx skills add winstonkoh87/Athena-Public --list

SKILL.md

Frontmatter
{
    "name": "daemon-loop",
    "vibe": "Infrastructure that works while you sleep.",
    "model": "default",
    "auto-invoke": false,
    "description": "Autonomous recurring agent tasks — converts workflows into persistent background daemons that run on intervals. Stolen from Boris Cherny's Claude Code `\/loop` pattern (2026-03-31).",
    "context_trigger": "loop, daemon, background, autonomous, recurring, schedule, cron"
}

Daemon Loop — Autonomous Agent Infrastructure

Source: Boris Cherny (Claude Code creator), X thread 2026-03-30 (CS-560) Pattern: "Turn workflows into skills, then loop them."

Core Concept

Traditional Athena workflows are pull-based — user triggers /start, /audit, /reindex manually. Daemon loops are push-based — they run autonomously at set intervals without user invocation.

This is the difference between a tool and infrastructure.

When to Use

Use Case Interval Workflow
Memory consolidation (dream pass) 24h (3-gate) /dream
Memory sync to Supabase 60m /reindex
Workspace hygiene + dead file pruning 24h /needful
PR/commit review (if git-active) 5m /check
Stale context detection (.context/ drift) 12h /audit (lightweight)
Client delivery queue check 30m Custom scan

Architecture

Option A: Cron + Headless Agent (Current-Compatible)

For environments where the agent platform supports CLI invocation:

# Example: reindex every hour
0 * * * * cd ./project && claude --bare -p "/reindex" 2>&1 >> .agent/temp/daemon.log

# Example: workspace hygiene daily at 4am
0 4 * * * cd ./project && claude --bare -p "/needful" 2>&1 >> .agent/temp/daemon.log

Key: --bare flag skips full context loading for speed. Only load what the specific daemon needs.

Option B: In-Session Loop (Manual Trigger)

When cron is unavailable, run a daemon within an active session:

User: "Loop /reindex every 60 minutes for the next 8 hours"
Agent: [Executes /reindex, sleeps 60m, repeats 8x]

Constraint: Requires an active session. Prefer Option A for true autonomy.

Option C: Async-Dev Integration

Combine with /async-dev (Sleeper Agent Protocol):

  1. User sets up daemon tasks before sleeping
  2. Agent executes loop overnight
  3. Morning: user reads STATUS.md for results

Daemon Registration

Track active daemons in .agent/temp/daemons.json:

{
  "daemons": [
    {
      "name": "memory-sync",
      "workflow": "/reindex",
      "interval": "60m",
      "last_run": "2026-03-31T01:00:00+08:00",
      "status": "active",
      "bare": true
    }
  ]
}

Safety Rules

  • CAN: Run read-only or idempotent workflows (reindex, audit, check, dream)
  • CAN: Write to .agent/temp/ and .context/ directories
  • CANNOT: Commit, push, or mutate source code without explicit user pre-authorization
  • CANNOT: Run workflows that require interactive user input
  • CANNOT: Exceed 8-hour autonomous window without checkpoint
  • BLOCKING BUDGET: Any single daemon action that would block for >15 seconds must be deferred (stolen from KAIROS)

Boris Cherny's Live Examples (Reference)

His Daemon Interval What It Does
/babysit 5m Code review, rebase, shepherd PRs to production
/slack-feedback 30m Create PRs from Slack feedback automatically
/post-merge-sweeper on-event Catch missed code review comments post-merge
/pr-pruner 1h Close stale PRs

Migration Path

  1. Phase 1 (Now): Define which workflows are daemon-eligible
  2. Phase 2: Write cron entries or use platform-native scheduling
  3. Phase 3: Build .agent/temp/daemons.json registry for state tracking
  4. Phase 4: Add /daemon workflow for CRUD operations on active daemons

References

Version History

  • e624e2d Current 2026-07-19 08:48

Same Skill Collection

examples/protocols/diagnostics/DIA-SKILL.md
examples/skills/business/brand-foundations/SKILL.md
examples/skills/business/client-pricing/SKILL.md
examples/skills/business/distribution-physics/SKILL.md
examples/skills/business/marketing-swarm/SKILL.md
examples/skills/business/seo-auditor/SKILL.md
examples/skills/business/sovereign-economics-engine/SKILL.md
examples/skills/coding/agentic-code-orchestrator/SKILL.md
examples/skills/coding/atomic-execution/SKILL.md
examples/skills/coding/dashboard-builder/SKILL.md
examples/skills/coding/diagnostic-refactor/SKILL.md
examples/skills/coding/git-worktree-swarm/SKILL.md
examples/skills/coding/micro-commit/SKILL.md
examples/skills/coding/spec-driven-dev/SKILL.md
examples/skills/coding/visual-verify-ui/SKILL.md
examples/skills/decision/bionic-decision-engine/SKILL.md
examples/skills/decision/decision-journal/SKILL.md
examples/skills/decision/mcda-solver/SKILL.md
examples/skills/decision/trading-risk-gate/SKILL.md
examples/skills/decision/zenith-execution/SKILL.md
examples/skills/quality/bionic-safety-net/SKILL.md
examples/skills/quality/circuit-breaker/SKILL.md
examples/skills/quality/consiglieri-protocol/SKILL.md
examples/skills/quality/power-inversion/SKILL.md
examples/skills/quality/red-team-review/SKILL.md
examples/skills/quality/web-launch-gate/SKILL.md
examples/skills/research/data-analysis/SKILL.md
examples/skills/research/deep-research-loop/SKILL.md
examples/skills/research/semantic-search/SKILL.md
examples/skills/research/statistical-analysis/SKILL.md
examples/skills/research/synthetic-parallel-reasoning/SKILL.md
examples/skills/social-physics-filter/SKILL.md
examples/skills/structural-trading-gate/SKILL.md
examples/skills/therapeutic-ifs/SKILL.md
examples/skills/workflow/academic-delivery/SKILL.md
examples/skills/workflow/context-compactor/SKILL.md
examples/skills/workflow/skill-compiler/SKILL.md
examples/skills/workflow/trade-journal-analyzer/SKILL.md

Metadata

Files
0
Version
e624e2d
Hash
ccef2173
Indexed
2026-07-19 08:48

Accueil - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-07-20 13:44
浙ICP备14020137号-1 $Carte des visiteurs$