npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

looming

v0.2.0

Published

Autonomous loop daemon for Claude Code: keep an agent working a durable mission, backlog and journal across fresh `claude -p` sessions — until you interrupt it.

Readme


Boris Cherny,Anthropic 的 Claude Code 負責人,談從「寫提示」轉向「自主代理迴圈」的轉變(2026 年 6 月):

"I don't prompt Claude anymore. I have loops running that prompt Claude and figuring out what to do. My job is to write loops."

— 廣為流傳,2026 年 6 月(The New Stack · Addy Osmani)。社群稱之為「loop engineering(迴圈工程)」。

Looming 是對「好,那我到底該怎麼把這個迴圈寫出來?」這個問題給出的一個小巧而鋒利的答案。

2026-06-14 02:11:04  Looming · autonomous loop started
2026-06-14 02:11:04  dir ~/proj/acme · model (default) · perm acceptEdits · every 5s · fresh context
2026-06-14 02:11:31  #1 ✓ scaffolded test harness; 3 specs green        · $0.0212
2026-06-14 02:12:55  #2 ✓ covered auth module (12 new tests, 0 fail)    · $0.0307
2026-06-14 02:14:40  #3 ✓ found + fixed off-by-one in pagination         · $0.0291
2026-06-14 02:16:02  #4 ▸ refactoring report.ts for testability …
^C  stop signal — exiting cleanly after this iteration

🤔 為什麼不直接用 /loop/goal 或 Ralph?

Ralph 技巧while :; do cat PROMPT.md | agent; done)及其衍生作品——snarktank/ralph、官方的 ralph-wiggum 外掛,以及 Claude Code 內建的 /loop/goal——都驗證了這個想法。但它們都侷限於單一工作階段或只跑一次:關掉終端機,迴圈就沒了;待辦清單清空,它就停了;沒有任何機制會從先前的失敗中學到東西。

Looming 填補的正是它們留下的這道空缺:

| | /loop | /goal | Ralph(檔案式) | Looming | |---|:--:|:--:|:--:|:--:| | 能撐過終端機關閉/當機/重開機 | ✗ | ✗ | ✗ | ✓ | | 將任務(mission)· 待辦(backlog)· 日誌(journal)視為第一級狀態 | ✗ | ✗ | ~ | ✓ | | 從自身的失敗中學習(背壓機制) | ✗ | ✗ | ~ | ✓ | | 持續不歇、常駐長青的任務 | 間隔輪詢 | 完成即停 | 清空即停 | ✓ 直到被中斷 | | 需要 Anthropic API key | ✗ | ✗ | ✗ | ✗ |

持續存活的是迴圈執行器本身——而不只是代理的工作檔案。

📦 安裝

npm install -g looming   # needs Node >=18 and Claude Code already logged in (`claude login`)

🚀 快速上手

cd your-project
looming init                 # scaffolds .looming/ (mission template + empty backlog + journal)
$EDITOR .looming/mission.md  # write your mission + definition of done + guardrails
looming run                  # start the loop — Ctrl+C to stop anytime

想預覽提示卻不花一毛錢:looming run --dry-run。想查看它的狀態:looming status

⚙️ 運作原理

每一次迭代都是一個全新claude -p(狀態存在磁碟上,而非脈絡視窗裡——這正是 Ralph 的核心洞見)。Looming 會:

  1. 編織出一段提示,素材來自 .looming/ 中的三個檔案:
    • mission.md — 長期的章程 + 完成定義(definition of done) + 護欄(由你來寫)。
    • backlog.json — 一個帶狀態的優先序任務佇列(todo / doing / done / blocked)。
    • journal.ndjson — 僅可追加的歷史記錄,涵蓋每一次迭代,包含學到的經驗與失敗,會被回饋給代理,讓它不再重蹈覆轍。
  2. 以無頭模式執行 Claudeclaude -p --output-format json),擷取結構化結果、工作階段 id 與成本。
  3. 讀回一份報告。 Claude 在每一輪結束時會給出一段圍欄程式碼區塊,Looming 會解析它來更新待辦與日誌:
    {
      "summary": "what this iteration did",
      "taskUpdates": [{ "id": "t_…", "status": "done" }],
      "newTasks": [{ "title": "discovered work", "priority": 3 }],
      "learnings": ["gotcha for next time"],
      "missionComplete": false,
      "blocked": false
    }
  4. 繼續推進——重新排定優先序、遇到速率限制時退避、在反覆失敗後觸發斷路器,並在任務的完成定義被客觀滿足、或被你中斷時,乾淨俐落地停下來。

🌙 無人值守執行(過夜跑)

Looming 會保留持久狀態,並從上次中斷處接著跑,所以把它放到行程監管器(process supervisor)底下,讓它能撐過重開機:

pm2 start "looming run --max-cost 5" --name looming   # pm2 (cross-platform)
# systemd: see supervisor/looming.service
# Windows: schedule `looming run` via Task Scheduler ("at log on", restart on failure)

現成的設定檔放在 supervisor/

🛡️ 安全

一個自主迴圈會在無人值守的情況下運行,並執行真實的操作。請以相應的審慎態度對待它:

  • 在一個你能 reset 的 git 倉庫裡運行——最好是一個全新的 worktree 或沙箱。
  • 把護欄寫進 mission.md(「絕不 force-push」、「未提交前不做破壞性操作」)。它們會被放進每一段提示裡。
  • 務必為預算設上限,免得過夜迴圈失控燒錢:--max-cost(累計總額)和/或 --max-daily-cost / --max-daily-tokens(每日,本地午夜自動重置、跨重啟保留)。自 2026 年 6 月 Anthropic 把 claude -p / Agent SDK 用量改成單獨按量計費的 credit 後,每日上限尤其重要——能在燒光那份 credit 前先把暴衝的迴圈停下。
  • --dangerously-skip-permissions 會讓它真正做到完全放手——只在你信任的封閉環境裡使用。不加這個旗標的話,迴圈會在第一個未被允許的工具上卡住;改用 --allowed-tools 來預先核准。

🎛️ 選項

looming run [options]
  -d, --dir <path>                  working directory (default: cwd)
  -m, --model <id>                  model id (e.g. claude-opus-4-8, claude-sonnet-4-6)
      --permission-mode <mode>      acceptEdits | dontAsk | plan | bypassPermissions  (default acceptEdits)
      --allowed-tools <list>        pre-approve tools, e.g. "Read,Edit,Bash(git commit *)"
      --dangerously-skip-permissions   no permission prompts (sandbox only)
      --delay <sec>                 pause between iterations (default 5)
      --max-iterations <n>          stop after n iterations (0 = unlimited)
      --max-cost <usd>              stop after $usd total (0 = unlimited)
      --max-daily-cost <usd>        pause when today's spend hits $usd (resets at local midnight; 0 = unlimited)
      --max-daily-tokens <n>        pause when today's tokens hit n (resets at local midnight; 0 = unlimited)
      --continue-session            reuse one Claude session instead of fresh each loop
      --dry-run                     print the prompt and exit (no Claude call)

looming init | status | stop

🗺️ 藍圖

  • 真正的作業系統服務安裝(looming daemon install,對應 systemd / launchd / Windows Service)
  • 跨多個 git worktree 的多迴圈並行(Cherny 所說的「數十個代理」)
  • 可插拔的後端,不限於 Claude Code(Codex、Gemini CLI)
  • 提供日誌與即時成本的網頁儀表板
  • 迭代之間自動整理待辦(去重、重新排序優先級)

🙏 致謝

站在 Geoffrey Huntley 的 Ralph 技巧與 Ryan Carson 的 snarktank/ralph 的肩膀之上;並由 Boris Cherny 的「write loops(寫迴圈)」理念所啟發成形。Looming 的貢獻,在於把這個迴圈打造成一個持久、不歇、能自我學習的守護行程,而不只是一個跑一次的 shell 迴圈。

📄 授權條款

MIT © 2026 Harry Xin