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

@anchor-engine/sdk

v0.1.4

Published

anchor-engine SDK - Intent preservation layer for LLM agents

Readme

@anchor-engine/sdk

npm version MIT License

Anchor is an open-source intent preservation layer for LLM agents. It monitors agent actions in real-time, detecting and correcting "intent drift" before it leads to hallucinations or out-of-bounds behavior.

[!IMPORTANT] Validated Performance (CNN/DailyMail Benchmark):

  • +9.2% High-Fidelity Lift: Significantly improves the grounding of agent-generated summaries.
  • 0% IFEval Regression: Zero impact on instruction-following capabilities.
  • 0% Tau2 Regression: Maintains absolute stability in sequential reasoning.

Get Started: Sign up at anchor-app-one.vercel.app to get your free API key.


Quickstart

Add Anchor to any AI agent project in just three lines of code.

1. Register & Get API Key

Sign up at anchor-app-one.vercel.app and generate your key from the Settings dashboard.

Note: The SDK is a cloud-first library and will securely communicate with the Anchor Engine via this API key. No local deployment is required.

2. Install

npm install @anchor-engine/sdk

2. Guard Your Agent

import { Anchor } from '@anchor-engine/sdk';

// 1. Initialize with your API key
const anchor = new Anchor({ apiKey: process.env.ANCHOR_API_KEY });

// 2. Define an intent contract for the task
const contract = await anchor.contract({ 
  task: "Build the project in /projects/myapp only. Do not touch core library files." 
});

// 3. Score agent actions in real-time
const result = await anchor.score(agentAction, contract.id);

if (!result.allow) {
  console.log(`Action blocked: ${result.intervention.message}`);
}

}


---

## Why Anchor?

Current LLM evaluation frameworks (like HHEM or IFEval) are generally applied *post-hoc*, assessing a system's quality long after a session has ended. 

**Anchor** brings evaluation into the *execution loop*. We call this **Intent Preservation**. By scoring agent actions in real-time, Anchor actively prevents divergence (drift) from the user's original objective safely and transparently.

---

## Features

- **Real-time Drift Monitoring**: Catch hallucinations the moment they occur.
- **Auto-Correction (Critique Loop)**: Automatically rewrites drifted actions to stay within contract scope.
- **Framework Native**: First-class support for LangChain, Claude Code, and more.
- **Zero Latency Overhead**: Asynchronous monitoring keeps your agents fast.

## Adapters

### LangChain
```typescript
import { LangChainAnchorCallback } from '@anchor-engine/sdk/adapters/langchain';

const executor = await initializeAgentExecutorWithOptions(tools, model, {
  callbacks: [new LangChainAnchorCallback({ anchor, contractId: contract.id })],
});

Claude Code / Generic Interception

Use the watch() proxy to automatically wrap any agent object:

const guardedAgent = anchor.watch(myAgent, contract.id);

// Automatically scores every .act(), .run(), or .execute() call
await guardedAgent.act({ type: 'file_write', target: '/src/main.ts', ... });

Examples

We provide robust examples containing copy-pasteable scripts for integrating Anchor into your existing workflows:


Troubleshooting & FAQ

Q: I get Missing ANCHOR_API_KEY when initializing the SDK. What do I do? A: Anchor requires a valid API key to communicate with the scoring engine. Sign up for free at anchor-app-one.vercel.app, generate a key in Settings, and inject it securely via your environment variables: export ANCHOR_API_KEY=your_key.

Q: Does Anchor require me to run a local backend or database? A: No! The open-source SDK communicates completely with our hosted cloud engine. There is zero local infrastructure required.

Q: Why was my action flagged with Drift detected? A: Anchor acts strictly based on the IntentContract you defined. If the agent's action deviates from the original instruction or violates constraints, it is flagged. You can view detailed scoring telemetry for every action in your Anchor Dashboard.


Benchmarks & Research

Anchor is based on research into real-time intent enforcement. Our latest benchmark on the CNN/DailyMail corpus with gemma4:31b-cloud shows a 9.2% net increase in high-fidelity grounding.

Read the full technical report: TECHNICAL_REPORT.md

Citation

If you use Anchor in your research or project, please cite:

@techreport{rahman2026anchor,
  title={Anchor: Real-Time Intent Preservation in LLM Agents},
  author={Rahman, Hasin},
  year={2026},
  url={https://github.com/anchor-engine/anchor-sdk}
}

License

MIT © anchor-engine