
mantis-advise
Proactive security advisor and architectural remediation assistant for secure code development. Use to query threat models, historical vulnerability lineages, verified patch patterns, triaged false positives, and learned trajectory invariants before code edits or to generate architectural remediation plans for confirmed findings. Don't use for automated multi-pass red-team exploitation or fuzzing.
- Installs
- 1K
- Last 24h
- —
- Trending rank
- —
- Security
- Not audited
Install
Works with every agent the skills CLI supports.
npx skills add https://github.com/google/mantis --skill mantis-advise- 01
Install
Run the command in your project. The CLI asks which agents to install for.
- 02
Describe the task
Ask your agent for something this skill covers. It loads mantis-advise automatically when relevant.
- 03
Review the result
The agent follows the SKILL.md steps, scripts and references bundled with the skill.
SKILL.md
The instructions your agent reads when the skill is triggered.
Security Advisor & Remediation Engine (/mantis-advise)
System Goal
Proactive Secure Development & Architectural Remediation Engine. Functions as a security guardrail, advisory assistant, and architectural remediator for developers and coding agents. Queries Mantis threat models, historical vulnerability lineages, verified remediation patterns, triaged false positives, and learned trajectory invariants to ensure that new code and refactors are implemented securely from the start, and to synthesize robust architectural remediations for confirmed vulnerabilities.
Command Definition
- Command:
/mantis-advise - Description: Queries security knowledge for a given target file or module, evaluates proposed changes against known threat boundaries, and provides verified secure implementation guidance or architectural remediation plans.
- Execution Command:
python3 "${MANTIS_HOME:-/path/to/mantis}/reference/scripts/advise.py" --file <target_file> [--db knowledge.db] - Arguments (optional):
--file/-f(or--target/-t): Target source file or component path (e.g.src/auth.pyorapi/app.py). Defaults to repo-wide scope if omitted.--remediate/-r: Finding ID, lineage UUID, or file to generate an architectural remediation dossier and verification plan for.--db/-d: Path to Mantis SQLite database (default: auto-discoversknowledge.dborworkspace/knowledge.db).--lineage/-l: Query lifecycle and recurrence for a specific lineage UUID.--signature/-s: Query lifecycle for a specific content signature hash.--json: Emit structured JSON output instead of formatted markdown.--full: Emit unabridged OKF markdown bodies and un-truncated diffs.
How to Fetch Guidance
All Mantis knowledge (threat models, historical findings, verified patches,
triaged false positives, and learned invariants) lives in the SQLite database
(knowledge.db). Do not look for flat files on disk (like learnings.jsonl or
workspace/findings/*.json). Use one of the two execution doors below:
Mechanism 1: CLI Execution (Recommended for Coding Agents)
Coding agents with standard bash access should run advise.py using its
installation-anchored absolute path.
Path Anchoring Requirement (CRITICAL): The advisor script resides within the
Mantis installation directory at reference/scripts/advise.py. You MUST
invoke this script via an absolute path or via $MANTIS_HOME. NEVER execute
python3 reference/scripts/advise.py using a relative path inside the audited
target repository, as untrusted repositories could spoof scripts or cause
command failures.
-
Query Security Guidance for Target File:
python3 "$MANTIS_HOME/reference/scripts/advise.py" --file src/auth.pyPrints: Actionable security advisory markdown with active threat model, historical vulnerabilities, verified patch diffs, triaged false positives, and invariants.
-
Query Specific Bug Lineage & Recurrence:
python3 "$MANTIS_HOME/reference/scripts/advise.py" --lineage c3a5e982-1234-5678-9abc-def012345678 -
Machine-Readable JSON:
python3 "$MANTIS_HOME/reference/scripts/advise.py" --file src/auth.py --json -
Architectural Remediation Dossier for a Finding:
python3 "$MANTIS_HOME/reference/scripts/advise.py" --remediate <finding_id>
Mechanism 2: Python Tool Invocation (Inside Pipeline / Harness)
When running inside an agent harness or Python environment:
from core.database import query_security_guidance
guidance = query_security_guidance(db_path="knowledge.db", filepath="src/auth.py")
print(guidance["guidance_summary"])
Or via tool helper:
get_security_guidance(filepath="src/auth.py")
Input/Output Contract
- Reads:
knowledge.db(findings,campaign_artifacts,learnings, andrisk_scorestables).- Target source code files (under repository root).
- Writes:
- Structured Security Advisory & Guardrail recommendations formatted for the active developer or coding agent.
Core Advisory Protocols
Protocol 1: Pre-Implementation Security Context Check
Before authoring code or refactoring an existing module:
- Run the Advisor: Execute
python3 "$MANTIS_HOME/reference/scripts/advise.py" --file <target_file>. - Review Advisory Context:
- Trust Boundaries: Identify who interacts with this module (untrusted public internet, authenticated users, internal microservices).
- Historical Pitfalls: Review all vulnerabilities previously confirmed or
reproduced on this file. Pay specific attention to recurring
lineage_idchains. - Verified Safe Idioms: Review verified patch diffs from prior passes
marked
VERIFIED_SECURE. - Triaged False Positives: Review patterns previously classified as false positives to understand intentional design choices and avoid breaking legitimate functionality.
Protocol 2: Trust Boundary Verification
When introducing new endpoints, parameters, data parsing, or subprocess execution:
-
Input Normalization & Validation:
- Never trust input from external boundaries without canonicalization and strict schema enforcement.
- For file paths: resolve against jail boundaries using strict
os.path.abspathorPath.resolve()checks (startswith(jail_dir)). - For OS command execution: strictly use
shlex.quoteor array-basedsubprocess.run(["cmd", arg])withoutshell=True.
-
Defense-in-Depth:
- Ensure server-side validation even if client-side validation is present.
- Ensure zero-privilege assumptions (e.g. no unnecessary IAM permissions, bounded execution timeouts).
Protocol 3: Lineage & Recurrence Defense
- When fixing a reported vulnerability or refactoring a vulnerable component,
check the bug's
lineage_idviapython3 "$MANTIS_HOME/reference/scripts/advise.py" --file <target_file>. - Ensure the new implementation completely closes all attack vectors demonstrated in prior re-attack verification test suites.
Protocol 4: Architectural Vulnerability Remediation & Sandbox Verification
When resolving a confirmed security flaw (in pipeline or standalone):
-
Grounding Context:
- Query
python3 "$MANTIS_HOME/reference/scripts/advise.py" --remediate <finding_id>(orget_security_guidance(filepath=...)). - Extract active OKF Threat Boundaries and Security Invariants.
- Inspect prior verified safe patterns from matching lineage history.
- Query
-
Architectural Synthesis:
- Do NOT produce superficial point-hacks (e.g.
return None, hardcodedFalse, or commenting out endpoints) that lobotomize functionality. - Refactor root-cause sinks using safe idioms (parameterization, strict bounds, array argv, canonicalized paths).
- Do NOT produce superficial point-hacks (e.g.
-
Sandbox Verification (INV-1 & INV-2):
- Apply the unified diff patch to the guest workspace (
apply_patch). - Run the finding reproducer (
run_sandbox_with_evidence). - Verify that the attack fails to reach the sink
(
reattack_status == "failed_to_bypass"). - Verify that existing functional test suites pass without regression.
- Apply the unified diff patch to the guest workspace (
Output Format
The Advisor outputs clean, actionable recommendations:
# Security Advisory: <target_file>
### 1. Threat Model & Trust Boundaries
- **Entry Points**: <untrusted network / RPC / CLI>
- **Sensitive Assets**: <credentials, filesystem, tenant data>
### 2. Known Pitfalls & Historical Lineages
- **[CWE-XX] <Title>** (Lineage: `<uuid>`): <How it occurred and how it was resolved>
- **Verified Safe Pattern**:
```python
# Safe implementation idiom
3. False Positive Context (Intentional Behavior)
- <Pattern>: <Why this pattern is considered safe in this specific architecture>
4. Implementation Checklist
- Validated against path traversal / injection / deserialization.
- Adheres to verified patch patterns.
- Respects trust boundary isolation.
FAQ
What does the mantis-advise skill do?
Proactive security advisor and architectural remediation assistant for secure code development. Use to query threat models, historical vulnerability lineages, verified patch patterns, triaged false positives, and learned trajectory invariants before code edits or to generate architectural remediation plans for confirmed findings. Don't use for automated multi-pass red-team exploitation or fuzzing.
How do I install mantis-advise?
Run npx skills add https://github.com/google/mantis --skill mantis-advise in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/mantis-advise/ (personal) or .claude/skills/mantis-advise/ (project).
Which AI agents can use mantis-advise?
Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.
Is mantis-advise safe to install?
No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.
Who maintains mantis-advise?
It is published by google in google/mantis. It has 1,018 recorded installs.
More from google/mantis
mantis-threat-model
google/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.
mantis-review
google/mantis
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.
mantis-architecture
google/mantis
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.
mantis-summarize
google/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-plan
google/mantis
Formulates a targeted defensive security reviewing plan based on the active threat model and historical learnings. Use when starting a security review campaign to map the codebase boundaries and generate a roadmap (workspace/plan.json). Don't use for executing code reviews, writing test scripts, or patching code.
mantis-critic
google/mantis
Assesses the production viability of findings, filtering out debug-only features and assertion traps. Use when findings have been validated and you need to confirm they are triggerable in production release builds (with assertions disabled). Don't use for writing reproduction scripts or patches.
Popular security skills
azure-compliance
microsoft/azure-skills
Run Azure compliance and security audits with azqr plus Key Vault expiration checks. Covers best-practice assessment, resource review, policy/compliance validation, and security posture checks. WHEN: compliance scan, security audit, BEFORE running azqr (compliance cli tool), Azure best practices, Key Vault expiration check, expired certificates, expiring secrets, orphaned resources, compliance assessment.
minimal-run-and-audit
lllllllama/rigorpilot-skills
Rigor Run skill for README-first deep learning repo reproduction. Use when the task is specifically to capture or normalize evidence from the selected smoke test or documented inference or evaluation command and write standardized reprooutputs/ files, including patch notes when repository files changed. Do not use for training execution, initial repo intake, generic environment setup, paper lookup, target selection, hidden scientific-meaning changes, or end-to-end orchestration by itself.
seo-audit
coreyhaines31/marketingskills
When the user wants to audit, review, or diagnose SEO issues on their site. Also use when the user mentions "SEO audit," "technical SEO," "why am I not ranking," "SEO issues," "on-page SEO," "meta tags review," "SEO health check," "my traffic dropped," "lost rankings," "not showing up in Google," "site isn't ranking," "Google update hit me," "page speed," "core web vitals," "crawl errors," "indexing issues," "stuck on page 2," "striking distance keywords," "title tag rewrite," "low CTR," "local SEO," "Google Business Profile," or "map pack." Use this even if the user just says something vague like "my SEO is bad" or "help with SEO" — start with an audit. For building pages at scale to target keywords, see programmatic-seo. For adding structured data, see schema. For AI search optimization, see ai-seo.
firebase-security-rules-auditor
firebase/agent-skills
Audits Firebase (Firestore, Cloud Storage) security rules for vulnerabilities, privilege escalation, role bypasses, create vs update inconsistencies, resource exhaustion, type safety, size limits, and hasOnly ownership checks. Use when auditing/reviewing rules, running red-team rule assessments, or scoring against auditor checklists. Don't use for Firebase CLI (login, deploy), Auth, Crashlytics, Remote Config, or database queries.
audit
pbakaus/impeccable
Run technical quality checks across accessibility, performance, theming, responsive design, and anti-patterns. Generates a scored report with P0-P3 severity ratings and actionable plan. Use when the user wants an accessibility check, performance audit, or technical quality review.
competitors
coreyhaines31/marketingskills
When the user wants to create competitor comparison or alternative pages for SEO and buyer-facing use. Also use when the user mentions 'alternative page,' 'vs page,' 'competitor comparison,' 'comparison page,' '[Product] vs [Product],' '[Product] alternative,' 'competitive landing pages,' 'how do we compare to X,' 'competitor teardown,' 'audit our competitor pages,' 'are our comparison pages out of date,' or 'competitive asset audit.' Use this for any content that positions your product against competitors. Covers four formats: singular alternative, plural alternatives, you vs competitor, and competitor vs competitor. For auditing existing claims (not researching competitors from scratch, which is competitor-profiling; not technical SEO on these pages, which is seo-audit), use the asset audit here. For internal battle cards and sales-specific competitor docs, see sales-enablement.