@xingular/harness 1.0.0 → 1.1.1

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 (257) hide show
  1. package/CHANGELOG.md +33 -5
  2. package/README.md +70 -19
  3. package/dist/cli.js +10321 -5785
  4. package/dist/sdk/agents/builtin.d.ts +2 -0
  5. package/dist/sdk/agents/builtin.js +34 -0
  6. package/dist/sdk/agents/narrow.d.ts +13 -0
  7. package/dist/sdk/agents/narrow.js +29 -0
  8. package/dist/sdk/agents/profiles.d.ts +80 -0
  9. package/dist/sdk/agents/profiles.js +221 -0
  10. package/dist/sdk/annotations/bridge.d.ts +42 -0
  11. package/dist/sdk/annotations/bridge.js +264 -0
  12. package/dist/sdk/annotations/capture.d.ts +116 -0
  13. package/dist/sdk/annotations/capture.js +308 -0
  14. package/dist/sdk/annotations/delivery.d.ts +72 -0
  15. package/dist/sdk/annotations/delivery.js +130 -0
  16. package/dist/sdk/annotations/inspect.d.ts +10 -0
  17. package/dist/sdk/annotations/inspect.js +33 -0
  18. package/dist/sdk/annotations/isolated.d.ts +6 -0
  19. package/dist/sdk/annotations/isolated.js +51 -0
  20. package/dist/sdk/annotations/pageScript.d.ts +28 -0
  21. package/dist/sdk/annotations/pageScript.js +570 -0
  22. package/dist/sdk/annotations/part.d.ts +10 -0
  23. package/dist/sdk/annotations/part.js +144 -0
  24. package/dist/sdk/annotations/queue.d.ts +4 -0
  25. package/dist/sdk/annotations/queue.js +40 -0
  26. package/dist/sdk/annotations/serverMethods.d.ts +3 -0
  27. package/dist/sdk/annotations/serverMethods.js +62 -0
  28. package/dist/sdk/annotations/store.d.ts +160 -0
  29. package/dist/sdk/annotations/store.js +386 -0
  30. package/dist/sdk/browser/index.d.ts +14 -3
  31. package/dist/sdk/browser/index.js +11 -4
  32. package/dist/sdk/browser/serverMethods.d.ts +3 -0
  33. package/dist/sdk/browser/serverMethods.js +7 -0
  34. package/dist/sdk/browser/session.d.ts +1 -0
  35. package/dist/sdk/browser/session.js +45 -9
  36. package/dist/sdk/cli.js +19 -11
  37. package/dist/sdk/core/bus.js +1 -1
  38. package/dist/sdk/core/env.d.ts +1 -1
  39. package/dist/sdk/core/env.js +1 -1
  40. package/dist/sdk/doctor/serverMethods.d.ts +3 -0
  41. package/dist/sdk/doctor/serverMethods.js +8 -0
  42. package/dist/sdk/harness.d.ts +15 -0
  43. package/dist/sdk/harness.js +44 -5
  44. package/dist/sdk/history/recall.js +8 -8
  45. package/dist/sdk/history/serverMethods.d.ts +3 -0
  46. package/dist/sdk/history/serverMethods.js +8 -0
  47. package/dist/sdk/hub/cli.d.ts +1 -1
  48. package/dist/sdk/hub/cli.js +1 -1
  49. package/dist/sdk/hub/schema.d.ts +1 -1
  50. package/dist/sdk/hub/serverMethods.d.ts +3 -0
  51. package/dist/sdk/hub/serverMethods.js +11 -0
  52. package/dist/sdk/index.d.ts +10 -0
  53. package/dist/sdk/index.js +7 -0
  54. package/dist/sdk/mcp/connections.js +14 -7
  55. package/dist/sdk/mcp/serverMethods.d.ts +3 -0
  56. package/dist/sdk/mcp/serverMethods.js +22 -0
  57. package/dist/sdk/plugins/builtin.d.ts +1 -0
  58. package/dist/sdk/plugins/builtin.js +128 -33
  59. package/dist/sdk/plugins/builtinRegistry.d.ts +53 -0
  60. package/dist/sdk/plugins/builtinRegistry.js +49 -0
  61. package/dist/sdk/plugins/cli.d.ts +1 -1
  62. package/dist/sdk/plugins/cli.js +4 -3
  63. package/dist/sdk/prompt/compile.d.ts +5 -2
  64. package/dist/sdk/prompt/compile.js +25 -8
  65. package/dist/sdk/refine/cli.d.ts +1 -1
  66. package/dist/sdk/refine/cli.js +2 -2
  67. package/dist/sdk/refine/serverMethods.d.ts +3 -0
  68. package/dist/sdk/refine/serverMethods.js +20 -0
  69. package/dist/sdk/server/methods.js +9 -86
  70. package/dist/sdk/server/params.d.ts +4 -0
  71. package/dist/sdk/server/params.js +11 -0
  72. package/dist/sdk/sessions/contracts.d.ts +17 -0
  73. package/dist/sdk/sessions/contracts.js +42 -3
  74. package/dist/sdk/sessions/planMode.d.ts +5 -2
  75. package/dist/sdk/sessions/planMode.js +12 -3
  76. package/dist/sdk/sessions/reasoningSummaries.d.ts +2 -2
  77. package/dist/sdk/sessions/reasoningSummaries.js +3 -3
  78. package/dist/sdk/sessions/registry.d.ts +1 -0
  79. package/dist/sdk/sessions/registry.js +4 -1
  80. package/dist/sdk/sessions/runIndex.js +7 -7
  81. package/dist/sdk/sessions/runStore.js +3 -1
  82. package/dist/sdk/sessions/runner.js +2 -2
  83. package/dist/sdk/sessions/sessions.d.ts +17 -5
  84. package/dist/sdk/sessions/sessions.js +79 -12
  85. package/dist/sdk/sessions/sideQuestionServerMethods.d.ts +3 -0
  86. package/dist/sdk/sessions/sideQuestionServerMethods.js +19 -0
  87. package/dist/sdk/sessions/sideQuestions.d.ts +66 -0
  88. package/dist/sdk/sessions/sideQuestions.js +290 -0
  89. package/dist/sdk/sessions/subagentServerMethods.d.ts +3 -0
  90. package/dist/sdk/sessions/subagentServerMethods.js +41 -0
  91. package/dist/sdk/sessions/subagentService.d.ts +13 -2
  92. package/dist/sdk/sessions/subagentService.js +34 -16
  93. package/dist/sdk/sessions/subagents.d.ts +9 -1
  94. package/dist/sdk/sessions/subagents.js +19 -0
  95. package/dist/sdk/terminal/browser.d.ts +62 -0
  96. package/dist/sdk/terminal/browser.js +41 -0
  97. package/dist/sdk/terminal/browserControl.d.ts +29 -0
  98. package/dist/sdk/terminal/browserControl.js +186 -0
  99. package/dist/sdk/terminal/commandHelp.d.ts +17 -0
  100. package/dist/sdk/terminal/commandHelp.js +20 -0
  101. package/dist/sdk/terminal/controller.d.ts +7 -1
  102. package/dist/sdk/terminal/controller.js +34 -2
  103. package/dist/sdk/terminal/opentui/subagentsWidget.d.ts +28 -0
  104. package/dist/sdk/terminal/opentui/subagentsWidget.js +52 -0
  105. package/dist/sdk/terminal/piExtension.js +33 -48
  106. package/dist/sdk/terminal/socket.d.ts +6 -3
  107. package/dist/sdk/terminal/socket.js +40 -9
  108. package/dist/sdk/terminal/standalone.d.ts +2 -0
  109. package/dist/sdk/terminal/standalone.js +50 -10
  110. package/dist/sdk/terminal/subagentMonitor.d.ts +38 -0
  111. package/dist/sdk/terminal/subagentMonitor.js +121 -0
  112. package/dist/sdk/terminal/terminals.d.ts +42 -6
  113. package/dist/sdk/terminal/terminals.js +359 -18
  114. package/dist/sdk/terminal/trajectory.js +2 -2
  115. package/dist/sdk/terminal/tui/annotateCommand.d.ts +3 -0
  116. package/dist/sdk/terminal/tui/annotateCommand.js +22 -0
  117. package/dist/sdk/terminal/tui/commandPages.d.ts +5 -1
  118. package/dist/sdk/terminal/tui/commandPages.js +54 -6
  119. package/dist/sdk/terminal/tui/commands.d.ts +8 -4
  120. package/dist/sdk/terminal/tui/commands.js +181 -58
  121. package/dist/sdk/terminal/tui/dialogGeometry.d.ts +2 -2
  122. package/dist/sdk/terminal/tui/dialogGeometry.js +4 -2
  123. package/dist/sdk/terminal/tui/dialogs.d.ts +6 -1
  124. package/dist/sdk/terminal/tui/dialogs.js +9 -2
  125. package/dist/sdk/terminal/tui/modelPicker.js +1 -6
  126. package/dist/sdk/terminal/tui/page.d.ts +3 -0
  127. package/dist/sdk/terminal/tui/pageOverlay.js +17 -6
  128. package/dist/sdk/terminal/tui/pages/accountsPage.d.ts +26 -4
  129. package/dist/sdk/terminal/tui/pages/accountsPage.js +264 -36
  130. package/dist/sdk/terminal/tui/pages/agentsPage.d.ts +74 -0
  131. package/dist/sdk/terminal/tui/pages/agentsPage.js +190 -0
  132. package/dist/sdk/terminal/tui/pages/annotatePage.d.ts +94 -0
  133. package/dist/sdk/terminal/tui/pages/annotatePage.js +341 -0
  134. package/dist/sdk/terminal/tui/pages/browserPage.d.ts +87 -0
  135. package/dist/sdk/terminal/tui/pages/browserPage.js +738 -0
  136. package/dist/sdk/terminal/tui/pages/doctorPage.d.ts +2 -0
  137. package/dist/sdk/terminal/tui/pages/doctorPage.js +103 -15
  138. package/dist/sdk/terminal/tui/pages/notesPage.d.ts +75 -0
  139. package/dist/sdk/terminal/tui/pages/notesPage.js +201 -0
  140. package/dist/sdk/terminal/tui/pages/settingsPage.d.ts +8 -0
  141. package/dist/sdk/terminal/tui/pages/settingsPage.js +16 -1
  142. package/dist/sdk/terminal/tui/pages/subagentsPage.d.ts +23 -0
  143. package/dist/sdk/terminal/tui/pages/subagentsPage.js +70 -0
  144. package/dist/sdk/terminal/tui/pages/trajectoryPage.d.ts +12 -5
  145. package/dist/sdk/terminal/tui/pages/trajectoryPage.js +156 -83
  146. package/dist/sdk/terminal/tui/pages/worktreesPage.d.ts +72 -0
  147. package/dist/sdk/terminal/tui/pages/worktreesPage.js +203 -0
  148. package/dist/sdk/terminal/tui/planMode.d.ts +1 -1
  149. package/dist/sdk/terminal/tui/planMode.js +1 -1
  150. package/dist/sdk/terminal/tui/pluginCommands.d.ts +14 -0
  151. package/dist/sdk/terminal/tui/pluginCommands.js +27 -0
  152. package/dist/sdk/terminal/tui/questions.d.ts +2 -0
  153. package/dist/sdk/terminal/tui/runtime.js +4 -2
  154. package/dist/sdk/terminal/tui/settingsModel.d.ts +2 -0
  155. package/dist/sdk/terminal/tui/settingsModel.js +32 -2
  156. package/dist/sdk/terminal/tui/sideQuestion.d.ts +26 -26
  157. package/dist/sdk/terminal/tui/sideQuestion.js +131 -98
  158. package/dist/sdk/terminal/tui/ui.d.ts +2 -0
  159. package/dist/sdk/terminal/tui/ui.js +1 -0
  160. package/dist/sdk/tools/askUser.js +26 -8
  161. package/dist/sdk/tools/checklist.js +2 -2
  162. package/dist/sdk/tools/harnessTools.d.ts +2 -0
  163. package/dist/sdk/tools/harnessTools.js +1 -1
  164. package/dist/sdk/tools/spawnSubagent.js +13 -4
  165. package/dist/sdk/web/part.d.ts +10 -0
  166. package/dist/sdk/web/part.js +6 -0
  167. package/dist/sdk/web/serverMethods.d.ts +3 -0
  168. package/dist/sdk/web/serverMethods.js +7 -0
  169. package/dist/sdk/wiki/serverMethods.d.ts +3 -0
  170. package/dist/sdk/wiki/serverMethods.js +26 -0
  171. package/dist/sdk/worktrees/cli.d.ts +11 -0
  172. package/dist/sdk/worktrees/cli.js +146 -0
  173. package/dist/sdk/worktrees/copy.d.ts +9 -0
  174. package/dist/sdk/worktrees/copy.js +111 -0
  175. package/dist/sdk/worktrees/git.d.ts +16 -0
  176. package/dist/sdk/worktrees/git.js +81 -0
  177. package/dist/sdk/worktrees/serverMethods.d.ts +3 -0
  178. package/dist/sdk/worktrees/serverMethods.js +30 -0
  179. package/dist/sdk/worktrees/service.d.ts +73 -0
  180. package/dist/sdk/worktrees/service.js +483 -0
  181. package/dist/sdk/worktrees/setup.d.ts +23 -0
  182. package/dist/sdk/worktrees/setup.js +65 -0
  183. package/dist/sdk/worktrees/types.d.ts +91 -0
  184. package/dist/sdk/worktrees/types.js +1 -0
  185. package/dist/sdk/world/cli.d.ts +2 -2
  186. package/dist/sdk/world/cli.js +6 -6
  187. package/dist/sdk/world/world.d.ts +3 -1
  188. package/dist/sdk/world/world.js +8 -9
  189. package/dist/terminal-opentui.js +14540 -7374
  190. package/dist/terminal-pi.js +285 -666
  191. package/docs/README.md +22 -2
  192. package/docs/architecture/00-overview.md +28 -16
  193. package/docs/architecture/02-sessions-and-runs.md +72 -15
  194. package/docs/architecture/03-variants.md +10 -2
  195. package/docs/architecture/04-prompt.md +26 -6
  196. package/docs/architecture/06-plugins-and-capabilities.md +39 -3
  197. package/docs/architecture/07-tools-and-gate.md +21 -6
  198. package/docs/architecture/09-accounts-and-connectors.md +8 -0
  199. package/docs/architecture/10-server-protocol.md +111 -2
  200. package/docs/architecture/11-terminal.md +185 -5
  201. package/docs/architecture/12-storage.md +15 -1
  202. package/docs/architecture/13-world-tools.md +28 -6
  203. package/docs/architecture/14-surfaces-and-parity.md +89 -0
  204. package/docs/architecture/README.md +15 -4
  205. package/docs/architecture/proposals/PROP-0006-run-checklist.md +4 -2
  206. package/docs/architecture/proposals/PROP-0013-resource-browser.md +58 -0
  207. package/docs/architecture/proposals/PROP-0014-fullscreen-browser-tabs.md +58 -0
  208. package/docs/architecture/proposals/PROP-0015-one-capability-surface.md +88 -0
  209. package/docs/architecture/proposals/PROP-0016-managed-worktrees.md +156 -0
  210. package/docs/architecture/proposals/PROP-0017-page-annotations.md +127 -0
  211. package/docs/architecture/proposals/PROP-0018-annotation-queue-and-app-targets.md +179 -0
  212. package/docs/architecture/proposals/PROP-0019-contextual-side-questions.md +122 -0
  213. package/docs/architecture/proposals/PROP-0020-builtin-feature-plugins.md +105 -0
  214. package/docs/architecture/proposals/PROP-0021-command-namespaces-and-duplicates.md +99 -0
  215. package/docs/architecture/proposals/PROP-0022-plan-only-questions.md +102 -0
  216. package/docs/architecture/proposals/PROP-0023-xagent-cli-name.md +61 -0
  217. package/docs/architecture/proposals/PROP-0024-question-sketch-previews.md +130 -0
  218. package/docs/architecture/proposals/PROP-0025-contextual-question-wireframes.md +49 -0
  219. package/docs/architecture/proposals/PROP-0026-connected-sketch-display.md +94 -0
  220. package/docs/architecture/proposals/PROP-0027-xingular-agent-product-identity.md +60 -0
  221. package/docs/architecture/proposals/PROP-0028-normalize-question-wireframes.md +55 -0
  222. package/docs/architecture/proposals/PROP-0029-agent-profiles.md +124 -0
  223. package/docs/architecture/proposals/PROP-0030-subagent-title.md +86 -0
  224. package/docs/architecture/proposals/README.md +25 -0
  225. package/docs/decisions/ADR-0009-xharness-command.md +6 -5
  226. package/docs/decisions/ADR-0014-public-release-baseline.md +3 -2
  227. package/docs/decisions/ADR-0015-resource-browser.md +28 -0
  228. package/docs/decisions/ADR-0016-fullscreen-browser-tabs.md +31 -0
  229. package/docs/decisions/ADR-0017-one-capability-surface.md +34 -0
  230. package/docs/decisions/ADR-0018-builtin-feature-plugins.md +35 -0
  231. package/docs/decisions/ADR-0019-managed-git-worktrees.md +31 -0
  232. package/docs/decisions/ADR-0020-page-annotations.md +37 -0
  233. package/docs/decisions/ADR-0021-required-command-namespaces.md +40 -0
  234. package/docs/decisions/ADR-0022-plan-only-question-tools.md +34 -0
  235. package/docs/decisions/ADR-0023-contextual-side-question-runs.md +35 -0
  236. package/docs/decisions/ADR-0024-xagent-command.md +40 -0
  237. package/docs/decisions/ADR-0025-question-choice-sketches.md +49 -0
  238. package/docs/decisions/ADR-0026-contextual-question-wireframes.md +58 -0
  239. package/docs/decisions/ADR-0027-connected-sketch-display.md +60 -0
  240. package/docs/decisions/ADR-0028-xingular-agent-product-identity.md +56 -0
  241. package/docs/decisions/ADR-0029-normalized-question-wireframe-borders.md +33 -0
  242. package/docs/decisions/ADR-0030-agent-profiles.md +43 -0
  243. package/docs/doctor.md +10 -4
  244. package/docs/features/README.md +26 -0
  245. package/docs/features/interfaces/README.md +1 -1
  246. package/docs/future-work.md +48 -0
  247. package/docs/parity.md +78 -0
  248. package/docs/releases/1.0.0.md +2 -2
  249. package/docs/releases/4.0.0.md +46 -0
  250. package/docs/releases/README.md +20 -15
  251. package/docs/study/00-index.md +5 -0
  252. package/docs/study/autonomous-engineering-sources.md +277 -0
  253. package/docs/study/autonomy-sources.md +147 -0
  254. package/docs/study/proactive-autonomy.md +408 -0
  255. package/docs/study/tui-resource-browser.md +78 -0
  256. package/docs/terminal-tui.md +325 -93
  257. package/package.json +3 -3
@@ -0,0 +1,61 @@
1
+ ---
2
+ id: PROP-0023
3
+ title: Rename the published CLI command to xagent
4
+ status: Implemented
5
+ created: 2026-10-24
6
+ updated: 2026-10-24
7
+ affects: [11-terminal.md, package.json#bin, CLI documentation, ADR-0009]
8
+ ---
9
+
10
+ # PROP-0023: Rename the published CLI command to xagent
11
+
12
+ ## Problem
13
+
14
+ The package currently publishes `xharness` as its only executable, and invoking it without a
15
+ subcommand starts the Harness-owned OpenTUI terminal. The requested launch command is `xagent`.
16
+ The command name is a public CLI contract, so replacing it must update the package bin mapping,
17
+ help text, command examples, smoke checks, and the terminal specification.
18
+
19
+ ## Affected rules
20
+
21
+ - Page 11 names `xharness` as the published executable and standalone terminal command.
22
+ - `package.json#bin`, the package lock, CLI usage, and command-specific help publish and document
23
+ `xharness`.
24
+ - ADR-0009 records `xharness` as the sole published executable.
25
+
26
+ ## Proposal
27
+
28
+ Publish `xagent` as the sole executable mapped to `dist/cli.js`. Invoking `xagent` without a
29
+ subcommand starts the existing OpenTUI terminal; `terminal` remains an explicit alias and the
30
+ existing subcommands remain available. Do not keep `xharness` as a compatibility alias. Keep the
31
+ npm package name, terminal runtime, data/state directory names, and environment-variable names
32
+ unchanged. Update command examples and regression/smoke checks to use `xagent`.
33
+
34
+ ## Alternatives
35
+
36
+ - Keep `xharness` as an alias. This avoids disruption but does not replace the requested launch
37
+ command.
38
+ - Rename the npm package. This is unrelated to the executable name.
39
+ - Do nothing. This leaves the requested command unavailable.
40
+
41
+ ## Consequences
42
+
43
+ - Scripts and shell aliases using `xharness` must change to `xagent`.
44
+ - The rename is a breaking CLI change. It is included before publication of the 4.0.0 candidate;
45
+ if `xharness` has already been released, the rename requires a new major release.
46
+ - No account, data, state, or server-protocol migration is required.
47
+
48
+ ## Migration
49
+
50
+ Install `@xingular/harness` and launch the terminal with `xagent`. Update invocations of the former
51
+ `xharness` command. Existing `~/.xingular-harness/{data,state}` contents are reused unchanged.
52
+
53
+ ## Checks
54
+
55
+ - `npm run typecheck` passed.
56
+ - `npm test` passed: 137 test files, 1,036 tests passed, 3 skipped; the focused CLI test also passed (2 tests).
57
+ - `npm run prove` passed, including the standalone server lifecycle.
58
+ - `node dist/cli.js --help` printed usage beginning with `xagent`.
59
+ - `npm pack --dry-run` passed and included the CLI, TUI bundle, and updated decision records.
60
+
61
+ The lasting decision is recorded in [ADR-0024](../../decisions/ADR-0024-xagent-command.md).
@@ -0,0 +1,130 @@
1
+ ---
2
+ id: PROP-0024
3
+ title: Add bounded ASCII sketch previews to question choices
4
+ status: Implemented
5
+ created: 2026-10-24
6
+ updated: 2026-10-24
7
+ affects: [INV-RUN-3, INV-PAR-1, INV-PAR-2, 02-sessions-and-runs.md, 10-server-protocol.md, 11-terminal.md, 14-surfaces-and-parity.md, docs/parity.md, App/shared/contracts.ts, App/src/modes/chat/QuestionBatchForm.tsx, App/docs/features/FEAT-0013-plan-mode.md, App/docs/architecture/implementation-stage.md, ADR-0025]
8
+ ---
9
+
10
+ # PROP-0024: Add bounded ASCII sketch previews to question choices
11
+
12
+ **Accepted by the product owner on 2026-10-24; implementation and verification completed in the working tree.**
13
+
14
+ ## Problem
15
+
16
+ Question choices currently carry labels, descriptions and recommendation state. The validated
17
+ `question.requested` run event persists those fields, but neither the Harness question contract nor
18
+ the App's mirrored contract can carry a choice-specific visual sketch. As a result, an agent cannot
19
+ show a small text diagram to clarify a choice, and neither question surface can preview one while a
20
+ person compares choices.
21
+
22
+ This changes the persisted run-event payload contract. It must be accepted before changing code or
23
+ the architecture specification.
24
+
25
+ ## Affected rules
26
+
27
+ - **INV-RUN-3:** “Every run event is validated against its schema, redacted, persisted, and only then
28
+ relayed to listeners, in order. An event that arrives after the run settled is kept as evidence and
29
+ never applied or relayed.” This proposal adds validated optional metadata to
30
+ `question.requested`; it does not change event ordering or persistence.
31
+ - **INV-PAR-1:** “Every capability a person can use in a host is a Harness capability: a foundation
32
+ service, a world part or a first-party plugin, reachable through server methods. The standalone
33
+ terminal surfaces it. A host is a presentation of it.” Sketch metadata and the terminal preview
34
+ are Harness-owned; the App presents the same question data.
35
+ - **INV-PAR-2:** “A capability is complete only when its terminal surface and its host surface both
36
+ pass acceptance. It lands in the Harness first, together with its terminal surface; the host
37
+ surface follows.” Both question surfaces must render and test the same metadata.
38
+
39
+ ## Proposal
40
+
41
+ 1. Extend each question input with optional `uiSketch?: true`. This question-level flag enables
42
+ sketch mode; it applies to that question only, including questions in an `ask_user` batch.
43
+ 2. Extend each choice with optional `sketch?: string`. When `uiSketch: true`, every choice must
44
+ contain a valid sketch. When the flag is absent, choices must not contain sketches. Reject an
45
+ invalid combination before emitting a question event; do not silently omit or truncate data.
46
+ 3. Bound each sketch to 1–8 lines and at most 32 printable ASCII characters per line. Lines are
47
+ separated by LF. Only bytes `0x20`–`0x7e` and LF are allowed; tabs, CR, terminal controls,
48
+ escape sequences and Unicode are rejected. The sketch must contain at least one non-space
49
+ printable character. Interior blank lines and trailing spaces are allowed and preserved exactly.
50
+ The maximum encoded length is 263 bytes (eight 32-character lines plus seven LF separators).
51
+ 4. Add the fields to both Harness question-tool schemas (`ask_user` and terminal
52
+ `ask_user_question`) and their runtime validation. Add them to the `question.requested` payload
53
+ schema and preserve them through `RunRegistry` into the persisted event. `question.answered` and
54
+ `QuestionAnswer` stay unchanged: sketch metadata is never part of an answer.
55
+ 5. The terminal question dock renders choice labels and descriptions in wrapping columns. It places
56
+ one shared, monospace sketch canvas below the choice list, displaying the hovered choice's sketch
57
+ or, with no hovered choice, the keyboard-focused choice's sketch. It does not create one canvas
58
+ per choice. Sketch content is rendered as literal text, without Markdown or ANSI interpretation.
59
+ 6. The App mirrors the payload schema and preview behavior in `QuestionBatchForm`. Its choice
60
+ label/description columns wrap at narrow widths, and its shared preview is literal monospace
61
+ text. Update plan-mode acceptance to cover sketch-enabled questions and record the implementation
62
+ in the App's implementation-stage log. Update Harness architecture/terminal docs and
63
+ `docs/parity.md` when implementing.
64
+ 7. On acceptance, add ADR-0025 to record the stable question-event and sketch-bounds contract.
65
+
66
+ The optional flag is intentionally a positive literal, not a free-form renderer configuration.
67
+ Sketches do not introduce an image/attachment type, a host-only surface or a new answer format.
68
+
69
+ ## Alternatives
70
+
71
+ - **Accept optional sketches without a mode flag.** This leaves it unclear whether sketches are
72
+ expected, permits partially illustrated questions, and makes the preview's presence ambiguous.
73
+ - **Allow Markdown, Unicode diagrams, ANSI or unbounded text.** Rendering differs across terminal
74
+ and host, escape/control content creates risk, and unbounded content can overwhelm a question
75
+ surface.
76
+ - **Use image attachments or a rich-output event.** This adds a separate content/storage/rendering
77
+ contract for a small, readable diagram and cannot provide the same text fallback in the terminal.
78
+ - **Do nothing.** Keeps the existing event stable but does not let questions explain choices with
79
+ compact diagrams.
80
+
81
+ ## Consequences
82
+
83
+ - New `question.requested` events may carry `uiSketch: true` and per-choice `sketch` strings. The
84
+ event remains backward-compatible: both fields are optional, and old events continue to parse.
85
+ - The App's shared contract must accept the same bounded fields as Harness. A stale host that does
86
+ not understand the optional metadata can still read the other question fields, but cannot show
87
+ the preview; parity requires updating the App before marking the feature complete.
88
+ - The question surface gains a bounded preview with no answer semantics. Recommendation ordering,
89
+ selection, free text, notes, submission and cancellation remain unchanged.
90
+ - There is no run-record layout change or migration. Sketches are stored only in the existing
91
+ `question.requested` event payload, subject to the existing event redaction and persistence path.
92
+ - Existing question-tool and event callers that omit `uiSketch` behave as before. Calls that enable
93
+ it must provide a valid sketch for every choice.
94
+
95
+ ## Migration
96
+
97
+ No migration is needed. New readers accept old question events because the new payload fields are
98
+ optional; new writers validate the flag/choice relationship and bounds. Answer payloads are
99
+ unchanged. The Harness implementation and terminal surface must land first; then the App schema and
100
+ form are updated in a separate App repository change. No live-model request is required for
101
+ verification.
102
+
103
+ ## Checks
104
+
105
+ After acceptance, verify schema bounds and flag/choice consistency, preservation of literal sketch
106
+ text through both tool paths and persisted events, compatibility with old events, unchanged answer
107
+ payloads, and terminal/App hover/focus preview behavior. Run the focused Harness and App question
108
+ tests, including the isolated question-form browser fixture. Also run:
109
+
110
+ - Harness: `npm run typecheck`, `npm test`, `npm run build`, `npm run prove`,
111
+ `python3 scripts/verify-terminal.py --questions-only` at 40×20, 80×24 and 120×40, and a terminal
112
+ input-latency profile.
113
+ - App: `npm run typecheck`, `npm test`, `npm run check:layers`, `npm run check:ui`,
114
+ `cd src-tauri && cargo test`, and the isolated question-form browser fixture.
115
+
116
+ ## Implementation evidence
117
+
118
+ - Harness: `npm run typecheck`, all 1,041 tests (3 skipped), `npm run build` and `npm run prove`
119
+ passed. The isolated `--questions-only` PTY check passed at 40×20, 80×24 and 120×40 with
120
+ `pyte`; the 40-column run checks compact sketch navigation and answers, while wider runs also
121
+ check wrapped notes and free-text.
122
+ - Input latency profile (160×45, four rounds, loopback provider, no live requests): idle p50/p95/p99/max
123
+ 4.83/9.69/10.02/10.14 ms; history 4.72/9.79/10.41/10.60 ms; streaming 8.36/19.53/21.67/26.00 ms.
124
+ No keystrokes were missed.
125
+ - App: `npm run typecheck`, `npm test` (566 renderer, 49 sidecar and 7 development-signing passed;
126
+ one signing test skipped), `npm run check:layers`, `npm run check:ui` and Rust tests (168 passed,
127
+ 1 ignored) passed. The isolated question-form browser fixture passed all 5 tests using the installed
128
+ system Chrome executable.
129
+ - The first App test run, executed concurrently with other checks, exceeded an existing run-event
130
+ performance threshold; the full suite passed when rerun alone. No live-model request was made.
@@ -0,0 +1,49 @@
1
+ ---
2
+ id: PROP-0025
3
+ title: Strict question columns and contextual ASCII wireframes
4
+ status: Implemented
5
+ created: 2026-10-24
6
+ updated: 2026-10-24
7
+ affects: [INV-RUN-3, INV-PAR-1, INV-PAR-2, 02-sessions-and-runs.md, 11-terminal.md, 14-surfaces-and-parity.md]
8
+ ---
9
+
10
+ # PROP-0025: Strict question columns and contextual ASCII wireframes
11
+
12
+ The owner accepted the design with “Implement the plan: Fix TUI question columns and sketch previews”. This is foundation work. Implemented and verified in the working tree; see [ADR-0026](../../decisions/ADR-0026-contextual-question-wireframes.md) and [retained evidence](../../evidence/terminal-question-wireframes/README.md).
13
+
14
+ ## Problem
15
+
16
+ Choice rows independently distribute width based on their content, so label and description boundaries differ. Sketches are limited to 32 columns by eight lines and presented beneath a redundant caption and left rule. These limits cannot represent a contextual UI panel like the owner's reference.
17
+
18
+ ## Affected rules
19
+
20
+ - INV-RUN-3 validates every persisted question event. Its sketch bounds change from 32×8 to 80×24.
21
+ - INV-PAR-1/2 require the same capability and accepted metadata on terminal and host surfaces.
22
+ - Page 11's wrapping columns become strictly aligned columns at compact widths too.
23
+
24
+ ## Proposal
25
+
26
+ Use one measured layout for every choice: marker gutter, one-third label cell, two-cell gap, remaining description cell. Preserve cells even without a description; never stack them on compact terminals. Text wraps within its cell.
27
+
28
+ Support up to 24 LF-separated lines of 80 printable ASCII characters each (1,943 bytes maximum), preserving whitespace and rejecting controls, Unicode and empty diagrams. Tool guidance requests contextual UI wireframes with actual panel/table structure and neighboring elements, consistent across alternatives.
29
+
30
+ Render one border-only ASCII preview without a visible caption. Preserve literal content with bounded two-axis scrolling. Keep tabs and answer/action controls outside the dock body's vertical scrolling region. PageUp/PageDown and Ctrl+Home/End scroll that body; Shift+arrows pan the sketch, leaving ordinary arrows for question/choice navigation. Focused choices and notes are brought into view. No answer semantics change.
31
+
32
+ ## Alternatives
33
+
34
+ - Keep the old bounds: cannot show the reference's contextual layout.
35
+ - Only change flex ratios: leaves per-row content-dependent boundaries.
36
+ - Reflow or truncate diagrams: destroys structure or hides content permanently.
37
+ - Rich images or structured scene graphs: unnecessary new storage/rendering contracts.
38
+
39
+ ## Consequences
40
+
41
+ Both question tools, event validation and host contracts use the larger bounds. Existing clients with old limits must update before accepting larger new events. Existing event and answer formats, gate, prompt compilation and storage ownership remain unchanged. Generation quality is guidance, not a schema guarantee.
42
+
43
+ ## Migration
44
+
45
+ No data rewrite. Old diagrams and events remain valid. Keep host contract compatibility in a separate repository change. Rollback of readers requires avoiding newly generated diagrams above the old bounds.
46
+
47
+ ## Checks
48
+
49
+ Geometry and schema boundary tests, literal persistence and unchanged answers; isolated production PTY checks at 40×20, 60×24, 80×24 and 120×40 including resizing, scrolling and keyboard focus; Harness typecheck/test/build/prove and latency profile; App typecheck/test/layer/UI/Rust checks and isolated question-form fixture. No live requests or personal profiles.
@@ -0,0 +1,94 @@
1
+ ---
2
+ id: PROP-0026
3
+ title: Connect structural sketch lines in the terminal display
4
+ status: Implemented
5
+ created: 2026-10-24
6
+ updated: 2026-10-24
7
+ affects: [INV-PAR-1, INV-PAR-2, 11-terminal.md, 14-surfaces-and-parity.md, terminal-tui.md]
8
+ ---
9
+
10
+ # PROP-0026: Connect structural sketch lines in the terminal display
11
+
12
+ The owner approved this foundation presentation change with “yes, fix it” after inspecting a
13
+ screenshot of disconnected sketch lines. Implementation and rendered-topology verification passed
14
+ in isolated production fixtures; see [retained evidence](../../evidence/terminal-connected-sketches/README.md) and
15
+ [ADR-0027](../../decisions/ADR-0027-connected-sketch-display.md).
16
+
17
+ ## Problem
18
+
19
+ The terminal preview's ASCII `+|-` table frame appears gapped, and bare horizontal divider rows
20
+ stop short of the surrounding preview frame. The absolute literal-render promise in PROP-0025
21
+ prevents a display-only correction even though the stored sketch and answer semantics need not
22
+ change. Historical PROP-0025 evidence establishes only the earlier presentation.
23
+
24
+ ## Affected rules
25
+
26
+ - Page 11: “Sketches support up to 80 columns by 24 lines (page 02) and remain literal: no wrapping,
27
+ reflow, truncation or markup interpretation.” Its absolute literal display requirement is amended
28
+ by the bounded structural projection below; raw persistence remains literal.
29
+ - Page 14: “The terminal and each host render the same literal text as one shared preview,
30
+ preserving whitespace and providing access to overflow; neither surface changes the answer
31
+ payload.” The same validated source and content remain required; identical structural glyphs
32
+ are not required across surfaces.
33
+ - INV-PAR-1/2 still require the same capability and acceptance on both surfaces. Terminal-only
34
+ typography introduces no new capability or host contract. Page 02's validated ASCII bounds and
35
+ literal persisted request event, and INV-RUN-3's validation requirement, are unchanged.
36
+
37
+ ## Proposal
38
+
39
+ In `src/terminal/opentui/sketchPanel.ts`, project validated ASCII into display text only:
40
+
41
+ - Recognize ASCII table-border rows and enclosed vertical table edges, rendering their structural
42
+ `+`, `-` and `|` cells as connected box-drawing glyphs. Keep internal framed tables at their
43
+ original widths and positions; do not stretch them to the viewport.
44
+ - Expand bare standalone hyphen divider rows to `max(panel viewport width, original sketch widest
45
+ line)`. Join these dividers to the outer single-line preview frame with `├` and `┤`; use the
46
+ existing bounded two-axis viewport when the projected canvas overflows.
47
+ - Recognition is structural, not a global substitution. Preserve prose, content, arithmetic
48
+ operators and ordinary pipes literally. Unrecognized rows remain literal. Apart from recognized
49
+ border cells and standalone-divider expansion, preserve whitespace, blank lines and geometry.
50
+ - Do not wrap, reflow, truncate or interpret Markdown/ANSI. All content remains reachable through
51
+ panning. Hover/focus preview behavior, navigation and staged answers remain unchanged.
52
+
53
+ Raw sketches remain exactly the validated 80-column × 24-line maximum ASCII source (1,943 bytes
54
+ maximum), including trailing spaces and blank lines, in request events and history. Display glyphs
55
+ and expanded dividers never enter persistence or answer payloads. A host may retain a literal ASCII
56
+ preview of that same source; terminal-only typography is permitted, not a host-only capability.
57
+
58
+ ## Alternatives
59
+
60
+ - Do nothing: retains the screenshot's disconnected frame and short dividers.
61
+ - Globally replace `+|-`: corrupts content, operators and pipes without structural context.
62
+ - Stretch every table: destroys internal layout and relative geometry.
63
+ - Rewrite stored sketches as Unicode or introduce structured graphics: unnecessary schema,
64
+ generation and migration changes for a display problem.
65
+
66
+ ## Consequences
67
+
68
+ The terminal's absolute literal-render promise becomes a bounded structural display projection.
69
+ There is no wire/schema, tool, validation-bound, server, storage or answer change. Hosts need no
70
+ implementation change and may keep literal previews. This is foundation rendering work, not variant
71
+ data. Historical proposals, decisions and evidence remain records of the behavior they verified.
72
+
73
+ ## Migration
74
+
75
+ No data migration. Existing ASCII sketches use the same display projection when shown; rollback
76
+ only restores literal terminal rendering. Implementation is terminal-only; host schemas and presentation
77
+ need no change.
78
+
79
+ ## Checks
80
+
81
+ The checks below passed in the implementing working tree; see the linked evidence for commands,
82
+ counts, screen captures, bundle digests and limits. This is fixture verification, not a claim of
83
+ owner visual acceptance or live-model diagram quality:
84
+
85
+ - Connected table corners/tees/edges, with internal framed tables retaining original widths.
86
+ - Standalone dividers fill the larger of viewport width and original widest line and join the
87
+ outer frame; test narrow/wide viewports, resizing and two-axis panning.
88
+ - Prose, arithmetic operators, ordinary pipes, unrecognized structures, whitespace and blank lines
89
+ remain unchanged outside the explicit projection; persisted ASCII and answers are byte-for-byte
90
+ unchanged, including 80×24 boundary fixtures.
91
+ - Isolated production PTY screenshots and interaction checks for the new rendering, independent of
92
+ the retained PROP-0025 evidence. Confirm the host's literal preview remains contract-compatible.
93
+ - The implementing change runs Harness typecheck/tests and the applicable terminal checks, plus
94
+ embedding App checks required by AGENTS.md. No live-provider request is authorized here.
@@ -0,0 +1,60 @@
1
+ ---
2
+ id: PROP-0027
3
+ title: Use Xingular Agent as the default Harness product identity
4
+ status: Accepted
5
+ created: 2026-10-24
6
+ updated: 2026-10-24
7
+ affects: [INV-BND-2, 00-overview.md, 04-prompt.md, 11-terminal.md, terminal-tui.md, ADR-0028]
8
+ ---
9
+
10
+ # PROP-0027: Use Xingular Agent as the default Harness product identity
11
+
12
+ The product owner accepted this proposal on 2026-10-24. The decision is recorded in
13
+ [ADR-0028](../../decisions/ADR-0028-xingular-agent-product-identity.md).
14
+
15
+ ## Problem
16
+
17
+ The empty welcome in `src/terminal/opentui/root.tsx` derives its block mark and spaced subline from `XINGULAR_HARNESS_NAME`, which `Terminals.prepare()` sets from `env.productName`. When no product name is supplied, `src/core/env.ts` defaults to `Xingular Harness`, so the current welcome shows a large `XINGULAR` mark and `H A R N E S S` subline. The requested identity is an orange `X` mark followed by a blue `A G E N T` label, with a welcoming message and restrained `/help` hint.
18
+
19
+ `Xingular Agent` is the product name; the requested screen remains the Harness-owned terminal. However, changing the default name changes person- and model-visible Harness text beyond this screen, and the specification forbids naming an application. This required an explicit architecture decision, which the product owner accepted as PROP-0027.
20
+
21
+ ## Affected rules
22
+
23
+ `INV-BND-2` currently says: “The harness names no application and no application concept (agent role, group, task, pane, handoff, App browser workspace, computer use) in code paths it reads or text a model or person sees. Text names the product through `env.productName` (default `Xingular Harness`; `{product}` in a tool description).”
24
+
25
+ The rule's default product identity and its prohibition on application naming are affected. The terminal's existing ownership and composition contracts in `11-terminal.md` are not otherwise changed.
26
+
27
+ ## Proposal
28
+
29
+ Make `Xingular Agent` the default `env.productName`, while retaining explicit `productName` values supplied by embedding hosts. Amend `INV-BND-2` to allow this exact canonical product identity as the default; continue to forbid application concepts, app-specific branching and other application names in Harness behavior.
30
+
31
+ For the welcome, format a multiword product name as a block mark made from the first letter of its first word, followed by the remaining word or words letter-spaced. Thus the default `Xingular Agent` appears as an orange `X` and blue `A G E N T`. A single-word product name keeps its full word as the mark and has no subline. Keep the greeting and tagline neutral, color the `/help` hint blue, and preserve the existing model/thinking information and composer. Use the existing `theme.primary` orange and `theme.accent` blue; do not add tokens or change other terminal surfaces.
32
+
33
+ The default product name is used by Harness outside the TUI, including compiled prompt and Wiki text. This proposal intentionally changes those defaults too; embedding hosts that need another identity continue to pass their own `productName`.
34
+
35
+ ## Alternatives
36
+
37
+ - **Keep `Xingular Harness` as the default and rely on `productName` overrides.** This preserves `INV-BND-2` and avoids changing prompt/Wiki text, but does not make the requested product identity the built-in default.
38
+ - **Change only the TUI welcome label.** This would show `Xingular Agent` while other Harness text still calls the product `Xingular Harness`, and would bypass the existing `env.productName` boundary.
39
+ - **Do nothing.** Retains the current `XINGULAR` / `H A R N E S S` welcome.
40
+
41
+ ## Consequences
42
+
43
+ - Hosts that omit `productName` will use `Xingular Agent` in Harness-authored product text, not only in the terminal welcome. Hosts with an explicit name are unaffected.
44
+ - The terminal remains Harness-owned and generic in behavior. No application-specific branches, capabilities, storage or protocol fields are added.
45
+ - Existing session/run records and Wiki data are not rewritten. New compiled contexts and new Wiki text use the new default; prior records retain the name with which they were created.
46
+ - No server or terminal wire schema changes.
47
+
48
+ ## Migration
49
+
50
+ No data migration is required. Embedding hosts that need to retain the former default can pass `productName: 'Xingular Harness'`; hosts with another product identity continue to pass that name explicitly. Reverting the default affects only newly created contexts and text, not persisted records.
51
+
52
+ ## Checks
53
+
54
+ Verification:
55
+
56
+ - Test `createEnv()`'s new default and that an explicit `productName` still wins.
57
+ - Add a focused PTY welcome check for the `A G E N T` label and orange/blue ANSI colors at 40x20, 80x24 and 120x40; verify `/help` replaces the welcome.
58
+ - Run Harness `npm run typecheck`, `npm test`, `npm run prove`, `npm run build`, and the focused terminal verification.
59
+ - Run Xingular Agent's `npm run typecheck`, `npm test`, `npm run check:layers`, and `cd src-tauri && cargo test`.
60
+ - Update the affected architecture and terminal-detail pages, and record the accepted lasting choice in an ADR.
@@ -0,0 +1,55 @@
1
+ ---
2
+ id: PROP-0028
3
+ title: Normalize high-confidence question wireframe borders in the terminal preview
4
+ status: Implemented
5
+ created: 2026-10-24
6
+ updated: 2026-10-24
7
+ affects: [INV-PAR-1, INV-PAR-2, 11-terminal.md, 14-surfaces-and-parity.md, terminal-tui.md, parity.md, ADR-0027]
8
+ ---
9
+
10
+ # PROP-0028: Normalize high-confidence question wireframe borders in the terminal preview
11
+
12
+ **Accepted and implemented on 2026-10-24** through “Implement the plan: Repair question wireframe borders.” The terminal-only display projection is amended; the persisted question contract and answers do not change. Verification is retained in [evidence](../../evidence/terminal-wireframe-normalization/README.md).
13
+
14
+ ## Problem
15
+
16
+ The terminal currently projects horizontal rules only when a row contains decoration characters alone, so a title embedded between a frame's `+` corners remains ASCII. It recognizes vertical edges only when a row already contains both `|` delimiters. A missing or shifted side edge can therefore leave a visibly open or misaligned frame. Existing fixtures cover regular tables and dividers, not these screenshot-shaped cases.
17
+
18
+ ## Affected rules
19
+
20
+ - Page 11 currently limits projection to recognized border characters and says whitespace and geometry are preserved except for structural glyph conversion and standalone-divider expansion. A high-confidence frame may now need a boundary glyph inserted or moved within whitespace to restore its declared rectangle.
21
+ - Page 14 currently promises preservation of whitespace and geometry in the shared sketch source. The validated source remains unchanged and hosts may remain literal; the terminal preview gains this narrowly bounded projection exception.
22
+ - The existing 80×24 ASCII source bounds, literal request-event persistence, answer payload, schema, server protocol and host contract are unchanged.
23
+
24
+ ## Proposal
25
+
26
+ Keep the ASCII sketch as the wire and persistence format. In `src/terminal/opentui/sketchPanel.ts`, use a bounded cell-grid/topology pass to:
27
+
28
+ - Recognize explicit ASCII frame rows with `+` corners and horizontal `-` runs, including a frame title surrounded by horizontal runs.
29
+ - Establish a panel's left and right boundary columns from matched frame rules. Project only high-confidence panels; nested frames retain their own extents.
30
+ - Within a matched frame, normalize a displaced `|` only when the path to its established boundary is whitespace, and synthesize a missing boundary glyph only into a whitespace cell. Preserve all interior text. If a row conflicts with content or the frame is ambiguous, leave it literal rather than guessing.
31
+ - Resolve corners, tees, crossings and edges from neighboring structural cells. This is not a global `+|-` conversion: prose, arithmetic, ordinary content pipes, Markdown-like text and unmatched rows remain literal.
32
+ - Keep the existing bounded two-axis viewport, panning, standalone-divider behavior and source bounds. Projected or inferred glyphs never enter events, history or answers.
33
+
34
+ Strengthen both `ask_user` and terminal `ask_user_question` generation guidance to require stable left/right columns and matching border positions across rows and alternatives. Guidance is not validation; existing and externally supplied bounded ASCII sketches still receive the same safe display treatment.
35
+
36
+ ## Alternatives
37
+
38
+ - **Prompt guidance only:** lowers the chance of new malformed sketches but cannot repair existing or externally supplied sketches.
39
+ - **Global symbol substitution:** can corrupt prose, pipes and operators.
40
+ - **Structured wireframe schema:** could make all geometry deterministic, but requires a wider protocol, persistence and host migration for a display-only correction.
41
+ - **Do nothing:** retains disconnected title rules and incomplete edges.
42
+
43
+ ## Consequences
44
+
45
+ Only the terminal's display projection changes. A recognized frame may occupy previously blank boundary cells or move a boundary character across whitespace, while its interior text stays fixed. Stored sketches remain byte-for-byte ASCII, answer semantics remain unchanged, and hosts may continue to show the literal source. Unrecognized or ambiguous diagrams are not repaired automatically.
46
+
47
+ ## Migration
48
+
49
+ No data, schema, protocol or host migration. Existing question records use the new projection when displayed. Rolling back the terminal restores the prior literal behavior without affecting stored data.
50
+
51
+ ## Checks
52
+
53
+ - Unit fixtures for title-bearing top rules, missing and whitespace-shifted edges, nested frames, ordinary pipes/prose, blank lines and unchanged source text.
54
+ - Production PTY question fixtures at 40×20, 60×24, 80×24 and 120×40: connected cell topology, resize/pan behavior, and unchanged answers and persisted sketches.
55
+ - Harness typecheck, full tests and build; App typecheck, tests, layer/UI checks and Rust tests. No live-provider requests are needed.
@@ -0,0 +1,124 @@
1
+ ---
2
+ id: PROP-0029
3
+ title: Agent profiles that subagents start from
4
+ status: Accepted; implemented
5
+ created: 2026-10-24
6
+ updated: 2026-10-24
7
+ affects: [INV-RUN-2, INV-VAR-4, INV-CAP-1, INV-STO-3, INV-SRV-1, 02-sessions-and-runs.md, 03-variants.md, 04-prompt.md, 06-plugins-and-capabilities.md, 10-server-protocol.md, 11-terminal.md, 12-storage.md, 14-surfaces-and-parity.md, parity, ADR-0030]
8
+ ---
9
+
10
+ # PROP-0029: Agent profiles that subagents start from
11
+
12
+ ## Problem
13
+
14
+ A subagent is either a copy of its parent or one of the parent variant's c5 definitions
15
+ (`sub_agents/<name>/AGENT.md`). A c5 definition carries instructions only: the child cannot have
16
+ its own tools, plugins, variant, model or effort (`subagentService.ts`, `spawn`). Nothing exists
17
+ outside a variant, so a person cannot keep a "worker" or an "explorer" of their own, and a
18
+ terminal session without a variant cannot name any subagent at all: the terminal never passed its
19
+ variant to `Subagents.register`, so `agent:` always failed with "There is no subagent named …".
20
+ The subagent roster could not say which kind of agent a child is.
21
+
22
+ ## Affected rules
23
+
24
+ - INV-RUN-2: "A child run's set is the intersection of its parent's and what it asked for; it
25
+ never widens."
26
+ - INV-VAR-4: "A run resolves its variant once and pins it; a child run or later turn uses the same
27
+ files even if the head moves."
28
+ - INV-CAP-1: "A capability set only narrows."
29
+ - INV-STO-3: "A new top-level folder or a new file in `runs/<id>/` is an architecture change."
30
+ - INV-SRV-1: the method table (a new `agents` group).
31
+ - 02 Subagents contract: "`agent` names one of the parent harness's subagents (c5)".
32
+
33
+ ## Proposal
34
+
35
+ **A profile** is a Markdown file with frontmatter. The body is the role instructions.
36
+
37
+ | Field | Meaning | Omitted |
38
+ |---|---|---|
39
+ | `name` | `^[a-z0-9][a-z0-9_-]*$`, equal to the file name | the file name |
40
+ | `description` | one line, shown to the model and in `/agents` | required |
41
+ | `color` | `blue green yellow red magenta cyan orange purple` | `blue` |
42
+ | `tools` | tool allowlist | every tool the parent has |
43
+ | `plugins` | plugin ids whose contributions the child keeps; required plugins always stay | all |
44
+ | `variant` | `<scope>`, `<scope>@<version>` or `none` | the parent's pinned variant |
45
+ | `model`, `effort` | the child's model and effort, on the parent's account | the parent's |
46
+
47
+ **Sources**, later ones winning by name:
48
+ 1. Built-ins in code (`agents/builtin.ts`): `worker` and `explorer`.
49
+ 2. `<data root>/agents/<name>.md` (global).
50
+ 3. `<project root>/.xingular/agents/<name>.md`, where the project root is the nearest folder above
51
+ the session's working folder that holds `.git`, or the working folder itself.
52
+
53
+ The parent variant's c5 definitions fill names nobody else took, as instruction-only profiles
54
+ (source `variant`), so existing variants keep working. An unreadable file is reported in
55
+ `problems` and hides nothing.
56
+
57
+ **Spawning.** `spawn_subagent { agent }` and `subagents.spawn { agent }` resolve a profile
58
+ (`agents/profiles.ts::resolveProfile`).
59
+ - Tools: the child's tools are the parent ceiling ∩ the profile's `tools` ∩ the call's `tools`.
60
+ Profile tools the parent lacks are dropped and returned as `unavailableTools`.
61
+ - Plugins: the child's contributions are the parent's whose plugin is in `plugins` or required,
62
+ and a tool whose owning plugin was dropped goes with it (`agents/narrow.ts`).
63
+ - Gated tools stay the parent's gated tools ∩ the child's, so a worker's edits still ask.
64
+ - Variant: a profile with `variant: <scope>[@version]` makes the child resolve and pin that variant
65
+ when it starts. `none` and c5 definitions start the child with no variant; otherwise the child
66
+ keeps the parent's pinned folder.
67
+ - The profile body becomes the child's `subagent` section, "Your role: <name>" (order 22).
68
+ - `RunRecord.profile` records the profile name on the child; it is absent for a copy.
69
+ - The spawn result adds `agent` and, when non-empty, `unavailableTools`.
70
+
71
+ **Prompt.** When a run may spawn, the compiler receives one `subagents` section (order 64) that
72
+ lists every profile with its description (`profileSection`). It replaces the variant's own c5
73
+ list, which it includes.
74
+
75
+ **Methods.** A new `agents` group: `agents.list { cwd? }` → `{ profiles, problems }`,
76
+ `agents.get { cwd?, name }`, `agents.create { cwd?, name, scope: global | project, from? }`
77
+ (the template, or a copy of `from`; never overwrites), `agents.remove { cwd?, name, scope }` (own
78
+ files only). The harness is the only writer of profile files. The terminal reaches the same
79
+ functions through `terminal.agents.list|create|remove`.
80
+
81
+ **Terminal.** `/agents` opens the Agents page: built-in, global, project and variant profiles,
82
+ unreadable files, and details. Enter on a row offers edit (opens `$VISUAL`/`$EDITOR`), copy and
83
+ delete for a person's own profile, and copy for a built-in. The subagent roster sits under the
84
+ status line after one blank line, without a heading; each row is the status mark, the profile
85
+ name in its colour (`subagent` for a copy), the child's session name (or its brief), and
86
+ `n of m tasks` from the child's own checklist. The terminal passes its pinned variant to
87
+ `Subagents.register`, so c5 names work there too.
88
+
89
+ ## Alternatives
90
+
91
+ - **Profiles as variant data (c5 only).** Refinement could change them, but a person would need a
92
+ variant to have a worker at all, and a variant cannot carry a model or plugin choice per child.
93
+ - **Store in `config/`.** One JSON file per data root is harder to edit by hand, cannot live in a
94
+ repository, and would make `config/` a second enablement store (INV-PLG-6).
95
+ - **A shared task pool that subagents claim.** Considered with this change and rejected: it needs
96
+ item ids, owners, locking and a new store, and is the delegated work queue the product keeps out
97
+ of scope. Each run keeps its own checklist (PROP-0006); the roster shows each child's progress.
98
+ - **Do nothing.** Subagents stay copies, and the terminal cannot name any.
99
+
100
+ ## Consequences
101
+
102
+ - Hosts see one optional `profile` field on run records, two optional fields on the spawn result,
103
+ and a new `agents` method group.
104
+ - A profile can only narrow: a child never gains a tool, connector or contribution its parent
105
+ lacks (INV-RUN-2 and INV-CAP-1 hold unchanged). Choosing another variant or model is not a
106
+ capability and stays within the parent's account.
107
+ - A project profile comes from the repository, like `AGENTS.md`: its instructions are as trusted
108
+ as the repository, and it cannot widen access.
109
+ - The prompt's subagent list now changes when a profile file changes, at the next run; a run that
110
+ already started keeps its prompt.
111
+ - INV-VAR-4 reads: a child run uses the parent's pinned files unless its profile names another
112
+ variant, which the child then resolves and pins itself.
113
+
114
+ ## Migration
115
+
116
+ None. Existing c5 definitions appear as profiles of source `variant`. Removing the feature means
117
+ deleting `src/agents/` and the `agents/` folders; run records keep an unused field.
118
+
119
+ ## Checks
120
+
121
+ `src/agents/profiles.test.ts`, `src/sessions/subagentService.test.ts` (profiles narrow, pin a
122
+ variant, record the name), `src/server/server.test.ts` (`agents.*`), the terminal roster, monitor
123
+ and Agents page tests, `npm run prove`, the App's checks, and a loopback PTY run that spawns an
124
+ explorer, a worker and a copy and reads the roster under the status line.