SDK Reference - Overview
Stoneforge is built as a modular monorepo with six core packages that work together to provide agent orchestration, data management, and UI components.Package Dependency Graph
Package Overview
@stoneforge/core
Foundation layer with types, errors, and ID generation
@stoneforge/storage
Multi-runtime SQLite backends (Bun, Node, Browser)
@stoneforge/quarry
Core API, services, sync, and CLI
@stoneforge/smithy
AI agent orchestration and session management
@stoneforge/ui
React 19 component library and design tokens
@stoneforge/shared-routes
Hono route factories for HTTP servers
Design Principles
Dual Storage Model
Stoneforge uses a dual storage architecture:- SQLite: Fast queries with indexes, FTS5 search, and materialized views. Acts as a cache.
- JSONL: Git-tracked, append-only files. The source of truth for all durable data.
Event Sourcing
Every mutation produces an immutable event, giving you:- Full audit trail
- Point-in-time reconstruction
- Document version history
- Sync conflict resolution
Type Safety
All packages use TypeScript with strict mode and branded types:ElementId,TaskId,EntityId,DocumentId- Type guards:
isTask(),isElement(), etc. - Runtime validation at API boundaries
Installation Patterns
For End Users (CLI + Orchestration)
sf CLI and includes all dependencies.
For Library Users (Core SDK)
For Custom Orchestration
For UI Development
Quick Start Example
Entry Points
Each package provides multiple entry points for tree-shaking and code organization:- @stoneforge/core
- @stoneforge/storage
- @stoneforge/quarry
- @stoneforge/smithy
@stoneforge/core— All exports@stoneforge/core/types— Type definitions only@stoneforge/core/errors— Error classes and factories@stoneforge/core/id— ID generation and validation@stoneforge/core/utils— Utility functions
Version Compatibility
| Package | Version | Node | Bun | Browser |
|---|---|---|---|---|
@stoneforge/core | 1.13.0 | ≥18 | ✓ | ✓ |
@stoneforge/storage | 1.13.0 | ≥18 | ✓ | ✓ |
@stoneforge/quarry | 1.13.0 | ≥18 | ✓ | — |
@stoneforge/smithy | 1.13.0 | ≥18 | ✓ | — |
@stoneforge/ui | 1.13.0 | ≥18 | ✓ | ✓ |
@stoneforge/shared-routes | 1.13.0 | ≥18 | ✓ | — |
All packages follow semver with changelogs. Breaking changes are always signaled with major version bumps.
Next Steps
Core Package
Learn about types, errors, and ID generation
Storage Package
Understand the SQLite backend system
Quarry API
Explore the main API and services
Smithy Orchestration
Build agent orchestration systems