@hippo-digital/hippocampus 1.0.0-rc.8 → 2.0.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 (93) hide show
  1. package/CHANGELOG.md +141 -3
  2. package/README.md +36 -0
  3. package/agents/README.md +6 -6
  4. package/agents/accessibility-tester.md +2 -2
  5. package/agents/ingestion-curator.md +9 -9
  6. package/agents/knowledge-builder.md +9 -9
  7. package/agents/prototype-builder.md +3 -3
  8. package/agents/screenshot-runner.md +2 -2
  9. package/agents/workflow-orchestrator.md +16 -16
  10. package/assets/dist/hippocampus.css +1 -1
  11. package/assets/hippocampus.scss +994 -133
  12. package/assets/javascript/blueprint.js +21 -0
  13. package/assets/javascript/trace.js +54 -0
  14. package/bin/hippocampus.js +9 -3
  15. package/docs/agent-roadmap.md +2 -2
  16. package/docs/custom-agents-usage.md +1 -1
  17. package/docs/repeatable-research-round-ingestion.md +3 -3
  18. package/docs/research-knowledge-graph.md +5 -5
  19. package/index.js +2 -1
  20. package/lib/breadcrumb.js +80 -0
  21. package/lib/create-router.js +246 -6
  22. package/lib/discover-projects.js +5 -0
  23. package/lib/filter.js +81 -0
  24. package/lib/flow-map.js +214 -0
  25. package/lib/lint-knowledge.js +31 -0
  26. package/lib/load-knowledge.js +335 -34
  27. package/lib/record-links.js +51 -0
  28. package/lib/templates.js +174 -0
  29. package/package.json +1 -1
  30. package/scripts/doctor.js +10 -0
  31. package/scripts/install-skills.js +93 -3
  32. package/scripts/lib/make-blueprint-template.py +107 -0
  33. package/scripts/smoke-routes.js +19 -0
  34. package/scripts/validate-skills.js +64 -5
  35. package/skills/README.md +18 -18
  36. package/skills/SKILL-FORMAT.md +24 -5
  37. package/skills/{add-prototype-screen.skill.md → add-prototype-screen/SKILL.md} +2 -0
  38. package/skills/{add-scenario.skill.md → add-scenario/SKILL.md} +2 -0
  39. package/skills/{add-user-needs.skill.md → add-user-needs/SKILL.md} +2 -0
  40. package/skills/{audit-knowledge-source.skill.md → audit-knowledge-source/SKILL.md} +2 -0
  41. package/skills/{capture-route-review-pack.skill.md → capture-route-review-pack/SKILL.md} +2 -0
  42. package/skills/{create-journey-from-scenario.skill.md → create-journey-from-scenario/SKILL.md} +2 -0
  43. package/skills/{deliver-service-slice.skill.md → deliver-service-slice/SKILL.md} +2 -0
  44. package/skills/examples/README.md +1 -1
  45. package/skills/examples/non-copilot-research-ingestion.md +1 -1
  46. package/skills/examples/non-copilot-service-slice.md +1 -1
  47. package/skills/{generate-service-slice.skill.md → generate-service-slice/SKILL.md} +2 -0
  48. package/skills/{ingest-project-context.skill.md → ingest-project-context/SKILL.md} +2 -0
  49. package/skills/{ingest-research-round.skill.md → ingest-research-round/SKILL.md} +2 -0
  50. package/skills/{ingest-user-personas.skill.md → ingest-user-personas/SKILL.md} +2 -0
  51. package/skills/{map-research-to-graph.skill.md → map-research-to-graph/SKILL.md} +2 -0
  52. package/skills/{onboard-team-member.skill.md → onboard-team-member/SKILL.md} +2 -0
  53. package/skills/{record-accessibility-review.skill.md → record-accessibility-review/SKILL.md} +2 -0
  54. package/skills/{record-design-decision.skill.md → record-design-decision/SKILL.md} +2 -0
  55. package/skills/{review-research-import-draft.skill.md → review-research-import-draft/SKILL.md} +2 -0
  56. package/skills/skills.json +21 -21
  57. package/skills/skills.schema.json +1 -1
  58. package/skills/{structure-project-context-draft.skill.md → structure-project-context-draft/SKILL.md} +2 -0
  59. package/skills/{structure-research-draft.skill.md → structure-research-draft/SKILL.md} +2 -0
  60. package/skills/{triage-research-corpus.skill.md → triage-research-corpus/SKILL.md} +2 -0
  61. package/skills/{write-delivery-summary.skill.md → write-delivery-summary/SKILL.md} +2 -0
  62. package/skills/{write-route-review-summary.skill.md → write-route-review-summary/SKILL.md} +2 -0
  63. package/templates/service-blueprint.xlsx +0 -0
  64. package/views/hippocampus/_layout.html +116 -3
  65. package/views/hippocampus/blueprint-classic.html +0 -1
  66. package/views/hippocampus/blueprint.html +0 -1
  67. package/views/hippocampus/components/_blueprint-cell.njk +6 -3
  68. package/views/hippocampus/components/_blueprint-controls.njk +2 -1
  69. package/views/hippocampus/components/_breadcrumb.njk +29 -0
  70. package/views/hippocampus/components/_connections.njk +38 -0
  71. package/views/hippocampus/components/_filters.njk +56 -0
  72. package/views/hippocampus/components/_journey-step.njk +11 -7
  73. package/views/hippocampus/components/_screen-preview.njk +41 -0
  74. package/views/hippocampus/doc.html +0 -1
  75. package/views/hippocampus/docs.html +67 -6
  76. package/views/hippocampus/evidence-impact.html +66 -33
  77. package/views/hippocampus/graph.html +137 -31
  78. package/views/hippocampus/handover-empty.html +0 -1
  79. package/views/hippocampus/handover.html +0 -1
  80. package/views/hippocampus/index.html +102 -13
  81. package/views/hippocampus/journey-flow.html +0 -1
  82. package/views/hippocampus/journey.html +21 -6
  83. package/views/hippocampus/journeys.html +63 -0
  84. package/views/hippocampus/project.html +19 -2
  85. package/views/hippocampus/record.html +33 -0
  86. package/views/hippocampus/research.html +14 -2
  87. package/views/hippocampus/route-review.html +0 -1
  88. package/views/hippocampus/scenarios.html +21 -3
  89. package/views/hippocampus/screens.html +45 -0
  90. package/views/hippocampus/trace.html +35 -22
  91. package/views/hippocampus/user-needs.html +55 -19
  92. package/views/hippocampus/user.html +131 -79
  93. package/views/hippocampus/users.html +33 -19
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hippo-digital/hippocampus",
3
- "version": "1.0.0-rc.8",
3
+ "version": "2.0.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/doctor.js CHANGED
@@ -62,6 +62,16 @@ function main () {
62
62
  (smoke.stderr || smoke.stdout || '').trim().split('\n').slice(0, 4).join('\n '))
63
63
  }
64
64
 
65
+ // Working on the package against a real project means symlinking it into that
66
+ // project's node_modules, and then the viewer is running code that is not
67
+ // published. That is the right way to do the work and the wrong thing to
68
+ // forget: a page that works here may not exist for anybody else yet.
69
+ const installedAt = path.join(root, 'node_modules/@hippo-digital/hippocampus')
70
+ if (fs.existsSync(installedAt) && fs.lstatSync(installedAt).isSymbolicLink()) {
71
+ notes.push(`hippocampus is LINKED, not installed - the viewer is running ${fs.realpathSync(installedAt)}`)
72
+ notes.push(' Anything you see here is unpublished. `npm install` restores the released version.')
73
+ }
74
+
65
75
  for (const note of notes) console.log(` note ${note}`)
66
76
 
67
77
  if (problems.length) {
@@ -47,6 +47,77 @@ function hash (text) {
47
47
  return crypto.createHash('sha256').update(text).digest('hex').slice(0, 16)
48
48
  }
49
49
 
50
+ /**
51
+ * Files to install, as paths relative to the tree root.
52
+ *
53
+ * Skills are `<name>/SKILL.md` rather than `<name>.skill.md` because that is
54
+ * what the Agent Skills standard specifies and what Copilot, Claude and the
55
+ * rest actually discover. A flat file in `.github/skills/` is read by nobody
56
+ * unless an agent has been told its exact path - which is how 21 skills sat in
57
+ * a host being loaded only when somebody named them.
58
+ *
59
+ * One level of nesting is enough for the standard, and going deeper would mean
60
+ * a skill could hide another skill.
61
+ */
62
+ function listSourceFiles (dir) {
63
+ const out = []
64
+ for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
65
+ if (entry.isDirectory()) {
66
+ for (const child of fs.readdirSync(path.join(dir, entry.name))) {
67
+ if (/\.(md|json)$/.test(child)) out.push(path.join(entry.name, child))
68
+ }
69
+ continue
70
+ }
71
+ if (/\.(md|json)$/.test(entry.name)) out.push(entry.name)
72
+ }
73
+ return out
74
+ }
75
+
76
+ /**
77
+ * Remove the flat `<name>.skill.md` files a previous version of this command
78
+ * installed, now that the same skills live at `<name>/SKILL.md`.
79
+ *
80
+ * Only files this command wrote and the host has not edited are removed - the
81
+ * manifest records a hash of each, so an edited one is left behind and named
82
+ * instead. Leaving them all would be worse than a tidiness problem: two copies
83
+ * of every skill, one of which no agent can see, and a catalog that points at
84
+ * whichever the host happens to validate.
85
+ */
86
+ function migrateFlatSkills (targetDir, manifestFiles) {
87
+ const removed = []
88
+ const keptEdited = []
89
+ const stuck = []
90
+
91
+ for (const name of Object.keys(manifestFiles)) {
92
+ if (!name.endsWith('.skill.md')) continue
93
+ const flat = path.join(targetDir, name)
94
+ if (!fs.existsSync(flat)) { delete manifestFiles[name]; continue }
95
+
96
+ if (hash(fs.readFileSync(flat, 'utf8')) !== manifestFiles[name]) {
97
+ keptEdited.push(name)
98
+ continue
99
+ }
100
+ if (!dryRun) {
101
+ // A removal that fails must not abort the upgrade. The files are already
102
+ // installed in their new home by this point, so throwing here would leave
103
+ // the host migrated but with its catalog unmerged and its manifest
104
+ // unwritten - a worse state than a leftover file, and one the next run
105
+ // cannot reason about. Read-only files, a lock on Windows and a mount
106
+ // that refuses unlink all reach this line.
107
+ try {
108
+ fs.rmSync(flat)
109
+ delete manifestFiles[name]
110
+ } catch (error) {
111
+ stuck.push(`${name} (${error.code || error.message})`)
112
+ continue
113
+ }
114
+ }
115
+ removed.push(name)
116
+ }
117
+
118
+ return { removed, keptEdited, stuck }
119
+ }
120
+
50
121
  function main () {
51
122
  const { root } = resolveRoot({ argv })
52
123
  const skillsTarget = path.join(root, '.github/skills')
@@ -87,6 +158,23 @@ function main () {
87
158
  }
88
159
 
89
160
  if (tree.key === 'files') {
161
+ const migrated = migrateFlatSkills(path.join(root, tree.target), manifest[tree.key])
162
+ if (migrated.removed.length) {
163
+ console.log(` ${dryRun ? 'would remove' : 'removed'} the old flat copies: ${migrated.removed.length}`)
164
+ }
165
+ if (migrated.stuck.length) {
166
+ anySkipped = true
167
+ console.log(' old flat copies that could not be removed:')
168
+ for (const name of migrated.stuck) console.log(` ${name}`)
169
+ console.log(' nothing reads these any more - delete them by hand.')
170
+ }
171
+ if (migrated.keptEdited.length) {
172
+ anySkipped = true
173
+ console.log(' old flat copies left because they have been edited here:')
174
+ for (const name of migrated.keptEdited) console.log(` ${name}`)
175
+ console.log(' nothing reads these any more - keep what you changed, then delete them.')
176
+ }
177
+
90
178
  const merged = mergeCatalog(skillsTarget, manifest)
91
179
  wroteAnything = wroteAnything || merged.added.length > 0
92
180
  console.log(` ${dryRun ? 'would add' : 'added'} to the catalog: ${merged.added.length} skills` +
@@ -132,8 +220,8 @@ function installTree (sourceDir, targetDir, manifestFiles) {
132
220
  const kept = []
133
221
  const foreign = []
134
222
 
135
- for (const name of fs.readdirSync(sourceDir)) {
136
- if (name === 'skills.json' || !/\.(skill\.md|md|json)$/.test(name)) continue
223
+ for (const name of listSourceFiles(sourceDir)) {
224
+ if (name === 'skills.json') continue
137
225
 
138
226
  const to = path.join(targetDir, name)
139
227
  const content = fs.readFileSync(path.join(sourceDir, name), 'utf8')
@@ -157,7 +245,9 @@ function installTree (sourceDir, targetDir, manifestFiles) {
157
245
 
158
246
  written.push(name)
159
247
  if (!dryRun) {
160
- fs.mkdirSync(targetDir, { recursive: true })
248
+ // `to` is <tree>/<skill>/SKILL.md, so make the file's own parent, not
249
+ // just the tree root.
250
+ fs.mkdirSync(path.dirname(to), { recursive: true })
161
251
  fs.writeFileSync(to, content)
162
252
  }
163
253
  manifestFiles[name] = incoming
@@ -0,0 +1,107 @@
1
+ """Generate the blank blueprint template the package ships.
2
+
3
+ The lane names are not invented here - they are the exact labels the importer's
4
+ swimlane triage matches, so a team filling this in lands in a mapped
5
+ destination rather than in the unmapped pile. The canonical list lives in
6
+ import-blueprint-spreadsheet.js and is passed in, so the two cannot drift.
7
+ """
8
+ import json, sys
9
+ from openpyxl import Workbook
10
+ from openpyxl.styles import Font, Alignment, PatternFill, Border, Side
11
+ from openpyxl.utils import get_column_letter
12
+
13
+ LANES = json.loads(sys.argv[1])
14
+ OUT = sys.argv[2]
15
+
16
+ wb = Workbook()
17
+ thin = Side(style="thin", color="D8DDE0")
18
+ box = Border(left=thin, right=thin, top=thin, bottom=thin)
19
+ head = Font(bold=True)
20
+ wrap = Alignment(wrap_text=True, vertical="top")
21
+
22
+ # --- How to use -----------------------------------------------------------
23
+ ws = wb.active
24
+ ws.title = "How to use"
25
+ ws.column_dimensions["A"].width = 100
26
+ rows = [
27
+ ("Service blueprint", True),
28
+ ("", False),
29
+ ("Fill in the Blueprint sheet, then import it:", False),
30
+ (" hippocampus import blueprint <this-file.xlsx>", False),
31
+ ("", False),
32
+ ("That writes a draft for you to check. Nothing reaches the knowledge base", False),
33
+ ("until you promote it.", False),
34
+ ("", False),
35
+ ("The Blueprint sheet", True),
36
+ ("", False),
37
+ ("One column per step, left to right, in the order the user meets them.", False),
38
+ ("One row per swimlane. The row labels in column A are the ones the importer", False),
39
+ ("recognises - keep them as they are and your content lands in the right", False),
40
+ ("place. A label it does not recognise is not lost: it is reported as", False),
41
+ ("unmapped for you to decide about.", False),
42
+ ("", False),
43
+ ("Put one item per line inside a cell. Blank cells are fine - a lane that", False),
44
+ ("does not apply to a step is a fact about the step, not a gap to fill.", False),
45
+ ("", False),
46
+ ("The Evidence sheet", True),
47
+ ("", False),
48
+ ("What each step rests on: the need it serves, the research behind it, or", False),
49
+ ("the document it came from. One row per link.", False),
50
+ ("", False),
51
+ ("The Sources sheet", True),
52
+ ("", False),
53
+ ("Where the evidence came from, so a reader can get back to the original.", False),
54
+ ]
55
+ for i, (text, bold) in enumerate(rows, start=1):
56
+ c = ws.cell(row=i, column=1, value=text)
57
+ if bold:
58
+ c.font = head
59
+
60
+ # --- Blueprint ------------------------------------------------------------
61
+ bp = wb.create_sheet("Blueprint")
62
+ bp.column_dimensions["A"].width = 28
63
+ for col in range(2, 8):
64
+ bp.column_dimensions[get_column_letter(col)].width = 34
65
+
66
+ bp.cell(row=1, column=1, value="Swimlane").font = head
67
+ for step in range(1, 7):
68
+ c = bp.cell(row=1, column=step + 1, value=f"{step}. ")
69
+ c.font = head
70
+ c.alignment = wrap
71
+ c.border = box
72
+ bp.cell(row=1, column=1).border = box
73
+
74
+ for r, lane in enumerate(LANES, start=2):
75
+ c = bp.cell(row=r, column=1, value=lane)
76
+ c.font = head
77
+ c.alignment = wrap
78
+ c.border = box
79
+ for step in range(1, 7):
80
+ cell = bp.cell(row=r, column=step + 1, value="")
81
+ cell.alignment = wrap
82
+ cell.border = box
83
+ bp.row_dimensions[r].height = 56
84
+ bp.freeze_panes = "B2"
85
+
86
+ # --- Evidence -------------------------------------------------------------
87
+ ev = wb.create_sheet("Evidence")
88
+ ev_cols = ["Step", "Screen", "Route", "Type", "Round", "Participants", "Statement", "Source ID"]
89
+ for i, name in enumerate(ev_cols, start=1):
90
+ c = ev.cell(row=1, column=i, value=name)
91
+ c.font = head
92
+ c.border = box
93
+ ev.column_dimensions[get_column_letter(i)].width = 22 if name != "Statement" else 60
94
+ ev.freeze_panes = "A2"
95
+
96
+ # --- Sources --------------------------------------------------------------
97
+ sr = wb.create_sheet("Sources")
98
+ sr_cols = ["Source ID", "Source title", "Reference", "Used for"]
99
+ for i, name in enumerate(sr_cols, start=1):
100
+ c = sr.cell(row=1, column=i, value=name)
101
+ c.font = head
102
+ c.border = box
103
+ sr.column_dimensions[get_column_letter(i)].width = 30 if i > 1 else 14
104
+ sr.freeze_panes = "A2"
105
+
106
+ wb.save(OUT)
107
+ print("wrote", OUT)
@@ -1,6 +1,7 @@
1
1
  const { spawn } = require('child_process')
2
2
  const { createContextOrExit } = require('../lib/context')
3
3
  const { listDocs } = require('../lib/docs')
4
+ const { allTemplates } = require('../lib/templates')
4
5
  const ctx = createContextOrExit()
5
6
 
6
7
  const port = process.env.SMOKE_PORT || 4587
@@ -53,11 +54,13 @@ function buildRoutes (basePath, knowledge) {
53
54
  `${basePath}/users`,
54
55
  `${basePath}/user-needs`,
55
56
  `${basePath}/scenarios`,
57
+ `${basePath}/journeys`,
56
58
  `${basePath}/research`,
57
59
  `${basePath}/graph`,
58
60
  `${basePath}/trace`,
59
61
  `${basePath}/handover`,
60
62
  `${basePath}/docs`,
63
+ `${basePath}/screens`,
61
64
  // The viewer serves these itself. If they 404 the pages load unstyled and
62
65
  // the blueprint stops working, which is exactly the kind of breakage a
63
66
  // smoke test should catch rather than a person noticing later.
@@ -65,10 +68,26 @@ function buildRoutes (basePath, knowledge) {
65
68
  `${basePath}/assets/blueprint.js`
66
69
  ])
67
70
 
71
+ for (const template of allTemplates()) {
72
+ routes.add(`${basePath}/templates/${template.file}`)
73
+ }
74
+
68
75
  for (const doc of listDocs()) {
69
76
  routes.add(`${basePath}/docs/${doc.slug}`)
70
77
  }
71
78
 
79
+ // Detail pages are generated per record, so check a sample rather than all
80
+ // of them - 132 needs would make the smoke test a load test.
81
+ for (const collection of [
82
+ { items: knowledge.needs, path: 'needs' },
83
+ { items: knowledge.insights, path: 'insights' },
84
+ { items: knowledge.screens, path: 'screens' }
85
+ ]) {
86
+ for (const item of (collection.items || []).slice(0, 3)) {
87
+ routes.add(`${basePath}/${collection.path}/${item.id}`)
88
+ }
89
+ }
90
+
72
91
  for (const journey of knowledge.journeys) {
73
92
  routes.add(`${basePath}/journeys/${journey.id}`)
74
93
  routes.add(`${basePath}/journeys/${journey.id}/blueprint`)
@@ -49,7 +49,7 @@ const catalogEntrySchema = z.object({
49
49
  id: z.string().regex(kebabCasePattern),
50
50
  title: z.string().min(1),
51
51
  purpose: z.string().min(1),
52
- file: z.string().regex(/^[^\0]+\.skill\.md$/),
52
+ file: z.string().regex(/^[a-z0-9]+(?:-[a-z0-9]+)*\/SKILL\.md$/),
53
53
  owners: z.array(z.string().regex(kebabCasePattern)).min(1),
54
54
  composes: z.array(z.string().regex(kebabCasePattern)).min(1).optional(),
55
55
  legacyPrompt: z.string().regex(/^[^\0]+\.prompt\.md$/).optional(),
@@ -71,6 +71,11 @@ const catalogSchema = z.object({
71
71
  }).strict()
72
72
 
73
73
  const frontMatterSchema = z.object({
74
+ // Required by the Agent Skills standard. `name` must equal the directory
75
+ // name and `id`; `description` is the only thing an agent reads before
76
+ // choosing a skill, so a missing or empty one means the skill never fires.
77
+ name: z.string().regex(kebabCasePattern).max(64),
78
+ description: z.string().min(1).max(1024),
74
79
  id: z.string().regex(kebabCasePattern),
75
80
  title: z.string().min(1),
76
81
  purpose: z.string().min(1),
@@ -85,12 +90,41 @@ const frontMatterSchema = z.object({
85
90
  acceptance: z.array(z.string().min(1)).min(1)
86
91
  }).strict()
87
92
 
93
+ /**
94
+ * Every `<name>/SKILL.md` under the skills directory.
95
+ *
96
+ * Also reports a leftover flat `<name>.skill.md`, because that is a file no
97
+ * agent runtime will ever read - it looks installed and is not. An upgrade
98
+ * removes the ones it wrote; one the host edited survives, and this is where
99
+ * they hear about it.
100
+ */
101
+ function listSkillFiles (dir) {
102
+ const found = []
103
+ const stale = []
104
+ for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
105
+ if (entry.isDirectory()) {
106
+ if (fs.existsSync(path.join(dir, entry.name, 'SKILL.md'))) {
107
+ found.push(path.join(entry.name, 'SKILL.md'))
108
+ }
109
+ continue
110
+ }
111
+ if (entry.name.endsWith('.skill.md')) stale.push(entry.name)
112
+ }
113
+ found.sort()
114
+ found.stale = stale
115
+ return found
116
+ }
117
+
88
118
  function main () {
89
119
  const catalog = catalogSchema.parse(readJson(catalogPath))
90
120
  const errors = []
91
- const skillFiles = fs.readdirSync(skillsDir)
92
- .filter((name) => name.endsWith('.skill.md'))
93
- .sort()
121
+ const skillFiles = listSkillFiles(skillsDir)
122
+ for (const name of skillFiles.stale || []) {
123
+ errors.push(`Skill file is in the old flat layout and no agent runtime will read it: ` +
124
+ `${path.join('.github/skills', name)} - it belongs at ` +
125
+ `${path.join('.github/skills', name.replace(/\.skill\.md$/, ''), 'SKILL.md')}`)
126
+ }
127
+
94
128
  const catalogFiles = new Set(catalog.skills.map((skill) => skill.file))
95
129
  const catalogIds = new Set(catalog.skills.map((skill) => skill.id))
96
130
 
@@ -156,7 +190,7 @@ function validateAgents (catalog, errors) {
156
190
  const referenced = new Set()
157
191
  for (const name of agentFiles) {
158
192
  const text = fs.readFileSync(path.join(agentsDir, name), 'utf8')
159
- for (const match of text.matchAll(/\.github\/skills\/([a-z0-9-]+\.skill\.md)/g)) {
193
+ for (const match of text.matchAll(/\.github\/skills\/([a-z0-9-]+\/SKILL\.md)/g)) {
160
194
  referenced.add(match[1])
161
195
  if (!catalog.skills.some((skill) => skill.file === match[1])) {
162
196
  errors.push(`agents/${name} names a skill that is not in the catalog: ${match[1]}`)
@@ -199,6 +233,31 @@ function validateSkillFile (skillPath, catalogEntry, catalogIds, errors) {
199
233
 
200
234
  const metadata = result.data
201
235
 
236
+ // The standard requires `name` to match the directory, and this catalog keys
237
+ // on `id`. Three spellings of one identifier is two chances to drift, so they
238
+ // are asserted equal rather than trusted.
239
+ const dirName = path.basename(path.dirname(skillPath))
240
+ if (metadata.name !== dirName) {
241
+ errors.push(`${path.relative(rootDir, skillPath)} front matter: name "${metadata.name}" ` +
242
+ `does not match its directory "${dirName}" - the Agent Skills standard requires them to match`)
243
+ }
244
+ if (metadata.name !== metadata.id) {
245
+ errors.push(`${path.relative(rootDir, skillPath)} front matter: name "${metadata.name}" ` +
246
+ `and id "${metadata.id}" differ`)
247
+ }
248
+
249
+ // A description that only restates the title never fires: an agent picks a
250
+ // skill by matching this string against what somebody typed, so it has to
251
+ // carry the trigger, not just the label.
252
+ // "Use when a scenario exists", "Use after the import", "Use before promoting"
253
+ // are all triggers. The rule is that SOME trigger clause is present, not that
254
+ // it is phrased one way - the first cut demanded "use when" and rejected six
255
+ // descriptions that named their trigger perfectly well.
256
+ if (!/\buse (when|after|before|if|for|to|this|it)\b/i.test(metadata.description)) {
257
+ errors.push(`${path.relative(rootDir, skillPath)} front matter: description does not say when to ` +
258
+ `use the skill - an agent chooses on this field alone, so it needs a "Use when ..." clause`)
259
+ }
260
+
202
261
  if (metadata.legacy_prompt && !fs.existsSync(path.join(hostRoot, metadata.legacy_prompt))) {
203
262
  errors.push(`${path.relative(rootDir, skillPath)} points to missing legacy prompt: ${metadata.legacy_prompt}`)
204
263
  }
package/skills/README.md CHANGED
@@ -30,33 +30,33 @@ Run:
30
30
  npx hippocampus skills validate
31
31
  ```
32
32
 
33
- after changing any `*.skill.md`, `skills.json`, `skills.schema.json`, or example files.
33
+ after changing any `<name>/SKILL.md`, `skills.json`, `skills.schema.json`, or example files.
34
34
 
35
35
  ## Skill map
36
36
 
37
- - `generate-service-slice.skill.md` ← `generate-service-slice.prompt.md`
38
- - `add-user-needs.skill.md` ← `add-user-needs.prompt.md`
39
- - `add-scenario.skill.md` ← `add-scenario.prompt.md`
40
- - `create-journey-from-scenario.skill.md` ← `create-journey-from-scenario.prompt.md`
41
- - `add-prototype-screen.skill.md` ← `add-prototype-screen.prompt.md`
42
- - `audit-knowledge-source.skill.md` ← `audit-knowledge-source.prompt.md`
43
- - `structure-project-context-draft.skill.md` ← `hippocampus-structure-project-context.prompt.md`
44
- - `structure-research-draft.skill.md` ← `hippocampus-structure-research.prompt.md`
45
- - `review-research-import-draft.skill.md` ← `hippocampus-review-import-draft.prompt.md`
46
- - `map-research-to-graph.skill.md` ← `hippocampus-map-research-to-graph.prompt.md`
37
+ - `generate-service-slice/SKILL.md` ← `generate-service-slice.prompt.md`
38
+ - `add-user-needs/SKILL.md` ← `add-user-needs.prompt.md`
39
+ - `add-scenario/SKILL.md` ← `add-scenario.prompt.md`
40
+ - `create-journey-from-scenario/SKILL.md` ← `create-journey-from-scenario.prompt.md`
41
+ - `add-prototype-screen/SKILL.md` ← `add-prototype-screen.prompt.md`
42
+ - `audit-knowledge-source/SKILL.md` ← `audit-knowledge-source.prompt.md`
43
+ - `structure-project-context-draft/SKILL.md` ← `hippocampus-structure-project-context.prompt.md`
44
+ - `structure-research-draft/SKILL.md` ← `hippocampus-structure-research.prompt.md`
45
+ - `review-research-import-draft/SKILL.md` ← `hippocampus-review-import-draft.prompt.md`
46
+ - `map-research-to-graph/SKILL.md` ← `hippocampus-map-research-to-graph.prompt.md`
47
47
 
48
48
  ## Orchestration skills
49
49
 
50
- - `ingest-research-round.skill.md` - chains research import draft structuring, review, and graph-linking without promotion
51
- - `ingest-project-context.skill.md` - chains project-context draft structuring and dry-run validation without promotion
52
- - `deliver-service-slice.skill.md` - chains source-model authoring, optional prototype work, audit, and delivery-summary handoff
53
- - `write-delivery-summary.skill.md` - records what changed, what was run, and what still needs follow-up
50
+ - `ingest-research-round/SKILL.md` - chains research import draft structuring, review, and graph-linking without promotion
51
+ - `ingest-project-context/SKILL.md` - chains project-context draft structuring and dry-run validation without promotion
52
+ - `deliver-service-slice/SKILL.md` - chains source-model authoring, optional prototype work, audit, and delivery-summary handoff
53
+ - `write-delivery-summary/SKILL.md` - records what changed, what was run, and what still needs follow-up
54
54
 
55
55
  ## Review workflow skills
56
56
 
57
- - `capture-route-review-pack.skill.md` - creates a dated screenshot or route-notes review pack after smoke testing
58
- - `record-accessibility-review.skill.md` - writes dated accessibility notes with blockers and improvements
59
- - `write-route-review-summary.skill.md` - links smoke-test, screenshot, and accessibility artefacts into one handover note
57
+ - `capture-route-review-pack/SKILL.md` - creates a dated screenshot or route-notes review pack after smoke testing
58
+ - `record-accessibility-review/SKILL.md` - writes dated accessibility notes with blockers and improvements
59
+ - `write-route-review-summary/SKILL.md` - links smoke-test, screenshot, and accessibility artefacts into one handover note
60
60
 
61
61
  ## Coverage matrix
62
62
 
@@ -6,10 +6,27 @@ This repo keeps skills in a simple, tool-agnostic format so they can work well i
6
6
 
7
7
  Each skill has:
8
8
 
9
- - a Markdown file: `<skill-id>.skill.md`
10
- - YAML front matter for machine-readable metadata
9
+ - a directory named for the skill, holding a `SKILL.md`
10
+ - YAML front matter opening with `name` and `description`
11
11
  - a short task recipe in Markdown for humans and agents
12
12
 
13
+ The directory-plus-`SKILL.md` shape is the [Agent Skills](https://agentskills.io)
14
+ open standard, which GitHub Copilot, Claude and others discover directly. A flat
15
+ `<skill-id>.skill.md` is invisible to all of them: a skill is found only when it
16
+ is a directory with that file inside.
17
+
18
+ `name` must match the directory name, and `description` is the one field an
19
+ agent sees before deciding whether to load the skill at all - so it states
20
+ **when to use this**, not only what it does.
21
+
22
+ The remaining keys - `id`, `title`, `purpose`, `owners`, `reads` and the rest -
23
+ are this catalog's own contract rather than the spec's. The spec offers
24
+ `metadata` for extra data but allows only string values, and these are arrays,
25
+ so they stay as top-level keys; unknown keys are not rejected, and splitting one
26
+ skill's definition across two files would cost more than it buys. `id`
27
+ duplicates `name` deliberately: the catalog keys on `id`, and the validator
28
+ asserts the two match so they cannot drift.
29
+
13
30
  The catalog also includes:
14
31
 
15
32
  - `skills.json` as a machine-readable index
@@ -18,9 +35,11 @@ The catalog also includes:
18
35
 
19
36
  ## Front matter fields
20
37
 
21
- Use these keys on every `*.skill.md` file:
38
+ Use these keys on every `<name>/SKILL.md` file:
22
39
 
23
- - `id` - stable lowercase kebab-case skill ID
40
+ - `name` - required by the spec; matches the directory name, lowercase kebab-case
41
+ - `description` - required by the spec; what the skill does **and when to use it**, in words somebody would actually type. Max 1024 characters. This is the only thing an agent reads before choosing the skill, so a vague one means the skill never fires.
42
+ - `id` - stable lowercase kebab-case skill ID; must equal `name`
24
43
  - `title` - short human-readable name
25
44
  - `purpose` - one-sentence statement of the task outcome
26
45
  - `owners` - preferred role agents from `.github/agents/`
@@ -81,7 +100,7 @@ npx hippocampus skills validate
81
100
  This checks:
82
101
 
83
102
  - `skills.json` syntax and catalog shape
84
- - required front matter on every `*.skill.md`
103
+ - required front matter on every `<name>/SKILL.md`
85
104
  - consistency between catalog entries and skill front matter
86
105
  - required body headings
87
106
  - legacy prompt references and composed skill IDs
@@ -1,4 +1,6 @@
1
1
  ---
2
+ name: add-prototype-screen
3
+ description: "Adds a prototype screen to the knowledge base as a source record plus a matching Express route and Nunjucks view. Use when a new screen must exist both as data and as a working page, or when someone asks to add a screen, page or route to the prototype."
2
4
  id: add-prototype-screen
3
5
  title: Add prototype screen
4
6
  purpose: Add a source-backed prototype screen with matching route and view.
@@ -1,4 +1,6 @@
1
1
  ---
2
+ name: add-scenario
3
+ description: "Adds a scenario record linking existing users and needs to a concrete trigger and context. Use when existing users and needs need a situation that can drive a journey, or when someone asks to add or write a scenario."
2
4
  id: add-scenario
3
5
  title: Add scenario
4
6
  purpose: Add a concrete scenario that links existing users and needs to journey work.
@@ -1,4 +1,6 @@
1
1
  ---
2
+ name: add-user-needs
3
+ description: "Adds or sharpens traceable user need records for an existing user group, linked to the evidence behind them. Use when a user group exists but its needs are missing, vague or unevidenced, or when someone asks to add, capture or tighten user needs."
2
4
  id: add-user-needs
3
5
  title: Add user needs
4
6
  purpose: Add or sharpen traceable need records for an existing user group.
@@ -1,4 +1,6 @@
1
1
  ---
2
+ name: audit-knowledge-source
3
+ description: "Reviews the knowledge base for traceability, route coverage and evidence quality, and reports the gaps. Use before a handover or design review, or when someone asks how complete, healthy or well-evidenced the knowledge base is."
2
4
  id: audit-knowledge-source
3
5
  title: Audit knowledge source
4
6
  purpose: Review traceability, route coverage, and evidence quality before handover.
@@ -1,4 +1,6 @@
1
1
  ---
2
+ name: capture-route-review-pack
3
+ description: "Creates a dated pack of screenshots and route notes after smoke testing changed routes. Use when a visible route change needs review evidence for handover or design review, or when someone asks for screenshots of what changed."
2
4
  id: capture-route-review-pack
3
5
  title: Capture route review pack
4
6
  purpose: Create a dated screenshot or notes pack for changed routes after smoke testing.
@@ -1,4 +1,6 @@
1
1
  ---
2
+ name: create-journey-from-scenario
3
+ description: "Turns an existing scenario into a blueprint-ready journey with ordered steps and screens. Use when a scenario exists and needs a journey, or when someone asks to build, draft or map a user journey."
2
4
  id: create-journey-from-scenario
3
5
  title: Create journey from scenario
4
6
  purpose: Turn an existing scenario into a blueprint-ready journey.
@@ -1,4 +1,6 @@
1
1
  ---
2
+ name: deliver-service-slice
3
+ description: "Orchestrates an end-to-end service slice: source data, prototype routes and views, audit and handover notes. Use when a new or revised service area needs the whole chain in one pass rather than skill by skill."
2
4
  id: deliver-service-slice
3
5
  title: Deliver service slice
4
6
  purpose: Deliver an end-to-end fictional service slice across source data, optional prototype routes/views, audit, and handover.
@@ -11,5 +11,5 @@ Use them alongside:
11
11
 
12
12
  - `.github/skills/skills.json` for discovery
13
13
  - `.github/skills/SKILL-FORMAT.md` for the metadata contract
14
- - the referenced `*.skill.md` files for the exact workflow
14
+ - the referenced `<name>/SKILL.md` files for the exact workflow
15
15
 
@@ -12,7 +12,7 @@ Open `.github/skills/skills.json` and find the entry with:
12
12
  Use its `file` field to load:
13
13
 
14
14
  ```text
15
- .github/skills/ingest-research-round.skill.md
15
+ .github/skills/ingest-research-round/SKILL.md
16
16
  ```
17
17
 
18
18
  ## 2. Read the skill metadata
@@ -12,7 +12,7 @@ Open `.github/skills/skills.json` and find:
12
12
  Load the referenced file:
13
13
 
14
14
  ```text
15
- .github/skills/deliver-service-slice.skill.md
15
+ .github/skills/deliver-service-slice/SKILL.md
16
16
  ```
17
17
 
18
18
  ## 2. Use the catalog for planning
@@ -1,4 +1,6 @@
1
1
  ---
2
+ name: generate-service-slice
3
+ description: "Creates the first coherent set of linked source records for a new service area - users, needs, scenario, journey, screens and evidence, lined up in one pass. Use when a service area has no knowledge base records yet."
2
4
  id: generate-service-slice
3
5
  title: Generate service slice
4
6
  purpose: Create a coherent fictional Hippocampus slice across linked source records.
@@ -1,4 +1,6 @@
1
1
  ---
2
+ name: ingest-project-context
3
+ description: "Turns a project overview deck, PDF or filled-in project-context workbook into a review-ready draft, without promoting anything. Use when importing project context, vision, policy, constraints, risks or milestones."
2
4
  id: ingest-project-context
3
5
  title: Ingest project context
4
6
  purpose: Run the no-promote project-context ingestion workflow from inbox artefact to review-ready draft.
@@ -1,4 +1,6 @@
1
1
  ---
2
+ name: ingest-research-round
3
+ description: "Turns a research deck or report into a review-ready draft, chaining structuring, review and graph-linking without promoting to canonical source. Use when importing a round of user research."
2
4
  id: ingest-research-round
3
5
  title: Ingest research round
4
6
  purpose: Run the no-promote research ingestion workflow from inbox artefact to review-ready draft.
@@ -1,4 +1,6 @@
1
1
  ---
2
+ name: ingest-user-personas
3
+ description: "Turns persona documents into user records, the needs they state and the evidence behind both. Use when a project has personas but no user records - this is the first ingestion step, because needs, scenarios, journeys and screens all reference users."
2
4
  id: ingest-user-personas
3
5
  title: Ingest user personas
4
6
  purpose: Turn persona documents into user records, the needs they state, and the evidence that backs both.
@@ -1,4 +1,6 @@
1
1
  ---
2
+ name: map-research-to-graph
3
+ description: "Adds only the links a reviewed research draft actually supports, between insights, needs, users and screens. Use after reviewing a research draft, when insights need connecting to the rest of the knowledge base."
2
4
  id: map-research-to-graph
3
5
  title: Map research to graph
4
6
  purpose: Add only supported links between a reviewed research draft and existing Hippocampus entities.
@@ -1,4 +1,6 @@
1
1
  ---
2
+ name: onboard-team-member
3
+ description: "Orients someone new from what the knowledge base already holds, and leaves them a dated briefing they can read without an agent. Use when someone joins the project or picks up work after a handover."
2
4
  id: onboard-team-member
3
5
  title: Onboard a team member
4
6
  purpose: Orient someone new to the project from what the knowledge base already knows, and leave them a dated briefing they can read without an agent.