---
title: Agent workflow
description: How a coding agent should use the optional secure-mcp server for defensive, remediation-focused secure code review, as a human summary of the master skill.
sidebar:
  label: Agent workflow
  order: 9
---

How a coding agent should use the optional `secure-mcp` server for **defensive,
remediation-focused** secure code review.

## Mandate

**Defensive security audit only, remediation focused.** Help the team
**identify potential weaknesses**, **classify** them (CWE / severity /
confidence), and **recommend concrete remediation** and verification. No exploit
generation, no bypass guidance, no using discovered secrets.

## The orchestration lives in one place

The review workflow (scope and evidence, SQLite and local-storage checks,
other local trust boundaries, optional tool use, and confirmation/handoff) is
the master skill at `.agents/skills/secure-mcp/SKILL.md`. That file is the
single source of truth; this page is a human-readable summary, not a second
playbook. The skill targets local-first iOS, macOS, and Expo/React Native apps;
the tools are optional assistance. On every call, the live MCP tool inventory
and input schemas win over any committed doc.

## Sequence at a glance

```text
Phase 0  list_authorized_roots / list_projects
                                     → choose an allowlisted absolute project_root
Phase 1  list_project_structure      → inventory artifact (no packs yet)
Phase 2  analyze_architecture        → stacks + typed surfaces/gaps + recommended_packs + pack_batches
         get_knowledge_pack          → pack_batches[0] first (summary); later batches only if needed
         build_remediation_threat_model → evidence-backed assets/boundaries + controls (optional)
Phase 3  check_authentication
         analyze_injection_risks
         review_secrets              → category candidate artifacts
         run_local_scanners          → optional, default off
Phase 4  Manual data-flow            → confirm candidates against source, control, and sink
Phase 5  produce_findings            → prioritized remediation report
```

**Progressive load rule:** do not load knowledge packs until after architecture.
Prefer `pack_batches` (max 6 pack ids per call), start with `pack_batches[0]`
and `detail=summary` (fair sampling across packs). Use `full` or a higher
`max_items` (hard max 60) only when drafting remediations.

## Working defensively

- **Candidates are not findings.** Open each cited file and trace source →
  control → sink before confirming. Separate confirmed findings, unresolved
  questions, and dismissed candidates. Tools still accept an optional
  `disposition_baseline` for callers that track dispositions across runs.
- **Coverage is honest.** An empty `findings` array means no candidate was
  observed in the reviewed files only when `coverage.not_observed_means` is
  `no_candidate_in_files_reviewed`. Partial or truncated coverage must be
  reported and followed up, and zero-hit high-value surfaces sampled.
- **Stack-honest.** A pure Expo/RN app never loads Next packs or surfaces, and
  a pure Next app never loads Expo/Swift packs or surfaces. Monorepos get the
  union of detected packages, reviewed per deployable `project_root`.
- **Secret-safe.** Tool output is redacted and marked untrusted; never re-paste
  raw secrets, and recommend rotation for anything that may be live.
- **No false certainty.** Never claim "the app is secure"; state the review
  boundary and remaining uncertainty, and end with actionable remediation.

Tools stay independently useful when the user asks about one category, for
example secrets only. Stay defensive and remediation-oriented in that case too.

## Scoped diff reviews

`focus_paths` scopes inventory, architecture, and category tools. Resolve
changed paths with host-agent git (`git diff --name-only`), filter build
artifacts and lockfiles, map the rest to relative prefixes under
`project_root`, and re-run architecture so surfaces, `authz_graph`, and gaps
match the PR surface. Respect `max_files` and coverage truncation. Do not
claim full-repo coverage from a focused pass.

Treat `coverage.not_observed_means` as authoritative:
`no_candidate_in_files_reviewed` is not a clean-repo certificate;
`scope_was_truncated_or_partial` needs a follow-up;
`inventory_only_contents_not_reviewed` means path metadata only.

Copy-paste: `examples/agents-md-snippet.md`. Any CI or pull-request
orchestration should live in the consumer repository and be reviewed as
trusted host code; secure-mcp does not ship a consumer GitHub Action.
