1仕組みと動作原理
本skillは「長大なプロンプト契約 + マルチソースPythonエンジン」の組み合わせです。2,394行のSKILL.mdがモデルの計画立案、エンジン呼び出し、出力合成の方法を規定し、実際のデータ取得と集約はscripts/last30days.pyおよび98個のlibモジュール(Pythonコード計約6.2万行)が担います。
You are inside the `/last30days` SKILL. This is a specific research tool with a 1400+ line instruction contract (the rest of this file) that defines EXACTLY how to produce the research output. It is not a generic "last 30 days of X" research prompt. Do NOT treat `/last30days` as a search keyword you can improvise against.
モデルは「プランナー」として動作することを求められます。固有名詞などのエンティティ系トピックでは必ずモデル自身が--plan(解決済みのhandle/subreddit/hashtagを含むJSONクエリプラン)を自前で生成して渡す必要があり、エンジンの内蔵プランナーはヘッドレス/cron実行パス専用に限定されています。
**LAW 7 - YOU ARE THE PLANNER. `--plan` IS MANDATORY ON NAMED-ENTITY TOPICS.** If you are the reasoning model hosting this skill (Claude Code, Codex, Hermes, Gemini, or any agent runtime that invoked `/last30days`), YOU generate the JSON query plan. You do not need an API key, "LLM provider" credentials, or an external planning service - you ARE the LLM.
エンジンの呼び出し形式は厳格にテンプレート化されています。常に${SKILL_DIR}を用いて現在ロードされているSKILL.mdが存在するディレクトリ配下のscripts/last30days.pyを参照し、--emit=compactで可読性の高い出力を生成し、--save-dirで保存先を一元管理します。
SKILL_DIR="<absolute path of the directory containing the SKILL.md you just Read>"
出力は散文ではなく厳格な契約として扱われます。11項目の「LAW」により、先頭行のバッジ、タイトル、ダッシュ記号の扱い、段落構成、エンジンフッターの完全透過、生エビデンスブロックの出力禁止、コミュニティコメントの引用義務などが定められており、違反は観測可能な不具合として扱われます(ドキュメント内では0/8のリグレッション事例で実証)。
**BADGE (MANDATORY, FIRST LINE OF OUTPUT):** The Python engine now emits the badge as the first line of its `--emit=compact` stdout. Your correct behavior is to PASS THROUGH the script's output verbatim.
トレンド・トピック探索クエリは「モデルが判定者」となる3コマンドプロトコル(nominate-only → judgments → finalize、オプションでangles)を採用しており、話題の選定や視点の付与をモデルに委ね、エンジンは集約とレンダリングのみを担当します。
"${LAST30DAYS_PYTHON}" "${SKILL_DIR}/scripts/last30days.py" --discover --nominate-only --save-dir="${LAST30DAYS_MEMORY_DIR}"
調査パイプラインを迂回するオフラインの高速パスが用意されています。ライブラリ検索、ライブラリフィード、トピックキューの3コマンドはローカルのSQLiteや保存済みブリーフを直接参照し、ネットワーク接続、モデル呼び出し、初期セットアップを一切行いません。
This is deterministic offline FTS over the existing saved-brief scanner plus per-run SQLite store sightings; it does not call a model or the network.
セキュリティ設計として「機密情報にアクセスする可能性」を明示的に事前提示します。初回調査の前には必ず`--preflight`を実行し、設定の読み込み、予定されているブラウザCookieモードや書き込みパスの宣言、利用可能なコマンドやエンドポイント上書きの一覧表示を行いますが、この段階ではCookieの読み取り、ファイル書き込み、実際の調査処理は一切実行されません。
**2. Permission preflight.** Run `"${LAST30DAYS_PYTHON:-python3}" "${SKILL_DIR}/scripts/last30days.py" --preflight` using the directory of the `SKILL.md` you loaded, then summarize the human-readable result before setup: config source, project config trust/ignore state, planned browser-cookie mode, planned writes, optional commands, and active/ignored endpoint overrides. This is safe: it does not read browser-cookie values, does not write setup/config/report files, and does not run research.
APIキーとブラウザCookieは完全に独立した認証チャネルとして扱われ、いずれもデフォルトで無効化されています。APIキーは環境変数 → グローバル.env(~/.config/last30days/.env) → プロジェクト.env(LAST30DAYS_TRUST_PROJECT_CONFIG=1が必要) → macOS Keychain → 1Passwordの順で解決され、ブラウザCookieの読み取りはデフォルトで無効です(FROM_BROWSER未設定時は読み取りを行いません)。
Default (FROM_BROWSER unset): no browser-cookie reads. The Chromium family (Chrome, Brave, Edge, Vivaldi, Opera, Arc, Chromium) is available only when explicitly selected because reading their cookies on macOS requires the browser's Safe Storage Keychain key, which triggers a system password prompt that cannot be reliably suppressed.
認証情報の書き込みも制限されたチャネルを経由します。`setup --store-key <NAME>`はstdinから1行読み取り、パーミッション0o600でグローバル.envに書き込み、stdoutにはNAME=****と1行のJSONのみを返却し、シークレット値がstdout/stderrに出力されることは決してありません。
Reads exactly one line from stdin (bounded to ``STORE_KEY_MAX_BYTES``), strips whitespace, and writes it to the global ``.env`` as a 0o600 secret through ``setup_wizard.write_api_key``. An existing line for the same name is replaced, so a rejected credential can be rotated by running the command again. The value never reaches stdout or stderr: stdout carries ``NAME=****`` plus a JSON line ``{"persisted": bool, "key": NAME}``.
2コア機能
3外部依存関係
| Kind | Dependency / Endpoint |
|---|---|
| cli | python3 ≥ 3.12(引擎自身;SKILL.md 用 ${LAST30DAYS_PYTHON:-python3} 调用) |
| cli | yt-dlp(YouTube 搜索与字幕;首次 setup 会尝试安装)、digg-pp-cli(Digg)、arXiv 与 Techmeme 的 Printing Press CLI |
| cli | agentcookie(Linux 上的外部 cookie sidecar,仅当 PATH 存在该命令且未设 AGENTCOOKIE=off 时启用) |
| cli | macOS `security`(Keychain 取密钥)与 openssl(Chromium cookie 解密)、`pass`(1Password/密码库取密钥) |
| api | ScrapeCreators(TikTok/Instagram/Threads/Pinterest/LinkedIn/YouTube 评论等;frontmatter 的 primaryEnv) |
| api | LLM/搜索类可选密钥(推理与规划回退用):OpenAI、xAI、Google/Gemini、OpenRouter、Perplexity、Brave、Exa、Serper、Parallel、Apify、GitHub token、X API bearer、XQUIK、BrightData |
| network | 免密钥公开端点(默认路径即可用):Reddit 公开 JSON/RSS、HN Algolia、Polymarket Gamma API、GitHub API、Arctic Shift、Bluesky、StockTwits、TruthSocial、Digg、r.jina.ai |
| network | HTML 简报托管发布(显式 --publish 才发;文档提醒页面默认公开可被索引) |
| package | 第三方 vendored 组件:scripts/lib/vendor/ 下的 X 搜索客户端(.skillignore 注明 'still installed') |
4推奨統制措置と判定根拠
- 本地凭据 / 浏览器配置: ユーザーのログインCookie/セッション/キーチェーンへのアクセス: プロセス環境変数および~/.config/last30days/.env(LAST30DAYS_CONFIG_DIRで変更可能、空設定時は設定なしモード):あり
- scripts/: ローカルスクリプトまたはシステムコマンドの実行: python3 scripts/last30days.py <サブコマンド>(実行ごとに呼び出し、--preflight / --welcome / setup等を含む)
- 外部 API: 外部プラットフォームへの投稿、リソース作成、またはデータ変更の書き込み: なし
- 本地工作目录: ファイルの読み書きおよび成果物の出力: 調査結果の保存:--save-dir(デフォルトは$HOME/Documents/Last30Days)配下のMarkdownレポートおよび{slug}-raw.md
5二重目の独立検証
- [ok] skill 路径(任务书标『待定位』) — 实际相对路径 skills/last30days(仓库 skills/ 下仅此一个子目录)。frontmatter name 为 'last30days',与任务书展示名 'Last 30 Days Research'/slug 'last-30-days-research' 不同名——本报告 skill.name 保留 frontmatter 真值 'last30days',文件名按任务书 slug 输出。
- [ok] 『1400+ 行指令契约』的量级声明 — SKILL.md 实测 2394 行(含契约与实现细节),『1400+』是保守表述,未夸大;OUTPUT CONTRACT 段落确实前置在文件开头附近(v3.0.8 起从第 ~1094 行前移),与文档自述一致。
- [ok] 『模型是规划者(--plan)』是否被代码支持 — SKILL.md 规定命名实体主题必须带 --plan;引擎侧确实消费 --plan(文档另说明缺省时用内部 planner 或确定性回退,仅 headless/cron 路径)。文档同时记录了把引擎 stderr 的 'provider' 一词误读为『需要凭证』的真实事故,属可复核的工程记录。
- [discrepancy] 浏览器 cookie 读取的默认状态(第一遍若笼统写『会读浏览器 cookie』则夸大) — 第二遍核对 env.py:'Default (FROM_BROWSER unset): no browser-cookie reads.',FROM_BROWSER=off 亦返回空;Linux 侧 agentcookie 还需 PATH 存在该二进制且未设 AGENTCOOKIE=off,MacBook 之外的 box-chrome CDP 路径需人工登录。结论修正为『能力存在、默认关闭、需显式同意』,已在 security 与 capabilities 中如实表述(不作默认行为)。
- [ok] 密钥来源分层与项目配置信任策略 — env.py 明确 CONFIG_FILE = Path.home()/'.config'/'last30days'/'.env'(可用 LAST30DAYS_CONFIG_DIR 覆盖),项目 .env 需 LAST30DAYS_TRUST_PROJECT_CONFIG;Keychain 仅 Darwin + security 在 PATH,LAST30DAYS_SKIP_KEYCHAIN 可关;另有 pass(1) 通道与 LAST30DAYS_KEYCHAIN_ALIASES 别名支持。
- [ok] 权限预检的『安全』承诺是否属实 — permission_preflight.build() docstring 为 'Build a stable, secret-free permission preflight object.';pipeline.py 中 browser_cookies 的 reads_values 在 safe 模式下恒为 False;代码注释要求 safe=True(doctor/--diagnose/--preflight)保持无网络。与 SKILL.md 的『does not read browser-cookie values, does not write … and does not run research』一致。
- [ok] 发布到第三方托管是默认还是 opt-in — last30days.py 的 --publish 帮助文本写明 'Publish --emit=html output to ht-ml.app (explicit opt-in; public by default)';SKILL.md 在 library feed 段要求先向用户解释页面公开可被索引再执行。非默认行为。
- [discrepancy] 外部依赖数量(避免把文档链接当成调用点) — 第一遍若按 https:// 出现频次直接列依赖会把文档链接(如 github.com、nodejs.org、ffmpeg.org、example.com)算进去。第二遍逐条回落到代码调用点:api.scrapecreators.com / api.github.com / hn.algolia.com / gamma-api.polymarket.com / arctic-shift.photon-reddit.com / api.x.ai / api.openai.com / generativelanguage.googleapis.com / openrouter.ai / api.perplexity.ai / api.stocktwits.com / bsky.social / truthsocial.com / di.gg / r.jina.ai / api.ht-ml.app 为真实请求端点;github.com、nodejs.org、ffmpeg.org、example.com 等仅出现在文档字符串或占位示例,未计入。
6結論
41f1dd6604aec716…