Load state from disk
Save state to disk using atomic write (write-to-tmp + rename).
Clean up expired cache entries and old articles
Cache MCP query result with adaptive TTL.
Unique identifier for the query
Query result to cache
Optionalttl: numberTime to live in seconds (default: adaptive based on plenary hours)
Get cached MCP query result
Unique identifier for the query
Cached result or null if expired/missing
Add recent article to tracking
Article metadata
Check if article is duplicate based on similarity.
Uses both weighted title/topic/source similarity (โฅ 0.70 threshold) and Jaccard topic-only similarity (โฅ 0.50 threshold) to catch same-topic articles with different titles.
Article title
Article topics
MCP query keys used for this article
Optionalsignificance: numberOptional political significance score (0-100). When provided and โฅ 80, a same-topic article with lower significance is NOT treated as a duplicate โ the high-significance version overrides.
Duplicate check result with similarity score
Calculate similarity between two articles
Uses weighted combination of:
Similarity score 0.0-1.0
Calculate string similarity using Jaccard similarity of word sets
First string
Second string
Similarity 0.0-1.0
Calculate set overlap (Jaccard similarity)
First set
Second set
Overlap 0.0-1.0
Hash object for cache comparison
Object to hash
SHA-256 hash (first 16 hex chars)
Record workflow execution
Name of workflow
Execution metadata
Get active generations for cross-workflow visibility.
Get recent articles from last N hours
Hours to look back
Recent articles
Workflow State Coordinator