算法艺术创作
algorithmic-art
通过代码和可调参数创作生成艺术与交互式视觉效果。
du-dum【设计与创意】Separate expensive observation from cheap decision-making in autonomous agent loops using a two-clock architecture. A fast clock accumulates data into a digest file; a slow clock reads the digest and acts only when something is pending. Idle cycles cost nothing because the action clock returns immediately after reading an empty digest. Use when build…
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
雙鐘異頻。速鐘(察)廉而集,書精要。慢鐘(行)讀要而判行否。要云無事→立退:閒週零費。
名源心跳:du-dum, du-dum。首拍(du)察,次拍(dum)行。多時,唯首拍動。
分工為察(廉、頻)與行(貴、稀)。
| 鐘 | 費 | 頻 | 例 |
|---|---|---|---|
| 速(析) | 廉:API 讀、文解、無 LLM | 日 4-6 | 掃 GitHub 通知、解 RSS、讀日 |
| 慢(行) | 貴:LLM 推、寫 | 日 1 | 擬答、更儀表、發警 |
得:清二列分,每作屬一鐘。速鐘無 LLM 呼;慢鐘無採數。
敗:一作須讀且 LLM 推(如「摘新議」)→分之:速鐘入原議於要;慢鐘摘之。要乃界。
要乃連兩鐘之低帶信。宜精、人可讀、機可解。
pending: none 或空節)要例:
# Digest — 2026-03-22T06:30:00Z
## Pending
- PR #42 needs review response (opened 2h ago, author requested feedback)
- Issue #99 has new comment from maintainer (action: reply)
## Status
- Last analyzed: 2026-03-22T06:30:00Z
- Sources checked: github-notifications, rss-feed, error-log
- Items scanned: 14
- Items pending: 2
無待時:
# Digest — 2026-03-22T06:30:00Z
## Pending
(none)
## Status
- Last analyzed: 2026-03-22T06:30:00Z
- Sources checked: github-notifications, rss-feed, error-log
- Items scanned: 8
- Items pending: 0
得:要之模,待/空態明。行鐘可察一欄一節定行否。
敗:要過長(>50 行)→速鐘含原數過多。移細於別檔,要只存摘與指。
造循速表之察本。
# Pseudocode: analyze-notifications.sh
fetch_notifications()
filter_actionable(notifications)
format_as_digest_entries(filtered)
atomic_write(digest_path, entries)
log("analyzed {count} notifications, {pending} actionable")
表例(cron):
# Fast clock: analyze every 4 hours
30 */4 * * * /path/to/analyze-notifications.sh >> /var/log/analysis.log 2>&1
0 6 * * * /path/to/analyze-pr-status.sh >> /var/log/analysis.log 2>&1
得:一或多析本,各產或更要文。本獨運——一敗他仍更其節。
敗:源暫無→本記誤而留舊要項。勿源敗即清要——舊數於行鐘勝無數。
造行本:讀要、判行否。
# Pseudocode: heartbeat.sh (the slow clock)
digest = read_file(digest_path)
if digest.pending is empty:
log("heartbeat: nothing pending, exiting")
exit(0)
# Only reaches here if work exists
response = call_llm(digest.pending, system_prompt)
execute_actions(response)
archive_digest(digest_path)
log("heartbeat: processed {count} items, cost: {tokens} tokens")
表例(cron):
# Slow clock: act once per day at 7am
0 7 * * * /path/to/heartbeat.sh >> /var/log/heartbeat.log 2>&1
得:閒週時本於 1 秒內退(僅讀文察空)。活週時處待項並清要。
敗:LLM 呼敗→勿清要。待項留於下行週。或於要中設重試計,免永敗項之無盡重試。
省費源於閒檢——行鐘須以最少成本可靠別「無事」與「有事」。
# Minimal idle check
if grep -q "^(none)quot; "$DIGEST_PATH" || grep -q "pending: 0" "$DIGEST_PATH"; then
echo "$(date -u +%FT%TZ) heartbeat: idle" >> "$LOG_PATH"
exit 0
fi
得:閒路為一讀後一匹。無網、無生進程(本身除外)。
敗:閒檢不可靠(偽正致漏工,偽負致冗 LLM 呼)→簡要之式。檔首一布值欄(has_pending: true/false)最可靠。
算預期費,驗雙鐘架確省。
fast_runs = 24 / fast_interval_hoursfast_runs * cost_per_analysis_run(無 LLM 宜~$0)active_days_fraction * cost_per_action_run(1 - active_days_fraction) * cost_per_idle_check(宜~$0)費較例:
| 架 | 日費(活) | 日費(閒) | 月費(80% 閒) |
|---|---|---|---|
| Single loop (LLM every 30min) | $13.74/37h | $13.74/37h | ~$400 |
| Du-dum (6 analyses + 1 action) | $0.30 | $0.00 | ~$6 |
得:費模顯 du-dum 於閒日至少廉於原 10 倍。
敗:費模未顯顯省,其一大抵真:(a) 速鐘過頻,(b) 速鐘含隱 LLM 呼,(c) 系少閒。Du-dum 宜高閒率系。若系恒活,簡輪詢或更宜。
manage-token-budget — 費控框,du-dum 使之可行;du-dum 乃架式,預為帳層circuit-breaker-pattern — 處敗態(工具壞);du-dum 處常態(無事)。並用:du-dum 察閒,斷路復敗observe — 供速鐘之察法;du-dum 結構何時與何以經要成可行forage-resources — 謀探層;du-dum 乃其運行之執節奏coordinate-reasoning — 間接信法;要文乃一種間接協(經環境遺物)