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

@manifesto-ai/intent-ir

v0.2.1

Published

Manifesto Intent IR - Chomskyan LF-based Intermediate Representation for natural language intent

Readme

@manifesto-ai/intent-ir

Status: Deprecated (v2 focuses on Core/Host/World/App). This package is legacy and may be removed.

Intent IR is a Chomskyan LF (Logical Form) based Intermediate Representation for natural language intent. It provides deterministic semantic structures that bridge human language to executable domain actions.


What is Intent IR?

Intent IR captures the semantic meaning of natural language intent in a language-independent, canonicalizable form. It serves as the bridge between human-generated utterances and machine-processable protocol structures.

In the Manifesto architecture:

Natural Language (PF)  ───►  INTENT IR (LF)  ───►  IntentBody
"Cancel my order"            Semantic Structure     (Protocol)
"주문 취소해"                 (language-independent)

Key insight: Same meaning, same form. Regardless of surface language, semantically equivalent intents produce identical IR structures.


What Intent IR Does

| Responsibility | Description | |----------------|-------------| | Represent semantic intent | Structure-based meaning (not strings or tokens) | | Canonicalize intents | Ensure equivalent meanings produce identical forms | | Derive semantic keys | intentKey, strictKey, simKey for caching and similarity | | Check features | Validate IR against Lexicon (type/selectional restrictions) | | Lower to protocol | Transform IntentIR to IntentBody | | Resolve references | Deterministic discourse resolution (this/that/lastid) |


What Intent IR Does NOT Do

| NOT Responsible For | Who Is | |--------------------|--------| | Parse natural language | Translator (LLM-assisted) | | Execute intents | Host | | Generate responses | Application layer | | Store conversation history | World / Application |


Installation

npm install @manifesto-ai/intent-ir
# or
pnpm add @manifesto-ai/intent-ir

Peer Dependencies

npm install zod  # Required peer

Quick Example

import {
  IntentIRSchema,
  parseIntentIR,
  checkFeatures,
  createLexicon,
  createResolver,
  lower,
  deriveSimKey,
} from "@manifesto-ai/intent-ir";

// 1. Define a Lexicon (domain vocabulary)
const lexicon = createLexicon({
  events: {
    CANCEL: {
      eventClass: "CONTROL",
      thetaFrame: {
        required: ["TARGET"],
        optional: [],
        restrictions: {
          TARGET: { termKinds: ["entity"], entityTypes: ["Order"] },
        },
      },
      policyHints: { destructive: true },
    },
  },
  entities: {
    Order: { fields: { id: "string", status: "string" } },
  },
});

// 2. Parse an Intent IR (from translator output)
const ir = parseIntentIR({
  v: "0.2",
  force: "DO",
  event: { lemma: "CANCEL", class: "CONTROL" },
  args: {
    TARGET: {
      kind: "entity",
      entityType: "Order",
      ref: { kind: "last" },
    },
  },
});

// 3. Feature checking (validate against Lexicon)
const checkResult = checkFeatures(ir, lexicon);
if (!checkResult.valid) {
  console.error(checkResult.error);
}

// 4. Resolve references (this/that/last → id)
const resolver = createResolver();
const context = {
  discourse: [{ entityType: "Order", id: "order-123", mentionedAt: 1 }],
};
const lowerResult = lower(ir, lexicon, resolver, context);

if (lowerResult.ok) {
  console.log(lowerResult.body);
  // { type: "cancel", input: { args: { target: { type: "Order", ref: { kind: "id", id: "order-123" } } } } }
}

// 5. Derive similarity key for caching/search
const simKey = deriveSimKey(ir);
console.log(simKey); // 64-bit SimHash

Core API

Schemas

// Main schema
const IntentIRSchema: z.ZodObject<IntentIR>;

// Parsing functions
function parseIntentIR(data: unknown): IntentIR;
function safeParseIntentIR(data: unknown): SafeParseResult;
function validateIntentIR(data: unknown): ValidationResult;

// Types
type IntentIR = {
  v: "0.2";
  force: Force;              // "ASK" | "DO" | "VERIFY" | "CONFIRM" | "CLARIFY"
  event: Event;              // { lemma: string, class: EventClass }
  args: Args;                // Partial<Record<Role, Term>>
  cond?: Pred[];             // AND-conjoined conditions
  mod?: Modality;            // "MUST" | "SHOULD" | "MAY" | "FORBID"
  time?: TimeSpec;
  verify?: VerifySpec;
  out?: OutputSpec;
  ext?: Record<string, unknown>;
};

type Term =
  | EntityRefTerm    // { kind: "entity", entityType, ref? }
  | PathRefTerm      // { kind: "path", path }
  | ArtifactRefTerm  // { kind: "artifact", artifactType, ref, content? }
  | ValueTerm        // { kind: "value", valueType, shape, raw? }
  | ExprTerm         // { kind: "expr", exprType, expr }
  | ListTerm;        // { kind: "list", items, ordered? }

Canonicalization

// Semantic mode (removes raw, for similarity)
function canonicalizeSemantic(ir: IntentIR): IntentIR;
function toSemanticCanonicalString(ir: IntentIR): string;

// Strict mode (normalizes raw, for exact caching)
function canonicalizeStrict(ir: IntentIR): IntentIR;
function toStrictCanonicalString(ir: IntentIR): string;

Key Derivation

// Protocol identity key
function deriveIntentKey(body: IntentBody, schemaHash: string): Promise<string>;
function deriveIntentKeySync(body: IntentBody, schemaHash: string): string;

// Exact reproduction key
function deriveStrictKey(
  resolvedIR: ResolvedIntentIR,
  footprint: Footprint,
  snapshot: Snapshot,
  context: ExecutionContext
): Promise<string>;

// Similarity search key (64-bit SimHash)
function deriveSimKey(ir: IntentIR): bigint;
function simhashDistance(a: bigint, b: bigint): number;

Lexicon & Feature Checking

// Create a Lexicon
function createLexicon(config: LexiconConfig): Lexicon;

// Check IR validity
function checkFeatures(ir: IntentIR, lexicon: Lexicon): CheckResult;

type CheckResult =
  | { valid: true; requiresConfirm?: boolean }
  | { valid: false; error: CheckError; suggest: "ERROR" | "CLARIFY" };

Lowering & Resolution

// Create resolver
function createResolver(): Resolver;

// Lower IntentIR to IntentBody
function lower(
  ir: IntentIR,
  lexicon: Lexicon,
  resolver: Resolver,
  context?: ResolutionContext
): LowerResult;

function lowerOrThrow(
  ir: IntentIR,
  lexicon: Lexicon,
  resolver: Resolver,
  context?: ResolutionContext
): { body: IntentBody; resolvedIR: ResolvedIntentIR };

Core Concepts

Functional Projection Hierarchy

Intent IR uses a fixed hierarchy of functional heads derived from linguistic theory:

ForceP ─── Illocutionary force (ASK/DO/VERIFY/CONFIRM/CLARIFY)
   │
ModP ──── Modality (MUST/SHOULD/MAY/FORBID)
   │
TP ────── Temporal specification (NOW/AT/BEFORE/AFTER/WITHIN)
   │
EventP ── Event/operation type (lemma + class)
   │
RoleP ─── θ-role arguments (TARGET/THEME/SOURCE/DEST/...)
   │
VerifyP ─ Verification contract (NONE/TEST/PROOF/CITATION/...)
   │
OutP ──── Output contract (number/expression/proof/plan/code/...)

Three Key Types

| Key | Purpose | Derivation | |-----|---------|------------| | intentKey | Protocol semantic identity | IntentBody + schemaHash | | strictKey | Exact reproduction cache | ResolvedIntentIR + footprint + context | | simKey | Similarity search | SemanticCanonicalIR → SimHash |

Discourse Reference Resolution

Symbolic references are resolved deterministically (no LLM):

| Reference | Resolves To | |-----------|-------------| | { kind: "this" } | Currently focused entity | | { kind: "that" } | Previously mentioned (non-focus) entity | | { kind: "last" } | Most recent of same entity type | | { kind: "id", id: "..." } | Explicit identifier (pass-through) | | (absent ref) | Collection scope (preserved) |


Relationship with Other Packages

┌──────────────┐
│  Translator  │ ← Produces IntentIR from natural language
└──────┬───────┘
       │
       ▼
┌──────────────┐
│  INTENT-IR   │ ← Validates, canonicalizes, lowers
└──────┬───────┘
       │ produces
       ▼
┌──────────────┐
│    World     │ ← Consumes IntentBody via protocol
└──────────────┘

| Relationship | Package | How | |--------------|---------|-----| | Input from | @manifesto-ai/translator | Translator produces IntentIR | | Output to | @manifesto-ai/world | IntentBody enters World Protocol | | Validates against | Application Lexicon | Domain-specific vocabulary |


When to Use Intent IR

Use Intent IR when building:

  • Natural language interfaces (chatbots, voice assistants)
  • LLM-powered domain interactions
  • Intent caching and similarity search systems
  • Multi-language intent normalization

Not needed for:

  • Direct programmatic API calls (use IntentBody directly)
  • Simple CRUD applications without NL interface

Documentation

| Document | Purpose | |----------|---------| | SPEC-v0.2.0.md | Complete specification | | FDR-v0.1.0.md | Foundational Design Rationale |


Theoretical Foundation

Intent IR is grounded in Chomsky's Minimalist Program:

  • PF (Phonetic Form): Surface utterance ("Cancel my order")
  • LF (Logical Form): Semantic structure (Intent IR)
  • Lexicon: Feature checking for grammaticality

Key axioms:

  1. Structure is meaning (not strings, not tokens)
  2. Lexicon is the arbiter of validity
  3. Same meaning, same form (canonicalization)
  4. IR is intent, not plan (execution is downstream)
  5. Functional heads are finite and enumerated

License

MIT