npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

ade-decision-engine

v1.1.0

Published

Deterministic decision engine with audit-grade replay. ADE is not an AI that decides—it is a system that decides about AI, safely and audibly.

Readme

@ade/engine

Deterministic decision engine with audit-grade replay.

ADE is not an AI that decides—it is a system that decides about AI, safely, deterministically, and audibly.

What ADE Is

  • A 9-stage decision pipeline with immutable selection after scoring
  • Authority separation: the engine decides, skills only narrate
  • Deterministic replay: same inputs → same outputs, always
  • Audit-grade traces: every decision is fully reconstructable
  • Governance-first: versioned authority patterns and prohibitions

What ADE Is Not

  • Not an AI/ML model
  • Not a recommendation engine
  • Not a chatbot or copilot
  • Not a system that "learns" inline (learning is post-decision, pre-next-decision)

Who Should Use ADE

  • Regulated decision systems — finance, healthcare, safety-critical
  • AI-assisted products needing auditability — explain every decision
  • Products that must explain why — not just what action occurred
  • Teams replacing heuristic sprawl — with deterministic control

Quick Start

import { createEngine } from '@ade/engine';

// 1. Create engine
const engine = await createEngine();

// 2. Register your scenario
await engine.registerScenario({
  scenario_id: 'my-scenario',
  version: '1.0.0',
  // ... scenario definition
});

// 3. Make a decision
const response = await engine.decide({
  scenario_id: 'my-scenario',
  user_id: 'user-123',
  actions: [
    { action_id: 'action-a', type_id: 'my_action', attributes: {} },
    { action_id: 'action-b', type_id: 'my_action', attributes: {} },
  ],
  signals: {
    engagement_score: 0.7,
    days_since_last_action: 2,
  },
  context: {
    current_time: new Date().toISOString(),
  },
  options: {
    execution_mode_override: 'deterministic_only',
    include_rationale: true,
  },
});

// 4. Use the decision
console.log(response.decision.selected_action);  // 'action-a'
console.log(response.decision.payload.rationale); // 'Based on your engagement...'
console.log(response.audit.replay_token);         // 'rpl_...'

Core Concepts

The 9-Stage Pipeline

| Stage | Name | Purpose | |-------|------|---------| | 1 | Ingest | Normalize request | | 2 | Derive State | Compute user state from signals | | 3 | Evaluate Guardrails | Filter/force actions | | 4 | Score and Rank | Selection locks here | | 5 | Resolve Skills | Map action to skill | | 6 | Execute Skill | Generate rationale | | 7 | Validate Output | Enforce authority boundaries | | 8 | Fallback | Safe degradation if needed | | 9 | Audit | Store trace, generate replay token |

Authority Separation

┌─────────────────────────────────────────────────────────┐
│                    DECISION AUTHORITY                    │
│                      (Engine Only)                       │
│  • Which action is selected                             │
│  • Guardrail enforcement                                │
│  • Scoring and ranking                                  │
│  • Selection is IMMUTABLE after Stage 4                 │
└─────────────────────────────────────────────────────────┘

┌─────────────────────────────────────────────────────────┐
│                   NARRATIVE AUTHORITY                    │
│                      (Skills Only)                       │
│  • How to explain the decision                          │
│  • Display text and parameters                          │
│  • Cannot change, suggest, or override selection        │
└─────────────────────────────────────────────────────────┘

Deterministic Replay

Every decision can be replayed:

// Retrieve audit trace
const trace = await auditStore.retrieve(decision_id);

// Re-execute with same inputs
const replay = await engine.decide(trace.request);

// Verify determinism
assert(replay.decision.selected_action === trace.final_decision.decision.selected_action);

Scenarios

Scenarios define the decision space:

const scenario = {
  scenario_id: 'fitness-daily-session',
  version: '1.0.0',
  state_schema: {
    core_dimensions: { /* engagement, fatigue, etc. */ },
    scenario_dimensions: { /* domain-specific */ },
  },
  actions: {
    action_types: [
      { type_id: 'workout_session', /* ... */ },
      { type_id: 'rest_day', /* ... */ },
    ],
  },
  guardrails: {
    rules: [
      { rule_id: 'GR-001', condition: '...', effect: 'block_action' },
    ],
  },
  scoring: {
    objectives: [
      { objective_id: 'completion', weight: 0.4, formula: '...' },
    ],
  },
};

Execution Modes

| Mode | Description | |------|-------------| | deterministic_only | Template-based rationale, no LLM | | skill_enhanced | LLM-powered rationale (with fallback) |

Deterministic mode is always available. Skill-enhanced mode falls back to deterministic if validation fails.

Governance

Authority patterns and prohibitions are versioned:

import { AUTHORITY_PATTERNS_V1, PROHIBITIONS_V1 } from '@ade/engine';

// Patterns detect authority boundary violations
// e.g., "I recommend", "you should", "instead"

// Prohibitions detect unsafe content
// e.g., medical claims, urgency manipulation

Golden Vectors

Test correctness with golden vectors:

import { runVectorSuite, FITNESS_GOLDEN_VECTORS } from '@ade/engine/tests';

const result = await runVectorSuite(FITNESS_GOLDEN_VECTORS, scenario);
console.log(result.passed); // true if behavior matches expectations

API Reference

Engine

const engine = await createEngine(config?: EngineConfig);

await engine.registerScenario(scenario: Scenario);
const response = await engine.decide(request: DecisionRequest);

Response Shape

interface DecisionResponse {
  decision: {
    decision_id: string;
    selected_action: string;
    payload: { rationale?: string; display_title?: string };
    ranked_options: Array<{ action_id: string; rank: number; score: number }>;
  };
  state: UserState;
  execution: {
    execution_mode: 'deterministic_only' | 'skill_enhanced';
    fallback_used: boolean;
  };
  guardrails_applied: string[];
  audit: {
    replay_token: string;
    scenario_hash: string;
  };
}

License

MIT

Philosophy

"The decision system never changes. Only the evidence it observes can grow."

ADE is designed for environments where:

  • Decisions must be explainable
  • Replay must be exact
  • Authority must be bounded
  • Compliance is non-negotiable

This includes finance, healthcare, safety-critical systems, and any domain where "the AI decided" is not an acceptable answer.