Terminal
Terminal/Skill
Advises developers and coding agents on security before code edits, drawing on threat models, past vulnerabilities, and verified patches.
By Google
Works with
npx skills add google/mantis --skill mantis-adviseProactive 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.
/mantis-advisepython3 "${MANTIS_HOME:-/path/to/mantis}/reference/scripts/advise.py" --file <target_file> [--db knowledge.db]
--file / -f (or --target / -t): Target source file or component path
(e.g. src/auth.py or api/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-discovers
knowledge.db or workspace/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.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:
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.py
Prints: 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>
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")
knowledge.db (findings, campaign_artifacts, learnings, and
risk_scores tables).Before authoring code or refactoring an existing module:
python3 "$MANTIS_HOME/reference/scripts/advise.py" --file <target_file>.lineage_id
chains.VERIFIED_SECURE.When introducing new endpoints, parameters, data parsing, or subprocess execution:
Input Normalization & Validation:
os.path.abspath or Path.resolve() checks (startswith(jail_dir)).shlex.quote or array-based
subprocess.run(["cmd", arg]) without shell=True.Defense-in-Depth:
lineage_id via
python3 "$MANTIS_HOME/reference/scripts/advise.py" --file <target_file>.When resolving a confirmed security flaw (in pipeline or standalone):
Grounding Context:
python3 "$MANTIS_HOME/reference/scripts/advise.py" --remediate <finding_id>
(or get_security_guidance(filepath=...)).Architectural Synthesis:
return None, hardcoded
False, or commenting out endpoints) that lobotomize functionality.Sandbox Verification (INV-1 & INV-2):
apply_patch).run_sandbox_with_evidence).reattack_status == "failed_to_bypass").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