AGENT SKILL

migrate

Universal migration from Obsidian, Notion, Logseq, markdown, CSV, JSON, Roam

使用场景电子表格
License 许可
MIT
最近更新
2026-04-26
Stars
★ 0
Forks
0

01 前言 Front Matter

name
migrate
tools
[ "put_page", "search", "add_link", "add_tag", "sync_brain" ]
version
1.0.0
mutating
true
triggers
[ "migrate from", "import from obsidian", "import from notion", "import from logseq", "migrate data", "import csv", "import json" ]
writes_to
[ "brain.db", "content/" ]
description
Universal migration from Obsidian, Notion, Logseq, markdown, CSV, JSON, Roam

03 SKILL.md 正文

Migrate Skill

Universal migration from any wiki, note tool, or brain system into GBrain.

Contract

  • Source data is never modified or deleted; migration is additive only.
  • Every migrated page is verified round-trip: written to gbrain, read back, spot-checked.
  • Cross-references from the source system (wikilinks, block refs, tags) are converted to gbrain equivalents.
  • Migration is tested on a sample (5-10 files) before bulk execution.
  • Post-migration health check confirms page count, link integrity, and embedding coverage.

Migrating from Postgres GBrain (v1 -> v2)

If you have an existing GBrain installation using Postgres + pgvector + Supabase, use the built-in migration script:

DATABASE_URL="postgresql://..." bun run src/scripts/migrate-pg-to-qmd.ts

The script:

  1. Connects to your old Postgres database
  2. Exports all pages, links, tags, timeline, versions, and raw data
  3. Writes markdown files to ~/.gbrain/data/content/
  4. Imports all domain data into SQLite
  5. Runs QMD indexing and embedding (downloads ~640MB model on first run)
  6. Verifies counts match

Options:

  • --dry-run -- count records without writing
  • --skip-embed -- defer embedding to a later gbrain embed run

Supported Sources

Source Format Strategy
Obsidian Markdown + [[wikilinks]] Direct import, convert wikilinks to gbrain links
Notion Exported markdown or CSV Parse Notion's export structure
Logseq Markdown with ((block refs)) Convert block refs to page links
Plain markdown Any .md directory Import directory into gbrain directly
CSV Tabular data Map columns to frontmatter fields
JSON Structured data Map keys to page fields
Roam JSON export Convert block structure to pages

Phases

  1. Assess the source. What format? How many files? What structure?
  2. Plan the mapping. How do source fields map to gbrain fields (type, title, tags, compiled_truth, timeline)?
  3. Test with a sample. Import 5-10 files, verify by reading them back from gbrain and exporting.
  4. Bulk import. Import the full directory into gbrain.
  5. Verify. Check gbrain health and statistics, spot-check pages.
  6. Build links. Extract cross-references from content and create typed links in gbrain.

Obsidian Migration

  1. Import the vault directory into gbrain (Obsidian vaults are markdown directories)
  2. Convert [[wikilinks]] to gbrain links with ancestor-search resolution:
    • Read each page from gbrain
    • For each [[Name]] found, resolve to a slug and create a link in gbrain
    • [[Name|alias]] uses the alias for context
    • Ancestor-search handles wiki KBs where authors omit one or more leading ../ prefixes
    • The .md suffix is inferred automatically for wikilinks
  3. Use --dry-run to preview before committing changes

Obsidian-specific:

  • Tags (#tag) become gbrain tags
  • Frontmatter properties map to gbrain frontmatter
  • Attachments (images, PDFs) are noted but handled separately via file storage
  • Native wikilink support handles [[relative/path]] and [[relative/path|Display Text]] alongside standard [text](page.md) markdown syntax

Notion Migration

  1. Export from Notion: Settings > Export > Markdown & CSV
  2. Notion exports nested directories with UUIDs in filenames
  3. Strip UUIDs from filenames for clean slugs
  4. Map Notion's database properties to frontmatter
  5. Import the cleaned directory into gbrain

CSV Migration

For tabular data (e.g., CRM exports, contact lists):

  1. For each row in the CSV, create a page with column values as frontmatter
  2. Use a designated column as the slug (e.g., name)
  3. Use another column as compiled_truth (e.g., notes)
  4. Store each page in gbrain

Verification

After any migration:

  1. Check gbrain statistics to verify page count matches source
  2. Check gbrain health for orphans and missing embeddings
  3. Export pages from gbrain for round-trip verification
  4. Spot-check 5-10 pages by reading them from gbrain
  5. Test search: search gbrain for "someone you know is in the data"

Anti-Patterns

  • Bulk import without sample test. Never import the full dataset before verifying with 5-10 files. The cost of cleaning up hundreds of bad pages is enormous.
  • Destroying source data. Migration is additive. Never modify, move, or delete the source files.
  • Ignoring cross-references. Wikilinks, block refs, and tags from the source system must be converted to gbrain equivalents. Dropping them loses the knowledge graph.
  • Skipping verification. A migration without post-import health check, page count comparison, and spot-check reads is incomplete.

Output Format

MIGRATION REPORT -- [source] -> GBrain
=======================================

Source: [format] ([file count] files, [size])
Mapping: [field mapping summary]

Sample Test (N files):
- Imported: N/N
- Round-trip verified: N/N
- Cross-refs converted: N

Bulk Import:
- Total imported: N
- Skipped (duplicates/errors): N
- Links created: N
- Tags migrated: N

Verification:
- Page count match: [yes/no]
- Health check: [pass/fail]
- Search test: [query] -> [result count] hits

Tools Used

  • Store/update pages in gbrain (put_page)
  • Read pages from gbrain (get_page)
  • Link entities in gbrain (add_link)
  • Tag pages in gbrain (add_tag)
  • Get gbrain statistics (get_stats)
  • Check gbrain health (get_health)
  • Search gbrain (query)
  • Sync brain index (sync_brain)

Note: Graph extraction via gbrain extract links --source db is not yet available in the QMD engine. Link extraction during migration is performed inline during import. Future versions will add full graph extraction support.

04 同仓库更多 Skills

sixtycat2000-ctrl
sixtycat2000-ctrl/gbrain-qmd

webhook-transforms

Generic framework for converting external events (SMS, meetings, social mentions) into brain-ingestible signals. Define a transform function, register a webhook URL, and incoming events get processed through the brain pipeline.

★ 0
sixtycat2000-ctrl
sixtycat2000-ctrl/gbrain-qmd

testing

Skill validation framework. Validates every skill has SKILL.md with frontmatter, every reference exists, every env var is declared. The testing contract for the skill system itself.

律师与法务测试与质量Skill与智能体开发
★ 0
sixtycat2000-ctrl
sixtycat2000-ctrl/gbrain-qmd

soul-audit

6-phase interactive interview that generates the agent's identity (SOUL.md), user profile (USER.md), access control (ACCESS_POLICY.md), and operational cadence (HEARTBEAT.md). Re-runnable anytime to update any section.

Skill与智能体开发
★ 0
sixtycat2000-ctrl
sixtycat2000-ctrl/gbrain-qmd

smoke-test

Post-restart smoke tests + auto-fix for gbrain and OpenClaw environments. Tests critical services, auto-fixes known issues, extensible via user-defined test scripts in ~/.gbrain/smoke-tests.d/*.sh.

测试与质量
★ 0
sixtycat2000-ctrl
sixtycat2000-ctrl/gbrain-qmd

skillpack-check

Run `gbrain skillpack-check` to produce an agent-readable JSON health report for the gbrain install. Wraps `gbrain doctor` + `gbrain apply-migrations --list` so a host agent (your OpenClaw's morning-briefing, any OpenClaw cron) can see at a glance whether the skillpack needs attention. Use when the user asks "is gbrain healthy?", when a cron fires a morning check, or proactively when something seems off (jobs not running, brain not updating, autopilot silent).

★ 0
sixtycat2000-ctrl
sixtycat2000-ctrl/gbrain-qmd

skillify

The meta skill. Turn any raw feature or script into a properly-skilled, tested, resolvable, evaled unit of agent-visible capability. Use when the user says "skillify this", "is this a skill?", "make this proper", or after a new feature is built without the full skill infrastructure. Paired with `gbrain check-resolvable`, skillify gives a user-controllable equivalent of Hermes' auto-skill-creation: you build, skillify checks the checklist, check-resolvable verifies nothing is orphaned. The human keeps judgment; the tooling keeps the checklist honest.

Skill与智能体开发
★ 0