gemini-history-analyzer
Analyze Google Takeout exports of Gemini conversation history. Use when the user mentions Gemini takeout, Gemini export, Gemini history, Gemini conversation analysis, Google Takeout zip analysis, or drags a takeout zip into the project. Also use when the user asks to "analyze my Gemini data", "what did I talk to Gemini about", or wants to extract insights from Gemini chat logs.
1How It Works & Mechanism
The entire pipeline consists of an 8-step instruction set in SKILL.md plus model reading, with no scripts in the directory: extraction relies on the shell, comprehension relies on the model, and aggregation relies on a fixed report template.
Extract, categorize, and analyze Google Takeout ZIP exports of Gemini Apps activity. The skill handles:
Determine the type before choosing a strategy: sample 3–5 files and use four signals—speaker tags, content format, length distribution, and file naming—to distinguish between 'meeting transcripts' and 'prompt-response' pairs, routing each to a different analytical path.
Before full analysis, sample 3-5 files to determine the **conversation type**:
The extraction phase has a clear technical justification: macOS's native unzip silently mangles Chinese filenames, making unar strictly required.
Google Takeout files contain Chinese/Unicode filenames. **macOS `unzip` corrupts these — always use `unar`.**
Take inventory before reading: use find + sed/uniq to tally extension distributions, list all txt files, and calculate sizes by type; establish the inventory before deciding what to read.
find <extract-dir> -type f | sed 's/.*\.//' | sort | uniq -c | sort -rn
Keyword searching is explicitly positioned as a 'first step, not the answer': context must be checked by reading 10 lines before and after hits, categorizing matches into three tiers.
**Read surrounding context** (10 lines before/after each match) — keyword matching alone produces massive false positives. "Investment" can mean business strategy, "option" can mean UI choice, "fund" can mean insurance feature
PII handling follows 'flag but do not transcribe': resumes, background checks, or contact lists must be noted as risk items in the report, but their content must never be copied into reports or memory.
- File: <name>, Type: <resume/background-check/etc.>, Risk: <high/medium/low>
Hierarchical reading for large files and parallel reading for massive sets preserve the context budget: read only the first and last 10% of single large files, and dispatch parallel sub-agents in batches of 10–15 for 100+ files.
For 100+ files, spawn parallel sub-agents to read and summarize in batches (10-15 files each). Merge results. One agent reading all files sequentially will exhaust context.
Output is standardized into a 7-section report (Overview, Topic Distribution, Key Findings, Domain-Specific Analysis, Notable Documents, High-Value Quotes, PII Risk), with an optional final memory file.
# Gemini History Analysis Report
Optional memory file artifacts adhere to a strict protocol: follow existing project memory formats, include originSessionId for provenance, update the MEMORY.md index, and avoid duplicating existing content.
- Include `originSessionId` or source tag pointing back to the analysis
Final cleanup requires user confirmation: rm -rf on the extraction directory is performed only after analysis is complete.
# Remove extracted files after analysis complete (user confirms)
2Core Capabilities
3External Dependencies
| Kind | Dependency / Endpoint |
|---|---|
| cli | unar(解包 Takeout ZIP,处理中文文件名) |
| package | Homebrew(仅在 unar 缺失时安装;命令带 2>/dev/null || true 容错) |
| cli | find / sed / sort / uniq / du(清单与统计) |
| cli | grep(领域关键词检索,随后必须人工回读上下文) |
| cli | rm(分析完成后清理解包目录,需用户确认) |
| api | 宿主 sub-agent 能力(100+ 文件时并行批处理) |
4Recommended Governance & Evidence
- 网络端点: Declared external network access: The only potential outbound network action is brew install unar—executed only if unar is missing to pull the third-party package via Homebrew; SKILL.md uses 2>/
- 本地工作目录: File read/write and artifact output: <output-dir>/**: All Takeout contents extracted via unar (txt transcripts, images, audio/video, PDF/Office documents, nested zip files)
5Second-Pass Verification
- [ok] 是否真的没有脚本(避免凭 description 臆测) — glob 结果:仅 SKILL.md。所有「处理」都是写在文档里让 agent 用通用 shell/工具执行的命令,非自带可执行文件。scripts_executed = []。
- [discrepancy] spawn 命中是否等于进程创建 — 〔第二遍标注:扫描器误报,已澄清〕SKILL.md 原文为『spawn parallel sub-agents to read and summarize in batches』,指宿主的 sub-agent 能力;全文件无 child_process / subprocess / exec / eval。
- [ok] brew install 是否被夸大成依赖 — 命令为 brew install unar 2>/dev/null || true,位于『Install unar if missing』注释下,失败被吞掉;SKILL.md 未把它列为前置条件(前置条件段落只说要 macOS 与 Takeout zip)。已在 external_deps 与 network_calls 中标为条件性、尽力而为。
- [discrepancy] rm -rf 的危险性是否被如实标注 — 〔第二遍标注:第一遍低估,已加强〕Step 8 的清理命令确为 rm -rf <extract-dir>,作用是删除解包出来的整棵目录树。命令上方注释写了『(user confirms)』,但这是文档级约束、无技术强制;已在 file_writes 与 verdict.risks 中单列,并指出它同时是隐私卫生措施(不留私人历史副本)——两个动机都要讲,避免读者只看到「破坏性」。
- [ok] PII 保护是否只是声明 — 报告第 7 节模板字段(File / Type / Risk)本身就是「不含内容」的结构;Pitfalls 4 条再次强调 do NOT include their contents;memory 段落要求 PII 摘要而非复制。三处一致,属可执行的结构性约束。
- [ok] 关键词检索纪律是否与实测证据一致 — Step 5 的四步(设计词表 → grep 全部文件 → 回读前后 10 行 → 三分类后全文重读)与 Pitfalls 2 的实测结论(80%+ 命中全为假阳性)互相印证,报告第 4 节要求列出假阳性条数与原因——方法、证据、交付物三者闭环。
- [ok] memory 写入是否有副作用管理 — Step 7 限定三个触发条件、要求遵循项目既有 frontmatter 约定、要带 originSessionId 溯源、要更新 MEMORY.md 索引、且『Never duplicate what's already in memory — update existing files instead』。副作用有明确协议。
- [ok] 元数据(license/stars/last_push) — 取自同 repo 同 commit 的池内既有值(MIT、1385★、2026-09-09T12:33:29Z);本次未联网复核 gh。
6Verdict & Scenarios
16d58ad7768cadfe…