Intent
Explore data or systems to find patterns, relationships, or anomalies that were not explicitly requested or expected. Discovery is open-ended exploration that surfaces novel insights rather than confirming hypotheses.
Success criteria:
- At least one non-obvious finding surfaced
- Significance level assigned to each discovery
- Novelty classified (known, suspected, surprising)
- Methodology documented for reproducibility
Compatible schemas:
schemas/output_schema.yaml
Inputs
| Parameter |
Required |
Type |
Description |
search_space |
Yes |
string|object |
Where to look (files, data, systems, domains) |
discovery_type |
No |
string |
What kind of discovery: relationship, pattern, anomaly, gap, opportunity |
constraints |
No |
object |
Bounds on exploration (time, scope, depth) |
seed_observations |
No |
array |
Initial observations that may hint at discoveries |
Procedure
Define search space boundaries: Establish what is in and out of scope
- File patterns, directories, or data sources
- Conceptual boundaries (domain, time range)
- Depth limits (how many hops of relationships)
Apply discovery heuristics: Use exploration strategies systematically
- Pattern mining: Look for recurring structures, naming conventions, code patterns
- Relationship mapping: Find connections between entities (imports, calls, references)
- Anomaly detection: Identify outliers, inconsistencies, unusual structures
- Gap analysis: Find missing elements, broken links, incomplete patterns
Assess significance: Evaluate each finding's importance
- High: Directly actionable or explains important behavior
- Medium: Useful context or potential issue
- Low: Interesting but not actionable
Classify novelty: Determine how surprising each discovery is
- Known: Documented or widely understood
- Suspected: Hypothesized but not confirmed
- Surprising: Unexpected or counter to assumptions
Identify entities involved: Link discoveries to specific entities
- Files, functions, classes, modules
- People, teams, systems
- Concepts, patterns, architectures
Ground claims: Attach evidence anchors to all discoveries
- Exact locations where patterns occur
- References to related documentation
Synthesize findings: Connect individual discoveries into coherent insights
Output Contract
Return a structured object:
discoveries:
- type: string # relationship, pattern, anomaly, gap, opportunity
description: string # What was discovered
significance: low | medium | high
novelty: known | suspected | surprising
entities_involved: array[string]
location: string # Where found (file:line, path, or reference)
methodology: string # How discovery was conducted
search_space: string # What was explored
confidence: number # 0.0-1.0 confidence in discoveries
evidence_anchors: array[string] # References to supporting evidence
assumptions: array[string] # Conditions that affect findings
Field Definitions
| Field |
Type |
Description |
discoveries |
array |
List of findings with metadata |
discoveries[].type |
string |
Category of discovery |
discoveries[].significance |
enum |
Importance level |
discoveries[].novelty |
enum |
How unexpected the finding is |
methodology |
string |
Exploration approach used |
search_space |
string |
Scope of exploration |
confidence |
number |
0.0-1.0 overall discovery confidence |
evidence_anchors |
array[string] |
References to evidence |
assumptions |
array[string] |
Conditions that could change findings |
Examples
Example 1: Discover Hidden Dependencies
Input:
search_space: "src/"
discovery_type: "relationship"
constraints:
max_depth: 3
focus: "imports and function calls"
Output:
discoveries:
- type: "relationship"
description: "Circular dependency between UserService and AuthService"
significance: high
novelty: surprising
entities_involved:
- "src/services/UserService.ts"
- "src/services/AuthService.ts"
location: "src/services/UserService.ts:12 imports AuthService; src/services/AuthService.ts:8 imports UserService"
- type: "pattern"
description: "All repository classes follow identical initialization pattern with DI container lookup"
significance: medium
novelty: known
entities_involved:
- "src/repositories/*.ts"
location: "src/repositories/"
- type: "anomaly"
description: "PaymentService bypasses standard error handling pattern used by all other services"
significance: high
novelty: suspected
entities_involved:
- "src/services/PaymentService.ts"
location: "src/services/PaymentService.ts:45-78"
- type: "gap"
description: "No unit tests for critical OrderValidation module"
significance: high
novelty: surprising
entities_involved:
- "src/validation/OrderValidation.ts"
location: "tests/ - no corresponding test file"
methodology: "Static analysis of import statements, grep for class instantiation patterns, comparison against test file naming conventions"
search_space: "src/ directory (156 TypeScript files)"
confidence: 0.85
evidence_anchors:
- "src/services/UserService.ts:12"
- "src/services/AuthService.ts:8"
- "src/services/PaymentService.ts:45"
- "tests/:directory-listing"
assumptions:
- "Standard TypeScript import resolution"
- "Test files follow *Spec.ts or *.test.ts convention"
- "All production code is in src/"
Evidence pattern: Grep for import statements, build dependency graph, compare patterns across files.
Example 2: Discover Architecture Patterns
Input:
search_space: "entire codebase"
discovery_type: "pattern"
seed_observations:
- "Some endpoints seem to share similar structure"
Output:
discoveries:
- type: "pattern"
description: "Three distinct architectural styles coexist: MVC in /admin, DDD in /core, and script-style in /legacy"
significance: high
novelty: suspected
entities_involved:
- "/admin/*"
- "/core/*"
- "/legacy/*"
location: "Repository-wide directory structure"
- type: "relationship"
description: "DDD bounded contexts in /core share a common anti-corruption layer for legacy integration"
significance: medium
novelty: surprising
entities_involved:
- "/core/adapters/legacy/"
location: "/core/adapters/legacy/*.ts"
- type: "opportunity"
description: "MVC controllers in /admin could be consolidated - 12 controllers have nearly identical CRUD patterns"
significance: medium
novelty: known
entities_involved:
- "/admin/controllers/*.ts"
location: "/admin/controllers/"
methodology: "Directory structure analysis, pattern matching on file organization, code similarity detection"
search_space: "Full repository (312 files, 4 top-level directories)"
confidence: 0.75
evidence_anchors:
- "/admin/controllers/:pattern-sample"
- "/core/domain/:ddd-structure"
- "/core/adapters/legacy/LegacyAdapter.ts:1-50"
assumptions:
- "Directory structure reflects intentional architecture"
- "Pattern differences are deliberate, not accidental"
Verification
Verification tools: Read (to verify locations), Grep (to confirm patterns exist)
Safety Constraints
mutation: false
requires_checkpoint: false
requires_approval: false
risk: low
Capability-specific rules:
- Do not modify any files during discovery
- Respect scope boundaries - do not explore outside search_space
- Flag discoveries that may reveal sensitive information
- Report uncertainty when findings could be coincidental
Composition Patterns
Commonly follows:
inspect - Discovery often follows initial system observation
search - Discovery extends search results
identify - Discovery finds relationships between identified entities
Commonly precedes:
identify - Discovered entities may need identification
estimate - Discovered patterns may need quantification
compare - Discovered options may need comparison
plan - Discoveries may trigger action planning
Anti-patterns:
- Never use discover for known-item retrieval (use
search)
- Avoid discover for existence checking (use
detect)
- Do not use discover when you already know what to find
Workflow references:
- See
reference/composition_patterns.md#capability-gap-analysis for discover-relationship usage
- See
reference/composition_patterns.md#world-model-build for discovery in modeling
1---2name: discover3description: Find latent patterns, relationships, anomalies, or insights not explicitly specified. Use when exploring unknown structure, finding hidden connections, or uncovering emergent phenomena.4---56## Intent78Explore data or systems to find patterns, relationships, or anomalies that were not explicitly requested or expected. Discovery is open-ended exploration that surfaces novel insights rather than confirming hypotheses.910**Success criteria:**11- At least one non-obvious finding surfaced12- Significance level assigned to each discovery13- Novelty classified (known, suspected, surprising)14- Methodology documented for reproducibility1516**Compatible schemas:**17- `schemas/output_schema.yaml`1819## Inputs2021| Parameter | Required | Type | Description |22|-----------|----------|------|-------------|23| `search_space` | Yes | string\|object | Where to look (files, data, systems, domains) |24| `discovery_type` | No | string | What kind of discovery: relationship, pattern, anomaly, gap, opportunity |25| `constraints` | No | object | Bounds on exploration (time, scope, depth) |26| `seed_observations` | No | array | Initial observations that may hint at discoveries |2728## Procedure29301) **Define search space boundaries**: Establish what is in and out of scope31 - File patterns, directories, or data sources32 - Conceptual boundaries (domain, time range)33 - Depth limits (how many hops of relationships)34352) **Apply discovery heuristics**: Use exploration strategies systematically36 - **Pattern mining**: Look for recurring structures, naming conventions, code patterns37 - **Relationship mapping**: Find connections between entities (imports, calls, references)38 - **Anomaly detection**: Identify outliers, inconsistencies, unusual structures39 - **Gap analysis**: Find missing elements, broken links, incomplete patterns40413) **Assess significance**: Evaluate each finding's importance42 - High: Directly actionable or explains important behavior43 - Medium: Useful context or potential issue44 - Low: Interesting but not actionable45464) **Classify novelty**: Determine how surprising each discovery is47 - Known: Documented or widely understood48 - Suspected: Hypothesized but not confirmed49 - Surprising: Unexpected or counter to assumptions50515) **Identify entities involved**: Link discoveries to specific entities52 - Files, functions, classes, modules53 - People, teams, systems54 - Concepts, patterns, architectures55566) **Ground claims**: Attach evidence anchors to all discoveries57 - Exact locations where patterns occur58 - References to related documentation59607) **Synthesize findings**: Connect individual discoveries into coherent insights6162## Output Contract6364Return a structured object:6566```yaml67discoveries:68 - type: string # relationship, pattern, anomaly, gap, opportunity69 description: string # What was discovered70 significance: low | medium | high71 novelty: known | suspected | surprising72 entities_involved: array[string]73 location: string # Where found (file:line, path, or reference)74methodology: string # How discovery was conducted75search_space: string # What was explored76confidence: number # 0.0-1.0 confidence in discoveries77evidence_anchors: array[string] # References to supporting evidence78assumptions: array[string] # Conditions that affect findings79```8081### Field Definitions8283| Field | Type | Description |84|-------|------|-------------|85| `discoveries` | array | List of findings with metadata |86| `discoveries[].type` | string | Category of discovery |87| `discoveries[].significance` | enum | Importance level |88| `discoveries[].novelty` | enum | How unexpected the finding is |89| `methodology` | string | Exploration approach used |90| `search_space` | string | Scope of exploration |91| `confidence` | number | 0.0-1.0 overall discovery confidence |92| `evidence_anchors` | array[string] | References to evidence |93| `assumptions` | array[string] | Conditions that could change findings |9495## Examples9697### Example 1: Discover Hidden Dependencies9899**Input:**100```yaml101search_space: "src/"102discovery_type: "relationship"103constraints:104 max_depth: 3105 focus: "imports and function calls"106```107108**Output:**109```yaml110discoveries:111 - type: "relationship"112 description: "Circular dependency between UserService and AuthService"113 significance: high114 novelty: surprising115 entities_involved:116 - "src/services/UserService.ts"117 - "src/services/AuthService.ts"118 location: "src/services/UserService.ts:12 imports AuthService; src/services/AuthService.ts:8 imports UserService"119 - type: "pattern"120 description: "All repository classes follow identical initialization pattern with DI container lookup"121 significance: medium122 novelty: known123 entities_involved:124 - "src/repositories/*.ts"125 location: "src/repositories/"126 - type: "anomaly"127 description: "PaymentService bypasses standard error handling pattern used by all other services"128 significance: high129 novelty: suspected130 entities_involved:131 - "src/services/PaymentService.ts"132 location: "src/services/PaymentService.ts:45-78"133 - type: "gap"134 description: "No unit tests for critical OrderValidation module"135 significance: high136 novelty: surprising137 entities_involved:138 - "src/validation/OrderValidation.ts"139 location: "tests/ - no corresponding test file"140methodology: "Static analysis of import statements, grep for class instantiation patterns, comparison against test file naming conventions"141search_space: "src/ directory (156 TypeScript files)"142confidence: 0.85143evidence_anchors:144 - "src/services/UserService.ts:12"145 - "src/services/AuthService.ts:8"146 - "src/services/PaymentService.ts:45"147 - "tests/:directory-listing"148assumptions:149 - "Standard TypeScript import resolution"150 - "Test files follow *Spec.ts or *.test.ts convention"151 - "All production code is in src/"152```153154**Evidence pattern:** Grep for import statements, build dependency graph, compare patterns across files.155156---157158### Example 2: Discover Architecture Patterns159160**Input:**161```yaml162search_space: "entire codebase"163discovery_type: "pattern"164seed_observations:165 - "Some endpoints seem to share similar structure"166```167168**Output:**169```yaml170discoveries:171 - type: "pattern"172 description: "Three distinct architectural styles coexist: MVC in /admin, DDD in /core, and script-style in /legacy"173 significance: high174 novelty: suspected175 entities_involved:176 - "/admin/*"177 - "/core/*"178 - "/legacy/*"179 location: "Repository-wide directory structure"180 - type: "relationship"181 description: "DDD bounded contexts in /core share a common anti-corruption layer for legacy integration"182 significance: medium183 novelty: surprising184 entities_involved:185 - "/core/adapters/legacy/"186 location: "/core/adapters/legacy/*.ts"187 - type: "opportunity"188 description: "MVC controllers in /admin could be consolidated - 12 controllers have nearly identical CRUD patterns"189 significance: medium190 novelty: known191 entities_involved:192 - "/admin/controllers/*.ts"193 location: "/admin/controllers/"194methodology: "Directory structure analysis, pattern matching on file organization, code similarity detection"195search_space: "Full repository (312 files, 4 top-level directories)"196confidence: 0.75197evidence_anchors:198 - "/admin/controllers/:pattern-sample"199 - "/core/domain/:ddd-structure"200 - "/core/adapters/legacy/LegacyAdapter.ts:1-50"201assumptions:202 - "Directory structure reflects intentional architecture"203 - "Pattern differences are deliberate, not accidental"204```205206## Verification207208- [ ] Each discovery has type, significance, and novelty classified209- [ ] At least one discovery has evidence_anchors210- [ ] Methodology is documented and reproducible211- [ ] Search space boundaries are clearly defined212- [ ] Surprising discoveries are supported by multiple evidence points213214**Verification tools:** Read (to verify locations), Grep (to confirm patterns exist)215216## Safety Constraints217218- `mutation`: false219- `requires_checkpoint`: false220- `requires_approval`: false221- `risk`: low222223**Capability-specific rules:**224- Do not modify any files during discovery225- Respect scope boundaries - do not explore outside search_space226- Flag discoveries that may reveal sensitive information227- Report uncertainty when findings could be coincidental228229## Composition Patterns230231**Commonly follows:**232- `inspect` - Discovery often follows initial system observation233- `search` - Discovery extends search results234- `identify` - Discovery finds relationships between identified entities235236**Commonly precedes:**237- `identify` - Discovered entities may need identification238- `estimate` - Discovered patterns may need quantification239- `compare` - Discovered options may need comparison240- `plan` - Discoveries may trigger action planning241242**Anti-patterns:**243- Never use discover for known-item retrieval (use `search`)244- Avoid discover for existence checking (use `detect`)245- Do not use discover when you already know what to find246247**Workflow references:**248- See `reference/composition_patterns.md#capability-gap-analysis` for discover-relationship usage249- See `reference/composition_patterns.md#world-model-build` for discovery in modeling