pulse api lookup
Audience: CLI users resolving a single row (or a small duplicate
set) by an exact key value instead of scanning or filtering a whole
cohort. Defined in
internal/cli/api.go.
pulse api lookup is the CLI leaf for Pulse.Lookup. It resolves a
point lookup against a cohort’s prebuilt sidecar index — see
pulse index for building one first. lookup never
builds or repairs an index itself; a missing or stale index is a
coded error, not an implicit rebuild.
lookup joins process / compose / facet / sample /
process-chain under pulse api because it is a request/response
operation against a cohort (execute-and-return), not a corpus-
management verb the way pulse index {build,list,verify,drop} is.
LLM agents using MCP: see the
pulse_lookupMCP tool and thetool-lookup/cohort-sidecar-indexskills.
Synopsis
pulse api lookup --input PATH --key FIELD=VALUE [--key FIELD=VALUE ...]
[--return FIELDS] [--mode MODE]
[--request FILE] [--json] [--echo-request]
Flags
Flags are listed in the Command & flag reference.
--input and --key are required unless --request names a full
LookupRequest file; flags override the file (--input replaces its
cohort, filename and data_dir).
Composite keys are order-significant end to end: --key region=EU --key date=2026-01-01 and the reverse order name the same
two logical values but resolve against different sidecar indexes,
because a composite key is built as an ordered byte-concatenation, not
a set.
Output (--json)
{
"format_version": "1.1",
"data": {
"rows": [
{ "order_id": 42, "region": "EU", "revenue": "129.50" }
]
},
"errors": [],
"warnings": []
}
rows carries one entry under the default assert_unique mode or
first; 1..N entries, ascending row-id order, under all. Cells render
as api sample renders them: decimal128 a string,
date YYYY-MM-DD, datetime RFC 3339 UTC (…Z).
Keyable-type policy
Not every field type may serve as a lookup key. ALLOW u4 / u8 /
u16 / u32 / u64, f32 / f64 (raw IEEE-754 bit-pattern equality
— -0.0 and 0.0 key differently, NaN never self-matches),
date, decimal128 (exact mantissa, no float round-trip),
datetime, categorical_* (dictionary ID), packed_bool. REJECT
set_* — a multi-select bitmask has no single unambiguous equality
value; use a FILTER_SET predicate via pulse api process instead —
and vec_* (PULSE_VECTOR_FIELD_NOT_SCALAR; key on a scalar field).
Exit codes / coded errors
Exit status: 0 on a hit, 1 on any coded error below (in the envelope’s
errors under --json), 2 on a usage error — see Exit
status.
| Code | Meaning |
|---|---|
PULSE_INDEX_MISSING | No sidecar built for the requested key field(s) — run pulse index build first |
PULSE_INDEX_STALE | The cohort really changed — a different size, or a content hash disagreeing with the sidecar’s fingerprint. An mtime that moved while the size held is not stale: it falls through to the fingerprint (see pulse index verify). On a shard archive, also a shard the index does not cover (details.shards_uncovered). Rebuild |
PULSE_LOOKUP_NOT_FOUND | The index is fresh but no record matches the key |
PULSE_LOOKUP_AMBIGUOUS | Default assert_unique mode rejects a key resolving to more than one row |
Performance notes
Indexed lookup is O(1) — flat latency regardless of cohort size
(measured ~5µs across 10k→1M rows). An unindexed scan (pulse api process with an equivalent FILTER_INCLUDE) is linear in record
count, so the gap between indexed and unindexed access widens, not
narrows, as a cohort grows — indexed lookup was measured roughly four
orders of magnitude faster at 1M rows. Build the index once with
pulse index build; every subsequent lookup against that key
combination pays only the O(1) cost.
Examples
# Build the index once
pulse index build --input sales.pulse --key order_id
# Single-key lookup
pulse api lookup --input sales.pulse --key order_id=42 --json
# Composite key, projected columns, tolerate duplicates
pulse api lookup --input sales.pulse \
--key region=EU --key date=2026-01-01 \
--return order_id,revenue --mode all --json
Related
- Point Lookup & Index Management — the Go library equivalent (
Pulse.Lookup/Pulse.BuildIndex/Pulse.VerifyIndex/Pulse.ListIndexes/Pulse.DropIndex) pulse index— build / list / verify / drop the sidecar index this command readspulse api process— full scan withFILTER_*for non-exact-key orset_*membership queries- .pulse File Format → Header Layout — the cohort layout the sidecar sits alongside, unchanged
skills/cohort-sidecar-index.md— sidecar index byte format (v3) + keyable-type policyskills/tool-lookup.md— MCP surface (pulse_lookup)