[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M69914Z015N7Z4TTQH3DTCTC":3,"skill-same:01M69914Z015N7Z4TTQH3DTCTC":68},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":39,"linkOnly":40,"markdownContent":41,"markdownBody":42,"frontMatter":43,"refName":44,"commitSha":45,"skillDirectory":46,"forksCount":47,"repositoryHtmlUrl":48,"repositoryHomepageUrl":49,"ownerHtmlUrl":50,"ownerBlogUrl":51,"ownerDescription":52,"updatedAt":53,"install":54,"resources":67},"01M69914Z015N7Z4TTQH3DTCTC","mantis-architecture",null,"Synthesizes raw learnings and codebase analysis into an interlinked Markdown Knowledge Base (KB). Use at the beginning of a loop to build or update architecture.md, entities, and vulnerabilities. Don't use for generating threat models or formulating execution plans.","google\u002Fmantis","google","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F1342004?v=4","01M698VYEFDM0VJBZDYYJ2T83S","Google","01M6990SDGGFEAP21TJNS7HEG9",2778,"Apache-2.0","https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fmantis\u002Fblob\u002Fmain\u002Fskills\u002Fmantis-architecture\u002FSKILL.md",[],[19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38],"architecture","mantis architecture","entities","for","at","codebase analysis","plans","knowledge base","learnings","build","models","threat","use","kb","loop","knowledge","markdown","analysis","execution","update","2026-11-10 10:12:30",false,"---\nname: mantis-architecture\ndescription: >-\n  Synthesizes raw learnings and codebase analysis into an interlinked Markdown Knowledge Base (KB).\n  Use at the beginning of a loop to build or update architecture.md, entities, and vulnerabilities.\n  Don't use for generating threat models or formulating execution plans.\n---\n\n# Architect (\u002Fmantis-architecture)\n\n## System Goal\n\nKnowledge Base Synthesizer. Translates ephemeral insights from the learnings\nqueue (`workspace\u002Flearnings.jsonl`) and structural analysis of the codebase into\na canonical, interlinked Markdown Knowledge Base (`workspace\u002Fkb\u002F`).\n\n## Command Definition\n\n- **Command:** `\u002Fmantis-architecture`\n- **Description:** Builds the foundation of the KB by defining system\n  architecture, mapping specific entities (components), and categorizing\n  historical vulnerability patterns.\n- **Arguments (all optional; resolved by LOCATOR RESOLUTION \u002F Block A):**\n  `--snapshot_root=\u003Cdir>` (or the `SNAPSHOT_ROOT` env var) — the pinned code\n  snapshot to read target source from; `--snapshot_id=\u003Cid>` — the `SNAPSHOT_ID`\n  of that snapshot; `--state_root=\u003Cdir>` — the parent of `workspace\u002F` for all\n  state and KB paths; `--target_root=\u003Cdir>` — an already-prepared tree that\n  OVERRIDES the snapshot (rarely passed to this stage). When none are passed,\n  behavior is byte-for-byte today's (degraded\u002Funpinned): read source from the\n  current directory and treat `snapshot_pinned` as false.\n\n## Input\u002FOutput Contract\n\n- **Reads**:\n  - `workspace\u002Flearnings.jsonl` (raw insights from the current round).\n  - `workspace\u002Fhistorical_learnings.jsonl` (optional, past vulnerability\n    metadata).\n  - Codebase directory structure and key source files.\n  - Existing Markdown files in `workspace\u002Fkb\u002F` (to validate\u002Fdecay check).\n  - `workspace\u002F.mantis_state.json` (to retrieve pass count).\n  - `workspace\u002F.mantis_state.json` → `active_snapshot` (`root`, `snapshot_id`,\n    `snapshot_pinned`) and `snapshot_history` — provenance for the KB freshness\n    gate (step 0b). Read the snapshot from STATE ONLY; NEVER run a live VCS\n    command (`git`\u002F`hg`\u002F`repo`) to decide KB currency.\n  - `workspace\u002F.mantis_state.json` → `kb_snapshot_id` (the `SNAPSHOT_ID` the\n    current KB was last built against; absent on a first\u002Flegacy KB).\n  - `workspace\u002F.mantis_state.json` → `changed_files` and `changed_files_status`\n    (written by mantis-plan's Block E; consumed by the scoped KB invalidation in\n    step 0b outcome 3. Present from pass 2 on, but may be stale (written in a\n    prior pass) — the scoped path checks `changed_files_pass` against\n    `state.pass_number` and falls back to full rebuild if they differ.)\n- **Writes**:\n  - Markdown files under `workspace\u002Fkb\u002F` (`architecture.md`,\n    `entities\u002F[component_name].md`, `vulnerabilities\u002F[CWE-ID].md`, `index.md`).\n  - `workspace\u002Fkb\u002Fdependencies.json` — a JSON map of import\u002Fdependency edges\n    extracted during architectural analysis (keys = source file paths relative\n    to CODE_ROOT; values = arrays of files that import\u002Fdepend on the key file).\n    This is consumed by `mantis-plan`'s dependency-aware fan-out (Phase 2). If\n    the codebase has no parseable import structure, write `{}`. Re-derive only\n    changed entries during scoped invalidation (see outcome 3 below).\n  - Archives `workspace\u002Flearnings.jsonl` to\n    `workspace\u002Farchive\u002Flearnings\u002Flearnings_pass_${N}_${X}.jsonl`.\n  - A `\u003C!-- KB_SNAPSHOT: \u003CSNAPSHOT_ID> -->` marker as the FIRST line of every\n    (re)written KB file (`index.md`, each `entities\u002F*.md`, each\n    `vulnerabilities\u002F*.md`), plus `kb_snapshot_id` = `SNAPSHOT_ID` in\n    `workspace\u002F.mantis_state.json`.\n  - An immutable per-pass copy of the whole KB tree to\n    `workspace\u002Farchive\u002Fkb\u002Fkb_pass_${N}_${X}\u002F` (so a later reverted fix cannot\n    silently erase the record of what the KB claimed at pass N).\n- **Preconditions**:\n  - `workspace\u002Flearnings.jsonl` must exist.\n- **Idempotency Guarantee**:\n  - Transactional: moves `workspace\u002Flearnings.jsonl` to archive only after\n    programmatically verifying all KB Markdown updates were written\n    successfully. KB files are overwritten in-place.\n  - Snapshot stamping is part of the same transaction: the `KB_SNAPSHOT`\n    markers, the per-pass `workspace\u002Farchive\u002Fkb\u002Fkb_pass_${N}_${X_kb}\u002F` copy, and\n    the `kb_snapshot_id` state write complete before (or together with) the\n    learnings move. On any failure, leave `workspace\u002Flearnings.jsonl` intact.\n\n## Instructions\n\nAnalyze the codebase and pending learnings to construct a permanent,\nMarkdown-based memory for future agents.\n\nExecute the architecture stage as follows:\n\n0. **LOCATOR RESOLUTION (Block A, inlined below):**\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\nThis is a CODE-READING stage (steps 2 and 4 read target source), so Block A\nsteps 1-6 all apply; it is NOT findings-only. Resolve `CODE_ROOT`,\n`SNAPSHOT_ID`, and `snapshot_pinned` from state BEFORE doing anything below. Per\nBlock A step 3, all `workspace\u002Fkb\u002F...` paths are STATE-RELATIVE: read and write\nthem under `state_root\u002Fworkspace`, NEVER under `CODE_ROOT`. Read all target\nsource under `CODE_ROOT`. Do NOT run any VCS command to decide KB freshness\n(Block A step 5's carve-out is only for history\u002Fdiff\u002Fblame, which this stage\ndoes not use).\n\n0b. **KB SNAPSHOT FRESHNESS GATE (mechanical; STATE + KB marker only, NO live\nVCS):**\n\n````\n- `CUR` = `SNAPSHOT_ID` (resolved by Block A; the empty string if\n  `active_snapshot` was absent). `PINNED` = `snapshot_pinned` (false if absent).\n- **MODE-OFF short-circuit (3-state rule):** if `active_snapshot` is ABSENT\n  in state (no `--sync` was requested — MODE-OFF = today's default), SKIP the\n  freshness gate entirely: do a best-effort build\u002Fupdate against `CODE_ROOT`,\n  do NOT prepend any STALE banner, and do\n  NOT stamp `kb_snapshot_id`. This is byte-for-byte today's behavior. (Only\n  HALT and PINNED run the gate below.)\n- `KB_ID` = the `kb_snapshot_id` value in `.mantis_state.json` (primary); else the\n  text after `KB_SNAPSHOT:` on the FIRST line of\n  `state_root\u002Fworkspace\u002Fkb\u002Findex.md` if that file exists (secondary fallback,\n  for legacy runs without state); else `\"\"` (no prior KB). State is primary so\n  the file-marker parsing pitfall (comment-wrapped first line, no `-->`\n  stripping) can never strand `KB_ID` with the comment closer and force BUILD\n  FRESH every pass.\n- Choose EXACTLY ONE outcome by string checks, top to bottom, first match wins:\n  1. `PINNED` is false (HALT mode — `active_snapshot` present but unpinned)\n     ->  **STALE \u002F HALT.** Do a best-effort build\u002Fupdate against `CODE_ROOT`,\n     but PREPEND the STALE banner (below) as the first lines of `index.md`.\n     Do NOT claim currency: leave the\n     banner in place. Set `kb_snapshot_id` = `CUR` (a `live:` id).\n  2. Else `KB_ID` == `CUR` (both non-empty)  ->  **CURRENT.** Do the incremental\n     update + decay-check (step 4) as today. Re-stamp `KB_SNAPSHOT: CUR` on\n     every (re)written file. REMOVE any STALE banner previously prepended to\n     `index.md`.\n  3. Else (`PINNED` true AND (`KB_ID` is empty OR `KB_ID` != `CUR`)) ->\n     **BUILD FRESH (full or scoped re-architecture).** The pinned code advanced\n     since the KB was built (a sync \u002F pass-boundary change), OR the KB is\n     unstamped \u002F legacy. Choose full or scoped:\n     - **Scoped invalidation (Phase 2 incremental efficiency):** If\n       `changed_files_status` is known (not UNKNOWN) AND the KB already has a\n       `KB_SNAPSHOT` stamp (KB_ID was non-empty, just different) AND\n       `changed_files_pass` equals the current `state.pass_number` (the diff\n       is from THIS pass, not a stale prior pass — absent or different →\n       treat as UNKNOWN → full rebuild below), attempt a SCOPED rebuild: only\n       invalidate KB entries whose source files are in `changed_files`, plus\n       their parent-rollup dependents (KB entities that import\u002Freference the\n       changed files). Re-derive ONLY those entries from `CODE_ROOT`; carry\n       forward all other KB entries unchanged (they were built against the\n       same code, just a different snapshot ID). Re-stamp `KB_SNAPSHOT: CUR`\n       on every (re)written file.\n        - **Parent-rollup (2-hop, matching plan's fan-out):** When\n          invalidating a KB entry for changed file F, also invalidate any KB\n          entry that REFERENCES F directly (1-hop) AND any entry that\n          references a 1-hop dependent of F (2-hop). This matches\n          `mantis-plan`'s dependency-aware fan-out (which expands up to 2\n          hops), ensuring that a grandchild entity (H imports G, G imports\n          changed F) is not carried forward stale and later fed as a\n          `kb_reference` while its dependency has changed.\n       - **Guardrail:** If ANY uncertainty arises (can't determine which KB\n         entries map to which source files, the KB structure is ambiguous, or\n         changed_files is empty but KB_ID != CUR), fall back to full rebuild\n         below. Never carry forward a stale entry for a changed file.\n     - **Full rebuild (Phase-1 fallback):** If KB_ID is empty (no prior KB),\n       OR `changed_files_status` is UNKNOWN, OR the scoped invalidation guardrail\n       fired, REBUILD every KB file from scratch against `CODE_ROOT`. Do NOT\n       carry forward any prior assertion you have not re-derived from\n       `CODE_ROOT` this pass. Stamp `KB_SNAPSHOT: CUR`. REMOVE any STALE banner.\n- STALE banner (paste verbatim, substituting `\u003CKB_ID>` and `\u003CCUR>`; keep the\n  leading `>` on every line so it renders as a visible blockquote):\n\n  ```\n  > **STALE KB WARNING — do not trust without re-verifying.**\n  > snapshot_pinned=false, or the KB was built against a different snapshot.\n  > KB_SNAPSHOT=\u003CKB_ID> does not match active_snapshot.snapshot_id=\u003CCUR>.\n  > Every SECURE\u002FFIXED\u002FNON_VIABLE\u002FSAMPLE_OR_TEST claim below is UNVERIFIED\n  > against the current code. Re-verify before trusting; do NOT filter, skip,\n  > or down-prioritize work based on this KB.\n  ```\n````\n\n1. **Read the Inbox (`workspace\u002Flearnings.jsonl` and\n   `workspace\u002Fhistorical_learnings.jsonl`):**\n\n   - Parse the contents of `workspace\u002Flearnings.jsonl` (and\n     `workspace\u002Fhistorical_learnings.jsonl` if it exists). Extract all\n     trajectory insights, discovered vulnerabilities, viable crash paths, and\n     verified patches.\n\n2. **Analyze Source Code Boundaries:**\n\n   - Examine the directory structure and key source files **under `CODE_ROOT`**\n     (the pinned snapshot resolved by Block A; use absolute paths per Block A\n     step 6, and do NOT run a VCS command). Dynamically identify the core\n     components, interfaces, and trust boundaries of the system based on the\n     repository's contents. This applies broadly across domains: whether it is a\n     software system (e.g., identifying parsers, controllers, or network\n     daemons), a hardware\u002FRTL design (e.g., identifying IP blocks, JTAG\n     interfaces, or memory controllers), Infrastructure-as-Code (e.g.,\n     identifying cloud permissions, VPC perimeters, or deployment descriptors),\n     or data\u002FML pipelines (e.g., identifying data ingress points, model\n     serialization mechanisms, or training boundaries).\n\n3. **Build or Update the Knowledge Base (KB):**\n\n   - Create or update files in the `workspace\u002Fkb\u002F` directory using standard\n     Markdown. Follow these strict paths:\n\n     - `workspace\u002Fkb\u002Farchitecture.md`: High-level data flows, zone definitions,\n       system design, and overall availability\u002Fuptime requirements (if\n       documented or inferable from configuration like systemd, kubernetes, or\n       load balancers).\n     - `workspace\u002Fkb\u002Fentities\u002F[component_name].md`: Specific definitions for\n       components (e.g., `auth_module.md`). Must include links to associated\n       vulnerability classes and document known constraints (e.g., \"This module\n       sanitizes input X\"). Document the component's criticality and\n       availability requirements (classify as CRITICAL, STANDARD, or\n       LOW_CRITICALITY if applicable). Incorporate trajectory insights here.\n     - `workspace\u002Fkb\u002Fvulnerabilities\u002F[CWE-ID_or_BugClass].md`: Descriptions of\n       bug classes (e.g., `CWE-79.md` or `Memory-Corruption.md`) that have been\n       historically relevant to this codebase, including examples of what *not*\n       to do.\n     - `workspace\u002Fkb\u002Findex.md`: A root catalog containing links and 1-line\n       summaries to every file created above. This is the map the Planner will\n       read.\n\n   - **Important Formatting Rules:** Use relative links to cross-reference\n     entities and vulnerabilities (e.g.,\n     `[Auth Module](entities\u002Fauth_module.md)`). Ensure all markdown files are\n     concise and focused on actionable security context.\n\n   - **Snapshot stamping (REQUIRED on every (re)written KB file when running the\n     freshness gate, i.e. HALT or PINNED; never in MODE-OFF):** Make the FIRST\n     line of `index.md`, each `entities\u002F*.md`, and each `vulnerabilities\u002F*.md`\n     exactly `\u003C!-- KB_SNAPSHOT: \u003CSNAPSHOT_ID> -->` (substitute `CUR` from step\n     0b; it is an HTML comment so it does not render). This is how the next\n     pass's freshness gate (step 0b) detects drift. **MODE-OFF gate (3-state\n     rule):** if `active_snapshot` is ABSENT (MODE-OFF — no `--sync` was\n     requested), do NOT stamp the per-file `KB_SNAPSHOT` marker: `CUR` is the\n     empty string (`arch:145`: \"the empty string if `active_snapshot` was\n     absent\"), so the mandated marker would be `\u003C!-- KB_SNAPSHOT:  -->` (empty\n     value) — a snapshot-era artifact that did not exist in Phase 1. The\n     per-file marker is ONLY consumed by step 0b's freshness gate, which\n     MODE-OFF skips entirely (`arch:147-152`: \"SKIP the freshness gate\n     entirely... This is byte-for-byte today's behavior. Only HALT and PINNED\n     run the gate below.\"). This MODE-OFF gate mirrors the freshness gate logic\n     below and step 0b's outcome clauses, which mention per-file\n     `KB_SNAPSHOT: CUR` stamping only in HALT\u002FPINNED outcomes (CURRENT `:164`,\n     scoped BUILD FRESH `:178`, full BUILD FRESH `:195`).\n\n   - **Per-file `KB_SNAPSHOT` stamping is the sole provenance mechanism for KB\n     assertions.** Do NOT write per-assertion `(AS_OF:\u003Csnapshot>)` tags — the\n     `AS_OF` re-verification reader was never built, and staleness protection is\n     already provided by the freshness gate (step 0b) comparing `kb_snapshot_id`\n     to `SNAPSHOT_ID`, plus per-finding `discovery_commit` (enforced by\n     `mantis-critic` Block B). A later-reverted fix is caught by these\n     mechanisms, not by per-assertion tags.\n\n4. **Validate and Decay Knowledge (Drift Prevention):**\n\n   - Knowledge becomes stale when code is patched or refactored. Before\n     finalizing the KB updates, spot-check the assertions in the existing\n     `workspace\u002Fkb\u002Fentities\u002F` against the source **under `CODE_ROOT`** (the\n     pinned snapshot — NOT a live VCS query, and NOT the live working tree). In\n     the **BUILD FRESH** outcome (step 0b) do NOT spot-check at all: discard the\n     prior assertions and re-derive every entity from `CODE_ROOT` this pass. In\n     the **STALE \u002F HALT** outcome, spot-check only best-effort and keep the\n     STALE banner regardless of the result.\n   - If an entity file claims a variable is un-sanitized (based on an old\n     learning) but the live code now contains a sanitization function (because a\n     patch landed), **delete or correct that outdated learning** in the KB.\n   - If a learning is repeatedly proven wrong by the current trajectory\n     insights, actively correct it to prevent the \"wrong learning\" from\n     persisting and blinding future agents.\n   - When you correct or re-confirm a finding-derived assertion, re-stamp the\n     `KB_SNAPSHOT` marker on that KB file.\n\n5. **Transactional Inbox Clearing & Archiving:**\n\n   - To prevent infinite loops and token bloat, you must clear the queue and\n     archive the learnings.\n   - **Verify and Finalize:** Programmatically verify that all Markdown KB\n     updates were successfully written to disk and that cross-references are\n     valid. Also verify, before committing, that every (re)written KB file\n     BEGINS with its `\u003C!-- KB_SNAPSHOT: \u003CSNAPSHOT_ID> -->` marker and that every\n     finding-derived verdict is grounded in the current `SNAPSHOT_ID`.\n   - **Commit by Moving:** Only after verifying synthesis success, move\n     `workspace\u002Flearnings.jsonl` to the archive directory:\n     - Ensure the target directory exists (e.g.,\n       `mkdir -p workspace\u002Farchive\u002Flearnings\u002F`).\n     - Determine the loop pass number `N` by reading `\"pass_number\"` from\n       `workspace\u002F.mantis_state.json`. If missing or invalid, scan\n       `workspace\u002Farchive\u002F` for folders matching `findings_pass_N` or\n       `loopN_findings` and resolve `N` to `max_found + 1`, defaulting to 1 if\n       no archives exist.\n     - Determine the sub-index `X` by counting existing files matching\n       `learnings_pass_${N}_*.jsonl` in `workspace\u002Farchive\u002Flearnings\u002F` and\n       adding 1.\n     - Move the file:\n       `mv workspace\u002Flearnings.jsonl workspace\u002Farchive\u002Flearnings\u002Flearnings_pass_${N}_${X}.jsonl`.\n   - **Snapshot the KB (per-pass archive):** After a successful synthesis, copy\n     the whole KB tree to a per-pass archive:\n     - Ensure the directory exists (`mkdir -p workspace\u002Farchive\u002Fkb\u002F`).\n     - Compute sub-index `X_kb` = (count of existing `kb_pass_${N}_*`\n       directories in `workspace\u002Farchive\u002Fkb\u002F`) + 1.\n     - Copy (do NOT move — the live `workspace\u002Fkb\u002F` must persist for the next\n       pass): `cp -a workspace\u002Fkb\u002F. workspace\u002Farchive\u002Fkb\u002Fkb_pass_${N}_${X_kb}\u002F`.\n   - **Stamp state:** Write `kb_snapshot_id` = `SNAPSHOT_ID` (`CUR` from step\n     0b) into `workspace\u002F.mantis_state.json`. If `active_snapshot` was absent\n     (MODE-OFF), do NOT write `kb_snapshot_id` and do NOT prepend any STALE\n     banner (the freshness gate was skipped). In HALT mode, write\n     `kb_snapshot_id` = `CUR` and leave the STALE banner in `index.md`.\n   - If synthesis fails or is interrupted, leave `workspace\u002Flearnings.jsonl`\n     intact in its original location to ensure no data is lost.\n   - If `workspace\u002Flearnings.jsonl` is ABSENT on entry (e.g. the Stage-15\n     invocation, because the Stage-2 invocation already archived it this pass),\n     skip ONLY the learnings move; STILL run the freshness gate (step 0b), stamp\n     the `KB_SNAPSHOT` markers, write `kb_snapshot_id`, and copy the per-pass KB\n     archive. KB provenance must be recorded on every invocation.\n\nWhen complete, notify the user.\n","# Architect (\u002Fmantis-architecture)\n\n## System Goal\n\nKnowledge Base Synthesizer. Translates ephemeral insights from the learnings\nqueue (`workspace\u002Flearnings.jsonl`) and structural analysis of the codebase into\na canonical, interlinked Markdown Knowledge Base (`workspace\u002Fkb\u002F`).\n\n## Command Definition\n\n- **Command:** `\u002Fmantis-architecture`\n- **Description:** Builds the foundation of the KB by defining system\n  architecture, mapping specific entities (components), and categorizing\n  historical vulnerability patterns.\n- **Arguments (all optional; resolved by LOCATOR RESOLUTION \u002F Block A):**\n  `--snapshot_root=\u003Cdir>` (or the `SNAPSHOT_ROOT` env var) — the pinned code\n  snapshot to read target source from; `--snapshot_id=\u003Cid>` — the `SNAPSHOT_ID`\n  of that snapshot; `--state_root=\u003Cdir>` — the parent of `workspace\u002F` for all\n  state and KB paths; `--target_root=\u003Cdir>` — an already-prepared tree that\n  OVERRIDES the snapshot (rarely passed to this stage). When none are passed,\n  behavior is byte-for-byte today's (degraded\u002Funpinned): read source from the\n  current directory and treat `snapshot_pinned` as false.\n\n## Input\u002FOutput Contract\n\n- **Reads**:\n  - `workspace\u002Flearnings.jsonl` (raw insights from the current round).\n  - `workspace\u002Fhistorical_learnings.jsonl` (optional, past vulnerability\n    metadata).\n  - Codebase directory structure and key source files.\n  - Existing Markdown files in `workspace\u002Fkb\u002F` (to validate\u002Fdecay check).\n  - `workspace\u002F.mantis_state.json` (to retrieve pass count).\n  - `workspace\u002F.mantis_state.json` → `active_snapshot` (`root`, `snapshot_id`,\n    `snapshot_pinned`) and `snapshot_history` — provenance for the KB freshness\n    gate (step 0b). Read the snapshot from STATE ONLY; NEVER run a live VCS\n    command (`git`\u002F`hg`\u002F`repo`) to decide KB currency.\n  - `workspace\u002F.mantis_state.json` → `kb_snapshot_id` (the `SNAPSHOT_ID` the\n    current KB was last built against; absent on a first\u002Flegacy KB).\n  - `workspace\u002F.mantis_state.json` → `changed_files` and `changed_files_status`\n    (written by mantis-plan's Block E; consumed by the scoped KB invalidation in\n    step 0b outcome 3. Present from pass 2 on, but may be stale (written in a\n    prior pass) — the scoped path checks `changed_files_pass` against\n    `state.pass_number` and falls back to full rebuild if they differ.)\n- **Writes**:\n  - Markdown files under `workspace\u002Fkb\u002F` (`architecture.md`,\n    `entities\u002F[component_name].md`, `vulnerabilities\u002F[CWE-ID].md`, `index.md`).\n  - `workspace\u002Fkb\u002Fdependencies.json` — a JSON map of import\u002Fdependency edges\n    extracted during architectural analysis (keys = source file paths relative\n    to CODE_ROOT; values = arrays of files that import\u002Fdepend on the key file).\n    This is consumed by `mantis-plan`'s dependency-aware fan-out (Phase 2). If\n    the codebase has no parseable import structure, write `{}`. Re-derive only\n    changed entries during scoped invalidation (see outcome 3 below).\n  - Archives `workspace\u002Flearnings.jsonl` to\n    `workspace\u002Farchive\u002Flearnings\u002Flearnings_pass_${N}_${X}.jsonl`.\n  - A `\u003C!-- KB_SNAPSHOT: \u003CSNAPSHOT_ID> -->` marker as the FIRST line of every\n    (re)written KB file (`index.md`, each `entities\u002F*.md`, each\n    `vulnerabilities\u002F*.md`), plus `kb_snapshot_id` = `SNAPSHOT_ID` in\n    `workspace\u002F.mantis_state.json`.\n  - An immutable per-pass copy of the whole KB tree to\n    `workspace\u002Farchive\u002Fkb\u002Fkb_pass_${N}_${X}\u002F` (so a later reverted fix cannot\n    silently erase the record of what the KB claimed at pass N).\n- **Preconditions**:\n  - `workspace\u002Flearnings.jsonl` must exist.\n- **Idempotency Guarantee**:\n  - Transactional: moves `workspace\u002Flearnings.jsonl` to archive only after\n    programmatically verifying all KB Markdown updates were written\n    successfully. KB files are overwritten in-place.\n  - Snapshot stamping is part of the same transaction: the `KB_SNAPSHOT`\n    markers, the per-pass `workspace\u002Farchive\u002Fkb\u002Fkb_pass_${N}_${X_kb}\u002F` copy, and\n    the `kb_snapshot_id` state write complete before (or together with) the\n    learnings move. On any failure, leave `workspace\u002Flearnings.jsonl` intact.\n\n## Instructions\n\nAnalyze the codebase and pending learnings to construct a permanent,\nMarkdown-based memory for future agents.\n\nExecute the architecture stage as follows:\n\n0. **LOCATOR RESOLUTION (Block A, inlined below):**\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\nThis is a CODE-READING stage (steps 2 and 4 read target source), so Block A\nsteps 1-6 all apply; it is NOT findings-only. Resolve `CODE_ROOT`,\n`SNAPSHOT_ID`, and `snapshot_pinned` from state BEFORE doing anything below. Per\nBlock A step 3, all `workspace\u002Fkb\u002F...` paths are STATE-RELATIVE: read and write\nthem under `state_root\u002Fworkspace`, NEVER under `CODE_ROOT`. Read all target\nsource under `CODE_ROOT`. Do NOT run any VCS command to decide KB freshness\n(Block A step 5's carve-out is only for history\u002Fdiff\u002Fblame, which this stage\ndoes not use).\n\n0b. **KB SNAPSHOT FRESHNESS GATE (mechanical; STATE + KB marker only, NO live\nVCS):**\n\n````\n- `CUR` = `SNAPSHOT_ID` (resolved by Block A; the empty string if\n  `active_snapshot` was absent). `PINNED` = `snapshot_pinned` (false if absent).\n- **MODE-OFF short-circuit (3-state rule):** if `active_snapshot` is ABSENT\n  in state (no `--sync` was requested — MODE-OFF = today's default), SKIP the\n  freshness gate entirely: do a best-effort build\u002Fupdate against `CODE_ROOT`,\n  do NOT prepend any STALE banner, and do\n  NOT stamp `kb_snapshot_id`. This is byte-for-byte today's behavior. (Only\n  HALT and PINNED run the gate below.)\n- `KB_ID` = the `kb_snapshot_id` value in `.mantis_state.json` (primary); else the\n  text after `KB_SNAPSHOT:` on the FIRST line of\n  `state_root\u002Fworkspace\u002Fkb\u002Findex.md` if that file exists (secondary fallback,\n  for legacy runs without state); else `\"\"` (no prior KB). State is primary so\n  the file-marker parsing pitfall (comment-wrapped first line, no `-->`\n  stripping) can never strand `KB_ID` with the comment closer and force BUILD\n  FRESH every pass.\n- Choose EXACTLY ONE outcome by string checks, top to bottom, first match wins:\n  1. `PINNED` is false (HALT mode — `active_snapshot` present but unpinned)\n     ->  **STALE \u002F HALT.** Do a best-effort build\u002Fupdate against `CODE_ROOT`,\n     but PREPEND the STALE banner (below) as the first lines of `index.md`.\n     Do NOT claim currency: leave the\n     banner in place. Set `kb_snapshot_id` = `CUR` (a `live:` id).\n  2. Else `KB_ID` == `CUR` (both non-empty)  ->  **CURRENT.** Do the incremental\n     update + decay-check (step 4) as today. Re-stamp `KB_SNAPSHOT: CUR` on\n     every (re)written file. REMOVE any STALE banner previously prepended to\n     `index.md`.\n  3. Else (`PINNED` true AND (`KB_ID` is empty OR `KB_ID` != `CUR`)) ->\n     **BUILD FRESH (full or scoped re-architecture).** The pinned code advanced\n     since the KB was built (a sync \u002F pass-boundary change), OR the KB is\n     unstamped \u002F legacy. Choose full or scoped:\n     - **Scoped invalidation (Phase 2 incremental efficiency):** If\n       `changed_files_status` is known (not UNKNOWN) AND the KB already has a\n       `KB_SNAPSHOT` stamp (KB_ID was non-empty, just different) AND\n       `changed_files_pass` equals the current `state.pass_number` (the diff\n       is from THIS pass, not a stale prior pass — absent or different →\n       treat as UNKNOWN → full rebuild below), attempt a SCOPED rebuild: only\n       invalidate KB entries whose source files are in `changed_files`, plus\n       their parent-rollup dependents (KB entities that import\u002Freference the\n       changed files). Re-derive ONLY those entries from `CODE_ROOT`; carry\n       forward all other KB entries unchanged (they were built against the\n       same code, just a different snapshot ID). Re-stamp `KB_SNAPSHOT: CUR`\n       on every (re)written file.\n        - **Parent-rollup (2-hop, matching plan's fan-out):** When\n          invalidating a KB entry for changed file F, also invalidate any KB\n          entry that REFERENCES F directly (1-hop) AND any entry that\n          references a 1-hop dependent of F (2-hop). This matches\n          `mantis-plan`'s dependency-aware fan-out (which expands up to 2\n          hops), ensuring that a grandchild entity (H imports G, G imports\n          changed F) is not carried forward stale and later fed as a\n          `kb_reference` while its dependency has changed.\n       - **Guardrail:** If ANY uncertainty arises (can't determine which KB\n         entries map to which source files, the KB structure is ambiguous, or\n         changed_files is empty but KB_ID != CUR), fall back to full rebuild\n         below. Never carry forward a stale entry for a changed file.\n     - **Full rebuild (Phase-1 fallback):** If KB_ID is empty (no prior KB),\n       OR `changed_files_status` is UNKNOWN, OR the scoped invalidation guardrail\n       fired, REBUILD every KB file from scratch against `CODE_ROOT`. Do NOT\n       carry forward any prior assertion you have not re-derived from\n       `CODE_ROOT` this pass. Stamp `KB_SNAPSHOT: CUR`. REMOVE any STALE banner.\n- STALE banner (paste verbatim, substituting `\u003CKB_ID>` and `\u003CCUR>`; keep the\n  leading `>` on every line so it renders as a visible blockquote):\n\n  ```\n  > **STALE KB WARNING — do not trust without re-verifying.**\n  > snapshot_pinned=false, or the KB was built against a different snapshot.\n  > KB_SNAPSHOT=\u003CKB_ID> does not match active_snapshot.snapshot_id=\u003CCUR>.\n  > Every SECURE\u002FFIXED\u002FNON_VIABLE\u002FSAMPLE_OR_TEST claim below is UNVERIFIED\n  > against the current code. Re-verify before trusting; do NOT filter, skip,\n  > or down-prioritize work based on this KB.\n  ```\n````\n\n1. **Read the Inbox (`workspace\u002Flearnings.jsonl` and\n   `workspace\u002Fhistorical_learnings.jsonl`):**\n\n   - Parse the contents of `workspace\u002Flearnings.jsonl` (and\n     `workspace\u002Fhistorical_learnings.jsonl` if it exists). Extract all\n     trajectory insights, discovered vulnerabilities, viable crash paths, and\n     verified patches.\n\n2. **Analyze Source Code Boundaries:**\n\n   - Examine the directory structure and key source files **under `CODE_ROOT`**\n     (the pinned snapshot resolved by Block A; use absolute paths per Block A\n     step 6, and do NOT run a VCS command). Dynamically identify the core\n     components, interfaces, and trust boundaries of the system based on the\n     repository's contents. This applies broadly across domains: whether it is a\n     software system (e.g., identifying parsers, controllers, or network\n     daemons), a hardware\u002FRTL design (e.g., identifying IP blocks, JTAG\n     interfaces, or memory controllers), Infrastructure-as-Code (e.g.,\n     identifying cloud permissions, VPC perimeters, or deployment descriptors),\n     or data\u002FML pipelines (e.g., identifying data ingress points, model\n     serialization mechanisms, or training boundaries).\n\n3. **Build or Update the Knowledge Base (KB):**\n\n   - Create or update files in the `workspace\u002Fkb\u002F` directory using standard\n     Markdown. Follow these strict paths:\n\n     - `workspace\u002Fkb\u002Farchitecture.md`: High-level data flows, zone definitions,\n       system design, and overall availability\u002Fuptime requirements (if\n       documented or inferable from configuration like systemd, kubernetes, or\n       load balancers).\n     - `workspace\u002Fkb\u002Fentities\u002F[component_name].md`: Specific definitions for\n       components (e.g., `auth_module.md`). Must include links to associated\n       vulnerability classes and document known constraints (e.g., \"This module\n       sanitizes input X\"). Document the component's criticality and\n       availability requirements (classify as CRITICAL, STANDARD, or\n       LOW_CRITICALITY if applicable). Incorporate trajectory insights here.\n     - `workspace\u002Fkb\u002Fvulnerabilities\u002F[CWE-ID_or_BugClass].md`: Descriptions of\n       bug classes (e.g., `CWE-79.md` or `Memory-Corruption.md`) that have been\n       historically relevant to this codebase, including examples of what *not*\n       to do.\n     - `workspace\u002Fkb\u002Findex.md`: A root catalog containing links and 1-line\n       summaries to every file created above. This is the map the Planner will\n       read.\n\n   - **Important Formatting Rules:** Use relative links to cross-reference\n     entities and vulnerabilities (e.g.,\n     `[Auth Module](entities\u002Fauth_module.md)`). Ensure all markdown files are\n     concise and focused on actionable security context.\n\n   - **Snapshot stamping (REQUIRED on every (re)written KB file when running the\n     freshness gate, i.e. HALT or PINNED; never in MODE-OFF):** Make the FIRST\n     line of `index.md`, each `entities\u002F*.md`, and each `vulnerabilities\u002F*.md`\n     exactly `\u003C!-- KB_SNAPSHOT: \u003CSNAPSHOT_ID> -->` (substitute `CUR` from step\n     0b; it is an HTML comment so it does not render). This is how the next\n     pass's freshness gate (step 0b) detects drift. **MODE-OFF gate (3-state\n     rule):** if `active_snapshot` is ABSENT (MODE-OFF — no `--sync` was\n     requested), do NOT stamp the per-file `KB_SNAPSHOT` marker: `CUR` is the\n     empty string (`arch:145`: \"the empty string if `active_snapshot` was\n     absent\"), so the mandated marker would be `\u003C!-- KB_SNAPSHOT:  -->` (empty\n     value) — a snapshot-era artifact that did not exist in Phase 1. The\n     per-file marker is ONLY consumed by step 0b's freshness gate, which\n     MODE-OFF skips entirely (`arch:147-152`: \"SKIP the freshness gate\n     entirely... This is byte-for-byte today's behavior. Only HALT and PINNED\n     run the gate below.\"). This MODE-OFF gate mirrors the freshness gate logic\n     below and step 0b's outcome clauses, which mention per-file\n     `KB_SNAPSHOT: CUR` stamping only in HALT\u002FPINNED outcomes (CURRENT `:164`,\n     scoped BUILD FRESH `:178`, full BUILD FRESH `:195`).\n\n   - **Per-file `KB_SNAPSHOT` stamping is the sole provenance mechanism for KB\n     assertions.** Do NOT write per-assertion `(AS_OF:\u003Csnapshot>)` tags — the\n     `AS_OF` re-verification reader was never built, and staleness protection is\n     already provided by the freshness gate (step 0b) comparing `kb_snapshot_id`\n     to `SNAPSHOT_ID`, plus per-finding `discovery_commit` (enforced by\n     `mantis-critic` Block B). A later-reverted fix is caught by these\n     mechanisms, not by per-assertion tags.\n\n4. **Validate and Decay Knowledge (Drift Prevention):**\n\n   - Knowledge becomes stale when code is patched or refactored. Before\n     finalizing the KB updates, spot-check the assertions in the existing\n     `workspace\u002Fkb\u002Fentities\u002F` against the source **under `CODE_ROOT`** (the\n     pinned snapshot — NOT a live VCS query, and NOT the live working tree). In\n     the **BUILD FRESH** outcome (step 0b) do NOT spot-check at all: discard the\n     prior assertions and re-derive every entity from `CODE_ROOT` this pass. In\n     the **STALE \u002F HALT** outcome, spot-check only best-effort and keep the\n     STALE banner regardless of the result.\n   - If an entity file claims a variable is un-sanitized (based on an old\n     learning) but the live code now contains a sanitization function (because a\n     patch landed), **delete or correct that outdated learning** in the KB.\n   - If a learning is repeatedly proven wrong by the current trajectory\n     insights, actively correct it to prevent the \"wrong learning\" from\n     persisting and blinding future agents.\n   - When you correct or re-confirm a finding-derived assertion, re-stamp the\n     `KB_SNAPSHOT` marker on that KB file.\n\n5. **Transactional Inbox Clearing & Archiving:**\n\n   - To prevent infinite loops and token bloat, you must clear the queue and\n     archive the learnings.\n   - **Verify and Finalize:** Programmatically verify that all Markdown KB\n     updates were successfully written to disk and that cross-references are\n     valid. Also verify, before committing, that every (re)written KB file\n     BEGINS with its `\u003C!-- KB_SNAPSHOT: \u003CSNAPSHOT_ID> -->` marker and that every\n     finding-derived verdict is grounded in the current `SNAPSHOT_ID`.\n   - **Commit by Moving:** Only after verifying synthesis success, move\n     `workspace\u002Flearnings.jsonl` to the archive directory:\n     - Ensure the target directory exists (e.g.,\n       `mkdir -p workspace\u002Farchive\u002Flearnings\u002F`).\n     - Determine the loop pass number `N` by reading `\"pass_number\"` from\n       `workspace\u002F.mantis_state.json`. If missing or invalid, scan\n       `workspace\u002Farchive\u002F` for folders matching `findings_pass_N` or\n       `loopN_findings` and resolve `N` to `max_found + 1`, defaulting to 1 if\n       no archives exist.\n     - Determine the sub-index `X` by counting existing files matching\n       `learnings_pass_${N}_*.jsonl` in `workspace\u002Farchive\u002Flearnings\u002F` and\n       adding 1.\n     - Move the file:\n       `mv workspace\u002Flearnings.jsonl workspace\u002Farchive\u002Flearnings\u002Flearnings_pass_${N}_${X}.jsonl`.\n   - **Snapshot the KB (per-pass archive):** After a successful synthesis, copy\n     the whole KB tree to a per-pass archive:\n     - Ensure the directory exists (`mkdir -p workspace\u002Farchive\u002Fkb\u002F`).\n     - Compute sub-index `X_kb` = (count of existing `kb_pass_${N}_*`\n       directories in `workspace\u002Farchive\u002Fkb\u002F`) + 1.\n     - Copy (do NOT move — the live `workspace\u002Fkb\u002F` must persist for the next\n       pass): `cp -a workspace\u002Fkb\u002F. workspace\u002Farchive\u002Fkb\u002Fkb_pass_${N}_${X_kb}\u002F`.\n   - **Stamp state:** Write `kb_snapshot_id` = `SNAPSHOT_ID` (`CUR` from step\n     0b) into `workspace\u002F.mantis_state.json`. If `active_snapshot` was absent\n     (MODE-OFF), do NOT write `kb_snapshot_id` and do NOT prepend any STALE\n     banner (the freshness gate was skipped). In HALT mode, write\n     `kb_snapshot_id` = `CUR` and leave the STALE banner in `index.md`.\n   - If synthesis fails or is interrupted, leave `workspace\u002Flearnings.jsonl`\n     intact in its original location to ensure no data is lost.\n   - If `workspace\u002Flearnings.jsonl` is ABSENT on entry (e.g. the Stage-15\n     invocation, because the Stage-2 invocation already archived it this pass),\n     skip ONLY the learnings move; STILL run the freshness gate (step 0b), stamp\n     the `KB_SNAPSHOT` markers, write `kb_snapshot_id`, and copy the per-pass KB\n     archive. KB provenance must be recorded on every invocation.\n\nWhen complete, notify the user.\n",{"name":5,"description":7},"main","f3162c039ecd9c9d5d8bc404dd1373c7ca3152f7","skills\u002Fmantis-architecture",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":8,"skillName":5,"commands":55,"prompt":65,"zipAvailable":66},[56,59,62],{"tool":57,"command":58},"npx","npx skills add google\u002Fmantis --skill mantis-architecture",{"tool":60,"command":61},"bunx","bunx skills add google\u002Fmantis --skill mantis-architecture",{"tool":63,"command":64},"pnpm","pnpm dlx skills add google\u002Fmantis --skill mantis-architecture","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fmantis\u002Fblob\u002Fmain\u002Fskills\u002Fmantis-architecture\u002FSKILL.md",true,[],[69,90,119,145,156,171],{"skillNo":70,"name":71,"nameZh":6,"description":72,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":73,"categories":74,"keywords":75,"publishedAt":39},"01M6992XJHHV0R5N8E392EHRW3","mantis-threat-model","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.","https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fmantis\u002Fblob\u002Fmain\u002Fskills\u002Fmantis-threat-model\u002FSKILL.md",[],[76,77,78,30,19,79,80,34,32,81,82,83,27,26,84,85,86,87,88,89],"mantis threat model","threat model","model","code","analyzing","files","surfaces","trust","as","extracting","reading","jsonl","source","source code",{"skillNo":91,"name":92,"nameZh":6,"description":93,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":94,"categories":95,"keywords":101,"publishedAt":39},"01M6992TR1BPA5HVF13QRM7EP0","mantis-summarize","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.","https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fmantis\u002Fblob\u002Fmain\u002Fskills\u002Fmantis-summarize\u002FSKILL.md",[96],{"categoryNo":97,"categoryName":98,"taxonomyType":99,"taxonomyTypeDesc":100},"01JBSEEDCAT000000000000021","资料检索与研究","SCENARIO","使用场景",[102,103,104,105,106,107,108,79,109,110,111,30,112,113,114,115,116,117,22,118],"summarize","mantis summarize","writing","directory","review","security","threat modeling","planning","repository","patching","campaign","map","modeling","scripts","make","reviews","when",{"skillNo":120,"name":121,"nameZh":6,"description":122,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":123,"categories":124,"keywords":130,"publishedAt":39},"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",[125],{"categoryNo":126,"categoryName":127,"taxonomyType":128,"taxonomyTypeDesc":129},"01JBSEEDCAT000000000000030","开发工程师","PROFESSION","适用职业",[131,132,133,134,79,135,136,137,36,111,138,139,140,31,141,142,143,144,22,118],"mantis structural index","index","structural","research","content","reporting","data","improve","quality","context","research quality","reference","live","unit",{"skillNo":146,"name":147,"nameZh":6,"description":148,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":149,"categories":150,"keywords":151,"publishedAt":39},"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",[],[106,152,79,153,111,31,154,155,117,22,88,89,118],"mantis review","validation","filters","false",{"skillNo":157,"name":158,"nameZh":6,"description":159,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":160,"categories":161,"keywords":162,"publishedAt":39},"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.","https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fmantis\u002Fblob\u002Fmain\u002Fskills\u002Fmantis-researcher\u002FSKILL.md",[],[163,164,104,106,165,79,109,36,166,167,31,81,168,169,117,22,88,170,89,118],"mantis researcher","researcher","static analysis","plan","strategy","deep","you","static",{"skillNo":172,"name":173,"nameZh":6,"description":174,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":175,"categories":176,"keywords":177,"publishedAt":39},"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.","https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fmantis\u002Fblob\u002Fmain\u002Fskills\u002Fmantis-reproduce\u002FSKILL.md",[],[178,179,107,79,111,180,181,182,31,183,184,185,169,22,118],"mantis reproduce","reproduce","verify","write","execute","crash","payload","script"]