OpenClaw to Hermes Migration (4/13) — Code Review That Identified 8 Assets Worth Migrating
Average 175 LOC, Zero External Dependencies, One File Accounting for 30% of Migration Value
ํต์ฌ ์์ฝ
- Line-by-line review of preserve (๐) candidates: 8 preserved, 2 partially preserved, 1 discarded.
- Migration difficulty is low — average 175 LOC, standard library only, zero external dependencies.
user-pattern-stage.pyalone accounts for approximately 30% of the migration's total value. No equivalent exists in Hermes.
This post covers asset review techniques for legacy → new platform migrations: how to classify assets as preserve/partially-preserve/discard using LOC, external dependency count, and functional replaceability as axes, and the pattern of reducing migration scope through LOC-based triage.
Prerequisites for Asset Review
Before entering the code review, migration targets, method, and boundaries must be fixed — otherwise classification decisions become unstable. The premises for this migration are as follows.
- Strategy: Strangler Fig + Subset Migration. Progressively encircle the original while migrating only a subset.
- Memory backend: SQLite + Python library (
memcore). No separate daemon. - Folder boundary:
~/Hermes/and~/Projectare separate. The original is locked as a read-only backup. - Agent roles:
Hermes Manager(new) andOpenClaw Manager(backup-only) are separated. - Cutover model: Dual execution → verification → cutover.
These premises are what make the question "is it worth migrating?" meaningful, as opposed to merely "can it be migrated?"
Classification Criteria
Each asset is evaluated on three axes.
- LOC — Primary indicator of migration cost.
- External dependencies — Standard library only, or external packages attached?
- Replaceability on the new platform — Discard if equivalent functionality already exists; preserve if it does not; partially preserve if only some overlap exists.
๐ Preserve — 8 Assets
| File | LOC | Migration Form | Value |
|---|---|---|---|
| user-pattern-stage.py | 260 | memcore.dialectic module |
Highest. U-tag 3-phase, anti-bias guard |
| confidence-decay.py | 82 | memcore cron tick |
opinions confidence decay 0.02 per tick, remove if <0.30 |
| topics-validate.py | 131 | memcore consistency check |
bank ↔ topics consistency |
| topics-expand.py | 186 | memcore auto-registration |
auto-registers new files |
| bank-lint.py | 176 | memcore validator |
Retain tag format validation |
| entity-audit.py | 152 | memcore stale detection |
30-day stale, equivalent via SQLite timestamp query |
| docs-snapshot.sh | 141 | Hermes cron payload | docs change detection |
| release-check.sh | 66 | Hermes cron payload | version change detection |
The highest-value asset is user-pattern-stage.py. It separates hypotheses about the user into three stages — observe → hypothesize → validate — with an anti-bias guard that prevents assertions before validation is complete. The approach is inspired by Honcho-class techniques but reimplemented for the target data model. The new platform has no equivalent dialectic structure. This single file represents approximately 30% of the justification for the migration itself.
๐ก Partially Preserve — 2 Assets
| File | LOC | Handling |
|---|---|---|
| bank-size-watch.py | 176 | Weakened by SQLite transition. Extract only the MemTree split logic portion |
| proactive-exception-alerts.py | 1310 | Too large. Extract only the 11 escalation-reason classification logic (~300 LOC); delegate alert routing and context collection to Hermes gateway/hook |
proactive-exception-alerts.py is a textbook case of partial preservation. Opening the 1310 LOC reveals that the classification logic is approximately 300 lines; the remainder is delivery infrastructure. Since the new platform already provides delivery infrastructure, only the classification logic is extracted and migrated, while the infrastructure is delegated. The result is a reduction from 1310 → 300 LOC, simultaneously lowering both migration cost and maintenance debt.
This pattern is reusable: when a large script mixes "classification core / delivery shell," and the new platform provides the shell, extract only the core. In many cases, 70–80% of LOC turns out to be shell.
๐ Discard — 1 Asset
| File | LOC | Replacement |
|---|---|---|
| heartbeat-tick.py | 262 | Hermes cron + on_turn_start hook provides 100% coverage |
Assets with a confirmed 1:1 replacement path are not preserved. They are terminated with only a backup retained. The discard criterion is "100% functional coverage + equivalent operational model."
Measurements and Patterns
- Why migration difficulty is low: Average 175 LOC, standard library only, zero external dependencies. Replacing the common I/O layer (
lib_common.py) withmemcore.iois sufficient for most files to operate as-is. - Effort estimate: The code migration for the 8 assets itself takes 1–2 days. The dominant cost is not code — it is verification (testing and dual execution).
- Concentration of value: Among 11 candidates, a single file (
user-pattern-stage.py) accounts for approximately 30% of total value. Prioritizing review time on this file yields the best efficiency. - Dietable assets: One file can be reduced from 1310 → 300 LOC. There are cases where migration simultaneously functions as debt reduction.
Limitations and Open Questions
- LOC is only an approximation of migration cost. Files with high state dependency carry large verification costs even at low LOC.
- The "30% value" estimate is a qualitative judgment based on functional overlap and replaceability. Converting it to a quantitative metric would require actual call frequency data and a dependency graph.
- Having chosen Strangler Fig, observing data inconsistencies during the dual-execution period is the next task.
Applicability
This review pattern is reusable under the following conditions.
- Legacy code is spread across dozens of scripts and carries few external dependencies.
- The new platform provides common infrastructure such as delivery, scheduling, and I/O — making "extract the core only" separation feasible.
- A decision structure exists that allows confidently discarding assets with 100% replaceability.
The next post covers reclassifying these 11 assets and remaining functionality into 11 categories, and scheduling them across a 5-week migration timeline.
Series overview: Series index
๋๊ธ
๋๊ธ ์ฐ๊ธฐ