migrate

A command workflow for GreyCat schema changes, data transformations, bulk import or export, and storage maintenance. A schema defines the fields and structure used to store data.

In plain words
What is it for?
Use it to add, remove, change, or rename fields; migrate stored data; import or export CSV and JSON files; or check, back up, and defragment storage.
Why use it?
It organizes database-management work that can be sequential, interactive, or destructive, and prompts for backups and safety checks before changes.

Command

Part of the greycat plugin — 1 skill, 8 commands shipped together

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/datathings/marketplace/migrate
Clone the repo
git clone --depth 1 https://github.com/datathings/marketplace

Or install greycat, the plugin that ships this one along with the rest of its 1 skill, 8 commands.

Per session 16 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 3,018 The whole file, excluding the scripts and references it only reads on demand.
Security scan C 1 finding. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00016 $0.03018
Opus 5 $0.00008 $0.01509
Sonnet 5 $0.00003 $0.00604
Haiku 4.5 $0.00002 $0.00302

Measured 3d ago against content hash a9a15f0dc422, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade C, and why

migrate scanned grade C with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Recursive force deletehighDestructive command

rm -rf with a variable or a broad path is one typo away from removing the wrong tree.

- **D) Dev reset**: `rm -rf gcdata` (destructive, dev only)
plugins/greycat/commands/migrate.md · 291 lines

How it starts

The opening of the file, as written. The whole thing — 291 lines — stays where its author put it; the contents beside it link to each section on GitHub.

GreyCat Migration & Database Management

Purpose: Schema changes, data transformations, bulk import/export, storage maintenance.

⚠ These ops are sequential, interactive, and destructive — do them one at a time, never in parallel, and back up before anything risky.


Step 1: Choose Operation (AskUserQuestion)

  • A. Schema Evolution — add/remove fields, detect breaking changes
  • B. Data Migration — transform existing data
  • C. Import/Export — bulk CSV/JSON ops
  • D. Storage Health — defrag, backup, diagnostics

Operation A: Schema Evolution

A.1 Scan models

find src -name "*.gcl" -not -name "*_api.gcl" -not -name "*_reader.gcl" -not -name "*_writer.gcl"

Per file: extract type Name { ... } definitions + field lists.

A.2 Ask change type (AskUserQuestion)

Add field · Remove field · Change field type · Rename field (requires migration).

A.3 Add field — safety analysis

The runtime diffs the new program against the stored ABI on rebuild and auto-migrates compatible changes:

  • Add a NULLABLE attribute            → auto-migrates (existing instances read it as null).
  • Add a NON-NULL attribute WITH a default → auto-migrates (existing instances get the default).
  • Add a NON-NULL attribute WITHOUT a default → load FAILS — provide a default or write a migration.
  • Remove an attribute → auto (dropped on next save). Rename → NOT auto (looks like remove + add).

Options:

  • A) Nullable (Recommended): field: T?; — no data touched, safe
  • B) Non-null with default: field: T = <default>; — auto-migrates existing instances to the default
  • C) Nullable → backfill → tighten: for a computed (non-constant) backfill, safe for production
  • D) Dev reset: rm -rf gcdata (destructive, dev only)
  • E) Cancel

Option C (computed backfill) — generate migration:

// src/migration/migrate_YYYYMMDD_<desc>.gcl
fn migrate_add_device_priority() {
  info("Start: add Device.priority");
  var count = 0; var errors = 0;
  for (id: int, device in devices_by_id) {
    try {
      device->priority = 1;  // user-provided default
      count = count + 1;
      if (count % 100 == 0) info("Migrated ${count}...");
    } catch (ex) { error("Failed ${id}: ${ex}"); errors = errors + 1; }
  }
  info("Done: ${count} updated, ${errors} errors");
}

Then: greycat run migrate_add_device_priority → set type non-nullable → greycat lint.

Read the full file on GitHub · 291 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 3d ago First seen · 291 lines · 16 tokens per session scan C a9a15f0dc422

Subscribe to this mod's changes

migrate is a command published in the GitHub repository datathings/marketplace (11 stars, last pushed 6d ago), licensed Apache-2.0. It adds 16 tokens to every session and 3,018 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it C with 1 finding (recursive force delete). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.