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

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 (96) hide show
  1. package/LICENSE +202 -0
  2. package/LICENSE-DOCS +395 -0
  3. package/LICENSING.md +36 -0
  4. package/README.md +181 -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 +260 -0
  9. package/dist/codec.d.ts +4 -0
  10. package/dist/codec.js +41 -0
  11. package/dist/codex.d.ts +72 -0
  12. package/dist/codex.js +510 -0
  13. package/dist/contracts.d.ts +129 -0
  14. package/dist/contracts.js +1 -0
  15. package/dist/html.d.ts +5 -0
  16. package/dist/html.js +50 -0
  17. package/dist/index.d.ts +7 -0
  18. package/dist/index.js +5 -0
  19. package/dist/notes.d.ts +52 -0
  20. package/dist/notes.js +184 -0
  21. package/dist/portable.d.ts +10 -0
  22. package/dist/portable.js +71 -0
  23. package/dist/revisions.d.ts +2 -0
  24. package/dist/revisions.js +18 -0
  25. package/dist/settings.d.ts +23 -0
  26. package/dist/settings.js +100 -0
  27. package/dist/setup.d.ts +9 -0
  28. package/dist/setup.js +161 -0
  29. package/dist/source-tools.d.ts +102 -0
  30. package/dist/source-tools.js +201 -0
  31. package/dist/startup.d.ts +7 -0
  32. package/dist/startup.js +74 -0
  33. package/dist/surface-draft.d.ts +19 -0
  34. package/dist/surface-draft.js +95 -0
  35. package/dist/surface-instructions.d.ts +2 -0
  36. package/dist/surface-instructions.js +23 -0
  37. package/dist/surface-store.d.ts +36 -0
  38. package/dist/surface-store.js +181 -0
  39. package/dist/validate.d.ts +4 -0
  40. package/dist/validate.js +184 -0
  41. package/docs/n8r-surface/README.md +133 -0
  42. package/docs/n8r-surface/codex-research-transcript.md +51 -0
  43. package/docs/n8r-surface/codex-research-verification.md +176 -0
  44. package/docs/n8r-surface/command-outcomes.md +564 -0
  45. package/docs/n8r-surface/contracts.md +210 -0
  46. package/docs/n8r-surface/critical-path.md +163 -0
  47. package/docs/n8r-surface/design.md +289 -0
  48. package/docs/n8r-surface/getting-started.md +107 -0
  49. package/docs/n8r-surface/host-contract.md +176 -0
  50. package/docs/n8r-surface/implementation-decisions.md +96 -0
  51. package/docs/n8r-surface/npm-distribution.md +137 -0
  52. package/docs/n8r-surface/npm-release.md +188 -0
  53. package/docs/n8r-surface/recreation-handoff.md +117 -0
  54. package/docs/n8r-surface/researcher-discovery.md +157 -0
  55. package/docs/n8r-surface/researcher-prepared-check.md +117 -0
  56. package/docs/n8r-surface/researcher-reconciliation-trial.md +149 -0
  57. package/docs/n8r-surface/researcher-repository-check.md +95 -0
  58. package/docs/n8r-surface/researcher-skeleton-check.md +84 -0
  59. package/docs/n8r-surface/researcher-skill-verification.md +725 -0
  60. package/docs/n8r-surface/researcher-skill.md +255 -0
  61. package/docs/n8r-surface/researcher-vault.md +134 -0
  62. package/docs/n8r-surface/save-reopen-transcript.md +211 -0
  63. package/docs/n8r-surface/save-reopen-verification.md +152 -0
  64. package/docs/n8r-surface/startup-human-check.md +172 -0
  65. package/docs/n8r-surface/startup-verification.md +161 -0
  66. package/docs/n8r-surface/startup.md +151 -0
  67. package/docs/n8r-surface/surface-revisions-transcript.md +552 -0
  68. package/docs/n8r-surface/surface-revisions-verification.md +161 -0
  69. package/docs/n8r-surface/vault-setup-verification.md +210 -0
  70. package/docs/n8r-surface/verification.md +117 -0
  71. package/docs/n8r-surface/versioning.md +183 -0
  72. package/examples/researcher/README.md +92 -0
  73. package/examples/researcher/composed.surface.json +430 -0
  74. package/examples/researcher/composed.surface.yaml +283 -0
  75. package/examples/researcher/harbor-r1.research.html +193 -0
  76. package/examples/researcher/harbor-r2.research.html +226 -0
  77. package/examples/researcher/lumen-manual-edit.pending.html +271 -0
  78. package/examples/researcher/lumen-r1.research.html +271 -0
  79. package/examples/researcher/lumen-r2.research.html +280 -0
  80. package/examples/researcher/sources/harbor-api.md +16 -0
  81. package/examples/researcher/sources/harbor-auth.md +8 -0
  82. package/examples/researcher/sources/lumen-guide.md +28 -0
  83. package/examples/researcher/sources/lumen-settings.md +9 -0
  84. package/package.json +45 -4
  85. package/plugins/n8r-surface/.codex-plugin/plugin.json +31 -0
  86. package/plugins/n8r-surface/LICENSE +202 -0
  87. package/plugins/n8r-surface/LICENSE-DOCS +395 -0
  88. package/plugins/n8r-surface/LICENSING.md +36 -0
  89. package/plugins/n8r-surface/assets/icon.svg +5 -0
  90. package/plugins/n8r-surface/plugin.json +27 -0
  91. package/plugins/n8r-surface/skills/research/SKILL.md +122 -0
  92. package/plugins/n8r-surface/skills/research/agents/openai.yaml +4 -0
  93. package/plugins/n8r-surface/skills/research/references/discovery-map.md +160 -0
  94. package/plugins/n8r-surface/skills/research/references/model-meanings.md +55 -0
  95. package/plugins/n8r-surface/skills/research/references/skeleton-surface.md +105 -0
  96. package/plugins/n8r-surface/skills/research/references/working-notes.md +116 -0
@@ -0,0 +1,564 @@
1
+ # Command intent, outcomes and verification
2
+
3
+ This is the product acceptance specification for `n8r-surface`. It defines what a
4
+ person should be able to accomplish, what changes, what they can observe, and how
5
+ to verify those outcomes. Implementation plans and lower-level tests must serve
6
+ these tasks. A passing codec test does not establish a working research command.
7
+
8
+ **Status:** product specification approved on 4 November 2026; delivery order
9
+ revised on 5 November 2026 to standalone AI integration, save/reopen/continue verification, then npm distribution. Lab adaptation remains separate.
10
+ [The skill lifecycle and research checks](researcher-skill.md) govern the active
11
+ increment. STATUS-01/CMD-02 are retired before implementation; no status
12
+ subcommand will be added. The existing STARTUP-01 behavior remains the CLI baseline.
13
+
14
+ The original command specification follows, with the planned inventory updated. The first #16
15
+ increment implements bare startup only, using the #15 experimental artefact
16
+ library. See [startup decisions and scope](startup.md). The setup-only increment now adds accepted local vault writes; other commands
17
+ remain broader acceptance work. The bounded RESEARCH-01 conversation is implemented; see the [Codex evidence](codex-research-verification.md). The first skill
18
+ provides instructions for working notes; it does not complete the structured-output
19
+ or installed-CLI research cases below.
20
+ The [recorded library checks](verification.md) are supporting evidence only.
21
+
22
+ This specification applies the task-driven development approach requested by the
23
+ user: define a real task, attempt it through the product, observe the gap, develop
24
+ what is missing, then repeat the same task. It does not publish private Lab
25
+ implementation material or require that application to be running.
26
+
27
+ ## Grow the specification with working verification
28
+
29
+ Work one useful behavior at a time, including behavior that already exists. Add a
30
+ small intent/example, try it, and retain a repeatable check with its observed
31
+ result. If existing behavior meets the intent, adding that evidence is a completed
32
+ increment; no implementation rewrite is required. If it does not, make the bounded
33
+ change and repeat the same check.
34
+
35
+ The command inventory gives direction. Detailed acceptance examples and evidence
36
+ grow alongside each increment; completing the entire future specification is not
37
+ a prerequisite for verifying the next useful behavior. Keep earlier checks and
38
+ rerun those affected by a change. Extend the spec when a new user need or observed
39
+ gap justifies it, while keeping expectations independent of implementation output.
40
+
41
+ Keep each human check as short as its proof allows. Reuse established installation,
42
+ runner and fixture prerequisites, with a setup link for anyone who lacks them. A
43
+ small addition can be verified by its exact command, expected result and relevant
44
+ readback; automated checks retain broader regression and edge-case coverage.
45
+ Expand human steps when changed assumptions or observed gaps require it. A short
46
+ proof must still exercise the intended outcome and identify what remains unproved.
47
+
48
+ Keep progress visible beside the intent: what is specified, what is implemented,
49
+ what was actually verified, and what remains blocked or unattempted. Update the
50
+ example, relevant repeatable checks and evidence together in the same increment.
51
+ A verified claim names its revision and limits; old evidence is not proof of a
52
+ changed path. New scenarios are not verified merely because nearby checks pass.
53
+
54
+ Current progress, with evidence defining the verified scope and revision:
55
+
56
+ | User or consumer intent | Current progress | Verification / next increment |
57
+ | --- | --- | --- |
58
+ | Create a security-focused skeleton and reconcile a later declaration change. | Skeleton Surface v0.1 guidance in installed skill 0.1.8; bounded agent brief/successor rehearsal and readback passed. Human acceptance pending; no new CLI command or Lab automation. | [SKELETON-01/02 prompts and readback](researcher-skeleton-check.md); [versioned results and remaining acceptance](researcher-skill-verification.md#skeleton-surface-018). |
59
+ | Read saved research and selected definitions through the library, retaining identities, findings and references. | Implemented and verified for the experimental library profile; no command claim. | [CONTRACT-01 and repeatable fixture/package checks](verification.md#contract-01-retain-useful-attributable-research-and-selected-definitions). |
60
+ | Run `n8r-surface` alone and see settings, saved artefacts and known process status. | Specified, implemented and verified for the read-only overview and guidance question; setup/conversation unavailable. | [STARTUP-01 installed evidence at `b90358a`](startup-verification.md). Historical read-only baseline; setup supersedes its guidance and exit behavior. |
61
+ | Choose a local vault once and reuse it from another source directory. | Setup-only implementation; installed rehearsal and human acceptance tracked separately. | [SETUP-01 evidence and tasks](vault-setup-verification.md). Research and continuation remain pending. |
62
+ | Research supplied sources through the installed skill and save working notes. | Implemented; bounded Lumen and LibreChat agent rehearsals have saved/read back notes. Actual human input survived fresh-agent continuation; Work UI acceptance remains pending. | [RESEARCH-01 evidence and limits](researcher-skill-verification.md). No structured-output or standalone-runner claim. |
63
+ | Offer to retain an initial partial graph when saving is undecided. | Implemented in skill 0.1.7; acceptance and evidence are tracked separately. | [Optional save offer](researcher-skill-verification.md#optional-save-offer-017). |
64
+ | Resume from saved recommendations and retain useful next investigations. | Implemented in skill 0.1.6; installed fresh-agent save/continue and independent readback passed. Human acceptance remains pending. | [Recommendations evidence](researcher-skill-verification.md#saved-recommendations-016) and [prepared interaction](researcher-prepared-check.md). |
65
+ | Try the installed skill using prepared files or another chat-system repository. | [Vault guide](researcher-vault.md) links prepared fictional inputs and descriptive walkthroughs; the prepared comparison has an installed-0.1.5 agent rehearsal. | [Vault evidence](researcher-skill-verification.md#repository-vault-rehearsal-015). Human acceptance and the next user-chosen repository remain pending; fresh chats are not enforced isolation. |
66
+ | Discover an AI Surface graph using available sources and applicable prior knowledge. | Instruction guidance in skill 0.1.5; code/docs-only and mixed evidence are valid starting points. | [DISCOVER-01 interaction](researcher-discovery.md#graph-discovery-reconciliation-and-live-evidence); distinguish guidance trials from live acceptance. |
67
+ | Reconcile a supplied Surface against current graph evidence. | Implemented instruction guidance; a controlled LibreChat declaration trial using installed 0.1.4 detected the target change and preserved prior research. Current 0.1.5 corrects ownership terminology. | [RECONCILE-02 procedure](researcher-reconciliation-trial.md) and [bounded evidence](researcher-skill-verification.md#controlled-declaration-trial-014); runtime and validated structured output remain unproved. |
68
+ | Inspect a graph-relevant live connection with user-assisted sign-in. | Specified through optional host tools; real admin inspection remains unverified. | [LIVE-01 interaction](researcher-discovery.md#graph-discovery-reconciliation-and-live-evidence); require actual UI/API readback without credential exposure. |
69
+ | Research a supplied repository through the standalone command with a human, then save and reopen the result. | Conversation and Markdown saving/reopening implemented; bounded evidence is tracked in SAVE-01. Structured HTML acceptance remains open. | Verify E2E-01 in #17; E2E-02 before claiming standalone LibreChat research. |
70
+
71
+ ## Governing development loop
72
+
73
+ For each increment, whether verifying existing behavior or adding a capability:
74
+
75
+ 1. Name the useful user task and why it matters.
76
+ 2. Define **State X**, the actual **Input Y**, and independently assessable
77
+ **Outcome Z**. Include the expected changes, observations and evidence source.
78
+ 3. Attempt Y through the current installed product in X. Record what it actually
79
+ does. If the entry point, credentials or environment are unavailable, record
80
+ the blocker; do not invent a baseline failure or bypass the product.
81
+ 4. Compare actual behavior with Z. If it already meets the intent, retain a
82
+ repeatable check and record the verified result; no code change is necessary.
83
+ Otherwise bound the next implementation increment to the observed gap.
84
+ 5. Add supporting automated checks for that gap and implement the increment when
85
+ a change is needed.
86
+ 6. After a change, repeat the original interaction through the installed product.
87
+ Reopen/read back its outputs independently, compare them with Z, and record the
88
+ result and limits.
89
+
90
+ Update the progress snapshot and linked evidence before choosing the next intent.
91
+ Each completed increment should make another useful behavior demonstrably verified,
92
+ or expose a specific blocker that remains visible.
93
+
94
+ The developing agent builds the Researcher's capabilities. It must not perform
95
+ the research itself and place prewritten answers in the output as proof that the
96
+ command works. A canned runner can test orchestration, but it is not a real-runner
97
+ research rehearsal. The same distinction applies to mocked storage and source reads.
98
+
99
+ A useful increment ends in visible, reproducible evidence or a concrete statement
100
+ of what remains unverified. Preserve the user task when implementation changes;
101
+ do not redefine success around whatever the code currently produces.
102
+
103
+ ## Initial public command inventory
104
+
105
+ This is the approved initial terminal surface for the first standalone milestone.
106
+ CMD-01 implements the overview and explicitly accepted local vault setup;
107
+ all argument forms below remain planned. See the [current parser contract](startup.md#settings-and-parser-decisions).
108
+ It includes startup, discover and explicit help/version behavior; the formerly
109
+ planned CMD-02 status command is retired.
110
+ Corpus operations below are conversation
111
+ intents, not additional undocumented subcommands. Any later command or option must
112
+ be added to this inventory with its own outcome and verification case first.
113
+
114
+ | ID | Invocation | User intent and delivered outcome | Observable change and verification |
115
+ | --- | --- | --- | --- |
116
+ | CMD-01 | `n8r-surface` | See readable non-private configuration and its file locations, local artefacts one per line, and process status where known. The setup-only increment offers vault selection and explicit write confirmation; configured reuse exits 0 without questions. Research remains unavailable. | Compare the initial overview with prepared settings/files using STARTUP-01. Read back any accepted setup change. Verify the overview itself changes no files and does not inspect/transmit source repositories or invoke inference. |
117
+ | CMD-03 | `n8r-surface discover` | Research the current directory with the human. | Establish cwd as the source scope, follow the identified Researcher instructions, inspect permitted material, ask relevant questions and save an attributable HTML research record. Verify with E2E-01. |
118
+ | CMD-04 | `n8r-surface discover ./product` | Research an explicitly selected directory. | Resolve the path from invocation cwd and report the actual scope; prove the intended source was read, with no fallback to a different repo. Verify source identity/read evidence and the resulting artefact. |
119
+ | CMD-05 | `n8r-surface discover ./documents/architecture.md` | Research one supplied document. | Inspect that file and retain file-only coverage. Reopen the resulting record and confirm it does not claim repository-wide inspection. |
120
+ | CMD-06 | `n8r-surface --help` | Discover the complete supported command surface and its effects. | Display syntax, purpose, source/destination behavior and links to details; exit without setup, source access, inference or writes. Compare with this inventory. |
121
+ | CMD-07 | `n8r-surface discover --help` | Understand the selected command before invoking it. | Display that command's inputs, outputs, side effects and limitations; no operation or setup begins. |
122
+ | CMD-08 | `n8r-surface --version` | Identify the installed tool being used or verified. | Display the package/build version without inference or mutation; compare with the installed package manifest. |
123
+ | CMD-10 | `n8r-surface reopen [FILE] --source SOURCE [--model MODEL]` | Continue a named Markdown note or saved HTML/JSON pair; omission suggests the latest-edited Markdown note. | Renew transmission consent; compare source evidence; see SAVE-01. |
124
+ | CMD-11 | `/save` at `You>` | Explicitly save or create a successor Markdown note. | Read back saved bytes and preserve predecessors; see SAVE-01. |
125
+ | CMD-12 | `/save surface` at `You>` | Save the exact validated pair previewed in the current conversation. | Immutable paired research HTML and Surface JSON, independent readback; see SURFACE-01. |
126
+ | CMD-09 | Unknown command, unknown option or invalid arguments | Receive an actionable explanation without unintended work. | Report the invalid input and applicable help, return failure, and leave source/corpus/settings unchanged. Never interpret a typo as permission to research. |
127
+
128
+ `discover [source]` also accepts an explicit absolute local source path; the
129
+ resulting portable artefact uses source IDs/portable locators rather than leaking
130
+ that machine's path. A directory need not be a Git repository. Git identity and
131
+ working-copy changes are recorded when present; otherwise file identity, hashes
132
+ and inspected coverage establish the source snapshot.
133
+
134
+ This inventory does not introduce `init`, `config`, `list`, `show`, `resume`,
135
+ `export`, `deploy` or other standalone subcommands. If real task attempts show a
136
+ need for them, specify and review their intent before adding them. Effective
137
+ settings are configurable as required by the design; the exact override syntax
138
+ must be added here when #16 selects it, before implementing that syntax.
139
+
140
+ Successful noninteractive informational commands exit successfully. Invalid input,
141
+ missing required setup and unavailable capabilities return a failure with a
142
+ specific reason; they must not wait on a prompt. Bare startup still prints its
143
+ overview without interactive input. If setup or conversation needs interaction,
144
+ explain the required interactive path and finish promptly. Discovery follows the
145
+ same no-wait rule when interaction is unavailable.
146
+ A future unattended-research interface needs an explicit answer/selection policy;
147
+ it is not implied by this first interactive workflow. Exact error codes belong in
148
+ \#16's parser contract and must preserve these observable distinctions.
149
+
150
+ Until #17 connects the actual Researcher, #16's `discover` reports that research
151
+ is unavailable. Printing a prompt or writing a placeholder HTML file is not CMD-03,
152
+ CMD-04 or CMD-05 success.
153
+
154
+ ## STARTUP-01: run the command and see what is here
155
+
156
+ **Given:** a readable configuration file at `~/.n8r/n8r-surface.json` selects
157
+ `~/n8r/artifacts` as the local artefact folder and JSON as the Surface output
158
+ format. No AI runner or Lab connection is configured. That folder contains one
159
+ valid synthetic Surface definition named LibreChat, stored as
160
+ `librechat-uniqueid.json`. No process status is known.
161
+
162
+ **When:** the user runs `n8r-surface` with no subcommands or switches.
163
+
164
+ **Then:** before any setup question or conversation, the terminal shows a readable
165
+ interpretation of those settings, where they came from, the saved artefact on one
166
+ line, and the fact that process status is unknown. For example:
167
+
168
+ ```text
169
+ $ n8r-surface
170
+
171
+ Configuration
172
+ File: ~/.n8r/n8r-surface.json
173
+ Artefact folder: ~/n8r/artifacts
174
+ Surface output: JSON
175
+ AI runner: Not configured
176
+ Lab connection: Not configured
177
+
178
+ Processes
179
+ Status unknown
180
+
181
+ Local artefacts (1)
182
+ LibreChat | Surface definition | ~/n8r/artifacts/librechat-uniqueid.json
183
+
184
+ Setup and AI conversation are not implemented in this build. Research needs a supported AI runner.
185
+ ```
186
+
187
+ This is representative expected output; the process also identifies its own live
188
+ PID and observation time. The interactive guidance question follows this overview.
189
+ The configured
190
+ folder in this example uses `artifacts`; the command displays the actual effective
191
+ path, whatever the folder is named. LibreChat is a synthetic saved-file label here,
192
+ not evidence that the command has researched LibreChat.
193
+
194
+ **Verify:** prepare those files under a temporary home directory, run the installed
195
+ command with closed input, and capture its output. Check the configuration path,
196
+ the readable values, exactly one artefact row with the right name and location,
197
+ and unknown process status. The command must finish promptly and identify missing
198
+ runner setup. Compare the files before and after: the overview changes nothing.
199
+ Also exercise an interactive launch and confirm the overview appears before the
200
+ first setup question. These are ordinary process, text and file checks; no special
201
+ test language is required. Exact spacing and decorative punctuation are optional.
202
+
203
+ The overview follows a few straightforward rules:
204
+
205
+ - Interpret supported non-private settings with useful labels instead of dumping
206
+ raw JSON. Show every contributing configuration file and explain defaults or
207
+ overrides when used. Adding a setting includes deciding how it appears here.
208
+ Omit secret values and private fields, including credentials inside URLs or
209
+ nested settings. A synthetic private-value marker must never appear in output.
210
+ - List saved research records and Surface definitions in the configured local
211
+ folder, with one logical line per artefact. Use available name/type metadata and
212
+ a distinguishing filename or location. Keep embedded newlines/control characters
213
+ from splitting a row or issuing terminal commands. Reading saved-file metadata
214
+ does not authorize scanning the source repositories those files describe.
215
+ - Say when the folder is empty. For missing/unreadable configuration or folders,
216
+ show the relevant location and problem; do not present failed inspection as an
217
+ empty corpus. An unreadable or unsupported artefact gets a filename and a clear
218
+ limitation on its own line rather than disappearing from the listing.
219
+ - Report a relevant process's identity and status when reliable status information
220
+ is available, including when it was observed if it may be stale. Otherwise say
221
+ unknown. A configured runner or saved PID alone does not establish that a process
222
+ is running. This overview does not introduce a background service.
223
+ - Produce the overview locally without AI inference, Lab credentials or implicit
224
+ network calls. It is read-only until the human accepts a setup change.
225
+
226
+ Repeat the same simple check with two artefacts, an empty folder, inaccessible
227
+ files, a private-value marker, and known versus unknown process status. Compare
228
+ each output to its prepared state. The separately planned status command was
229
+ retired before implementation. Configured vault reuse exits without a prompt;
230
+ first-use setup requires explicit confirmation.
231
+
232
+ **Current result:** verified through the installed command at `b90358a` on
233
+ Node 22/24/26, including closed input and a real terminal. See the
234
+ [observed output, independent readback and limits](startup-verification.md).
235
+ This is historical evidence. Current setup behavior has its own
236
+ [verification record](vault-setup-verification.md); research remains unavailable. [Startup decisions](startup.md) define the bounded path.
237
+
238
+ ## Conversation intents are part of the product surface
239
+
240
+ An explicitly requested research conversation must support these user tasks.
241
+ Wording is illustrative; outcomes, not exact phrasing, are the contract. Each
242
+ session establishes a source scope and destination explicitly enough to prevent
243
+ an accidental source or artefact change.
244
+
245
+ | ID | Human input or intent | Required change/outcome | Independent verification |
246
+ | --- | --- | --- | --- |
247
+ | CHAT-01 | "Research this supplied repository/document." | Establish the actual source, inspect permitted material using the Researcher instructions, retain evidence/gaps, and produce a research record. | Compare source-access evidence and attributed findings with the supplied snapshot; reopen the saved HTML through the reader and in a browser. |
248
+ | CHAT-02 | "Include the archive, but leave callbacks undecided." | Record the human's choice and unresolved option; ask a useful follow-up when the choice matters. | Read the saved decisions/questions and later selected graph. An undecided possibility must not become a selected edge. |
249
+ | CHAT-03 | "Save this research." | Persist the accepted record to the selected destination and report its identity/revision and actual location. | Read the file independently after the command returns; compare identity, revision and digest. A chat statement alone is not save evidence. |
250
+ | CHAT-04 | "Find and open the research I saved for this product." | List only the relevant permitted corpus and let the human select the intended record; no implicit resume or new source upload. | Match the displayed selection to saved IDs/revisions and original bytes; verify no unrelated record changed. |
251
+ | CHAT-05 | "Continue this record with this second document." | Establish access to that document and create a successor retaining earlier identities, evidence, decisions and unresolved work. | Compare before/after records, source hashes and parent digest; reopen both. Earlier revisions remain intact. |
252
+ | CHAT-06 | "I corrected this note/choice." | Preserve the edited bytes, review ambiguity with the human and produce an agreed successor, or report a conflict. | Keep before/edited/after versions; verify the correction is in both readable HTML and data, with no lost extensions or changed historical evidence. |
253
+ | CHAT-07 | "Make a Surface for the options I selected, and save it as JSON/YAML." | Produce a separate partial selected definition with sources, requirements and gaps; preserve the research record. | Reopen the actual output, resolve exact research references, compare selected nodes/edges to the human's decisions, and check supported JSON/YAML equality. |
254
+ | CHAT-08 | "Change the output folder/runner preference." | Show the proposed effective change and apply the human's selection without moving old artefacts or transmitting sources implicitly. | Read effective settings through bare startup; check old files and source-access/inference evidence. Runner and optional Lab destination remain independent. |
255
+
256
+ A host that can only supply downloads must say so and provide the real download;
257
+ it cannot claim to have saved into a local corpus. This command milestone uses
258
+ local persistence. External skill and Lab hosts have separate verification rows.
259
+
260
+ ## State X, input Y, verified Z
261
+
262
+ Use plain language and concrete examples. For a small behavior, a short **Given /
263
+ When / Then / Verify** description and representative output, as in STARTUP-01,
264
+ are enough. These are prose labels, not a parser, technical DSL or new test engine.
265
+ Automate the same interaction with ordinary process, output and file assertions.
266
+ Expected values come from the task and controlled sources, not from the
267
+ implementation under test.
268
+
269
+ The following checklist helps with more involved cases such as repository research;
270
+ it is not a mandatory form to repeat for every small check. Include only relevant
271
+ state and evidence, and record shared run metadata once in the verification record.
272
+
273
+ | Field | Content when relevant |
274
+ | --- | --- |
275
+ | Intent | The user's useful task and why it matters. |
276
+ | State X | Initial settings/files and interaction mode; for research, also instruction revision, source snapshot/dirty state, permitted scope and runner/model availability. Never include credential values. |
277
+ | Input Y | Exact command from its invocation directory, relevant user questions/answers and any supplied files. |
278
+ | Expected change | Files, records, revisions, decisions or configuration that should be created/changed, and important state that should stay unchanged. |
279
+ | Expected observations | What the terminal/conversation should show, including evidence references, questions, limitations and actual output location. |
280
+ | Verification Z | Independent source checks and persisted-state readback that establish each expected outcome. Name the evidence, not just a test command. |
281
+ | Actual result | What happened, with the exercised entry point and returned output; distinguish it from the expectation. |
282
+ | Assessment | Pass, fail, blocked or not attempted, with criterion-level results and remaining limits. |
283
+
284
+ The verification record must also identify who performed it, the date, environment,
285
+ installed package revision and retained evidence location. Redact private material
286
+ before publishing evidence; use public/synthetic fixtures for retained repository
287
+ records. A private rehearsal can retain its evidence privately and publish only
288
+ permitted conclusions and limits.
289
+
290
+ ## E2E-01: research a repository and produce a durable record
291
+
292
+ **Intent:** understand a supplied product repository with Researcher and retain
293
+ findings and human choices for later continuation. This is the minimum complete
294
+ path through source access, instructions, inference, human interaction and storage.
295
+
296
+ **State X:**
297
+
298
+ - Install the built package into a temporary consumer environment, independent of
299
+ its source checkout. Record its package/build, instruction and contract versions.
300
+ - Create a temporary Git repository containing the two tracked Lumen source
301
+ documents from [the shared fixtures](../../examples/researcher/README.md), with
302
+ a known commit and matching byte hashes. Copy no research HTML or answer files
303
+ into this source repository. Run the command from a different directory.
304
+ - Start with valid explicit settings, an empty artefact folder, no Lab connection,
305
+ a supported configured real runner/model and authorized transmission of only
306
+ these synthetic documents. The human can answer through the real interface.
307
+ - Preserve a before snapshot of settings, source and corpus. The independently
308
+ specified facts are: guide limit 10, settings limit 25, no known model version,
309
+ optional archive delivery, external identity and callback choices. Do not load
310
+ the expected research record into the runner's context.
311
+
312
+ **Input Y:**
313
+
314
+ ```sh
315
+ n8r-surface discover ./case-source
316
+ ```
317
+
318
+ The human asks: "Research the components and configuration choices in this repo.
319
+ Tell me where the sources disagree and ask which options I want to include."
320
+ When Researcher presents the consequential choices, the human answers: "Include
321
+ archival delivery and external identity. Leave callbacks undecided and keep the
322
+ batch-limit conflict unresolved. Save the research." Both turns go through the
323
+ command's actual conversation; do not inject the decisions directly into storage.
324
+
325
+ **Outcome and verification Z:**
326
+
327
+ | Step | What must happen or change | What we observe | How we verify it |
328
+ | --- | --- | --- | --- |
329
+ | 1. Find the repo | Establish the supplied repo as the source scope. | Selected source identity and inspected coverage; missing/unreadable material is explicit. | Match reported commit/working-copy state and inspected file hashes to the prepared repo. Check source-read events target only the permitted scope. |
330
+ | 2. Follow the Researcher instructions | Load an identified instruction revision and use it to research source evidence. | Instruction version/hash in the session evidence; claims linked to actual source reads and limitations. | Compare the loaded instruction hash with the packaged asset; inspect the actual runner request/tool trace and source-grounded behavior. A version label alone is insufficient. |
331
+ | 3. Interact with the human | Record requested selections, leave callbacks unresolved, and handle a relevant follow-up or correction. | An actual question/answer or correction exchange, with its consequence explained. | Match the transcript to saved decisions/questions. Do not count hard-coded answers or post-hoc edits by the developing agent. |
332
+ | 4. Preserve findings and uncertainty | Retain the 10/25 conflict and unknown model version without inventing a resolution. | Both attributed claims and the unknown are visible in the result. | Check them against the two frozen sources independently, including precise source locators and hashes. Exact generated wording need not match. |
333
+ | 5. Produce the artefact | Create a nonempty HTML research record at the selected destination. | The command reports the actual path, identity, revision and remaining gaps. | Read those bytes from disk after completion; parse with `readResearchHtml`, inspect readable HTML, and verify source references and decisions. A success message/file existence alone is insufficient. |
334
+ | 6. Reopen useful saved work | Exit and open the saved record through a fresh command conversation. | Previous findings, choices and questions remain available; no silent rerun or upload. | Compare reopened identity/revision/digest and retained decisions with the saved output; inspect the real read operation. |
335
+
336
+ **Pass:** all six steps are evidenced through the installed command with the real
337
+ runner and actual saved bytes. Record unsupported or failed criteria explicitly.
338
+ A fixture-library pass, fake runner, developer-authored artefact, or demonstration
339
+ that skips interaction or reopening cannot pass E2E-01.
340
+
341
+ **Current result:** not attempted; blocked by the missing CLI, Researcher instruction
342
+ bundle and runner. The supplied synthetic HTML files demonstrate the artefact
343
+ contract only. They are not outputs of this command scenario.
344
+
345
+ ## E2E-02: apply the same path to LibreChat
346
+
347
+ Before claiming LibreChat research works, repeat E2E-01 on a permitted, explicitly
348
+ selected LibreChat checkout, recording its exact upstream revision and dirty state.
349
+ Use a bounded task: "Describe the authentication path and the components and
350
+ configuration it depends on. Show the evidence and unknowns; ask what I want to
351
+ include, then save the research."
352
+
353
+ Before running, identify the expected relevant source files and a small set of
354
+ checkable facts directly from that frozen checkout. Record those expectations
355
+ separately from the runner input. Verify that the command really reads those
356
+ sources, distinguishes supported options from the user's chosen setup, and does
357
+ not mistake repository documentation for a running integration. Missing optional
358
+ sources remain coverage gaps. Review unexpected findings against the source;
359
+ do not require a fixed prose answer or silently drop supported new evidence.
360
+
361
+ Apply all six verification steps above, using actual persisted outputs. Also
362
+ check that the same product-agnostic instructions work without LibreChat-specific
363
+ control flow. The source version, independent expected-fact set and real output
364
+ must be recorded when exercised; none is invented here.
365
+
366
+ **Current result:** this installed-command path is not attempted. A separate
367
+ [installed-skill LibreChat source rehearsal](researcher-skill-verification.md#predictable-notes-and-real-source-trial-012)
368
+ has saved and reopened working notes. It does not establish E2E-02, runtime
369
+ authentication, human acceptance or validated HTML/Surface output.
370
+
371
+ ## Other required paths and failure outcomes
372
+
373
+ Each row gets a concrete plain-language example when its increment starts.
374
+ These checks accompany E2E-01; they are not a substitute for the complete path.
375
+
376
+ | Case | State X and input Y | Expected change and observable outcome | Verification |
377
+ | --- | --- | --- | --- |
378
+ | SETUP-01 | Isolated home without settings, source outside the vault; run bare `n8r-surface`, press Enter then `y`. | Show `Vault directory [~/n8r/]:`, resolved path and `Create vault folders and save this location? [y/N]`. Acceptance creates three folders and saves version-1 `vaultRoot`, exit 0. Refusal/EOF/interrupt exits 1 without writes. | Read settings and `research/`, `artifacts/`, `surfaces/` independently; repeat from another source cwd with no question or settings rewrite. Preserve source and legacy bytes. |
379
+ | INPUT-01 | Unknown argument or nonexistent/unreadable source. | Specific error or explicit coverage limitation; no substituted repo or invented completed record. | Observe terminal/exit result; inspect source-access events and corpus changes. |
380
+ | SCOPE-01 | Explicit file source, or cwd different from installation and source. | Inspect exactly the intended scope, retaining omissions/truncation. | Compare read paths/hashes and saved coverage to prepared inputs; ensure file-only research does not claim whole-repo coverage. |
381
+ | RUNNER-01 | Missing credential, unavailable model, network failure or cancelled interaction. | Report blocked/partial progress honestly, preserve useful accepted work, and avoid fallback. | Inspect actual runner destination/results and saved state; no completed-research claim without evidence. |
382
+ | CONTINUE-01 | Saved incomplete Harbor r1 plus the authentication source; CHAT-05. | Add supported authentication evidence under the existing finding ID and a new revision. | Reopen old/new records; verify hashes, parent, retained decisions and new source evidence. |
383
+ | EDIT-01 | Accepted record changed manually after read; CHAT-06/save. | Preserve the manual edit, report conflict and reconcile only the human-reviewed intent. | Keep before/edited/after bytes and compare both data and visible HTML. Verify the old revision remains recoverable. |
384
+ | SAVE-01 | Unwritable destination or interruption during write. | Report failure accurately and retain recoverable previous work. | Read actual filesystem state after the failed operation; check no partial replacement masquerades as the accepted record. |
385
+ | SELECT-01 | Two researched products and explicit human choices; CHAT-07. | Save a separate selected graph with shared nodes, parallel edges, cycles, references, requirements and gaps. | Compare persisted graph to selections and exact research revisions, reopen both JSON/YAML outputs and verify supported meanings. |
386
+ | NONINTERACTIVE-01 | No interactive input; CMD-01 or discover needs a decision. | For bare startup needing setup/repair: `Vault setup required; run n8r-surface in an interactive terminal.`, exit 1 promptly, no writes. Configured reuse exits 0; invalid settings, filesystem and legacy inspection failures exit 2 before setup. | Exercise the installed process with closed input under a bounded harness and inspect its output/state. |
387
+ | HELP-01 | Any setup state; CMD-06/07/08. | Accurate help/version, no work begun. | Compare to the inventory/manifest and verify unchanged settings/corpus and no source/inference calls. |
388
+
389
+ Absence-of-side-effect claims need instrumented boundaries and before/after state,
390
+ not just an absence of terminal messages. Verification traces must omit secrets
391
+ and retain only permitted source excerpts. Record input/version metadata, tool
392
+ calls and returned evidence; internal model reasoning is not required. A later independent check can verify
393
+ the recorded readback; the implementer's report does not replace human acceptance.
394
+
395
+ ## Milestone acceptance and evidence status
396
+
397
+ | Milestone | What its evidence can establish | Required product proof |
398
+ | --- | --- | --- |
399
+ | #15 | Experimental record/graph contracts, synthetic preservation/reference checks and this outcome specification. | Reviewable human-readable examples and concrete inputs for the command work; no successful command claim. |
400
+ | #16 | Installed startup, scoped source operations and safe persistence foundation. | STARTUP-01's readable no-argument overview first, then installed command rehearsals for applicable setup/input/scope/save/help/noninteractive paths. Discovery explicitly remains unavailable until #17. |
401
+ | #17 | The shared Researcher completes standalone discovery with a human. | E2E-01 with a real runner, continued/edited research and selected output; E2E-02 before claiming LibreChat support. External skill behavior is exercised separately. |
402
+ | Later Lab integration | A named consumer imports and continues supported standalone work. | The same facts/choices/gaps survive the named application's actual entry points, with limitations and losses recorded. |
403
+
404
+ Maintain an evidence record beside the capability being delivered. It contains the
405
+ case ID, initial state, exact interaction, expected/actual changes, evidence/readback,
406
+ revision/environment, verdict and unproved limits. Link it from the issue and PR.
407
+ Tests may automate parts of this process, but the record must explain what those
408
+ checks demonstrated in terms a person trying the feature can assess.
409
+
410
+ ## SETUP-01: setup-only increment
411
+
412
+ Specified before implementation on 5 November 2026; setup is implemented.
413
+ Candidate verification and its limits are recorded in
414
+ [the setup evidence](vault-setup-verification.md). The [plan](../superpowers/plans/2026-11-05-standalone-vault.md)
415
+ defines exact prompts, path handling, repair, preservation and the user-approved
416
+ cooperating-writer concurrency boundary. No arguments are added. SOURCE-01 remains
417
+ paused. Earlier read-only STARTUP-01 evidence is historical, not evidence for the
418
+ new setup interaction. Missing legacy corpus now permits setup; other legacy
419
+ inspection errors still take precedence (exit 2). No research is started.
420
+
421
+ ## RESEARCH-01: first standalone conversation
422
+
423
+ Specified on 5 November 2026 before implementation. This is a bounded #17
424
+ increment, not completion of E2E-01. The delivery priority is now standalone AI,
425
+ then save/reopen/continue verification, then distribution (#27). Lab adaptation
426
+ remains separate work in its own repository.
427
+
428
+ **Given** a configured vault, permitted local source and Codex 0.166.0 signed in
429
+ with ChatGPT, **when** the user runs `n8r-surface discover [source]`, accepts the
430
+ source-transmission confirmation and asks about the source, **then** Codex uses
431
+ bounded host tools to inspect it and returns findings with source locations.
432
+ A correction or follow-up stays in the same conversation. **Verify** by comparing
433
+ the cited source lines and tool digests with the unchanged source bytes.
434
+
435
+ CMD-03/04/05 accept one optional directory or file (default cwd), plus optional
436
+ `--model MODEL` for an explicit per-session choice. Without it, use the configured
437
+ Codex model; never silently select another. CMD-06/07 display local help and CMD-08
438
+ (`--version`) displays the package version without setup, source reads or Codex.
439
+ Unknown arguments fail with exit 2 without echoing them or reading configuration.
440
+
441
+ Discovery requires an interactive input/output terminal; otherwise exit 1 without
442
+ loading settings or launching Codex. In a terminal, validate settings, require a
443
+ complete configured vault, resolve the selected scope and display it. Explain
444
+ that inspected source text and the conversation go to OpenAI through Codex using
445
+ ChatGPT sign-in; ask `Start research with OpenAI using Codex ChatGPT sign-in? [y/N]`.
446
+ Only y/yes authorizes inference and source content reads. Refusal/EOF exits 1;
447
+ invalid source/settings, runner failure or failed turns exit 2. Ctrl-C exits 130
448
+ and stops the owned server. No API-key, provider or model fallback is permitted.
449
+
450
+ After connecting, display the model and bundled Researcher version/digest.
451
+ At `You>`, accept one line per turn. Display tool-read paths/digests and completed
452
+ agent messages as they arrive. `/exit` or EOF at the prompt exits 0. Ctrl-C during
453
+ a turn requests interruption and closes the server. A failed or timed-out answer
454
+ is marked incomplete and exits 2. SAVE-01 adds explicit Markdown saving/reopening;
455
+ structured output, web/live access and extra source selection remain unsupported.
456
+ Without `/save`, the CLI creates no research artefact; Codex owns its own authentication, cache and diagnostic state.
457
+
458
+ ## SAVE-01: save, reopen and continue
459
+
460
+ Implemented bounded Markdown increment for #17; see [evidence and limits](save-reopen-verification.md).
461
+
462
+ - Given a configured vault and an authorized research conversation, enter `/save`.
463
+ Expect a numbered `research/<source-slug>/research-NNN.md` destination, a
464
+ Researcher-authored working note, and a saved path plus byte digest after readback.
465
+ The note retains stable component IDs, source references/hashes, human decisions,
466
+ unknowns and recommended next steps. Ordinary conversation does not write;
467
+ natural-language save requests receive guidance to use `/save`.
468
+ - Exit, then run `n8r-surface reopen NOTE --source SOURCE [--model MODEL]`.
469
+ Confirm transmission of the note and source. Expect a fresh conversation which
470
+ compares recorded evidence against that source, retains decisions separately,
471
+ and reports changed/missing evidence rather than silently revising history.
472
+ - Alternatively run `n8r-surface reopen --source SOURCE [--model MODEL]`.
473
+ Expect the most recently filesystem-edited numbered note in that source's
474
+ research folder, with path and edit time, and a yes/no selection prompt.
475
+ Refusal exits without launching Codex or writing. Explicit NOTE bypasses ranking.
476
+ - Continue and `/save` again. Expect the next unused number in the predecessor's
477
+ folder, a predecessor filename/digest, unchanged predecessor bytes and retained
478
+ identities. If the predecessor changes while drafting, stop and require reopening
479
+ the edited note. No general write tool or validated structured output is added.
480
+
481
+ The suggested filename is convenience, not evidence of source identity or a
482
+ selection of a deployment. A fresh process requires explicit `--source`; it never
483
+ restores private source paths from a saved note. Help (`reopen --help`) is read-only.
484
+
485
+ ### Pending-operation feedback
486
+
487
+ While connecting, answering, reopening or preparing a `/save` draft, show an
488
+ interactive-terminal spinner with elapsed seconds and the operation label. Clear
489
+ it before normal output and stop it on completion, failure or cancellation. Do
490
+ not animate at `You>` or in nonterminal output. It means the request is pending,
491
+ not that server-side progress is known. Verify a delayed answer/save and Ctrl-C;
492
+ expect visible activity, clean answer/prompt output, and no continuing timer.
493
+
494
+ ## SURFACE-01: generate, save and revise a partial Surface
495
+
496
+ **Implemented in the candidate; verification is tracked in the
497
+ [Surface evidence record](surface-revisions-verification.md).** The installed baseline
498
+ help checked on 5 November 2026 supported Markdown-only saves. Structured output was
499
+ the authorized known missing capability; no failed live generation trial is claimed.
500
+
501
+ **Given:** a saved numbered note, permitted source, configured vault and supported
502
+ Codex sign-in. **When:** reopen the note, ask “Create a Surface from these notes;
503
+ show me what is selected and still unknown,” inspect the preview and enter
504
+ `/save surface`. **Then:** save and read back linked research HTML and Surface JSON
505
+ without changing the note or source. `/save` continues saving Markdown notes.
506
+
507
+ Exit and start `n8r-surface reopen FILE --source SOURCE`, selecting either saved
508
+ member of the pair. After renewed transmission consent, change a named decision,
509
+ request an updated Surface and save it. Expect a new pair with retained identities,
510
+ evidence, human decisions and exact parent references. Earlier bytes remain intact.
511
+ Omitting FILE continues suggesting a Markdown note only. Unknown or unsupported
512
+ files fail clearly; no implicit search for missing research records is authorized.
513
+
514
+ **Verify:** independently parse/read both pairs, check research logical references,
515
+ parent digests and retained IDs/decisions/evidence, and compare note, predecessor,
516
+ source and settings bytes. Repeat a small second-product case. Real installed Codex
517
+ output is required; scripted protocol tests do not establish research correctness.
518
+ See the [design and short human proof](../superpowers/specs/2026-11-05-surface-revisions-design.md).
519
+
520
+ ## DISTRIBUTION-01: install either official package candidate
521
+
522
+ Given a built checkout and cached dependencies, generate private candidates using
523
+ `npm run pack:candidates -- NEW_DIRECTORY`. Install each tarball independently
524
+ outside the checkout. Expect the same `n8r-surface` command, version, library
525
+ exports and bundled assets; bare startup with a fresh home and closed input exits
526
+ 1 with setup guidance and no writes. Configured startup retains existing read-only
527
+ checks. The public command inventory is unchanged.
528
+
529
+ The [distribution procedure](npm-distribution.md) supplies copyable interactions,
530
+ readback and release blockers. The pre-change registry attempt returned E404 for
531
+ both names and E401 for identity on 5 November 2026. Local candidates cannot prove
532
+ registry installation, permissions or provenance. Candidate checks use scripted
533
+ runner fixtures; no new real-model research claim follows.
534
+
535
+ ## VERSION-01: identify the installed package and its release source
536
+
537
+ Given an installed candidate in an isolated consumer, run `n8r-surface --version`
538
+ from another directory. Expect the installed manifest's version, exit 0, no setup
539
+ or inference. The pre-change installed command reported `0.0.0-experimental.1`;
540
+ a copied installation with manifest `0.7.3-rc.2` reproduced the stale hardcoded
541
+ output. The regression now reads back `n8r-surface 0.7.3-rc.2`.
542
+
543
+ The [version policy and human check](versioning.md) describe source/lockfile
544
+ validation and read-only release mapping verification. Synthetic Git repositories
545
+ exercise missing/wrong tags, dirty source, altered archives and release metadata;
546
+ they do not establish an authenticated release or registry provenance. The public
547
+ CLI inventory is unchanged; `check:version` and `check:release` are maintainer npm
548
+ scripts. Real release verification remains blocked until an authorized release
549
+ and publishing setup exist.
550
+
551
+ ## RELEASE-01: prepare and publish the first dual release
552
+
553
+ Given reviewed version `0.1.0-experimental.2`, explicit
554
+ `npm run pack:candidates -- NEW_DIRECTORY --publishable` creates both equivalent
555
+ publishable archives; the source and default candidates remain private. The
556
+ [human procedure](npm-release.md#human-check-before-publication) checks both
557
+ installed routes and unchanged isolated homes. Public CLI inventory is unchanged.
558
+
559
+ The manual workflow prepares retained archives before publication and verifies
560
+ existing registry bytes before staging only absent versions for maintainer 2FA approval. Tests cover altered
561
+ bytes, wrong registry identity/integrity, partial-publication recovery and network
562
+ failure. These use synthetic registry boundaries, not authenticated publication.
563
+ Live workflow, registry installation, cryptographic provenance and immutable
564
+ release acceptance remain unverified until the documented release procedure runs.