brainstorming
brainstorming
You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation).
manage-engagement-bufferManage an engagement buffer that ingests, prioritizes, rate-limits, deduplicates, and tracks state for incoming engagement items across platforms. Generates periodic digests and enforces cooldown periods. Composes with du-dum: du-dum sets the observation/action cadence, this skill manages the queue between beats.
Independent GitHub snapshot · Automated classification · Original documentation governs
收、排、限速、去重、追跨平台投入項之態。生期摘並執冷卻。與 du-dum 組:du-dum 設觀/動節,此技管拍間之列。
buffer_path — JSONL 緩文件路platform_config — 各平台限速與冷卻digest_size — 摘頂項數(默 5)ttl_hours — 未動項之生壽(默 48)cooldown_minutes — 動後線冷卻(默 60)設投入項結。緩中各項為單 JSON 行含此字段:
{
"id": "gh-notif-20260408-001",
"source": "github:pjt222/agent-almanac",
"timestamp": "2026-04-08T09:15:00Z",
"content_summary": "PR #218 review requested by contributor",
"priority": 4,
"state": "new",
"dedup_key": "github:pjt222/agent-almanac:pr-218:contributor-name",
"thread_id": "pr-218",
"ttl_hours": 48
}
字段定義:
| 字段 | 型 | 述 |
|---|---|---|
id | 串 | 獨識(源前綴+日+序) |
source | 串 | 平與道(github:repo、slack:channel、email:inbox) |
timestamp | ISO 8601 | 項收時 |
content_summary | 串 | 投入項之一行述 |
priority | int 1-5 | 合排(見步四) |
state | enum | new、acknowledged、acted、cooldown、merged、expired |
dedup_key | 串 | 合鍵:源+線+作者 |
thread_id | 串 | 話線識以追冷卻 |
ttl_hours | int | 未動過期時(默 48) |
存為 JSON Lines(各行一 JSON 象)。此格支僅追寫、行處、易按重寫除過期行而清。
得:於 buffer_path 初 JSONL 緩文件附模於伴註或頭。模穩足支諸下游步。
敗:緩文件不可造(權、路)→當週回內存列並記文系誤。勿默棄項——存於某處,即臨。
受平適配器之項並加至緩附初排:
按項型之初排:
| 型 | 排 | 理 |
|---|---|---|
| 直提(@agent) | 5 | 有人明求注 |
| 審請 | 4 | 阻他人工 |
| 追線中之應 | 3 | 代理參之活話 |
| 通知(派、訂) | 2 | 信息,或需動 |
| 廣播(發、通) | 1 | 僅覺,少可動 |
各新項:
state 為 newtimestamp 為當 UTCdedup_key# Pseudocode: ingest from GitHub adapter
for notification in github_adapter.fetch():
item = build_item(notification)
item.priority = priority_by_type(notification.reason)
item.state = "new"
append_jsonl(buffer_path, item)
log("ingested {item.id} priority={item.priority}")
得:新項現於緩附正排與 state=new。各適配器獨生合格項——適配器敗不阻他。
敗:平適配器敗(認過期、限速、網斷)→記敗並略此週之源。勿清現緩項——前成功取之陳項較空緩佳。
掃緩於可配窗(默 24 時)內共 dedup_key 之項。保最高排並他標為合:
dedup_key 組state=mergedthread_id 於 1 時內異作者示活動潮——合為單項附參者計加於 content_summary# Dedup logic
groups = group_by(buffer, "dedup_key", window_hours=24)
for key, items in groups:
if len(items) > 1:
keeper = max(items, key=lambda i: (i.priority, i.timestamp))
for item in items:
if item.id != keeper.id:
item.state = "merged"
# Thread burst detection
thread_groups = group_by(buffer, "thread_id", window_hours=1)
for thread_id, items in thread_groups:
active_items = [i for i in items if i.state == "new"]
if len(active_items) >= 3:
keeper = max(active_items, key=lambda i: i.priority)
keeper.content_summary += f" ({len(active_items)} participants)"
for item in active_items:
if item.id != keeper.id:
item.state = "merged"
得:緩無窗內重 dedup_key 項。線潮縮為單項附參者計。合項保於文件(審用)而除下游處外。
敗:去重生意外合(合法異項共鍵)→窄去重窗或精鍵構。加容散於去重鍵可辨共源+線+作者而容真異之項。
按合分(含近衰與升級)重排緩:
合分式:
score = base_priority * recency_weight * escalation_factor
recency_weight = 0.9 ^ hours_since_ingestion
escalation_factor = 1.0 + (resubmission_count * 0.2)
# Cap effective priority at 5
effective_priority = min(5, score)
行為:
3 * 1.0 * 1.0 = 3.03 * 0.43 * 1.0 = 1.29(衰下於排 2 項)2 * 1.0 * 1.4 = 2.8(升近排 3)排諸 state=new 項按 effective_priority 降。此排序即摘(步六)呈予 du-dum 者。
得:緩按合分排。新高排項於頂。老項衰。重提項升。無項逾排 5。
敗:若分式生反直覺排(如 1 時前排 2 項排上於新排 3)→調衰率。0.95/時 較和;0.85/時 較激。調以匹投入節奏。
以各平寫限與線冷卻阻代理過投:
平限速(由 platform_config 配):
| 平 | 默限 | 窗 |
|---|---|---|
| GitHub 評 | 1/20 秒 | 滾 |
| GitHub 審 | 3/時 | 滾 |
| Slack 訊 | 1/10 秒 | 滾 |
| 郵回 | 5/時 | 滾 |
線冷卻:代理動線後,該線入冷卻 cooldown_minutes(默 60)。冷卻中新項收而不於摘現。
誤退:受任平之 429/限速應→翻該平冷卻。成動後重設默。
# Rate limit check before action
def can_act(platform, thread_id):
if rate_limit_exceeded(platform):
return False, "rate limited"
if thread_in_cooldown(thread_id):
return False, "thread cooldown active"
return True, "clear"
# After action
def record_action(platform, thread_id):
increment_rate_counter(platform)
set_cooldown(thread_id, cooldown_minutes)
# After rate-limit error
def handle_rate_error(platform):
current_cooldown = get_platform_cooldown(platform)
set_platform_cooldown(platform, current_cooldown * 2)
得:代理永不逾平限速。線有執冷卻。限誤觸自退。緩冷卻中積項不失。
敗:即有執而限被觸(鐘偏、並代理)→加安全餘——設限為平實限之 80%。冷卻過激(失時敏線)→僅為高排線減 cooldown_minutes。
生 du-dum 動拍之緊要。摘乃交點:du-dum 讀之非原緩。
摘容:
state=new 項計digest_size)# Engagement Digest — 2026-04-08T12:00:00Z
## Pending: 12 items
### Top 5 by Priority
| # | Priority | Source | Summary | Age |
|---|----------|--------|---------|-----|
| 1 | 5.0 | github:pr-218 | Review requested by contributor | 2h |
| 2 | 4.2 | github:issue-99 | Maintainer question (escalated) | 6h |
| 3 | 3.0 | slack:dev | Build failure alert | 1h |
| 4 | 2.8 | github:pr-215 | CI check feedback (3 participants) | 3h |
| 5 | 2.1 | email:inbox | Collaboration inquiry | 8h |
### Expiring Soon
- github:issue-85 — 4h remaining (TTL 48h, ingested 44h ago)
### Cooldowns Active
- pr-210: 22 min remaining
- issue-92: 45 min remaining
### Buffer Health
- Total items: 47 | New: 12 | Merged: 18 | Acted: 11 | Expired: 6
寫摘至已知路(如 buffer_path.digest.md)供 du-dum 動鐘讀。
得:摘 < 50 行,du-dum 一讀解。摘含決動何之信息,非全緩。無待→摘明言。
敗:摘 > 50 行→減 digest_size 或更激總期/冷卻節。摘乃總——若近緩之大→失目。
du-dum 由摘處項後,更態並維審跡:
態機:
new → acknowledged → acted → cooldown → expired
↑ │
└───── (re-ingested) ───┘
merged → (終,無轉)
expired → (終,歸檔)
各態轉:
state 字段{"item_id": "...", "from": "new", "to": "acknowledged", "timestamp": "...", "reason": "du-dum digest pickup"}保留與修剪:
state=acted 或 state=expired 逾 7 日之項歸檔(可配)buffer_path.archive.jsonl),非刪state=merged 逾 24 時項修剪(已服去重目)# End-of-cycle maintenance
for item in buffer:
if item.state == "new" and age_hours(item) > item.ttl_hours:
transition(item, "expired", reason="TTL exceeded")
if item.state in ("acted", "expired") and age_days(item) > retention_days:
archive(item)
if item.state == "merged" and age_hours(item) > 24:
archive(item)
rewrite_buffer(buffer_path, active_items_only)
得:各態轉記時戳與理。緩文件僅含活項(new、acknowledged、cooldown)。歸項別存供審。緩不無界長。
敗:緩文件重寫時壞(部寫、崩)→由重寫前備恢。必寫臨文件並原子改名——勿原地重寫。歸過大→月壓或輪。
du-dum — 此緩組之節式;du-dum 決何時觀動,此技決何值動manage-token-budget — 本算;緩設摘尺並限動吞吐時守令牌約circuit-breaker-pattern — 饋緩之平適配器敗處;適配器斷路開時收優雅降coordinate-reasoning — 緩與動系間之群痕信號;緩文件本為群痕物forage-resources — 察饋緩收適配器之新投入源