Adapt architecture

From pjt222/agent-almanac · View interactive version

Adapt architecture is an AI agent skill from the GitHub repository pjt222/agent-almanac. Execute structural metamorphosis using strangler fig migration, chrysalis phases, and interface preservation. Covers transformation planning, parallel running, progressive cutover, rollback design, and post-metamorphosis stabilization for system architecture evolution. Use when assess-form has class

How to use this skill

Skill file

Adapt Architecture

Execute structural metamorphosis — transforming a system's architecture from its current form to a target form while maintaining operational continuity. Uses strangler fig migration, chrysalis phases, and interface preservation to ensure the system never stops functioning during transformation.

When to Use

Inputs

Procedure

Step 1: Design the Transformation Blueprint

Plan the metamorphosis path from current form to target form.

  1. Map the transformation as a sequence of intermediate forms:
  1. Identify the transformation seams:
  1. Choose the metamorphosis pattern:
  1. Design the interface preservation layer:
Metamorphosis Patterns:
┌───────────────┬───────────────────────────────────────────────────┐
│ Strangler Fig │ New code intercepts routes one by one;            │
│               │ old code handles everything else until replaced   │
│               │ ┌──────────┐                                     │
│               │ │ Old ████ │ → │ Old ██ New ██ │ → │ New ████ │  │
│               │ └──────────┘                                     │
├───────────────┼───────────────────────────────────────────────────┤
│ Chrysalis     │ Wrap old system in new interface; replace         │
│               │ internals while external shell stays stable       │
│               │ ┌──────────┐     ┌──[new]───┐     ┌──[new]───┐  │
│               │ │ old core │ → │ old core │ → │ new core │  │
│               │ └──────────┘     └──────────┘     └──────────┘  │
├───────────────┼───────────────────────────────────────────────────┤
│ Budding       │ New system runs in parallel; traffic shifts       │
│               │ ┌──────┐ ┌──────┐     ┌──────┐ ┌──────┐         │
│               │ │ Old  │ │ New  │  →  │ Old  │ │ New  │         │
│               │ │ 100% │ │  0%  │     │  0%  │ │ 100% │         │
│               │ └──────┘ └──────┘     └──────┘ └──────┘         │
└───────────────┴───────────────────────────────────────────────────┘

Got: A transformation blueprint showing intermediate forms, seams, the chosen metamorphosis pattern, and the interface preservation strategy. Each step is concrete and testable.

If fail: If no clean seam can be found, the system may need preliminary dissolution (see dissolve-form) to create seams before transformation. If the intermediate forms aren't operationally viable, the transformation steps are too large — decompose into smaller increments.

Step 2: Build the Scaffolding

Construct the temporary infrastructure that supports metamorphosis.

  1. Create the anti-corruption layer:
  1. Set up parallel running infrastructure:
  1. Establish rollback checkpoints:
  1. Build the validation harness:

Got: Scaffolding infrastructure (anti-corruption layer, parallel running, rollback, validation) is in place before any transformation begins. The scaffolding itself is tested and verified.

If fail: If scaffolding is too expensive, simplify: the minimum viable scaffolding is a feature flag and a rollback procedure. Anti-corruption layers and parallel running add safety but are not always necessary for smaller transformations.

Step 3: Execute Progressive Cutover

Migrate functionality from old form to new form incrementally.

  1. Order components for migration:
  1. For each component:

a. Implement the new version behind the anti-corruption layer

b. Run parallel: both old and new process the same inputs

c. Compare outputs — they should be equivalent (or the differences should be expected and documented)

d. When confident, switch traffic to the new version (feature flag flip)

e. Monitor for anomalies (increase monitoring sensitivity post-cutover)

f. After a stability period, decommission the old version of this component

  1. Maintain continuous delivery throughout:

Got: Functionality migrates component by component with validation at each step. The system is always operational. Each cutover builds confidence for the next.

If fail: If parallel running reveals discrepancies, the new implementation has a bug — fix it before cutting over. If a cutover causes performance degradation, the new component may need optimization or the anti-corruption layer is adding too much overhead. If the team loses confidence mid-migration, pause and stabilize — a half-migrated system in a known state is far better than a rushed full migration.

Step 4: Manage the Chrysalis Phase

Navigate the most vulnerable period — when the system is between forms.

  1. Acknowledge the chrysalis reality:
  1. Chrysalis discipline:
  1. Mid-chrysalis assessment:
  1. Protect the chrysalis:

Got: The chrysalis phase is managed as a deliberate, time-bounded period with increased discipline and monitoring. The team understands that temporary complexity is the cost of safe transformation.

If fail: If the chrysalis phase drags on too long, the hybrid state becomes the new normal — which is worse than either old or new. Set a time limit. If the limit is reached, either accelerate the remaining migration or accept the hybrid state as the "new form" and stabilize it.

Step 5: Complete Metamorphosis and Stabilize

Finish the transformation and remove scaffolding.

  1. Final cutover:
  1. Remove scaffolding:
  1. Post-metamorphosis stabilization:
  1. Retrospective:

Got: The transformation is complete. The system operates in its new form. Scaffolding is removed. Documentation is updated. The team has captured learnings for future transformations.

If fail: If the new form is unstable after cutover, maintain the rollback path and continue stabilization. If stabilization takes more than the planned period, there may be a design issue in the new architecture — consider whether targeted fixes or a partial rollback of the most problematic component is appropriate.

Validation

Pitfalls

Related Skills

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.