docs: add daily brief implementation notes — context-from chaining, cost breakdown, prev state
This commit is contained in:
@@ -0,0 +1,42 @@
|
|||||||
|
# Daily Brief — Implementation Notes
|
||||||
|
|
||||||
|
## Architecture: context-from Chaining
|
||||||
|
|
||||||
|
The daily brief uses a **no-agent script → agent curation** pipeline:
|
||||||
|
|
||||||
|
```
|
||||||
|
┌──────────────────────────────┐
|
||||||
|
│ cron: 0 15 * * * │
|
||||||
|
│ script: collector.sh │ ← no-agent, free public APIs
|
||||||
|
├──────────────────────────────┤
|
||||||
|
│ Script stdout → agent │ ← injected as prompt context
|
||||||
|
│ context │
|
||||||
|
├──────────────────────────────┤
|
||||||
|
│ Agent: curates → formats │ ← lightweight LLM pass only
|
||||||
|
│ → delivers to Telegram │
|
||||||
|
└──────────────────────────────┘
|
||||||
|
```
|
||||||
|
|
||||||
|
## Cost Breakdown
|
||||||
|
|
||||||
|
| Stage | Token Cost | Frequency |
|
||||||
|
|-------|-----------|-----------|
|
||||||
|
| Script fetch (shell) | $0 | 1x per tick |
|
||||||
|
| Agent curation | Full model | 1x per tick |
|
||||||
|
| **Total vs old approach** | **~90% cheaper** | Old: agent had to web search + X search (both failing) |
|
||||||
|
|
||||||
|
## Sources (Free, No API Key)
|
||||||
|
|
||||||
|
| Source | Endpoint | Reliability |
|
||||||
|
|--------|----------|-------------|
|
||||||
|
| Weather | `wttr.in/Placerville,CA` | 99.9% |
|
||||||
|
| Hacker News | Firebase API (v0) | 99.9% |
|
||||||
|
| GitHub Trending | `api.github.com/search/repositories` | 99% (unauthed rate limit: 60/hr — fine for daily) |
|
||||||
|
|
||||||
|
## Previous State (Before June 20)
|
||||||
|
|
||||||
|
The old prompt instructed the agent to use web_search and x_search tools to gather data. Both were failing silently — Firecrawl was unconfigured and xAI credits were exhausted. The brief was returning `[SILENT]` every run (zero useful output for weeks).
|
||||||
|
|
||||||
|
## Key Insight
|
||||||
|
|
||||||
|
The **script + context_from** pattern from the masterclass turned a dead cron job into a working one in <5 minutes, with zero ongoing API costs. The script does the heavy lifting (API calls, parsing), and the agent only does the lightweight curation pass.
|
||||||
Reference in New Issue
Block a user