home / skills / bdambrosio / cognitive_workbench / load

load skill

/src/primitives/load

This skill loads a persisted Note or Collection by ID or name and returns sliced content when requested.

npx playbooks add skill bdambrosio/cognitive_workbench --skill load

Review the files below or copy the command above to add this skill to your agents.

Files (1)
Skill.md
2.8 KB
---
name: load
type: primitive
description: Load persistent Note or Collection by ID or name, with optional slice
---

# Load

## INPUT CONTRACT

- `target`: Note/Collection ID (e.g., `Note_123`), name (e.g., `"my-note"`), or variable
- `out`: Variable name
- `slice` (optional): Python-style slice string controlling how much content to return

**REQUIREMENTS:**
- Resource MUST exist (persisted or named)
- Can load by ID (`Note_123`) or name (`"my-note"`)

**NOT SUPPORTED:**
- ❌ Loading non-existent resources
- ❌ Loading from Collection (load individual Notes/Collections only)

## SLICE PARAMETER

| Target type | Units | Default | Ceiling |
|---|---|---|---|
| Note | characters | `"0:4096"` | 4096 chars (default only) |
| Collection | items | `"0:5"` | 16 items (default only) |

When slice is explicit (e.g. `":"` for full, `"0:10000"`), no ceiling — full requested range is returned. Syntax follows Python slice notation: `"start:stop"`, `":stop"`, `"start:"`, `":"` (all, no limit).

**Validation:** Rejects only when both start and stop are non-negative and `stop < start`. Standard Python semantics supported, including negative indices.

Examples:
- `slice: ":"` — full content (no limit)
- `slice: "0:1000"` — first 1000 chars of a Note
- `slice: "1500:2000"` — chars 1500–2000 of a Note
- `slice: "-500:"` — last 500 chars (Python semantics)
- `slice: "0:10"` — first 10 items of a Collection

**Chunked processing pattern** (for large Notes):
```
load(target=$doc, slice="0:500", out=$chunk1)  → process $chunk1
load(target=$doc, slice="500:1000", out=$chunk2)  → process $chunk2
load(target=$doc, slice="1500:2000", out=$chunk3)  → process $chunk3
```

## OUTPUT

**Notes:** Returns `"Note Content: <sliced text>"` with character count metadata.

**Collections:** The `out` binding is a **new Collection** containing the sliced items. The planner-visible value is a content preview showing each item's Note ID and first 200 chars.

## FAILURE SEMANTICS

**Returns `failed` when:**
- Resource not found
- Invalid resource ID/name
- Missing parameters
- Invalid slice: both start and stop non-negative and stop&lt;start

**Empty content ≠ error** — null Notes return content, not failure.

## REPRESENTATION INVARIANTS

- `load` returns Note/Collection content, not the resource itself
- Prefix distinguishes content from domain-specific output
- For Collections, `out` binds a new Collection (real resource), value string is a preview
- search-web/semantic-scholar return Collections directly — NO load needed

## ANTI-PATTERNS

❌ `map(load)` on search-web results → Results already materialized Notes
❌ `load(target=$collection)` → Load individual Notes/Collections, not from Collection
❌ Expecting domain output → Returns prefixed Note/Collection content
❌ Omitting `slice` when you need full content → Use `slice: ":"` to get up to ceiling

Overview

This skill loads a persisted Note or Collection by ID or name and returns its content (optionally sliced). It supports Python-style slice strings to control how much of the Note text or how many items from a Collection are returned. The skill validates slices and returns structured, prefixed content rather than the raw resource object.

How this skill works

You call load with a target (Note or Collection ID/name), an out binding name, and an optional slice string like "0:1000" or ":". For Notes the skill returns a prefixed text string containing the requested character range and metadata; for Collections it creates a new Collection containing the requested items and returns a planner-visible preview listing each item ID and its first 200 characters. Validation rejects only clearly invalid slices (both start and stop non-negative and stop < start) and missing or non-existent targets cause failure.

When to use it

  • Retrieve part or all of a persisted Note by ID or name for processing or display
  • Extract a subset of items from a persisted Collection into a new Collection
  • Chunk large Notes into multiple loads for incremental processing
  • Obtain a preview of Collection contents for planning or UI display
  • When you need a content string with count metadata rather than the resource object

Best practices

  • Specify slice explicitly (use ":" for full content) when you need the entire Note or Collection beyond default ceilings
  • Use chunked loads (incremental slices) to process very large Notes without hitting resource limits
  • Load by stable ID when available to avoid ambiguous name resolution
  • Do not attempt to load resources that are not persisted or to load from inside another Collection
  • Treat empty content as valid output, not an error

Example use cases

  • Load the first 4,096 characters of a long Note for summarization: load(target=Note_123, slice="0:4096", out=$chunk)
  • Iteratively process a large document by loading 500-char windows: load(... slice="0:500"), load(... slice="500:1000"), etc.
  • Create a smaller Collection preview by loading the first 10 items from a large Collection: load(target=Collection_45, slice="0:10", out=$mini)
  • Fetch an entire Note explicitly with slice=":" when you need full content without default ceilings
  • Produce a planner-visible preview of items (ID + first 200 chars) when inspecting a Collection

FAQ

What happens if the requested target does not exist?

The skill returns failed for missing or invalid resource IDs/names.

How do I get the full content without the default ceiling?

Provide an explicit slice of ":" or a range that covers the full content; explicit slices bypass the default ceiling.

Can I load from a Collection (i.e., pass a Collection as the source of Notes)?

No. load accepts individual Note or Collection targets only; it does not accept an enclosing Collection as a source for loading its members.