Map
INPUT CONTRACT
target: Collection (variable or ID)
operation: Tool/primitive name (string) or dict with tool field
out: Variable name
- Additional fields: Tool-specific parameters
REQUIREMENTS:
target MUST be Collection
operation MUST be valid tool/primitive name
- Operation applied to each Note in Collection
NOT SUPPORTED IN MAP:
- Collection-only primitives:
size, union, intersection, difference, join, filter-structured, sort, head, flatten, split
- Control flow:
if, while, wait
- Discovery/search primitives:
discover-notes, discover-collections, search-within-collection
- Persistence:
persist, load, index
OUTPUT
Returns Collection of Notes, each containing result from applying operation. Failed/null results excluded if filter_null=true (default).
FAILURE SEMANTICS
Empty Collection = expected when:
- All operations fail or return null
- Type contract violated
Empty ≠ error — indicates no successful results, not failure.
Actual failures: Invalid target type, unknown operation, or missing parameters.
REPRESENTATION INVARIANTS
map(load) on search-web results returns empty (results already materialized Notes)
- Empty result from
map(load) = expected behavior, not diagnostic
ANTI-PATTERNS
❌ map(target=$note, operation="refine") → Must be Collection
❌ map(target=$results, operation="load") → search-web results already Notes
❌ map(target=$coll, operation="split") → split operates on Notes, not Collections
❌ Treating empty result as error → Empty = no successful operations
1---2name: map3description: Apply operation to each item in Collection4---56# Map78## INPUT CONTRACT910- `target`: Collection (variable or ID)11- `operation`: Tool/primitive name (string) or dict with `tool` field12- `out`: Variable name13- Additional fields: Tool-specific parameters1415**REQUIREMENTS:**16- `target` MUST be Collection17- `operation` MUST be valid tool/primitive name18- Operation applied to each Note in Collection1920**NOT SUPPORTED IN MAP:**21- Collection-only primitives: `size`, `union`, `intersection`, `difference`, `join`, `filter-structured`, `sort`, `head`, `flatten`, `split`22- Control flow: `if`, `while`, `wait`23- Discovery/search primitives: `discover-notes`, `discover-collections`, `search-within-collection`24- Persistence: `persist`, `load`, `index`2526## OUTPUT2728Returns Collection of Notes, each containing result from applying operation. Failed/null results excluded if `filter_null=true` (default).2930## FAILURE SEMANTICS3132**Empty Collection = expected when:**33- All operations fail or return null34- Type contract violated3536**Empty ≠ error** — indicates no successful results, not failure.3738**Actual failures:** Invalid target type, unknown operation, or missing parameters.3940## REPRESENTATION INVARIANTS4142- `map(load)` on search-web results returns empty (results already materialized Notes)43- Empty result from `map(load)` = expected behavior, not diagnostic4445## ANTI-PATTERNS4647❌ `map(target=$note, operation="refine")` → Must be Collection48❌ `map(target=$results, operation="load")` → search-web results already Notes49❌ `map(target=$coll, operation="split")` → `split` operates on Notes, not Collections50❌ Treating empty result as error → Empty = no successful operations