# Lilith stub-target audit (V1-P2-2500)

Audit produced by running the §2.6 mandatory stub-indicator regex
(`scripts/stub-indicator-scan.sh`) plus the broader CLAUDE.md scan
(`(would|will) (use|call|invoke|fetch|implement|need|require)`,
`in production[,:]`, `in a (real|full) (implementation|integration)`,
`simulate`, `not yet implemented`, `TODO:`, `FIXME:`, `HACK:`, `placeholder`,
`hardcoded`, `hard-coded`, `\bfake\b`) over `apps/lilith/` and `libs/lilith/` on
**2026-05-04**.

**Scope.** Production source (`*.ts`, `*.tsx`) under `apps/lilith/` (84 service
apps plus `web`, `mobile`, `desktop`, `bff`, `cli`, `contracts`, `shared`) and
`libs/lilith/` (22 packages including `service-lib`, `fastify-core`, `vectordb`,
`database`, `cache`, etc.). Excluded: `node_modules/`, `dist/`, `*.test.ts`,
`*.spec.ts`, `*.stories.tsx`, `locales/` directories (i18n strings), and lines
already marked `// stub:legitimate <reason>`.

The strict pre-commit scan
(`scripts/stub-indicator-scan.sh apps/lilith/ libs/lilith/`) returns **exit 0**
for both `--mode=stubs` and `--mode=all` (which adds the silent-`Math.random()`
check) — the scanner's allow-list has already absorbed the historical Lilith
hits.

## Counts

| Bucket                                          | Files | Line hits |
| ----------------------------------------------- | ----- | --------- |
| Strict scan (`stub-indicator-scan.sh` defaults) | 0     | 0         |
| Strict scan (`--mode=all`, includes random)     | 0     | 0         |
| Broader CLAUDE.md grep (production source)      | 306   | 978       |

Density distribution of the broader-grep hits across files:

| Density (hits per file) | File count |
| ----------------------- | ---------- |
| ≥10                     | 4          |
| 5–9                     | 42         |
| 2–4                     | 109        |
| 1                       | 151        |

## Explicit V1-P2-2501..2503 targets

These are called out explicitly in OSHUN_V1_TODOS_P2.md and have dedicated
tasks; the per-file checklist below also includes them so V1-P2-2504 can walk
the full list in one pass.

- **V1-P2-2501** — `apps/lilith/svc-ai/src/app.impl.ts:2191` —
  `score: Math.random() * 0.3 + 0.7`. Real fake AI score; replace with actual
  model output. Adjacent random sites at lines 1357, 1465, 1470, 1473
  (response-time and confidence fakes) should be wired in the same pass.
- **V1-P2-2502** —
  `apps/lilith/mobile/src/services/knowledge/ConceptExplorationService.ts:1232`
  — `relevance_score: Math.random() * 0.5 + 0.5`. Real fake relevance; replace
  with embedding cosine similarity against the concept vector.
- **V1-P2-2503** — `apps/lilith/svc-metaverse/` Math.random uses (236 total,
  across 8 production files plus tests). Bucketed under V1-P2-0353's allow-list
  policy:
  - **Allow-list as procedurally generative**: CosmicSpaces,
    UnderwaterConsciousness, ProceduralWorldGenerator, AstralProjection,
    EnergyFieldVisualization, WeatherSystem, AssetLibrary, TerrainGenerator.
    These intentionally synthesize procedural worlds and energy field
    perturbations — Math.random is the API surface, not a stub.
  - **Replace**: any Math.random hits found in service routing, ID generation,
    or metric reporting elsewhere in svc-metaverse should use `randomUUID()` /
    `randomInt()` from `node:crypto`.

## High-density files (≥10 hits) — sweep first

- [ ] `apps/lilith/svc-multi-region-resilience/src/app.ts` — 37 hits. The
      service is an explicit in-process simulator (lines 34-45 ship a production
      guard refusing to start with `NODE_ENV=production` unless
      `MULTI_REGION_BACKEND=real` is also set). Most hits are legitimate — the
      simulator vocabulary is the API surface — but the `simulate*Failover()`
      factory functions and per-region health score generators should carry
      explicit `// stub:legitimate     simulator-by-design` annotations so the
      broader regex stops flagging them.
- [ ] `apps/lilith/web/src/features/publishing/PresentationGeneration.tsx` — 35
      hits. Mostly UI copy ("simulate the export...") for meditation-author
      tooling. Real stub if the export pipeline is meant to actually produce
      presentations; investigate the generate/export flow before classifying.
- [ ] `apps/lilith/web/src/accessibility/visual/color-blind.ts` — 11 hits.
      Per-mode `simulate*Vision()` color transformations are the core API of a
      colorblind-simulator module — **legitimate domain**, annotate.
- [ ] `libs/lilith/service-lib/comfyui/workflow-builder.ts` — 11 hits. ComfyUI
      image-generation workflow construction. Inspect: many hits are likely
      "TODO: support workflow X" comments; classify individually.

## Medium-density files (5–9 hits) — 42 files

Top entries (full list in `/tmp/lilith-counts.txt` from the audit run):

- [ ] `apps/lilith/svc-ai/src/app.impl.ts` (covers V1-P2-2501)
- [ ] `apps/lilith/web/src/features/publishing/AcademicFormatting.tsx`
- [ ] `apps/lilith/web/src/components/SeamlessAuthManager.tsx`
- [ ] `apps/lilith/mobile/src/components/meditation/JournalEntry.tsx`
- [ ] `apps/lilith/web/src/features/workspace/NoteEditor.tsx`
- [ ] `apps/lilith/web/src/features/references/CitationImport.tsx`
- [ ] `apps/lilith/web/src/features/community/ScholarProfiles.tsx`
- [ ] `apps/lilith/svc-content/src/meditations/meditation-repository.ts`
- [ ] `apps/lilith/svc-ai/src/image-moderation/patterns.ts`
- [ ] `apps/lilith/mobile/src/screens/AuthScreen.tsx`
- [ ] `apps/lilith/mobile/src/components/molecules/Select.tsx` (UI input
      `placeholder` attribute — legitimate)
- [ ] `apps/lilith/desktop/src/components/CapturePanel.tsx`
- [ ] `apps/lilith/web/src/features/zettelkasten/BlockEditor.tsx`
- [ ] `apps/lilith/web/src/features/community/QASystem.tsx`
- [ ] `apps/lilith/web/src/features/community/DiscussionForums.tsx`
- [ ] `apps/lilith/web/src/features/collaboration/PeerReview.tsx`
- [ ] `apps/lilith/svc-voice-pipeline/src/simulation-routes.ts` (filename
      announces the simulation purpose — legitimate)
- [ ] `apps/lilith/contracts/scripts/deployment-security.ts`
- [ ] `apps/lilith/web/src/features/workspace/Bookmarks.tsx`
- [ ] `apps/lilith/web/src/features/collaboration/ResearchGroups.tsx`
- [ ] `apps/lilith/web/src/components/ProgressTracker.tsx`
- [ ] `apps/lilith/svc-transaction-manager/src/app.ts`
- [ ] `apps/lilith/svc-operational-excellence/src/health-monitor.ts`
- [ ] `apps/lilith/svc-notification/src/dispatch/providers/mock.ts` (filename
      announces the mock purpose — legitimate)
- [ ] `apps/lilith/svc-media/src/asset-repository.ts`
- [ ] `apps/lilith/svc-ai/src/social-community/stream-transport.ts`
- [ ] `apps/lilith/contracts/scripts/deploy-multichain.ts`
- [ ] (16 additional files at 5 hits each — see `/tmp/lilith-counts.txt`)

## Low-density files (2–4 hits) — 109 files

Spread across web features, mobile services, BFF utilities, and many backend
services. The triage cost is roughly proportional to the per- file hit count;
address the high-density files first and the long tail becomes mostly UI
`placeholder` attributes plus occasional "in production..." comments to rewrite.

## Single-hit files — 151 files

Mostly UI input `placeholder` attributes (HTML attribute, not a stub marker) and
a long tail of one-off "in production..." comments. Many of these will resolve
with a single `// stub:legitimate` annotation or a one-line comment rewrite.

## Per-directory hot-spots

Hits per leaf directory (top 10):

| Directory                                        | Files |
| ------------------------------------------------ | ----- |
| `apps/lilith/web/src/components`                 | 12    |
| `apps/lilith/svc-metaverse/src/ai`               | 7     |
| `apps/lilith/web/src/features/workspace`         | 6     |
| `apps/lilith/web/src/features/collaboration`     | 6     |
| `apps/lilith/web/src/components/ui`              | 6     |
| `apps/lilith/contracts/scripts`                  | 6     |
| `apps/lilith/web/src/features/publishing`        | 5     |
| `apps/lilith/svc-ai/src/multi-platform-delivery` | 5     |
| `apps/lilith/svc-ai/src`                         | 5     |
| `apps/lilith/web/src/features/zettelkasten`      | 4     |

## Summary of action types

| Class                          | Approximate count |
| ------------------------------ | ----------------- |
| Real stubs to wire             | ~60–80            |
| Legitimate domain — annotate   | ~150              |
| Legitimate UI input attributes | ~80               |
| Already-correct, comment-only  | ~50               |

V1-P2-2504 will iterate this list, classifying each entry on first read and
either wiring the implementation, adding a `// stub:legitimate <reason>`
annotation, or rewriting the comment to honestly describe the chosen
implementation. The strict scanner's continued green status (`exit 0`) is the
source-of-truth signal for completion per CLAUDE.md project policy.
