home / skills / bdambrosio / cognitive_workbench / split
This skill transforms a Note into a Collection by splitting JSON arrays or plain text into individual notes for better organization.
npx playbooks add skill bdambrosio/cognitive_workbench --skill splitReview the files below or copy the command above to add this skill to your agents.
---
name: split
type: primitive
description: Transform Note structure into Collection
---
# Split
## INPUT CONTRACT
- `target`: Note (variable or ID)
- `out`: Variable name
- `field`: Optional string (default `"results"`) — for JSON objects with array field
- `delimiter`: Optional string (default `"sentence"`) — for plain text: `"sentence"`, `"paragraph"`, `"line"`, or custom
**REQUIREMENTS:**
- `target` MUST be Note (not Collection)
- Note content MUST be: JSON array, JSON object with array field, JSONL, or plain text
**NOT SUPPORTED:**
- ❌ Collection (Collections already split)
- ❌ Invalid JSON structure
## OUTPUT
Returns Collection of Notes, one per element/segment. Empty segments filtered out.
## FAILURE SEMANTICS
**Returns `failed` when:**
- Target is Collection (not Note)
- Invalid JSON structure
- No items to split
**Empty Collection ≠ error** — indicates no splittable content, not failure.
## REPRESENTATION INVARIANTS
- Note containing JSON array ≠ Collection
- `split` converts: array → Collection, text → Collection
- `flatten` performs inverse (Collection → Note)
- search-web/semantic-scholar return Collections directly — NO split needed
## ANTI-PATTERNS
❌ `split(target=$collection)` → Collections already split, use `display` to view
❌ `split(target=$search_results)` → search-web returns Collections, not Notes
❌ Splitting Collection to "see inside" → Use `display` or `flatten` instead
This skill transforms a single Note into a Collection by splitting its content into individual Notes. It supports JSON arrays, JSON objects with an array field, JSONL, and plain text segmented by sentence, paragraph, line, or a custom delimiter. The result is a Collection of Notes, one per element or segment, with empty segments filtered out.
You provide a Note (variable or ID) as the target and an output variable name. For JSON objects, specify the array field name; for plain text choose a delimiter mode (sentence, paragraph, line, or custom string). The skill parses the Note, extracts elements or segments, creates one Note per item, and returns those Notes as a Collection. It validates input and returns a failure state for unsupported shapes or when no items can be split.
What input formats are supported?
JSON arrays, JSON objects with an array field, JSONL, and plain text (sentence, paragraph, line, or custom delimiter).
What causes split to fail?
Passing a Collection as target, invalid JSON structure, or finding no items to split will return a failed state.