Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

leyline

Infrastructure and pipeline building blocks for plugins.

Overview

Leyline provides reusable infrastructure patterns that other plugins build on. Think of it as a standard library for plugin development - error handling, authentication, storage, and testing patterns.

Installation

/plugin install leyline@claude-night-market

Skills

SkillDescriptionWhen to Use
quota-managementRate limiting and quotasBuilding services that consume APIs
usage-loggingTelemetry trackingLogging tool usage for analytics
service-registryService discovery patternsManaging external tool connections
damage-controlAgent-level error recovery for multi-agent coordinationCrash recovery, context overflow, merge conflicts
error-patternsStandardized error handlingImplementing production-grade error recovery
authentication-patternsAuth flow patternsHandling API keys and OAuth
evaluation-frameworkDecision thresholdsBuilding evaluation criteria
mecw-patternsMECW implementationMinimal Effective Context Window
progressive-loadingDynamic content loadingLazy loading strategies
risk-classificationInline 4-tier risk classification for agent tasksRisk-based task routing with war-room escalation
pytest-configPytest configurationStandardized test configuration
storage-templatesStorage abstractionFile and database patterns
testing-quality-standardsTest quality guidelinesEnsuring high-quality tests

Commands

CommandDescription
/reinstall-all-pluginsUninstall and reinstall all plugins to refresh cache
/update-all-pluginsUpdate all installed plugins from marketplaces

Usage Examples

Plugin Management

# Refresh all plugins (fixes version mismatches)
/reinstall-all-plugins

# Update to latest versions
/update-all-plugins

Using as Dependencies

Leyline skills are typically used as dependencies in other plugins:

# In your skill's SKILL.md frontmatter
dependencies:
  - leyline:error-patterns
  - leyline:quota-management

Error Handling Pattern

Skill(leyline:error-patterns)

# Provides:
# - Structured error types
# - Recovery strategies
# - Logging standards
# - User-friendly messages

Authentication Pattern

Skill(leyline:authentication-patterns)

# Covers:
# - API key management
# - OAuth flows
# - Token refresh
# - Secret storage

Testing Standards

Skill(leyline:testing-quality-standards)

# Enforces:
# - Test naming conventions
# - Coverage requirements
# - Mocking guidelines
# - Fixture patterns

Pattern Categories

Rate Limiting

# quota-management pattern
from leyline import QuotaManager

manager = QuotaManager(
    daily_limit=1000,
    hourly_limit=100,
    burst_limit=10
)

if manager.can_proceed():
    # Make API call
    manager.record_usage()

Telemetry

# usage-logging pattern
from leyline import UsageLogger

logger = UsageLogger(output="telemetry.csv")
logger.log_tool_use("WebFetch", tokens=500, latency_ms=1200)

Storage Abstraction

# storage-templates pattern
from leyline import Storage

storage = Storage.from_config()
storage.save("key", data)
data = storage.load("key")

MECW Patterns

The mecw-patterns skill implements Minimum Effective Context Window principles:

PatternDescription
Summarize EarlyCompress context before it grows
Load on DemandFetch details only when needed
Evict StaleRemove outdated information
Prioritize RecentWeight recent context higher

Integration

Leyline is used by:

  • abstract: Plugin validation uses error patterns
  • conjure: Delegation uses quota management
  • conservation: Context optimization uses MECW patterns

Best Practices

  1. Don’t Duplicate: Use leyline patterns instead of reimplementing
  2. Compose Patterns: Combine multiple patterns for complex needs
  3. Test with Standards: Use pytest-config for consistent testing
  4. Log Everything: Use usage-logging for debugging and analytics
  • abstract: Uses leyline for plugin infrastructure
  • conjure: Uses leyline for quota and service management
  • conservation: Uses leyline for MECW implementation