@n8r/surface 0.0.0-stage → 0.1.0-experimental.5

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 (181) hide show
  1. package/LICENSE +202 -0
  2. package/LICENSE-DOCS +395 -0
  3. package/LICENSING.md +36 -0
  4. package/README.md +207 -2
  5. package/dist/activity.d.ts +16 -0
  6. package/dist/activity.js +44 -0
  7. package/dist/cli.d.ts +2 -0
  8. package/dist/cli.js +412 -0
  9. package/dist/codec.d.ts +6 -0
  10. package/dist/codec.js +56 -0
  11. package/dist/codex.d.ts +72 -0
  12. package/dist/codex.js +526 -0
  13. package/dist/contracts.d.ts +235 -0
  14. package/dist/contracts.js +1 -0
  15. package/dist/cyclonedx-schemas/bom-1.7.schema.json +6700 -0
  16. package/dist/cyclonedx-schemas/cryptography-defs.schema.json +576 -0
  17. package/dist/cyclonedx-schemas/jsf-0.82.schema.json +240 -0
  18. package/dist/cyclonedx-schemas/spdx.schema.json +786 -0
  19. package/dist/cyclonedx-validation.d.ts +1 -0
  20. package/dist/cyclonedx-validation.js +45 -0
  21. package/dist/html.d.ts +5 -0
  22. package/dist/html.js +74 -0
  23. package/dist/index.d.ts +7 -0
  24. package/dist/index.js +5 -0
  25. package/dist/notes.d.ts +52 -0
  26. package/dist/notes.js +184 -0
  27. package/dist/portable.d.ts +10 -0
  28. package/dist/portable.js +71 -0
  29. package/dist/recent.d.ts +9 -0
  30. package/dist/recent.js +71 -0
  31. package/dist/revisions.d.ts +2 -0
  32. package/dist/revisions.js +60 -0
  33. package/dist/settings.d.ts +23 -0
  34. package/dist/settings.js +100 -0
  35. package/dist/setup.d.ts +9 -0
  36. package/dist/setup.js +161 -0
  37. package/dist/skill-artifacts-cli.d.ts +1 -0
  38. package/dist/skill-artifacts-cli.js +13 -0
  39. package/dist/skill-artifacts.d.ts +15 -0
  40. package/dist/skill-artifacts.js +184 -0
  41. package/dist/skill-cyclonedx.d.ts +26 -0
  42. package/dist/skill-cyclonedx.js +214 -0
  43. package/dist/skill-presentation.d.ts +10 -0
  44. package/dist/skill-presentation.js +108 -0
  45. package/dist/skill-surface-cli.d.ts +1 -0
  46. package/dist/skill-surface-cli.js +37 -0
  47. package/dist/skill-surface-store.d.ts +7 -0
  48. package/dist/skill-surface-store.js +126 -0
  49. package/dist/source-tools.d.ts +102 -0
  50. package/dist/source-tools.js +201 -0
  51. package/dist/startup.d.ts +7 -0
  52. package/dist/startup.js +74 -0
  53. package/dist/surface-bom.d.ts +73 -0
  54. package/dist/surface-bom.js +139 -0
  55. package/dist/surface-draft.d.ts +22 -0
  56. package/dist/surface-draft.js +112 -0
  57. package/dist/surface-instructions.d.ts +3 -0
  58. package/dist/surface-instructions.js +32 -0
  59. package/dist/surface-overview.d.ts +15 -0
  60. package/dist/surface-overview.js +86 -0
  61. package/dist/surface-store.d.ts +34 -0
  62. package/dist/surface-store.js +213 -0
  63. package/dist/surface-view.d.ts +3 -0
  64. package/dist/surface-view.js +50 -0
  65. package/dist/validate.d.ts +4 -0
  66. package/dist/validate.js +482 -0
  67. package/docs/n8r-surface/README.md +133 -0
  68. package/docs/n8r-surface/cli-bundles.md +72 -0
  69. package/docs/n8r-surface/codex-research-transcript.md +51 -0
  70. package/docs/n8r-surface/codex-research-verification.md +176 -0
  71. package/docs/n8r-surface/command-outcomes.md +711 -0
  72. package/docs/n8r-surface/contracts.md +220 -0
  73. package/docs/n8r-surface/critical-path.md +184 -0
  74. package/docs/n8r-surface/design.md +289 -0
  75. package/docs/n8r-surface/first-use-access.md +143 -0
  76. package/docs/n8r-surface/first-use-overview.md +262 -0
  77. package/docs/n8r-surface/getting-started.md +74 -0
  78. package/docs/n8r-surface/guided-journey-verification.md +137 -0
  79. package/docs/n8r-surface/host-contract.md +176 -0
  80. package/docs/n8r-surface/implementation-decisions.md +96 -0
  81. package/docs/n8r-surface/instance-first-research.md +209 -0
  82. package/docs/n8r-surface/npm-distribution.md +107 -0
  83. package/docs/n8r-surface/npm-release.md +315 -0
  84. package/docs/n8r-surface/product-direction.md +327 -0
  85. package/docs/n8r-surface/recreation-handoff.md +117 -0
  86. package/docs/n8r-surface/researcher-discovery.md +157 -0
  87. package/docs/n8r-surface/researcher-prepared-check.md +117 -0
  88. package/docs/n8r-surface/researcher-reconciliation-trial.md +149 -0
  89. package/docs/n8r-surface/researcher-repository-check.md +95 -0
  90. package/docs/n8r-surface/researcher-skeleton-check.md +84 -0
  91. package/docs/n8r-surface/researcher-skill-verification.md +725 -0
  92. package/docs/n8r-surface/researcher-skill.md +309 -0
  93. package/docs/n8r-surface/researcher-vault.md +134 -0
  94. package/docs/n8r-surface/save-reopen-transcript.md +211 -0
  95. package/docs/n8r-surface/save-reopen-verification.md +152 -0
  96. package/docs/n8r-surface/security-assurance-strategy.md +267 -0
  97. package/docs/n8r-surface/skill-bom-verification.md +142 -0
  98. package/docs/n8r-surface/skill-cyclonedx-verification.md +144 -0
  99. package/docs/n8r-surface/skill-cyclonedx.md +85 -0
  100. package/docs/n8r-surface/skill-manual.md +129 -0
  101. package/docs/n8r-surface/skill-surface-artifacts.md +234 -0
  102. package/docs/n8r-surface/skill-usefulness-verification.md +135 -0
  103. package/docs/n8r-surface/skill-workspace-automation.md +359 -0
  104. package/docs/n8r-surface/startup-human-check.md +172 -0
  105. package/docs/n8r-surface/startup-verification.md +161 -0
  106. package/docs/n8r-surface/startup.md +151 -0
  107. package/docs/n8r-surface/surface-description-contract.md +224 -0
  108. package/docs/n8r-surface/surface-descriptions.md +173 -0
  109. package/docs/n8r-surface/surface-relationships.md +231 -0
  110. package/docs/n8r-surface/surface-revisions-transcript.md +552 -0
  111. package/docs/n8r-surface/surface-revisions-verification.md +161 -0
  112. package/docs/n8r-surface/tester-candidate.md +158 -0
  113. package/docs/n8r-surface/vault-setup-verification.md +210 -0
  114. package/docs/n8r-surface/verification.md +117 -0
  115. package/docs/n8r-surface/versioning.md +172 -0
  116. package/docs/n8r-surface/workspace-human-check.md +101 -0
  117. package/docs/n8r-surface/workspace-installation.md +68 -0
  118. package/docs/n8r-surface/workspace-verification.md +350 -0
  119. package/docs/n8r-surface/workspace.md +83 -0
  120. package/examples/researcher/README.md +100 -0
  121. package/examples/researcher/composed.surface.json +430 -0
  122. package/examples/researcher/composed.surface.yaml +283 -0
  123. package/examples/researcher/cyclonedx/configured/README.md +7 -0
  124. package/examples/researcher/cyclonedx/configured/manifest.json +10 -0
  125. package/examples/researcher/cyclonedx/configured/mapping.json +323 -0
  126. package/examples/researcher/cyclonedx/configured/surface-records.json +1275 -0
  127. package/examples/researcher/cyclonedx/configured/surface.cdx.json +79 -0
  128. package/examples/researcher/descriptions/README.md +29 -0
  129. package/examples/researcher/descriptions/bound-r1.json +141 -0
  130. package/examples/researcher/descriptions/bound-r2.json +153 -0
  131. package/examples/researcher/descriptions/capability.json +167 -0
  132. package/examples/researcher/descriptions/research-r1.json +153 -0
  133. package/examples/researcher/descriptions/research-r2.json +157 -0
  134. package/examples/researcher/descriptions/sources.md +24 -0
  135. package/examples/researcher/harbor-r1.research.html +193 -0
  136. package/examples/researcher/harbor-r2.research.html +226 -0
  137. package/examples/researcher/lumen-manual-edit.pending.html +271 -0
  138. package/examples/researcher/lumen-r1.research.html +271 -0
  139. package/examples/researcher/lumen-r2.research.html +280 -0
  140. package/examples/researcher/relationships/README.md +34 -0
  141. package/examples/researcher/relationships/bound-r1.json +346 -0
  142. package/examples/researcher/relationships/bound-r2.json +358 -0
  143. package/examples/researcher/relationships/capability.json +325 -0
  144. package/examples/researcher/relationships/config/assistant.env.example +4 -0
  145. package/examples/researcher/relationships/research-r1.json +300 -0
  146. package/examples/researcher/relationships/research-r2.json +304 -0
  147. package/examples/researcher/relationships/sources.md +38 -0
  148. package/examples/researcher/sources/harbor-api.md +16 -0
  149. package/examples/researcher/sources/harbor-auth.md +8 -0
  150. package/examples/researcher/sources/lumen-guide.md +28 -0
  151. package/examples/researcher/sources/lumen-settings.md +9 -0
  152. package/examples/researcher/surface-bom/README.md +17 -0
  153. package/examples/researcher/surface-bom/initial.cdx.json +188 -0
  154. package/package.json +45 -4
  155. package/plugins/n8r-surface/.codex-plugin/plugin.json +31 -0
  156. package/plugins/n8r-surface/LICENSE +202 -0
  157. package/plugins/n8r-surface/LICENSE-DOCS +395 -0
  158. package/plugins/n8r-surface/LICENSING.md +39 -0
  159. package/plugins/n8r-surface/assets/icon.svg +5 -0
  160. package/plugins/n8r-surface/plugin.json +27 -0
  161. package/plugins/n8r-surface/skills/research/SKILL.md +163 -0
  162. package/plugins/n8r-surface/skills/research/agents/openai.yaml +4 -0
  163. package/plugins/n8r-surface/skills/research/references/artifacts.md +152 -0
  164. package/plugins/n8r-surface/skills/research/references/cyclonedx.md +207 -0
  165. package/plugins/n8r-surface/skills/research/references/discovery-map.md +178 -0
  166. package/plugins/n8r-surface/skills/research/references/examples/bound-r1.json +346 -0
  167. package/plugins/n8r-surface/skills/research/references/examples/capability.json +325 -0
  168. package/plugins/n8r-surface/skills/research/references/examples/research-r1.json +300 -0
  169. package/plugins/n8r-surface/skills/research/references/examples/surface.cdx.json +188 -0
  170. package/plugins/n8r-surface/skills/research/references/first-use-access.md +97 -0
  171. package/plugins/n8r-surface/skills/research/references/first-use-overview.md +101 -0
  172. package/plugins/n8r-surface/skills/research/references/instance-first.md +125 -0
  173. package/plugins/n8r-surface/skills/research/references/model-meanings.md +55 -0
  174. package/plugins/n8r-surface/skills/research/references/skeleton-surface.md +105 -0
  175. package/plugins/n8r-surface/skills/research/references/working-notes.md +121 -0
  176. package/plugins/n8r-surface/skills/research/references/workspace.md +89 -0
  177. package/plugins/n8r-surface/skills/research/scripts/THIRD-PARTY-NOTICES.txt +273 -0
  178. package/plugins/n8r-surface/skills/research/scripts/artifacts.mjs +8348 -0
  179. package/plugins/n8r-surface/skills/research/scripts/cyclonedx.mjs +28113 -0
  180. package/plugins/n8r-surface/skills/research/scripts/surface.mjs +27800 -0
  181. package/plugins/n8r-surface/skills/research/scripts/workspace.mjs +120 -0
@@ -0,0 +1,220 @@
1
+ # Experimental Researcher artefact contracts 0.1
2
+
3
+ Issue [#15](https://github.com/injectionator/n8r-surface/issues/15) introduces a
4
+ bounded experimental profile of the **AI Surface Model**, not a released universal
5
+ schema. Existing [LibreChat examples](../../examples/README.md) remain illustrative
6
+ and use a different shape. No deployment, interoperability or recreation claim
7
+ follows from passing these checks.
8
+
9
+ The TypeScript [types](../../src/contracts.ts), runtime
10
+ [checks](../../src/validate.ts) and [synthetic cases](../../examples/researcher/README.md)
11
+ make this profile concrete. Other languages can implement the same data contract.
12
+ The library reads supplied strings and returns values/strings; it does not read
13
+ files, fetch references, call inference or write a corpus.
14
+
15
+ The separate JSON-only [Capability and Bound contract 0.2](surface-description-contract.md)
16
+ adds possible relationships and configured instance bindings without reinterpreting
17
+ these selected `0.1` definitions. The APIs accept both versions; their meanings
18
+ and fields remain distinct. Installed-skill production is separate work.
19
+
20
+ The [shared relationship contract 0.3](surface-relationships.md) adds the same
21
+ component-node and relationship-edge structure to both descriptions, including
22
+ evidenced purpose, integration mechanism and safe configuration references.
23
+ Existing `0.1` and `0.2` representations remain readable.
24
+
25
+ ## Common envelope and identity
26
+
27
+ Every artefact has these required fields. Objects are closed except the explicit
28
+ `extensions` object; misspelled or future core fields are rejected, never stripped.
29
+
30
+ | Field | Meaning |
31
+ | --- | --- |
32
+ | `contract` | Exactly `n8r.research/0.1` or `n8r.surface/0.1`. |
33
+ | `id` | Stable namespaced identifier for this artefact across revisions. |
34
+ | `title`, `scope` | Nonempty human text; scope states coverage limits. |
35
+ | `revision` | `{id, parent, createdAt, author, reason}`. |
36
+ | `extensions` | Map of namespaced identifiers to portable values; `{}` is valid. |
37
+
38
+ Identifiers have a URI-style scheme and non-whitespace remainder. They are opaque
39
+ and case-sensitive; the checker does not fetch them or claim URI normalization.
40
+ Revision IDs are nonempty alphanumeric/dot/underscore/hyphen tokens, starting with
41
+ an alphanumeric character. They identify snapshots, not product release versions
42
+ or timestamps. Times use real UTC dates with seconds: `2026-11-04T00:00:00Z`.
43
+ Names and locations are labels, never identity matching rules.
44
+
45
+ `parent` is null for an initial revision, or `{id, revision, digest}` for the
46
+ previous snapshot of this same artefact. Revision changes retain the artefact ID
47
+ and existing component/finding/relationship IDs when their identity is unchanged.
48
+ A fork gets a new artefact ID and may record its origin in an extension. The
49
+ library does not infer whether two similarly named entities are the same thing.
50
+
51
+ `verifySuccessor(previous, next)` checks matching contract and identity, a fresh
52
+ revision token and an exact parent revision/digest. It rejects changing the type
53
+ or endpoints of a retained relationship ID; assign a new ID for a different
54
+ connection. Historical snapshots remain immutable. The caller must preserve old
55
+ bytes and prevent ID reuse across its complete history; a two-snapshot check
56
+ cannot enforce corpus-wide immutability. A snapshot ID is distinct from a later
57
+ Lab's deliberate release/version label.
58
+
59
+ ## Research record
60
+
61
+ `n8r.research/0.1` carries these required arrays (empty arrays are allowed unless
62
+ specified). IDs are unique across the record and all identified entries.
63
+
64
+ | Array | Entry fields |
65
+ | --- | --- |
66
+ | `sources` | `id`, `location`, `version`, `digest`, `inspectedAt`, `coverage`. |
67
+ | `findings` | `id`, `subject`, `property`, `state`, `note`, `claims`. |
68
+ | `alternatives` | `id`, `title`, `findings` (finding IDs), `requirements` (text). |
69
+ | `decisions` | `id`, `alternative` (option ID), `choice`, `reason`, `by`, `at`. |
70
+ | `questions` | `id`, `text`, `findings` (possibly empty related finding IDs). |
71
+ | `notes` | `by`, `at`, `text`; human commentary and corrections. |
72
+
73
+ A source identifies the supplied snapshot. `digest` is SHA-256 over its exact
74
+ UTF-8 bytes; `version` records an applicable document revision or checkout state.
75
+ A dirty checkout must not be labeled only with a clean commit. `location` is a
76
+ portable relative path, HTTP(S) URL without credentials, or URN; it conveys no
77
+ permission to access it. Absolute local paths and traversal are rejected. Coverage
78
+ contains at least one `{path, status, note}` entry; status is `inspected`, `missing`,
79
+ `unreadable`, `excluded`, `truncated` or `unsupported`. If a source's bytes are
80
+ unavailable and cannot be hashed, do not invent a digest: record the missing
81
+ material in scope/questions or coverage of the supplied source bundle.
82
+
83
+ A finding's `subject` is a stable namespaced identifier for the described thing;
84
+ it need not already be a selected graph node. `property` names the question being
85
+ answered. A claim is `{value, evidence}`. Evidence is a nonempty array of
86
+ `{source, locator}` referring to a local source and a human-readable section or
87
+ range. `note` states applicability, limitations and the basis for the conclusion.
88
+ The contract checks reference existence, not whether prose supports a claim.
89
+
90
+ States have distinct meanings:
91
+
92
+ - `known`: at least one sourced claim; all claim values agree.
93
+ - `absent`: a scoped, sourced absence assertion; at least one agreed claim value
94
+ describing what is absent. Absence outside that scope is not implied.
95
+ - `conflicting`: at least two differing sourced values, with no selected answer.
96
+ - `unknown`, `omitted`, `redacted`, `out-of-scope`: no claim values. The note explains
97
+ the distinction. Do not place withheld values in a redacted field's extension.
98
+
99
+ Decisions use `selected`, `rejected` or `deferred`, at most one current decision
100
+ per alternative. An unanswered option has no decision. A changed decision belongs
101
+ in a successor record; earlier decisions remain in its predecessor. Research
102
+ options are possibilities; selecting one does not prove a working integration.
103
+
104
+ ## Selected Surface definition
105
+
106
+ `n8r.surface/0.1` has `kind: "definition"`. It contains:
107
+
108
+ | Field | Shape and interpretation |
109
+ | --- | --- |
110
+ | `records` | Exact research `{id, revision, digest}` references. |
111
+ | `vocabularies` | Unique `{id, version}` references; version is a token. |
112
+ | `nodes` | Identified components, each with a human `label`. |
113
+ | `relationships` | Identified connections with explicit `from`, `to` and `claim: "declared"`. |
114
+ | `requirements` | `{id, kind, description, state}`; kind is `secret`, `resource` or `configuration`. |
115
+ | `coverage`, `gaps` | Arrays of human text about what is described and still needed. |
116
+
117
+ Every node/relationship carries `id`, `type: {vocabulary, term}`, `attributes`,
118
+ `basis` and `requirements` (local requirement IDs). Type vocabulary references
119
+ must resolve locally; unknown terms/vocabularies remain opaque and preserved.
120
+ Their presence does not establish consumer understanding. Graph IDs and requirement
121
+ IDs are unique across the Surface. Edges reference node IDs; shared nodes, cycles,
122
+ self-loops and distinct parallel edges are legal. Degree is relative to a start
123
+ node; no semantic two-hop limit exists.
124
+
125
+ `attributes` maps property names to `{state, note, value?}`. `known` requires a
126
+ portable value (including null); all other states prohibit one. Supported states
127
+ are the six draft states above, excluding `conflicting`: a selected definition
128
+ can leave an attribute unknown and cite the competing research findings. An
129
+ omitted attribute is unspecified, never automatically absent.
130
+
131
+ `basis` entries are `{record, revision, items}` with nonempty lists of research
132
+ finding, alternative, decision or question IDs. Empty basis is allowed for an
133
+ explicit author declaration; the envelope's author/reason and attribute notes
134
+ remain its attribution. `validateArtefact` checks local structure and references.
135
+ `verifyReferences(surface, records)` additionally requires the supplied research
136
+ revisions, verifies their logical digests and resolves each basis item. Missing
137
+ external context is an error from that explicit check, not evidence of absence.
138
+ No reference is fetched. A valid link is not proof that a selection is justified.
139
+
140
+ Secret requirements name a need, never contain a secret or a recipient's credential
141
+ binding. Requirements describe the selected composition; a Lab separately decides
142
+ how to satisfy them. Reachability, exercised connections, deployment bindings,
143
+ effective settings and Experiment Runs need separate linked records. Those record
144
+ formats are outside this profile. Later evidence cannot mutate this definition.
145
+
146
+ ## Portable values and JSON/YAML
147
+
148
+ JSON is the default; YAML is an alternative representation of the same logical
149
+ data. The profile supports null, booleans, well-formed Unicode strings, signed safe
150
+ integers from `-9007199254740991` through `9007199254740991`, arrays and string-keyed
151
+ objects. JavaScript arrays must have the ordinary `Array.prototype`; subclasses
152
+ and arrays with custom prototypes are rejected before inherited methods or
153
+ serialization hooks can run. Numeric tokens use decimal integer notation; no
154
+ negative zero, fraction, exponent, leading zero, hexadecimal, infinity or NaN.
155
+ Use an explicit string plus
156
+ unit for decimal quantities or larger identifiers. This deliberately small subset
157
+ prevents number precision loss between runtimes.
158
+
159
+ Reject duplicate keys, non-string mapping keys, custom or explicit YAML tags,
160
+ anchors, aliases, unquoted merge keys, directives and multiple YAML documents.
161
+ Quoted literal `<<` keys are ordinary extension data and are preserved. YAML comments
162
+ and formatting are not semantic and are not preserved by re-encoding. Strings
163
+ that resemble booleans, dates or numbers stay strings when emitted. JSON object
164
+ order is insignificant; array order is preserved. JavaScript inputs must be plain
165
+ data: no accessors, sparse arrays, extra array properties, cycles, class instances,
166
+ undefined, symbols or non-enumerable fields.
167
+
168
+ Unknown `extensions` values are preserved through conversion, revision checks and
169
+ HTML. No tool may treat opaque extensions as understood semantics or discard them
170
+ silently. Unknown core fields and contract versions fail closed; a later migration
171
+ must retain the original and report losses. This profile has no required-extension
172
+ mechanism: a consumer must separately report which extension meanings it supports.
173
+
174
+ The reference implementation bounds each encoded input/output and canonical
175
+ logical document to 2 MiB and nested values to depth 64. These are defensive
176
+ codec limits, not graph depth semantics. Oversized or unsupported input fails
177
+ without producing a replacement document.
178
+
179
+ ## Logical digest and byte digest
180
+
181
+ `digest(value)` returns `sha256:` plus lowercase hexadecimal SHA-256 over UTF-8
182
+ canonical JSON: recursively sort object keys by UTF-16 code units, preserve array
183
+ order, emit compact JSON strings/booleans/null/decimal integers, and add no trailing
184
+ newline. All fields, including extensions and parent references, participate.
185
+ No Unicode normalization occurs. This is this profile's algorithm, not a claim
186
+ of implementing a general canonicalization standard.
187
+
188
+ For example, both key orders of `{"a":1,"b":2}` hash to
189
+ `sha256:43258cff783fe7036d8a43033f830adfc60ec037382473548ac742b888292777`.
190
+ Research/Surface references use this logical digest. Source digests and future
191
+ storage compare-and-swap tokens instead hash exact bytes, including formatting.
192
+ A logical digest neither proves authorship nor describes what was running.
193
+
194
+ ## HTML ownership and manual editing
195
+
196
+ The durable research record is a complete UTF-8 HTML document, readable offline.
197
+ Its single inert `script` data block (`type="application/json"`, `id="n8r-record"`)
198
+ contains the authoritative research record. All visible facts and notes are a
199
+ deterministic projection of that block; there is no second narrative authority.
200
+ Source text is escaped as text, including closing-script sequences. Generated
201
+ HTML contains no executable code, external assets, active source links or forms.
202
+
203
+ `readResearchHtml` validates the data and compares the entire supplied document
204
+ with `renderResearchHtml(data)`. Any edit to the visible projection, embedded data,
205
+ styles or surrounding markup is a conflict. Even benign reformatting requires
206
+ review. This strict first profile favors detecting edits over accepting arbitrary
207
+ HTML. It is not a general HTML sanitizer; never render arbitrary imported HTML
208
+ in a privileged host before validation.
209
+
210
+ To reconcile an edit, preserve the original bytes and the manually edited copy,
211
+ review both data and visible changes with the human, and prepare a corrected
212
+ successor data object. Put human prose in `notes` or the relevant structured field;
213
+ retain unknown extensions. Check its parent against the last accepted revision,
214
+ render a new HTML file, and show what changed. Never regenerate over an edited
215
+ file merely because its embedded data still parses. Guarded atomic persistence,
216
+ backup retention and byte-conflict tokens are #16's responsibility; this library
217
+ returns strings and cannot overwrite a file.
218
+
219
+ See the [manual-edit fixture](../../examples/researcher/README.md#manual-edit-case)
220
+ and [host continuation contract](host-contract.md).
@@ -0,0 +1,184 @@
1
+ # n8r-surface critical path
2
+
3
+ The [security assurance strategy agreed on 12 November 2026](security-assurance-strategy.md)
4
+ sets the destination: a consultant-led framework connecting policy and levels to
5
+ controls, implementation and observable tests. Its
6
+ [milestone map](security-assurance-strategy.md#existing-work-and-proposed-next-milestones)
7
+ places the existing skill, pending acceptance and proposed first framework slice
8
+ in that context. The delivery history below does not define a complete assurance
9
+ framework or establish a posture score.
10
+
11
+ The [product direction captured on 11 November 2026](product-direction.md)
12
+ proposes a first value demonstration: installed-skill discovery across sources,
13
+ a bounded security finding on an integrated test system, and a verified defence.
14
+ It accepts unintegrated sources for discovery and requires runtime evidence for
15
+ runtime claims. This is a proposed acceptance target, not implementation or
16
+ rehearsal evidence; the delivery history and existing obligations below remain.
17
+
18
+ The next installed-skill delivery agreed on 8 November 2026 is
19
+ [Capability and Bound Surfaces from workspace artifacts](surface-descriptions.md),
20
+ tracked by #50 → #51 → #52 under #17. Observed Surface is deferred. The earlier
21
+ CLI sequence and evidence below remain historical context, not this increment's
22
+ completion criteria.
23
+
24
+ The user updated delivery order on 5 November 2026: standalone Codex research,
25
+ Markdown save/reopen, then partial Surface generation and a complete fresh-session
26
+ revision proof. npm distribution ([#27](https://github.com/injectionator/n8r-surface/issues/27))
27
+ is separate and last. Lab integration stays in the n8r-labs repository.
28
+
29
+ The standalone conversation and Markdown continuation are merged in #33 and #34.
30
+ The current #17 increment adds paired structured research HTML and Surface JSON;
31
+ see the [short human check](getting-started.md) and
32
+ [versioned evidence](surface-revisions-verification.md). Broader host lifecycle,
33
+ live observations and consumer compatibility remain separate acceptance work.
34
+ The unfinished #16 source-overview branch is paused; no status subcommand is planned.
35
+
36
+ ```mermaid
37
+ flowchart LR
38
+ Contract[Artefact contracts] --> CLI[Standalone Codex research]
39
+ CLI --> Notes[Markdown save and reopen]
40
+ Notes --> Surface[Partial Surface and fresh-session revision]
41
+ Surface --> Distribution[Separate npm distribution decision]
42
+ ```
43
+
44
+ The sections below retain the wider requirements; their numbering is historical,
45
+ not the current delivery order. The
46
+ [command outcome specification](command-outcomes.md) governs implementation and
47
+ requires actual installed-runner proof beyond contract fixtures.
48
+
49
+ ## 1. Define artefacts with concrete examples
50
+
51
+ **Issue:** [#15](https://github.com/injectionator/n8r-surface/issues/15).
52
+
53
+ Define a versioned experimental HTML research record and partial Surface graph.
54
+ Use synthetic sources for two unrelated products and show how selected findings
55
+ compose into one description. Establish which representation owns each fact in
56
+ the HTML, how manual edits are retained, and what a revision identifies.
57
+
58
+ Specify JSON/YAML preservation rules and examples with attributed nodes and
59
+ relationships, shared components, cycles, multiple connections, unknowns and
60
+ conflicting evidence. The [implementation decisions](implementation-decisions.md) select TypeScript,
61
+ Node.js 22/24/26, the `n8r-surface` npm package and npm/Node testing. The original
62
+ Responses API runner choice has been superseded by installed Codex for later CLI work. Runner implementation and credentials are not
63
+ needed by these offline contract checks.
64
+
65
+ Review the [compatibility contract](design.md#compatibility-contract) against
66
+ n8r-labs requirements: source access, human questions, artefact persistence,
67
+ version handling and continuation. Record gaps and supported boundaries using
68
+ public, synthetic examples. This review does not implement the application.
69
+
70
+ **Advance when:** the examples and checks give #16 and #17 concrete contracts,
71
+ including a documented route for n8r-labs to consume the shared core later.
72
+ Do not relabel existing illustrative fixtures as schema-conforming without
73
+ specifying and checking them.
74
+
75
+ The [command outcome spec](command-outcomes.md) must also give each subsequent
76
+ increment a user task, initial state, actual input and independently verifiable
77
+ result. Contract fixtures alone do not pass a command's acceptance case.
78
+
79
+ ## 2. Prove the shared skill in the current harness
80
+
81
+ **Issue:** [#17](https://github.com/injectionator/n8r-surface/issues/17).
82
+
83
+ Use the [share/install and lifecycle procedure](researcher-skill.md) and record
84
+ the actual host/version, installed instruction identity, source access, output
85
+ and readback. The first package has no new runner or Lab dependency. A passing
86
+ manifest check or CLI installation does not establish a Work-mode invocation.
87
+
88
+ Lab adaptation remains separate work in n8r-labs. The standalone foundation and
89
+ research criteria below now precede it under the current user-selected order.
90
+
91
+ ## 3. Resume the local CLI foundation
92
+
93
+ **Issue:** [#16](https://github.com/injectionator/n8r-surface/issues/16).
94
+ **Depends on:** #15.
95
+
96
+ Implement informational startup, missing-setup guidance, current-directory and explicit
97
+ source selection, and the configured artefact folder. Provide bounded tools to
98
+ list, read, create and revise records. Updates check the version read earlier,
99
+ retain a recoverable previous revision and complete atomically.
100
+
101
+ Implement in TypeScript and package the built CLI and required assets for npm.
102
+ Verify the installed tarball on supported Node.js versions independently of the
103
+ source checkout. Bun may support development/builds but is not an end-user
104
+ requirement. Package tests do not require publishing a release.
105
+
106
+ STARTUP-01 selects `~/.n8r/n8r-surface.json` for settings and
107
+ `~/n8r/artefacts` as the default corpus; `artefactRoot` in that file overrides it.
108
+ The overview displays the effective path; see [settings decisions](startup.md).
109
+ Keep AI selection separate from an optional Lab destination. Preserve invalid
110
+ configuration for repair; non-interactive commands must not wait on a prompt.
111
+
112
+ **Advance when:** synthetic tests cover first run, missing/unwritable paths,
113
+ unavailable runners, interrupted saves and human edits between read and write.
114
+ The executable is a local foundation at this point; it must not present an
115
+ unconnected discovery command as working research.
116
+
117
+ Start with [STARTUP-01](command-outcomes.md#startup-01-run-the-command-and-see-what-is-here):
118
+ given a configuration file and one saved artefact, running `n8r-surface` alone
119
+ shows readable non-private settings and their locations, one line for that artefact,
120
+ and known process status or an honest unknown. Verify this simple terminal example
121
+ before the more involved research paths; it requires no AI or Lab connection.
122
+
123
+ Exercise those behaviors through the installed command as well as internal
124
+ handlers. Record the applicable SETUP, INPUT, SCOPE, SAVE, HELP and
125
+ NONINTERACTIVE cases from [the outcome spec](command-outcomes.md#other-required-paths-and-failure-outcomes),
126
+ including actual before/after state and independent readback.
127
+
128
+ ## 4. Demonstrate the standalone Researcher workflow
129
+
130
+ **Issue:** [#17](https://github.com/injectionator/n8r-surface/issues/17).
131
+ **Depends on:** #15 and #16.
132
+
133
+ Implement and version the shared Researcher skill in this repository, connecting
134
+ one supported AI runner and the local tools. No application extraction is required.
135
+ Support a human question, source inspection, saved findings, consequential
136
+ follow-up questions, corrections, continuation and JSON/YAML model output.
137
+ Reuse the skill already tried in ChatGPT with supplied documents. Host adapters provide access; they do not maintain separate
138
+ versions of discovery knowledge.
139
+
140
+ **Advance when:** a real supported-runner session completes the workflow on
141
+ permitted examples, the records survive save/reopen, and a second product works
142
+ without product-specific code. Compare facts, selections and gaps across the
143
+ CLI and external skill; generated wording need not match. Record any host
144
+ limitation and do not claim untested compatibility.
145
+
146
+ This completes the first standalone milestone. It does not establish that a Lab
147
+ importer accepts the output; that needs a separate named-consumer trial.
148
+
149
+ Use [E2E-01](command-outcomes.md#e2e-01-research-a-repository-and-produce-a-durable-record)
150
+ as the minimum complete path: locate the repo, load and follow the identified
151
+ Researcher instructions, interact with the human, save and reopen the actual
152
+ artefact. Exercise [E2E-02](command-outcomes.md#e2e-02-apply-the-same-path-to-librechat)
153
+ before claiming LibreChat research. Record actual tool/runner evidence and saved
154
+ state; do not substitute developer-authored findings or a fake runner.
155
+
156
+ ## Work after the first milestone
157
+
158
+ The application adaptation preceding CLI completion belongs in the n8r-labs project: use an identified
159
+ Researcher revision with the Lab's own source access, AI, conversation and
160
+ storage adapters. Use the shared examples to verify research behaviour and
161
+ import an incomplete standalone record/definition, then continue it in the Lab.
162
+ Preserve identities, evidence, gaps and user decisions; report unsupported data.
163
+ Record the tested application and contract versions before claiming compatibility.
164
+
165
+ The [capability map](README.md) also retains remote Researcher execution,
166
+ additional AI runners, MessagePack and standalone executables. Create their
167
+ delivery issues when their consumer contracts and acceptance cases are concrete.
168
+
169
+ Keep browser editing, a general database, automatic two-way synchronisation,
170
+ advanced indexing and deployment automation outside this first path. Users can
171
+ choose their own editor; safe Researcher-assisted updates are sufficient here.
172
+
173
+ ## Review and evidence
174
+
175
+ Each issue uses its own branch and draft PR in this repository. Link the primary
176
+ issue with `Closes #N` only when complete; use `Related to #N` for a partial
177
+ increment and retain its remaining scope. Link the overview with `Related to #13`.
178
+ Keep draft status
179
+ until review readiness is authorised; merging and releasing are separate steps.
180
+
181
+ Run the relevant [repository checks](../../CONTRIBUTING.md)
182
+ and the issue's acceptance cases. Distinguish file syntax, reference integrity,
183
+ model behaviour and actual consumer compatibility. Update the map and this path
184
+ when scope or dependencies change so the next task remains explicit.