adobe / adobe/spacecat-api-service
Add an entry_channel dimension to prompts (onboarding-seed vs recommendation-accept vs manual vs CSV)
- Dominant language
- JavaScript
- Stars
- 10
- Forks
- 15
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 150
Description
**Severity:** 🟠 provenance
**Group F — provenance**
## Problem
We can't cleanly tell *how* a library prompt got there. In particular **onboarding-seeded and recommendation-accepted prompts are identical in the data** — both `origin:'ai'` with a generator `source` — so "the customer actively accepted this" can't be separated from "we pre-loaded it at onboarding."
## What already IS distinguishable (verified)
- `origin` (`ai`|`human`) — derived from the request principal at the write boundary (`src/support/prompts-storage.js` `deriveOrigin`), so pipeline-generated vs customer-authored is reliable.
- `source` registry (`src/support/prompt-sources.js:35-61`): generators `gsc/base_url/citation_attempt/strategy-chat/semrush/synthetic_personas`; `config` (manual UI create, the default); **`sheet` (CSV import)**. So CSV=`sheet`, manual≈`config`, recommendation-source=a TRACKED generator.
## What's NOT distinguishable (the gap)
1. **onboarding-seed vs recommendation-accept** — same `origin`+`source`; there is no onboarding marker.
2. `source` conflates the **generator** (which pipeline wrote the text) with the **entry channel** (how it entered the library) — a `semrush` prompt could have arrived via onboarding, a card-accept, or a re-import.
## Implementation
Add an `entry_channel` (a.k.a. `acquisition`) column, orthogonal to `origin` and `source`: `onboarding_seed | recommendation_accept | manual_author | csv_import`. Enforce/accept it at the prompts write boundary (`prompts-storage.js`), and have each caller set it — recommendation accept (project-elmo-ui `useAddRecommendationPrompts.ts:282-291`), CSV import, manual add, and the onboarding seeder (tag seeds explicitly).
## Retrieval impact
Today acceptance can't be sliced by "actively chosen vs pre-loaded"; onboarding prompts inflate the "accepted" library because they're indistinguishable from real accepts. Interim reconstruction (imperfect): CSV≈`source:'sheet'`, manual≈`origin:human & source:'config'`, recommendation-source≈`origin:ai & source∈TRACKED` — but onboarding-vs-accept stays unrecoverable.
## Definition of done
Every prompt records how it entered the library; acceptance metrics can exclude onboarding seeds and isolate genuine recommendation accepts.
---
Related epic: adobe/project-elmo-ui#3108.
Contributor guide
Research direction
Start at the prompts write boundary in src/support/prompts-storage.js, including deriveOrigin, then trace the callers named in project-elmo-ui's useAddRecommendationPrompts.ts and the CSV, manual-add, and onboarding-seeder paths. Check src/support/prompt-sources.js:35-61 for existing source handling. Done means every prompt records one of the four entry channels and acceptance metrics can exclude onboarding seeds and isolate recommendation accepts.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- api, backend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 65/100