Skip to content

Add context migration for version upgrades#19

Open
th3nate wants to merge 1 commit intoromiluz13:mainfrom
th3nate:feature/context-migration
Open

Add context migration for version upgrades#19
th3nate wants to merge 1 commit intoromiluz13:mainfrom
th3nate:feature/context-migration

Conversation

@th3nate
Copy link
Copy Markdown

@th3nate th3nate commented Mar 20, 2026

Summary

  • Adds automatic context migration that preserves accumulated project knowledge (patterns, decisions, learnings, verification evidence) when STATE_VERSION bumps (e.g., v10 → v11)
  • Runs on first SessionStart after upgrade, merging content from all previous version directories (including legacy root-level files) into the new version
  • Idempotent via .migrated marker file; section-aware merge with bullet-level dedup; atomic writes with .pre-migration.bak backups

Changes

File Change
plugins/cc10x/scripts/cc10x_hooklib.py Added parse_markdown_sections(), extract_bullets(), normalize_bullet() utilities
plugins/cc10x/scripts/cc10x_context_migration.py New migration script — discovery, merge, dedup, marker, logging
plugins/cc10x/hooks/hooks.json Added startup-only SessionStart hook before existing context injection

Merge strategy per file

  • patterns.md — full section merge (all 10 contract headings)
  • activeContext.md — selective (Decisions + Learnings only; ephemeral sections skipped)
  • progress.md — selective (Completed + Verification only)

Test plan

  • Unit tests for parse_markdown_sections, extract_bullets, normalize_bullet
  • End-to-end migration test with legacy + v9 sources merging into v10
  • Dedup verification (overlapping bullets across sources merged once)
  • Idempotency verification (re-run finds 0 pending sources)
  • Fresh install test (no sources = clean no-op exit)
  • Hook contract test (stdin JSON, exit 0, valid stdout)

🤖 Generated with Claude Code

Preserve accumulated project knowledge (patterns, decisions, learnings,
verification evidence) when STATE_VERSION bumps by merging content from
previous version directories into the new one on first SessionStart.

- Add parse_markdown_sections, extract_bullets, normalize_bullet to hooklib
- New cc10x_context_migration.py with section-aware merge, dedup, idempotency
- SessionStart hook in hooks.json triggers migration before context injection

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant