Loading...
Loading...
Consolidates raw security findings to eliminate redundant reports. Use when raw findings have been generated by the researcher and need consolidation before review. Don't use for initial code auditing or patch generation.
npx skill4agent add google/mantis mantis-dedupe/mantis-dedupe--snapshot_root--snapshot_id--state_rootworkspace/findings/.trash/workspace/archive/findings_pass_*/*.jsonworkspace/archive/loop*_findings/*.jsonworkspace/.mantis_state.jsonworkspace/findings/.trash/"status": "DUPLICATE""duplicate_of""possible_duplicate_of""discovery_commit"active_snapshotsnapshot_pinned.mantis_state.jsonworkspace/.tx_log.jsonlworkspace/helpers/merge_findings.pyworkspace/findings/<primary_id>.jsonworkspace/findings/workspace/archive/workspace/.tx_log.jsonlmerge_findings.pyLOCATOR RESOLUTION (before reading ANY target code or artifact):
0. ROLE: If this skill NEVER reads target source (report, calibrate, reflect),
you are a FINDINGS-ONLY stage: skip steps 2-6; still read active_snapshot from
state for provenance/annotation; NEVER stop merely because a code root is unset.
1. Determine CODE_ROOT, in this priority order:
a. If --target_root is passed on THIS invocation, CODE_ROOT = --target_root.
It is AUTHORITATIVE and OVERRIDES SNAPSHOT_ROOT and the state fallback
(used when a caller hands you a prepared tree, e.g. a patched shadow).
b. Else if --snapshot_root (or SNAPSHOT_ROOT) is passed, use it.
c. Else read state_root/workspace/.mantis_state.json (state_root from
--state_root if passed, else ./workspace/... relative to the current dir)
-> active_snapshot.root / .snapshot_id / .snapshot_pinned.
d. Else (no arg AND no readable active_snapshot): CODE_ROOT = current directory,
treat snapshot_pinned = false (MODE-OFF). Do NOT stop.
2. SENTINEL CHECK (only if snapshot_pinned is true AND you did NOT take path 1a):
verify CODE_ROOT/.mantis_snapshot_id exists and equals SNAPSHOT_ID. If missing
or different -> STOP "snapshot sentinel mismatch". (A --target_root tree (1a) is
deliberately mutated and is sentinel-EXEMPT.)
3. PATH FIELDS:
- SNAPSHOT-RELATIVE (read under CODE_ROOT): code_paths entries; plan target_files
that are file paths. Strip ONLY a trailing ":<digits>". A code_paths entry
containing "://" is a URL/endpoint, NOT a file read. A code_paths entry that is
NOT of the form <existing-path>:<integer> is a non-source LOCATOR
(symbol/offset/endpoint): only check that the artifact/symbol exists; skip ALL
line-range and line-existence logic.
- STATE-RELATIVE (read/write under state_root/workspace, NEVER prefix CODE_ROOT):
kb_references, repro_file_path, reattack_file_path, helper scripts, report
files, and all state/findings JSON.
4. Never WRITE under CODE_ROOT when snapshot_pinned is true. Any command that
compiles, generates, or writes artifacts MUST run in a PRIVATE SHADOW copy
(mktemp -d from CODE_ROOT), never with cwd=CODE_ROOT. Read-only inspection may
cd into CODE_ROOT.
5. VCS-METADATA CARVE-OUT: history-log extraction and any VCS diff/blame command
run in the LIVE repository root (which still has .git/.hg/.repo), NOT CODE_ROOT
(the snapshot copy strips VCS metadata). Do NOT stop merely because CODE_ROOT
lacks .git/.hg/.repo.
6. Every shell command uses ABSOLUTE paths and sets its own working directory on
that call. Do NOT assume the working directory persists between calls.[!NOTE] CURRENT-PASS CHECK (defensive; the binding guarantee is on the harness perScenario 2): ifmantis-pipeline-adapteris present ANDactive_snapshot, treat the snapshot as STALE for this pass — STOP "stale active_snapshot: pass mismatch" or degrade as HALT (active_snapshot.pass != state.pass_numbereffectively false: no authoritative verdicts, Block B NOT_MATCHED, reproducesnapshot_pinned). This catches a custom harness that preservednot_attemptedacross the Stage 15 pass increment without re-pinning. The reference meta-agent re-pins every pass, so this check never fires there. Block B itself cannot detect this (it isactive_snapshot-only, notsnapshot_id-aware).pass
workspace/findings/workspace/archive/workspace/.tx_log.jsonlworkspace/helpers/.mantis_state.jsonworkspace/findings/.trash/workspace/archive/findings_pass_*/*.jsonworkspace/archive/loop*_findings/*.jsonworkspace/historical_learnings.jsonldiscovery_commitactive_snapshot.snapshot_id.mantis_state.jsoncode_pathstitlesignaturecode_pathstitlecode_paths:linesignaturesignaturesignaturecode_pathstitlepossible_duplicate_ofsignaturecode_pathsparser.c:100parser.c:900signaturesignaturecode_pathstitlediscovery_commitdiscovery_commitSNAPSHOT_IDsnapshot_pinnedactive_snapshotactive_snapshotsnapshot_pinned=falsediscovery_commitlive:discovery_commitdiscovery_commit"MIXED"discovery_commitSNAPSHOT_IDdiscovery_commitSNAPSHOT_IDSNAPSHOT_ID"status": "DUPLICATE""duplicate_of": "<archived_uuid>"possible_duplicate_ofmkdir -p workspace/findings/.trash/loop_filterworkspace/.tx_log.jsonllineage_idlineage_idDUPLICATE"possible_duplicate_of": "<archived_uuid>"lineage_idlineage_id[!IMPORTANT] STATUS & DUPLICATE INVARIANTS:
- A finding MUST NOT carry both
andduplicate_ofpointing to the same target UUID.possible_duplicate_of MUST NOT coexist withstatus = "DUPLICATE"pointing to the same target UUID.possible_duplicate_of- Under NOT_MATCHED (outside the MODE-OFF fallback exception), the finding's
MUST remain active (e.g.status,VALID,PROVISIONALLY_VALID),NEEDS_RESEARCHMUST NOT be set, and the finding MUST NOT be moved toduplicate_of. Setting.trash/is a non-terminal hint only.possible_duplicate_of
patch_statusVERIFIED_SECUREMITIGATION_PROPOSEDstatusFALSE_POSITIVEproduction_viabilityNON_VIABLEactive_snapshotactive_snapshotsnapshot_pinnedactive_snapshot.snapshot_pinnedsignaturestable_keycode_paths:line:lineparser.c:100parser.c:900signature:linesignaturestable_keysignatureactive_snapshotpossible_duplicate_ofDUPLICATEcode_paths:lineworkspace/helpers/merge_findings.py# MANTIS_HELPER_VERSION = 2MANTIS_HELPER_VERSION = 2"id"NONELOWHIGHEXTERNALINTERNAL_NETWORKIN_CLUSTERLOCALHOST_SYSTEMSUPPLY_CHAINPHYSICAL_TEMPORARYPHYSICAL_LONG_TERMNONEREQUIRED"history""history""stage": "dedupe""action": "merge""details": "Merged duplicate findings: [comma-separated-ids]""pass_number": <current_pass_number>"timestamp": "<current_iso8601_timestamp>"discovery_commitrepro_snapshot_idpatch_base_snapshotpossible_duplicate_ofsignaturelineage_idcwediscovery_commitdiscovery_commitworkspace/findings/<primary_id>.jsonmkdir -p workspace/findings/.trash/"status": "DUPLICATE""duplicate_of": "<primary_uuid>".jsonworkspace/findings/.trash/workspace/.tx_log.jsonlworkspace/.tx_log.jsonl{"timestamp": "2026-07-14T15:13:00Z", "action": "loop_filter | dedupe_merge", "primary_uuid": "[UUID] (or null for loop_filter)", "moved_uuid": "[UUID]"}