@hippo-digital/hippocampus 2.3.0 → 2.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,46 @@
1
1
  # Changelog
2
2
 
3
+ ## 2.4.0
4
+
5
+ Room for what a team's insight workbook already holds. Promoting the NCRS
6
+ Optometry Alpha insight library showed most of a well-kept workbook fits the
7
+ model as it stands - feedback as evidence, key insights as insights, needs as
8
+ needs - but its richest layer did not: user stories with their design
9
+ questions, how much a finding matters, and the IDs the team works from in
10
+ Jira. Carried as extra fields they produced 336 "unrecognised field" warnings.
11
+ All of it is now part of the schema. Every change is optional and additive, so
12
+ data written by 2.4.0 still loads in 2.3.0.
13
+
14
+ - **`reference` on every record type** except relationships. The identifier a
15
+ record already has where it came from - a Jira key, or a workbook row such as
16
+ `FB-013` or `US-010` - so a decision stays traceable to the ticket, and an
17
+ importer can find a record it wrote before and update it instead of adding a
18
+ second copy. Needs already had it; now everything does. The evidence page
19
+ shows it next to the source type.
20
+ - **`impact` on evidence and insights**: `critical`, `high`, `medium`, `low` or
21
+ `unknown`. How much a finding matters, kept apart from `confidence`, which is
22
+ how sure we are of it. They disagree often enough to matter: the most severe
23
+ item in the Optometry library is critical impact on a repeated signal, and
24
+ with confidence alone it read as medium. The evidence and insight pages show
25
+ both.
26
+ - **`story` on needs**: `{ reference, text, designQuestion, acceptanceCriteria }`,
27
+ with only `text` required. Stories are one per need in the workbooks teams
28
+ keep, so a story lives on its need rather than as a record type of its own -
29
+ no new page, relationship type or validator - and the need page shows it,
30
+ design question and acceptance criteria included. The design question is the
31
+ reason to carry stories at all.
32
+ - **`Not yet researched`**, exported as `UNRESEARCHED`, is the value to write in
33
+ a user's `responsibilities` or `accessNeeds` when nobody has researched them.
34
+ Both fields still need at least one entry: relaxing that would let data
35
+ written by this version break the previous one, which a minor release must
36
+ not do. `validate` now counts users carrying the marker as a coverage note -
37
+ "6 of 20 users have access needs not yet researched" - so the gap is reported
38
+ every time instead of passing as a finding. The `ingest-user-personas` skill
39
+ uses it.
40
+
41
+ The need page also renders list-valued facts as a list, which acceptance
42
+ criteria needed.
43
+
3
44
  ## 2.3.0
4
45
 
5
46
  `hippocampus mcp` serves the knowledge base to agents over MCP, read-only, so an
@@ -85,6 +85,8 @@ Each user includes:
85
85
  - access needs
86
86
  - service context
87
87
 
88
+ Both `responsibilities` and `accessNeeds` need at least one entry. When nobody has researched one of them yet - common when a workbook names a user group before persona work reaches it - write exactly `Not yet researched` (exported as `UNRESEARCHED` from `lib/schema.js`). Do not invent an entry: a guessed access need reads as a finding. `npx hippocampus validate` counts users carrying the marker and reports them as coverage notes, so the gap stays visible.
89
+
88
90
  ### User needs
89
91
 
90
92
  File: `hippocampus/source/needs.json`
@@ -101,6 +103,19 @@ Needs should be specific enough to influence journeys and screens.
101
103
 
102
104
  A need may optionally carry a `reference` (e.g. an external ticket ID such as a Jira key) when it was imported from a source that already tracks it that way.
103
105
 
106
+ A need may carry the user story derived from it, as an optional `story`:
107
+
108
+ ```json
109
+ "story": {
110
+ "reference": "US-010",
111
+ "text": "As a hospital eye service triage clinician, I want referrals to include...",
112
+ "designQuestion": "What minimum referral data standard should be required before submission?",
113
+ "acceptanceCriteria": ["Differentiates mandatory from optional fields", "..."]
114
+ }
115
+ ```
116
+
117
+ Only `text` is required inside it. Stories are one per need in the workbooks teams keep, so a story lives on its need rather than as a record of its own; the need page shows it, with its design question and acceptance criteria.
118
+
104
119
  ### Scenarios
105
120
 
106
121
  File: `hippocampus/source/scenarios.json`
@@ -190,6 +205,8 @@ Each evidence item includes:
190
205
 
191
206
  Use `sourcePath` when the evidence comes from a copied artefact in the repo.
192
207
 
208
+ Evidence and insights may carry an optional `impact`: `critical`, `high`, `medium`, `low` or `unknown`. It answers how much the finding matters, which is a different question from `confidence` - how sure we are of it. Keep both: an item can be critical and only weakly evidenced, and recording confidence alone makes it read as middling.
209
+
193
210
  Do not invent evidence. If a claim is not evidenced, add an assumption instead.
194
211
 
195
212
  ### Decisions
@@ -217,6 +234,10 @@ Use assumptions when:
217
234
  - a service rule is plausible but unconfirmed
218
235
  - the spike makes a deliberate simplification
219
236
 
237
+ ### References
238
+
239
+ Every record type except relationships may carry an optional `reference`: the identifier it already has where it came from, such as a Jira key or a workbook row (`FB-013`, `US-010`). It keeps a decision traceable to the ticket a team works from, and gives an importer a stable key to find a record it wrote before and update it rather than add a second copy. It is not an `id`: ids stay kebab-case and never change; a reference is whatever the source system uses.
240
+
220
241
  ## Relationship Map
221
242
 
222
243
  ```text
@@ -149,12 +149,23 @@ function createHippocampusRouter ({ basePath, knowledgeStore, paths }) {
149
149
  // connects to is resolved once by getRecordDetail and rendered the same way
150
150
  // on every page, so a reader learns one layout rather than three.
151
151
  const FACTS = {
152
- Need: (r) => [
153
- { key: 'Priority', value: r.priority },
154
- { key: 'Reference', value: r.reference }
155
- ],
152
+ Need: (r) => {
153
+ const story = r.story || {}
154
+ return [
155
+ { key: 'Priority', value: r.priority },
156
+ { key: 'Reference', value: r.reference },
157
+ // The story's design question is the reason to carry stories at all,
158
+ // so it sits next to the story rather than below the connections.
159
+ { key: 'User story', value: story.text },
160
+ { key: 'Story reference', value: story.reference },
161
+ { key: 'Design question', value: story.designQuestion },
162
+ { key: 'Acceptance criteria', list: story.acceptanceCriteria }
163
+ ]
164
+ },
156
165
  Insight: (r) => [
157
166
  { key: 'Confidence', value: r.confidence },
167
+ { key: 'Impact', value: r.impact },
168
+ { key: 'Reference', value: r.reference },
158
169
  { key: 'Summary', value: r.summary }
159
170
  ],
160
171
  Screen: (r) => [
@@ -1,4 +1,4 @@
1
- const { recordSchemas } = require('./schema')
1
+ const { recordSchemas, UNRESEARCHED } = require('./schema')
2
2
 
3
3
  const LIST_GLYPH = /^[\s\u00a0]*[\u2022\u25cf\u25aa\u25e6\u2043\u2219\u00b7\u25cb]/
4
4
 
@@ -144,6 +144,27 @@ function lintKnowledge (knowledge) {
144
144
  })
145
145
  }
146
146
 
147
+ // A user written down before anyone researched them - common when a workbook
148
+ // names a user group long before persona work reaches it. The schema still
149
+ // requires a responsibility and an access need (see UNRESEARCHED in
150
+ // schema.js), so the honest entry is that exact value, and this counts it.
151
+ // Reported per field, because "nobody has asked about their access needs" is
152
+ // the gap worth chasing, and it hides inside a user who otherwise looks done.
153
+ const unresearched = (list) => Array.isArray(list) && list.length > 0 &&
154
+ list.every((item) => String(item).trim().toLowerCase() === UNRESEARCHED.toLowerCase())
155
+ for (const [field, label] of [['accessNeeds', 'access needs'], ['responsibilities', 'responsibilities']]) {
156
+ const users = (knowledge.users || []).filter((user) => unresearched(user[field]))
157
+ if (users.length) {
158
+ infos.push({
159
+ rule: 'user-unresearched',
160
+ field,
161
+ count: users.length,
162
+ ids: users.map((user) => user.id),
163
+ message: `${users.length} of ${knowledge.users.length} users have ${label} not yet researched`
164
+ })
165
+ }
166
+ }
167
+
147
168
  const defaultPriority = (knowledge.needs || []).filter((need) => need.priority === 'medium')
148
169
  if (defaultPriority.length && knowledge.needs.length) {
149
170
  const share = Math.round((defaultPriority.length / knowledge.needs.length) * 100)
package/lib/schema.js CHANGED
@@ -4,6 +4,24 @@ const id = z.string().regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/, 'Use lowercase kebab-c
4
4
  const nonEmptyString = z.string().trim().min(1)
5
5
  const stringList = z.array(nonEmptyString).min(1)
6
6
 
7
+ // The identifier a record already has in the system it came from: a Jira key, or
8
+ // a workbook row such as "FB-013" or "US-010". It keeps a decision traceable to
9
+ // the ticket a team actually works from, and gives an importer a stable key to
10
+ // find a record it wrote earlier and update it rather than add a second copy.
11
+ const reference = nonEmptyString.optional()
12
+
13
+ // How much a finding matters - a different question from how sure we are of it,
14
+ // which is `confidence`. A finding can be critical and only weakly evidenced;
15
+ // folding the two together makes the most severe item in a log read as middling.
16
+ const impact = z.enum(['critical', 'high', 'medium', 'low', 'unknown']).optional()
17
+
18
+ // What a user record says when nobody has researched that part of it yet. The
19
+ // schema still requires at least one responsibility and one access need, because
20
+ // relaxing that would let data written by this version break the previous one.
21
+ // Writing this exact value instead is honest, and the linter counts it, so a gap
22
+ // is reported every time rather than passing as a finding.
23
+ const UNRESEARCHED = 'Not yet researched'
24
+
7
25
  const ProjectSchema = z.object({
8
26
  id,
9
27
  name: nonEmptyString,
@@ -93,7 +111,21 @@ const UserSchema = z.object({
93
111
  label: nonEmptyString,
94
112
  description: nonEmptyString,
95
113
  responsibilities: stringList,
96
- accessNeeds: stringList
114
+ accessNeeds: stringList,
115
+ reference
116
+ }).passthrough()
117
+
118
+ // A user story derived from the need it belongs to. In the workbooks teams keep,
119
+ // stories are one per need, so a story is a facet of its need rather than a record
120
+ // type of its own: it renders wherever the need does, and needs no page,
121
+ // relationship type or validator of its own.
122
+ const NeedStorySchema = z.object({
123
+ reference,
124
+ text: nonEmptyString,
125
+ // The design question the story exists to answer. For a designer it is the most
126
+ // useful part, and the part most often lost when stories become tickets.
127
+ designQuestion: nonEmptyString.optional(),
128
+ acceptanceCriteria: z.array(nonEmptyString).optional()
97
129
  }).passthrough()
98
130
 
99
131
  const NeedSchema = z.object({
@@ -102,7 +134,8 @@ const NeedSchema = z.object({
102
134
  statement: nonEmptyString,
103
135
  priority: z.enum(['high', 'medium', 'low']),
104
136
  evidenceIds: z.array(id).min(1),
105
- reference: nonEmptyString.optional()
137
+ reference,
138
+ story: NeedStorySchema.optional()
106
139
  }).passthrough()
107
140
 
108
141
  const LocationSearchSchema = z.object({
@@ -127,7 +160,8 @@ const ScenarioSchema = z.object({
127
160
  needIds: z.array(id).min(1),
128
161
  happyPath: stringList,
129
162
  edgeCases: stringList,
130
- locationSearch: LocationSearchSchema.optional()
163
+ locationSearch: LocationSearchSchema.optional(),
164
+ reference
131
165
  }).passthrough()
132
166
 
133
167
  const PainPointSchema = z.object({
@@ -162,7 +196,8 @@ const JourneySchema = z.object({
162
196
  scenarioId: id,
163
197
  entryPoint: nonEmptyString,
164
198
  exitPoint: nonEmptyString,
165
- steps: z.array(JourneyStepSchema).min(1)
199
+ steps: z.array(JourneyStepSchema).min(1),
200
+ reference
166
201
  }).passthrough()
167
202
 
168
203
  const ScreenSchema = z.object({
@@ -176,7 +211,8 @@ const ScreenSchema = z.object({
176
211
  // knowledge base models the service, not only the screens this repo happens
177
212
  // to render, so the route smoke test skips these instead of failing on them.
178
213
  external: z.boolean().optional(),
179
- sourcePath: nonEmptyString.optional()
214
+ sourcePath: nonEmptyString.optional(),
215
+ reference
180
216
  }).passthrough()
181
217
 
182
218
  const EvidenceSchema = z.object({
@@ -186,7 +222,9 @@ const EvidenceSchema = z.object({
186
222
  summary: nonEmptyString,
187
223
  confidence: z.enum(['high', 'medium', 'low']),
188
224
  sourcePath: nonEmptyString.optional(),
189
- quotes: z.array(nonEmptyString).optional()
225
+ quotes: z.array(nonEmptyString).optional(),
226
+ reference,
227
+ impact
190
228
  }).passthrough()
191
229
 
192
230
  const DecisionSchema = z.object({
@@ -194,13 +232,15 @@ const DecisionSchema = z.object({
194
232
  title: nonEmptyString,
195
233
  status: z.enum(['proposed', 'accepted', 'superseded', 'rejected']),
196
234
  decision: nonEmptyString,
197
- consequence: nonEmptyString
235
+ consequence: nonEmptyString,
236
+ reference
198
237
  }).passthrough()
199
238
 
200
239
  const AssumptionSchema = z.object({
201
240
  id,
202
241
  statement: nonEmptyString,
203
- risk: z.enum(['high', 'medium', 'low'])
242
+ risk: z.enum(['high', 'medium', 'low']),
243
+ reference
204
244
  }).passthrough()
205
245
 
206
246
  const ResearchRoundSchema = z.object({
@@ -209,7 +249,8 @@ const ResearchRoundSchema = z.object({
209
249
  date: z.string().regex(/^\d{4}-\d{2}-\d{2}$/, 'Use YYYY-MM-DD dates'),
210
250
  sourceType: nonEmptyString,
211
251
  sourcePath: nonEmptyString.optional(),
212
- summary: nonEmptyString
252
+ summary: nonEmptyString,
253
+ reference
213
254
  }).passthrough()
214
255
 
215
256
  const ParticipantSchema = z.object({
@@ -217,7 +258,8 @@ const ParticipantSchema = z.object({
217
258
  label: nonEmptyString,
218
259
  role: nonEmptyString,
219
260
  organisation: nonEmptyString.optional(),
220
- roundIds: z.array(id).min(1)
261
+ roundIds: z.array(id).min(1),
262
+ reference
221
263
  }).passthrough()
222
264
 
223
265
  const InsightSchema = z.object({
@@ -227,7 +269,9 @@ const InsightSchema = z.object({
227
269
  summary: nonEmptyString,
228
270
  confidence: z.enum(['high', 'medium', 'low']),
229
271
  participantIds: z.array(id),
230
- evidenceIds: z.array(id)
272
+ evidenceIds: z.array(id),
273
+ reference,
274
+ impact
231
275
  }).passthrough()
232
276
 
233
277
  const DesignActionSchema = z.object({
@@ -236,7 +280,8 @@ const DesignActionSchema = z.object({
236
280
  status: z.enum(['proposed', 'in-progress', 'done', 'parked']),
237
281
  action: nonEmptyString,
238
282
  rationale: nonEmptyString,
239
- insightIds: z.array(id).min(1)
283
+ insightIds: z.array(id).min(1),
284
+ reference
240
285
  }).passthrough()
241
286
 
242
287
  const RelationshipSchema = z.object({
@@ -339,6 +384,7 @@ const recordSchemas = {
339
384
  }
340
385
 
341
386
  module.exports = {
387
+ UNRESEARCHED,
342
388
  KnowledgeSchema,
343
389
  ResearchImportDraftSchema,
344
390
  ProjectContextImportDraftSchema,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hippo-digital/hippocampus",
3
- "version": "2.3.0",
3
+ "version": "2.4.0",
4
4
  "description": "A design-knowledge base for NHS Prototype Kit projects: research, insights, needs, journeys and screens, traceable end to end.",
5
5
  "license": "MIT",
6
6
  "main": "index.js",
@@ -64,7 +64,7 @@ acceptance:
64
64
  The schema requires both of these, so neither can be left empty and an unstated value looks exactly like a researched one. When the document is silent, fill it and say so.
65
65
 
66
66
  - **`Need.priority`** is an enum with no "unknown". Persona documents rarely rank needs. Default to `medium` and add one assumption covering the whole import: *"Needs imported from persona documents carry priority medium because the documents do not state priority. Priorities need a team decision before they sequence design work."*
67
- - **`User.accessNeeds`** requires at least one entry. If the document does not cover access needs, say so in the field itself rather than inventing one, and add an assumption recording that the personas did not cover accessibility.
67
+ - **`User.accessNeeds`** requires at least one entry. If the document does not cover access needs, write exactly `Not yet researched` rather than inventing one - `npx hippocampus validate` counts that value and reports the gap - and add an assumption recording that the personas did not cover accessibility.
68
68
 
69
69
  ## Guardrails
70
70
 
@@ -16,7 +16,11 @@
16
16
  #}
17
17
  <p class="knowledge-card__meta">
18
18
  {{ impact.evidence.sourceType }}
19
+ {% if impact.evidence.reference %} · {{ impact.evidence.reference }}{% endif %}
19
20
  <span class="knowledge-confidence-tag knowledge-confidence-tag--{{ impact.evidence.confidence }}">{{ impact.evidence.confidence }} confidence</span>
21
+ {# How much it matters, next to how sure we are. The two differ often enough
22
+ that showing one alone misreads the record. #}
23
+ {% if impact.evidence.impact %} · {{ impact.evidence.impact }} impact{% endif %}
20
24
  </p>
21
25
  <p class="nhsuk-lede-text">{{ impact.evidence.summary }}</p>
22
26
 
@@ -18,10 +18,18 @@
18
18
  {% if facts.length %}
19
19
  <dl class="nhsuk-summary-list">
20
20
  {% for fact in facts %}
21
- {% if fact.value %}
21
+ {% if fact.value or (fact.list and fact.list.length) %}
22
22
  <div class="nhsuk-summary-list__row">
23
23
  <dt class="nhsuk-summary-list__key">{{ fact.key }}</dt>
24
- <dd class="nhsuk-summary-list__value">{{ fact.value }}</dd>
24
+ <dd class="nhsuk-summary-list__value">
25
+ {% if fact.list and fact.list.length %}
26
+ <ul class="nhsuk-list nhsuk-list--bullet nhsuk-u-margin-bottom-0">
27
+ {% for item in fact.list %}<li>{{ item }}</li>{% endfor %}
28
+ </ul>
29
+ {% else %}
30
+ {{ fact.value }}
31
+ {% endif %}
32
+ </dd>
25
33
  </div>
26
34
  {% endif %}
27
35
  {% endfor %}