The FreshContext
Specification
What this is
The FreshContext Specification defines a standard envelope format for AI-retrieved web data.
It exists to solve one problem: AI models present stale data with the same confidence as fresh data, and users have no way to tell the difference.
Any tool, agent, or system that implements this spec is FreshContext-compatible.
The envelope format
Every FreshContext-compatible response MUST wrap its content in the following text envelope:
[FRESHCONTEXT] Source: <canonical_url> Published: <content_date_or_unknown> Retrieved: <iso8601_datetime> Confidence: <high|medium|low> --- <content> [/FRESHCONTEXT]
| Field | Required | Format | Description |
|---|---|---|---|
Source | Yes | Valid URL | Canonical URL of the original source |
Published | Yes | ISO 8601 date or unknown | Best estimate of when the content was originally published |
Retrieved | Yes | ISO 8601 datetime with timezone | Exact timestamp when this data was fetched |
Confidence | Yes | high, medium, or low | Confidence level of the Published date estimate |
Confidence levels
Structured JSON form
Implementations MAY additionally expose freshness metadata as structured JSON. This form can be validated against the JSON Schema.
{ "freshcontext": { "source_url": "https://github.com/owner/repo", "content_date": "2026-03-05", "retrieved_at": "2026-04-05T09:19:00.000Z", "freshness_confidence": "high", "freshness_score": 94, "adapter": "github", "decay_rate": 1.0 }, "content": "..." }
Validate with: npx freshcontext-validate <json_string>
Freshness score
An optional numeric freshness value 0–100:
freshness_score = max(0, 100 - (days_since_retrieved × decay_rate))
| Score | Interpretation |
|---|---|
90–100 | Retrieved within hours — treat as current |
70–89 | Retrieved within days — reliable for most uses |
50–69 | Retrieved within weeks — verify before acting |
<50 | Retrieved more than a month ago — use with caution |
Domain-specific decay rates
| Category | Decay rate | Half-life | Adapters |
|---|---|---|---|
| Financial data | 5.0 | ~10 days | extract_finance |
| Job listings | 3.0 | ~17 days | search_jobs |
| News / HN / Reddit | 2.0 | ~25 days | extract_hackernews, extract_reddit, extract_producthunt |
| Gov contracts / YC | 1.5 | ~33 days | extract_govcontracts, extract_yc, extract_gebiz |
| GitHub / packages | 1.0 | ~50 days | extract_github, search_repos, package_trends, extract_changelog |
| Academic papers | 0.3 | ~167 days | extract_scholar, extract_arxiv |
| Default | 1.5 | ~33 days | All unlisted adapters |
Adapter contract
Any data source that feeds into a FreshContext-compatible system is called an adapter.
Adapters MUST:
- Return raw content plus a
content_date(ornullif unknown) - Set a
freshness_confidencelevel based on how the date was determined - Never fabricate or forward-date content timestamps
- Identify the source system via the
adapterfield
Adapters SHOULD:
- Prefer structured API sources over scraped content when both are available
- Surface rate-limit or access-denied errors explicitly rather than returning empty content
- Never silently return cached or stale data on retrieval failure
Composite adapters (v1.1)
A composite adapter combines multiple single-source adapters into one call. Composites MUST:
- Run constituent adapters in parallel (Promise.allSettled or equivalent)
- Handle partial failures gracefully — if one source fails, the others still return
- Label each section with its source adapter name
- Include a
Generated:timestamp at the top of combined output - Support an optional
min_freshness_scoreparameter (0–100) to filter constituent results
When min_freshness_score is set, any constituent result below the threshold is replaced with a staleness warning rather than omitted, preserving output structure.
Compatibility levels
freshness_score on every result. Agents can filter by score threshold.[FRESHCONTEXT] envelope OR JSON form with retrieved_at + freshness_confidence.retrieved_at without freshness_confidence. Partial implementation.Verify: npx freshcontext-validate <response>
Implementations
Why this matters for AI agents
Large language models have no internal clock. When an agent retrieves web data, it cannot distinguish between something published this morning and something published three years ago — unless that information is explicitly surfaced.
The spec started from a concrete failure: the author asked an AI to help find a job. It returned listings. Three applications later — two roles no longer existed, one had closed two years prior. The AI presented everything with equal confidence.
FreshContext is the fix. Every piece of retrieved data carries its own timestamp. The agent can reason about data age before acting. Users can see exactly how fresh their AI’s information is.
Changelog
- Added composite adapter contract (parallel execution, graceful partial failure, section labelling)
- Added
min_freshness_scoreparameter spec for composite adapters - Added
decay_ratefield to JSON form - Formalised three compatibility levels: FreshContext-scored, compatible, aware
- Added JSON Schema (
freshcontext.schema.json) and CLI validator (npx freshcontext-validate) - Published spec site at freshcontext-site.pages.dev/spec.html
- Initial specification: envelope format, three confidence levels, optional JSON form, freshness_score formula, adapter contract
- Reference implementation: freshcontext-mcp with 11 adapters