---
title: "detect"
description: "Find patterns or occurrences in data"
canonical: "https://acs.synapti.ai/capabilities/detect/"
last_updated: "2026-11-16T01:14:10Z"
---

# detect

Find patterns or occurrences in data

Generated from [schemas/capability_ontology.yaml](https://github.com/synaptiai/agent-capability-standard/blob/main/schemas/capability_ontology.yaml), [skills/detect/SKILL.md](https://github.com/synaptiai/agent-capability-standard/blob/main/skills/detect/SKILL.md) at commit 18c38b74ac21. Ontology version 2.2.0.

Layer: [UNDERSTAND](https://acs.synapti.ai/layers/understand/index.md)

## Safety

| Property | Value |
| --- | --- |
| Risk | Low |
| Changes state | No |
| Needs checkpoint | No |
| Needs approval | No |
| Overridable | No |
| Blocked from autonomy | No |

**Figure: Ordering rules for detect in a workflow.** In a workflow, observe, where the workflow has it, must come first (V102); it is a recommended step before ground; and where the workflow has classify and attribute, detect must come before them (V102).

| Where | Capability | Rule | Enforcement | Diagnostic |
| --- | --- | --- | --- | --- |
| Before detect | [`observe`](https://acs.synapti.ai/capabilities/observe/index.md) | `precedes` | MUST | V102 |
| After detect | [`classify`](https://acs.synapti.ai/capabilities/classify/index.md) | `precedes` | MUST | V102 |
| After detect | [`attribute`](https://acs.synapti.ai/capabilities/attribute/index.md) | `precedes` | MUST | V102 |
| After detect | [`ground`](https://acs.synapti.ai/capabilities/ground/index.md) | `soft_requires` | SHOULD | W601 |

## Relationships

**Figure: Relationships of detect: 11 relationships with 7 capabilities.** detect has 11 relationships with 7 capabilities: 2 with edges into it, 2 with edges out of it, 2 with edges both into it and out of it, and 1 joined to it only by edges that run both ways.

| Capability | Row | Relationships |
| --- | --- | --- |
| [`retrieve`](https://acs.synapti.ai/capabilities/retrieve/index.md) | Edges into detect | `enables` (into) |
| [`search`](https://acs.synapti.ai/capabilities/search/index.md) | Edges into detect | `enables` (into) |
| [`observe`](https://acs.synapti.ai/capabilities/observe/index.md) | Both directions | `precedes` (into), `specializes` (out of) |
| [`classify`](https://acs.synapti.ai/capabilities/classify/index.md) | Both directions | `enables` (out of), `precedes` (out of), `specializes` (into) |
| [`discover`](https://acs.synapti.ai/capabilities/discover/index.md) | Either way | `alternative_to` (both ways) |
| [`attribute`](https://acs.synapti.ai/capabilities/attribute/index.md) | Edges out of detect | `enables` (out of), `precedes` (out of) |
| [`ground`](https://acs.synapti.ai/capabilities/ground/index.md) | Edges out of detect | `soft_requires` (out of) |

- `soft_requires`: Recommended before [`ground`](https://acs.synapti.ai/capabilities/ground/index.md)
- `enables`: Unlocks [`classify`](https://acs.synapti.ai/capabilities/classify/index.md), [`attribute`](https://acs.synapti.ai/capabilities/attribute/index.md)
- `enables`: Unlocked by [`retrieve`](https://acs.synapti.ai/capabilities/retrieve/index.md), [`search`](https://acs.synapti.ai/capabilities/search/index.md)
- `precedes`: Comes before, when both are present [`classify`](https://acs.synapti.ai/capabilities/classify/index.md), [`attribute`](https://acs.synapti.ai/capabilities/attribute/index.md)
- `precedes`: Comes after, when both are present [`observe`](https://acs.synapti.ai/capabilities/observe/index.md)
- `alternative_to`: Can substitute for [`discover`](https://acs.synapti.ai/capabilities/discover/index.md)
- `specializes`: Specializes [`observe`](https://acs.synapti.ai/capabilities/observe/index.md)
- `specializes`: Specialized by [`classify`](https://acs.synapti.ai/capabilities/classify/index.md)

## Contract

**Figure: Contract of detect: 3 inputs (2 required), 7 outputs.** detect takes 3 inputs, 2 required (filled pin) and 1 optional (hollow pin), and returns 7 outputs. The tables below list every field.

### Inputs

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `data` | any | Yes | Data to analyze |
| `pattern` | string\|object | Yes | Pattern to find |
| `threshold` | number | No | Detection threshold |

### Outputs

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `detected` | boolean | Yes |  |
| `matches` | array | No | Found occurrences |
| `locations` | array | No | Where patterns found |
| `evidence_anchors` | array of Anchor (or deprecated string or object) | Yes | What the output is based on, as evidence anchors (Standard v1.2 §6.5). An empty list grounds nothing, and the output is then marked inferred (§3.1). |
| `confidence` | number | Yes | The producer's probability that the output's claim is correct, self-reported unless the host documents a calibration (Standard v1.2 §4.1.1) From 0 to 1 |
| `inference_method` | string | No | How the output was reached when it is not grounded in evidence; with confidence it marks the output inferred (Standard v1.2 §3.1, §4.1.1). A producer should use model_knowledge, deduction, induction, abduction, analogy, statistical, simulation, assumption or an x- vendor value; a grounding policy (§5.20) requires one of them. |
| `uncertainty` | Uncertainty | No | The uncertainty of the output's principal value; its confidence equals the output's confidence (Standard v1.2 §4.1.1) |

The skill returns 9 fields: 5 are in detect's output contract (3 required) and 4 are the skill's own, outside the contract; it leaves out 2 contract fields (inference_method, uncertainty).

| Field of the skill's output | In the output contract |
| --- | --- |
| `detected` | Yes, required |
| `target_type` | No, the skill's own |
| `matches` | Yes, optional |
| `locations` | Yes, optional |
| `false_positive_risk` | No, the skill's own |
| `confidence` | Yes, required |
| `evidence_anchors` | Yes, required |
| `assumptions` | No, the skill's own |
| `next_actions` | No, the skill's own |
| `inference_method` | Yes, but the skill leaves it out |
| `uncertainty` | Yes, but the skill leaves it out |

## Used in workflows

**Figure: detect in workflows.** 18 workflows use detect, in 21 steps in all; its steps are the squares in an ink ring, and the key under the strips names the other squares.

- [`monitor_and_replan`](https://acs.synapti.ai/workflows/monitor-and-replan/index.md): step 4
- [`world_model_build`](https://acs.synapti.ai/workflows/world-model-build/index.md): step 3
- [`digital_twin_sync_loop`](https://acs.synapti.ai/workflows/digital-twin-sync-loop/index.md): steps 5 and 10
- [`rag_pipeline`](https://acs.synapti.ai/workflows/rag-pipeline/index.md): step 3
- [`security_assessment`](https://acs.synapti.ai/workflows/security-assessment/index.md): step 2
- [`data_quality_pipeline`](https://acs.synapti.ai/workflows/data-quality-pipeline/index.md): step 2
- [`data_pipeline_validation`](https://acs.synapti.ai/workflows/data-pipeline-validation/index.md): step 7
- [`report_generation`](https://acs.synapti.ai/workflows/report-generation/index.md): step 5
- [`model_monitoring`](https://acs.synapti.ai/workflows/model-monitoring/index.md): steps 7 and 8
- [`patient_monitoring`](https://acs.synapti.ai/workflows/patient-monitoring/index.md): step 6
- [`clinical_alert_triage`](https://acs.synapti.ai/workflows/clinical-alert-triage/index.md): step 5
- [`care_plan_review`](https://acs.synapti.ai/workflows/care-plan-review/index.md): steps 6 and 8
- [`handoff_preparation`](https://acs.synapti.ai/workflows/handoff-preparation/index.md): step 8
- [`production_line_monitoring`](https://acs.synapti.ai/workflows/production-line-monitoring/index.md): step 4
- [`predictive_maintenance`](https://acs.synapti.ai/workflows/predictive-maintenance/index.md): step 3
- [`supply_chain_sync`](https://acs.synapti.ai/workflows/supply-chain-sync/index.md): step 6
- [`schedule_management`](https://acs.synapti.ai/workflows/schedule-management/index.md): step 4
- [`information_research`](https://acs.synapti.ai/workflows/information-research/index.md): step 5

## Claude Code skill

**Figure: What the detect skill's tools can do, against the ontology.** The skill may use 2 tools: 2 only read; the ontology marks detect as read-only, and every tool only reads.

| What they can do | Tools |
| --- | --- |
| Only read | `Read`, `Grep` |
| Run commands, which can change state | none |
| Change files | none |

**Figure: The field names each step of the detect procedure uses.** 4 of the procedure's 6 steps use the name of an input or output field of the detect skill as a word; 6 output fields of 9 are used by no step (detected, target_type, locations, confidence, assumptions, next_actions).

| Step | Inputs it uses by name | Output fields it uses by name |
| --- | --- | --- |
| 1. Define detection criteria | `threshold` |  |
| 2. Scan target systematically | `data`, `pattern` |  |
| 3. Evaluate signal strength |  |  |
| 4. Assess false positive risk | `data` | `matches`, `false_positive_risk` |
| 5. Ground claims |  | `evidence_anchors` |
| 6. Format output |  |  |

Both examples of the skill write out every one of its 9 output fields.

**Figure: The field names each verification check of the detect skill uses.** 4 of the 5 checks use the name of an input or output field as a word; 5 output fields of 9 are named by no check (target_type, confidence, evidence_anchors, assumptions and next_actions).

| Check | Inputs it uses by name | Output fields it uses by name |
| --- | --- | --- |
| 1. Output contains detected boolean matching signal presence |  | `detected` |
| 2. At least one evidence anchor exists for positive detections |  |  |
| 3. Confidence score correlates with number and strength of matches |  | `matches` |
| 4. All referenced file:line locations are valid and accessible |  | `locations` |
| 5. False positive risk assessment is justified |  | `false_positive_risk` |

**Figure: The neighbours the skill lists for detect, checked against the ontology and the catalogs.** The skill lists 5 capabilities as common neighbours of detect; 3 of them have an edge with it in the ontology, and 4 run next to it, in that order, in a catalog workflow (classify most often, 6 times). Under each tile, an edge reads from its source to its target, with detect's symbol in its place: "requires Dt" is a requires edge from the tile's capability to detect, so the tile's capability must run before detect; "Dt precedes" is a precedes edge from detect to the tile's capability.

| Listed as | Capability | Ontology edge | Next to it in a workflow |
| --- | --- | --- | --- |
| commonly follows | [`observe`](https://acs.synapti.ai/capabilities/observe/index.md) | `precedes`, `specializes` (into it) | 3 times |
| commonly follows | [`search`](https://acs.synapti.ai/capabilities/search/index.md) | `enables` | 1 times |
| commonly precedes | [`classify`](https://acs.synapti.ai/capabilities/classify/index.md) | `enables` (into it), `precedes` (into it), `specializes` | 6 times |
| commonly precedes | [`measure`](https://acs.synapti.ai/capabilities/measure/index.md) | none | 3 times |
| commonly precedes | [`plan`](https://acs.synapti.ai/capabilities/plan/index.md) | none | never |

### Intent

Scan data sources to determine whether a specified pattern, entity, or condition is present. Detection is binary (present/absent) with associated signal strength.

**Success criteria:**
- Clear boolean determination of presence/absence
- At least one evidence anchor for positive detections
- False positive risk assessment provided
- Confidence score justified by evidence quality

**Compatible schemas:**
- `schemas/output_schema.yaml`

### Inputs

| Parameter | Required | Type | Description |
|-----------|----------|------|-------------|
| `data` | Yes | any | Data to analyze |
| `pattern` | Yes | string\|object | The pattern, entity type, or condition to detect |
| `threshold` | No | number | Detection threshold (e.g. minimum confidence for a match) |

Inputs not listed here are outside the capability's contract: a workflow step that binds them gets W604 (STANDARD v1.1 §5.5).

### Procedure

1) **Define detection criteria**: Clarify exactly what constitutes a positive detection
   - Convert vague patterns to concrete search terms or regex
   - Establish minimum evidence threshold for positive detection

2) **Scan target systematically**: Search the target data for matching signals
   - Use Grep for text patterns with appropriate flags (-i for case-insensitive, etc.)
   - Use Read for structural inspection when pattern requires context
   - Record location (file:line) for each potential match

3) **Evaluate signal strength**: For each match, assess how strongly it indicates true presence
   - Strong: exact match with clear context
   - Medium: partial match or ambiguous context
   - Weak: possible match requiring human verification

4) **Assess false positive risk**: Determine likelihood that detections are spurious
   - High risk: generic patterns, noisy data, few matches
   - Low risk: specific patterns, clean data, multiple corroborating signals

5) **Ground claims**: Attach evidence anchors to all detection signals
   - Format: `file:line` for file-based targets
   - Include snippet of matched content for verification

6) **Format output**: Structure results according to the output contract below

### Output Contract

Return a structured object:

```yaml
detected: boolean  # True if pattern/entity was found
target_type: string  # What was being detected (e.g., "security vulnerability", "deprecated API")
matches:
  - signal: string  # Description of what was found
    strength: low | medium | high  # Signal strength
    location: string  # file:line or path where found
locations: array[string]  # Every location where the pattern was found
false_positive_risk: low | medium | high  # Likelihood of spurious detection
confidence: number  # probability that the reported detections are correct (§4.1.1)
evidence_anchors: array[EvidenceAnchor]  # File:line references; each {ref, kind} (STANDARD v1.2 §6.5)
assumptions: array[string]  # Explicit assumptions made
next_actions: array[string]  # 0-3 suggested follow-ups if uncertain
```

#### Field Definitions

| Field | Type | Description |
|-------|------|-------------|
| `detected` | boolean | True if the target pattern/entity was found |
| `target_type` | string | Category of what was searched for |
| `matches` | array\<object\> | Found occurrences: each detection signal with strength and location (empty when nothing found) |
| `locations` | array[string] | Every location where the pattern was found |
| `false_positive_risk` | enum | Assessment of detection reliability |
| `confidence` | number | Probability, 0.0-1.0, that the reported detections are correct (§4.1.1) |
| `evidence_anchors` | array of evidence anchors (§6.5) | File:line references or tool outputs |
| `assumptions` | array[string] | Explicitly stated assumptions |

### Examples

#### Example 1: Detect SQL Injection Vulnerability

**Input:**
```yaml
data: src/api/user_controller.py
pattern: "SQL injection pattern"
threshold: 0.5  # report matches with at least this confidence
```

**Output:**
```yaml
detected: true
target_type: "SQL injection vulnerability"
matches:
  - signal: "String concatenation in SQL query with user input"
    strength: high
    location: "src/api/user_controller.py:47"
  - signal: "Raw SQL execution without parameterization"
    strength: medium
    location: "src/api/user_controller.py:52"
locations:
  - "src/api/user_controller.py:47"
  - "src/api/user_controller.py:52"
false_positive_risk: low
confidence: 0.85
evidence_anchors:
  - {ref: "file:src/api/user_controller.py:47", kind: file}
  - {ref: "file:src/api/user_controller.py:52", kind: file}
assumptions:
  - "User input flows from request.params to query variable"
  - "No input sanitization in calling function"
next_actions:
  - "Verify data flow from user input to SQL query"
  - "Check for parameterized query alternatives in codebase"
```

**Evidence pattern:** Grep for SQL keywords combined with string formatting patterns, then Read to verify context.

---

#### Example 2: Detect Deprecated API Usage

**Input:**
```yaml
data: "src/**/*.{jsx,tsx}"
pattern: "componentWillMount|componentWillReceiveProps"
```

**Output:**
```yaml
detected: true
target_type: "deprecated React lifecycle method"
matches:
  - signal: "componentWillMount usage"
    strength: high
    location: "src/components/Dashboard.jsx:23"
locations:
  - "src/components/Dashboard.jsx:23"
false_positive_risk: low
confidence: 0.95
evidence_anchors:
  - {ref: "file:src/components/Dashboard.jsx:23", kind: file}
assumptions:
  - "Project uses React 16.3+ where these methods are deprecated"
next_actions:
  - "Migrate to componentDidMount or useEffect hook"
```

### Verification

- [ ] Output contains `detected` boolean matching signal presence
- [ ] At least one evidence anchor exists for positive detections
- [ ] Confidence score correlates with number and strength of matches
- [ ] All referenced file:line locations are valid and accessible
- [ ] False positive risk assessment is justified

**Verification tools:** Read (to verify file:line references exist)

### Safety Constraints

- `mutation`: false
- `requires_checkpoint`: false
- `requires_approval`: false
- `risk`: low

**Capability-specific rules:**
- Do not access paths outside the specified target scope
- Do not modify any files during detection
- Stop and request clarification if detection criteria are ambiguous
- Report uncertainty rather than guessing when signals are weak

### Composition Patterns

**Commonly follows:**
- `observe` - Detection often follows initial observation of a system
- `search` - Detection may refine broad search results

**Commonly precedes:**
- `classify` - Positive detection often leads to classification of what was found
- `measure` - Detection of anomalies feeds into risk measurement
- `plan` - Detected issues may trigger remediation planning

**Anti-patterns:**
- Never use detect for complex entity classification (use `classify` instead)
- Avoid detect for quantitative assessment (use `measure` instead)

**Workflow references:**
- See `reference/composition_patterns.md#risk-assessment` for detection in risk workflows
- See `reference/composition_patterns.md#observe-model-act` for detection in agentic loops
