freshcontext-mcp 0.3.13 → 0.3.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.actor/Dockerfile +7 -4
- package/.actor/actor.json +1 -1
- package/CONTEXT_SKILL.md +84 -0
- package/FRESHCONTEXT_SPEC.md +80 -6
- package/HANDOFF.md +220 -91
- package/METHODOLOGY.md +277 -0
- package/README.md +195 -41
- package/SESSION_SAVE_V5.md +121 -0
- package/SESSION_SAVE_V6.md +194 -0
- package/SESSION_SAVE_V9.md +170 -0
- package/dist/apify.js +133 -0
- package/dist/server.js +92 -46
- package/freshcontext-validate.js +196 -0
- package/freshcontext.schema.json +103 -0
- package/input_schema.json +16 -17
- package/package.json +2 -2
- package/server.json +3 -3
package/.actor/Dockerfile
CHANGED
|
@@ -1,16 +1,19 @@
|
|
|
1
|
-
FROM apify/actor-node:20
|
|
1
|
+
FROM apify/actor-node-playwright-chrome:20
|
|
2
2
|
|
|
3
3
|
# Copy package files first for better Docker layer caching
|
|
4
4
|
COPY package*.json ./
|
|
5
5
|
|
|
6
|
-
# Install
|
|
6
|
+
# Install dependencies
|
|
7
7
|
RUN npm install --include=dev
|
|
8
8
|
|
|
9
|
+
# Install Chromium matching the npm-installed Playwright version
|
|
10
|
+
RUN npx playwright install chromium
|
|
11
|
+
|
|
9
12
|
# Copy source and pre-built dist
|
|
10
13
|
COPY . ./
|
|
11
14
|
|
|
12
|
-
# Rebuild TypeScript
|
|
15
|
+
# Rebuild TypeScript
|
|
13
16
|
RUN npm run build || echo "Build had warnings, using pre-compiled dist/"
|
|
14
17
|
|
|
15
|
-
#
|
|
18
|
+
# Run the Actor entry point
|
|
16
19
|
CMD ["node", "dist/apify.js"]
|
package/.actor/actor.json
CHANGED
package/CONTEXT_SKILL.md
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
# FreshContext Project Context Skill
|
|
2
|
+
|
|
3
|
+
## Purpose
|
|
4
|
+
Generate a compressed, structured context map of the FreshContext project state. Used at the start of new sessions to restore working context without re-reading full session saves. Reduces token usage by ~70% compared to full session save parsing.
|
|
5
|
+
|
|
6
|
+
## When to use
|
|
7
|
+
- Start of any new chat session on the FreshContext project
|
|
8
|
+
- When context window is filling up and compression is needed
|
|
9
|
+
- When asked to "load context", "restore state", or "what are we working on"
|
|
10
|
+
|
|
11
|
+
## Output format
|
|
12
|
+
|
|
13
|
+
Generate a context map in this structure:
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
PROJECT: FreshContext MCP
|
|
17
|
+
STATE: [one line — what's live vs pending]
|
|
18
|
+
|
|
19
|
+
CORE FILES:
|
|
20
|
+
- worker/src/intelligence.ts [DAR engine — exponential decay scoring]
|
|
21
|
+
- worker/src/worker.ts [Cloudflare Worker — all endpoints + cron]
|
|
22
|
+
- worker/src/synthesize.ts [Claude briefing synthesis — paused, needs key]
|
|
23
|
+
- METHODOLOGY.md [formal IP documentation]
|
|
24
|
+
- FRESHCONTEXT_SPEC.md [open standard v1.1]
|
|
25
|
+
|
|
26
|
+
INFRASTRUCTURE:
|
|
27
|
+
- Worker: https://freshcontext-mcp.gimmanuel73.workers.dev [LIVE]
|
|
28
|
+
- D1: freshcontext-db (d9898d65-f67e-4dcb-abdc-7f7b53f2d444) [LIVE]
|
|
29
|
+
- KV: RATE_LIMITER + CACHE [LIVE]
|
|
30
|
+
- Cron: 0 */6 * * * [RUNNING]
|
|
31
|
+
- npm: freshcontext-mcp@0.3.15 [LIVE]
|
|
32
|
+
|
|
33
|
+
ENDPOINTS:
|
|
34
|
+
/mcp — MCP transport (all tools)
|
|
35
|
+
/briefing — GET latest stored briefing
|
|
36
|
+
/briefing/now — POST force scrape + synthesize
|
|
37
|
+
/watched-queries — GET list all watched queries
|
|
38
|
+
/v1/intel/feed/:id — GET DAR-scored intelligence feed
|
|
39
|
+
/debug/db — GET D1 counts + recent scores
|
|
40
|
+
/debug/scrape — GET run one adapter raw
|
|
41
|
+
|
|
42
|
+
DAR ENGINE (intelligence.ts):
|
|
43
|
+
R_t = R_0 · e^(-λt)
|
|
44
|
+
λ: HN=0.050 Reddit=0.010 Jobs=0.005 Finance=0.001 GitHub=0.0002 Scholar=0.00005
|
|
45
|
+
Outputs: base_score, rt_score, entropy(low/stable/high), ha_pri_sig, published_at, semantic_fingerprint
|
|
46
|
+
|
|
47
|
+
D1 SCHEMA additions (idempotent on every cron):
|
|
48
|
+
base_score, rt_score, ha_pri_sig, entropy_level, published_at, semantic_fingerprint
|
|
49
|
+
|
|
50
|
+
KNOWN ISSUES:
|
|
51
|
+
- 12 TS type errors in worker.ts (type:"string" not literal "text") — wrangler deploys fine
|
|
52
|
+
- 130 node_modules conflicts (workers-types vs @types/node) — cosmetic
|
|
53
|
+
- Fix: add "skipLibCheck": true to tsconfig.json
|
|
54
|
+
|
|
55
|
+
BLOCKED ON:
|
|
56
|
+
- ANTHROPIC_KEY: not set — formatBriefing() fallback active
|
|
57
|
+
- Paddle verification: pending
|
|
58
|
+
|
|
59
|
+
NEXT BUILD PRIORITIES:
|
|
60
|
+
1. Webhook/trigger system — push signals when rt_score > threshold
|
|
61
|
+
2. Mining/industrial domain watched queries
|
|
62
|
+
3. Profile population (user_profiles table exists, nothing writes to it)
|
|
63
|
+
4. skipLibCheck tsconfig fix
|
|
64
|
+
|
|
65
|
+
COMMITS (current):
|
|
66
|
+
- d330dc3: DAR engine + intel feed endpoint
|
|
67
|
+
- a965554: ToolResult type fix + SESSION_SAVE_V9
|
|
68
|
+
- b9df76b: semantic deduplication + METHODOLOGY.md
|
|
69
|
+
|
|
70
|
+
AUTHOR: Immanuel Gabriel · Grootfontein, Namibia · gimmanuel73@gmail.com
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## Instructions for Claude
|
|
74
|
+
|
|
75
|
+
At session start:
|
|
76
|
+
1. Read SESSION_SAVE_V9.md for detailed state
|
|
77
|
+
2. Output the context map above — compressed, no prose
|
|
78
|
+
3. Ask: "What are we working on today?"
|
|
79
|
+
|
|
80
|
+
Mid-session update: revise only changed fields. Don't regenerate the full map.
|
|
81
|
+
|
|
82
|
+
## Token budget
|
|
83
|
+
Full session save: ~2,500 tokens. This map: ~400 tokens.
|
|
84
|
+
Use this for orientation. Use session saves only for deep debugging.
|
package/FRESHCONTEXT_SPEC.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# The FreshContext Specification
|
|
2
|
-
**Version 1.
|
|
2
|
+
**Version 1.1 — April 2026**
|
|
3
3
|
*Authored by Immanuel Gabriel (Prince Gabriel) — Grootfontein, Namibia*
|
|
4
4
|
|
|
5
5
|
---
|
|
@@ -51,7 +51,7 @@ Confidence: <high|medium|low>
|
|
|
51
51
|
### `high`
|
|
52
52
|
The publication date was sourced from a structured, machine-readable field — an API response, HTML metadata tag, RSS feed, or official timestamp. The date is reliable.
|
|
53
53
|
|
|
54
|
-
*Examples: GitHub API `pushed_at`, arXiv submission date, Hacker News `created_at
|
|
54
|
+
*Examples: GitHub API `pushed_at`, arXiv submission date, Hacker News `created_at`, SEC EDGAR filing date, USASpending.gov award date*
|
|
55
55
|
|
|
56
56
|
### `medium`
|
|
57
57
|
The publication date was inferred from page signals — visible date strings, URL patterns, or content heuristics. Likely correct but not guaranteed.
|
|
@@ -91,7 +91,22 @@ A numeric representation of data freshness from 0–100, calculated as:
|
|
|
91
91
|
freshness_score = max(0, 100 - (days_since_retrieved × decay_rate))
|
|
92
92
|
```
|
|
93
93
|
|
|
94
|
-
Where `decay_rate` defaults to `1.5` for general web content. Implementations MAY use domain-specific decay rates
|
|
94
|
+
Where `decay_rate` defaults to `1.5` for general web content. Implementations MAY use domain-specific decay rates to reflect how quickly different categories of data become unreliable.
|
|
95
|
+
|
|
96
|
+
#### Recommended Decay Rates by Domain
|
|
97
|
+
|
|
98
|
+
| Category | Decay Rate | Approximate Half-life | Examples |
|
|
99
|
+
|---|---|---|---|
|
|
100
|
+
| Financial data | 5.0 | ~10 days | Stock prices, market cap, P/E ratios |
|
|
101
|
+
| Job listings | 3.0 | ~17 days | Remote job boards, HN Who is Hiring |
|
|
102
|
+
| News / HN / Reddit | 2.0 | ~25 days | Top stories, community discussion |
|
|
103
|
+
| Government procurement | 1.5 | ~33 days | USASpending.gov, GeBIZ tenders |
|
|
104
|
+
| GitHub repositories | 1.0 | ~50 days | Stars, forks, last commit, README |
|
|
105
|
+
| Product releases | 1.0 | ~50 days | Changelog entries, npm versions |
|
|
106
|
+
| Academic papers | 0.3 | ~167 days | arXiv submissions, Google Scholar |
|
|
107
|
+
| General web content | 1.5 | ~33 days | Default for unclassified sources |
|
|
108
|
+
|
|
109
|
+
#### Score Interpretation
|
|
95
110
|
|
|
96
111
|
| Score | Interpretation |
|
|
97
112
|
|---|---|
|
|
@@ -116,6 +131,22 @@ Adapters SHOULD:
|
|
|
116
131
|
- Prefer structured API sources over scraped content when both are available
|
|
117
132
|
- Log retrieval errors without silently returning cached or stale data
|
|
118
133
|
- Surface rate-limit or access-denied errors explicitly rather than returning empty content
|
|
134
|
+
- Use domain-specific decay rates from the recommended table above
|
|
135
|
+
|
|
136
|
+
---
|
|
137
|
+
|
|
138
|
+
## Composite Adapters
|
|
139
|
+
|
|
140
|
+
A **composite adapter** is a FreshContext-compatible adapter that calls multiple upstream adapters in parallel and combines their results into a single unified response. Each upstream result MUST retain its own FreshContext envelope — the composite wrapper MUST NOT collapse individual timestamps into a single envelope.
|
|
141
|
+
|
|
142
|
+
Composite adapters SHOULD:
|
|
143
|
+
|
|
144
|
+
- Fire all upstream calls in parallel (e.g. `Promise.allSettled`)
|
|
145
|
+
- Handle partial failures gracefully — if one upstream fails, return the rest
|
|
146
|
+
- Label each section clearly with its source adapter name
|
|
147
|
+
- Include a composite `retrieved_at` timestamp representing the time the composite call was initiated
|
|
148
|
+
|
|
149
|
+
*Examples in the reference implementation: `extract_landscape`, `extract_company_landscape`, `extract_idea_landscape`*
|
|
119
150
|
|
|
120
151
|
---
|
|
121
152
|
|
|
@@ -127,11 +158,13 @@ Without FreshContext (or equivalent):
|
|
|
127
158
|
- An agent recommending job listings may recommend roles that no longer exist
|
|
128
159
|
- An agent summarising market trends may cite conditions from a previous cycle
|
|
129
160
|
- An agent checking a competitor's pricing may act on outdated information
|
|
161
|
+
- An agent synthesising news may present last year's controversy as current
|
|
130
162
|
|
|
131
163
|
With FreshContext:
|
|
132
164
|
- Every piece of retrieved data carries its own timestamp
|
|
133
165
|
- The agent can reason about data age before acting
|
|
134
166
|
- Users can see exactly how fresh their AI's information is
|
|
167
|
+
- Composite intelligence reports carry per-source freshness signals
|
|
135
168
|
|
|
136
169
|
---
|
|
137
170
|
|
|
@@ -144,25 +177,66 @@ A tool, server, or API is **FreshContext-compatible** if:
|
|
|
144
177
|
|
|
145
178
|
Partial implementations that include only `retrieved_at` without `freshness_confidence` are considered **FreshContext-aware** but not fully compatible.
|
|
146
179
|
|
|
180
|
+
### Compatibility Levels
|
|
181
|
+
|
|
182
|
+
| Level | Requirements |
|
|
183
|
+
|---|---|
|
|
184
|
+
| **FreshContext-compatible** | Full envelope OR full JSON form with `retrieved_at` + `freshness_confidence` |
|
|
185
|
+
| **FreshContext-aware** | Includes `retrieved_at` but not `freshness_confidence` |
|
|
186
|
+
| **FreshContext-scored** | Full compatible + numeric `freshness_score` with domain-specific decay |
|
|
187
|
+
|
|
147
188
|
---
|
|
148
189
|
|
|
149
190
|
## Reference Implementation
|
|
150
191
|
|
|
151
192
|
The canonical reference implementation of this specification is:
|
|
152
193
|
|
|
153
|
-
**freshcontext-mcp** — an MCP server with
|
|
194
|
+
**freshcontext-mcp** — an MCP server with 20 adapters covering:
|
|
195
|
+
|
|
196
|
+
**Intelligence:** GitHub, Hacker News, Google Scholar, arXiv, Reddit
|
|
197
|
+
|
|
198
|
+
**Competitive research:** YC Companies, Product Hunt, GitHub repo search, npm/PyPI package trends
|
|
199
|
+
|
|
200
|
+
**Market data:** Yahoo Finance (up to 5 tickers), job listings (Remotive, RemoteOK, HN Hiring)
|
|
201
|
+
|
|
202
|
+
**Unique — not available in any other MCP server:**
|
|
203
|
+
- `extract_changelog` — release history from any repo, npm package, or website
|
|
204
|
+
- `extract_govcontracts` — US federal contract awards (USASpending.gov)
|
|
205
|
+
- `extract_sec_filings` — SEC 8-K material event disclosures (EDGAR)
|
|
206
|
+
- `extract_gdelt` — global news intelligence, 100+ languages, updated every 15 minutes
|
|
207
|
+
- `extract_gebiz` — Singapore Government procurement (data.gov.sg)
|
|
154
208
|
|
|
209
|
+
**Composite landscapes:** `extract_landscape`, `extract_idea_landscape`, `extract_gov_landscape`, `extract_finance_landscape`, `extract_company_landscape`
|
|
210
|
+
|
|
211
|
+
**Deployment:**
|
|
155
212
|
- npm: `freshcontext-mcp`
|
|
156
213
|
- GitHub: https://github.com/PrinceGabriel-lgtm/freshcontext-mcp
|
|
157
214
|
- Cloud endpoint: `https://freshcontext-mcp.gimmanuel73.workers.dev/mcp`
|
|
215
|
+
- Apify Store: `https://apify.com/prince_gabriel/freshcontext-mcp`
|
|
216
|
+
- MCP Registry: `io.github.PrinceGabriel-lgtm/freshcontext`
|
|
217
|
+
|
|
218
|
+
---
|
|
219
|
+
|
|
220
|
+
## Changelog
|
|
221
|
+
|
|
222
|
+
### Version 1.1 — April 2026
|
|
223
|
+
- Added Composite Adapters section
|
|
224
|
+
- Added domain-specific decay rate table with recommended values
|
|
225
|
+
- Added Compatibility Levels table (compatible / aware / scored)
|
|
226
|
+
- Updated reference implementation to 20 adapters
|
|
227
|
+
- Added `extract_gdelt`, `extract_gebiz`, `extract_sec_filings` to high-confidence examples
|
|
228
|
+
- Added Apify Store and MCP Registry to reference implementation listings
|
|
229
|
+
|
|
230
|
+
### Version 1.0 — March 2026
|
|
231
|
+
- Initial specification published
|
|
158
232
|
|
|
159
233
|
---
|
|
160
234
|
|
|
161
235
|
## Versioning
|
|
162
236
|
|
|
163
|
-
This document is version 1.
|
|
237
|
+
This document is version 1.1 of the FreshContext Specification.
|
|
164
238
|
|
|
165
|
-
Future versions will be tagged in this repository. Breaking changes to the envelope format will increment the major version. Additive changes (new optional fields, new confidence levels) will increment the minor version.
|
|
239
|
+
Future versions will be tagged in this repository. Breaking changes to the envelope format will increment the major version. Additive changes (new optional fields, new confidence levels, new recommended values) will increment the minor version.
|
|
166
240
|
|
|
167
241
|
---
|
|
168
242
|
|