@hippo-digital/hippocampus 2.7.2 → 2.8.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 +53 -0
- package/README.md +5 -4
- package/agents/knowledge-builder.md +2 -0
- package/agents/workflow-orchestrator.md +2 -0
- package/assets/dist/hippocampus.css +1 -1
- package/assets/hippocampus.scss +124 -0
- package/bin/hippocampus.js +1 -0
- package/docs/add-project-context.md +8 -2
- package/docs/ask-whats-already-known.md +6 -2
- package/docs/check-for-unintended-consequences.md +7 -2
- package/docs/data-and-governance.md +6 -2
- package/docs/describe-the-context-of-use.md +134 -0
- package/docs/design-actions-and-decisions.md +8 -3
- package/docs/hippocampus-for-designers-and-researchers.md +98 -220
- package/docs/hippocampus-technical.md +16 -0
- package/docs/human-centred-design.md +165 -0
- package/docs/import-a-research-round.md +9 -2
- package/docs/link-insights-to-needs.md +6 -2
- package/docs/record-a-usability-test.md +118 -0
- package/docs/record-design-principles.md +76 -0
- package/docs/research-knowledge-graph.md +25 -6
- package/docs/review-and-promote-a-draft.md +7 -2
- package/docs/set-quality-objectives.md +87 -0
- package/docs/source-model.md +104 -23
- package/docs/start-here.md +52 -34
- package/docs/turn-personas-into-users-and-needs.md +9 -2
- package/docs/weigh-options-against-requirements.md +96 -0
- package/docs/write-requirements.md +161 -0
- package/lib/breadcrumb.js +67 -14
- package/lib/create-router.js +90 -2
- package/lib/docs.js +28 -4
- package/lib/flow-map.js +15 -4
- package/lib/hcd-views.js +362 -0
- package/lib/known.js +5 -2
- package/lib/lint-knowledge.js +170 -1
- package/lib/load-knowledge.js +128 -5
- package/lib/record-links.js +11 -2
- package/lib/schema.js +190 -4
- package/lib/tidy-principles.js +112 -0
- package/package.json +1 -1
- package/scripts/init.js +19 -0
- package/scripts/migrate-knowledge.js +9 -1
- package/scripts/smoke-routes.js +12 -1
- package/scripts/tidy-principles.js +68 -0
- package/skills/COVERAGE-MATRIX.md +2 -0
- package/skills/README.md +5 -0
- package/skills/add-scenario/SKILL.md +4 -0
- package/skills/add-user-needs/SKILL.md +11 -1
- package/skills/create-journey-from-scenario/SKILL.md +4 -1
- package/skills/ingest-research-round/SKILL.md +3 -3
- package/skills/ingest-user-personas/SKILL.md +24 -7
- package/skills/map-research-to-graph/SKILL.md +7 -5
- package/skills/record-design-decision/SKILL.md +1 -0
- package/skills/review-research-import-draft/SKILL.md +7 -1
- package/skills/skills.json +54 -1
- package/skills/structure-research-draft/SKILL.md +12 -2
- package/skills/weigh-options-against-requirements/SKILL.md +60 -0
- package/skills/write-requirements/SKILL.md +69 -0
- package/views/hippocampus/_layout.html +15 -12
- package/views/hippocampus/components/_activity.njk +36 -0
- package/views/hippocampus/components/_journey-step.njk +30 -0
- package/views/hippocampus/context.html +197 -0
- package/views/hippocampus/design.html +128 -0
- package/views/hippocampus/evaluation.html +119 -0
- package/views/hippocampus/index.html +57 -11
- package/views/hippocampus/journey.html +25 -1
- package/views/hippocampus/journeys.html +3 -0
- package/views/hippocampus/plan.html +64 -0
- package/views/hippocampus/requirements.html +94 -0
- package/views/hippocampus/research.html +20 -1
- package/views/hippocampus/scenarios.html +3 -0
- package/views/hippocampus/user.html +43 -3
package/lib/schema.js
CHANGED
|
@@ -22,13 +22,46 @@ const impact = z.enum(['critical', 'high', 'medium', 'low', 'unknown']).optional
|
|
|
22
22
|
// is reported every time rather than passing as a finding.
|
|
23
23
|
const UNRESEARCHED = 'Not yet researched'
|
|
24
24
|
|
|
25
|
+
// The parts of human-centred quality (ISO 9241-220, as the CPUX-F curriculum
|
|
26
|
+
// teaches it). Usability is split into its three criteria because a finding is
|
|
27
|
+
// almost always about one of them, and "usability" alone sorts nothing.
|
|
28
|
+
// Avoidance of harm is its own dimension: in a clinical service a confident
|
|
29
|
+
// false negative is not an efficiency problem.
|
|
30
|
+
const qualityDimension = z.enum([
|
|
31
|
+
'usability',
|
|
32
|
+
'effectiveness',
|
|
33
|
+
'efficiency',
|
|
34
|
+
'satisfaction',
|
|
35
|
+
'accessibility',
|
|
36
|
+
'user-experience',
|
|
37
|
+
'harm'
|
|
38
|
+
])
|
|
39
|
+
|
|
40
|
+
// The context of use has five parts: users, goals, tasks, environment and
|
|
41
|
+
// resources. Environment is three kinds of condition, and they are worth
|
|
42
|
+
// keeping apart - "variable connectivity" and "Caldicott rules" both shape a
|
|
43
|
+
// design, but nobody fixes them in the same way.
|
|
44
|
+
const EnvironmentSchema = z.object({
|
|
45
|
+
physical: stringList.optional(),
|
|
46
|
+
social: stringList.optional(),
|
|
47
|
+
technical: stringList.optional()
|
|
48
|
+
}).passthrough()
|
|
49
|
+
|
|
50
|
+
// As-is describes how people work today; to-be describes how they will work
|
|
51
|
+
// with what is being designed (CPUX-F: as-is scenario and use scenario). A
|
|
52
|
+
// journey with no state predates the field and is read as as-is.
|
|
53
|
+
const designState = z.enum(['as-is', 'to-be'])
|
|
54
|
+
|
|
25
55
|
const ProjectSchema = z.object({
|
|
26
56
|
id,
|
|
27
57
|
name: nonEmptyString,
|
|
28
58
|
description: nonEmptyString,
|
|
29
59
|
phase: nonEmptyString,
|
|
30
60
|
serviceArea: nonEmptyString,
|
|
31
|
-
prototypeSlice: id
|
|
61
|
+
prototypeSlice: id,
|
|
62
|
+
// What people call the service day to day ("NCRS"). The linter treats it
|
|
63
|
+
// as naming the system when it turns up inside a user need.
|
|
64
|
+
shortName: nonEmptyString.optional()
|
|
32
65
|
}).passthrough()
|
|
33
66
|
|
|
34
67
|
const ProjectContextUserSchema = z.object({
|
|
@@ -112,6 +145,25 @@ const UserSchema = z.object({
|
|
|
112
145
|
description: nonEmptyString,
|
|
113
146
|
responsibilities: stringList,
|
|
114
147
|
accessNeeds: stringList,
|
|
148
|
+
// Primary users use the service for its purpose; secondary users support it
|
|
149
|
+
// (configure access, train, maintain); indirect users never touch it but
|
|
150
|
+
// live with its output - in a records service, the patient.
|
|
151
|
+
userType: z.enum(['primary', 'secondary', 'indirect']).optional(),
|
|
152
|
+
// A user group profile describes a group; a persona is one fictitious member
|
|
153
|
+
// of a group, written to build empathy. A persona names its group.
|
|
154
|
+
kind: z.enum(['user-group', 'persona']).optional(),
|
|
155
|
+
userGroupId: id.optional(),
|
|
156
|
+
environment: EnvironmentSchema.optional(),
|
|
157
|
+
resources: stringList.optional(),
|
|
158
|
+
reference
|
|
159
|
+
}).passthrough()
|
|
160
|
+
|
|
161
|
+
// What a user wants to achieve - the intended outcome of a task. A need says
|
|
162
|
+
// what is necessary to reach a goal; the goal is the reason the need exists.
|
|
163
|
+
const GoalSchema = z.object({
|
|
164
|
+
id,
|
|
165
|
+
userId: id,
|
|
166
|
+
statement: nonEmptyString,
|
|
115
167
|
reference
|
|
116
168
|
}).passthrough()
|
|
117
169
|
|
|
@@ -134,6 +186,8 @@ const NeedSchema = z.object({
|
|
|
134
186
|
statement: nonEmptyString,
|
|
135
187
|
priority: z.enum(['high', 'medium', 'low']),
|
|
136
188
|
evidenceIds: z.array(id).min(1),
|
|
189
|
+
goalId: id.optional(),
|
|
190
|
+
qualityDimension: qualityDimension.optional(),
|
|
137
191
|
reference,
|
|
138
192
|
story: NeedStorySchema.optional()
|
|
139
193
|
}).passthrough()
|
|
@@ -160,6 +214,10 @@ const ScenarioSchema = z.object({
|
|
|
160
214
|
needIds: z.array(id).min(1),
|
|
161
215
|
happyPath: stringList,
|
|
162
216
|
edgeCases: stringList,
|
|
217
|
+
state: designState.optional(),
|
|
218
|
+
goalId: id.optional(),
|
|
219
|
+
environment: EnvironmentSchema.optional(),
|
|
220
|
+
resources: stringList.optional(),
|
|
163
221
|
locationSearch: LocationSearchSchema.optional(),
|
|
164
222
|
reference
|
|
165
223
|
}).passthrough()
|
|
@@ -183,10 +241,16 @@ const JourneyStepSchema = z.object({
|
|
|
183
241
|
painPoints: z.array(PainPointSchema),
|
|
184
242
|
exceptionHandling: stringList,
|
|
185
243
|
futureState: stringList.optional(),
|
|
244
|
+
// The user journey map's other two lanes: what could be better here, and
|
|
245
|
+
// how the step feels, from -2 (worst) to 2 (best).
|
|
246
|
+
opportunities: stringList.optional(),
|
|
247
|
+
sentiment: z.number().int().min(-2).max(2).optional(),
|
|
186
248
|
needIds: z.array(id).min(1),
|
|
187
249
|
screenIds: z.array(id),
|
|
188
250
|
evidenceIds: z.array(id).min(1),
|
|
189
|
-
decisionIds: z.array(id)
|
|
251
|
+
decisionIds: z.array(id),
|
|
252
|
+
requirementIds: z.array(id).optional(),
|
|
253
|
+
principleIds: z.array(id).optional()
|
|
190
254
|
}).passthrough()
|
|
191
255
|
|
|
192
256
|
const JourneySchema = z.object({
|
|
@@ -194,6 +258,7 @@ const JourneySchema = z.object({
|
|
|
194
258
|
title: nonEmptyString,
|
|
195
259
|
description: nonEmptyString,
|
|
196
260
|
scenarioId: id,
|
|
261
|
+
state: designState.optional(),
|
|
197
262
|
entryPoint: nonEmptyString,
|
|
198
263
|
exitPoint: nonEmptyString,
|
|
199
264
|
steps: z.array(JourneyStepSchema).min(1),
|
|
@@ -243,10 +308,96 @@ const AssumptionSchema = z.object({
|
|
|
243
308
|
reference
|
|
244
309
|
}).passthrough()
|
|
245
310
|
|
|
311
|
+
// An intended outcome for the people who will use the service, set while
|
|
312
|
+
// planning and refined as research comes in (CPUX-F: human-centred quality
|
|
313
|
+
// objective). Quantitative requirements make one measurable.
|
|
314
|
+
const QualityObjectiveSchema = z.object({
|
|
315
|
+
id,
|
|
316
|
+
dimension: qualityDimension,
|
|
317
|
+
statement: nonEmptyString,
|
|
318
|
+
criteria: stringList.optional(),
|
|
319
|
+
reference
|
|
320
|
+
}).passthrough()
|
|
321
|
+
|
|
322
|
+
// How a quantitative requirement is measured. The numbers are usually a
|
|
323
|
+
// guess before they are an agreement, and a guess that looks like a target is
|
|
324
|
+
// worse than no number - so `valuesStatus` says which this is.
|
|
325
|
+
const RequirementMeasureSchema = z.object({
|
|
326
|
+
dimension: qualityDimension,
|
|
327
|
+
task: nonEmptyString,
|
|
328
|
+
userId: id.optional(),
|
|
329
|
+
sampleSize: z.number().int().positive().optional(),
|
|
330
|
+
successRate: z.number().min(0).max(1).optional(),
|
|
331
|
+
timeLimit: nonEmptyString.optional(),
|
|
332
|
+
valuesStatus: z.enum(['placeholder', 'agreed']).default('placeholder')
|
|
333
|
+
}).passthrough()
|
|
334
|
+
|
|
335
|
+
// What the service must make possible, precisely enough to check a design
|
|
336
|
+
// against. A need says what is necessary and must not name a solution; a
|
|
337
|
+
// requirement says what the user must be able to do, and must be verifiable.
|
|
338
|
+
//
|
|
339
|
+
// user-qualitative "The user must be able to recognise / select / input ..."
|
|
340
|
+
// user-quantitative a measurable level of quality, with a measure
|
|
341
|
+
// organisational a rule users must follow - IG, RBAC, policy - that
|
|
342
|
+
// becomes a requirement on the service. It comes from a
|
|
343
|
+
// source, not from a user need.
|
|
344
|
+
//
|
|
345
|
+
// The rules that tie fields to a kind are checked by validate, where the
|
|
346
|
+
// message can name the record, rather than here.
|
|
347
|
+
const RequirementSchema = z.object({
|
|
348
|
+
id,
|
|
349
|
+
kind: z.enum(['user-qualitative', 'user-quantitative', 'organisational', 'market']),
|
|
350
|
+
statement: nonEmptyString,
|
|
351
|
+
verb: z.enum(['recognise', 'select', 'input']).optional(),
|
|
352
|
+
needIds: z.array(id).default([]),
|
|
353
|
+
insightIds: z.array(id).optional(),
|
|
354
|
+
source: nonEmptyString.optional(),
|
|
355
|
+
measure: RequirementMeasureSchema.optional(),
|
|
356
|
+
qualityDimension: qualityDimension.optional(),
|
|
357
|
+
status: z.enum(['draft', 'agreed', 'retired']).optional(),
|
|
358
|
+
reference
|
|
359
|
+
}).passthrough()
|
|
360
|
+
|
|
361
|
+
// Guidance a design follows: an interaction principle, a heuristic, a design
|
|
362
|
+
// system rule, a pattern, or a principle the team arrived at. Kept apart from
|
|
363
|
+
// evidence, because a principle is a choice about how to design rather than
|
|
364
|
+
// something learned about users - counted as evidence, it inflates the
|
|
365
|
+
// research behind every step that cites it.
|
|
366
|
+
const PrincipleSchema = z.object({
|
|
367
|
+
id,
|
|
368
|
+
kind: z.enum(['interaction-principle', 'heuristic', 'ui-guideline', 'design-pattern', 'design-principle']),
|
|
369
|
+
title: nonEmptyString,
|
|
370
|
+
statement: nonEmptyString,
|
|
371
|
+
source: nonEmptyString.optional(),
|
|
372
|
+
sourcePath: nonEmptyString.optional(),
|
|
373
|
+
reference
|
|
374
|
+
}).passthrough()
|
|
375
|
+
|
|
376
|
+
// How a round was run. A list, because most rounds mix methods - an interview
|
|
377
|
+
// with prototype tasks is the commonest NCRS round. The method decides what
|
|
378
|
+
// an insight from the round can claim: CPUX-F is explicit that interviews and
|
|
379
|
+
// focus groups cannot evaluate usability, because they record what people say
|
|
380
|
+
// rather than what they do.
|
|
381
|
+
const researchMethod = z.enum([
|
|
382
|
+
'contextual-interview',
|
|
383
|
+
'interview',
|
|
384
|
+
'observation',
|
|
385
|
+
'focus-group',
|
|
386
|
+
'user-survey',
|
|
387
|
+
'usability-test',
|
|
388
|
+
'usability-inspection',
|
|
389
|
+
'card-sort',
|
|
390
|
+
'preference-test',
|
|
391
|
+
'desk-research',
|
|
392
|
+
'analytics',
|
|
393
|
+
'other'
|
|
394
|
+
])
|
|
395
|
+
|
|
246
396
|
const ResearchRoundSchema = z.object({
|
|
247
397
|
id,
|
|
248
398
|
title: nonEmptyString,
|
|
249
399
|
date: z.string().regex(/^\d{4}-\d{2}-\d{2}$/, 'Use YYYY-MM-DD dates'),
|
|
400
|
+
methods: z.array(researchMethod).min(1).optional(),
|
|
250
401
|
sourceType: nonEmptyString,
|
|
251
402
|
sourcePath: nonEmptyString.optional(),
|
|
252
403
|
summary: nonEmptyString,
|
|
@@ -259,6 +410,9 @@ const ParticipantSchema = z.object({
|
|
|
259
410
|
role: nonEmptyString,
|
|
260
411
|
organisation: nonEmptyString.optional(),
|
|
261
412
|
roundIds: z.array(id).min(1),
|
|
413
|
+
// The user group the participant was recruited as. Recorded at recruitment,
|
|
414
|
+
// it replaces guessing the group from the job title afterwards.
|
|
415
|
+
userId: id.optional(),
|
|
262
416
|
reference
|
|
263
417
|
}).passthrough()
|
|
264
418
|
|
|
@@ -270,6 +424,15 @@ const InsightSchema = z.object({
|
|
|
270
424
|
confidence: z.enum(['high', 'medium', 'low']),
|
|
271
425
|
participantIds: z.array(id),
|
|
272
426
|
evidenceIds: z.array(id),
|
|
427
|
+
// A positive finding is something that worked. Recording it is what stops
|
|
428
|
+
// a later change breaking it by accident.
|
|
429
|
+
polarity: z.enum(['problem', 'positive', 'observation']).optional(),
|
|
430
|
+
// The CPUX-F rating for a usability finding. Catastrophic means a risk of
|
|
431
|
+
// major harm and is not a UX professional's call alone - in the NHS, the
|
|
432
|
+
// clinical safety officer's. `signedOffBy` records who made it.
|
|
433
|
+
rating: z.enum(['positive', 'minor', 'major', 'critical', 'catastrophic']).optional(),
|
|
434
|
+
signedOffBy: nonEmptyString.optional(),
|
|
435
|
+
qualityDimension: qualityDimension.optional(),
|
|
273
436
|
reference,
|
|
274
437
|
impact
|
|
275
438
|
}).passthrough()
|
|
@@ -312,9 +475,22 @@ const RelationshipSchema = z.object({
|
|
|
312
475
|
'resolves-action',
|
|
313
476
|
// Retained so older drafts still validate. New links use
|
|
314
477
|
// responds-to-insight, which traces.
|
|
315
|
-
'leads-to-action'
|
|
478
|
+
'leads-to-action',
|
|
479
|
+
// The requirements layer. Each points from the record that depends to the
|
|
480
|
+
// record it depends on, so impact walks reach requirements and decisions.
|
|
481
|
+
'derives-from', // requirement -> need
|
|
482
|
+
'based-on-insight', // requirement -> insight
|
|
483
|
+
'constrained-by', // requirement -> organisational requirement
|
|
484
|
+
'refines-objective', // requirement -> quality objective
|
|
485
|
+
'verified-by', // requirement -> insight that evaluated it (outcome)
|
|
486
|
+
'weighed-against', // decision -> requirement (outcome)
|
|
487
|
+
'applies-principle', // screen, requirement or decision -> principle
|
|
488
|
+
'observed-on' // insight -> screen the finding was seen on
|
|
316
489
|
]),
|
|
317
|
-
to: id
|
|
490
|
+
to: id,
|
|
491
|
+
// How a decision fares against a requirement, or what an evaluation found.
|
|
492
|
+
outcome: z.enum(['meets', 'partly', 'fails', 'not-assessed']).optional(),
|
|
493
|
+
note: nonEmptyString.optional()
|
|
318
494
|
}).passthrough()
|
|
319
495
|
|
|
320
496
|
const ResearchImportDraftSchema = z.object({
|
|
@@ -360,6 +536,10 @@ const KnowledgeSchema = z.object({
|
|
|
360
536
|
participants: z.array(ParticipantSchema).default([]),
|
|
361
537
|
insights: z.array(InsightSchema).default([]),
|
|
362
538
|
designActions: z.array(DesignActionSchema).default([]),
|
|
539
|
+
goals: z.array(GoalSchema).default([]),
|
|
540
|
+
qualityObjectives: z.array(QualityObjectiveSchema).default([]),
|
|
541
|
+
requirements: z.array(RequirementSchema).default([]),
|
|
542
|
+
principles: z.array(PrincipleSchema).default([]),
|
|
363
543
|
relationships: z.array(RelationshipSchema).default([])
|
|
364
544
|
}).strict()
|
|
365
545
|
|
|
@@ -380,11 +560,17 @@ const recordSchemas = {
|
|
|
380
560
|
participants: ParticipantSchema,
|
|
381
561
|
insights: InsightSchema,
|
|
382
562
|
designActions: DesignActionSchema,
|
|
563
|
+
goals: GoalSchema,
|
|
564
|
+
qualityObjectives: QualityObjectiveSchema,
|
|
565
|
+
requirements: RequirementSchema,
|
|
566
|
+
principles: PrincipleSchema,
|
|
383
567
|
relationships: RelationshipSchema
|
|
384
568
|
}
|
|
385
569
|
|
|
386
570
|
module.exports = {
|
|
387
571
|
UNRESEARCHED,
|
|
572
|
+
RESEARCH_METHODS: researchMethod.options,
|
|
573
|
+
QUALITY_DIMENSIONS: qualityDimension.options,
|
|
388
574
|
KnowledgeSchema,
|
|
389
575
|
ResearchImportDraftSchema,
|
|
390
576
|
ProjectContextImportDraftSchema,
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
// Move principles out of evidence.
|
|
2
|
+
//
|
|
3
|
+
// Before principles were a record type, the only place to put "a search that
|
|
4
|
+
// could not run must not report that nobody was found" was evidence, with a
|
|
5
|
+
// sourceType saying it was a principle. It then counted as research behind
|
|
6
|
+
// every journey step that cited it. This moves each one into principles and
|
|
7
|
+
// rewrites what pointed at it, so the evidence that remains is research.
|
|
8
|
+
//
|
|
9
|
+
// Pure: takes the collections, returns new ones and an account of what moved.
|
|
10
|
+
// The command writes; this decides.
|
|
11
|
+
|
|
12
|
+
const PRINCIPLE_SOURCE = /principle/i
|
|
13
|
+
|
|
14
|
+
// Links that mean "this relies on that as evidence", and what each becomes
|
|
15
|
+
// when "that" turns out to be a principle - from these record types.
|
|
16
|
+
const APPLIES_FROM = new Set(['screens', 'requirements', 'decisions', 'journeys'])
|
|
17
|
+
|
|
18
|
+
function newIdFor (evidenceId, taken) {
|
|
19
|
+
const base = evidenceId.startsWith('evidence-') ? `principle-${evidenceId.slice('evidence-'.length)}` : `principle-${evidenceId}`
|
|
20
|
+
let candidate = base
|
|
21
|
+
let n = 2
|
|
22
|
+
while (taken.has(candidate)) candidate = `${base}-${n++}`
|
|
23
|
+
return candidate
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function collectionOf (data, id) {
|
|
27
|
+
for (const [key, value] of Object.entries(data)) {
|
|
28
|
+
if (Array.isArray(value) && value.some((record) => record && record.id === id)) return key
|
|
29
|
+
}
|
|
30
|
+
return null
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function planPrincipleTidy (input) {
|
|
34
|
+
const data = JSON.parse(JSON.stringify(input))
|
|
35
|
+
data.principles = data.principles || []
|
|
36
|
+
const moved = []
|
|
37
|
+
const blocked = []
|
|
38
|
+
|
|
39
|
+
const candidates = (data.evidence || []).filter((item) => PRINCIPLE_SOURCE.test(item.sourceType || ''))
|
|
40
|
+
const taken = new Set(Object.values(data).filter(Array.isArray).flat().map((record) => record && record.id))
|
|
41
|
+
|
|
42
|
+
for (const evidence of candidates) {
|
|
43
|
+
// A need must cite at least one piece of evidence. Where a principle is all
|
|
44
|
+
// a need has, moving it would leave the need citing nothing - so it stays,
|
|
45
|
+
// and the need is named, because that need is resting on a choice rather
|
|
46
|
+
// than on research and somebody should know.
|
|
47
|
+
// Journey steps are held to the same rule as needs.
|
|
48
|
+
const onlyThis = (record) => (record.evidenceIds || []).length === 1 && record.evidenceIds[0] === evidence.id
|
|
49
|
+
const soleSupport = [
|
|
50
|
+
...(data.needs || []).filter(onlyThis).map((need) => need.id),
|
|
51
|
+
...(data.journeys || []).flatMap((journey) => (journey.steps || []).filter(onlyThis).map((step) => `${journey.id}/${step.id}`))
|
|
52
|
+
]
|
|
53
|
+
if (soleSupport.length) {
|
|
54
|
+
blocked.push({ id: evidence.id, reason: `the only evidence for ${soleSupport.join(', ')}` })
|
|
55
|
+
continue
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const newId = newIdFor(evidence.id, taken)
|
|
59
|
+
taken.add(newId)
|
|
60
|
+
const changes = []
|
|
61
|
+
|
|
62
|
+
data.principles.push(Object.fromEntries(Object.entries({
|
|
63
|
+
id: newId,
|
|
64
|
+
kind: /guideline|style/i.test(evidence.sourceType) ? 'ui-guideline' : 'design-principle',
|
|
65
|
+
title: evidence.title,
|
|
66
|
+
statement: evidence.summary,
|
|
67
|
+
source: evidence.sourceType,
|
|
68
|
+
sourcePath: evidence.sourcePath,
|
|
69
|
+
quotes: evidence.quotes,
|
|
70
|
+
reference: evidence.reference
|
|
71
|
+
}).filter(([, value]) => value !== undefined)))
|
|
72
|
+
data.evidence = data.evidence.filter((item) => item.id !== evidence.id)
|
|
73
|
+
|
|
74
|
+
for (const key of ['needs', 'insights']) {
|
|
75
|
+
for (const record of data[key] || []) {
|
|
76
|
+
if (!(record.evidenceIds || []).includes(evidence.id)) continue
|
|
77
|
+
record.evidenceIds = record.evidenceIds.filter((id) => id !== evidence.id)
|
|
78
|
+
changes.push(`${record.id}: no longer cites it as evidence`)
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
for (const journey of data.journeys || []) {
|
|
83
|
+
for (const step of journey.steps || []) {
|
|
84
|
+
if (!(step.evidenceIds || []).includes(evidence.id)) continue
|
|
85
|
+
step.evidenceIds = step.evidenceIds.filter((id) => id !== evidence.id)
|
|
86
|
+
step.principleIds = [...new Set([...(step.principleIds || []), newId])]
|
|
87
|
+
changes.push(`${journey.id} / ${step.id}: evidence citation became a principle`)
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
const kept = []
|
|
92
|
+
for (const rel of data.relationships || []) {
|
|
93
|
+
const touches = rel.from === evidence.id || rel.to === evidence.id
|
|
94
|
+
if (!touches) { kept.push(rel); continue }
|
|
95
|
+
const other = rel.from === evidence.id ? rel.to : rel.from
|
|
96
|
+
const otherCollection = collectionOf(data, other)
|
|
97
|
+
if (rel.to === evidence.id && APPLIES_FROM.has(otherCollection)) {
|
|
98
|
+
kept.push({ ...rel, type: 'applies-principle', to: newId })
|
|
99
|
+
changes.push(`${rel.id}: ${rel.type} became applies-principle`)
|
|
100
|
+
} else {
|
|
101
|
+
changes.push(`${rel.id}: ${rel.type} from ${other} removed - a principle is not evidence for it`)
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
data.relationships = kept
|
|
105
|
+
|
|
106
|
+
moved.push({ from: evidence.id, to: newId, changes })
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
return { data, moved, blocked }
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
module.exports = { planPrincipleTidy }
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hippo-digital/hippocampus",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.8.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",
|
package/scripts/init.js
CHANGED
|
@@ -43,6 +43,7 @@ function main () {
|
|
|
43
43
|
planConfig(root)
|
|
44
44
|
planKnowledgeDirs(root)
|
|
45
45
|
planKnowledgeBase(root)
|
|
46
|
+
planCollectionBackfill(root)
|
|
46
47
|
planArtefacts(root, artefactsDir(root))
|
|
47
48
|
planArtefactGovernance(root)
|
|
48
49
|
planResearchIgnore(root)
|
|
@@ -143,6 +144,7 @@ function listTemplateFiles (dir, prefix = '') {
|
|
|
143
144
|
const EMPTY_COLLECTIONS = [
|
|
144
145
|
'users', 'needs', 'scenarios', 'journeys', 'screens', 'evidence', 'decisions',
|
|
145
146
|
'assumptions', 'research-rounds', 'participants', 'insights', 'design-actions',
|
|
147
|
+
'goals', 'quality-objectives', 'requirements', 'principles',
|
|
146
148
|
'relationships'
|
|
147
149
|
]
|
|
148
150
|
|
|
@@ -204,6 +206,23 @@ function planKnowledgeBase (root) {
|
|
|
204
206
|
})
|
|
205
207
|
}
|
|
206
208
|
|
|
209
|
+
// A knowledge base made before a collection existed gains it as an empty
|
|
210
|
+
// file on the next `init`, for the same reason the directories are
|
|
211
|
+
// backfilled: the skills declare the files they read, and a file that is
|
|
212
|
+
// missing rather than empty fails that check in a project that has simply
|
|
213
|
+
// been upgraded. An existing file is never touched.
|
|
214
|
+
function planCollectionBackfill (root) {
|
|
215
|
+
const sourceDir = path.join(root, 'hippocampus/source')
|
|
216
|
+
if (!fs.existsSync(path.join(sourceDir, 'project.json'))) return
|
|
217
|
+
const missing = EMPTY_COLLECTIONS.filter((collection) => !fs.existsSync(path.join(sourceDir, `${collection}.json`)))
|
|
218
|
+
if (!missing.length) return
|
|
219
|
+
plan(`hippocampus/source: ${missing.length} empty ${missing.length === 1 ? 'collection' : 'collections'} (${missing.join(', ')})`, () => {
|
|
220
|
+
for (const collection of missing) {
|
|
221
|
+
fs.writeFileSync(path.join(sourceDir, `${collection}.json`), '[]\n')
|
|
222
|
+
}
|
|
223
|
+
})
|
|
224
|
+
}
|
|
225
|
+
|
|
207
226
|
// source-artefacts holds the research material a round was built from -
|
|
208
227
|
// transcripts, scenario maps, quotes with participant identifiers attached.
|
|
209
228
|
// Putting that in a prototype repo's history is a decision for the team, and
|
|
@@ -29,6 +29,10 @@ const collectionFiles = {
|
|
|
29
29
|
participants: 'participants.json',
|
|
30
30
|
insights: 'insights.json',
|
|
31
31
|
designActions: 'design-actions.json',
|
|
32
|
+
goals: 'goals.json',
|
|
33
|
+
qualityObjectives: 'quality-objectives.json',
|
|
34
|
+
requirements: 'requirements.json',
|
|
35
|
+
principles: 'principles.json',
|
|
32
36
|
relationships: 'relationships.json'
|
|
33
37
|
}
|
|
34
38
|
|
|
@@ -58,7 +62,11 @@ function main () {
|
|
|
58
62
|
}
|
|
59
63
|
|
|
60
64
|
for (const [key, filename] of Object.entries(collectionFiles)) {
|
|
61
|
-
|
|
65
|
+
const filePath = path.join(sourceDir, filename)
|
|
66
|
+
// A collection this base has never used stays absent rather than
|
|
67
|
+
// appearing as an empty file the team did not ask for.
|
|
68
|
+
if (!fs.existsSync(filePath) && !(data[key] || []).length) continue
|
|
69
|
+
fs.writeFileSync(filePath, JSON.stringify(data[key], null, 2) + '\n')
|
|
62
70
|
}
|
|
63
71
|
writeMeta(sourceDir, { generator: 'hippocampus migrate:knowledge' })
|
|
64
72
|
console.log(`${project.name}: migrated ${meta.schemaVersion} -> ${version}, ${META_FILENAME} stamped`)
|
package/scripts/smoke-routes.js
CHANGED
|
@@ -50,6 +50,12 @@ async function main () {
|
|
|
50
50
|
function buildRoutes (basePath, knowledge) {
|
|
51
51
|
const routes = new Set([
|
|
52
52
|
basePath,
|
|
53
|
+
`${basePath}/plan`,
|
|
54
|
+
`${basePath}/context`,
|
|
55
|
+
`${basePath}/requirements`,
|
|
56
|
+
`${basePath}/design`,
|
|
57
|
+
`${basePath}/evaluation`,
|
|
58
|
+
`${basePath}/research?method=usability-test`,
|
|
53
59
|
`${basePath}/project`,
|
|
54
60
|
`${basePath}/users`,
|
|
55
61
|
`${basePath}/user-needs`,
|
|
@@ -88,7 +94,12 @@ function buildRoutes (basePath, knowledge) {
|
|
|
88
94
|
for (const collection of [
|
|
89
95
|
{ items: knowledge.needs, path: 'needs' },
|
|
90
96
|
{ items: knowledge.insights, path: 'insights' },
|
|
91
|
-
{ items: knowledge.screens, path: 'screens' }
|
|
97
|
+
{ items: knowledge.screens, path: 'screens' },
|
|
98
|
+
{ items: knowledge.requirements, path: 'requirements' },
|
|
99
|
+
{ items: knowledge.principles, path: 'principles' },
|
|
100
|
+
{ items: knowledge.decisions, path: 'decisions' },
|
|
101
|
+
{ items: knowledge.goals, path: 'goals' },
|
|
102
|
+
{ items: knowledge.qualityObjectives, path: 'objectives' }
|
|
92
103
|
]) {
|
|
93
104
|
for (const item of (collection.items || []).slice(0, 3)) {
|
|
94
105
|
routes.add(`${basePath}/${collection.path}/${item.id}`)
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
const fs = require('fs')
|
|
3
|
+
const path = require('path')
|
|
4
|
+
const { createContextOrExit } = require('../lib/context')
|
|
5
|
+
const { planPrincipleTidy } = require('../lib/tidy-principles')
|
|
6
|
+
|
|
7
|
+
// `hippocampus tidy principles` - move evidence that is really a principle
|
|
8
|
+
// into principles.json. Shows the plan unless --apply is given, because this
|
|
9
|
+
// rewrites source/ and the right review is reading what it will do first.
|
|
10
|
+
|
|
11
|
+
const argv = process.argv.slice(2)
|
|
12
|
+
const apply = argv.includes('--apply')
|
|
13
|
+
const ctx = createContextOrExit({ argv })
|
|
14
|
+
|
|
15
|
+
const FILES = {
|
|
16
|
+
needs: 'needs.json',
|
|
17
|
+
insights: 'insights.json',
|
|
18
|
+
journeys: 'journeys.json',
|
|
19
|
+
evidence: 'evidence.json',
|
|
20
|
+
screens: 'screens.json',
|
|
21
|
+
decisions: 'decisions.json',
|
|
22
|
+
requirements: 'requirements.json',
|
|
23
|
+
principles: 'principles.json',
|
|
24
|
+
relationships: 'relationships.json'
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function main () {
|
|
28
|
+
for (const project of ctx.requireProjects()) {
|
|
29
|
+
const sourceDir = path.join(project.dir, 'source')
|
|
30
|
+
const raw = {}
|
|
31
|
+
for (const [key, file] of Object.entries(FILES)) {
|
|
32
|
+
const filePath = path.join(sourceDir, file)
|
|
33
|
+
raw[key] = fs.existsSync(filePath) ? JSON.parse(fs.readFileSync(filePath, 'utf8')) : []
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const { data, moved, blocked } = planPrincipleTidy(raw)
|
|
37
|
+
if (!moved.length && !blocked.length) {
|
|
38
|
+
console.log(`${project.name}: no evidence records are principles - nothing to move`)
|
|
39
|
+
continue
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
console.log(`${project.name}:`)
|
|
43
|
+
for (const item of moved) {
|
|
44
|
+
console.log(` move ${item.from} -> principles/${item.to}`)
|
|
45
|
+
for (const change of item.changes) console.log(` ${change}`)
|
|
46
|
+
}
|
|
47
|
+
for (const item of blocked) console.log(` note ${item.id}: ${item.reason}`)
|
|
48
|
+
|
|
49
|
+
if (!apply) {
|
|
50
|
+
console.log('\nNothing written. Run again with --apply to make these changes, then `hippocampus validate`.')
|
|
51
|
+
continue
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
for (const [key, file] of Object.entries(FILES)) {
|
|
55
|
+
const filePath = path.join(sourceDir, file)
|
|
56
|
+
if (JSON.stringify(data[key]) === JSON.stringify(raw[key])) continue
|
|
57
|
+
fs.writeFileSync(filePath, JSON.stringify(data[key], null, 2) + '\n')
|
|
58
|
+
}
|
|
59
|
+
console.log('\nWritten. Run `hippocampus validate`, then review with `git diff hippocampus/source`.')
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
try {
|
|
64
|
+
main()
|
|
65
|
+
} catch (error) {
|
|
66
|
+
console.error(error.message)
|
|
67
|
+
process.exit(1)
|
|
68
|
+
}
|
|
@@ -27,6 +27,8 @@ This matrix shows how the archived prompt pack now maps to the active skill cata
|
|
|
27
27
|
| Handover note for multi-step agent work | `write-delivery-summary` | `workflow-orchestrator` | validation, smoke, and dry-run results plus changed-file summary |
|
|
28
28
|
| Screenshot or route-note review pack for changed pages | `capture-route-review-pack` | `screenshot-runner`, `workflow-orchestrator` | smoke-tested route list plus dated manifest and captures/notes |
|
|
29
29
|
| Accessibility note for changed pages | `record-accessibility-review` | `accessibility-tester`, `workflow-orchestrator` | smoke-tested route list plus blockers/improvements note |
|
|
30
|
+
| Requirements a design can be checked against | `write-requirements` | `knowledge-builder`, `workflow-orchestrator` | needs, goals, insights, project-context policies and quality objectives |
|
|
31
|
+
| Options for a design action compared on the requirements | `weigh-options-against-requirements` | `knowledge-builder`, `workflow-orchestrator` | `record-design-decision`, `write-requirements` |
|
|
30
32
|
| Combined route review handover note | `write-route-review-summary` | `workflow-orchestrator`, `screenshot-runner`, `accessibility-tester` | screenshot pack, accessibility note, and delivery summary |
|
|
31
33
|
|
|
32
34
|
## How to use this matrix
|
package/skills/README.md
CHANGED
|
@@ -45,6 +45,11 @@ after changing any `<name>/SKILL.md`, `skills.json`, `skills.schema.json`, or ex
|
|
|
45
45
|
- `review-research-import-draft/SKILL.md` ← `hippocampus-review-import-draft.prompt.md`
|
|
46
46
|
- `map-research-to-graph/SKILL.md` ← `hippocampus-map-research-to-graph.prompt.md`
|
|
47
47
|
|
|
48
|
+
## Human-centred design skills
|
|
49
|
+
|
|
50
|
+
- `write-requirements/SKILL.md` - drafts user, quantitative and organisational requirements from needs, insights and policies into `hippocampus/imports/requirements/` for the team to agree
|
|
51
|
+
- `weigh-options-against-requirements/SKILL.md` - records how each option for a design action fares against each requirement, and reports what no option meets on its own
|
|
52
|
+
|
|
48
53
|
## Orchestration skills
|
|
49
54
|
|
|
50
55
|
- `ingest-research-round/SKILL.md` - chains research import draft structuring, review, and graph-linking without promotion
|
|
@@ -36,6 +36,10 @@ acceptance:
|
|
|
36
36
|
## Workflow
|
|
37
37
|
1. Pick an existing `userId` and linked `needIds`.
|
|
38
38
|
2. Add a scenario with `title`, `trigger`, `context`, `riskLevel`, `happyPath`, and `edgeCases`.
|
|
39
|
+
- `state`: `as-is` for how the work is done today, `to-be` for how it will be done with the new design.
|
|
40
|
+
- `goalId` when the user has a goal in `goals.json` this scenario is about.
|
|
41
|
+
- `environment` (`physical`, `social`, `technical`) and `resources` when the conditions are particular to this scenario rather than to the user. Leave out a kind the evidence does not cover.
|
|
42
|
+
- `happyPath` lists the subtasks of one whole task - the task is what reaches the goal, and what a usability test would ask someone to do.
|
|
39
43
|
3. Make it specific enough to generate journey steps and screens: what starts the work, what the user is deciding, what data matters, and what can go wrong.
|
|
40
44
|
|
|
41
45
|
## Guardrails
|
|
@@ -9,7 +9,9 @@ owners:
|
|
|
9
9
|
- workflow-orchestrator
|
|
10
10
|
reads:
|
|
11
11
|
- node_modules/@hippo-digital/hippocampus/docs/source-model.md
|
|
12
|
+
- node_modules/@hippo-digital/hippocampus/docs/write-requirements.md
|
|
12
13
|
- hippocampus/source/users.json
|
|
14
|
+
- hippocampus/source/goals.json
|
|
13
15
|
- hippocampus/source/needs.json
|
|
14
16
|
- hippocampus/source/evidence.json
|
|
15
17
|
- hippocampus/source/assumptions.json
|
|
@@ -24,8 +26,11 @@ outputs:
|
|
|
24
26
|
guardrails:
|
|
25
27
|
- Do not invent evidence or rename existing IDs casually.
|
|
26
28
|
- Keep need statements short enough to display cleanly in Hippocampus lists and blueprint views.
|
|
29
|
+
- A need names no solution - not the system, not a screen, not an interface element such as "highlighted" or "filters". It says what the user needs to know or do.
|
|
30
|
+
- A need says why - a "so that" or a goalId. A need with no reason cannot be weighed against another.
|
|
27
31
|
acceptance:
|
|
28
32
|
- Each changed need has a valid userId, priority, and supporting evidence or assumption gap.
|
|
33
|
+
- Each changed need has a goal clause or goalId, and validate does not report it as naming a solution.
|
|
29
34
|
- Need text remains concise enough for lists and blueprint views.
|
|
30
35
|
- npx hippocampus validate passes.
|
|
31
36
|
---
|
|
@@ -39,14 +44,19 @@ acceptance:
|
|
|
39
44
|
## Workflow
|
|
40
45
|
1. Confirm the target `userId` already exists in `hippocampus/source/users.json`.
|
|
41
46
|
2. Add or revise need records with a lowercase kebab-case `id`, a single clear statement, a `priority`, and at least one `evidenceId`.
|
|
47
|
+
- Write what is necessary, not how it will be provided: "I need to know when two records disagree", not "I need conflicting records highlighted".
|
|
48
|
+
- Give it a reason. Where the user already has a goal in `goals.json` that the need serves, set `goalId`; otherwise end with "so that ...".
|
|
49
|
+
- Set `qualityDimension` when the need is plainly about one - `harm` for a need whose failure could hurt someone, `accessibility` for an access need.
|
|
42
50
|
3. Reuse existing evidence where it really supports the need.
|
|
43
51
|
4. If the direction is plausible but not evidenced, add an assumption and call out the evidence gap.
|
|
44
52
|
|
|
45
53
|
## Guardrails
|
|
46
54
|
- Do not invent evidence or rename existing IDs casually.
|
|
47
55
|
- Keep need statements short enough to display cleanly in Hippocampus lists and blueprint views.
|
|
56
|
+
- No solution in a need, and no need without a reason.
|
|
57
|
+
- A requirement is a different record. When the team wants to say what the user must be able to recognise, select or input, use `write-requirements`.
|
|
48
58
|
|
|
49
59
|
## Finish
|
|
50
60
|
- Run `npx hippocampus validate`.
|
|
51
|
-
- Report needs added or changed, evidence used, assumptions added, and validation result.
|
|
61
|
+
- Report needs added or changed, evidence used, assumptions added, and validation result, including any need validate still reports as naming a solution or having no goal.
|
|
52
62
|
|
|
@@ -39,7 +39,10 @@ acceptance:
|
|
|
39
39
|
1. Confirm the `scenarioId` exists.
|
|
40
40
|
2. Add or revise a journey with `title`, `description`, `entryPoint`, `exitPoint`, and 4 to 7 steps.
|
|
41
41
|
3. For each step, fill the real blueprint lanes used by `buildBlueprintViewModel()`: `userAction`, `frontstage`, `backstage`, `supportProcesses`, `dataDependencies`, `securityAndGovernance`, `painPoints`, `exceptionHandling`, `needIds`, `screenIds`, `evidenceIds`, and `decisionIds`.
|
|
42
|
-
4.
|
|
42
|
+
4. Set the journey's `state` to match the scenario's: `as-is` for a journey map of the work today, `to-be` for the work with the new design.
|
|
43
|
+
5. Where the evidence shows them, add the journey map's own lanes to each step: `opportunities` (what could be better here) and `sentiment` (how the step feels, -2 to 2). Two or more sentiments draw a sentiment line. Leave them out rather than guessing.
|
|
44
|
+
6. List the requirements a step must meet in `requirementIds` and the principles it applies in `principleIds`. A principle is never an `evidenceIds` entry.
|
|
45
|
+
7. Flag missing screens or evidence instead of hiding gaps in free text.
|
|
43
46
|
|
|
44
47
|
## Guardrails
|
|
45
48
|
- Do not put all detail in `userAction`; the blueprint views render lane content separately.
|