@awebai/oats 0.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (112) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +380 -0
  3. package/bin/oats.mjs +3294 -0
  4. package/capabilities/oats-authoring/oats.json +12 -0
  5. package/capabilities/oats-aweb/bin/oats-aweb.mjs +297 -0
  6. package/capabilities/oats-aweb/injects/aweb.md +55 -0
  7. package/capabilities/oats-aweb/oats.json +47 -0
  8. package/capabilities/oats-aweb/package.json +20 -0
  9. package/capabilities/oats-jira/bin/oats-jira.mjs +40 -0
  10. package/capabilities/oats-jira/injects/jira.md +10 -0
  11. package/capabilities/oats-jira/oats.json +22 -0
  12. package/capabilities/oats-jira/package.json +25 -0
  13. package/capabilities/oats-jira/skills/jira-tasks/SKILL.md +176 -0
  14. package/capabilities/oats-linear/README.md +234 -0
  15. package/capabilities/oats-linear/bin/oats-linear-hook.mjs +32 -0
  16. package/capabilities/oats-linear/bin/oats-linear.mjs +344 -0
  17. package/capabilities/oats-linear/injects/linear.md +8 -0
  18. package/capabilities/oats-linear/oats.json +24 -0
  19. package/capabilities/oats-linear/package.json +29 -0
  20. package/capabilities/oats-linear/skills/linear-tasks/SKILL.md +217 -0
  21. package/capabilities/oats-linear/test/oats-linear.test.mjs +168 -0
  22. package/capabilities/oats-okf/agents/memory-harvest.md +25 -0
  23. package/capabilities/oats-okf/bin/oats-okf.mjs +283 -0
  24. package/capabilities/oats-okf/injects/okf.md +62 -0
  25. package/capabilities/oats-okf/oats.json +20 -0
  26. package/capabilities/oats-okf/package.json +22 -0
  27. package/capabilities/oats-okf/skills/memory-harvest/SKILL.md +100 -0
  28. package/capabilities/oats-okf/skills/okf/SKILL.md +107 -0
  29. package/capabilities/oats-okf/skills/okf/scripts/okf-validate.mjs +123 -0
  30. package/capabilities/oats-review/agents/reviewer/AGENTS.md +53 -0
  31. package/capabilities/oats-review/agents/reviewer/soul.yaml +6 -0
  32. package/capabilities/oats-review/injects/review.md +68 -0
  33. package/capabilities/oats-review/oats.json +10 -0
  34. package/capabilities/oats-review/skills/code-review/SKILL.md +44 -0
  35. package/capabilities/oats-review/skills/security-review/SKILL.md +59 -0
  36. package/docs/capabilities.md +505 -0
  37. package/docs/capability-manifest.schema.json +223 -0
  38. package/docs/configuration.md +482 -0
  39. package/docs/conventions.md +73 -0
  40. package/docs/design/desktop-ux-plan.md +362 -0
  41. package/docs/design/package-engine-contract.md +813 -0
  42. package/docs/design/package-runtime-api.md +414 -0
  43. package/docs/desktop-cli-api.md +89 -0
  44. package/docs/desktop-succession.md +51 -0
  45. package/docs/desktop.md +187 -0
  46. package/docs/implementation.md +282 -0
  47. package/docs/integrations.md +123 -0
  48. package/docs/knowledge-theory.md +97 -0
  49. package/docs/knowledge.md +139 -0
  50. package/docs/layers.md +110 -0
  51. package/docs/migration-from-oas.md +122 -0
  52. package/docs/oats-config.schema.json +140 -0
  53. package/docs/oats-lock.schema.json +175 -0
  54. package/docs/oats-package.schema.json +129 -0
  55. package/docs/packages.md +442 -0
  56. package/docs/release-lane.md +132 -0
  57. package/docs/release-notes/v0.18.2.md +79 -0
  58. package/docs/release-notes/v0.18.3.md +63 -0
  59. package/docs/release-notes/v0.18.4.md +65 -0
  60. package/docs/release-notes/v0.18.5.md +66 -0
  61. package/docs/release-notes/v0.18.6.md +87 -0
  62. package/docs/release-notes/v0.19.0.md +186 -0
  63. package/docs/release-notes/v0.19.1.md +24 -0
  64. package/docs/release-notes/v0.19.2.md +32 -0
  65. package/docs/release-notes/v0.19.3.md +16 -0
  66. package/docs/release-notes/v0.19.4.md +12 -0
  67. package/docs/release-notes/v0.20.0.md +89 -0
  68. package/docs/release-notes/v0.22.0.md +180 -0
  69. package/docs/souls-and-instances.md +344 -0
  70. package/injects/framework-workspace.md +7 -0
  71. package/injects/instance-boundary.md +43 -0
  72. package/injects/local-soul.md +19 -0
  73. package/injects/oats.md +11 -0
  74. package/injects/work-attached.md +16 -0
  75. package/injects/work-checkout.md +12 -0
  76. package/injects/work-workspace.md +22 -0
  77. package/injects/work-worktree.md +13 -0
  78. package/lib/core.mjs +6792 -0
  79. package/lib/packages.mjs +1375 -0
  80. package/lib/tmux-config.mjs +35 -0
  81. package/package-catalog.json +44 -0
  82. package/package.json +55 -0
  83. package/packages/record/README.md +151 -0
  84. package/packages/record/bin/capture.mjs +256 -0
  85. package/packages/record/bin/recall.mjs +102 -0
  86. package/packages/record/bin/setup.mjs +281 -0
  87. package/packages/record/bin/turn-record.mjs +47 -0
  88. package/packages/record/docs/turn-record-sot.md +350 -0
  89. package/packages/record/lib/canonical.mjs +151 -0
  90. package/packages/record/lib/capture-aw.mjs +179 -0
  91. package/packages/record/lib/capture-cc.mjs +322 -0
  92. package/packages/record/lib/formats.mjs +296 -0
  93. package/packages/record/lib/ignore.mjs +155 -0
  94. package/packages/record/lib/index-db.mjs +524 -0
  95. package/packages/record/lib/project-aweb.mjs +251 -0
  96. package/packages/record/lib/segments.mjs +186 -0
  97. package/packages/record/lib/store.mjs +447 -0
  98. package/packages/record/lib/tags.mjs +114 -0
  99. package/packages/record/package.json +45 -0
  100. package/packages/record/test/vectors/README.md +34 -0
  101. package/packages/record/test/vectors/aweb-projection-v1.json +231 -0
  102. package/packages/record/test/vectors/journal-merge-v1.json +261 -0
  103. package/packages/record/test/vectors/turn-id-v1.json +152 -0
  104. package/packages/record/test/vectors/validate.mjs +391 -0
  105. package/skills/integration-authoring/SKILL.md +76 -0
  106. package/skills/oats/SKILL.md +151 -0
  107. package/skills/oats-config/SKILL.md +162 -0
  108. package/skills/oats-getting-started/SKILL.md +159 -0
  109. package/skills/oats-packages/SKILL.md +180 -0
  110. package/skills/oats-support/SKILL.md +79 -0
  111. package/skills/skill-craft/SKILL.md +109 -0
  112. package/skills/soul-craft/SKILL.md +109 -0
@@ -0,0 +1,362 @@
1
+ # OATS Desktop — UX plan (phase 1)
2
+
3
+ Author: ux-designer-desktop-ux · Branch: `ux-designer/desktop-app`
4
+ Scope: design language + UX for `packages/desktop/` (Electron shell,
5
+ xterm.js terminal, brain viewer, markdown viewer, diff viewer, panel port).
6
+ This is a **decision document**: each section states the chosen option and why.
7
+ It is written against the binding contract in
8
+ `briefs/desktop-app-CONTRACT.md` (view modules `mount(el, ctx)` / `unmount()`;
9
+ data from the oats-web HTTP API; tmux-attach terminals).
10
+
11
+ ---
12
+
13
+ ## 1. Design research — what we take from VS Code and opencode
14
+
15
+ ### VS Code shell anatomy (what applies)
16
+
17
+ VS Code's shell is: **activity bar → sidebar → editor group (tabs) → panel →
18
+ status bar**, all keyboard-addressable through a **command palette**, all
19
+ colored through **semantic theme tokens** (`editor.background`,
20
+ `sideBar.foreground`, …) rather than raw hex in components.
21
+
22
+ Principles we adopt:
23
+
24
+ 1. **One persistent shell, swappable content.** Chrome (sidebar, tabs, status
25
+ bar) never remounts; only the active view does. This maps 1:1 onto the
26
+ `mount(el, ctx)` contract — the shell owns chrome, views own their `el`.
27
+ 2. **Semantic color tokens.** Components reference roles (`--surface`,
28
+ `--accent`, `--term-bg`), never palette values. Themes are token maps.
29
+ The existing panel (`capabilities/oats-web/ui/panel.html`) already does
30
+ this correctly — we extend its token set, we don't replace it (§4).
31
+ 3. **Command palette as the universal escape hatch.** Every action reachable
32
+ by mouse is reachable by `⌘K` (see §5). This is the cheapest way to be
33
+ keyboard-first without designing a shortcut for everything.
34
+ 4. **Tabs are documents; the sidebar is the world.** Tabs hold *open work*
35
+ (a terminal, a diff, a markdown file); the sidebar holds *everything that
36
+ exists* (the roster). Closing a tab never destroys the underlying thing —
37
+ which matches the contract exactly (detach pty, never kill tmux).
38
+ 5. **Status bar for ambient truth**: connection to the oats-web server,
39
+ active workspace, running-instance count, theme toggle.
40
+
41
+ What we deliberately **do not** clone:
42
+
43
+ - **No activity bar.** VS Code's activity bar exists because it has many
44
+ coequal top-level domains (explorer, SCM, debug, extensions). OATS desktop
45
+ has *one* primary domain — agents — so a vertical icon rail would be
46
+ ceremony. The sidebar gets a small segmented header instead
47
+ (Agents | Hierarchy) — two modes, not five domains.
48
+ - **No multi-root editor-group splitting (phase 2).** The panel's proven
49
+ ≤3-pane terminal split is enough initially; generalized grid splitting is
50
+ a later enhancement, not a launch requirement.
51
+
52
+ ### opencode (what applies)
53
+
54
+ opencode is a TUI-first agent client: session list on the left, one live
55
+ session dominating the screen, minimal chrome, everything driven by keys and
56
+ a fuzzy switcher. Principles we adopt:
57
+
58
+ 1. **The session is the hero.** When you open an instance, its live terminal
59
+ fills the stage immediately — no dashboard detour, no click-through.
60
+ 2. **Fast session switching** (fuzzy, recency-ordered) matters more than
61
+ deep navigation trees. Our palette's default mode is "jump to instance".
62
+ 3. **State is legible at a glance**: running/idle/busy is shown as a colored
63
+ dot next to every session name, everywhere the name appears (roster,
64
+ tabs, hierarchy graph, palette). One vocabulary of status dots (§5).
65
+ 4. **Terminal fidelity over widgetry.** Don't wrap the agent session in
66
+ chat-bubble reconstructions; show the real terminal. The contract's
67
+ direct tmux-attach already commits us to this — the UX embraces it.
68
+
69
+ ---
70
+
71
+ ## 2. Information architecture — agents at the heart
72
+
73
+ **Decision: the primary object is the agent *instance*.** Files, diffs,
74
+ terminals and brains are *facets of an instance*, not siblings of it. The IA
75
+ is instance-centric, not file-centric — this is the single biggest departure
76
+ from VS Code, and the reason the app exists.
77
+
78
+ ### Shell layout
79
+
80
+ ```
81
+ ┌──────────────────────────────────────────────────────────────┐
82
+ │ titlebar: ● oats [workspace ▾] filter/⌘K ◐ theme │
83
+ ├───────────────┬──────────────────────────────────────────────┤
84
+ │ SIDEBAR │ TAB STRIP [dev-1 ⬤][dev-1: diff][README.md] │
85
+ │ ┌───────────┐ ├──────────────────────────────────────────────┤
86
+ │ │Agents|Tree│ │ │
87
+ │ └───────────┘ │ ACTIVE VIEW │
88
+ │ roster: │ (terminal / brain / markdown / diff / │
89
+ │ ws → repo → │ hierarchy / home) │
90
+ │ instances │ │
91
+ │ (children │ │
92
+ │ indented) │ │
93
+ │ ── souls ── │ │
94
+ │ spawnable │ │
95
+ ├───────────────┴──────────────────────────────────────────────┤
96
+ │ status bar: ⬤ server · ws:oats · 4 running · branch · theme │
97
+ └──────────────────────────────────────────────────────────────┘
98
+ ```
99
+
100
+ - **Sidebar (left, collapsible ⌘B)** — the roster, ported from the panel:
101
+ workspace → repo → instances, with spawn-children indented under parents
102
+ (the panel's `parentInstance` walk is kept verbatim). Below it, spawnable
103
+ souls with a Spawn action. A segmented control at the top switches the
104
+ sidebar between **Agents** (list) and **Hierarchy** (mini-tree; the full
105
+ graph opens as a view, §3).
106
+ - **Tab strip** — open facets. Tab title = `instance` (terminal),
107
+ `instance: diff`, `instance: brain`, or file name (markdown). Terminal
108
+ tabs carry the status dot. Middle-click / `⌘W` closes (detach only).
109
+ - **Status bar** — server reachability, workspace, running count. Clicking
110
+ the server segment reveals host/port; clicking the count filters to
111
+ running.
112
+
113
+ ### The home surface
114
+
115
+ **Decision: home = the hierarchy view with an overview header**, not an
116
+ empty state and not a dashboard of widgets. On launch (no tabs open) the
117
+ stage shows the agent hierarchy graph (§3) topped by a one-line summary
118
+ ("*oats workspace — 4 running, 2 idle, 1 retired today*") and a spawn button.
119
+ Rationale: it makes the app's thesis — *you are orchestrating a team* —
120
+ visible in the first second, and every node is one click from its terminal.
121
+
122
+ ### Per-instance facet model
123
+
124
+ Selecting an instance (sidebar click, palette, or graph node) opens its
125
+ **terminal tab** — the hero facet. From the terminal tab's header (and the
126
+ context menu / palette) the sibling facets are one action away:
127
+
128
+ | Facet | Source | Opens as |
129
+ |----------|-------------------------------|-----------------------|
130
+ | Terminal | tmux attach via pty IPC | tab (default) |
131
+ | Brain | `GET /api/brain/<agent>` | tab `instance: brain` |
132
+ | Diff | `GET /api/diff/<instance>` | tab `instance: diff` |
133
+ | Files | `GET /api/file?path=…` | tab per file (markdown viewer) |
134
+
135
+ Cross-facet links use the contract's `ctx` verbs: brain view lists skills /
136
+ knowledge / STATE.md → `ctx.openFile(path)`; any view can
137
+ `ctx.openTerminal(instance)`. The hierarchy view is itself a view module and
138
+ uses the same two verbs — no new contract surface needed.
139
+
140
+ **Decision: tabs are per-facet, not per-instance-with-inner-tabs.** Inner
141
+ tab bars (an instance tab containing terminal/brain/diff sub-tabs) were
142
+ considered and rejected: they double the chrome, break `⌘W`/`⌘1..9`
143
+ uniformity, and fight the `mount(el, ctx)` contract, which is flat. Facet
144
+ association is expressed by tab naming + grouping tabs of the same instance
145
+ adjacently.
146
+
147
+ ---
148
+
149
+ ## 3. Agent hierarchy visualization
150
+
151
+ **Decision: an interactive tree-of-trees (layered DAG), not a force-directed
152
+ graph.** Spawn parentage (`parentInstance` in the roster) is a forest —
153
+ force layouts add jitter and non-determinism for zero benefit on tree data.
154
+ Layout: **top-down tidy tree per workspace** (d3-hierarchy-style tidy layout;
155
+ implementable in ~150 lines without a dependency, or with `d3-hierarchy`
156
+ since desktop deps are allowed), workspaces side by side, SVG-rendered,
157
+ pan/zoom.
158
+
159
+ ### Two relationship kinds, two visual languages
160
+
161
+ 1. **Spawn parentage** (who spawned whom): solid edges, the tree structure
162
+ itself. Source: roster `parentInstance`.
163
+ 2. **Coordination** (who works with whom): dashed accent edges *overlaid*
164
+ on the tree, shown on hover/selection (always-on is noisy). Source:
165
+ shared workspace/repo membership + aweb team metadata as exposed by
166
+ `/api/panel`; degrade gracefully if absent — the view must not depend on
167
+ a new endpoint (if richer comms data is wanted later, that is a phase-2
168
+ request to the coordinator, not an assumption).
169
+
170
+ ### Node design
171
+
172
+ A compact card, not a bare circle — names and states must be readable
173
+ without hover:
174
+
175
+ ```
176
+ ┌──────────────────────────┐
177
+ │ ⬤ webpanel-dev-brain │ ⬤ status dot (see states)
178
+ │ webpanel-dev · repo:oats │ agent · repo, muted
179
+ └──────────────────────────┘
180
+ ```
181
+
182
+ - **States** (same vocabulary app-wide): **running** = green dot +
183
+ full-opacity card; **idle** = hollow/gray dot, card at ~65% opacity
184
+ (matching the panel's `.inst.idle`); **retired** = dashed border,
185
+ faint text, only shown when the "show retired" toggle is on (retired
186
+ instances known from roster history if available; otherwise omitted).
187
+ - **Busy pulse** (phase-2 nice-to-have): subtle dot pulse when the session
188
+ produced output in the last N seconds — cheap liveness signal.
189
+
190
+ ### Interactions
191
+
192
+ - **Click node → focus + detail popover** (task line, branch, dirty chip,
193
+ buttons: *Open terminal · Brain · Diff*). **Double-click / Enter → open
194
+ terminal tab** directly.
195
+ - **Hover → highlight lineage** (ancestors + descendants) and show
196
+ coordination edges for that node.
197
+ - Pan (drag), zoom (pinch/`⌘±`), `f` to fit. Keyboard: arrows walk the tree,
198
+ Enter opens.
199
+ - Search-as-you-type filters/highlights nodes (reuses the sidebar filter
200
+ semantics).
201
+
202
+ The hierarchy is both a **full view** (home surface / `⌘⇧H`) and a
203
+ **sidebar mini-mode** (same data, vertical indented tree — effectively the
204
+ roster's existing child-indentation, promoted).
205
+
206
+ ---
207
+
208
+ ## 4. Theming
209
+
210
+ **Decision: extend the panel's existing token system — it is already
211
+ semantic, already dual-theme, already AA-audited.** The panel's `:root` /
212
+ `[data-theme]` token blocks become `packages/desktop/renderer/theme.css`,
213
+ the single source of truth. Views consume tokens only; a view containing a
214
+ hex literal fails review.
215
+
216
+ ### Token architecture
217
+
218
+ Three tiers, one file:
219
+
220
+ 1. **Core surface/text/interactive tokens** (exist today): `--bg`,
221
+ `--surface`, `--surface-2`, `--border`, `--fg`, `--muted`, `--faint`,
222
+ `--accent`, `--accent-fg`, `--ok`, `--warn`, `--danger`, `--chip-*`,
223
+ `--sel`, `--shadow`.
224
+ 2. **Terminal tokens**: `--term-bg`, `--term-fg`, `--term-sel` (exist) plus
225
+ a **16-slot ANSI set** `--ansi-black … --ansi-bright-white` (new —
226
+ xterm.js takes a theme object; we generate it from these tokens so the
227
+ embedded terminal matches the app theme, including the solarized remap
228
+ the panel already ships for light mode).
229
+ 3. **New component tokens** (thin aliases over tier 1, so themes rarely
230
+ need to override them): `--tab-active-bg`, `--tab-inactive-fg`,
231
+ `--statusbar-bg`, `--graph-edge`, `--graph-edge-coord`,
232
+ `--diff-add-bg`, `--diff-del-bg`, `--md-code-bg`.
233
+
234
+ ### Themes
235
+
236
+ - **Dark** (default when OS is dark): the panel's GitHub-dark-adjacent
237
+ palette, unchanged.
238
+ - **Light**: the panel's **solarized-light** palette, unchanged —
239
+ compatibility with the web panel is a requirement and the palette already
240
+ passes AA (`--fg` 9.9:1, `--muted` 4.9:1 on surface).
241
+ - Theme = OS-follow by default, manual override persisted
242
+ (`localStorage`, same keys as the panel: `oatsweb.theme`) so panel and
243
+ desktop feel like one product. Room for future themes = adding one
244
+ `[data-theme="x"]` block; no component changes.
245
+
246
+ ### Accessibility commitments (both themes, verified in phase 2)
247
+
248
+ - Body & secondary text ≥ 4.5:1 on their actual surfaces; UI glyphs/borders
249
+ ≥ 3:1; status conveyed by **dot shape + label**, never color alone
250
+ (idle = hollow dot, retired = dashed border — already specified in §3).
251
+ - Visible `:focus-visible` ring (`--accent`, 2px) on every interactive
252
+ element; full keyboard reachability (tabs, sidebar, graph, palette).
253
+ - Diff colors get text labels (`+`/`−` gutters) in addition to
254
+ `--diff-add/del-bg`; ANSI light remap keeps terminal output ≥ 4.5:1 as
255
+ the panel already does.
256
+ - `prefers-reduced-motion`: disable graph pan-inertia, dot pulse, spinner
257
+ fades.
258
+
259
+ ---
260
+
261
+ ## 5. Component inventory + interaction details
262
+
263
+ **Type & space.** UI font: system stack (as panel). Mono:
264
+ `"SF Mono", ui-monospace, Menlo` (as panel). Type scale (px):
265
+ 11 (chips/status) · 12 (secondary) · 13 (body/controls) · 14 (view titles) —
266
+ matching the panel's proven density. Spacing scale: **4-px base**
267
+ (4/8/12/16/24/32); radii: 6 (small controls) / 8 (cards, inputs) / 999
268
+ (chips). Shadows: `--shadow` only.
269
+
270
+ **Components** (shell-owned unless noted):
271
+
272
+ - **Tabs**: 32px strip; active tab `--tab-active-bg` + 2px top accent
273
+ (mirrors the panel's focused-pane inset accent); dirty/status dot on
274
+ terminal tabs; overflow scrolls; drag-reorder phase-2. `⌘1..9` jump,
275
+ `⌘W` close, `⌃Tab` MRU cycle.
276
+ - **Sidebar**: as panel roster (filter input, collapsible groups, chips for
277
+ branch/dirty/runtime) + segmented Agents/Hierarchy header. `⌘B` toggle.
278
+ - **Command palette** (`⌘K`): single input, mode prefixes —
279
+ default = jump to instance (fuzzy, MRU-boosted); `>` commands
280
+ (spawn, toggle theme, open diff/brain of current instance, fit graph);
281
+ `#` open file within current instance's home. Esc closes; results show
282
+ status dots and repo chips.
283
+ - **Toasts**: bottom-right, `--surface` card + colored left border
284
+ (`--ok/--warn/--danger`), auto-dismiss 5s (errors sticky with a Close
285
+ button), max 3 stacked, `aria-live="polite"`. Used for: spawn result,
286
+ server lost/regained, pty exit.
287
+ - **Loading states**: reuse panel's `.spinner` + `.loading-block`; skeleton
288
+ rows (pulse animation) for roster and brain tree; terminals show
289
+ "attaching to `<session>` …" with spinner until first pty bytes.
290
+ - **Empty states**: reuse panel's `.empty` pattern (big glyph, one sentence,
291
+ one action). E.g. diff view with clean tree: "No changes on
292
+ `<branch>` — the work tree is clean."
293
+ - **Dialogs**: only for destructive/parameterized actions (spawn with task
294
+ text). Everything else is inline or palette.
295
+ - **Markdown viewer** (view module): panel typography, `--md-code-bg` code
296
+ blocks with syntax highlight, heading anchor links, relative links to
297
+ files resolved through `ctx.openFile`.
298
+ - **Diff viewer** (view module): file list (status/+/− counts) left or top,
299
+ unified diff with `--diff-*` tokens, per-file collapse, staged toggle.
300
+ - **Brain viewer** (view module): two columns — soul (AGENTS.md, skills,
301
+ knowledge tree) and instances (state/task/notes) — every leaf is an
302
+ `openFile` link; skills show their descriptions inline.
303
+
304
+ **Keyboard-first rules**: `⌘K` palette · `⌘B` sidebar · `⌘T` spawn ·
305
+ `⌘⇧H` hierarchy · `⌘W`/`⌘1..9`/`⌃Tab` tabs · `⌘F` filter. **Ctrl-B is never
306
+ bound** — it is the tmux prefix and always flows to the focused terminal
307
+ (the panel already enforces this rule; we keep it as law).
308
+
309
+ ---
310
+
311
+ ## 6. Phase-2 implementation plan (incremental, contract-compatible)
312
+
313
+ Each step lands independently on the integrated app; none changes the view
314
+ contract or the API contract. Order chosen so every step is visible value.
315
+
316
+ 1. **Token foundation** — extract/extend `renderer/theme.css` (tiers 1–3,
317
+ ANSI variables), wire `data-theme` + OS-follow + persistence; generate
318
+ the xterm.js theme object from tokens; contrast-check both themes
319
+ (automated check script if feasible).
320
+ 2. **Shell chrome polish** — tab strip (status dots, accents, keyboard
321
+ map), status bar, sidebar restyle to spec (segmented header, chips,
322
+ focus rings), toasts, loading/empty components as shared renderer
323
+ helpers views can import.
324
+ 3. **Command palette** — jump/command/file modes as above; registered
325
+ commands provided by the shell; instance jump from roster data.
326
+ 4. **Hierarchy view** — new view module `views/hierarchy.js` using only
327
+ roster data + `ctx.openTerminal`/`ctx.openFile`; tidy-tree layout,
328
+ node cards, states, lineage highlight, popover, keyboard nav; wire as
329
+ home surface and `⌘⇧H`.
330
+ 5. **View polish pass** — apply tokens/typography/empty-loading patterns to
331
+ the four developer-built views (terminal header, brain, markdown, diff),
332
+ coordinating any needed hooks through dev-coordinator-1.
333
+ 6. **Accessibility + reduced-motion audit** — keyboard walk of every
334
+ surface, focus-visible sweep, contrast verification, `prefers-reduced-
335
+ motion` guards; fix list executed before calling phase 2 done.
336
+
337
+ ### Addendum — human directives (received via coordinator before phase-2
338
+ go-ahead; to be re-confirmed in the go-ahead mail)
339
+
340
+ Binding design directives that supersede anything conflicting above:
341
+
342
+ 1. **Diff viewer surface removed** — no nav entry, no diff tabs. `/api/diff`
343
+ and `diff.mjs` stay in the tree, dormant; removing dead UI wiring is in my
344
+ scope. (Step 5 no longer polishes a diff view; `--diff-*` tokens remain
345
+ defined for a possible return.)
346
+ 2. **Markdown reader is the flagship viewer** — `openFile → markdown` gets
347
+ the depth budget: typography, highlighting, anchors, relative-link
348
+ resolution via `ctx.openFile`, strong loading/empty states.
349
+ 3. **Jira surface hidden entirely** — no nav entry or inline cards; code
350
+ stays unwired. Verify no remnants during the polish pass.
351
+ 4. **Three first-class surfaces**: (a) hierarchy view = home + primary
352
+ navigation (extra investment beyond step 4); (b) a proper **souls
353
+ browser** stage view (descriptions + spawn affordances, palette-reachable)
354
+ — promoted from the sidebar-list sketch in §2; (c) a nice way into agent
355
+ brains.
356
+ 5. Everything else (themes, tokens, palette, a11y) stands as written.
357
+
358
+ Dependencies/risks flagged to the coordinator up front: (a) step 5 touches
359
+ other developers' view code — I will work on the *integrated* branch only,
360
+ after their merges; (b) coordination-edge data for §3 uses whatever
361
+ `/api/panel` already exposes — if we want explicit aweb-team edges, that is
362
+ a small additive API request, not a blocker.