---
title: "search"
description: "Query for data matching criteria"
canonical: "https://acs.synapti.ai/capabilities/search/"
last_updated: "2026-11-16T01:14:10Z"
---

# search

Query for data matching criteria

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

Layer: [PERCEIVE](https://acs.synapti.ai/layers/perceive/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 search in a workflow.** In a workflow, it is a recommended step before ground; and where the workflow has compare, search must come before it (V102).

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

## Relationships

**Figure: Relationships of search: 5 relationships with 5 capabilities.** search has 5 relationships with 5 capabilities: 4 with edges 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) | Either way | `alternative_to` (both ways) |
| [`detect`](https://acs.synapti.ai/capabilities/detect/index.md) | Edges out of search | `enables` (out of) |
| [`compare`](https://acs.synapti.ai/capabilities/compare/index.md) | Edges out of search | `precedes` (out of) |
| [`discover`](https://acs.synapti.ai/capabilities/discover/index.md) | Edges out of search | `enables` (out of) |
| [`ground`](https://acs.synapti.ai/capabilities/ground/index.md) | Edges out of search | `soft_requires` (out of) |

- `soft_requires`: Recommended before [`ground`](https://acs.synapti.ai/capabilities/ground/index.md)
- `enables`: Unlocks [`detect`](https://acs.synapti.ai/capabilities/detect/index.md), [`discover`](https://acs.synapti.ai/capabilities/discover/index.md)
- `precedes`: Comes before, when both are present [`compare`](https://acs.synapti.ai/capabilities/compare/index.md)
- `alternative_to`: Can substitute for [`retrieve`](https://acs.synapti.ai/capabilities/retrieve/index.md)

## Contract

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

### Inputs

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `query` | string\|object | Yes | Search criteria |
| `scope` | string | No | Search scope/domain |
| `limit` | integer | No | Maximum results |

### Outputs

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `results` | array | Yes | Matching items |
| `total_count` | integer | No |  |
| `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: 4 are in search's output contract (3 required) and 5 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 |
| --- | --- |
| `results` | Yes, required |
| `total_count` | Yes, optional |
| `query_details` | No, the skill's own |
| `coverage` | No, the skill's own |
| `search_strategy` | No, the skill's own |
| `confidence` | Yes, required |
| `evidence_anchors` | Yes, required |
| `assumptions` | No, the skill's own |
| `next_searches` | 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: search in workflows.** 14 workflows use search, in 16 steps in all; its steps are the squares in an ink ring, and the key under the strips names the other squares.

- [`debug_code_change`](https://acs.synapti.ai/workflows/debug-code-change/index.md): step 2
- [`digital_twin_sync_loop`](https://acs.synapti.ai/workflows/digital-twin-sync-loop/index.md): step 2
- [`rag_pipeline`](https://acs.synapti.ai/workflows/rag-pipeline/index.md): step 1
- [`security_assessment`](https://acs.synapti.ai/workflows/security-assessment/index.md): step 1
- [`anomaly_investigation`](https://acs.synapti.ai/workflows/anomaly-investigation/index.md): step 5
- [`report_generation`](https://acs.synapti.ai/workflows/report-generation/index.md): step 2
- [`clinical_alert_triage`](https://acs.synapti.ai/workflows/clinical-alert-triage/index.md): step 3
- [`care_plan_review`](https://acs.synapti.ai/workflows/care-plan-review/index.md): step 2
- [`handoff_preparation`](https://acs.synapti.ai/workflows/handoff-preparation/index.md): steps 3 and 6
- [`supply_chain_sync`](https://acs.synapti.ai/workflows/supply-chain-sync/index.md): step 1
- [`schedule_management`](https://acs.synapti.ai/workflows/schedule-management/index.md): step 5
- [`information_research`](https://acs.synapti.ai/workflows/information-research/index.md): steps 2 and 3
- [`task_delegation`](https://acs.synapti.ai/workflows/task-delegation/index.md): step 3
- [`communication_drafting`](https://acs.synapti.ai/workflows/communication-drafting/index.md): step 3

## Claude Code skill

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

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

**Figure: The field names each step of the search procedure uses.** 7 of the procedure's 8 steps use the name of an input or output field of the search skill as a word; 6 output fields of 9 are used by no step (total_count, query_details, confidence, evidence_anchors, assumptions, next_searches).

| Step | Inputs it uses by name | Output fields it uses by name |
| --- | --- | --- |
| 1. Parse query | `query` |  |
| 2. Select search strategy | `query`, `scope` | `search_strategy` |
| 3. Construct search queries |  |  |
| 4. Execute searches | `query` | `results`, `coverage` |
| 5. Collect and deduplicate results |  | `results` |
| 6. Rank results | `query` | `results` |
| 7. Extract key information | `query` | `results` |
| 8. Assess coverage |  | `coverage` |

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

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

| Check | Inputs it uses by name | Output fields it uses by name |
| --- | --- | --- |
| 1. All returned results have valid evidence anchors |  | `results`, `evidence_anchors` |
| 2. Relevance scores are between 0.0 and 1.0 |  |  |
| 3. Coverage assessment identifies blind spots |  |  |
| 4. Search strategy is documented |  | `search_strategy` |
| 5. Suggested next searches address coverage gaps |  | `coverage`, `next_searches` |

**Figure: The neighbours the skill lists for search, checked against the ontology and the catalogs.** The skill lists 5 capabilities as common neighbours of search; 2 of them have an edge with it in the ontology, and 3 run next to it, in that order, in a catalog workflow (retrieve most often, 6 times). Under each tile, an edge reads from its source to its target, with search's symbol in its place: "requires Sr" is a requires edge from the tile's capability to search, so the tile's capability must run before search; "Sr precedes" is a precedes edge from search 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) | none | 1 times |
| commonly precedes | [`retrieve`](https://acs.synapti.ai/capabilities/retrieve/index.md) | `alternative_to` (into it), `alternative_to` | 6 times |
| commonly precedes | [`state`](https://acs.synapti.ai/capabilities/state/index.md) | none | never |
| commonly precedes | [`integrate`](https://acs.synapti.ai/capabilities/integrate/index.md) | none | 1 times |
| commonly precedes | [`ground`](https://acs.synapti.ai/capabilities/ground/index.md) | `soft_requires` (into it) | never |

### Live Context

Available search context:

- Current directory: !`pwd`
- File types available: !`find . -type f -not -path './.git/*' 2>/dev/null | sed 's/.*\.//' | sort | uniq -c | sort -rn | head -10`
- Total searchable files: !`find . -type f -not -path './.git/*' 2>/dev/null | wc -l | tr -d ' '`
- Common directories: !`find . -type d -maxdepth 2 -not -path './.git/*' 2>/dev/null | head -10`
- README files: !`find . -name 'README*' -not -path './.git/*' 2>/dev/null | head -5`

### Intent

Execute **search** to find relevant information when you don't know exactly where to look. Unlike `retrieve` (which fetches known items), search explores under uncertainty and ranks results by relevance.

**Success criteria:**
- Relevant results are found and ranked
- Search strategy is appropriate for the domain
- Coverage is sufficient for the use case
- Results include relevance scores and evidence
- False positives are minimized

**World Modeling Context:**
Search feeds the **MODEL** layer by discovering entities and observations to include in `state`. It also finds candidate matches for the identity resolution that `integrate` performs.

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

### Inputs

| Parameter | Required | Type | Description |
|-----------|----------|------|-------------|
| `query` | Yes | string\|object | What to search for (natural language or structured) |
| `scope` | No | string | Search scope/domain |
| `limit` | No | integer | Maximum results |

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) **Parse query**: Understand what the user is looking for
   - Extract key terms and concepts
   - Identify entity types being sought
   - Determine search intent (existence, discovery, comparison)
   - Expand with synonyms or related terms if appropriate

2) **Select search strategy**: Based on scope and query type
   - **Code/repo search**: Use Grep patterns, file globs
   - **Web search**: Use web search tools with keywords
   - **Documentation**: Search docs directories, README files
   - **Semantic**: Expand query with related concepts

3) **Construct search queries**: Formulate effective queries
   - For Grep: Build regex patterns that balance precision/recall
   - For web: Use keywords, exclude noise terms
   - Apply filters (file type, date range, domain)

4) **Execute searches**: Run queries across sources
   - Use multiple query variations if first returns poor results
   - Apply pagination for comprehensive coverage
   - Track which queries were tried

5) **Collect and deduplicate results**: Aggregate findings
   - Merge results from multiple sources
   - Remove duplicates (same content, different paths)
   - Note source and search method for each result

6) **Rank results**: Score by relevance and other criteria
   - **Term match**: How well result matches query
   - **Authority**: Source credibility, recency
   - **Context**: Relevance to broader task
   - **Uniqueness**: Information not found elsewhere

7) **Extract key information**: For top results
   - Relevant snippets that match query
   - Metadata (file, date, author)
   - Context around the match

8) **Assess coverage**: Evaluate search completeness
   - What portion of relevant sources were searched?
   - Any known blind spots?
   - Suggest additional searches if coverage is poor

### Output Contract

Return a structured object:

```yaml
results:
  - id: string  # Result identifier
    type: file | web | doc | record
    source: string  # Where found
    path: string | null  # File path or URL
    title: string | null
    snippet: string  # Relevant excerpt
    relevance_score: number  # 0.0-1.0
    metadata:
      date: string | null
      author: string | null
      size: number | null
    evidence_anchor: string  # Reference for grounding
total_count: integer  # Total matches before filtering
query_details:
  query: string  # Original query
  query_expansions: array[string]  # Variations tried
  sources_searched: array[string]  # Where we looked
  returned: integer  # Results in this response
coverage:
  sources_available: array[string]
  sources_searched: array[string]
  coverage_ratio: number  # 0.0-1.0
  blind_spots: array[string]  # Known gaps
search_strategy:
  method: string  # How search was conducted
  queries_executed: array[string]  # Actual queries run
  filters_applied: object
confidence: number  # probability that the results answer the query (§4.1.1)
evidence_anchors: array[EvidenceAnchor]  # each {ref, kind, digest?} (STANDARD v1.2 §6.5)
assumptions: array[string]
next_searches: array[string]  # Suggested follow-up searches
```

#### Field Definitions

| Field | Type | Description |
|-------|------|-------------|
| `results` | array | Ranked search results (empty when nothing matched) |
| `results[].relevance_score` | number | How well result matches query |
| `total_count` | integer | Total matches before filtering (`results` may hold fewer) |
| `query_details` | object | Query, expansions tried, sources searched, and number returned |
| `coverage` | object | Assessment of search completeness |
| `blind_spots` | array | Known areas not searched |
| `next_searches` | array | Suggested follow-up queries |
| `confidence` | number | Probability, 0.0-1.0, that the results answer the query (§4.1.1) |
| `evidence_anchors` | array of evidence anchors (§6.5) | References to where each result was found |
| `assumptions` | array | Explicit assumptions |

### Examples

#### Example 1: Code Search for Authentication Logic

**Input:**
```yaml
query: "JWT token validation"
scope: "repo: *.ts and *.js files, excluding node_modules/ and test/"
```

**Output:**
```yaml
results:
  - id: "r1"
    type: file
    source: "repo"
    path: "src/middleware/auth.ts"
    title: null
    snippet: |
      export function validateToken(token: string): JWTPayload {
        return jwt.verify(token, process.env.JWT_SECRET) as JWTPayload;
      }
    relevance_score: 0.95
    metadata:
      date: "2025-01-20"
      author: null
      size: 2450
    evidence_anchor: "src/middleware/auth.ts:45-48"
  - id: "r2"
    type: file
    source: "repo"
    path: "src/services/user-service.ts"
    title: null
    snippet: |
      const decoded = validateToken(authHeader.split(' ')[1]);
    relevance_score: 0.75
    metadata:
      date: "2025-01-15"
      size: 5200
    evidence_anchor: "src/services/user-service.ts:23"
  - id: "r3"
    type: file
    source: "repo"
    path: "src/utils/jwt-helpers.ts"
    title: null
    snippet: |
      export const JWT_ALGORITHM = 'HS256';
      export const TOKEN_EXPIRY = '24h';
    relevance_score: 0.60
    metadata:
      date: "2024-12-01"
      size: 800
    evidence_anchor: "src/utils/jwt-helpers.ts:1-5"
total_count: 8
query_details:
  query: "JWT token validation"
  query_expansions:
    - "jwt.*valid"
    - "token.*verify"
    - "jsonwebtoken"
  sources_searched: ["repo:src/"]
  returned: 3
coverage:
  sources_available: ["repo", "docs"]
  sources_searched: ["repo:src/"]
  coverage_ratio: 0.85
  blind_spots:
    - "Config files not searched"
    - "Documentation not searched"
search_strategy:
  method: "grep_pattern_search"
  queries_executed:
    - "grep -r 'jwt.*valid' --include='*.ts' src/"
    - "grep -r 'token.*verify' --include='*.ts' src/"
  filters_applied:
    file_types: [".ts", ".js"]
    excluded: ["node_modules", "test"]
confidence: 0.9
evidence_anchors:
  - {ref: "file:src/middleware/auth.ts:45-48", kind: file}
  - {ref: "file:src/services/user-service.ts:23", kind: file}
  - {ref: "file:src/utils/jwt-helpers.ts:1-5", kind: file}
assumptions:
  - "All JWT logic is in TypeScript files"
  - "No JWT validation in excluded test files matters"
next_searches:
  - "Search config/ for JWT_SECRET references"
  - "Search docs/ for authentication documentation"
```

**Evidence pattern:** Used Grep with multiple patterns to find JWT-related code, ranked by directness of validation logic.

---

#### Example 2: Web Search for API Documentation

**Input:**
```yaml
query: "OpenAI API rate limits 2025"
scope: web
```

**Output:**
```yaml
results:
  - id: "w1"
    type: web
    source: "web"
    path: "https://platform.openai.com/docs/guides/rate-limits"
    title: "Rate limits - OpenAI API"
    snippet: "Rate limits are measured in tokens per minute (TPM) and requests per minute (RPM). Tier 1 users: 500 RPM, 100,000 TPM..."
    relevance_score: 0.95
    metadata:
      date: "2025-01-15"
      author: "OpenAI"
    evidence_anchor: "url:https://platform.openai.com/docs/guides/rate-limits"
  - id: "w2"
    type: web
    source: "web"
    path: "https://community.openai.com/t/rate-limit-changes-2025"
    title: "Rate Limit Changes in 2025"
    snippet: "As of January 2025, we've updated rate limit tiers..."
    relevance_score: 0.85
    metadata:
      date: "2025-01-10"
    evidence_anchor: "url:https://community.openai.com/t/rate-limit-changes-2025"
total_count: 15
query_details:
  query: "OpenAI API rate limits 2025"
  query_expansions:
    - "OpenAI rate limit tiers"
    - "GPT-4 API quota"
  sources_searched: ["web"]
  returned: 2
coverage:
  sources_available: ["web", "docs"]
  sources_searched: ["web"]
  coverage_ratio: 0.7
  blind_spots:
    - "Internal documentation not accessible"
search_strategy:
  method: "web_search"
  queries_executed:
    - "OpenAI API rate limits 2025"
    - "OpenAI rate limit tiers"
  filters_applied:
    recency: "2025"
confidence: 0.85
evidence_anchors:
  - {ref: "https://platform.openai.com/docs/guides/rate-limits", kind: url}
assumptions:
  - "Official documentation is current"
next_searches:
  - "Search OpenAI changelog for rate limit updates"
```

### Verification

- [ ] All returned results have valid evidence anchors
- [ ] Relevance scores are between 0.0 and 1.0
- [ ] Coverage assessment identifies blind spots
- [ ] Search strategy is documented
- [ ] Suggested next searches address coverage gaps

**Verification tools:** Link validators, file existence checks

### Safety Constraints

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

**Capability-specific rules:**
- Do not search paths marked as sensitive
- Rate-limit web searches appropriately
- Flag when search coverage is < 50%
- Distinguish authoritative from user-generated sources

### Composition Patterns

**Commonly follows:**
- None typically - search is often a starting point
- May follow `observe` when observation reveals knowledge gaps

**Commonly precedes:**
- `retrieve` - After finding, retrieve full content
- `state` - Search results inform state construction
- `integrate` - Find candidate entities to resolve and merge
- `ground` - Search for evidence to ground claims

**Anti-patterns:**
- Avoid searching when exact path is known (use `retrieve`)
- Never search without considering coverage limitations

**Workflow references:**
- See `reference/composition_patterns.md#world-model-build` for search in model construction
- See `reference/composition_patterns.md#debug-code-change` for search during debugging
