Local, versioned package references for your coding agents.
Packref gives coding agents local copies of the exact dependency source used by a project. Agents can inspect implementation details without guessing from documentation, cloning an unrelated revision, or reading a different installed version.
Packref installs source for inspection only. It does not install runtime dependencies, modify your dependency manifest, or replace your package manager.
- π― Exact source alignment: Reference the package versions that the project actually uses.
- π Repository-first inspection: Prefer tagged repository source and retain monorepo layout when package metadata identifies a subdirectory.
- π¦ Reliable fallback: Use the published npm tarball when repository source is not available.
- π Reproducible references: Commit one Packref lockfile so every contributor can materialize the same package source references.
- β»οΈ Shared source snapshots: Reuse immutable package source across projects through a deduplicated global store.
- π€ Agent-ready guidance: Add clear instructions that tell coding agents where and when to read dependency source.
- π§ Safe reconciliation: Sync dependency-tracked references without changing manual references or adopting unrelated dependencies.
- π§° Package-manager neutral: Work alongside Bun, npm, pnpm, and Yarn without replacing runtime dependency installation.
Initialize Packref from the root of a project:
npx packref initInitialization creates .packref/packref-lock.json, registers the project for global-store
pruning, and can update .gitignore, tsconfig.json, and AGENTS.md with Packref guidance.
Use --non-interactive to initialize Packref entirely from flags. Add --ignore to update
.gitignore and exclude .packref from TypeScript. Add --agents to write Packref guidance to
AGENTS.md.
# Initialize only the Packref lockfile and project registration
npx packref init --non-interactive
# Recommended unattended setup for coding agents
npx packref init --non-interactive --ignore --agentsOmitted setup flags are disabled. The --ignore and --agents flags require
--non-interactive; without setup flags, packref init keeps the interactive setup flow.
Add the exact installed version of a dependency, or request a package and version explicitly:
npx packref add react
npx packref add hono@4.2.0
npx packref add @effect/cliRunning packref add without a package opens a multiselect of dependencies not yet referenced.
When a dependency has no installed version in a package-manager lockfile or node_modules, Packref
resolves its manifest range against the registry and tells you to install dependencies and sync.
Commit .packref/packref-lock.json with the project. After cloning, restore every locked source
reference with:
npx packref installinstall follows the committed lockfile exactly. It does not resolve project dependencies, adopt
new dependencies, or change lockfile contents.
Initialize the current project, create or preserve its lockfile, register it globally, and offer to
write ignore rules and agent guidance. Use --non-interactive with --ignore and/or --agents for
an unattended setup. If a committed lockfile already has entries, run npx packref install
afterward to materialize them.
Add a package source reference. A versionless dependency uses the project's exact installed version
when available. Explicit versions such as hono@4.2.0 are tracked manually. Omit the package to
select one or more unresolved project dependencies interactively.
Materialize missing source trees from .packref/packref-lock.json. Matching global snapshots are
reused; missing snapshots are fetched from the source metadata already recorded in the lockfile.
List the current project's references in deterministic order, including version, source host or tarball type, and a marker for manually tracked entries.
Remove matching project-local source trees and lockfile entries. Omit the package to select from all references. If a name matches multiple versions, Packref asks which versions to remove.
npx packref remove react
npx packref remove react@18.3.1Update existing dependency-tracked references to the exact versions resolved for the project and remove dependency-tracked references no longer present in the manifest. Manual references are preserved, and unreferenced manifest dependencies are not automatically adopted.
npx packref syncRemove global store entries unused by every registered project. Missing or unreadable registered projects are reported and prevent unsafe pruning; stale registrations can be removed interactively.
npx packref pruneClear all references from the current project and reset its lockfile after confirmation. Use the global flag to wipe only the global source store; registered projects and project-local state are preserved.
npx packref clean
npx packref clean --global.packref/packref-lock.jsonβ committed package identities, exact versions, source metadata, and dependency/manual tracking modes..packref/packages/β ignored, generated project-local source trees agents inspect.~/.agents/packref/store/β deduplicated global source snapshots reused across projects.~/.agents/packref/config.jsonβ registered project paths used bypackref prune.
Only .packref/packages/ and temporary lockfile writes should be ignored. The lockfile is the
reproducibility boundary and belongs in version control.
For npm packages, Packref prefers repository source when registry metadata points to a supported Git host (GitHub, GitLab, Bitbucket, or SourceHut) and the repository has a tag matching the resolved package version. Repository snapshots retain the repository layout and, when metadata specifies one, the package's monorepo directory.
Packref falls back to the published npm tarball when repository metadata is missing, the repository host is unsupported, or no matching version tag exists. It does not silently fall back when Git is missing or a supported repository download fails, because those are actionable environment or network failures.
- Packref currently supports npm packages and JavaScript projects with
package.json. - Fetching repository source requires Git, which Packref uses to discover matching version tags.
- Package-manager lockfiles and
node_modulesare used to discover exact installed versions; the npm registry is the final resolution fallback. - Source trees are read-only references for agents, not runtime dependencies.
- Packref assumes one process mutates its project and global files at a time. There is no concurrent writer locking in v1.
- Multiple versions of the same package can coexist.
Install the first-party Packref skill to teach coding agents when and how to inspect the exact local dependency source:
npx skills add metaideas/packref --list
npx skills add metaideas/packref --skill packrefSee the packref skill on skills.sh.
Made with π₯ pastry