[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6991MFXGQAV61XX4K4AZQ52":3,"skill-same:01M6991MFXGQAV61XX4K4AZQ52":80},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":8,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":18,"categories":19,"keywords":30,"publishedAt":51,"linkOnly":52,"markdownContent":53,"markdownBody":54,"frontMatter":55,"refName":56,"commitSha":57,"skillDirectory":58,"forksCount":59,"repositoryHtmlUrl":60,"repositoryHomepageUrl":61,"ownerHtmlUrl":62,"ownerBlogUrl":63,"ownerDescription":64,"updatedAt":65,"install":66,"resources":79},"01M6991MFXGQAV61XX4K4AZQ52","mantis-history","仓库历史漏洞分析","Analyzes the repository's version control system (VCS) history to extract past vulnerabilities, security fixes, and vulnerability patterns. Use as an initial pre-processing step to build a historical vulnerabilities database (workspace\u002Fhistorical_learnings.jsonl) that informs subsequent stages about past issues and fixes. Don't use for code reviews, writing test scripts, or patching code.","分析代码仓库的版本控制系统（VCS）历史，提取过往的漏洞、安全修复和漏洞模式。作为初始预处理步骤使用，用于构建历史漏洞数据库（workspace\u002Fhistorical_learnings.jsonl），为后续阶段提供有关过往问题和修复的信息。不用于代码审查、编写测试脚本或修补代码。","google\u002Fmantis","google","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F1342004?v=4","01M698VYEFDM0VJBZDYYJ2T83S","Google","01M6990SDGGFEAP21TJNS7HEG9",2778,"Apache-2.0",null,"https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fmantis\u002Fblob\u002Fmain\u002Fskills\u002Fmantis-history\u002FSKILL.md",[20,25],{"categoryNo":21,"categoryName":22,"taxonomyType":23,"taxonomyTypeDesc":24},"01M8BQV98CYQ7TEW2D1MRQ00TE","安全公告与漏洞管理","SCENARIO","使用场景",{"categoryNo":26,"categoryName":27,"taxonomyType":28,"taxonomyTypeDesc":29},"01M8BR4MYFKGCC4WCWVJ50KJ2C","安全工程师","PROFESSION","适用职业",[31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50],"mantis history","history","patterns","fixes","for","past","jsonl","reviews","processing","scripts","as","learnings","writing","vulnerability","patching","repository","database","issues","code","security","2026-11-10 10:12:30",false,"---\nname: mantis-history\ndescription: >-\n  Analyzes the repository's version control system (VCS) history to extract past vulnerabilities, security fixes, and vulnerability patterns.\n  Use as an initial pre-processing step to build a historical vulnerabilities database (workspace\u002Fhistorical_learnings.jsonl) that informs subsequent stages about past issues and fixes.\n  Don't use for code reviews, writing test scripts, or patching code.\n---\n\n# History Analyzer (\u002Fmantis-history)\n\n## System Goal\n\nHistorical Vulnerability Extractor. Analyzes repository's version control system\n(VCS) history to extract past vulnerabilities, security-related fixes, patches,\nand associated files, creating a historical learnings database to inform\ndownstream skills.\n\n## Command Definition\n\n- **Command:** `\u002Fmantis-history`\n- **Description:** Analyzes repository's version control system (VCS) history to\n  extract past vulnerabilities and fixes, producing a structured historical\n  learnings file (`workspace\u002Fhistorical_learnings.jsonl`).\n- **Arguments (optional; supplied by the orchestrator, consumed by Block A):**\n  `--snapshot_root`\u002F`--snapshot_id`\u002F`--state_root`. History reads VCS logs from\n  the LIVE repository root (Block A step 5), not the snapshot; it uses\n  `--state_root` only to place its cache\u002Foutput\u002Fscript. All absent -> DEGRADED\n  (behaves as today, live cwd).\n\n## Input\u002FOutput Contract\n\n- **Reads**:\n  - `workspace\u002F.mantis_state.json` (to track current loop pass).\n  - Codebase directory structure and key files (to determine stack).\n  - VCS history logs (commit messages, titles, diffs).\n  - `mantis-summary.md` (optional, if available).\n  - Internal history analysis cache (optional, if exists).\n- **Writes**:\n  - VCS extraction script (written on-the-fly to workspace).\n  - `workspace\u002Fhistorical_learnings.jsonl`.\n  - Internal history analysis cache.\n  - All under `--state_root\u002Fworkspace\u002F` (cache, `historical_learnings.jsonl`,\n    extraction script): kept outside the target tree. Optional `history_status`\n    marker (`UNSUPPORTED_VCS` \u002F `PARTIAL_SHALLOW`).\n- **Preconditions**:\n  - Target repository and VCS logs must be accessible.\n- **Idempotency Guarantee**:\n  - The cache is the source of truth: the output DB is rebuilt from it every run\n    and is never truncated to empty while the cache is non-empty. The cache is\n    invalidated on VCS-history rewrite (`_analyzed_head` no longer reachable) or\n    a vcs_type\u002Frepo-identity change. On `none`\u002F`unknown` VCS the stage writes an\n    empty DB + `history_status=UNSUPPORTED_VCS` and exits.\n\n## Instructions\n\n### Step 0: Locator Resolution (run first)\n\n```\nLOCATOR RESOLUTION (before reading ANY target code or artifact):\n0. ROLE: If this skill NEVER reads target source (report, calibrate, reflect),\n   you are a FINDINGS-ONLY stage: skip steps 2-6; still read active_snapshot from\n   state for provenance\u002Fannotation; NEVER stop merely because a code root is unset.\n1. Determine CODE_ROOT, in this priority order:\n   a. If --target_root is passed on THIS invocation, CODE_ROOT = --target_root.\n      It is AUTHORITATIVE and OVERRIDES SNAPSHOT_ROOT and the state fallback\n      (used when a caller hands you a prepared tree, e.g. a patched shadow).\n   b. Else if --snapshot_root (or SNAPSHOT_ROOT) is passed, use it.\n   c. Else read state_root\u002Fworkspace\u002F.mantis_state.json (state_root from\n      --state_root if passed, else .\u002Fworkspace\u002F... relative to the current dir)\n      -> active_snapshot.root \u002F .snapshot_id \u002F .snapshot_pinned.\n   d. Else (no arg AND no readable active_snapshot): CODE_ROOT = current directory,\n      treat snapshot_pinned = false (MODE-OFF). Do NOT stop.\n2. SENTINEL CHECK (only if snapshot_pinned is true AND you did NOT take path 1a):\n   verify CODE_ROOT\u002F.mantis_snapshot_id exists and equals SNAPSHOT_ID. If missing\n   or different -> STOP \"snapshot sentinel mismatch\". (A --target_root tree (1a) is\n   deliberately mutated and is sentinel-EXEMPT.)\n3. PATH FIELDS:\n   - SNAPSHOT-RELATIVE (read under CODE_ROOT): code_paths entries; plan target_files\n     that are file paths. Strip ONLY a trailing \":\u003Cdigits>\". A code_paths entry\n     containing \":\u002F\u002F\" is a URL\u002Fendpoint, NOT a file read. A code_paths entry that is\n     NOT of the form \u003Cexisting-path>:\u003Cinteger> is a non-source LOCATOR\n     (symbol\u002Foffset\u002Fendpoint): only check that the artifact\u002Fsymbol exists; skip ALL\n     line-range and line-existence logic.\n   - STATE-RELATIVE (read\u002Fwrite under state_root\u002Fworkspace, NEVER prefix CODE_ROOT):\n     kb_references, repro_file_path, reattack_file_path, helper scripts, report\n     files, and all state\u002Ffindings JSON.\n4. Never WRITE under CODE_ROOT when snapshot_pinned is true. Any command that\n   compiles, generates, or writes artifacts MUST run in a PRIVATE SHADOW copy\n   (mktemp -d from CODE_ROOT), never with cwd=CODE_ROOT. Read-only inspection may\n   cd into CODE_ROOT.\n5. VCS-METADATA CARVE-OUT: history-log extraction and any VCS diff\u002Fblame command\n   run in the LIVE repository root (which still has .git\u002F.hg\u002F.repo), NOT CODE_ROOT\n   (the snapshot copy strips VCS metadata). Do NOT stop merely because CODE_ROOT\n   lacks .git\u002F.hg\u002F.repo.\n6. Every shell command uses ABSOLUTE paths and sets its own working directory on\n   that call. Do NOT assume the working directory persists between calls.\n```\n\nCRITICAL for history: the pinned snapshot copy STRIPS `.git`\u002F`.hg`\u002F`.repo`, so\nper Block A step 5 you MUST run every VCS log \u002F diff \u002F blame command in the LIVE\nrepository root (the working directory Mantis was launched in), NOT under\nCODE_ROOT. Do NOT stop because CODE_ROOT lacks VCS metadata. Write the cache,\n`workspace\u002Fhistorical_learnings.jsonl`, and your generated extraction script\nunder `--state_root\u002Fworkspace\u002F` (STATE-RELATIVE) — never into the target tree,\nso a sync\u002Fclean cannot wipe them. Record `active_snapshot.snapshot_id` on\nentries only for provenance.\n\nYour task is to analyze the codebase architecture, determine what constitutes\nsecurity-relevant history, and write a script on-the-fly to extract and document\nhistorical vulnerabilities from the project's version control system (VCS).\n\nExecute the history analysis stage as follows:\n\n1. **Phase 1: Analyze Codebase and Define Target History:**\n\n   - Read existing summaries (e.g. `mantis-summary.md` if available) or quickly\n     inspect the root codebase structure to understand the primary files,\n     programming languages, and core components.\n   - Determine what types of historical security issues (e.g., memory\n     corruption, authentication bypass, SQL injection, buffer overflow, or\n     others) are relevant to this project and what keywords or commits should be\n     targeted.\n\n2. **Phase 2: Write a History Extraction Script:**\n\n   - **VCS-support guard (run BEFORE writing\u002Fexecuting the script):** Determine\n     `vcs_type` from `.mantis_state.json` `vcs_info` (or detect it in the LIVE\n     root). If `vcs_type` is `none` or `unknown`, OR the VCS history is\n     otherwise unreachable: write an EMPTY\n     `workspace\u002Fhistorical_learnings.jsonl`, set a top-of-file \u002F sidecar marker\n     `history_status = \"UNSUPPORTED_VCS\"`, and EXIT — never fabricate history.\n     For `multi-vcs` (.repo): either iterate history per sub-project, or write\n     the empty file with `history_status = \"UNSUPPORTED_VCS\"` rather than run a\n     git-shaped script that errors. For a SHALLOW git clone\n     (`git rev-parse --is-shallow-repository` == true): proceed but set\n     `history_status = \"PARTIAL_SHALLOW\"` so downstream stages do NOT read \"no\n     historical vuln for this file\" as \"clean.\"\n\n   - Read the active pass number from the state file\n     `workspace\u002F.mantis_state.json` and resolve the current ISO 8601 timestamp.\n\n   - Write a script (e.g. Python, bash, or your choice) directly in your\n     workspace that interacts with your repository version control system (VCS)\n     history logs.\n\n   - **Cost-Efficiency & Scale Optimization:** To ensure the historical analysis\n     remains cost-effective and runs efficiently, the script must implement the\n     following optimizations:\n\n     - **Commit Message\u002FDescription Pre-filtering:** Before retrieving diffs,\n       the script should dynamically determine relevant keywords for commit\n       message screening. It can do this by first inspecting the repository's\n       files and languages\u002Fdomains in scope to establish its primary stack (e.g.\n       software versus hardware\u002FRTL), then either querying an LLM\u002Fanalysis agent\n       for a tailored list of security\u002Fbug keywords or using a broader set of\n       keywords augmented with these specific domain terms. Skip revisions whose\n       messages or titles do not match these relevant keywords to avoid\n       unnecessarily retrieving and analyzing changesets that are irrelevant to\n       the codebase in scope.\n     - **Diff Filtering and Size Limits:** Ignore commits that only touch\n       non-production code (e.g., tests, documentation, or configuration files).\n       Skip commits with excessively large diffs (e.g., more than several\n       thousand lines changed), as they are usually automated formatting changes\n       or massive refactorings rather than discrete security patches.\n     - **Caching Results (cache is the source of truth):** Maintain a local\n       cache (JSON or SQLite) under `workspace\u002F` mapping\n       `revision_id -> analyzed`, AND storing the full extracted record for each\n       analyzed revision plus an `_analyzed_head` high-water mark and the\n       `vcs_type` + repo identity the cache was built against. On each run,\n       REBUILD `workspace\u002Fhistorical_learnings.jsonl` from the cache (do NOT\n       skip a revision merely because the cache says \"analyzed\" and then leave\n       the output empty — that is the desync bug). NEVER truncate a non-empty\n       output DB to empty. Only analyze revisions NEWER than `_analyzed_head`.\n       **Rewrite detection:** before trusting the cache, verify `_analyzed_head`\n       still resolves in the current LIVE history (git:\n       `git cat-file -e \u003C_analyzed_head>` succeeds AND\n       `git merge-base --is-ancestor \u003C_analyzed_head> HEAD`; hg:\n       `hg log -r \u003C_analyzed_head>` succeeds). If it does not (force-push \u002F\n       rebase \u002F squash) OR `vcs_type`\u002Frepo identity changed, INVALIDATE the\n       cache and re-extract from scratch.\n     - **Batch Processing (Batching Diffs):** Instead of making one LLM call per\n       commit diff, the script should batch multiple commit diffs and messages\n       (e.g. 3 to 5 commits) into a single LLM call. Ask the LLM to analyze all\n       commits in the batch and return a JSON array of findings for the batch,\n       reducing request overhead and cost.\n     - **Model Selection:** Use lightweight and cost-efficient models for the\n       initial commit analysis\u002Ffiltering, and only fall back to heavier model\n       tiers if deeper verification of a suspected vulnerability is needed.\n\n   - **Detailed Analysis:** For revisions or commits that look\n     security-relevant, the script should retrieve the commit diffs and\n     messages\u002Fchange descriptions.\n\n   - **LLM\u002FAgent Analysis:** The script should make API calls (e.g., via\n     subagent messages or Agent API subcommands) or use an LLM subagent to\n     analyze the changes' diffs and messages to determine whether a\n     revision\u002Fcommit was a security fix, what component was affected, the\n     vulnerability type, impact, and the mitigation diff. Make sure it uses\n     batching and caching to minimize API calls.\n\n   - **Missing Information:** Do not overindex on the lack of security-related\n     keywords. Many security fixes do not get CVEs, and many security\n     vulnerabilities are fixed without realizing they were vulnerabilities.\n\n   - **Output Format:** Instruct your script to output the extracted findings\n     into a JSONL file named `workspace\u002Fhistorical_learnings.jsonl`, matching\n     the following format:\n\n### Historical Learnings Schema Format (`workspace\u002Fhistorical_learnings.jsonl`)\n\n```json\n{\n  \"revision_id\": \"...\",\n  \"title\": \"...\",\n  \"description\": \"...\",\n  \"code_paths\": [\"file:line_number\"],\n  \"vuln_type\": \"...\",\n  \"mitigation_diff\": \"...\",\n  \"cve\": \"...\",\n  \"history\": [\n    {\n      \"stage\": \"history_extractor\",\n      \"action\": \"created\",\n      \"details\": \"Extracted from repository revision history.\",\n      \"pass_number\": \u003Ccurrent_pass_number>,\n      \"timestamp\": \"\u003Ccurrent_iso8601_timestamp>\"\n    }\n  ]\n}\n```\n\n1. **Phase 3: Execute and Verify:**\n   - Run the script you just wrote to analyze the VCS history, process\n     revisions, and generate the `workspace\u002Fhistorical_learnings.jsonl` file.\n   - Wait for the script to finish and verify that\n     `workspace\u002Fhistorical_learnings.jsonl` has been written successfully and\n     contains extracted data.\n\nWhen complete, notify the user.\n","# History Analyzer (\u002Fmantis-history)\n\n## System Goal\n\nHistorical Vulnerability Extractor. Analyzes repository's version control system\n(VCS) history to extract past vulnerabilities, security-related fixes, patches,\nand associated files, creating a historical learnings database to inform\ndownstream skills.\n\n## Command Definition\n\n- **Command:** `\u002Fmantis-history`\n- **Description:** Analyzes repository's version control system (VCS) history to\n  extract past vulnerabilities and fixes, producing a structured historical\n  learnings file (`workspace\u002Fhistorical_learnings.jsonl`).\n- **Arguments (optional; supplied by the orchestrator, consumed by Block A):**\n  `--snapshot_root`\u002F`--snapshot_id`\u002F`--state_root`. History reads VCS logs from\n  the LIVE repository root (Block A step 5), not the snapshot; it uses\n  `--state_root` only to place its cache\u002Foutput\u002Fscript. All absent -> DEGRADED\n  (behaves as today, live cwd).\n\n## Input\u002FOutput Contract\n\n- **Reads**:\n  - `workspace\u002F.mantis_state.json` (to track current loop pass).\n  - Codebase directory structure and key files (to determine stack).\n  - VCS history logs (commit messages, titles, diffs).\n  - `mantis-summary.md` (optional, if available).\n  - Internal history analysis cache (optional, if exists).\n- **Writes**:\n  - VCS extraction script (written on-the-fly to workspace).\n  - `workspace\u002Fhistorical_learnings.jsonl`.\n  - Internal history analysis cache.\n  - All under `--state_root\u002Fworkspace\u002F` (cache, `historical_learnings.jsonl`,\n    extraction script): kept outside the target tree. Optional `history_status`\n    marker (`UNSUPPORTED_VCS` \u002F `PARTIAL_SHALLOW`).\n- **Preconditions**:\n  - Target repository and VCS logs must be accessible.\n- **Idempotency Guarantee**:\n  - The cache is the source of truth: the output DB is rebuilt from it every run\n    and is never truncated to empty while the cache is non-empty. The cache is\n    invalidated on VCS-history rewrite (`_analyzed_head` no longer reachable) or\n    a vcs_type\u002Frepo-identity change. On `none`\u002F`unknown` VCS the stage writes an\n    empty DB + `history_status=UNSUPPORTED_VCS` and exits.\n\n## Instructions\n\n### Step 0: Locator Resolution (run first)\n\n```\nLOCATOR RESOLUTION (before reading ANY target code or artifact):\n0. ROLE: If this skill NEVER reads target source (report, calibrate, reflect),\n   you are a FINDINGS-ONLY stage: skip steps 2-6; still read active_snapshot from\n   state for provenance\u002Fannotation; NEVER stop merely because a code root is unset.\n1. Determine CODE_ROOT, in this priority order:\n   a. If --target_root is passed on THIS invocation, CODE_ROOT = --target_root.\n      It is AUTHORITATIVE and OVERRIDES SNAPSHOT_ROOT and the state fallback\n      (used when a caller hands you a prepared tree, e.g. a patched shadow).\n   b. Else if --snapshot_root (or SNAPSHOT_ROOT) is passed, use it.\n   c. Else read state_root\u002Fworkspace\u002F.mantis_state.json (state_root from\n      --state_root if passed, else .\u002Fworkspace\u002F... relative to the current dir)\n      -> active_snapshot.root \u002F .snapshot_id \u002F .snapshot_pinned.\n   d. Else (no arg AND no readable active_snapshot): CODE_ROOT = current directory,\n      treat snapshot_pinned = false (MODE-OFF). Do NOT stop.\n2. SENTINEL CHECK (only if snapshot_pinned is true AND you did NOT take path 1a):\n   verify CODE_ROOT\u002F.mantis_snapshot_id exists and equals SNAPSHOT_ID. If missing\n   or different -> STOP \"snapshot sentinel mismatch\". (A --target_root tree (1a) is\n   deliberately mutated and is sentinel-EXEMPT.)\n3. PATH FIELDS:\n   - SNAPSHOT-RELATIVE (read under CODE_ROOT): code_paths entries; plan target_files\n     that are file paths. Strip ONLY a trailing \":\u003Cdigits>\". A code_paths entry\n     containing \":\u002F\u002F\" is a URL\u002Fendpoint, NOT a file read. A code_paths entry that is\n     NOT of the form \u003Cexisting-path>:\u003Cinteger> is a non-source LOCATOR\n     (symbol\u002Foffset\u002Fendpoint): only check that the artifact\u002Fsymbol exists; skip ALL\n     line-range and line-existence logic.\n   - STATE-RELATIVE (read\u002Fwrite under state_root\u002Fworkspace, NEVER prefix CODE_ROOT):\n     kb_references, repro_file_path, reattack_file_path, helper scripts, report\n     files, and all state\u002Ffindings JSON.\n4. Never WRITE under CODE_ROOT when snapshot_pinned is true. Any command that\n   compiles, generates, or writes artifacts MUST run in a PRIVATE SHADOW copy\n   (mktemp -d from CODE_ROOT), never with cwd=CODE_ROOT. Read-only inspection may\n   cd into CODE_ROOT.\n5. VCS-METADATA CARVE-OUT: history-log extraction and any VCS diff\u002Fblame command\n   run in the LIVE repository root (which still has .git\u002F.hg\u002F.repo), NOT CODE_ROOT\n   (the snapshot copy strips VCS metadata). Do NOT stop merely because CODE_ROOT\n   lacks .git\u002F.hg\u002F.repo.\n6. Every shell command uses ABSOLUTE paths and sets its own working directory on\n   that call. Do NOT assume the working directory persists between calls.\n```\n\nCRITICAL for history: the pinned snapshot copy STRIPS `.git`\u002F`.hg`\u002F`.repo`, so\nper Block A step 5 you MUST run every VCS log \u002F diff \u002F blame command in the LIVE\nrepository root (the working directory Mantis was launched in), NOT under\nCODE_ROOT. Do NOT stop because CODE_ROOT lacks VCS metadata. Write the cache,\n`workspace\u002Fhistorical_learnings.jsonl`, and your generated extraction script\nunder `--state_root\u002Fworkspace\u002F` (STATE-RELATIVE) — never into the target tree,\nso a sync\u002Fclean cannot wipe them. Record `active_snapshot.snapshot_id` on\nentries only for provenance.\n\nYour task is to analyze the codebase architecture, determine what constitutes\nsecurity-relevant history, and write a script on-the-fly to extract and document\nhistorical vulnerabilities from the project's version control system (VCS).\n\nExecute the history analysis stage as follows:\n\n1. **Phase 1: Analyze Codebase and Define Target History:**\n\n   - Read existing summaries (e.g. `mantis-summary.md` if available) or quickly\n     inspect the root codebase structure to understand the primary files,\n     programming languages, and core components.\n   - Determine what types of historical security issues (e.g., memory\n     corruption, authentication bypass, SQL injection, buffer overflow, or\n     others) are relevant to this project and what keywords or commits should be\n     targeted.\n\n2. **Phase 2: Write a History Extraction Script:**\n\n   - **VCS-support guard (run BEFORE writing\u002Fexecuting the script):** Determine\n     `vcs_type` from `.mantis_state.json` `vcs_info` (or detect it in the LIVE\n     root). If `vcs_type` is `none` or `unknown`, OR the VCS history is\n     otherwise unreachable: write an EMPTY\n     `workspace\u002Fhistorical_learnings.jsonl`, set a top-of-file \u002F sidecar marker\n     `history_status = \"UNSUPPORTED_VCS\"`, and EXIT — never fabricate history.\n     For `multi-vcs` (.repo): either iterate history per sub-project, or write\n     the empty file with `history_status = \"UNSUPPORTED_VCS\"` rather than run a\n     git-shaped script that errors. For a SHALLOW git clone\n     (`git rev-parse --is-shallow-repository` == true): proceed but set\n     `history_status = \"PARTIAL_SHALLOW\"` so downstream stages do NOT read \"no\n     historical vuln for this file\" as \"clean.\"\n\n   - Read the active pass number from the state file\n     `workspace\u002F.mantis_state.json` and resolve the current ISO 8601 timestamp.\n\n   - Write a script (e.g. Python, bash, or your choice) directly in your\n     workspace that interacts with your repository version control system (VCS)\n     history logs.\n\n   - **Cost-Efficiency & Scale Optimization:** To ensure the historical analysis\n     remains cost-effective and runs efficiently, the script must implement the\n     following optimizations:\n\n     - **Commit Message\u002FDescription Pre-filtering:** Before retrieving diffs,\n       the script should dynamically determine relevant keywords for commit\n       message screening. It can do this by first inspecting the repository's\n       files and languages\u002Fdomains in scope to establish its primary stack (e.g.\n       software versus hardware\u002FRTL), then either querying an LLM\u002Fanalysis agent\n       for a tailored list of security\u002Fbug keywords or using a broader set of\n       keywords augmented with these specific domain terms. Skip revisions whose\n       messages or titles do not match these relevant keywords to avoid\n       unnecessarily retrieving and analyzing changesets that are irrelevant to\n       the codebase in scope.\n     - **Diff Filtering and Size Limits:** Ignore commits that only touch\n       non-production code (e.g., tests, documentation, or configuration files).\n       Skip commits with excessively large diffs (e.g., more than several\n       thousand lines changed), as they are usually automated formatting changes\n       or massive refactorings rather than discrete security patches.\n     - **Caching Results (cache is the source of truth):** Maintain a local\n       cache (JSON or SQLite) under `workspace\u002F` mapping\n       `revision_id -> analyzed`, AND storing the full extracted record for each\n       analyzed revision plus an `_analyzed_head` high-water mark and the\n       `vcs_type` + repo identity the cache was built against. On each run,\n       REBUILD `workspace\u002Fhistorical_learnings.jsonl` from the cache (do NOT\n       skip a revision merely because the cache says \"analyzed\" and then leave\n       the output empty — that is the desync bug). NEVER truncate a non-empty\n       output DB to empty. Only analyze revisions NEWER than `_analyzed_head`.\n       **Rewrite detection:** before trusting the cache, verify `_analyzed_head`\n       still resolves in the current LIVE history (git:\n       `git cat-file -e \u003C_analyzed_head>` succeeds AND\n       `git merge-base --is-ancestor \u003C_analyzed_head> HEAD`; hg:\n       `hg log -r \u003C_analyzed_head>` succeeds). If it does not (force-push \u002F\n       rebase \u002F squash) OR `vcs_type`\u002Frepo identity changed, INVALIDATE the\n       cache and re-extract from scratch.\n     - **Batch Processing (Batching Diffs):** Instead of making one LLM call per\n       commit diff, the script should batch multiple commit diffs and messages\n       (e.g. 3 to 5 commits) into a single LLM call. Ask the LLM to analyze all\n       commits in the batch and return a JSON array of findings for the batch,\n       reducing request overhead and cost.\n     - **Model Selection:** Use lightweight and cost-efficient models for the\n       initial commit analysis\u002Ffiltering, and only fall back to heavier model\n       tiers if deeper verification of a suspected vulnerability is needed.\n\n   - **Detailed Analysis:** For revisions or commits that look\n     security-relevant, the script should retrieve the commit diffs and\n     messages\u002Fchange descriptions.\n\n   - **LLM\u002FAgent Analysis:** The script should make API calls (e.g., via\n     subagent messages or Agent API subcommands) or use an LLM subagent to\n     analyze the changes' diffs and messages to determine whether a\n     revision\u002Fcommit was a security fix, what component was affected, the\n     vulnerability type, impact, and the mitigation diff. Make sure it uses\n     batching and caching to minimize API calls.\n\n   - **Missing Information:** Do not overindex on the lack of security-related\n     keywords. Many security fixes do not get CVEs, and many security\n     vulnerabilities are fixed without realizing they were vulnerabilities.\n\n   - **Output Format:** Instruct your script to output the extracted findings\n     into a JSONL file named `workspace\u002Fhistorical_learnings.jsonl`, matching\n     the following format:\n\n### Historical Learnings Schema Format (`workspace\u002Fhistorical_learnings.jsonl`)\n\n```json\n{\n  \"revision_id\": \"...\",\n  \"title\": \"...\",\n  \"description\": \"...\",\n  \"code_paths\": [\"file:line_number\"],\n  \"vuln_type\": \"...\",\n  \"mitigation_diff\": \"...\",\n  \"cve\": \"...\",\n  \"history\": [\n    {\n      \"stage\": \"history_extractor\",\n      \"action\": \"created\",\n      \"details\": \"Extracted from repository revision history.\",\n      \"pass_number\": \u003Ccurrent_pass_number>,\n      \"timestamp\": \"\u003Ccurrent_iso8601_timestamp>\"\n    }\n  ]\n}\n```\n\n1. **Phase 3: Execute and Verify:**\n   - Run the script you just wrote to analyze the VCS history, process\n     revisions, and generate the `workspace\u002Fhistorical_learnings.jsonl` file.\n   - Wait for the script to finish and verify that\n     `workspace\u002Fhistorical_learnings.jsonl` has been written successfully and\n     contains extracted data.\n\nWhen complete, notify the user.\n",{"name":5,"description":7},"main","f3162c039ecd9c9d5d8bc404dd1373c7ca3152f7","skills\u002Fmantis-history",237,"https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fmantis","https:\u002F\u002Fcloud.google.com\u002F","https:\u002F\u002Fgithub.com\u002Fgoogle","https:\u002F\u002Fopensource.google\u002F","Google ❤️ Open Source","2026-11-15 00:33:31",{"source":9,"skillName":5,"commands":67,"prompt":77,"zipAvailable":78},[68,71,74],{"tool":69,"command":70},"npx","npx skills add google\u002Fmantis --skill mantis-history",{"tool":72,"command":73},"bunx","bunx skills add google\u002Fmantis --skill mantis-history",{"tool":75,"command":76},"pnpm","pnpm dlx skills add google\u002Fmantis --skill mantis-history","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fmantis\u002Fblob\u002Fmain\u002Fskills\u002Fmantis-history\u002FSKILL.md",true,[],[81,110,132,159,174,193],{"skillNo":82,"name":83,"nameZh":84,"description":85,"descriptionZh":86,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":87,"categories":88,"keywords":93,"publishedAt":51},"01M6992XJHHV0R5N8E392EHRW3","mantis-threat-model","Mantis 威胁建模","Synthesizes trust boundaries, attack surfaces, and attacker profiles into a living threat model. Use as Stage B of the Knowledge Base generation process, reading architecture and entity definitions from the KB. Don't use for analyzing source code or extracting raw learnings from JSONL files.","将信任边界、攻击面和攻击者画像综合成一个持续演进的威胁模型。用作知识库（KB）生成流程的阶段 B，从 KB 中读取架构与实体定义。不用于分析源代码或从 JSONL 文件中提取原始学习成果。","https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fmantis\u002Fblob\u002Fmain\u002Fskills\u002Fmantis-threat-model\u002FSKILL.md",[89,90],{"categoryNo":26,"categoryName":27,"taxonomyType":28,"taxonomyTypeDesc":29},{"categoryNo":91,"categoryName":92,"taxonomyType":23,"taxonomyTypeDesc":24},"01M8BSJ8FPTACYEEYRWQRNFXKY","安全检测工程",[94,95,96,97,98,49,99,100,101,102,103,104,42,105,41,106,107,37,108,109],"mantis threat model","threat model","model","threat","architecture","analyzing","knowledge","kb","files","surfaces","trust","knowledge base","extracting","reading","source","source code",{"skillNo":111,"name":112,"nameZh":113,"description":114,"descriptionZh":115,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":116,"categories":117,"keywords":120,"publishedAt":51},"01M6992TR1BPA5HVF13QRM7EP0","mantis-summarize","Mantis 代码库安全摘要生成","Pre-processes the repository by generating security-focused summaries (mantis-summary.md) for each directory to make planning and research more efficient. Use when starting a review campaign to map the codebase before threat modeling and planning. Don't use for executing code reviews, writing test scripts, or patching code.","通过为每个目录生成聚焦安全的摘要（mantis-summary.md）来预处理代码仓库，从而提升规划与研究效率。当启动审查活动、在威胁建模与规划之前梳理代码库时使用。不用于执行代码审查、编写测试脚本或修补代码。","https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fmantis\u002Fblob\u002Fmain\u002Fskills\u002Fmantis-summarize\u002FSKILL.md",[118,119],{"categoryNo":26,"categoryName":27,"taxonomyType":28,"taxonomyTypeDesc":29},{"categoryNo":91,"categoryName":92,"taxonomyType":23,"taxonomyTypeDesc":24},[121,122,43,123,124,50,125,49,126,46,45,97,127,128,129,40,130,38,35,131],"summarize","mantis summarize","directory","review","threat modeling","planning","campaign","map","modeling","make","when",{"skillNo":133,"name":134,"nameZh":135,"description":136,"descriptionZh":137,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":138,"categories":139,"keywords":142,"publishedAt":51},"01M6992QB4DVMDR2AGT6BPSE3N","mantis-structural-index","代码语义单元索引构建","Builds a content-addressed semantic-unit index from source code for structural context. Use when a pinned or live codebase is available and structural cross-reference data would improve research quality. Don't use for findings analysis, patching, or reporting.","从源代码构建一个内容寻址的语义单元索引，以提供结构化上下文。当拥有固定或实时的代码库，且结构化交叉引用数据能提升研究质量时使用。不用于发现分析、修补或报告。","https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fmantis\u002Fblob\u002Fmain\u002Fskills\u002Fmantis-structural-index\u002FSKILL.md",[140,141],{"categoryNo":26,"categoryName":27,"taxonomyType":28,"taxonomyTypeDesc":29},{"categoryNo":91,"categoryName":92,"taxonomyType":23,"taxonomyTypeDesc":24},[143,144,145,146,49,147,148,149,150,45,151,152,153,154,155,156,157,158,35,131],"mantis structural index","index","structural","research","content","reporting","data","analysis","improve","quality","context","use","research quality","reference","live","unit",{"skillNo":160,"name":161,"nameZh":162,"description":163,"descriptionZh":164,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":165,"categories":166,"keywords":169,"publishedAt":51},"01M6992KRP2XYWEMV12P5M4GPE","mantis-review","审查发现复核与误报过滤","Independently reviews findings and filters out false positives. Use when consolidated findings need validation against the actual source code. Don't use for reproducing crashes or patching code.","独立复核发现并过滤误报。当汇总的发现需要根据实际源代码进行验证时使用。不用于复现崩溃或修补代码。","https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fmantis\u002Fblob\u002Fmain\u002Fskills\u002Fmantis-review\u002FSKILL.md",[167,168],{"categoryNo":26,"categoryName":27,"taxonomyType":28,"taxonomyTypeDesc":29},{"categoryNo":91,"categoryName":92,"taxonomyType":23,"taxonomyTypeDesc":24},[124,170,49,171,45,154,172,173,38,35,108,109,131],"mantis review","validation","filters","false",{"skillNo":175,"name":176,"nameZh":177,"description":178,"descriptionZh":179,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":180,"categories":181,"keywords":184,"publishedAt":51},"01M6992GKVGJ2NXEJWYFVCN01Q","mantis-researcher","生产源代码安全审计","Audits production source code files based on the strategy in workspace\u002Fplan.json. Use when a review plan exists and you need to perform static analysis and deep-dive reviews of targeted files. Don't use for planning, deduplicating, or writing patches.","根据 workspace\u002Fplan.json 中的策略审计生产源代码文件。当存在审查计划且需要对目标文件进行静态分析和深入审查时使用。不用于规划、去重或编写补丁。","https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fmantis\u002Fblob\u002Fmain\u002Fskills\u002Fmantis-researcher\u002FSKILL.md",[182,183],{"categoryNo":26,"categoryName":27,"taxonomyType":28,"taxonomyTypeDesc":29},{"categoryNo":91,"categoryName":92,"taxonomyType":23,"taxonomyTypeDesc":24},[185,186,43,124,187,49,126,150,188,189,154,102,190,191,38,35,108,192,109,131],"mantis researcher","researcher","static analysis","plan","strategy","deep","you","static",{"skillNo":194,"name":195,"nameZh":196,"description":197,"descriptionZh":198,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":199,"categories":200,"keywords":203,"publishedAt":51},"01M6992D5WXENF3TW68GM5WPHC","mantis-reproduce","安全漏洞崩溃复现","Generates and runs crash reproducers to verify security flaws. Use when viable findings exist and you need to write and execute a script or payload to verify the crash. Don't use for code auditing or patching.","生成并运行崩溃复现程序以验证安全缺陷。当存在可行的发现且需要编写并执行脚本或 payload 来验证崩溃时使用。不用于代码审计或补丁制作。","https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fmantis\u002Fblob\u002Fmain\u002Fskills\u002Fmantis-reproduce\u002FSKILL.md",[201,202],{"categoryNo":26,"categoryName":27,"taxonomyType":28,"taxonomyTypeDesc":29},{"categoryNo":91,"categoryName":92,"taxonomyType":23,"taxonomyTypeDesc":24},[204,205,50,49,45,206,207,208,154,209,210,211,191,35,131],"mantis reproduce","reproduce","verify","write","execute","crash","payload","script"]