@hippo-digital/hippocampus 2.4.0 → 2.6.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.
Files changed (51) hide show
  1. package/CHANGELOG.md +128 -0
  2. package/README.md +19 -0
  3. package/assets/dist/hippocampus.css +1 -1
  4. package/assets/hippocampus.scss +34 -1
  5. package/bin/hippocampus.js +1 -1
  6. package/docs/add-project-context.md +225 -0
  7. package/docs/agent-roadmap.md +6 -1
  8. package/docs/agent-workflow.md +6 -1
  9. package/docs/ask-whats-already-known.md +159 -0
  10. package/docs/check-for-unintended-consequences.md +191 -0
  11. package/docs/colour-pairings.md +6 -0
  12. package/docs/components.md +7 -1
  13. package/docs/custom-agents-usage.md +6 -1
  14. package/docs/data-and-governance.md +188 -0
  15. package/docs/design-actions-and-decisions.md +5 -0
  16. package/docs/diagrams/README.md +44 -0
  17. package/docs/diagrams/evidence-flow.mmd +56 -0
  18. package/docs/diagrams/mermaid.config.json +20 -0
  19. package/docs/hippocampus-for-designers-and-researchers.md +9 -3
  20. package/docs/hippocampus-technical.md +7 -1
  21. package/docs/images/evidence-flow.svg +1 -0
  22. package/docs/import-a-research-round.md +233 -0
  23. package/docs/link-insights-to-needs.md +225 -0
  24. package/docs/prompt-architecture-guardrails.md +6 -1
  25. package/docs/repeatable-research-round-ingestion.md +9 -3
  26. package/docs/research-knowledge-graph.md +12 -4
  27. package/docs/research-source-file-conventions.md +7 -2
  28. package/docs/review-and-promote-a-draft.md +212 -0
  29. package/docs/source-model.md +7 -1
  30. package/docs/start-here.md +223 -0
  31. package/docs/turn-personas-into-users-and-needs.md +207 -0
  32. package/lib/create-router.js +26 -3
  33. package/lib/docs.js +288 -30
  34. package/lib/templates.js +1 -1
  35. package/package.json +1 -1
  36. package/scripts/consequences.js +7 -5
  37. package/scripts/import-project-context.js +17 -5
  38. package/scripts/import-research-deck.js +31 -6
  39. package/scripts/known.js +2 -2
  40. package/scripts/link-insights-to-needs.js +38 -13
  41. package/scripts/promote-project-context-draft.js +66 -15
  42. package/scripts/promote-research-draft.js +99 -12
  43. package/scripts/smoke-routes.js +8 -1
  44. package/scripts/sync-project-context.js +90 -12
  45. package/skills/ingest-project-context/SKILL.md +1 -1
  46. package/skills/skills.json +2 -2
  47. package/skills/structure-project-context-draft/SKILL.md +1 -1
  48. package/templates/project-context.xlsx +0 -0
  49. package/views/hippocampus/doc.html +15 -0
  50. package/views/hippocampus/docs.html +42 -13
  51. package/views/hippocampus/research.html +9 -4
@@ -0,0 +1,223 @@
1
+ ---
2
+ section: start
3
+ order: 10
4
+ audience: [viewer, cli]
5
+ summary: What Hippocampus is and is not, how research moves through it, and how to get it running in a prototype.
6
+ ---
7
+ # Start here
8
+
9
+ Hippocampus keeps a design team's knowledge in one connected place: the
10
+ research a team has done, what it learned, the needs that came out of it, and
11
+ the journeys and screens built to meet them. Every record is linked to the
12
+ records it relies on, so you can follow a screen back to the research that
13
+ shaped it.
14
+
15
+ This page covers what Hippocampus is, how research moves through it, and how
16
+ to set it up. If you only ever look at the pages in a prototype and never run
17
+ commands, read the first three sections and skip to
18
+ [If you only use the viewer](#if-you-only-use-the-viewer).
19
+
20
+ ## What Hippocampus is
21
+
22
+ - **A structured record.** Users, needs, research rounds, insights, evidence,
23
+ scenarios, journeys, screens and decisions, each stored as data in the same
24
+ repository as your NHS Prototype Kit prototype.
25
+ - **A set of links between them.** A need says which evidence supports it. A
26
+ screen says which needs it meets. A decision says what it changed. That is
27
+ what lets you ask "why is this screen like this?" and get an answer.
28
+ - **A viewer.** Pages inside your prototype, at `/hippocampus`, that show the
29
+ records and the links between them. Nobody has to read the data files.
30
+ - **A set of commands and skills.** Commands bring research in and check the
31
+ record holds together. Skills are written instructions an AI agent follows
32
+ to do the longer jobs, such as tidying a research draft or turning a
33
+ scenario into a journey.
34
+
35
+ ## What it is not
36
+
37
+ - **Not where your research files live.** Your shared drive, or wherever your
38
+ team keeps research, stays the home of the original files. Hippocampus holds
39
+ what was learned from them and where it came from.
40
+ - **Not an analysis tool.** It does not decide which findings matter. People
41
+ do, and the record shows who decided and on what evidence.
42
+ - **Not automatic.** Nothing becomes part of the record until a person
43
+ approves it.
44
+ - **Not a hosted service.** It runs inside your prototype, on your machine,
45
+ like the rest of the prototype does.
46
+
47
+ ## How research moves through it
48
+
49
+ ![How evidence moves through Hippocampus: seven steps from inbox to viewer, with a person approving each draft before it becomes part of the record](images/evidence-flow.svg)
50
+
51
+ The list below describes the same steps.
52
+ [Open the diagram on its own](images/evidence-flow.svg) to see it full size.
53
+
54
+ 1. **Inbox.** You put research files in `hippocampus/inbox/research/`. Decks,
55
+ PDFs, Word documents, spreadsheets and plain text notes all work.
56
+ 2. **Import.** `npx hippocampus research sync` reads each new file on your
57
+ machine and writes a draft. Nothing is sent anywhere.
58
+ 3. **Draft.** The draft goes into `hippocampus/imports/research/`. It is a
59
+ machine's reading of a messy file, so nothing treats it as true yet.
60
+
61
+ *Optional:* an AI agent can tidy the draft using the
62
+ `structure-research-draft` skill. Whatever the agent reads is sent to that
63
+ agent's service. See [When anything leaves your machine](#when-anything-leaves-your-machine).
64
+ 4. **Review.** A person reads the draft. If it is not right, it goes back to be
65
+ fixed. The `review-research-import-draft` skill can help someone check it,
66
+ but it does not decide.
67
+ 5. **Promote.** A person runs `npx hippocampus promote research` for the draft
68
+ they reviewed. This is the only step that writes to the record, and nothing
69
+ runs it on its own.
70
+
71
+ `research sync` asks whether to promote straight after importing. The
72
+ answer defaults to no. Say no until someone has read the draft, and do not
73
+ use `--yes`, which promotes without asking.
74
+ 6. **Source.** Promoted records live in `hippocampus/source/`. This is the
75
+ record everything else is built from.
76
+ 7. **Viewer.** The pages at `/hippocampus` are built from `source/` each time
77
+ you load one, so a promoted change shows up when you refresh.
78
+
79
+ Alongside the viewer, skills that review or hand over work write their output
80
+ to `artefacts/`: route review packs, accessibility reviews and delivery
81
+ summaries. Nothing reads them back, so `artefacts/` is safe to delete.
82
+
83
+ ## If you only use the viewer
84
+
85
+ You can follow the evidence behind a prototype without running anything. The
86
+ pages below are under `/hippocampus` by default; your team may have mounted
87
+ the viewer somewhere else.
88
+
89
+ | To find out | Open |
90
+ | --- | --- |
91
+ | Where the work stands: rounds not yet mined, insights with no need, needs with no screen | `/hippocampus` |
92
+ | Why a screen is designed the way it is | `/hippocampus/trace`, then choose the screen |
93
+ | What depends on a piece of research | any evidence link on a need or user page, which opens its impact page |
94
+ | Every need, and what supports it | `/hippocampus/user-needs` |
95
+ | The journey being prototyped, and what it is built on | `/hippocampus/handover` |
96
+ | How the records connect | `/hippocampus/graph` |
97
+ | This guide | `/hippocampus/docs` |
98
+
99
+ A link that is missing in the viewer is a link missing in the record. Ask the
100
+ team to add it rather than drawing it in by hand somewhere else.
101
+
102
+ ## Set it up
103
+
104
+ ### Before you start
105
+
106
+ You need:
107
+
108
+ - an NHS Prototype Kit project, using `nhsuk-prototype-kit` 8.3.0 or later
109
+ - Node.js 22.16.0 or later
110
+
111
+ ### Install it
112
+
113
+ In your prototype's folder:
114
+
115
+ ```bash
116
+ npm install @hippo-digital/hippocampus
117
+ ```
118
+
119
+ ### Set up the knowledge base
120
+
121
+ See what would change first:
122
+
123
+ ```bash
124
+ npx hippocampus init --dry-run
125
+ ```
126
+
127
+ Then run it for real:
128
+
129
+ ```bash
130
+ npx hippocampus init
131
+ ```
132
+
133
+ This writes:
134
+
135
+ - `hippocampus.config.json`, which tells every command where your knowledge
136
+ base is
137
+ - `hippocampus/`, with an empty knowledge base and its `inbox/`, `imports/`
138
+ and `source/` folders
139
+ - `artefacts/`, with a short README in each folder
140
+
141
+ It also adds two short blocks to your prototype, one in `app/routes.js` and
142
+ one in `app.js`, so the viewer appears inside it. Both are marked, and
143
+ `npx hippocampus eject` takes them back out without touching your knowledge
144
+ base.
145
+
146
+ Before anyone imports research, add the lines in
147
+ [Keep research files and drafts out of git](data-and-governance.md#keep-research-files-and-drafts-out-of-git)
148
+ to your `.gitignore`. Research files and drafts hold participants' words, and
149
+ anything committed stays in the repository's history.
150
+
151
+ ### Check it worked
152
+
153
+ ```bash
154
+ npx hippocampus doctor
155
+ ```
156
+
157
+ The first line is the project folder it found. If that is wrong, nothing
158
+ after it will be right: run the command from inside your prototype, or pass
159
+ `--root <folder>`.
160
+
161
+ After that, `doctor` checks the config, the knowledge base, the two blocks in
162
+ your prototype and whether the records link up. Then it starts the prototype
163
+ and opens every page to make sure each one loads. A failed check says what went
164
+ wrong, and usually what to run next.
165
+
166
+ Start your prototype as you normally would and go to `/hippocampus`. An empty
167
+ knowledge base still shows every page, and tells you what to add next.
168
+
169
+ ### If your team uses an AI agent
170
+
171
+ ```bash
172
+ npx hippocampus skills install
173
+ ```
174
+
175
+ This copies the skills, agent roles and instructions into `.github/` in your
176
+ prototype, where agents such as GitHub Copilot read them. Run it again after
177
+ upgrading Hippocampus; it leaves alone any file your team has edited and tells
178
+ you which.
179
+
180
+ ## When anything leaves your machine
181
+
182
+ - **The `hippocampus` commands send nothing anywhere.** Importing reads PDFs,
183
+ Word, PowerPoint and Excel files on your machine. Apart from the optional
184
+ Gemini tool below, the only network request any command makes is `doctor`
185
+ opening your own prototype's pages.
186
+ - **Skills are carried out by an AI agent, and what the agent reads goes to
187
+ its service.** If you point a skill at a research transcript, that
188
+ transcript is sent to whichever service runs the agent. Agree with your
189
+ information governance lead which agents may read which material before the
190
+ first research file goes into the inbox. The same applies to any agent
191
+ connected to `hippocampus mcp`, which hands it the knowledge base.
192
+ - **One optional tool calls Google Gemini.** `hippocampus mcp` serves the
193
+ knowledge base to agents. One of its tools, `design_brain_ask`, sends the
194
+ question and the parts of the knowledge base it looks up to Gemini. It is
195
+ off unless someone sets `GEMINI_API_KEY` and `DESIGN_BRAIN_MODEL` and
196
+ installs `@google/genai`. The rest of `hippocampus mcp` uses no model.
197
+
198
+ [Data and governance](data-and-governance.md) covers this in more detail,
199
+ along with who can see the knowledge base and what to keep out of git.
200
+
201
+ ## What to read next
202
+
203
+ - [Data and governance](data-and-governance.md): what to agree with your
204
+ information governance lead before the first research file goes in
205
+ - [Ask what's already known](ask-whats-already-known.md): check what the team
206
+ already knows before you research or design something
207
+ - [Import a research round](import-a-research-round.md) and
208
+ [Review a draft and promote it](review-and-promote-a-draft.md): bring a
209
+ round of research in, steps 1 to 6 above
210
+ - [Add project context](add-project-context.md) and
211
+ [Turn personas into users and needs](turn-personas-into-users-and-needs.md):
212
+ the briefing material and the users everything else hangs off
213
+ - [Link insights to needs](link-insights-to-needs.md) and
214
+ [Check for unintended consequences](check-for-unintended-consequences.md):
215
+ connect the research to the needs, then use those links before designing a
216
+ new journey
217
+ - [Hippocampus for designers and researchers](hippocampus-for-designers-and-researchers.md):
218
+ the record types and viewer pages in more detail
219
+ - [Research source file conventions](research-source-file-conventions.md):
220
+ how to write research files so they import cleanly
221
+ - [Repeatable research round ingestion](repeatable-research-round-ingestion.md):
222
+ the full import and promotion procedure
223
+ - [Source model](source-model.md): every record type and its fields
@@ -0,0 +1,207 @@
1
+ ---
2
+ section: recipes
3
+ order: 50
4
+ audience: [viewer, cli]
5
+ summary: Turn persona documents into the users and needs everything else hangs off. There is no draft for this, so git is where you review it.
6
+ ---
7
+ # Turn personas into users and needs
8
+
9
+ Users and their needs are what the rest of the knowledge base points at.
10
+ Scenarios, journeys, screens and research insights all name the user and the
11
+ needs they are about, so users usually come first. They come from your persona
12
+ documents.
13
+
14
+ This works differently from importing research. There is no import command
15
+ and no draft. Either an AI agent reads the persona documents and writes users,
16
+ needs and the evidence behind them straight into `hippocampus/source/`, or you
17
+ add them by hand. Either way, **you review the change with git before you
18
+ commit it**.
19
+
20
+ ## Who this is for
21
+
22
+ Researchers and designers who own the personas. You need to be able to run
23
+ commands in the prototype, and either have an AI agent set up or be happy
24
+ editing JSON files.
25
+
26
+ ## Before you start
27
+
28
+ ### Agree whether an agent may read the personas
29
+
30
+ Personas are research. If your team uses the agent route, what the agent reads
31
+ is sent to its service. Agree this first; see
32
+ [Data and governance](data-and-governance.md#agree-these-before-your-first-import).
33
+ If an agent may not read them, add the records by hand, described in
34
+ [By hand](#by-hand).
35
+
36
+ ### Start from a clean record
37
+
38
+ Commit or set aside any other changes in `hippocampus/source/` first, so that
39
+ `git diff` shows only what this step adds, and throwing it away throws away
40
+ nothing else.
41
+
42
+ ### Check the documents say enough
43
+
44
+ Each persona becomes one user. The more the document states in its own words,
45
+ the more the record holds:
46
+
47
+ - who the group is
48
+ - what they are responsible for
49
+ - what they need, and why
50
+ - their access needs, if the research covered them
51
+
52
+ Nothing is filled in from judgement. A persona that states two needs gives a
53
+ user with two needs, which is the honest result.
54
+
55
+ ## At the command line
56
+
57
+ 1. Copy the persona documents into `hippocampus/inbox/personas/`. The
58
+ `.gitignore` lines in
59
+ [Keep research files and drafts out of git](data-and-governance.md#keep-research-files-and-drafts-out-of-git)
60
+ keep them out of the repository.
61
+
62
+ 2. Ask your agent to use the `ingest-user-personas` skill on them, for
63
+ example: "Use the ingest-user-personas skill on the documents in
64
+ hippocampus/inbox/personas."
65
+
66
+ For each document, the agent adds:
67
+
68
+ - one **evidence** record for the document, with its file name as
69
+ `sourcePath`, so anyone can find the original
70
+ - one **user**, with the description and responsibilities from the document
71
+ - the **needs** the document states, in its own words, each citing that
72
+ evidence
73
+ - an **assumption** for every field it had to fill that the document did
74
+ not state
75
+
76
+ Two fields cannot be left empty, so they are where a guess could hide. When
77
+ the document does not rank needs, each need's priority is `medium` and an
78
+ assumption says so. When it does not cover access needs, the user's access
79
+ needs are exactly `Not yet researched`, and an assumption says that too.
80
+
81
+ 3. Check it:
82
+
83
+ ```bash
84
+ npx hippocampus validate
85
+ ```
86
+
87
+ 4. Review the change:
88
+
89
+ ```bash
90
+ git diff hippocampus/source
91
+ ```
92
+
93
+ Check that:
94
+
95
+ - there is one user per persona, and none merges two personas
96
+ - every need is one the document states, in its words, and belongs to the
97
+ right user
98
+ - every need cites the persona's evidence record
99
+ - nothing is invented: no responsibility, need or access need that is not in
100
+ the document
101
+ - the assumptions name what the documents left out
102
+ - nothing identifies a real person
103
+
104
+ 5. Commit `hippocampus/source/` if it is right. To throw the whole change away
105
+ instead, run `git checkout -- hippocampus/source`. That puts back every file
106
+ in it as last committed, which is why you started from a clean record.
107
+
108
+ ### By hand
109
+
110
+ [Source model](source-model.md#users) describes each field. For each persona,
111
+ add to these files in `hippocampus/source/`:
112
+
113
+ - `evidence.json`: one record with `sourceType: "user persona"` and the
114
+ document's file name as `sourcePath`
115
+ - `users.json`: the user
116
+ - `needs.json`: each need, with the user's id as `userId` and the evidence
117
+ record's id in `evidenceIds`
118
+ - `relationships.json`: a `has-need` link from the user to each need
119
+ - `assumptions.json`: anything you had to fill in that the document did not
120
+ say
121
+
122
+ Then run `npx hippocampus validate`, and review with `git diff` as above.
123
+
124
+ ## What it looks like
125
+
126
+ This example is made up. A user and one of their needs, as they appear in the
127
+ diff:
128
+
129
+ ```json
130
+ {
131
+ "id": "carer",
132
+ "label": "Carer",
133
+ "description": "Someone booking blood tests for a person they look after.",
134
+ "responsibilities": ["Book and keep track of tests for someone else"],
135
+ "accessNeeds": ["Not yet researched"]
136
+ }
137
+ ```
138
+
139
+ ```json
140
+ {
141
+ "id": "need-see-booked-appointments",
142
+ "userId": "carer",
143
+ "statement": "I need to see the appointments I have booked for my parent, so that I do not book the same test twice.",
144
+ "priority": "medium",
145
+ "evidenceIds": ["evidence-carer-persona"]
146
+ }
147
+ ```
148
+
149
+ `validate` then reports the gaps the import left on purpose:
150
+
151
+ ```text
152
+ $ npx hippocampus validate
153
+ hippocampus: knowledge data is valid
154
+ info 3 of 3 users have access needs not yet researched
155
+ info 4 of 6 needs (67%) sit at priority "medium" - likely the import default rather than a decision, so priority cannot sequence design work yet
156
+ ```
157
+
158
+ Those two lines are not errors. They are the gaps the personas left, kept
159
+ visible until research or a team decision fills them.
160
+
161
+ ## In the viewer
162
+
163
+ - **Users** (`/hippocampus/users`) lists every user with how many needs and
164
+ scenarios they have.
165
+ - A user's page shows their responsibilities and access needs, then each need
166
+ with the evidence behind it. `Not yet researched` shows there as it is.
167
+ - **User needs** (`/hippocampus/user-needs`) lists every need. Filter it by
168
+ user or by priority.
169
+ - The front page's **Needs with no screen** count goes up: every new need is
170
+ design work nobody has started.
171
+
172
+ ## How to check it worked
173
+
174
+ - `npx hippocampus validate` says `knowledge data is valid`.
175
+ - Each persona is on the Users page, with the number of needs its document
176
+ states.
177
+ - Each need's page lists the persona's evidence under it.
178
+
179
+ ## If it goes wrong
180
+
181
+ - **"users.0.accessNeeds: Too small: expected array to have >=1 items"**: a
182
+ user has no access needs at all. If nobody has researched them, write
183
+ `Not yet researched`.
184
+ - **"needs.5.evidenceIds: Too small: expected array to have >=1 items"**: a
185
+ need cites no evidence. Every need from a persona cites the persona's
186
+ evidence record. The number is the need's position in the file, counting
187
+ from 0.
188
+ - **"need need-reminder-text: userId references missing id patients"**: the
189
+ need names a user that does not exist, here because of a typing mistake.
190
+ Use the id from `users.json`.
191
+ - **A need you did not expect**: if it is not in the document, take it out. A
192
+ need that came from somewhere else needs its own evidence.
193
+ - **The diff shows changes you did not make**: something else in
194
+ `hippocampus/source/` had changed before you started. Sort those out
195
+ separately before committing.
196
+
197
+ ## Related skills
198
+
199
+ - `ingest-user-personas`: the agent route described above.
200
+ - `add-user-needs`: adds needs to a user who already exists, or sharpens vague
201
+ ones, each linked to the evidence behind it.
202
+ - `find-unintended-consequences`: when a new kind of user arrives, checks what
203
+ their journeys could break for the users already here. See
204
+ [Check for unintended consequences](check-for-unintended-consequences.md).
205
+
206
+ Whatever an agent reads is sent to the agent's service. See
207
+ [When anything leaves your machine](data-and-governance.md#when-anything-leaves-your-machine).
@@ -1,7 +1,7 @@
1
1
  const express = require('express')
2
2
  const path = require('path')
3
3
  const packagePaths = require('./package-paths')
4
- const { listDocs, readDoc, packageVersion } = require('./docs')
4
+ const { listDocSections, readDoc, docImagePath, packageVersion } = require('./docs')
5
5
  const { listTemplates, allTemplates } = require('./templates')
6
6
  const { hrefFor, listHrefFor } = require('./record-links')
7
7
  const { matchesText, facet, matchesFacet, queryWithout } = require('./filter')
@@ -377,7 +377,7 @@ function createHippocampusRouter ({ basePath, knowledgeStore, paths }) {
377
377
  // so what a team reads always matches the version they are running.
378
378
  router.get('/docs', (req, res) => {
379
379
  res.render('hippocampus/docs', {
380
- docs: listDocs(),
380
+ sections: listDocSections(),
381
381
  templates: listTemplates(paths),
382
382
  packageVersion: packageVersion()
383
383
  })
@@ -393,10 +393,33 @@ function createHippocampusRouter ({ basePath, knowledgeStore, paths }) {
393
393
  res.download(template.path, template.file)
394
394
  })
395
395
 
396
+ // Diagrams the guides embed, from the package like the guides themselves.
397
+ // docImagePath only answers for a plain name already in docs/images. The CSP
398
+ // is because an SVG opened on its own is a document that can run script:
399
+ // these are the package's own files, but the header costs nothing and means a
400
+ // diagram can only ever be a picture.
401
+ router.get('/docs/images/:file', (req, res) => {
402
+ const file = docImagePath(req.params.file)
403
+ if (!file) return res.status(404).render('hippocampus/not-found')
404
+ res.set('X-Content-Type-Options', 'nosniff')
405
+ res.set('Content-Security-Policy', "default-src 'none'; style-src 'unsafe-inline'")
406
+ res.sendFile(file)
407
+ })
408
+
409
+ // A guide sits under its section in the trail, so a reader who arrived from a
410
+ // link elsewhere can see which part of the guide they are in and get back to
411
+ // the rest of it. Not when the two share a name: "Start here > Start here"
412
+ // reads as a mistake, and the section adds nothing the page title does not.
396
413
  router.get('/docs/:slug', (req, res) => {
397
414
  const doc = readDoc(req.params.slug)
398
415
  if (!doc) return res.status(404).render('hippocampus/not-found')
399
- withLeaf(res, req, doc.title)
416
+ const section = { text: doc.sectionTitle, href: `${basePath}/docs#section-${doc.section}` }
417
+ res.locals.breadcrumbItems = buildTrail({
418
+ basePath,
419
+ path: req.path,
420
+ leaf: doc.title,
421
+ crumbs: doc.sectionTitle === doc.title ? [] : [section]
422
+ })
400
423
  res.render('hippocampus/doc', { doc, packageVersion: packageVersion() })
401
424
  })
402
425