Install context packs
Install selected reference material from local directories or Git repositories.
Prerequisites
- Node.js 26+, Git, and
granary-aiinstalled withnpm install --global granary-ai. - Run from your consuming project's root.
- For the distributed-set example, clone
thebytefarm/granaryinto a sibling directory namedgranary-packs. This is the pack source; no CLI build is needed.
1. Inspect a declared source
This lists the root and declared recommended sets and their members without writing consumer files. Manifestless sources have no named entries but remain installable.
2. Install the TypeScript set
Granary writes five component directories, root granary.json and granary-lock.json, and .granary/.gitignore. It also links their reference entrypoints directly in a managed region of root AGENTS.md, preserving existing instructions. Generated context and cache files are ignored automatically. Only the selected set is adopted. For a single component, point at its directory instead:
3. Select ordinary upstream files
For stable Next.js 15/16 docs, use the built-in recipe instead of designing a selection:
It installs docs/** from the highest matching stable tag and records the exact resolution. granary install nextjs@16 is equivalent; bare granary install restores. Add another explicit version to keep both, such as granary add nextjs@15.5.0. See curated Next.js documentation for limits.
For a repository without Granary metadata, add a selection under packs in your granary.json:
This is a complete fresh-project example. In an existing project, preserve its entries and add the source rather than replacing the document. granary install creates the first lock; changing existing locked intent requires a reviewed update.
The React example demonstrates composing docs and implementation from independent pinned repositories.
4. Restore and inspect
Inspect and commit the consumer config, lock, and AGENTS.md. Git sources restore recorded commits while available upstream. Local sources must remain accessible and retain their locked bytes.
Verification
Read the Granary region in AGENTS.md for installed entrypoints. Missing managed files can be restored; changed upstream bytes, unaccepted local edits, and mismatching intent fail explicitly. Inspect accepted customization data for secrets before sharing a lock.
Troubleshooting
Already declared selections should be restored, not added again. Another explicit tag may be added alongside them. To replace a selection or change its files, edit the manifest and prepare a reviewed update. If Git access fails, verify existing repository credentials. Unknown members must be declared by the source, not inferred from directory names. Unaccepted local edits block restoration rather than being overwritten; deleting a managed file recreates it on restore unless that deletion was accepted through review.
Next steps
Browse prebuilt packs or point your agent at installed context.