Spaces:
Sleeping
Sleeping
Commit History
-
Sync from GitHub main β ERP priority, WMCA/Shropshire watchlist, network preserve-owners fix (a7395ea)
Verified signaturea87217c
-
Output LGR landscape report as Word .docx alongside .mdβ
Piers Lyon +1: Claude Opus 4.7 (1M context)User wants the intel asset shareable as a proper Word doc rather than a Markdown file. Adding a focused markdownβdocx converter and wiring it into the LGR research script so every future run writes both formats automatically. md_to_docx.py β new module: Pure-python (python-docx, no pandoc shell-out) converter that handles the markdown patterns we actually emit in Claude reports: - ATX headings H1-H4 with Curium navy styling - Paragraphs, unordered + ordered lists - Bold / italic / inline code - Inline hyperlinks (rendered as proper Word hyperlinks) - Horizontal rules Not a general-purpose markdown engine β tables / fenced code / nested lists past one level all render as plain text. Trade-off is zero shell dependencies and ~150 lines of code. scripts/lgr_deep_research.py: Final persistence step now writes BOTH .md (for git diff / readability / re-run input) AND .docx (for sharing with the team). requirements.txt: + python-docx intel_assets/lgr_landsβ¦224df5f -
Deepen LGR research sweep β 4 more passes + streaming consolidationβ
Piers Lyon +1: Claude Opus 4.7 (1M context)User asked to "go deeper" on LGR research β leave no stone unturned across job sites, tender notices, LinkedIn, and council cabinet papers. Added 4 new passes after the original 5: 6. jobs_uk_boards β comprehensive UK job-board sweep covering JobsGoPublic, LG Jobs, MJ Recruitment, LGC Jobs, gov.uk Civil Service, Reed, Totaljobs, Indeed, CV-Library, direct council careers pages. 10 search budget. 7. tenders_deep β FTS + Contracts Finder + CCS frameworks (RM6187 MCF3 etc.) + regional consortia (NEPO, YPO, ESPO, Pro5). Catches PINs (early-warning notices) 3-6 months before tenders go live. 8 search budget. 8. linkedin_deep β aggressive site:linkedin.com queries via web_search to find named Programme Directors / Directors of Transformation at each priority council. ZERO LinkedIn account risk (uses Google's public index, not LinkedIn auth). 12 search budget. 9. moderngov_cabinet β Cabinet papers + committee agendas on ModernGov / Cβ¦563437a -
Deep LGR research sweep β script + landscape report (18 May 2026)β
Piers Lyon +1: Claude Opus 4.7 (1M context)User asked for a one-off deep research piece on LGR to identify every council planning or mobilising. Built a five-pass web_search sweep + Claude consolidation that produces a markdown landscape report and a structured lgr_tracker DB table. scripts/lgr_deep_research.py: Five focused passes via Anthropic web_search: 1. Current landscape β every council by LGR stage 2. Ministerial decisions + funding triggers (last 90d) 3. Transformation / programme / change leadership hires 4. Section 114 / Best Value / commissioner interventions 5. Major ERP rollouts coinciding with LGR Consolidation step merges multi-pass output into: - intel_assets/lgr_landscape_YYYY-MM-DD.md (markdown report) - lgr_tracker DB table (one row per council with curium_priority, lgr_stage, preferred_option, key_dates, intervention_status, transformation_hires, erp_systems, reasoning) Re-runnable quarterly to refresh the landscape. Cost: ~Β£3 in Claude tokens per run. intelβ¦4348881 -
Add 3 UK council intel feeds + Section 114 / commissioner detectionβ
Piers Lyon +1: Claude Opus 4.7 (1M context)Continuation of the LGR-focused intel work. Three new RSS feeds wired into intel_feeds.RSS_FEEDS (all verified live, all relevance-filtered): - nao_reports β National Audit Office. Critical audits of council programmes are recovery opportunities. Volume is intentionally low (the existing 'nao critical' / 'audit office criticism' classifier keywords catch what matters). - lgc β Local Government Chronicle. UK council trade press; surfaces exec moves, LGR analysis, contract awards before they syndicate to mainstream. First live pull caught: "Essex to launch challenge against LGR". - mhclg β Ministry of Housing, Communities & Local Government (gov.uk Atom). LGR ministerial decisions, council intervention orders, funding allocations. LGA / MJ / CIPFA don't publish RSS β would need HTML scraping which is fragile. Parked. Classifier extensions on the lgr_signal bucket: - Section 114 notices (council financial crisis) β "section 114 notice", "s11β¦dc0cef7 -
Make Monday cron reliable + wake HF Space after sendingβ
Piers Lyon +1: Claude Opus 4.7 (1M context)User noticed the Monday 18 May cron never fired β GitHub Actions silently dropped it. Two fixes in one commit. (1) Cron unreliability: GH Actions docs explicitly warn that "scheduled workflows may be delayed during periods of high load" β and the worst slot is anything on the exact top of an hour at peak European load (07:00 UTC). The old '0 7 * * 1' was sitting right in that hole. Replaced with two schedule entries: - Primary: '17 7 * * 1' (Monday 07:17 UTC / 08:17 BST) - Safety: '45 11 * * 1' (Monday 11:45 UTC / 12:45 BST) Minute-17 dramatically reduces the drop rate. If both fire, the orchestrator's hunt-cooldown guard makes the second a cheap no-op (state pull + early exit). If the primary drops, the safety net catches it within hours rather than us realising on Tuesday. (2) Wake the HF Space after sending: Even though the digest workflow is independent of the Space, the Space is what team members visit when they click the link in the digest. If it's asleep on Mondβ¦11992e6
-
Merge remote-tracking branch 'hf/main'
Piers Lyoncf6dc72 -
LGR (UK local-government reorganisation) as a tier-1 lead categoryβ
Piers Lyon +1: Claude Opus 4.7 (1M context)User uploaded an internal Curium briefing (Oxfordshire intro call) and asked for the lead engine to treat LGR β Local Government Reorganisation β as a first-class strategic opportunity. Every UK 2-tier county is being merged or considering merger; the integration risk (operating model + ERP + people change at once) is exactly the Curium sweet spot. Curium is already engaged at Staffordshire CC and in active discussion with Oxfordshire CC. Wired across four layers: 1. intel_assets/lgr_briefing.md β internal reference doc derived from the uploaded Word file. Captures the Curium positioning language, live engagements (Staffordshire, Oxfordshire), what "good" LGR signals look like, and the high-value questions a partner should ask on a call. The digest composer references this framing. 2. config.yaml: - public_sector companies expanded from 8 β 55: full LGR-cohort county councils (Essex, Hampshire, Kent, Surrey, Sussex, Norfolk, Suffolk, Hertfordshire, Lincolnshβ¦6e78cbc
-
Drop mailbox-poll feedback path β web form is the only routeβ
Piers Lyon +1: Claude Opus 4.7 (1M context)Per agreed plan: feedback is captured via the unauth web form on the HF Space (?form=feedback), not via email replies. The Microsoft Graph mailbox poll was blocked anyway by the tenant's Application Access Policy, so leaving it in the cron just produced noisy 403 lines in the logs every run. Changes: - scripts/weekly_hunt_and_email.py β Step 1.5 commented out, with a one-liner explaining how to re-enable if Mail.Read ever lands. - weekly_digest.py footer β drops the "Or just reply to this email" alternative line; the example phrases now read as form-input guidance instead. The downstream recap flow is unchanged. feedback_form._submit() already persists into the same feedback_messages / feedback_signals tables that feedback_digest reads, so the "What you told us last week" header keeps working β just sourced 100% from web form submissions now. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>ffb7a00 -
Add Piers to weekly digest recipients
Piers Lyonbffddba
-
Add diagnose-state workflow β verify HF Dataset health before Monday cronβ
Piers Lyon +1: Claude Opus 4.7 (1M context)Read-only health check on the dataset's leads.db. Reports: - Top-level row counts (companies, signals_*, signal_facts, macro_pulse, weekly_themes, feedback_*) - Per-colleague network_graph counts (the critical table β empty network_graph = empty digests on Monday morning) - Recent activity counts (last 7d / 30d at score>=50) - Warm-route lead candidates (the colleague x company x recent signal intersection that drives the digest) Built specifically because we had to fix a stale Space HF_TOKEN and want to confirm the underlying data is intact, not just that the auth path works again. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>bb49bbf -
Fix Space CONFIG_ERROR: don't add HF_STATE_REPO as both variable AND secretβ
Piers Lyon +1: Claude Opus 4.7 (1M context)The first run of sync-space-secrets pushed HF_STATE_REPO into the Space as a *secret*, but the Space already had it set as a *variable* (public env var). HF Spaces require unique keys across the variable/secret namespace, so the Space went CONFIG_ERROR with "Collision on variables and secrets names". Fix: - Delete any stale HF_STATE_REPO *secret* we may have created. - Set/refresh HF_STATE_REPO as a Space *variable* (the right place for a non-sensitive dataset path). - HF_TOKEN remains a secret (correctly). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>c9e8a05 -
Add sync-space-secrets workflow β fix the Space's 401 auth driftβ
Piers Lyon +1: Claude Opus 4.7 (1M context)The live Space's container log just showed the precise cause of the zero-data symptom: httpx.HTTPStatusError: Client error '401 Unauthorized' for url 'https://huggingface.co/datasets/mipwr-admin/curium-intel-state/ resolve/main/leads.db' The dataset URL is correct. The Space's own HF_TOKEN secret has gone stale (it's been there since 2026-04-30 per `gh secret list`'s GitHub counterpart, and the HF Space copy probably hasn't been touched since the Space was created). The GitHub Actions HF_TOKEN still works β last week's cron pulled the dataset successfully β so the two have drifted. Rather than push the rotation to the user (require them to find a working token, paste it into the Space settings UI, restart), this workflow programmatically copies the proven-working GH-side token onto the Space via huggingface_hub.add_space_secret() and restarts the Space. Safety: - Manual trigger only (workflow_dispatch). Doesn't fire on push. - Self-tests the GH-side token by calling dataset_iβ¦035ffeb -
Deploy Phase 1-4 + feedback loop + state_sync diagnostics (b189beb)
Verified signaturefcb0190 -
Surface the real HF Hub error in state_sync logsβ
Piers Lyon +1: Claude Opus 4.7 (1M context)The Space's container log was showing [state_sync] pull error: Force download failed due to the above error. which is huggingface_hub's wrapper exception with no detail. The actual HTTP error (401 / 403 / 404) lives on the inner exception and was being swallowed. Patch: - HfHubHTTPError handler now also prints the HTTP status code (so 401 vs 403 vs 404 are obvious at a glance β different fixes for each). - Generic Exception handler now prints the full traceback AND a one-line summary of the call args (repo, token length, token prefix). No secret leakage β only length and the first 4 chars. This lets the next Space restart self-diagnose: if the log shows HTTP 401 β the Space's HF_TOKEN is invalid (rotate it). HTTP 403 β the token exists but lacks read scope on the dataset. HTTP 404 β HF_STATE_REPO points to a non-existent dataset. Anything else β the traceback will tell us. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>b189beb -
Add deploy-to-Space workflow β manual trigger, no auto-deployβ
Piers Lyon +1: Claude Opus 4.7 (1M context)Diagnosis: the live HF Space (mipwr-admin/curium-intel) hasn't rebuilt since 2026-05-05. None of the Phase 1-4 work, feedback loop, or hardening landed on the Space because there was no GitHubβSpace sync configured. The Monday cron runs in GitHub Actions so emails are unaffected, but the dashboard the team visits has been frozen for almost a week. This workflow uses huggingface_hub.upload_folder() to push the repo to the Space when manually triggered. Manual-only on purpose β a "git push to main" never silently deploys to production. Flip to `on: push: branches: [main]` once we trust the pipeline. Safety guards in the workflow: - Refuses to deploy if a .env file is in the checkout. - Greps tracked files for committed API key literals and aborts on a hit. - Excludes: leads.db, sales_signals.db, venv/, __pycache__/, logs/, data/, .env*, .claude/, memory/, *.xlsx, *.csv, .git/, .github/, .vscode/, .idea/, .DS_Store, deploy docs. - Concurrency group ensures only one deploy runs at β¦482374c -
Harden public feedback form against abuse + roster leakβ
Piers Lyon +1: Claude Opus 4.7 (1M context)Tightens the unauth /?form=feedback page so the only thing it can do is accept signed-attribution feedback from people who already received a digest. Changes: - HMAC-sign the recipient name in digest URLs. The footer link is now /?form=feedback&from=Stu&sig=<16-hex>. Form only honours ?from= when the signature verifies AND the name is in team_emails. Forged or forwarded links can no longer pose as a colleague or enumerate the team roster. - When no valid signature is present, the form shows a generic "Your name (optional)" text field instead of a dropdown β no internal team names exposed to outsiders. - Per-session rate limit: max 5 submissions, 20s cooldown between submits. Stops accidental spam + caps LLM-cost amplification from a misbehaving client. - Input limits: 8 < body β€ 4000 chars (hard-truncate above). - LLM parser system prompt now explicitly treats reply text as untrusted; "ignore previous instructions" patterns in user input no longer have grammatical β¦bd531ac -
Add unauth web feedback form β primary capture pathβ
Piers Lyon +1: Claude Opus 4.7 (1M context)Email replies are messy: the tenant Application Access Policy blocked Mail.Read on the digest mailbox, and recipients reading from a personal inbox would never have their replies routed back to us anyway. A web form sidesteps all of it. What ships: - New feedback_form.py renders a single-purpose Streamlit page (name dropdown pre-filled from ?from= query param, free-text body, one submit button, tight thank-you). No login required. - app.py recognises ?form=feedback BEFORE the auth gate and routes to the public form, st.stop()'s before anything else loads. No other page is affected. - Form submissions flow through the SAME parser + storage path as mailbox replies (feedback_ingest.parse_reply_to_signals β _store_message). A new recipient_override kwarg lets web-form submissions tag the colleague directly, since the synthetic web-form sender address wouldn't match team_emails. - Digest footer now leads with a prominent "Open feedback form β" button (URL pre-filled with β¦b28e767 -
Drop visible feedback tokens β natural-language replies onlyβ
Piers Lyon +1: Claude Opus 4.7 (1M context)The token render was unreliable (LLM dropped the instruction inconsistently) and visually noisy. Recipients will write "Bentley felt thin" / "more food manufacturing" / "loved the FDE theme" β not "lead-bentley-motors-2026w19". Changes: - Digest prompt no longer asks Claude to append a slug tag to <h3>. - Feedback footer rewritten: short paragraph + three natural-language example phrases, no token syntax. - Parser system prompt updated: keeps target_token=null, leans on target_label resolution from the natural-language reference. The feedback_token field is still computed per lead (internal use β reserved for future structured workflows like clickable feedback URLs or per-lead vote endpoints) but no longer surfaced in the rendered email. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>e83d1af -
Closed-loop feedback: recipients reply, system digests, recap surfacesβ
Piers Lyon +1: Claude Opus 4.7 (1M context)Adds a feedback round-trip so each weekly digest learns from the recipient's reply to the previous one. Capture - Every lead in the email gets a stable feedback token (lead-<company-slug>-<isoYYYYwWW>) printed as a small grey tag next to the company name. - A "Help us tune this β just reply" footer is appended to every email body, telling recipients they can either quote a lead token ("lead-bentley-motors-2026w19 β already knew") or write naturally ("more food manufacturing", "loved the FDE theme"). - Reply-To remains the existing ADMIN_EMAIL convention; no recipient workflow change required. Ingest (feedback_ingest.py) - Polls the mailbox via the SAME Microsoft Graph app registration used for sendMail. Requires Mail.Read permission to be granted on the app β fails cleanly with a 403 in logs otherwise (digest still ships, recap section just renders empty). - Mailbox priority: FEEDBACK_INBOX > MS_GRAPH_REPLY_TO > ADMIN_EMAIL > MS_GRAPH_FROM_EMAIL. - For each new reβ¦3395614 -
Polish macro pulse: working feeds + require quantified bulletsβ
Piers Lyon +1: Claude Opus 4.7 (1M context)Drops dead feeds (Reuters returns 401, CIPD RSS redirects to 0 items) and adds working replacements: BoE Statistics, HM Treasury announcements, OBR fiscal reports, Guardian Business, Economist Britain and F&E. Tightens the LLM-output validator to reject any indicator without an explicit digit in value_text β closes a quality miss from the Phase 2 smoke test where "Youth unemployment: record high" survived despite lacking a number. The manual benchmark's defining feature is that every bullet leads with a quantified fact; this validator enforces it mechanically rather than relying solely on the LLM's prompt-following. Smoke test: feed pool grew from 16 to 22 candidate items; tighter validator drops 1 non-quantified bullet, keeps 3 quality indicators (Cloudflare AI layoffs, employee engagement cost, construction admins). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>b06b0e9 -
Lead-gen + market research quality upgrade (Phases 1-4)β
Piers Lyon +1: Claude Opus 4.7 (1M context)Brings digest + briefing output up to the layout and specificity of a manually-researched intel pack: macro context β cross-sector themes β cited reports β company-specific news with quantified facts and exec quotes weaved in. Phase 1 β Extraction - brain.py / news_radar.py prompts now extract quantified_facts (Β£/$ figures, headcount, %, timelines), executive_quotes (named attribution), confidence (official|confirmed|rumour), impact_scope (company_wide|divisional|site_specific|individual). - New signal_facts table + JSON columns on signals_news / signals_jobs. - Wired through hunter.py, council_scanner.py callsites. Existing no-LLM scraped-post paths default to None β backwards compatible. Phase 2 β UK macro pulse - New macro_intel.py: 10 free UK macro feeds (BoE, ONS, BBC, Sky, FT, Reuters, CIPD, Personnel Today, Construction News, Building) β keyword filter β Claude extracts 4-8 quantified weekly indicators with category, value, change, Curium-relevant implication, soβ¦9d92f64
-
Tighten lead quality: programme-shaped opportunities onlyβ
Piers Lyon +1: Claude Opus 4.7 (1M context)Colleague feedback: 'opportunities are not suitable for Curium' β generic senior hires + generic news were leaking through. Curium sells hands-on transformation/change/leadership-development DELIVERY, so leads must point to a programme starting/in planning, not just any senior change at any company. weekly_digest.fetch_warm_leads_for_colleague (SQL filters): - Jobs: title MUST contain a Curium-relevant function keyword (transformation/change/operating model/programme/PMO/people/ culture/talent/L&D/leadership/wellbeing/restructure/integration/ M&A/modernisation/ERP/SAP/IFS/Workday/CHRO/CPO/Chief X). Drops generic Head of Marketing / Sales / Commercial / Product etc. - News: trigger_type MUST be one of {leadership_change, restructure, ma_activity, transformation_programme, culture_capability, contract_award, programme_launch}. 'general' news is dropped at SQL level. weekly_digest._DIGEST_PROMPT (rewrite): - Explicit Curium ICP block describing the actuβ¦42aefe5
-
Add Adela as third recipient with aggregate (all-team) digest roleβ
Piers Lyon +1: Claude Opus 4.7 (1M context)User wants Adela to receive a full cross-team digest β every team member's leads concatenated into one email so she has visibility across the whole pipeline. Henriette + Stu continue to receive their individual warm-route digests. config.yaml: new digest_role field on team_emails entries. - "individual" (default) β own warm-route leads only - "all" β own leads + every other enabled team member's leads in one email Adela added as digest_role: "all". Pulls from network_graph too β she has 292 LinkedIn connections of her own. weekly_digest.build_aggregate_digest: composes the cross-team email. Recipient's own leads anchor the top, then sections per team member. Empty sections (colleagues with 0 warm-route leads this week) are skipped to keep it scannable. scripts/weekly_hunt_and_email.py: orchestrator dispatches to build_aggregate_digest when role is "all", else build_digest_for_colleague as before. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>11f303e -
Periodic pull: live app sees Monday cron data within 30 minβ
Piers Lyon +1: Claude Opus 4.7 (1M context)User asked whether hunt data stays visible to viewers all week. Today the live HF Space pulls leads.db ONCE at container startup β so Monday's cron updates aren't visible until the next container restart (could be days later) or a code push. Add a second timer to start_periodic_sync: - push every STATE_SYNC_INTERVAL_MIN (default 5 min) β unchanged - pull every STATE_PULL_INTERVAL_MIN (default 30 min) β NEW Periodic pull only fires when the local file hash matches the last pushed hash (i.e. no pending local writes). When local has dirty state, pull defers to the next iteration β push runs first, then the pull becomes safe. This closes the race where: - cron pushes Monday at 07:00 - live app still on pre-Monday state - user uploads connections Tuesday β app pushes (pre-Monday + new connections), OVERWRITING Monday's cron data With periodic pull, the app catches Monday's data within 30 min, so the upload merges on top. Co-Authored-By: Claude Opus 4.7 (1M context) <noreplβ¦77dd980 -
Web Discovery: explicit LinkedIn-via-Google search + ICP guardrailβ
Piers Lyon +1: Claude Opus 4.7 (1M context)User's personal LinkedIn account got flagged previously, so direct LinkedIn scraping via session cookies is too risky. Closing the LinkedIn-signal gap via Google's public index of LinkedIn instead β no auth, no account risk, just expands what Claude already does in the existing Web Discovery phase. - web_discovery._build_prompt: explicitly tell Claude to spend at least 2 of its search budget on `site:linkedin.com {client}` style queries. Catches public LinkedIn posts that Google has indexed β exec moves, hiring posts, programme launches that hit LinkedIn before press. - Bumped max_uses from 6 β 8 to make room for the extra LinkedIn searches (per-hunt cost goes from ~Β£0.30 to ~Β£0.40). - Added explicit ICP guardrail in the prompt: 'drop signals where the company is mega-cap (Meta/Apple/Goldman/Tata/Samsung etc.)' - web_discovery.persist_signals: belt-and-braces ICP filter at persistence time too, using the same OUT_OF_SCOPE_COMPANIES list as intel_feeds. Logs the count dβ¦06ade89 -
Careers-page scraping infrastructure (Greenhouse/Lever/Workday/SR/Personio)β
Piers Lyon +1: Claude Opus 4.7 (1M context)User asked to add direct careers-page scraping for Curium clients. Built the infrastructure as an additive fourth jobs-source phase after Adzuna and the keyword scraper. careers_scraper.py β five public-API fetchers: - Greenhouse (boards-api.greenhouse.io) - Lever (api.lever.co) - Workday (*.myworkdayjobs.com β POST search endpoint) - SmartRecruiters (api.smartrecruiters.com) - Personio XML feed Auto-dispatches to the right fetcher based on URL pattern. Filters to senior + transformation/change/people titles only. Each posting gets the client name attached so it lands in the right collator company record. hunter._hunt_jobs_fast: new Phase 1c calls careers_scraper.run_all_client_careers β walks every curium_clients entry that has an `ats_url` set, fetches that client's senior roles, adds to the same all_jobs pool that Adzuna fills. Same US-signal filter applies (with UK/EMEA carve-out). scripts/discover_ats.py β probes each client name across all 5 ATS platforms with sensibβ¦b48405d -
ICP filter: drop mega-cap companies outside Curium's reachβ
Piers Lyon +1: Claude Opus 4.7 (1M context)User noticed the digest mentioned Meta β way out of Curium's 200-10,000-employee UK/Ireland ICP. Two filter points added: 1. intel_feeds.OUT_OF_SCOPE_COMPANIES β explicit exclusion list of ~50 mega-cap names (FAANG, Wall Street, Asian giants, Chinese tech, global consumer brands). RSS items mentioning ONLY an out-of-scope company are dropped before they reach signals_news. Items mentioning both an out-of-scope name AND a Curium target ('Premier Foods partners with Microsoft') are kept β they're still about the Curium-relevant company. 2. weekly_digest._is_in_curium_icp β same exclusion applied to the warm-route lead aggregation. Henriette + Stu have LinkedIn connections at Meta / Apple / Goldman Sachs (because they're well-connected), but those companies aren't sellable for Curium, so they shouldn't bubble up as 'warm-route leads' in their weekly digests. Filtered companies are logged so we can audit. Verified locally: Premier Foods / Bentley Motors β¦8aa2218 -
Add Stu Bailey as second test recipient for weekly digestβ
Piers Lyon +1: Claude Opus 4.7 (1M context)Adds Stu (stuartbailey@curiumsolutions.com) alongside Henriette in the team_emails block. Email is set inline rather than via ENV: indirection because (a) it's not a credential, (b) the repo is private on both GitHub and HF, (c) avoids needing a new GH secret per recipient. 'Stu' matches the colleague_owner value in network_graph (confirmed during the connection upload β top 5 team members are Henriette, Chris, Stu, James Farrow, Mark). Both recipients have enabled:true; remove or set false to pause without deleting either entry. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>3137c3f -
Add 5 free intel feeds + FTS tenders + HF token diagnosticβ
Piers Lyon +1: Claude Opus 4.7 (1M context)User asked to make the hunt more powerful with free sources. Adds five Tier-1 sources (no API keys, all UK-focused) and a focused FTS tender source β all persist into existing signals_news / signals_tenders tables. intel_feeds.py β new module: β’ Personnel Today RSS (HR, no relevance filter β feed is on-topic) β’ HR Director RSS (HR, no filter) β’ FT Companies RSS (UK board changes / M&A β relevance-filtered) β’ City AM RSS (UK financial news β relevance-filtered) β’ BBC Business RSS (broad UK biz β relevance-filtered) β’ Hansard API (UK Parliament, 6 search terms β public-sector signals) β’ Find a Tender Service (FTS) API β UK above-threshold tenders, keyword + buyer match against Curium target list β’ Trigger-type classifier maps headline+summary into the existing leadership_change / restructure / ma_activity / transformation_ programme / culture_capability / contract_award taxonomy β’ Persistence helpers re-use collator.add_news_signal / add_tender_signal sβ¦5a206c6
-
weekly_digest: init tables defensively before queryingβ
Piers Lyon +1: Claude Opus 4.7 (1M context)GH Actions dry-run failed with 'no such table: network_graph' β the runner has no leads.db (state pull failed due to a malformed HF_TOKEN secret), so when fetch_warm_leads_for_colleague queried network_graph it crashed. Init the relevant tables idempotently at the top of the function so a fresh container with no persisted state returns [] (which the digest builder turns into a 'quiet week' email) rather than raising. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>13b8cbc -
Fix domain: curium.co.uk β curiumsolutions.comβ
Piers Lyon +1: Claude Opus 4.7 (1M context)The actual Curium tenant uses curiumsolutions.com β the prior references to curium.co.uk were my mistaken assumption from the public website branding. Updated: - config.yaml: company.website + an old example email recipient - mailer.py: docstring example - scripts/setup_gh_secrets.sh: MS_GRAPH_FROM_EMAIL default Caused a spurious 'mailbox not found' error when running New-ApplicationAccessPolicy against the wrong domain. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>27f7662 -
mailer: add Microsoft Graph API transport for M365 service accountsβ
Piers Lyon +1: Claude Opus 4.7 (1M context)User is M365 admin and prefers to keep email sending inside the tenant (data security) rather than using a third-party transactional service. SMTP AUTH is being deprecated by Microsoft and requires a paid mailbox license; Graph API with an Azure AD App Registration is the Microsoft- recommended path: - No SMTP AUTH, no basic auth deprecation risk - Works with a free shared mailbox (no license required) - Application Access Policy can scope the app to one mailbox only mailer.py now auto-picks transport: - 'graph' when MS_GRAPH_TENANT_ID + MS_GRAPH_CLIENT_ID + MS_GRAPH_CLIENT_SECRET + MS_GRAPH_FROM_EMAIL are all set - 'smtp' fallback when SMTP_USERNAME + SMTP_PASSWORD are set - 'none' when neither β send() returns a clear error Graph path uses msal client credentials flow β bearer token β POST /users/{mailbox}/sendMail. Common Graph errors (403 missing Mail.Send / Application Access Policy, 404 mailbox not found, 401 token issues) are surfaced to the caller in the messaβ¦48cb4ed -
mailer: separate SMTP_FROM_EMAIL from SMTP_USERNAMEβ
Piers Lyon +1: Claude Opus 4.7 (1M context)Previously the From-header address came from SMTP_USERNAME, which forced the auth user to also be the visible sender. That breaks for transactional relays (e.g. Resend) where SMTP_USERNAME='resend' but the team wants emails to come from intelligence@curium.co.uk. New SMTP_FROM_EMAIL env var separates the two; falls back to SMTP_USERNAME for the M365 / Gmail case where they're identical. Workflow + setup_gh_secrets.sh updated to handle the new variable. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>37eb301 -
Add scripts/setup_gh_secrets.sh β interactive GH Actions secret setupβ
Piers Lyon +1: Claude Opus 4.7 (1M context)Helper for populating the 14 GitHub Actions secrets the weekly workflow needs. Run locally in Terminal β values are piped to gh secret set via stdin (never on argv), sensitive prompts use read -s (no terminal echo). Prefills defaults from local .env where possible so re-runs are idempotent. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>e09465e -
Weekly Monday hunt + per-colleague email digest (Henriette as test recipient)β
Piers Lyon +1: Claude Opus 4.7 (1M context)End-to-end pipeline: GitHub Actions cron β pull state β run hunt β push state β compose per-colleague emails via Claude β send via SMTP. Configured for ONE recipient initially (Henriette) so the team can validate wording and routing before broadcasting. Adding more recipients is purely a config.yaml + Space-secret edit later. config.yaml β new top-level `team_emails` block. Each entry maps a colleague name (must match the LinkedIn export's `Owner` column) to an email. The `ENV:HENRIETTE_EMAIL` syntax keeps the actual address out of git β resolved at send time from the GH Actions secret. weekly_digest.py β new module: - get_team_emails(): reads config + resolves ENV: indirection - fetch_warm_leads_for_colleague(): joins network_graph (filtered to THIS colleague's connections) with recent signals_jobs / signals_news / signals_tenders, ranks by overall_score + signal density, returns top 12. Each lead carries the colleague's specific contact at that company, pβ¦aea8ae2 -
Move B (Web Discovery) + Move D (hunt summary on Dashboard)β
Piers Lyon +1: Claude Opus 4.7 (1M context)Move B β Web Discovery as the 10th hunt source - New web_discovery.py module: one Claude call with web_search (max 6 searches, ~Β£0.30) hunts for senior moves, restructures, and contract awards in Curium's target sectors over the last 30 days. Targets the gap left by scrapers and APIs (exec announcements on company pages, regional press, niche industry pubs). - Persists each discovered signal into the existing signals_news table via collator.add_news_signal with source='web_discovery', so the discoveries show up across the same dossier surfaces (with deduplication via the existing 30-day same-headline check). - hunter.AutonomousHunter: registers 'web_discovery' in source_status, runs as the 10th hunt step, marks count from the raw signals list (not the post-dedup persisted count, which would under-report on second runs). - collator.SOURCE_API_KEYS / SOURCE_SETUP_INSTRUCTIONS: registers 'web_discovery' as a source with ANTHROPIC_API_KEYβ¦d6882c4 -
Use Claude as hunt director: sector-aware keywords + contextual scoringβ
Piers Lyon +1: Claude Opus 4.7 (1M context)User asked 'is it worth using Claude earlier in the process as part of the hunt?' β yes. Today Claude is only a downstream judge (scores items after they're collected by static rules). Two upstream improvements: Move A β sector-aware keyword expansion (hunt_planner.py) - At hunt start, one Claude call (~$0.05) takes the static job_keywords list from config.yaml plus Curium's canonical sectors and client portfolio and returns an expanded, timely, deduplicated set of UK senior titles to search Adzuna for. - Tracks per-keyword hit counts across hunts in the app_settings store; keywords that have run 3+ times and never returned anything get pruned next hunt β the planner gets sharper over time. - Falls back to the static list on any failure so the hunt always has something to search. Move C β contextual scoring (brain.py) - analyze_opportunities_batch now accepts an optional `context` block. By default it lazily builds one with Curium's target sectors,β¦6212b0c -
Use Adzuna API as primary jobs source β scraping was being blockedβ
Piers Lyon +1: Claude Opus 4.7 (1M context)Post-hunt result showed 'Jobs β 0' β the Playwright scraping of Reed / Indeed / Totaljobs is being blocked by Cloudflare bot detection on shared cloud IPs (HF Spaces). Adding more keywords would not help β every term hits the same bot wall. Fix: prefer Adzuna's UK jobs API (single JSON feed aggregating Reed, Indeed, Totaljobs, CV-Library into one reliable source). Free tier = 500 calls/day, more than enough for daily hunts (~10-20 calls each). Falls back to scraping when Adzuna isn't configured, and skips the slow + blocked scrape phase entirely when Adzuna already returned 20+ jobs (saves 60-90s per hunt). - adzuna_jobs.py: new module with search_adzuna() + search_many() - hunter._hunt_jobs_fast: try Adzuna first, fall back to scraping - collator.SOURCE_API_KEYS: register ADZUNA_APP_ID for the 'jobs' source so the Source Health card shows missing/set status accurately - collator.SOURCE_SETUP_INSTRUCTIONS: tell users how to register - .env.example: document the two new secrets Useβ¦10ba18c -
Sidebar: remove Service Line filter (not needed)β
Piers Lyon +1: Claude Opus 4.7 (1M context)User requested. The radio (All / TD / CC / CODE 3i) only affected the Dashboard's filtering logic, and the default with the session value missing is 'All' β i.e. no filtering. Removing the control locks the Dashboard into the universal 'All' view, which is what most users want anyway. Per-page filtering can be added back inside individual pages later if it ever becomes useful. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>6c3620b -
Sidebar: drop 'Detailed Stats' expander, label the 3 KPIs properlyβ
Piers Lyon +1: Claude Opus 4.7 (1M context)User asked 'is this of any value?' about the per-source counts in the sidebar. Honest answer: every number in the Detailed Stats expander duplicates the Data Coverage Summary on the Source Health page. The 3 KPI tiles above were also poorly labelled β bare emoji + a number, with the meaning hidden in a hover tooltip. - Drop the Detailed Stats expander (Jobs / News / Reports / Tenders / Sentiment / M&A / LI Intel / TD/CC Pipeline counts) β Source Health is the canonical place for these. - Label the 3 sidebar KPIs: π’ Companies / π₯ Hot / π Network so their meaning is visible at a glance. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>4620e71 -
Fold COUNCIL SCAN into HUNT NOW as a 9th sourceβ
Piers Lyon +1: Claude Opus 4.7 (1M context)User requested: 'I want that included in the hunt not a separate action.' - hunter.AutonomousHunter: add 'councils' to source_status; new _hunt_councils method that wraps the existing council_scanner. run_council_scan() so all the targeted-council logic (~70 councils, per-council Network/Tenders/Jobs/News/People with per-council network warm-intro mapping) is reused unchanged. Council scan runs as the 9th step in the hunt sequence after the 8 broad sources. Updates set_last_council_scan_at for backward compatibility with existing watchers of that timestamp. - collator.SOURCE_API_KEYS / SOURCE_SETUP_INSTRUCTIONS: register 'councils' as a tracked source so the Source Health card shows it. - ui_components.SOURCE_LABELS: add 'councils' label + emoji. - app.py sidebar: drop the separate COUNCIL SCAN button, the cooldown helper, and the 'which scan should I run?' expander. Update the HUNT NOW tooltip to reflect 9 sources and the longer 10β20 min runtime. Drop the noβ¦055f393 -
Move state_sync pull into app.py β Dockerfile CMD bypasses entrypoint.shβ
Piers Lyon +1: Claude Opus 4.7 (1M context)Diagnostic from the running Space showed 'Last pull (entrypoint marker): β none β' even though HF_TOKEN and HF_STATE_REPO are correctly set and the dataset exists. Root cause: the Dockerfile's CMD launches streamlit directly, so entrypoint.sh (which had the pull step) is never executed on HF Spaces. All the pull-on-start logic was dead code in that path. Fix: move state_sync.pull_state() into app.py at module load, BEFORE the init_*_db calls. Now the pull runs regardless of how the container is launched (Dockerfile CMD, entrypoint.sh, manual streamlit run). Added an idempotency guard (skip if already pulled this process) so Streamlit reruns don't re-fetch on every render. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>39e7824 -
Stop state sync from overwriting good remote data with empty local DBβ
Piers Lyon +1: Claude Opus 4.7 (1M context)User reports: pulled good remote DB β restart β leads.db comes up empty (pull failed silently or didn't restore) β init creates empty tables β 5-min periodic sync pushes the 172 kB empty DB β overwrites the good 30 MB remote DB. User now sees "0 connections" with no way back. The push hooks were also wrapped in `except: pass` so we never saw the silent failures. Fixes: - state_sync.push_state(): refuse to auto-push if the DB has fewer than 10 rows of meaningful content (companies + network + jobs + news + briefings combined). The 'Sync now' button still works with force=True so the user can override after deliberately re-populating an empty DB. - state_sync.diagnose(): full diagnostic β token / repo / SDK version / local-DB content / pull marker / remote dataset state / in-memory pull/push timestamps / last error. Surfaces from the UI. - app.py sidebar: 'Sync now' result is now persisted via session_state and rendered as st.success / st.error after the rerun (was silentlβ¦60fe1d8 -
State sync caption: surface pull timestamp, distinguish from pushβ
Piers Lyon +1: Claude Opus 4.7 (1M context)Container restart shows 'πΎ State: β¦ no sync yet' even though the state pull HAS happened β the pull runs in a separate Python process (entrypoint.sh's `python -m state_sync pull`) whose in-memory last_pulled_at doesn't propagate to Streamlit. Fix: pull writes a marker file at /tmp/curium_state_pulled_at, and status() reads it as a fallback when in-memory state is empty. Caption now reads e.g. 'πΎ mipwr-admin/curium-intel-state Β· pulled 14:05 Β· no push yet (auto every 5 min)' so it's clear the data was restored even before the first push fires. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>f15390f -
Update .env.example
Verified signature7c53724 -
Update .env.example
Verified signature694bf19 -
Source Health: don't shout MISSING for keys that are optional fallbacksβ
Piers Lyon +1: Claude Opus 4.7 (1M context)The News source has RSS + GDELT fallbacks that work without NEWSAPI_KEY, so a healthy successful run can coexist with NEWSAPI_KEY not being set. The card was rendering both 'HEALTHY' (green) and 'NEWSAPI_KEY: MISSING' (red) at once, which screams 'broken!' for what's actually 'fine β you're just missing optional extra coverage'. - pages/7_Source_Health.py: when status='success' and the key isn't set, render the key line as amber 'not set (optional β running on fallbacks)' instead of red MISSING. - Suppress the loud blue 'Setup:' instructions banner on cards where setup isn't actually required (source is healthy + key is optional). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>7912bc1 -
Render Last-hunt bold via <strong>, not markdown asterisksβ
Piers Lyon +1: Claude Opus 4.7 (1M context)The Last-hunt caption sits inside a div rendered with unsafe_allow_html=True, which doesn't parse markdown. The literal asterisks were showing up in the UI as "Last hunt: **18 minutes ago**". Switch to a real <strong> tag so the timestamp renders bold. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>219b56e -
Free persistent storage via HF Dataset repo (no Pro tier needed)β
Piers Lyon +1: Claude Opus 4.7 (1M context)HF Spaces' free tier wipes the container filesystem on every restart β including every code push. That meant leads.db (network connections, hunt history, briefings, source health) was getting reset many times a day. The fix without paying for Pro is to use a private HF Dataset repo as a remote store for the SQLite file. state_sync.py - pull_state(): downloads leads.db from the dataset on container start - push_state(): uploads a consistent snapshot (sqlite3 backup API, safe vs. concurrent writes) β no-op if file unchanged since last push - start_periodic_sync(): background daemon thread, pushes every N min (default 5, configurable via STATE_SYNC_INTERVAL_MIN) - CLI: `python -m state_sync pull|push` for entrypoint use - Auto-creates the dataset repo (private) on first push if needed entrypoint.sh - Pulls state from HF Dataset before launching streamlit. No-op (with a logged hint) if HF_TOKEN / HF_STATE_REPO aren't set. app.py - Starts the periodic sync at stβ¦20e93be