Skip to main content

Component Migration Workflow System — Gap Analysis & Proposal

Date: 2026-02-11 Author: Claude (Opus 4.6) Task: H.22 — Component Migration Workflow System Project: PILOT Status: PROPOSED — awaiting approval


Problem Statement

CODITECT needs to relocate components between repositories (e.g., pdf-to-markdown from coditect-core to coditect-research-continuum). The framework has extensive migration infrastructure for code/database/naming migrations, but zero support for component relocation between repositories.

When a component moves:

  1. Framework discovery (skill catalog, command index, component search) breaks silently
  2. Registry entries (framework-registry.json, component-activation-status.json) become stale
  3. Component counts in component-counts.json become inaccurate
  4. Users invoking relocated commands get no feedback

Discovery: What Exists Today

Migration Infrastructure (Code/Database/Naming Only)

ComponentTypePurposeHandles Relocation?
skills/migration-safety-patterns/SKILL.mdSkillSafe file renaming (ADR-100 patterns)No
skills/migration-strategy/SKILL.mdSkillDatabase migration planningNo
skills/interactive-migration/SKILL.mdSkillInteractive migration executionNo
skills/framework-migration-patterns/SKILL.mdSkillFramework version upgradesNo
agents/migration-safety-specialist.mdAgentSafe migration enforcementNo
agents/lowercase-migration-agent.mdAgentLowercase naming migrationNo
hooks/migration-safety-validator.pyHookValidates migration safetyNo
hooks/validators/migration-validator.pyHookDatabase migration validationNo
commands/migration-preflight.mdCommandPre-flight checklistNo
commands/migration-status.mdCommandMigration queue statusNo
commands/migration-mark.mdCommandManual status markingNo
commands/migration-next.mdCommandNext pending migrationNo

Finding: 12 migration components exist. ALL handle code/database/naming migrations. NONE handle component relocation between repos.

Component Lifecycle (Updated This Session)

ComponentTypeMigration SupportStatus
commands/component-lifecycle.mdCommandPhase 6: MIGRATE added (v1.1.0)Docs only — no script
commands/component-create.mdCommand--stub support added (v1.1.0)Docs only — no script

Finding: Command documentation updated but no execution scripts exist for migration operations.

What's Missing (Gap Map)

NeedComponent TypeExists?Gap
Migration execution scriptScriptNoCore gap — no script moves files + creates stubs
Stub templateTemplateNoTemplates dir has agent/skill/command but no stub template
Stub validation hookHookNoNo validation that stubs have correct frontmatter
Migration workflow definitionWorkflowNoNo WF-* workflow orchestrating the full migration
Registry updater for relocationsScriptNoExisting ensure_component_registered.py doesn't handle status: relocated
Migration preflight for relocationCommandPartialmigration-preflight.md exists but only covers code/DB migrations
Batch migration orchestrationScriptNoNo batch processing for multi-component moves

Proposed Solution: Component Migration Workflow System

Architecture

User invokes: /component-lifecycle skill pdf-to-markdown --migrate --to coditect-research-continuum

┌─────────────────────────────────┐
│ /component-lifecycle --migrate │
└─────────────┬───────────────────┘

┌─────────────▼───────────────────┐
│ Phase 6a: PREFLIGHT │
│ - Verify source exists │
│ - Verify target repo exists │
│ - Check for conflicts │
│ - Show migration plan │
└─────────────┬───────────────────┘

┌─────────────▼───────────────────┐
│ Phase 6b: COPY │
│ - Copy files to target repo │
│ - Preserve directory structure│
│ - Update import paths │
└─────────────┬───────────────────┘

┌─────────────▼───────────────────┐
│ Phase 6c: STUB │
│ - Create redirect stubs │
│ - Apply stub template │
│ - Validate stub frontmatter │
└─────────────┬───────────────────┘

┌─────────────▼───────────────────┐
│ Phase 6d: REGISTRY │
│ - Update framework-registry │
│ - Update activation-status │
│ - Update component-counts │
└─────────────┬───────────────────┘

┌─────────────▼───────────────────┐
│ Phase 6e: VERIFY │
│ - Validate stubs discoverable │
│ - Validate registries updated │
│ - Run stub validation hook │
└─────────────┬───────────────────┘

┌─────────────▼───────────────────┐
│ Phase 5: CONTEXT (/cx) │
│ - Log migration in session │
└─────────────────────────────────┘

Components to Create

1. Migration Execution Script (NEW)

Path: scripts/component-migration.py Type: Script Purpose: Executes component relocation: copies files, creates stubs, updates registries

scripts/component-migration.py \
--type skill \
--name pdf-to-markdown \
--to coditect-research-continuum \
--target-path src/pipeline/ \
--reason "Product code moved to dedicated product repository"

Capabilities:

  • Discover all files belonging to a component (by type + name)
  • Copy files to target repo (within rollout-master tree)
  • Create redirect stubs with standardized frontmatter
  • Update framework-registry.json (status → relocated)
  • Update component-activation-status.json (status → relocated)
  • Update component-counts.json (decrement active, increment relocated)
  • Batch mode for multi-component migration
  • Dry-run mode for previewing changes
  • Rollback capability (undo stubs, restore originals from git)

2. Stub Validation Hook (NEW)

Path: hooks/validators/stub-relocation-validator.py Type: Hook (PreToolUse:Write/Edit) Purpose: Validates that any file with status: relocated has all required frontmatter fields

Required fields:

  • status: relocated or status: deprecated
  • relocated_to (required if relocated)
  • relocated_date (ISO date)
  • relocated_path (path in target repo)
  • original_path (path in source repo)
  • reason (human-readable explanation)

3. Migration Workflow Definition (NEW)

Path: docs/workflows/WF-component-migration.md Type: Workflow Purpose: Orchestrates the full component migration lifecycle

Phases:

  1. PREFLIGHT — Validate source, target, conflicts
  2. COPY — Transfer files to target repository
  3. STUB — Create redirect stubs in source
  4. REGISTRY — Update all framework registries
  5. VERIFY — Validate stubs and registries
  6. CONTEXT — Log migration to session

4. Stub Template (NEW)

Path: templates/components/stub-relocated.md Type: Template Purpose: Standard template for redirect stub components

5. Migration Preflight Extension (EXTEND)

Path: commands/migration-preflight.md (existing) Type: Command (extend) Purpose: Add --component-relocation mode to existing preflight command

New checks:

  • Target repo exists and is accessible
  • Component files discoverable in source
  • No conflicts in target
  • Registry entries exist for component

Component Summary

#ComponentTypeActionPriorityEffort
1scripts/component-migration.pyScriptCREATEP18-12h
2hooks/validators/stub-relocation-validator.pyHookCREATEP12-4h
3docs/workflows/WF-component-migration.mdWorkflowCREATEP12-3h
4templates/components/stub-relocated.mdTemplateCREATEP11h
5commands/migration-preflight.mdCommandEXTENDP22-3h
6commands/component-lifecycle.mdCommandDONE (v1.1.0)Done
7commands/component-create.mdCommandDONE (v1.1.0)Done

Total new effort: ~15-23 hours Already done: component-lifecycle + component-create updated


Immediate Next Steps

  1. Create scripts/component-migration.py — the core execution engine
  2. Create hooks/validators/stub-relocation-validator.py — ensures stub quality
  3. Create docs/workflows/WF-component-migration.md — workflow orchestration
  4. Create templates/components/stub-relocated.md — stub template
  5. Register and activate all new + updated components
  6. Execute first migration: pdf-to-markdown → coditect-research-continuum

  • Code Migration Analysis: internal/analysis/research-continuum/research-continuum-code-migration-analysis-2026-02-11.md
  • ADR-174: internal/architecture/adrs/ADR-174-research-continuum-agentic-knowledge-infrastructure.md
  • Vision Document: internal/analysis/research-continuum/CODITECT-Research-Continuum-Vision-Document.md
  • Migration Safety Patterns: skills/migration-safety-patterns/SKILL.md