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

@retiform-ai/kg

v0.5.4

Published

Upload a folder of documents to Retiform, shared memory for AI agents, signed in as yourself.

Readme

@retiform-ai/kg

Uploads a folder of documents to your tenant on Retiform, shared memory for AI agents, signed in as yourself. It applies the same rules as the console's Documents page (027 contracts/upload-rules.md). Requires Node.js 22 or later.

npx @retiform-ai/kg upload ./notes

The command uploads to the trial at https://api.retiform.ai. Name another platform with --endpoint, such as the development environment:

npx @retiform-ai/kg upload ./notes --endpoint https://api.dev.retiform.ai

The first run shows an address and a code. Open the address, check the code, and sign in with your email. Later runs renew that sign-in without asking.

Before it sends anything, the command says where the files go and asks you to confirm:

Uploading to tenant Notes (t-abcdefghijkl) as [email protected] on api.retiform.ai.
Send 10 files to tenant Notes (t-abcdefghijkl) as [email protected] on api.retiform.ai? [y/N]

Only y or yes sends. Check the account: a sign-in stored on a shared computer may be someone else's. kg whoami shows it, and kg logout removes it.

Commands

| Command | Does | |---|---| | kg upload <folder-or-file>... [--endpoint <origin>] [--tenant <id>] [--yes] [--dry-run] [--confirm] [--wait] [--json] | uploads Markdown, HTML, plain-text and Word files. PDF files are sent too; the platform reads their pages, within a monthly page limit. With --wait, it then follows each sent document until it is searchable or failed, for up to 10 minutes | | kg login [--endpoint <origin>] | signs in without uploading | | kg logout [--endpoint <origin>] | revokes and deletes the stored sign-in | | kg whoami [--endpoint <origin>] [--json] | shows the signed-in account, its tenant and role, without signing in | | kg link (--project <id> \| --name <name>) [--endpoint <origin>] [--json] | links a repository for the Retiform plugin for Claude Code | | kg codex install [--endpoint <origin>] [--dry-run] | gives the Codex CLI the same session start as the plugin | | kg login --read [--store-file] [--endpoint <origin>] | signs in a second time, to read (#1137); kept apart from the upload sign-in | | kg recall [--label <l>]... [--topic <t>] [--since <date>] [--tenant-wide] [--session <label>] [--json] | current memory entries, newest first, or ranked by --topic; in a linked repository, the Project's (with --tenant-wide, the tenant's own too) | | kg context "<question>" [--budget <tokens>] [--session <label>] [--json] | cited passages and entities for a question, within --budget tokens (100 to 16000; 2000 when absent) | | kg record "<statement>" [--label <l>]... [--session <label>] [--json] | records a memory entry, about the linked Project when there is one | | kg handoff [--session <label>] [--json] | the newest entry labelled handoff for the linked Project |

  • --dry-run signs in, then prints what would be sent and skipped. It sends nothing.
  • --confirm sends again the files that came back needs confirmation, accepting the change it printed for each.
  • --tenant refuses to send unless you belong to that tenant. Because it names the tenant, the command then sends without asking.
  • --yes sends without asking. In a script or CI job, where the command cannot ask, give --yes or --tenant; without either it stops before signing in, and sends nothing.
  • --json prints one JSON object per file and a summary object.

Hidden files and folders (any name starting with .) are never read, and are listed as skipped. Sending the same folder again is safe: unchanged files are reported as unchanged.

Each file becomes the document named by its path. Under a folder you name, that is the folder's name, then the path inside it: kg upload notes sends notes/a/b.md. A file you name on its own is named by its path from the current folder, so kg upload specs/*/spec.md from a repository's top folder sends specs/001-x/spec.md and so on, the same names kg upload specs gives them. A file outside the current folder is named by its file name alone. Two different files that would get the same name stop the command before anything is sent.

The console's Documents page names files the same way. A folder you choose or drop there gets the names kg upload gives that folder. Files you choose one by one are named by their file names, as kg names files in the current folder. Sending the same files once as files and once as a folder makes two sets of documents.

added means Retiform has stored the file. It becomes searchable once processed, usually within a minute. kg's sign-in can only upload, so it can't follow that processing (#993): the console's Documents page shows when each document is ready, and kg upload ends with its address.

Builds from source before #785 named a file given on its own by its file name alone. If you uploaded files that way from a subfolder, sending them again now creates new documents under their paths. Delete the old ones on the console's Documents page.

kg link writes .retiform/project.json at the root of the Git repository you run it in, for the Retiform plugin for Claude Code. Commit the file, and teammates who install the plugin share the same decisions without linking again. Use --project with the Project you picked through the plugin's link skill, or --name to create a new Project. It shows your tenant first. If a valid link already exists, it changes nothing.

kg codex install gives OpenAI's Codex CLI the same start to each session as the Retiform plugin gives Claude Code. It copies the hook into $CODEX_HOME/retiform/ (~/.codex/retiform/ without CODEX_HOME) and adds its entry to $CODEX_HOME/hooks.json, keeping your other hooks. Running it again replaces only its own entry. It makes no network call. It then prints the steps left to you: codex mcp add retiform --url https://api.retiform.ai/mcp and codex mcp login retiform to connect Codex, trusting the hook with /hooks in Codex, and kg link in each repository. With --dry-run it only says what it would write. A hooks.json that is not a JSON object is left as it is, and the command stops with exit status 1.

When too many of your documents are still processing, the command says so and waits for them, up to about five minutes for a file, before sending it again. If they are still processing after that, the file fails and the command stops, naming the limit; send the folder again later.

Exit status

| Status | When | |---|---| | 0 | every file was added, a new revision, unchanged or skipped | | 1 | at least one file failed, needs confirmation, or was not sent; or you answered no (nothing sent) | | 1 | kg link: the platform refused to create the Project, or the file could not be written | | 1 | kg codex install: hooks.json could not be read or merged (it is left as it is) | | 2 | the arguments or the folder could not be used, or the command could not ask and had neither --yes nor --tenant (nothing sent) | | 3 | sign-in, or the platform's configuration, failed (nothing sent) |

Your sign-in

The command keeps only a refresh token, in your system's credential store (Windows Credential Manager, the macOS Keychain or the Secret Service on Linux), under kg-upload:<sign-in domain>. Where no store is available, it keeps the token in credentials.json under $XDG_CONFIG_HOME/kg (or ~/.config/kg; %APPDATA%\kg on Windows), readable by you only, and tells you so. No option or environment variable accepts a token. This sign-in can upload; it cannot read your documents.

Reading and recording (#1137)

kg recall, kg context and kg handoff need a second sign-in that can only read your tenant. You opt in once per machine with kg login --read; until then they say so and exit with status 3, and nothing else on the machine can read. kg record writes with the upload sign-in (kg login), which holds kg:write; the read sign-in cannot write. Where the platform offers the read sign-in an application of its own (readClientId in its configuration), it signs in through that one, so it can be switched off without touching uploads. It is kept apart from the upload sign-in, under kg-read:<sign-in domain>, and in the system's credential store only: where none is available, kg login --read --store-file keeps it in credentials.json as above, which you must ask for, since anyone who reads that file can read your tenant. kg logout revokes and removes both sign-ins.

They act as you, not as an agent:

  • kg recall, kg context and kg handoff count against your plan's monthly retrieval calls, as the MCP tools do, and the console's context usage files them under you, not under an agent.
  • kg record records as you. A statement that looks like it holds a credential is refused, as is one past the plan's memory entries.
  • --session <label> (or KG_SESSION_LABEL) declares a session label on each call, 1 to 40 characters of A-Z a-z 0-9 . _ : - (others are refused, since the platform would drop them), so that a script's entries say where they came from. It is the caller's own text, not verified.

In a repository linked with kg link, they work on that Project; elsewhere, on the tenant. --json prints the platform's answer; without it, a few readable lines.

License

Apache-2.0 (LICENSE). The bundle includes the console's upload rules (console/src/upload), which ship under the same license.

Development

npm ci
npm run typecheck
npm test
npm run build   # dist/kg.js, bundling ../console/src/upload