creationix-rx-data-store

Expert skill for using RX, an embedded data store for JSON-shaped data with random-access reads, no-parse lookups, and a text-safe binary encoding format.

3,819 stars

Best use case

creationix-rx-data-store is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Expert skill for using RX, an embedded data store for JSON-shaped data with random-access reads, no-parse lookups, and a text-safe binary encoding format.

Teams using creationix-rx-data-store should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/creationix-rx-data-store/SKILL.md --create-dirs "https://raw.githubusercontent.com/openclaw/skills/main/skills/adisinghstudent/creationix-rx-data-store/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/creationix-rx-data-store/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How creationix-rx-data-store Compares

Feature / Agentcreationix-rx-data-storeStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Expert skill for using RX, an embedded data store for JSON-shaped data with random-access reads, no-parse lookups, and a text-safe binary encoding format.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

Related Guides

SKILL.md Source

# RX Data Store

> Skill by [ara.so](https://ara.so) — Daily 2026 Skills collection.

RX is an embedded data store for JSON-shaped data. Encode once, then query the encoded document in place — no parsing, no object graph, no GC pressure. Think of it as *no-SQL SQLite*: unstructured data with database-style random access.

**Key benefits:**
- O(1) array access, O(log n) object key lookup on encoded data
- Automatic deduplication of values and shared schemas
- Text-safe encoding (copy-paste friendly, no binary tooling needed)
- Minimal heap allocations (~10 vs millions for JSON parsing)
- ~18x compression on real deployment manifests (92 MB → 5.1 MB)

---

## Installation

```sh
npm install @creationix/rx        # library
npm install -g @creationix/rx     # CLI (global)
npx @creationix/rx data.rx        # CLI (one-off)
```

---

## Core API

### String API (most common)

```ts
import { stringify, parse } from "@creationix/rx";

// Encode
const rx = stringify({ users: ["alice", "bob"], version: 3 });
// Returns a string — store it anywhere you'd store JSON text

// Decode (returns a read-only Proxy)
const data = parse(rx) as any;
data.users[0]         // "alice"
data.version          // 3
Object.keys(data)     // ["users", "version"]
JSON.stringify(data)  // works — full JS interop
```

### Uint8Array API (performance-critical paths)

```ts
import { encode, open } from "@creationix/rx";

const buf = encode({ path: "/api/users", status: 200 });
const data = open(buf) as any;
data.path    // "/api/users"
data.status  // 200
```

### Inspect API (lazy AST)

```ts
import { encode, inspect } from "@creationix/rx";

const buf = encode({ name: "alice", scores: [10, 20, 30] });
const root = inspect(buf);

root.tag          // ":"
root[0].tag       // "," (a string key)
root[0].value     // "name"
root.length       // 4 (key, value, key, value)

// Iterate children
for (const child of root) {
  console.log(child.tag, child.b64);
}

// Object helpers
for (const [key, val] of root.entries()) { /* ... */ }
const node = root.index("name");   // key lookup → node
const elem = root.index(2);        // array index → node

// Filtered key search (O(log n + m) on indexed objects)
for (const [key, val] of root.filteredKeys("/api/")) { /* ... */ }
```

### Escape hatch to underlying buffer

```ts
import { handle } from "@creationix/rx";

const h = handle(data.nested);
// h.data: Uint8Array
// h.right: byte offset
```

---

## Encoding Options

```ts
stringify(data, {
  // Add sorted indexes to containers with >= N entries (enables O(log n) lookup)
  // Use 0 for all containers, false to disable entirely
  indexes: 10,

  // External refs — shared dictionary of known values for cross-document dedup
  refs: { R: ["/api/users", "/api/teams"] },

  // Streaming — receive chunks as they're produced
  onChunk: (chunk: string, offset: number) => process.stdout.write(chunk),
});

encode(data, {
  indexes: 10,
  refs: { R: ["/api/users", "/api/teams"] },
  onChunk: (chunk: Uint8Array, offset: number) => { /* ... */ },
});
```

**If the encoder used external refs, pass the same dictionary to the decoder:**

```ts
const data = parse(payload, { refs: { R: ["/api/users", "/api/teams"] } });
const data = open(buf, { refs: { R: ["/api/users", "/api/teams"] } });
```

---

## CLI

```sh
rx data.rx                         # pretty-print as tree (default on TTY)
rx data.rx -j                      # convert to JSON
rx data.json -r                    # convert to RX
cat data.rx | rx                   # read from stdin (auto-detect format)
rx data.rx -s key 0 sub            # select a sub-value: data["key"][0]["sub"]
rx data.rx -o out.json             # write to file
rx data.rx --ast                   # output encoding structure as JSON
rx data.rx -w                      # write converted file (.json↔.rx)
```

**Full CLI flags:**

| Flag | Description |
|------|-------------|
| `<file>` | Input file (format auto-detected) |
| `-` | Read from stdin explicitly |
| `-j`, `--json` | Output as JSON |
| `-r`, `--rexc` | Output as RX |
| `-t`, `--tree` | Output as tree |
| `-a`, `--ast` | Output encoding structure |
| `-s`, `--select <seg>...` | Select a sub-value by path segments |
| `-w`, `--write` | Write converted file |
| `-o`, `--out <path>` | Write to file instead of stdout |
| `-c`, `--color` / `--no-color` | Force or disable ANSI color |
| `--index-threshold <n>` | Index containers above n values (default: 16) |
| `--string-chain-threshold <n>` | Split strings longer than n (default: 64) |
| `--string-chain-delimiter <s>` | Delimiter for string chains (default: `/`) |
| `--key-complexity-threshold <n>` | Max object complexity for dedupe keys (default: 100) |

**Shell completions:**

```sh
rx --completions setup zsh   # or bash
```

**Tip — paged, colorized viewing:**

```sh
p() { rx "$1" -t -c | less -RFX; }
```

---

## Proxy Behavior

The value returned by `parse`/`open` is **read-only**:

```ts
obj.newKey = 1;      // throws TypeError
delete obj.key;      // throws TypeError
"key" in obj;        // works (zero-alloc key search)
obj.nested === obj.nested  // true (container Proxies are memoized)
```

**Supported operations on the Proxy:**
- Property access: `data.key`, `data[0]`
- `Object.keys()`, `Object.entries()`, `Object.values()`
- `for...of`, `for...in`
- `Array.isArray()`
- `.map()`, `.filter()`, `.find()`, `.reduce()`
- Spread and destructuring
- `JSON.stringify()`

---

## Common Patterns

### Build-step: convert JSON artifact to RX

```ts
import { readFileSync, writeFileSync } from "fs";
import { stringify } from "@creationix/rx";

const json = JSON.parse(readFileSync("manifest.json", "utf-8"));
const rx = stringify(json, { indexes: 10 });
writeFileSync("manifest.rx", rx, "utf-8");
```

### Runtime: sparse read from large RX file

```ts
import { readFileSync } from "fs";
import { parse } from "@creationix/rx";

const manifest = parse(readFileSync("manifest.rx", "utf-8")) as any;

// Only the accessed values are decoded — everything else is skipped
const route = manifest.routes["/dashboard/projects"];
console.log(route.title, route.component, route.auth);
```

### Streaming encode to stdout

```ts
import { stringify } from "@creationix/rx";

stringify(largeData, {
  onChunk: (chunk, offset) => process.stdout.write(chunk),
});
```

### Using external refs for cross-document deduplication

```ts
import { stringify, parse } from "@creationix/rx";

const sharedRefs = { R: ["/api/users", "/api/teams", "/api/projects"] };

// Encode multiple documents sharing the same ref dictionary
const doc1 = stringify(data1, { refs: sharedRefs });
const doc2 = stringify(data2, { refs: sharedRefs });

// Decode with the same dictionary
const val1 = parse(doc1, { refs: sharedRefs }) as any;
const val2 = parse(doc2, { refs: sharedRefs }) as any;
```

### Low-level inspect traversal (zero allocation)

```ts
import { encode, inspect } from "@creationix/rx";

const buf = encode(routes);
const root = inspect(buf);

// Walk object entries without creating JS objects
if (root.tag === ":") {
  for (const [key, val] of root.entries()) {
    if (key.value === "/dashboard") {
      console.log("Found:", val.index("title").value);
      break;
    }
  }
}
```

### Type-safe usage pattern

```ts
import { parse } from "@creationix/rx";

interface Route {
  title: string;
  component: string;
  auth: boolean;
}

interface Manifest {
  routes: Record<string, Route>;
  version: number;
}

// Cast after parse — RX Proxy supports all read operations
const manifest = parse(rxString) as unknown as Manifest;
const dashboard = manifest.routes["/dashboard"];
```

---

## Format Reference

RX is a **text encoding** — not human-readable like JSON, but safe to copy-paste.

Every value is read **right-to-left**. The parser scans left past base64 digits to find a **tag** character:

```
[body][tag][b64 varint]
            ◄── read this way ──
```

| JSON | RX | Description |
|------|----|-------------|
| `42` | `+1k` | tag `+` (integer), b64 `1k` = 84, zigzag → 42 |
| `"hi"` | `hi,2` | tag `,` (string), length = 2 |
| `true` | `'t` | tag `'` (ref), built-in literal |
| `[1,2,3]` | `+6+4+2;6` | tag `;` (array), b64 `6` = content size |
| `{"a":1}` | `+2a,1:a` | tag `:` (object), interleaved keys/values |

**Tags:** `+` integer · `*` decimal · `,` string · `'` ref/literal · `:` object · `;` array · `^` pointer · `.` chain · `#` index

---

## When to Use RX vs Alternatives

| Scenario | Use |
|----------|-----|
| Large artifact, sparse reads | **RX** |
| Build manifests, route tables | **RX** |
| Small config files | JSON |
| Human-authored config | JSON/YAML |
| Write-heavy / mutable data | Real database |
| Fixed schema, minimize wire size | Protobuf |
| Relational/tabular data | SQLite |
| Minimizing compressed transfer | gzip/zstd + JSON |

---

## Troubleshooting

**`TypeError: Cannot set property` on decoded value**
The Proxy returned by `parse`/`open` is read-only by design. To mutate, spread into a plain object first:
```ts
const mutable = { ...parse(rx) };
mutable.newKey = "value"; // works
```

**Decoded value looks correct but `instanceof Array` fails**
Use `Array.isArray(val)` instead — this is correctly intercepted by the Proxy.

**External refs mismatch / wrong values decoded**
Ensure the exact same `refs` dictionary (same keys, same arrays, same order) is passed to both `stringify`/`encode` and `parse`/`open`.

**CLI not found after global install**
```sh
npm install -g @creationix/rx
# If still not found, check your npm global bin path:
npm bin -g
```

**Inspecting encoded bytes**
```sh
rx data.rx --ast    # shows encoding structure with tags and offsets
```
Or use the live viewer at **[rx.run](https://rx.run/)** — paste RX or JSON directly.

**Performance: lookups slower than expected**
Ensure `indexes` threshold is set appropriately when encoding. For large objects (e.g., 35k keys), use `indexes: 0` to index all containers:
```ts
stringify(data, { indexes: 0 });
```

---

## Resources

- **[rx.run](https://rx.run/)** — live web viewer, paste RX or JSON to inspect
- **[docs/rx-format.md](https://github.com/creationix/rx/blob/main/docs/rx-format.md)** — full format spec with grammar and railroad diagrams
- **[docs/cursor-api.md](https://github.com/creationix/rx/blob/main/docs/cursor-api.md)** — low-level zero-allocation cursor API
- **[samples/](https://github.com/creationix/rx/tree/main/samples)** — example datasets (route manifest, RPG state, emoji metadata, sensor telemetry)

Related Skills

Database Engineering Mastery

3891
from openclaw/skills

> Complete database design, optimization, migration, and operations system. From schema design to production monitoring — covers PostgreSQL, MySQL, SQLite, and general SQL patterns.

Coding & Development

Data Room Builder

3891
from openclaw/skills

Build a structured virtual data room checklist and folder hierarchy for fundraising, M&A, or due diligence.

Workflow & Productivity

Data Privacy & Protection Program

3891
from openclaw/skills

You are a **Data Privacy Officer (DPO) agent** — a comprehensive privacy program architect. You help organizations build, operate, and mature privacy programs that comply with global regulations (GDPR, CCPA/CPRA, LGPD, PIPEDA, POPIA, APPI, PDPA) while enabling business growth.

Privacy & Compliance

Data Migration Planner

3891
from openclaw/skills

Plan, execute, and validate data migrations between systems. Covers schema mapping, ETL pipeline design, rollback strategies, and post-migration validation.

Workflow & Productivity

Data Governance Framework

3891
from openclaw/skills

Assess, score, and remediate your organization's data governance posture across 6 domains.

Security

Data Analyst — AfrexAI ⚡📊

3891
from openclaw/skills

**Transform raw data into decisions. Not just charts — answers.**

Data & Research

data-analysis-partner

3891
from openclaw/skills

智能数据分析 Skill,输入 CSV/Excel 文件和分析需求,输出带交互式 ECharts 图表的 HTML 自包含分析报告

Data & Research

Made-in-China Trade Data Analyst

3891
from openclaw/skills

**Short Description**

ercdata

3891
from openclaw/skills

Store, verify, and manage AI data on the Ethereum blockchain (Base network) using the ERCData standard. Use when an agent needs to store data fingerprints on-chain, verify data integrity, create audit trails, manage access control for private data, or interact with the ERCData smart contract. Supports public and private storage, EIP-712 verification, snapshots, and batch operations.

Security

Data Engineering Command Center

3880
from openclaw/skills

Complete methodology for designing, building, operating, and scaling data pipelines and infrastructure. Zero dependencies — pure agent skill.

Data Engineering

ths-financial-data

3891
from openclaw/skills

该skill用于获取股票市场数据,包括实时行情、中文名称查询、键盘缩写转换、资金流向和日K线数据。使用thsdk库提供同花顺数据接口支持。支持自动将中文、缩写、短代码转换为thsdk所需的完整ths_code格式。当匹配到多只股票时,会返回候选列表供用户选择。如未安装thsdk,会自动安装。

datafast-analytics

3891
from openclaw/skills

Query DataFast website analytics and visitor data via the DataFast API for metrics, time series, realtime stats, breakdowns, visitor details, and goal/payment management.