home/roleplay/migrate-from-v1-6

Migrate From V1.6

GPTClaudeGemini··637 copies·updated 2026-07-14
migrate-from-v1-6.prompt
# User-invoked prompt · migrate-from-v1.6 (v1.8.2 · Obsidian-style)

> Replaces deleted `tools/migrate.py` (903 lines). ROUTER reads this when user
> upgrades from a v1.6.x second-brain to v1.7+ schema.
>
> **v1.8.2 HARD RULE #11**: Migration plan + report render in Obsidian. Apply
> `references/obsidian-style.md` — `> [!warning]` for breaking changes,
> `> [!success]` for per-step results, `[[wikilinks]]` for entry refs.

## Trigger keywords

- `从 v1.6 升级` / `migrate from v1.6`
- `v1.6 → v1.7 数据迁移` / `legacy migration`
- `升级第二大脑数据`

## Goal

Migrate a pre-v1.7 second-brain layout to the v1.7+ schema. **Read-heavy +
careful — wrong migration can corrupt years of decision history.** Always
backup before starting.

## Pre-flight checks

1. **Confirm with user before any write**: "I'm about to migrate {path}. This
   will create new `_meta/sessions/`, `_meta/concepts/`, `_meta/snapshots/`
   directories. Existing files will be preserved. OK?"
2. Verify `git status` is clean. If not: tell user to commit first.
3. Create branch: `git checkout -b migrate-v1.6-to-v1.7-{date}`
4. `cp -r .` of the entire repo to `/tmp/lifeos-backup-{date}` as belt-and-suspenders.

## Migration steps

### 1. Detect v1.6 schema markers

- v1.6 has `_meta/journal/` with date-named markdown files (one per session)
- v1.6 has `_meta/index.md` (single flat index file)
- v1.6 lacks `_meta/concepts/` and `_meta/snapshots/`

If markers absent → tell user "this brain is already v1.7+, no migration needed".

### 2. Migrate sessions

For each `_meta/journal/{YYYY-MM-DD}-*.md`:
- Parse frontmatter (v1.6 fields: `id`, `subject`, `decisions`, `outcome`)
- Generate v1.7 session_id: `{YYYY-MM-DD}T{HHMM}Z` from filename + frontmatter timestamp
- Map v1.6 → v1.7 frontmatter fields:
  - `subject` → `subject`
  - `decisions[]` → `Key Decisions` body section
  - `outcome` → `Outcome` body section + estimate `outcome_score` from sentiment
  - Add new required fields with defaults: `duration_minutes: 0`, `platform: claude-code`,
    `theme: zh-classical`, `workflow: full`, `veto_count: 0`, `council_triggered: false`,
    `compliance_violations: 0`
- Write to `_meta/sessions/{session_id}.md` matching the v1.7 schema in
  `agents/archiver.md` (SessionSummary block)

### 3. Initialize empty cortex graph

- `mkdir -p _meta/concepts/`
- Write empty `_meta/concepts/INDEX.md` (concept extraction happens at next archiver run)
- `mkdir -p _meta/snapshots/soul/`
- If `SOUL.md` exists, write initial snapshot at `_meta/snapshots/soul/{date}-0000.md`
  using current SOUL.md state (per Snapshot Schema in archiver.md)

### 4. Verify

- Run `scripts/prompts/rebuild-session-index.md` to compile sessions INDEX
- Spot-check 3 random sessions: open old `_meta/journal/{file}` and new
  `_meta/sessions/{sid}.md` side-by-side, confirm content preserved
- Tell user to manually inspect: `_meta/journal/` is preserved (not deleted)
  for 30 days; user can `rm -rf` it after confidence builds

## Report to user

fill the variables

This prompt has 7 variables. Pro fills them into a ready-to-paste prompt for you — no manual find-and-replace.

{path}{date}{YYYY-MM-DD}{HHMM}{session_id}{file}{sid}
Unlock with Pro →

when to use it

Community prompt sourced from the open-source GitHub repo jasonhnd/life_OS (NOASSERTION). A "Migrate From V1.6" style prompt — adapt the placeholders and specifics to your task. Imported as-is and not independently retested here, so check the output before relying on it.

tags

roleplaycommunitygeneral

source

jasonhnd/life_OS · NOASSERTION