Xpersona
P

progressive-loading

CLAWHUB · Unverified

Implements hub-and-spoke lazy loading to minimize token usage in large skills Skill: progressive-loading Owner: athola Summary: Implements hub-and-spoke lazy loading to minimize token usage in large skills Tags: latest:1.9.19 Version history: v1.9.19 | 2026-08-26T13:15:03.367Z | user Release v1.9.19 v1.9.17 | 2026-07-30T05:36:05.107Z | user Release v1.9.17 v1.9.16 | 2026-07-14T19:52:49.461Z | user Release v1.9.16 v1.9.14 | 2026-06-30T18:01:45.065Z | user Release v1.9.14 v1.9.13 | 2026-06-27T16

62
Rank
84
Safety
1.5k
Downloads

About

What it does, and when to use it.

Capability contract not published. No trust telemetry is available yet. 1.5K downloads reported by the source. Last updated 10/10/2026.

Avoid when

  • Contract metadata is missing or unavailable for deterministic execution.

Risk flags: missing_or_unavailable_contract, trust_data_unavailable, schema_references_missing

Install and run

Setup complexity: low.

clawhub skill install s17emme0e2m3cpf7k2jvp3a84984b8z9:nm-leyline-progressive-loading
  1. Setup complexity is classified as HIGH. You must provision dedicated cloud infrastructure or an isolated VM. Do not run this directly on your local workstation.
  2. Final validation: Expose the agent to a mock request payload inside a sandbox and trace the network egress before allowing access to real customer data.

Contract: missing

curl -s "https://www.xpersona.co/api/v1/agents/clawhub-athola-nm-leyline-progressive-loading/snapshot"

Run-check

$0.02 USD

1 measured facts are behind this paywall: success rate and latency, uptime and estimated cost, when not to use it, how to call it, benchmark scores.

Agents pay $0.02 in USDC. A card payment is $0.50, the smallest a card allows.

Documentation

CLAWHUB

149,783 characters of source documentation, loaded on request.

Extracted files

5 files captured from the source.

SKILL.md

---
name: progressive-loading
description: Implements hub-and-spoke lazy loading to minimize token usage in large skills
version: 1.9.8
triggers:
  - progressive-disclosure
  - context-management
  - modularity
  - token-optimization
  - lazy-loading
  - building multi-module skills that need conditional on-demand loading
metadata: {"openclaw": {"homepage": "https://github.com/athola/claude-night-market/tree/master/plugins/leyline", "emoji": "\ud83e\udd9e", "requires": {"config": ["night-market.leyline:mecw-patterns"]}}}
source: claude-night-market
source_plugin: leyline
---

> **Night Market Skill** — ported from [claude-night-market/leyline](https://github.com/athola/claude-night-market/tree/master/plugins/leyline). For the full experience with agents, hooks, and commands, install the Claude Code plugin.


## Table of Contents

- [Overview](#overview)
- [When to Use](#when-to-use)
- [Quick Start](#quick-start)
- [Basic Hub Pattern](#basic-hub-pattern)
- [Progressive Loading](#progressive-loading)
- [Context-Based Selection](#context-based-selection)
- [Hub-and-Spoke Architecture](#hub-and-spoke-architecture)
- [Hub Responsibilities](#hub-responsibilities)
- [Spoke Characteristics](#spoke-characteristics)
- [Selection Strategies](#selection-strategies)
- [Loading Patterns](#loading-patterns)
- [Common Use Cases](#common-use-cases)
- [Best Practices](#best-practices)
- [Module References](#module-references)
- [Integration with Other Skills](#integration-with-other-skills)
- [Exit Criteria](#exit-criteria)


# Progressive Loading Patterns

## Overview

Progressive loading provides standardized patterns for building skills that load modules dynamically based on context, user intent, and available token budget. This prevents loading unnecessary content while ensuring required functionality is available when needed.

The core principle: **Start minimal, expand intelligently, monitor continuously.**

## When To Use

Use progressive loading when building skills that:
- Cover multiple distinct workflows or domains
- Need to manage context window efficiently
- Have modules that are mutually exclusive based on context
- Require MECW compliance for long-running sessions
- Want to optimize for common paths while supporting edge cases

## When NOT To Use

- Project doesn't use the leyline infrastructure patterns
- Simple scripts without service architecture needs

## Quick Start

### Basic Hub Pattern

```markdown
## Progressive Loading

**Context A**: Load `modules/loading-patterns.md` for scenario A
**Context B**: Load `modules/selection-strategies.md` for scenario B

**Always Available**: Core utilities, exit criteria, integration points
```
**Verification:** Run the command with `--help` flag to verify availability.

### Context-Based Selection

```python
from leyline import ModuleSelector, MECWMonitor

selector = ModuleSelector(skill_path="my-skill/")
modules = selector.select_modules(
    context={"intent": "git-catchup", "artifacts": ["git", "python"

_meta.json

{
  "ownerId": "kn7d107jg9jv602h9ytsegydq184a42s",
  "slug": "nm-leyline-progressive-loading",
  "version": "1.9.19",
  "publishedAt": 1787750103367
}

modules/advanced-patterns.md

# Advanced Patterns

This module covers progressive-loading techniques that go beyond
the basic hub-and-spoke setup: adaptive loading driven by runtime
signals, dependency graph resolution across modules, multi-tier
caches with eviction, and recovery patterns when a module load
fails mid-session. Read this after `loading-patterns.md` and
`selection-strategies.md` are familiar.

## When to Reach for Advanced Patterns

The basic patterns in `loading-patterns.md` cover most skills.
Use the advanced patterns here only when one of the following is
true:

- The skill exceeds the standard 800-1500 token target listed in
  `performance-budgeting.md` and cannot be split.
- Modules form a directed acyclic graph (DAG) of dependencies,
  not a flat list.
- Sessions are long enough that loaded modules outlive their
  usefulness and must be evicted.
- A module load can fail (missing file, parse error, dependency
  conflict) and the skill must degrade rather than abort.

## Pattern 1: Adaptive Loading

Adaptive loading shifts module selection based on telemetry from
the current session. The hub records which modules were actually
read and which were never accessed. On the next activation, low
hit-rate modules drop to a lower tier.

```python
from collections import Counter
from pathlib import Path

class AdaptiveSelector:
    def __init__(self, telemetry_path: Path) -> None:
        self.telemetry_path = telemetry_path
        self.hits: Counter[str] = self._load_hits()

    def _load_hits(self) -> Counter[str]:
        if not self.telemetry_path.exists():
            return Counter()
        return Counter(self.telemetry_path.read_text().splitlines())

    def tier_for(self, module: str, default: str = "common") -> str:
        count = self.hits.get(module, 0)
        if count >= 10:
            return "core"
        if count >= 3:
            return default
        return "edge"
```

This pattern is appropriate for skills used hundreds of times by
the same user. For one-shot skills the overhead is not justified.

## Pattern 2: Module DAG Resolution

When modules declare dependencies on other modules (see the
`dependencies` field in the frontmatter shown in
`loading-patterns.md`), the loader must resolve them topologically
to avoid loading a module before its prerequisites.

```python
from graphlib import TopologicalSorter

def resolve_load_order(modules: dict[str, list[str]]) -> list[str]:
    sorter: TopologicalSorter[str] = TopologicalSorter()
    for module, deps in modules.items():
        sorter.add(module, *deps)
    return list(sorter.static_order())
```

`graphlib` is in the Python standard library since 3.9 and raises
`CycleError` if the graph is not a DAG. Catch that exception and
report which modules form the cycle rather than letting the
loader hang.

## Pattern 3: Tiered Cache with Eviction

For skills with many small modules, a two-tier cache keeps recent
modules hot and evicts cold ones under context pressure.

```python
from collections import

modules/api-patterns.md

# API Patterns

This module covers how to apply progressive-loading when a skill
analyzes, designs, or reviews a public API surface. The driving
question is which slices of API knowledge to load on demand:
versioning rules, error envelopes, pagination, authentication,
or surface inventory. Loading all of them at once wastes tokens
when only one slice applies to the current task.

## When This Module Applies

Load this module when the active task involves any of:

- Reviewing a REST, GraphQL, gRPC, or library API surface.
- Designing a new endpoint or public function signature.
- Auditing API consistency across an existing codebase.
- Generating client code, OpenAPI specs, or SDK bindings.

If the task is general code review with no API focus, prefer
`api-review.md` for the audit workflow itself. This module is
about how to chunk API content for progressive loading, not how
to perform the review.

## Slice the API Surface First

Before loading deep API knowledge, classify the surface in one
pass. The classification drives the next module load.

```python
from dataclasses import dataclass
from pathlib import Path

@dataclass
class ApiSlice:
    style: str        # "rest", "graphql", "grpc", "library"
    transport: str    # "http", "tcp", "in-process"
    auth: str         # "none", "bearer", "oauth2", "mtls"
    versioned: bool

def classify(spec_path: Path) -> ApiSlice:
    text = spec_path.read_text(encoding="utf-8").lower()
    style = "rest"
    if "type query" in text or "schema {" in text:
        style = "graphql"
    elif "service " in text and "rpc " in text:
        style = "grpc"
    auth = "bearer" if "authorization: bearer" in text else "none"
    return ApiSlice(
        style=style,
        transport="http" if style != "grpc" else "tcp",
        auth=auth,
        versioned="version" in text or "/v1/" in text,
    )
```

The output of `classify` selects which detail modules to load.
A REST API with bearer auth needs the REST conventions module
and the OAuth/bearer module, not the gRPC streaming module.

## Loading Map

A typical API skill keeps these modules separate so each loads
only when relevant. The frontmatter `triggers` declared in
`selection-strategies.md` controls activation.

| Slice | Load Trigger | Token Estimate |
|-------|--------------|----------------|
| REST conventions | `style == "rest"` | 600 |
| GraphQL schema rules | `style == "graphql"` | 700 |
| gRPC service patterns | `style == "grpc"` | 500 |
| Pagination strategies | `paginated` field present | 400 |
| Auth: bearer/OAuth2 | `auth in ("bearer","oauth2")` | 500 |
| Versioning policy | `versioned == True` | 300 |
| Error envelopes | always (small) | 200 |

The error envelope module is small and always loaded because
every API has errors. Everything else is gated.

## Concrete Example: Bearer-Auth REST Endpoint

When the classifier returns
`ApiSlice(style="rest", auth="bearer", versioned=True)`, the
hub loads three modules and skips the rest.

```yaml
# hub fr

modules/api-review.md

# API Review

This module shows how a progressive-loading hub can drive an API
review without front-loading every checklist, exemplar, and
language convention at once. It is the loading playbook that
sits behind the `pensive:api-review` skill: when reviewing a
public API, decide which detail modules to load and in what
order, instead of pulling in every possible rule.

## Scope

Use this module when:

- The user asks for an API review, design critique, or
  consistency audit.
- The hub skill needs to choose between language-specific or
  style-specific review modules.
- The session has already loaded a generic review skeleton and
  needs to specialize.

For pure design exploration with no existing surface to audit,
load `api-patterns.md` instead. That module covers slicing API
content; this one covers running the review.

## Three-Phase Loading

API review has three phases, and each phase needs a different
module set. Loading all three at once defeats progressive
loading.

### Phase 1: Surface Inventory

Always load. The reviewer needs to know which symbols are
public before anything else. A small inventory module suffices.

```bash
# Find Python public symbols (no leading underscore)
rg --type py '^(class|def) [A-Za-z]' -l

# Find Rust public items
rg --type rust '^pub (fn|struct|enum|trait) ' -l
```

For larger codebases, generate the inventory once into a
session file and refer to it by path rather than reloading
the rg output every turn.

### Phase 2: Exemplar Comparison

Load on demand. Pick exemplars matching the surface style.
For a Python data API, `pandas` and `polars` are reasonable
references. For an HTTP client, `requests` and `httpx`. The
exemplar list is in a separate module so it can be swapped
without rewriting the review skeleton.

### Phase 3: Consistency Audit

Load when discrepancies between surface and exemplars surface.
The audit module enumerates the rules to check: naming
conventions, error types, return shapes, pagination, idempotency,
auth headers. Most reviews do not exercise every rule, so the
audit module itself can be subdivided.

## Loading Decision Table

| Signal | Load |
|--------|------|
| Python files in surface | `python-api-rules.md` |
| Rust files in surface | `rust-api-rules.md` |
| OpenAPI spec found | `openapi-conformance.md` |
| Mentions of pagination | `pagination-rules.md` |
| Mentions of auth | `auth-rules.md` |
| Versioning question | `versioning-policy.md` |

The signals come from user input, scanned files, and earlier
review turns. Cache the signal set per session so the loader
does not re-scan the working tree on every check.

## Example Loading Trace

A user asks: "Review the public functions in
`plugins/abstract/scripts/skills_auditor.py`."

```text
turn 1: load surface-inventory.md (always)
        run rg for public defs in skills_auditor.py
turn 2: load python-api-rules.md (Python file detected)
turn 3: detect inconsistent return types
        load consistency-audit.md
turn 4: user asks "what 

Sponsored

Ads related to progressive-loading and adjacent AI workflows.