open-index/open-npm huggingface dataset:
npm package: @loom-node/skills
Description: 基于 Claude Skills 标准的三层渐进式披露架构。
Latest version: 0.1.16

# Skills 机制

基于 Claude Skills 标准的三层渐进式披露架构。

## 快速开始

```typescript
import { SkillRegistry, createSkillActivationTool, buildSkillsSystemPrompt } from '@loom-node/skills';

// 初始化
const registry = new SkillRegistry();
await registry.scanDirectory('./skills');

// 生成系统提示词
const systemPrompt = buildSkillsSystemPrompt(registry);

// 注册激活工具
const skillTool = createSkillActivationTool(registry);
```

## 架构

### Layer 1: Discovery (启动时)
- 扫描 SKILL.md frontmatter
- 提取 name + description
- 成本: ~50 tokens/skill

### Layer 2: Activation (运行时)
- LLM 语义匹配
- 调用 `activate_skill` 工具
- 加载完整 SKILL.md
- 成本: ~500-2000 tokens/skill

### Layer 3: Execution (按需)
- SKILL.md 指令驱动
- LLM 调用 read_file/bash
- 懒加载 scripts/references/assets

## 技能目录结构

```
my-skill/
├── SKILL.md           # 必需
├── scripts/           # 可选
├── references/        # 可选
└── assets/            # 可选
```

## SKILL.md 格式

```markdown
---
name: my-skill
description: Skill description for semantic matching
allowed-tools: read_file, write_file, bash
---

# Skill Instructions

Detailed instructions here...
```

## 文档

- `REDESIGN.md` - 完整设计方案
- `MIGRATION.md` - 迁移指南
- `IMPLEMENTATION.md` - 实现总结
- `examples/` - 示例技能
npm package: @loomal/cli
Description: CLI for the Loomal API — identity infrastructure for AI agents
Author: Loomal
Latest version: 0.1.0

# @loomal/cli

The official CLI for the [Loomal API](https://loomal.ai) — identity infrastructure for AI agents.

[![npm](https://img.shields.io/npm/v/@loomal/cli)](https://www.npmjs.com/package/@loomal/cli)
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)

## Install

```bash
npm install -g @loomal/cli
```

Requires Node.js 18 or later.

## Quick Start

```bash
# Set your API key
export LOOMAL_API_KEY=your_api_key

# Verify your identity
loomal whoami
```

## Authentication

Pass your API key in one of two ways:

```bash
# Environment variable (recommended)
export LOOMAL_API_KEY=your_api_key

# Or per-command flag
loomal whoami --api-key your_api_key
```

## Commands

### Identity

```bash
loomal whoami                          # Show identity info
```

### Mail

```bash
loomal mail send --to a@b.com --subject "Hi" --text "Hello"
loomal mail list [--limit 20] [--labels inbox]
loomal mail get <messageId>
loomal mail reply <messageId> --text "Reply"
loomal mail labels <messageId> --add important
loomal mail delete <messageId>
```

### Threads

```bash
loomal threads list [--limit 20]
loomal threads get <threadId>
loomal threads delete <threadId>
```

### Vault

```bash
loomal vault list
loomal vault get <name>
loomal vault store <name> --type API_KEY --data '{"key":"sk_..."}'
loomal vault delete <name>
loomal vault totp <name>               # Get TOTP code
```

### Logs

```bash
loomal logs list [--category mail] [--status error]
loomal logs stats
```

### DID

```bash
loomal did resolve <identityId>        # Resolve DID document
loomal did domain                      # Resolve domain DID
```

## Global Options

| Flag | Description |
| --- | --- |
| `--api-key <key>` | API key (or set `LOOMAL_API_KEY` env var) |
| `--base-url <url>` | API base URL (or set `LOOMAL_API_URL` env var) |
| `--json` | Output as JSON |
| `--help` | Show help |
| `--version` | Show version |

## JSON Output

Most commands support the `--json` flag for machine-readable output:

```bash
loomal whoami --json
loomal mail list --json
loomal vault list --json
```

## Links

- [Documentation](https://docs.loomal.ai)
- [Website](https://loomal.ai)
- [Node.js SDK](https://github.com/loomal-ai/loomal-node)

## License

MIT
npm package: @loomal/mcp
Description: MCP server for Loomal — Identity infrastructure for AI agents
Latest version: 0.1.0

# @loomal/mcp

Identity infrastructure for AI agents — email, credentials, and TOTP in one place.

## Quick Start

```json
{
  "mcpServers": {
    "loomal": {
      "command": "npx",
      "args": ["-y", "@loomal/mcp"],
      "env": {
        "LOOMAL_API_KEY": "YOUR_API_KEY"
      }
    }
  }
}
```

Get your API key from [console.loomal.ai](https://console.loomal.ai).

## Examples

```
> Send an onboarding email to the new client
> Check my inbox and reply to the latest message
> Store my Stripe API key in the vault
> Get the TOTP code for my AWS account
> Delete the test thread I created earlier
```

## Tools

### Identity

| Tool | Description |
|------|-------------|
| `mail.whoami` | Get identity info — name, email, scopes |

### Email

| Tool | Description |
|------|-------------|
| `mail.send` | Send email |
| `mail.reply` | Reply to a message |
| `mail.list_messages` | List inbox messages |
| `mail.get_message` | Get a specific message |
| `mail.update_labels` | Update message labels |
| `mail.delete_message` | Delete a message |
| `mail.list_threads` | List conversation threads |
| `mail.get_thread` | Get a full thread |
| `mail.delete_thread` | Delete a thread |

### Vault

| Tool | Description |
|------|-------------|
| `vault.list` | List stored credentials |
| `vault.get` | Get a decrypted credential |
| `vault.totp` | Generate a TOTP code |
| `vault.store` | Store or update a credential |
| `vault.delete` | Delete a credential |

## Multiple Identities

Each identity is its own MCP server instance:

```json
{
  "mcpServers": {
    "sales-agent": {
      "command": "npx",
      "args": ["-y", "@loomal/mcp"],
      "env": { "LOOMAL_API_KEY": "loid-sales-key" }
    },
    "support-agent": {
      "command": "npx",
      "args": ["-y", "@loomal/mcp"],
      "env": { "LOOMAL_API_KEY": "loid-support-key" }
    }
  }
}
```

## Docs

[docs.loomal.ai](https://docs.loomal.ai)

## License

MIT
npm package: @loomal/sdk
Description: Official Node.js SDK for the Loomal API — identity infrastructure for AI agents
Author: Loomal
Latest version: 0.1.0

# Loomal Node.js SDK

The official Node.js/TypeScript SDK for the [Loomal API](https://docs.loomal.ai) -- identity infrastructure for AI agents.

[![npm](https://img.shields.io/npm/v/@loomal/sdk)](https://www.npmjs.com/package/@loomal/sdk)
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)

- Zero dependencies (native `fetch`)
- ESM + CJS dual output
- Full TypeScript type definitions
- Node 18+

## Installation

```bash
npm install @loomal/sdk
```

## Quick start

```typescript
import { Loomal } from "@loomal/sdk";

const client = new Loomal({ apiKey: "loid-..." });

const { messages } = await client.mail.listMessages({ limit: 10 });
```

## Authentication

Create an API key in the [Loomal Console](https://console.loomal.ai). Keys are prefixed with `loid-`.

Pass the key directly:

```typescript
const client = new Loomal({ apiKey: "loid-..." });
```

Or load from an environment variable:

```typescript
const client = new Loomal({ apiKey: process.env.LOOMAL_API_KEY });
```

## Usage

### Identity

```typescript
const identity = await client.identity.whoami();
```

### More resources

The SDK also exposes `client.mail`, `client.calendar`, `client.vault`, `client.logs`, and `client.did`. See the full reference at **[docs.loomal.ai](https://docs.loomal.ai)** for request/response shapes, pagination, and end-to-end examples.

## Error handling

All API errors are thrown as `LoomalApiError` with structured fields:

```typescript
import { Loomal, LoomalApiError } from "loomal";

try {
  await client.mail.send({ to: "test@example.com", subject: "Hi", text: "Hello" });
} catch (e) {
  if (e instanceof LoomalApiError) {
    console.error(e.status);  // HTTP status code
    console.error(e.code);    // API error code
    console.error(e.message); // Human-readable message
  }
}
```

## TypeScript

The SDK exports all request and response types:

```typescript
import type {
  LoomalConfig,
  MessageResponse,
  ThreadResponse,
  ThreadDetailResponse,
  PaginatedMessages,
  PaginatedThreads,
  VaultCredentialType,
  CredentialMetadata,
  CredentialWithData,
  VaultList,
  TotpResponse,
  IdentityResponse,
  ActivityLog,
  PaginatedLogs,
  LogsStatsResponse,
  DidDocument,
} from "loomal";
```

## Links

- [Documentation](https://docs.loomal.ai)
- [Website](https://loomal.ai)
- [Console](https://console.loomal.ai)

## License

MIT
npm package: @loomic/devtools
Description: Developer tooling for the Loomic agentic app runtime
Latest version: 0.1.5

# @loomic/devtools

Developer tooling for the Loomic agentic runtime. Not needed in production — add this to your `devDependencies`.

## What it does

- **`MockProvider`** — a deterministic AI provider for unit and integration tests; returns configurable `AgentPlan` responses without hitting any API
- **`ReplayRunner`** — replays a recorded sequence of signals and plans against the runtime for regression testing
- **`RuntimeLogger`** — structured, human-readable console logger that subscribes to runtime events; useful during development to trace the full run-loop cycle

## Install

```bash
npm install --save-dev @loomic/devtools
```

## Usage

```ts
// In tests
import { MockProvider } from '@loomic/devtools';
import { createAgenticRuntime } from '@loomic/runtime';

const runtime = createAgenticRuntime({
  provider: new MockProvider({
    plan: { uiOperations: [], toolCalls: [], memoryCandidates: [] },
  }),
});

// In development (attach to your runtime instance)
import { RuntimeLogger } from '@loomic/devtools';

const logger = new RuntimeLogger(runtime, { level: 'debug' });
logger.attach();
```
npm package: @loomic/memory-sqlite
Description: Local-first SQLite + vector memory store for the Loomic agentic app runtime
Latest version: 0.1.5

# @loomic/memory-sqlite

Local-first memory store for the Loomic agentic runtime, backed by a native SQLite TurboModule. Implements the propose/commit memory pattern — the agent proposes memory candidates; the governor approves and commits them.

## What it does

- **`createSQLiteMemoryStore(adapter)`** — production store backed by native SQLite via React Native New Architecture TurboModules
- **`createInMemoryStore()`** — in-process store for testing and simulators without native modules
- **`MemoryService`** — handles search, retrieval, and the propose/commit lifecycle
- Supports semantic similarity via pluggable embedding and reranker providers

> **Note:** This package requires React Native ≥ 0.76 and the New Architecture enabled. It ships source + native code (no build step — consumed by Metro and CocoaPods/Gradle directly).

## Install

```bash
npm install @loomic/memory-sqlite @loomic/types
```

Then link the native module (auto-linked via React Native's standard linking):

```bash
cd ios && pod install
```

## Usage

```ts
import { createSQLiteMemoryStore } from '@loomic/memory-sqlite';
import { createAgenticRuntime } from '@loomic/runtime';

const runtime = createAgenticRuntime({
  provider: myProvider,
  memory: createSQLiteMemoryStore(),
});
```

For tests or environments without native modules, use the in-memory adapter:

```ts
import { createInMemoryStore } from '@loomic/memory-sqlite';

const runtime = createAgenticRuntime({
  provider: myProvider,
  memory: createInMemoryStore(),
});
```
npm package: @loomic/openai
Description: OpenAI provider adapter for the Loomic agentic app runtime
Latest version: 0.1.5

# @loomic/openai

OpenAI provider adapter for the Loomic agentic runtime. Translates the runtime's planner interface into structured OpenAI API calls using JSON Schema mode.

## What it does

- **`createOpenAIProvider(config)`** — returns a `LoomicProvider` that the runtime uses for planning cycles
- Uses OpenAI's structured output mode to produce typed `AgentPlan` objects (UI diffs, tool calls, memory candidates)
- Supports GPT-4o and any model that supports JSON Schema response format

## Install

```bash
npm install @loomic/openai @loomic/types
# peer dependency:
npm install openai
```

## Usage

```ts
import { createOpenAIProvider } from '@loomic/openai';
import { createAgenticRuntime } from '@loomic/runtime';

const runtime = createAgenticRuntime({
  provider: createOpenAIProvider({
    apiKey: process.env.OPENAI_API_KEY,
    model: 'gpt-4o',           // default
    temperature: 0.2,          // optional
  }),
});
```

## Provider routing

Pass alongside a local provider to enable cloud/local routing:

```ts
createAgenticRuntime({
  cloudProvider: createOpenAIProvider({ apiKey: '...' }),
  localProvider: myLocalProvider,
  providerRouter: myRoutingStrategy,
});
```
npm package: @loomic/react-native
Description: React Native integration layer for the Loomic agentic app runtime
Latest version: 0.1.5

# @loomic/react-native

React Native integration layer for the Loomic agentic runtime. Connects the runtime to your component tree and provides hooks for subscribing to agent-driven state.

## What it does

- **`AgenticAppProvider`** — initializes the runtime and provides it via React context
- **`AgenticScreen`** — renders the dynamic screen descriptor emitted by the agent; you register your own components and the agent mounts/unmounts/updates them
- **`useRuntime()`** — access the runtime instance from any component
- **`useScreenState()`** — subscribe to live screen state updates
- **`useRuntimeEvent()`** — listen to specific run-loop events
- **`useGoals()` / `useNarrative()` / `useJournal()`** — subscribe to agent memory and reasoning state

> **Note:** This package ships source (`.tsx`) rather than compiled output. It is consumed directly by Metro, the React Native bundler. No build step needed.

## Install

```bash
npm install @loomic/react-native @loomic/runtime @loomic/types
```

## Minimal setup

```tsx
import { AgenticAppProvider, AgenticScreen } from '@loomic/react-native';
import { runtime } from './runtime'; // your createAgenticRuntime() instance

export default function App() {
  return (
    <AgenticAppProvider runtime={runtime}>
      <AgenticScreen components={{ HeroCard, ActionButton }} />
    </AgenticAppProvider>
  );
}
```
npm package: @loomic/runtime
Description: Core cross-platform runtime for the Loomic agentic app framework
Latest version: 0.1.5

# @loomic/runtime

> **Start here.** This is the core of the Loomic framework.

The cross-platform agentic runtime that powers the run loop: signal intake → context assembly → AI planning → governor approval → tool execution → UI composition. Works in any JavaScript environment (React Native, Node, web).

## What it does

- **`createAgenticRuntime(config)`** — the single factory that wires everything together
- **`ToolRegistry`** — register typed tools the agent can call
- **`SignalQueue`** — async ingestion of signals (user actions, lifecycle events, etc.)
- **`UIComposer`** — translates agent plans into incremental UI operations
- **`Governor`** — enforces policies, budgets, and approval rules before execution
- **`Journal`** — structured event log of every run-loop cycle
- **`ProviderRouter`** — routes between cloud and local AI providers

## Install

```bash
npm install @loomic/runtime @loomic/types
```

## Minimal setup

```ts
import { createAgenticRuntime } from '@loomic/runtime';
import { createOpenAIProvider } from '@loomic/openai';

const runtime = createAgenticRuntime({
  provider: createOpenAIProvider({ apiKey: process.env.OPENAI_API_KEY }),
});

await runtime.start();
```

See [`@loomic/react-native`](../react-native/README.md) to connect the runtime to your React Native app.
npm package: @loomic/types
Description: Shared TypeScript types and contracts for Loomic
Latest version: 0.1.5

# @loomic/types

Shared TypeScript type contracts for the Loomic agentic app framework. No runtime code — pure type definitions only.

All other `@loomic/*` packages import from here. You'll rarely depend on this package directly; it comes along as a peer dependency.

## What's inside

| Domain | Types |
|--------|-------|
| `signal` | `AppSignal`, `SignalType` — events that enter the run loop |
| `screen` | `ScreenDescriptor`, `UIOperation` — agent-driven UI descriptors |
| `tool` | `ToolDefinition`, `ToolResult` — typed tool contracts |
| `memory` | `MemoryCandidate`, `MemoryEntry`, `MemoryStore` — propose/commit memory model |
| `plan` | `AgentPlan`, `PlannerOutput` — structured agent output |
| `policy` | `GovernorPolicy`, `GovernorVerdict`, `BudgetState` — approval and budget rules |
| `context` | `RuntimeContext` — assembled context passed to the planner |
| `events` | `RuntimeEvent`, `RuntimeEventType` — observable run-loop events |

## Install

```bash
npm install @loomic/types
```