Praxis-Core API Documentation
February 1, 2026 ยท View on GitHub
Version: 1.0.0
Status: Stable
Last Updated: 2026-02-01
Overview
Praxis-Core is the canonical logic layer of the Praxis framework. It provides the foundational primitives for building functional, declarative applications with contracts, rules, constraints, and decision ledger capabilities.
This document defines the stable API surface and stability guarantees for praxis-core.
What is Praxis-Core?
Praxis-Core consists of the following source modules under src/:
Core Modules (Stable)
src/core/protocol.ts- Language-neutral protocol typessrc/core/rules.ts- Registry system for rules and constraintssrc/core/engine.ts- Logic engine executionsrc/core/actors.ts- Actor system for side effectssrc/core/introspection.ts- Registry introspection and analysissrc/core/reactive-engine.ts- Framework-agnostic reactive enginesrc/core/reactive-engine.svelte.ts- Svelte 5 reactive enginesrc/dsl/- DSL helpers for defining facts, events, rulessrc/decision-ledger/- Contract-based validation and behavior tracking
Supporting Core Modules
src/core/schema/- Schema types, validation, and loadingsrc/core/component/- Component generation from schemassrc/core/logic/- Logic generation utilitiessrc/core/pluresdb/- PluresDB integration primitives
All modules above are considered part of the praxis-core stable API surface.
Non-Core Modules
The following are not part of praxis-core but build on top of it:
src/integrations/- Third-party integrations (PluresDB, Unum, Tauri, etc.)src/cli/- Command-line interfacesrc/cloud/- Cloud synchronizationsrc/components/- UI componentssrc/runtime/- Runtime adapterssrc/adapters/- External adapters
Core Modules
Praxis-Core consists of the following stable modules:
1. Protocol (src/core/protocol.ts)
The language-neutral, JSON-friendly protocol that forms the foundation of Praxis.
Stability: STABLE - These types will not change in backward-incompatible ways within the same major version.
Exported Types
PraxisFact- A typed proposition about the domainPraxisEvent- A temporally ordered fact meant to drive changePraxisState- The state of the Praxis engine at a point in timePraxisDiagnostics- Diagnostic information about violations or errorsPraxisStepConfig- Configuration for step executionPraxisStepResult- Result of a step executionPraxisStepFn- The core step function signature
Exported Constants
PRAXIS_PROTOCOL_VERSION- Current protocol version (follows semver)
Stability Guarantees
- Core Types Stability: All protocol types maintain backward compatibility within major versions
- JSON Compatibility: All types remain JSON-serializable
- Cross-Language Compatibility: Changes coordinated across TypeScript, C#, and PowerShell implementations
- Migration Path: Major version changes include migration guides and deprecation warnings
2. Rules & Constraints (src/core/rules.ts)
The registry system for rules and constraints with contract compliance support.
Stability: STABLE
Exported Types
RuleId- Unique identifier for a ruleConstraintId- Unique identifier for a constraintRuleFn<TContext>- Rule function signature (pure, no side effects)ConstraintFn<TContext>- Constraint function signature (pure, no side effects)RuleDescriptor<TContext>- Complete rule definition with metadataConstraintDescriptor<TContext>- Complete constraint definition with metadataPraxisModule<TContext>- Bundle of rules and constraintsRegistryComplianceOptions- Contract compliance configurationPraxisRegistryOptions- Registry configuration options
Exported Classes
PraxisRegistry<TContext>- Central registry for rules and constraints
Registry Methods (Public API)
class PraxisRegistry<TContext> {
// Registration
registerRule(descriptor: RuleDescriptor<TContext>): void
registerConstraint(descriptor: ConstraintDescriptor<TContext>): void
registerModule(module: PraxisModule<TContext>): void
// Lookup
getRule(id: RuleId): RuleDescriptor<TContext> | undefined
getConstraint(id: ConstraintId): ConstraintDescriptor<TContext> | undefined
getRuleIds(): RuleId[]
getConstraintIds(): ConstraintId[]
getAllRules(): RuleDescriptor<TContext>[]
getAllConstraints(): ConstraintDescriptor<TContext>[]
// Contract Compliance
getContractGaps(): ContractGap[]
clearContractGaps(): void
}
Stability Guarantees
- ID Stability: Rule and constraint IDs are permanent identifiers
- Function Signatures:
RuleFnandConstraintFnsignatures will not change - Registry API: Public methods will maintain backward compatibility
- Compliance Optional: Contract compliance checks can be disabled in production
3. Logic Engine (src/core/engine.ts)
The core execution engine that processes events through rules and checks constraints.
Stability: STABLE
Exported Types
PraxisEngineOptions<TContext>- Configuration for engine creation
Exported Classes
LogicEngine<TContext>- The main logic engine
Engine Methods (Public API)
class LogicEngine<TContext> {
// State Access
getState(): Readonly<PraxisState & { context: TContext }>
getContext(): TContext
getFacts(): PraxisFact[]
// Execution
step(events: PraxisEvent[]): PraxisStepResult
stepWithConfig(events: PraxisEvent[], config: PraxisStepConfig): PraxisStepResult
// Direct Manipulation (exceptional cases)
updateContext(updater: (context: TContext) => TContext): void
addFacts(facts: PraxisFact[]): void
clearFacts(): void
reset(options: PraxisEngineOptions<TContext>): void
}
Exported Functions
createPraxisEngine<TContext>(options: PraxisEngineOptions<TContext>): LogicEngine<TContext>
Stability Guarantees
- Immutability: All state returns are immutable copies
- Purity: Rule and constraint functions must be pure
- Determinism: Same inputs always produce same outputs
- Error Handling: Errors captured in diagnostics, never thrown during step
4. DSL Helpers (src/dsl/index.ts)
Ergonomic TypeScript helpers for defining typed facts, events, rules, and constraints.
Stability: STABLE
Exported Types
FactDefinition<TTag, TPayload>- Typed fact definitionEventDefinition<TTag, TPayload>- Typed event definitionDefineRuleOptions<TContext>- Options for defining rulesDefineConstraintOptions<TContext>- Options for defining constraintsDefineModuleOptions<TContext>- Options for defining modules
Exported Functions
// Factory Functions
defineFact<TTag, TPayload>(tag: TTag): FactDefinition<TTag, TPayload>
defineEvent<TTag, TPayload>(tag: TTag): EventDefinition<TTag, TPayload>
defineRule<TContext>(options: DefineRuleOptions<TContext>): RuleDescriptor<TContext>
defineConstraint<TContext>(options: DefineConstraintOptions<TContext>): ConstraintDescriptor<TContext>
defineModule<TContext>(options: DefineModuleOptions<TContext>): PraxisModule<TContext>
// Helper Functions
filterEvents<T extends PraxisEvent>(events: PraxisEvent[], predicate: (e: PraxisEvent) => e is T): T[]
filterFacts<T extends PraxisFact>(facts: PraxisFact[], predicate: (f: PraxisFact) => f is T): T[]
findEvent<T extends PraxisEvent>(events: PraxisEvent[], predicate: (e: PraxisEvent) => e is T): T | undefined
findFact<T extends PraxisFact>(facts: PraxisFact[], predicate: (f: PraxisFact) => f is T): T | undefined
Stability Guarantees
- Type Safety: All definitions provide compile-time type safety
- Runtime Safety: Type guards validate structure at runtime
- Serialization: All definitions produce JSON-serializable output
- Composability: Definitions can be freely composed and reused
5. Decision Ledger (src/decision-ledger/)
Contract-based validation and behavior tracking for rules and constraints.
Stability: STABLE
Exported Types
Contract- Contract definition for rules/constraintsExample- Given/When/Then test exampleAssumption- Explicit assumption with confidence levelReference- External reference (docs, tickets, etc.)ContractGap- Information about missing contract elementsMissingArtifact- Type of missing contract artifactSeverity- Severity level for validation issuesValidationReport- Report of contract validationValidateOptions- Options for contract validationLedgerEntry- Immutable snapshot of rule behaviorLedgerEntryStatus- Status of ledger entry
Exported Functions
// Contract Definition
defineContract(options: DefineContractOptions): Contract
getContract(descriptor: RuleDescriptor | ConstraintDescriptor): Contract | undefined
isContract(obj: unknown): obj is Contract
// Validation
validateContracts(registry: PraxisRegistry, options?: ValidateOptions): ValidationReport
formatValidationReport(report: ValidationReport): string
formatValidationReportJSON(report: ValidationReport): string
formatValidationReportSARIF(report: ValidationReport): string
// Ledger
createBehaviorLedger(basePath: string): BehaviorLedger
Exported Events/Facts
ContractMissing- Fact emitted when contract is missingContractValidated- Fact emitted when contract is validatedContractGapAcknowledged- Fact emitted when gap is acknowledgedContractAdded- Event for adding a contractContractUpdated- Event for updating a contractAcknowledgeContractGap- Event to acknowledge a gapValidateContracts- Event to trigger validation
Exported Classes
BehaviorLedger- Immutable ledger for tracking behavior changes
Stability Guarantees
- Contract Schema: Contract structure remains backward compatible
- Validation API: Validation functions maintain signatures
- Ledger Immutability: Ledger entries are append-only, never modified
- Output Formats: SARIF and JSON output formats remain stable
API Stability Levels
Stable
APIs marked as STABLE follow semantic versioning:
- Patch (1.0.x): Bug fixes, documentation, no API changes
- Minor (1.x.0): New features, backward-compatible additions
- Major (x.0.0): Breaking changes (with migration guide)
Stable APIs will:
- Not remove exported functions, classes, or types
- Not change function signatures in breaking ways
- Provide deprecation warnings before removal
- Include migration guides for breaking changes
Experimental
APIs marked as EXPERIMENTAL may change without notice. Use with caution in production.
Currently, no core APIs are experimental. All extensions and integrations may have their own stability levels.
Versioning
Praxis-Core follows Semantic Versioning 2.0.0:
MAJOR.MINOR.PATCH
- MAJOR: Breaking changes to the core API
- MINOR: New features, backward-compatible additions
- PATCH: Bug fixes, documentation updates
Version Compatibility
| Praxis Version | Protocol Version | Min Node.js | Min Deno |
|---|---|---|---|
| 1.x.x | 1.0.0 | 18.0.0 | 1.37.0 |
Deprecation Policy
- Announcement: Deprecations announced at least one minor version in advance
- Warnings: Deprecated APIs emit runtime warnings in development mode
- Documentation: Deprecated APIs marked clearly in docs with alternatives
- Removal: Deprecated APIs removed only in next major version
Non-Breaking Changes
The following changes are considered non-breaking:
- Adding new optional parameters with defaults
- Adding new methods to classes
- Adding new exported functions or types
- Adding new fields to options objects (as optional)
- Performance improvements
- Bug fixes that restore documented behavior
- Internal refactoring without API changes
Breaking Changes
The following changes are considered breaking:
- Removing exported functions, classes, or types
- Changing function signatures (parameters or return types)
- Changing behavior in incompatible ways
- Renaming exports without aliases
- Making optional parameters required
- Changing TypeScript compiler requirements
Cross-Language Compatibility
Praxis-Core maintains implementations in:
- TypeScript (reference implementation)
- C# (.NET)
- PowerShell
All core types and protocol definitions are coordinated across implementations to ensure:
- Data Portability: State, facts, and events can be serialized and shared
- Behavior Consistency: Same rules produce same results
- Version Synchronization: Major versions released in lockstep
Testing Guarantees
Praxis-Core maintains:
- Unit Tests: All public APIs have unit test coverage
- Integration Tests: Cross-module integration tested
- Contract Tests: All core rules/constraints have contracts
- Cross-Language Tests: Protocol compatibility verified across implementations
- Performance Tests: No performance regressions in stable APIs
Support
- Documentation: Full API documentation at docs/core/
- Examples: Reference examples in examples/
- Issues: Bug reports at GitHub Issues
- Discussions: Questions at GitHub Discussions
References
Next: Extending Praxis-Core