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

memory-anchor

v1.0.36

Published

MemoryAnchor CLI scaffold

Readme

Memory Anchor

Memory Anchor is a lightweight, local context scaffolding tool engineered for the AI-Agent (GitHub Copilot, Claude Code, Cline, etc.).

By maintaining a compact set of incremental metadata anchors directly within your repository, Memory Anchor drastically slashes LLM token consumption, eliminates context drift (the "Lost in the Middle" problem), and cuts down cold-start latencies in long-lived agent sessions.

🔥 Key Features

  • 🪙 Token Optimization: Prevents AI agents from mindlessly rescanning your entire codebase. It feeds them precise, compact code signatures instead.
  • 🧠 Long-Term Memory (Ballast): Two-section rule system — default rules are auto-managed and refreshed on every init, while repository-specific rules (constraints, architectural decisions, "lessons learned") are preserved across sessions so your AI never repeats the same mistakes.
  • 📅 State Synchronization (Manifest): Module status tracker and key decisions log that helps AI agents understand what state each module is in and what critical design choices have been made.
  • 🔄 Automated Lifecycle Hooks: Seamless pre/post-session integration. Automatically injects compact payloads on session start, and incrementally refreshes the codebase chart based on Git diffs upon session end.

Optimization

Implement threadPool and language load cache to reuse the parser and loaded language, make it sharply faster when appling initialization on large workspace.

threadPool is lazy create, it will automatically creating when necessary, but it should exit

WorkerPool will exist when you use the cli, to catch the file change after every change, it will destroy when you exit the cli, ensuring highest reuse amount.

Initialization will destroy the pool after it finished.

🧭 How It Works

Memory Anchor operates via lightweight lifecycle hooks that orchestrate a tight loop between your source code, Git state, and the AI's system instructions:

[ 1. Start Session ]

↓ Trigger: sessionStart Hook Aggregate Ballast + Manifest Automatically scans and consolidates the core architecture benchmarks and file index lists. ↓ Inject Compact Payload Injects the highly compressed, noise-free context payload directly into the AI's system instructions.

[ 2. AI Coding Session ]

↓ Interactive Development Context-Aware Coding The AI collaborates and modifies source code with a precise, global understanding of your workspace.

[ 3. agent stop ]

Trigger: agentStop Hook Incremental Git Diff Analysis Automatically analyzes Git states to pinpoint only the files changed, added, or deleted during the session. Sync & Update Runs heavy AST parsing exclusively on those changed files, instantly updating the registry.json cache and chart.md blueprint.

[ 3. End Session ]

↓ Trigger: sessionEnd Hook Update ballast, manifest. Do full update for chart.md to ensure the correctness.

Requirements

  • Node.js >= 18

Getting Started

npm install -g memory-anchor
anchor init

Will initialize mamory-anchor for all supported cli.

Extra Commands

anchor init-copilot 
anchor init-claude
anchor init-codex
anchor init-opencode
anchor init-codebuddy
anchor init-public

Used to initialize a specific agent.

CLI Commands

anchor init

Initializes a workspace by creating:

  • ./.memoryanchor/chart.md (project map: directory-grouped skeleton + export signatures)
  • ./.memoryanchor/ballast.md (two-section rules: default system rules + repo-specific rules)
  • ./.memoryanchor/manifest.md (module status tracker + key decisions log)
  • ./AGENTS.md (AI behavior rules and memory workflow)

anchor init-opencode

OpenCode-only setup. Creates:

  • ./.opencode/plugins/memory-anchor.js — a plugin that subscribes to session.idle / session.deleted / tool.execute.after and invokes the memoryanchor-opencode-{pre,stop,post} hooks.
  • ./opencode.json — adds AGENTS.md + the three anchor files to the instructions array so the LLM sees them on every turn. Existing keys (model, provider, mcp, …) are preserved.

Hooks

The init command registers following hooks:

  • sessionStart: runs .memoryanchor/dist/hooks/public/sessionStartPublic.js
  • agentStop: runs .memoryanchor/dist/hooks/public/stopPublic.js
  • sessionEnd: runs .memoryanchor/dist/sessionEndPublic.js

These hooks are expected to read/write the Memory Anchor files above. The build-chart logic generates the project chart, and the post-session hook updates the manifest/ballast and refreshes the chart every session (incremental when git changes exist).

Hook effects and purpose:

  1. sessionStart: loads chart/ballast/manifest to inject a compact context payload and reduce token spend on re-reading the repo.
  2. sessionEnd: records changes into manifest/ballast and refreshes chart slices to preserve long-term memory and cut cold-start time next session.

Project Layout

  • src/cli.ts: CLI entrypoint (shebang)
  • src/index.ts: CAC wiring and command registration
  • src/commands/: CLI commands
  • src/core/: chart building and configuration
  • src/hooks/: pre-session / post-session hooks
  • src/utils/: shared utilities

Current work

Implement multi-thread in chart-building, use threading pool.