Rayfin

rayfin init ai-files

Install, refresh, disable, and audit Rayfin-managed agent files with rayfin init ai-files install and status.

rayfin init ai-files manages the agent context that Rayfin projects ship for coding agents. Scaffolding runs it automatically; run it again after upgrading the CLI, or when rayfin init ai-files status reports items that are not up-to-date.

Managed items in 2.0.0

ItemIDBehavior
AGENTS.mdone-time installSeeded only when missing. Never overwritten by install, even with --force. In 2.0 it also tells agents to catch errors from every sign-in call and show error.message instead of swallowing them. Changed in 2.0
.mcp.json mcpServers.rayfin keymcp:rayfinOwned by Rayfin. The CLI updates only the mcpServers.rayfin key and preserves other servers.
.agents/skills/rayfin/SKILL.mdskill:rayfinCore Rayfin project skill.
.agents/skills/rayfin-functions/SKILL.mdskill:rayfin-functionsFunctions skill.
.agents/skills/rayfin-connectors/SKILL.mdskill:rayfin-connectorsConnectors skill.
.agents/skills/rayfin-storage/SKILL.mdskill:rayfin-storageStorage skill. Installed by default; in 1.36 it was installed only when the experimental storage feature flag or service was enabled. Changed in 2.0
.agents/skills/rayfin-auth-claims/SKILL.mdskill:rayfin-auth-claimsDynamic auth claims skill. Always installed. New in 2.0
.agents/skills/rayfin-schema-drift/SKILL.mdskill:rayfin-schema-driftGuidance for a schema apply that is blocked by database drift. Installed unless RAYFIN_SCHEMA_RECOVERY is 0 or false. New in 2.0

With RAYFIN_SCHEMA_RECOVERY set to 0 or false, the CLI stops shipping the schema-drift skill: status reports an installed copy as orphaned, and the next install removes it unless you edited it.

Because AGENTS.md is installed only once, a project created before 2.0 keeps its old file. To pick up the 2.0 sign-in guidance, append the lines the 2.0 CLI ships:

AGENTS.md
Generated sign-in code must catch errors from every sign-in call, both on page load and on button click, and display `error.message` to the user.
Never swallow sign-in errors with an empty `catch` or by only calling `setUser(null)`.

The lockfile is rayfin/.lockfile.json. Commit it so every developer sees the same managed-item baseline.

ai-files install

npx rayfin init ai-files install

Idempotently reconciles managed items with the bundled 2.0.0 assets.

OptionDefaultDescription
-f, --force [ids...]no forceOverwrite managed items that were user-modified or restore missing items. With no IDs, applies to every managed item except AGENTS.md; with IDs, scopes the force.
-y, --yesfalseSkip the interactive prompt. Alias of --non-interactive, redeclared so it works after the subcommand.
--non-interactivefalseSkip the prompt and accept defaults: all items enabled.
--enable <id>[]Enable a managed item. Repeatable. Skips the prompt.
--disable <id>[]Disable a managed item and record the choice without writing the file. Repeatable.
--remove-filesfalseWith --disable, also remove on-disk content for previously installed items.
--jsonfalseEmit a single JSON envelope and suppress prompts.
-n, --dry-runfalseClassify what would change without touching disk.

ai-files status

npx rayfin init ai-files status --json
OptionDescription
--jsonEmit a JSON object instead of formatted lines.

Item states

StateMeaning
up-to-dateOn disk and matches the bundled content recorded in the lockfile.
update-availableOn disk and untouched, but the current CLI ships newer content.
user-modifiedThe user changed a managed file after the CLI wrote it.
missingThe lockfile records an item that is no longer on disk.
not-installedThe CLI knows about the item but has not installed it.
disabledOpted out by --disable, or for skills by removing the Rayfin-managed sigil.
orphanedThe lockfile records an item the current CLI no longer ships.
unreadableThe file exists but cannot be parsed, such as invalid JSON in .mcp.json.

Exit codes

CodeMeaning
0Success without warnings.
1Hard error.
3Success with warnings, usually because user-modified content was preserved.

Conflict resolution

The installer compares three things: the bundled asset in the current CLI, the lockfile entry that records what Rayfin last wrote, and the file currently on disk.

StateDefault install behaviorWith --force
not-installedInstall the item.Install the item.
up-to-dateNo-op.No-op.
update-availableRewrite with the new bundled content.Rewrite with the new bundled content.
user-modifiedWarn and preserve the file.Overwrite when the item is in force scope.
missingWarn and leave missing.Reinstall when the item is in force scope.
disabledSkip.Skip unless the item is also passed to --enable.
unreadableWarn and preserve.Rebuild when the item is in force scope.
orphaned, untouchedRemove lockfile and disk content.Remove lockfile and disk content.
orphaned, editedWarn and preserve.Remove when the item is in force scope.

AGENTS.md is the exception. It is installed only when missing and is never overwritten by install, even with --force.

Scripting examples

Check what would change without writing:

npx rayfin init ai-files install --dry-run --json

Refresh in CI or an agent session while preserving user edits:

npx rayfin init ai-files install --yes --json

Force only the MCP server entry after a malformed .mcp.json repair decision:

npx rayfin init ai-files install --force mcp:rayfin --yes

Check after upgrading the CLI

After you upgrade @microsoft/rayfin-cli, run status to see what the new CLI ships. Items the new CLI adds, such as skill:rayfin-auth-claims after an upgrade from 1.36, show as not-installed; skills whose bundled content changed show as update-available. install applies both and preserves files you edited.

npx rayfin init ai-files status
npx rayfin init ai-files install --yes
PromptRefresh Rayfin agent files
Run `npx rayfin init ai-files status --json`, then run `npx rayfin init ai-files install --yes --json`. Preserve any user-modified items unless I explicitly approve a scoped `--force <id>` overwrite.
Something wrong on this page?Report an issueEdit this page

On this page