AI agent skill that researches any topic across Reddit, X, YouTube, HN, Polymarket, and the web - then synthesizes a grounded summary
Python ai-promptsai-skillblueskyclaudeclaude-codeclawhubdeep-researchhackernewsinstagramopenclawpolymarketrecencyredditresearchsocial-mediatiktoktrendstwitterweb-searchyoutube
Merge origin/main into feat/keyless-coverage-honest-degradation
Trevin Chow5b5ed6ddd1ea
diff --cc skills/last30days/SKILL.mdindex 95c9b79b,d5d130dc..7e727d12--- a/skills/last30days/SKILL.md+++ b/skills/last30days/SKILL.md@@@ -270,17 -315,11 +315,19 @@@ fLAST30DAYS_MEMORY_DIR="${LAST30DAYS_MEMORY_DIR:-$HOME/Documents/Last30Days}"```+**Native-search signal (web coverage).** If you (the hosting model) have your own web-search tool available — e.g. Claude Code's `WebSearch`, which STEP 0 loads — export `LAST30DAYS_NATIVE_SEARCH=1` in the same shell before invoking the engine:++```bash+export LAST30DAYS_NATIVE_SEARCH=1 # ONLY when you have a native web-search tool+```++Your native search is better than the engine's keyless web fallback, so this tells the engine to skip that fallback and leave general web to you (you already run WebSearch supplements in Step 2). If you have NO native web-search tool (some non-Claude hosts and headless/cron paths), do **not** set this: the engine's keyless web floor supplies general-web coverage automatically. The rule is capability-based, not host-name-based — set it only when you genuinely have a better search, never to suppress the floor on a host that has nothing else.+## Configuration- Set `LAST30DAYS_MEMORY_DIR` before invoking the skill to choose where raw research files are saved. If it is not set, the skill defaults to `~/Documents/Last30Days`.+ Set `LAST30DAYS_MEMORY_DIR` before invoking the skill to choose where raw research files are saved. If it is not set, the skill defaults to `~/Documents/Last30Days`. The SessionStart hook (`hooks/scripts/check-config.sh`) creates this directory automatically on every session start if it doesn't already exist, so first-run users don't need to `mkdir` by hand.++ The engine reads `LAST30DAYS_MEMORY_DIR` from either the process env or `~/.config/last30days/.env`, so direct CLI invocations (`python3 scripts/last30days.py ...`) without `--save-dir` will still save when the env var is set. Mirrors the `LAST30DAYS_STORE` env-or-flag convention. Explicit `--save-dir` always wins.## Step 0: First-Run Setup Wizarddiff --cc skills/last30days/scripts/lib/env.pyindex 4dd794f9,8ef65f5a..8245254c--- a/skills/last30days/scripts/lib/env.py+++ b/skills/last30days/scripts/lib/env.py@@@ -405,12 -414,10 +420,14 @@@ def get_config() -> dict[str, Any]('SETUP_COMPLETE', None),('INCLUDE_SOURCES', ''),('EXCLUDE_SOURCES', ''),+ ('LAST30DAYS_DEFAULT_SEARCH', ''),('LAST30DAYS_YOUTUBE_SSH_HOST', None),('LAST30DAYS_TRANSCRIPT_TIMEOUT', None),+ # Whisper transcription provider for caption-free audio/video. Groq's+ # free tier is preferred; OPENAI_API_KEY is the paid backstop (already+ # resolved above via openai_auth).+ ('GROQ_API_KEY', None),+ ('LAST30DAYS_YT_SUB_LANGS', 'en,es,pt'),]for key, default in keys:diff --cc skills/last30days/scripts/lib/setup_wizard.pyindex 027b4276,03218adb..c455c7ce--- a/skills/last30days/scripts/lib/setup_wizard.py+++ b/skills/last30days/scripts/lib/setup_wizard.py@@@ -99,47 -107,7 +108,47 @@@ def run_auto_setup(config: Dict[str, Anreturn results+def _open_secret_append(path: Path):+ """Open ``path`` for appending as a 0o600 secret file with no readable window.++ ``os.open`` with ``O_CREAT|O_WRONLY|O_APPEND`` and mode ``0o600`` sets+ restrictive permissions at creation (umask can only further restrict, never+ widen, so the file is never world-readable even transiently). An explicit+ ``chmod`` afterwards also tightens a pre-existing loose file. This matters+ because the .env stores API keys, cookies, and tokens.+ """+ fd = os.open(path, os.O_CREAT | os.O_WRONLY | os.O_APPEND, 0o600)+ try:+ os.chmod(path, 0o600)+ except OSError:+ pass+ return os.fdopen(fd, "a", encoding="utf-8")+++def _format_env_value(value: str) -> str:+ """Quote a value so it round-trips through env.load_env_file.++ env.load_env_file strips a single layer of matching surrounding quotes but+ does NOT process backslash escapes, so we wrap (never escape):+ - plain tokens (no whitespace, no leading quote): returned unchanged;+ - values with whitespace/leading quote and no double-quote: double-quoted;+ - values containing a double-quote but no single-quote: single-quoted;+ - values containing both quote types: returned as-is (best effort; no+ wrapper round-trips through the loader, and tokens never hit this).+ Newlines are not valid in a single-line env value and are stripped.+ """+ value = value.replace("\r", "").replace("\n", " ")+ needs_quoting = (not value) or value[0] in ("'", '"') or any(c.isspace() for c in value)+ if not needs_quoting:+ return value+ if '"' not in value:+ return f'"{value}"'+ if "'" not in value:+ return f"'{value}'"+ return value++- def write_setup_config(env_path: Path, from_browser: str = "auto") -> bool:+ def write_setup_config(env_path: Path, from_browser: str | None = None) -> bool:"""Write SETUP_COMPLETE and FROM_BROWSER to the .env file.Creates the file and parent directories if needed.@@@ -170,8 -143,8 +184,8 @@@lines_to_add = []if "SETUP_COMPLETE" not in existing_keys:lines_to_add.append("SETUP_COMPLETE=true")- if "FROM_BROWSER" not in existing_keys:+ if from_browser and "FROM_BROWSER" not in existing_keys:- lines_to_add.append(f"FROM_BROWSER={from_browser}")+ lines_to_add.append(f"FROM_BROWSER={_format_env_value(from_browser)}")if not lines_to_add:return True # Nothing to write, already configured