forage-resources
について
このスキルは、アリコロニー最適化と採餌理論を応用し、総当たり手法が機能しない大規模な解空間を効率的に探索します。既知の良好な解の活用と新たな選択肢の探索のバランスを取り、偵察要員の配置と経路の強化を管理します。リソース配分の最適化、早期収束の回避、分散型探索問題における探索と活用のトレードオフの処理にご利用ください。
クイックインストール
Claude Code
推奨npx skills add pjt222/agent-almanac -a claude-code/plugin add https://github.com/pjt222/agent-almanacgit clone https://github.com/pjt222/agent-almanac.git ~/.claude/skills/forage-resourcesこのコマンドをClaude Codeにコピー&ペーストしてスキルをインストールします
ドキュメント
Forage Resources
Apply foraging theory and ant colony optimization to system search for, check, and exploit spread resources — balance roam of unknown ground with exploit of known yields.
When Use
- Search large solution space where brute-force count is not practical
- Balance invest between roaming new paths and deepening known good ones
- Tune resource spend across many uncertain chances
- Design search strategies for spread teams or auto agents
- Spot premature converge (stuck on local optima) or endless wander (never commit)
- Complement
coordinate-swarmwith specific resource-find patterns
Inputs
- Required: Desc of resource being sought (info, compute, talent, solutions, chances)
- Required: Desc of search space (size, structure, known features)
- Optional: Current search strategy and its fail mode
- Optional: Count of open scouts/searchers
- Optional: Cost of roam vs cost of exploit fail
- Optional: Time horizon (short-term exploit vs long-term roam)
Steps
Step 1: Map the Foraging Landscape
Describe resource env to pick right forage strategy.
- Spot resource type and its distribution:
- Concentrated: resources cluster in rich patches (e.g., talent in specific communities)
- Distributed: resources spread evenly (e.g., bugs across codebase)
- Ephemeral: resources appear and vanish (e.g., market chances)
- Nested: rich patches hold sub-patches at different scales
- Check info landscape:
- How much known about resource spots before forage starts?
- Can scouts share info with foragers? (see
coordinate-swarmfor signal design) - Is landscape static or shifting while you forage?
- Figure cost structure:
- Cost per scout sent (time, compute, money)
- Cost of exploit low-quality resource (chance cost)
- Cost of missing high-quality resource (regret)
Got: Described forage landscape with resource distribution type, info availability, cost structure. This picks which forage model to apply.
If fail: Landscape fully unknown? Start with max roam (all scouts, no exploit) for fixed time budget to build first map. Switch to right model once landscape character becomes clear.
Step 2: Deploy Scouts with Trail Marking
Send roam agents into search space with orders to mark what they find.
- Set scout percent (start with 20-30% of open agents as scouts)
- Set scout behavior:
- Move through search space with randomized or systematic patterns
- Check each spot met (quick check, not deep analysis)
- Mark finds with signal strength by quality:
- High quality → strong trail signal
- Medium quality → moderate signal
- Low quality → weak signal or no signal
- Return info to collective (signal deposit, report, broadcast)
- Design scout pattern:
- Random walk: good for unknown, uniform landscapes
- Levy flight: long jumps with occasional local clustering — good for patchy resources
- Systematic sweep: grid or spiral — good for bounded, well-defined spaces
- Biased random: lean toward areas like past finds — good for clustered resources
Got: Scouts sent across search space, dropping trail signals by resource quality. First map of landscape starts to emerge from scout reports.
If fail: Scouts find nothing in first sweep? Either scout percent too low (bump to 50%), search pattern wrong (switch from random walk to Levy flight for patchy resources), or quality check miscalibrated (lower detection threshold).
Step 3: Establish Trail Reinforcement
Make positive feedback loops that amplify good paths and let bad ones fade.
- When forager follows trail and finds good resource:
- Reinforce trail signal (bump strength)
- Reinforced signal pulls more foragers → more reinforcement → exploit
- When forager follows trail and finds nothing:
- Do not reinforce (let trail decay natural)
- Weakening signal pulls fewer foragers → trail fades → roam resumes
- Set reinforcement params:
- Deposit amount: by resource quality found
- Decay rate: trails lose X% of strength per time unit
- Saturation cap: max trail strength (blocks runaway exploit of single path)
Trail Reinforcement Dynamics:
┌─────────────────────────────────────────────────────────────────────┐
│ │
│ Strong trail ──→ More foragers ──→ If good: reinforce ──→ EXPLOIT │
│ ↑ │ │
│ │ If bad: no reinforce │ │
│ │ │ │ │
│ │ ↓ │ │
│ Decay ←── Weak trail ←── Fewer foragers ←── Trail fades │ │
│ │ │ │
│ ↓ │ │
│ No trail ──→ Scouts explore ──→ New discovery ──→ New trail ↗ │
│ │
└─────────────────────────────────────────────────────────────────────┘
Got: Self-regulating feedback loop where good resources pull growing focus and poor resources naturally abandoned. System balances exploit and roam through trail dynamics alone.
If fail: All foragers converge on single trail (premature converge)? Decay rate too slow or saturation cap too high. Bump decay, lower cap, or add random roam rules (e.g., 10% of foragers always ignore trails). Trails fade too fast and nothing gets exploited? Drop decay rate.
Step 4: Detect Diminishing Returns
Watch resource yields to know when to shift from exploit back to roam.
- Track yield per unit effort for each active forage site:
- Yield rising → healthy exploit, keep going
- Yield flat → close to saturation, start scouting alternatives
- Yield dropping → diminishing returns, cut foragers, bump scouts
- Apply marginal value theorem:
- Compare current site yield rate to average yield rate across all known sites
- When current site drops below average, time to leave
- Factor in travel cost (cost of switching to new site)
- Fire scouting waves when:
- Overall yield across all sites drops below threshold
- Best-performing site exploited longer than its expected life
- Env change spotted (new signals from scouts in unexplored areas)
Got: Forage swarm naturally shifts between exploit phases (focused on known-good sites) and roam phases (scouts spread), driven by yield watch rather than fixed schedules.
If fail: Swarm stays on depleted sites too long? Marginal value threshold too low or travel cost estimate too high. Recalibrate by compare real yield rates. Swarm abandons good sites too early? Threshold too sensitive — add smoothing window to yield measure.
Step 5: Adapt Foraging Strategy to Conditions
Pick and switch between forage strategies by env feedback.
- Match strategy to landscape:
- Rich, clustered: commit heavy to found patches (high exploit)
- Sparse, scattered: keep high scout ratio (high roam)
- Volatile, changing: short trail decay, frequent scouting waves (adaptive)
- Competitive: faster reinforcement, pre-emptive trail marking (territorial)
- Watch for strategy-env mismatch:
- High effort, low yield → strategy too exploit for landscape
- High find rate, low follow-through → strategy too roam
- Oscillating yield → strategy switching too aggressive
- Do adaptive switching:
- Track rolling average of roam-to-exploit ratio
- If ratio drifts too far from best (set by landscape type), nudge back
- Allow gradual shifts — abrupt strategy switches cause coord chaos
Got: Forage system that adapts its roam-exploit balance to current env, keeping effect as conditions shift.
If fail: Strategy adapt itself becomes unstable (oscillating between roam and exploit)? Add damping: need mismatch signal to stick for N time units before fire strategy shift. No strategy seems to work? Recheck landscape description from Step 1 — resource distribution may be more complex than first assumed.
Validation
- Forage landscape described (distribution type, info open, cost structure)
- Scout percent and search pattern set and deployed
- Trail reinforcement loop works with deposit, decay, and saturation params
- Diminishing returns detect fires rebalance from exploit to roam
- Strategy-env match watched and adaptive switch configured
- System recovers from landscape shifts (new resources, depleted resources)
Pitfalls
- Premature converge: All foragers pile onto first good find, skip possibly better options. Cure: mandatory roam percent, trail saturation caps, and decay
- Endless roam: Scouts keep finding new options but swarm never commits. Cure: lower quality threshold for trail reinforcement, drop scout percent
- Ignore travel costs: Switch sites has cost. Foragers that jump between same-quality sites waste more on travel than they gain. Factor travel cost into marginal value count
- Static strategy in dynamic landscape: Strategy tuned for yesterday fails tomorrow. Build adapt into forage loop, not as afterthought
- Mix scout quality with forager quality: Good scouts (broad, quick check) and good foragers (deep, full exploit) need different skills. Do not force all agents into both roles
See Also
coordinate-swarm— base coord patterns that back forage signal designbuild-consensus— used when swarm must collectively agree on which resource patches to prioritizescale-colony— scaling forage ops when resource landscape or swarm size growsassess-form— morphic skill for check of current state of system, complement to landscape checkconfigure-alerting-rules— alerting patterns apply to diminishing returns detectplan-capacity— capacity plan shares explore-exploit frame with forage theoryforage-solutions— AI self-apply variant; maps ant colony forage to single-agent solution roam with scout hypotheses and trail reinforcement
GitHub リポジトリ
関連スキル
llamaguard
その他LlamaGuardは、暴力やヘイトスピーチなど6つの安全性カテゴリーにおいて、LLMの入力と出力をモデレートするMetaの70-80億パラメータモデルです。94〜95%の精度を提供し、vLLM、Hugging Face、Amazon SageMakerを使用してデプロイ可能です。このスキルを使用して、AIアプリケーションにコンテンツフィルタリングと安全策を簡単に統合できます。
cost-optimization
その他このClaudeスキルは、リソースの適正サイジング、タグ付け戦略、支出分析を通じて、開発者がクラウドコストを最適化することを支援します。AWS、Azure、GCPにわたるクラウド支出の削減とコストガバナンスの実施のためのフレームワークを提供します。インフラコストの分析、リソースの適正サイジング、または予算制約への対応が必要な際にご利用ください。
quantizing-models-bitsandbytes
その他このスキルは、bitsandbytesを使用してLLMを8ビットまたは4ビット精度に量子化し、精度の低下を最小限に抑えつつ50〜75%のメモリ削減を実現します。限られたGPUメモリでより大規模なモデルを実行したり、推論を高速化するのに理想的で、INT8、NF4、FP4などのフォーマットをサポートしています。HuggingFace Transformersと統合され、QLoRAトレーニングや8ビットオプティマイザーを可能にします。
dispatching-parallel-agents
その他このClaudeスキルは、複数のエージェントを配備し、3つ以上の独立した問題を並行して調査・修正します。共有状態や依存関係がなく解決可能な、無関係な障害が発生するシナリオ向けに設計されています。中核となる機能は並列問題解決であり、効率を最大化するために独立した問題領域ごとに1つのエージェントを割り当てます。
