# Tasks — Migrate @suaveplan/profiler to genesis ## 0. Pre-flight (non-negotiable) - [x] 0.1 `git status` clean inside `.claude/worktrees/agent-a53dffba816b6eb95` - [x] 0.2 Account for every worktree returned by `git worktree list` (this agent's worktree + main checkout) - [x] 0.3 Confirm `MANIFEST.md` package count matches `find packages -maxdepth 3 -name package.json` - [x] 0.4 §0a Sync: `git merge-base --is-ancestor 56c1fae5078a5afff119847b4b96d86c78668f02 HEAD` reports true after `git fetch /home/paul/web/genesis genesis && git merge FETCH_HEAD --no-edit` ## 1. Spec authoring - [x] 1.1 Read `../suaveplan/enterprise/profiler.md` end-to-end - [x] 1.2 Read `openspec/AGENTS.md` Sections 13 and 14 - [x] 1.3 Draft `proposal.md` with `## Source mapping` table - [x] 1.4 Draft `specs/profiler/spec.md` with `## ADDED Requirements` and `**Verified by:**` lines ## 2. Implementation - [x] 2.1 `src/types/` — shared types module - [x] 2.2 `src/error-codes/` — `PROFILER_CODES` registry + `ProfilerError` - [x] 2.3 `src/telemetry/` — OTel meter, counters, histograms - [x] 2.4 `src/profiler/` — `Profiler` class with `Clock`-injection - [x] 2.5 `src/sampler/` — `Sampler` with `TimersLike` + injectable memory-probe - [x] 2.6 `src/memory/` — `MemoryProfiler` with injectable `HeapCapture` - [x] 2.7 `src/bottleneck/` — `BottleneckDetector` - [x] 2.8 `src/comparison/` — `ProfileComparator` - [x] 2.9 `src/flamegraph/` — `FlameGraphGenerator` - [x] 2.10 `src/reporter/` — `ProfileReporter` - [x] 2.11 `src/otel/` — `OtelExporter` with injectable `fetch` + crypto-rng - [x] 2.12 `src/index.ts` — explicit named re-exports ## 3. Tests - [x] 3.1 Unit tests at `src//.test.ts` for every module - [x] 3.2 100/100/100/100 coverage gate met (istanbul) - [x] 3.3 Every `it(...)` carries `{ timeout: 5000 }` - [x] 3.4 All tests import from `@suaveplan/testing/runner` ## 4. Documentation - [x] 4.1 Sibling `.md` for every implementation `.ts` (≥200 words, basic + advanced) - [x] 4.2 `README.md` at package root ## 5. Pre-archive verification - [ ] 5.1 `bunx turbo lint typecheck test --filter=@suaveplan/profiler` green - [ ] 5.2 `bunx turbo test:coverage --filter=@suaveplan/profiler` 100/100/100/100 - [ ] 5.3 `bunx turbo build --filter=@suaveplan/profiler` green - [ ] 5.4 `bun scripts/lint/check-feature-layout.ts | grep profiler` — empty (no violations) - [ ] 5.5 `bun scripts/folder-reorg/generate-manifest.ts` refreshes MANIFEST.md ## 6. Archive (post-merge — orchestrator's job) - [ ] 6.1 Fold spec delta into `openspec/specs/profiler/spec.md` - [ ] 6.2 Move `openspec/changes/profiler/` → `openspec/archive/-profiler/`