From a2da1196a38cbb9600c2237e832b43d54d2814dc Mon Sep 17 00:00:00 2001 From: Sam Catlow Date: Fri, 25 Sep 2026 11:00:31 +1000 Subject: [PATCH] docs(design): add UI redesign handoff bundle Add a self-contained design handoff under docs/design/ui-redesign/ (README, build prompt, HTML mockups, design-canvas sources, CSS and JSON theme tokens). docs/design/ is held back from the published docs sets like docs/inspiration/: it is input to building the UI, not a page to read. Remove the superseded service-decomposition research from docs/inspiration/. --- docs/design/ui-redesign/CLAUDE_PROMPT.md | 34 + docs/design/ui-redesign/README.md | 277 ++++++ .../mockups/P0-navigation-map.html | 95 ++ .../ui-redesign/mockups/P1-dashboard.html | 187 ++++ .../ui-redesign/mockups/P2-task-detail.html | 127 +++ .../ui-redesign/mockups/P3-workflows.html | 152 +++ .../mockups/P4-new-task-dialog.html | 77 ++ .../design/ui-redesign/mockups/P5-events.html | 102 ++ .../S1-settings-sidebar-setting-rows.html | 176 ++++ .../mockups/S2-settings-personas.html | 154 ++++ .../mockups/S3-settings-tools-mcp.html | 144 +++ .../mockups/S4-settings-review-drawer.html | 124 +++ .../mockups/S5-settings-channels.html | 155 ++++ .../mockups/T-theme-components.html | 138 +++ .../source/P0-navigation-map.dc.html | 103 +++ .../ui-redesign/source/P1-dashboard.dc.html | 172 ++++ .../ui-redesign/source/P2-task-detail.dc.html | 138 +++ .../ui-redesign/source/P3-workflows.dc.html | 142 +++ .../source/P4-new-task-dialog.dc.html | 83 ++ .../ui-redesign/source/P5-events.dc.html | 108 +++ .../S1-settings-sidebar-setting-rows.dc.html | 167 ++++ .../source/S2-settings-personas.dc.html | 146 +++ .../source/S3-settings-tools-mcp.dc.html | 155 ++++ .../source/S4-settings-review-drawer.dc.html | 123 +++ .../source/S5-settings-channels.dc.html | 165 ++++ .../source/T-theme-components.dc.html | 120 +++ docs/design/ui-redesign/tokens/tokens.css | 84 ++ docs/design/ui-redesign/tokens/tokens.json | 45 + ...ce-decomposition-and-ansible-task-model.md | 149 --- ...e-reference-awx-decomposition-vs-archie.md | 127 --- ...tion-open-questions-research-2026-09-05.md | 868 ------------------ .../service-discovery-research-2026-09-05.md | 291 ------ tools/docsite/main.go | 4 +- 33 files changed, 3696 insertions(+), 1436 deletions(-) create mode 100644 docs/design/ui-redesign/CLAUDE_PROMPT.md create mode 100644 docs/design/ui-redesign/README.md create mode 100644 docs/design/ui-redesign/mockups/P0-navigation-map.html create mode 100644 docs/design/ui-redesign/mockups/P1-dashboard.html create mode 100644 docs/design/ui-redesign/mockups/P2-task-detail.html create mode 100644 docs/design/ui-redesign/mockups/P3-workflows.html create mode 100644 docs/design/ui-redesign/mockups/P4-new-task-dialog.html create mode 100644 docs/design/ui-redesign/mockups/P5-events.html create mode 100644 docs/design/ui-redesign/mockups/S1-settings-sidebar-setting-rows.html create mode 100644 docs/design/ui-redesign/mockups/S2-settings-personas.html create mode 100644 docs/design/ui-redesign/mockups/S3-settings-tools-mcp.html create mode 100644 docs/design/ui-redesign/mockups/S4-settings-review-drawer.html create mode 100644 docs/design/ui-redesign/mockups/S5-settings-channels.html create mode 100644 docs/design/ui-redesign/mockups/T-theme-components.html create mode 100644 docs/design/ui-redesign/source/P0-navigation-map.dc.html create mode 100644 docs/design/ui-redesign/source/P1-dashboard.dc.html create mode 100644 docs/design/ui-redesign/source/P2-task-detail.dc.html create mode 100644 docs/design/ui-redesign/source/P3-workflows.dc.html create mode 100644 docs/design/ui-redesign/source/P4-new-task-dialog.dc.html create mode 100644 docs/design/ui-redesign/source/P5-events.dc.html create mode 100644 docs/design/ui-redesign/source/S1-settings-sidebar-setting-rows.dc.html create mode 100644 docs/design/ui-redesign/source/S2-settings-personas.dc.html create mode 100644 docs/design/ui-redesign/source/S3-settings-tools-mcp.dc.html create mode 100644 docs/design/ui-redesign/source/S4-settings-review-drawer.dc.html create mode 100644 docs/design/ui-redesign/source/S5-settings-channels.dc.html create mode 100644 docs/design/ui-redesign/source/T-theme-components.dc.html create mode 100644 docs/design/ui-redesign/tokens/tokens.css create mode 100644 docs/design/ui-redesign/tokens/tokens.json delete mode 100644 docs/inspiration/2026-09-05-awx-service-decomposition-and-ansible-task-model.md delete mode 100644 docs/inspiration/module-reference-awx-decomposition-vs-archie.md delete mode 100644 docs/inspiration/service-decomposition-open-questions-research-2026-09-05.md delete mode 100644 docs/inspiration/service-discovery-research-2026-09-05.md diff --git a/docs/design/ui-redesign/CLAUDE_PROMPT.md b/docs/design/ui-redesign/CLAUDE_PROMPT.md new file mode 100644 index 000000000..cc2c30db4 --- /dev/null +++ b/docs/design/ui-redesign/CLAUDE_PROMPT.md @@ -0,0 +1,34 @@ +# Prompt for Claude Code + +Unzip this bundle into the repo at `docs/design/ui-redesign/`, then paste the prompt below. + +--- + +The design handoff for the Archie UI redesign is in `docs/design/ui-redesign/`. It covers a new theme, a new +top-level navigation, the Settings pages (Channels moves in there), and the Dashboard, Task detail, Workflows, +New task dialog and Events pages. + +Read `README.md` in full, then look at every PNG in `screenshots/`. The `00-current-*.png` files show how the +pages look today; `P0-navigation-map.png` shows what moves where. The static HTML in `mockups/` has the exact +CSS if you need it. `tokens/tokens.css` holds the colours, fonts and sizes. + +Treat the spec as a hypothesis to check against the code, not a spec to copy exactly. + +Before changing anything: +1. Find how the UI is built: framework, router, component library, where styles and theme colours live, + and where the purple comes from. +2. Map today's routes and the Work / System menus to the proposed navigation in README §2. List every + page that isn't covered and where you'd put it. +3. For Settings and Channels: find how each section loads and saves config, how "Restart required", + "Version", "History" and the audit log work, and where "Connecting" comes from. Map every field in + README §5 to its real config key and type. +4. Answer the backend questions in README §5.2 and §9. +5. Check what data the Dashboard, Task detail and Workflows pages already get, and list anything the + mockups show that isn't available. + +Then write a short migration plan using the PR sequence in README §8. Adjust it to what you found and +list anything the mockups assume that the backend doesn't support. Stop and show me the plan before you +write code. + +When I approve, do PR 1 only (theme tokens across the whole app, no layout changes) on a new branch, with +before/after screenshots of each page. diff --git a/docs/design/ui-redesign/README.md b/docs/design/ui-redesign/README.md new file mode 100644 index 000000000..5c447117b --- /dev/null +++ b/docs/design/ui-redesign/README.md @@ -0,0 +1,277 @@ +# Archie UI Redesign — Handoff + +A redesign of the Archie web UI: + +- a calmer **"Graphite" theme** that replaces the purple +- a **new navigation**: five top-level places, with all configuration moved under Settings +- new layouts for **Settings** (every section, plus Channels moved in), the **Dashboard**, + **Task detail**, **Workflows**, a **New task** dialog and **Events** + +This folder is self-contained. Read this file first, then look at the screenshots. + +``` +README.md ← this spec (read it all before planning) +CLAUDE_PROMPT.md ← the prompt to paste into Claude Code +tokens/tokens.css ← theme as CSS custom properties (source of truth) +tokens/tokens.json ← same values as JSON (for Tailwind / JS themes) +screenshots/ + 00-current-*.png ← how each page looks TODAY + P0-navigation-map ← today → proposed navigation, and what moves where + P1…P5 ← app pages: dashboard, task detail, workflows, new task, events + S1…S5 ← settings: sidebar + rows, personas, tools & MCP, review drawer, channels + T-theme-components ← palette, type, buttons, pills, toggles, inputs +mockups/*.html ← static HTML of each screenshot; open in a browser, inspect for exact CSS +source/*.dc.html ← original design-canvas sources (reference only, needs a runtime that isn't included) +``` + +> **How to treat this.** The mockups are a target, not a pixel spec. They are static HTML +> written by hand; the app's framework, component library, router and data model win. Where the +> mockups assume something the backend doesn't have, flag it rather than faking it. +> Text in `[square brackets]` in a mockup is a placeholder for real data. + +--- + +## 1. Problems being fixed (all pages) + +1. **Purple everywhere.** Purple-tinted backgrounds, borders, buttons, checkboxes, bars and links all compete for attention. +2. **Repeated chrome.** Every settings card has its own "Connecting" pill, "Restart required" pill, "Version 1", + "Save changes" and "History". Workflows and Channels repeat the pattern. +3. **Raw config shapes leak through.** Durations as Go strings (`1h0m0s`, `0s`), bytes as `2000000`, + maps as key/value boxes, secret refs as two separate Engine/Key text fields, booleans as bare checkboxes with no explanation. +4. **No descriptions.** Almost no field says what it does. +5. **Things live in the wrong place.** Channels (configuration) sits under Work; "Start work" sits inside the + workflow editor page; the Channels audit table only covers Channels; workflow analytics mix every workflow together. +6. **The most important information isn't first.** The Dashboard opens with quality gates; the "3 need you" count is a small button. + +## 2. Navigation (screenshot `P0-navigation-map.png`) + +**Top bar (every page):** logo · **Dashboard · Tasks · Workflows · Events · Settings** · spacer · +"Jump to…" search (⌘K) · **New task** button · connection pill · account avatar. +The Work and System dropdowns go away. The floating chat button stays, restyled (neutral fill, accent icon). + +| Place | Job | Contains | +|---|---|---| +| Dashboard | What needs me right now | Needs-you queue, live activity, health (quality gates, tokens) | +| Tasks | The work | Task list (filter by state), task detail | +| Workflows | How work runs | List with runs/success/cost, definition editor, Performance and Runs tabs | +| Events | What comes in | Inspector, Mappings, Bindings | +| Settings | Everything you configure | **Agents:** Personas, Schedules, Scheduling policy · **Integrations:** Channels, Tools & MCP, Plugins · **Runtime:** Container runtime · **History** | + +What moves: + +| What | Moves to | Why | +|---|---|---| +| Start work card (Workflows page) | **New task** dialog from the top bar and ⌘K | Starting work isn't editing a workflow | +| Channels (Work menu) | Settings › Integrations › Channels | It's configuration; gets the shared setting rows and save flow | +| Audit table (Channels page) | Settings › History, filterable by section | One change log for all settings; replaces per-card History links | +| Per workflow table | Columns in the Workflows list | Stats next to the workflow you're about to open | +| Slowest stages · Most failures | Workflow › Performance tab | Scoped to the selected workflow | +| Connecting / Version pills on every card | One connection status in the top bar | Connection is global | +| Settings "Managed elsewhere" row | Removed; those are the Events tabs | They already live there | +| Task "Attempt 2 is not recorded" column | Attempts list in the task side rail | Shows every attempt and its outcome | + +The dropdown contents of today's Work and System menus were inferred from screenshots. **Check the router** and +place any page not covered here using the same rule: configure → Settings, act on → where the work is. + +## 3. Theme + +All values are in `tokens/tokens.css`. Rules that matter more than the hex values: + +- **One accent, used sparingly.** Default sage `#86b5a0`. Only for: active nav/list item (2px inset left bar + raised background), + active tab underline, focus borders/rings, "edited" dots and counts, toggle "on" track, primary button fill, success text, + the "live"/"running"/"connected" dot, and positive bars. Never for backgrounds, headings or borders at rest. +- Keep the accent a **single variable** so it can be swapped (sage / steel `#8aa4c2` / sand `#d4a373` / muted violet `#a397c9`). +- **Neutral, slightly warm greys**, no hue tint on surfaces and no background gradients. Hierarchy comes from surface steps and borders. +- **Amber = needs attention** (parked, awaiting reply, applies after restart, connecting). **Red = failed / destructive / risky** + (errors, delete, unrestricted filesystem). No other hues except the agent state swatches in the tokens. +- **Fonts:** IBM Plex Sans for UI; **IBM Plex Mono for every machine value**: config values, IDs, keys, env var names, + image refs, durations, paths, event names, task numbers, log lines, counts in tables. +- Text contrast: `--text-3` is the dimmest text allowed, and only for hints and captions. + +## 4. Components (screenshot `T-theme-components.png`) + +Build these once and reuse everywhere. Heights are 36px unless noted. + +| Component | Spec | +|---|---| +| **Button** | primary (accent fill, `--text-on-accent`), secondary (`--raised` + `--border-button`), ghost (transparent, `--text-2`), destructive (red text, transparent). 13px/500, radius 6. Small variant 30px/12px. **One primary per view.** | +| **Text input** | `--bg` fill, `--border-input`, radius 6, mono 13px. Focus: accent border + 3px `--accent-ring`. Invalid: red border + 12px red message. | +| **Input with unit** | input + attached suffix (`MB`, `sec`, `chars`) or unit ``, `⌘K + +Connected +A + + +
+
+
+

Good morning

+

Nothing is running. 3 tasks need you.

+
+ +
+ +
+ +
+
Working now
+
0
+
0 waiting to start
+
+ +
+
Needs you
+
3
+
Parked or awaiting a reply
+
+ +
+
Delivered
+
1
+
25% of all tasks
+
+ +
+
Tokens used
+
14.5M
+
Across 1 day
+
+ +
+ +
+
+
+
Needs you3
All tasks
+ +
+Parked +
+changes_captured key-set validation is top-level only +
archie-core #868 · tdd · worktree prepare failed: fetch origin: http transport…
+
+
+
+ +
+Awaiting reply +
+[Task title] +
[repo #issue] · [workflow] · [last agent message]
+
+
+
+ +
+Awaiting reply +
+[Task title] +
[repo #issue] · [workflow] · [last agent message]
+
+
+
+ +
+ +
+
Live activitylive
+
+
+ + + + + + + + + + + + + + + + + + + + + + + +
EventTaskDetailWhen
curator_run—session-memory19 mins ago
task_archive_requested#5archive requested with no recorded actor1 hr ago
task_abandoned#5abandoned with no recorded actor1 hr ago
curator_run×6—session-memory1 hr ago
stage_start×4#51 hr ago
stage_start×5#47 hrs ago
agent_finish#4Problem surface for samcharles93/archie-core issue 836 ("Updater cannot detect o…7 hrs ago
agent_finish#4Root cause7 hrs ago
stage_start×6#48 hrs ago
+
+
+ +
+
+
Quality gates
last 4 runs
+
+
25%pass rate
+ +
+
tdd0 / 3
+
+
+ +
+
triage1 / 1
+
+
+ +
+
+ +
+
Token outlook
+
+
+
Today
14.5M
+
Next 30 days at this rate
≈ 434M
+
+
+
M
T
W
T
F
S
S
+
+
Only 1 day of history. The projection steadies after a week of runs.
+
+
+
+
+
+ + + + + diff --git a/docs/design/ui-redesign/mockups/P2-task-detail.html b/docs/design/ui-redesign/mockups/P2-task-detail.html new file mode 100644 index 000000000..fc36790ba --- /dev/null +++ b/docs/design/ui-redesign/mockups/P2-task-detail.html @@ -0,0 +1,127 @@ + + + + +Task detail + + + + + + +
+ +
+
Archie
+ +
+ + +Connected +A +
+ +
+
+
Tasks / #1
+
+
+

changes_captured key-set validation is top-level only

+ +
+ + +
+
+ +
+ +
+
Parked: couldn’t prepare the worktree
+
fetch origin: http transport: Get "https://github.com/samcharles93/archie-core.git/info/refs?service=git-upload-pack": terminated signal received
+
+ +
+ +
+
+ +
+ + + +
+ +
+
+
+08:38:49 +ERROR +
+
task parked: worktree prepare failed: fetch origin: http transport: Get "https://github.com/samcharles93/archie-core.git/info/refs?service=git-upload-pack": terminated signal received
+
component=daemontask=1
+
+
+
End of attempt 1 · 1 line
+
+
+ + +
+
+
+ + diff --git a/docs/design/ui-redesign/mockups/P3-workflows.html b/docs/design/ui-redesign/mockups/P3-workflows.html new file mode 100644 index 000000000..3b43a781b --- /dev/null +++ b/docs/design/ui-redesign/mockups/P3-workflows.html @@ -0,0 +1,152 @@ + + + + +Workflows + + + + + + +
+ +
+
Archie
+ +
+ + +Connected +A +
+ +
+
+
+

Workflows

+

The step sequences agents follow. Success rate is merged tasks over all runs.

+
+ + +
+ +
+
+
WorkflowRunsSuccessAvg tok
+ + +Bootstrapbootstrap +0 +— +— + + + +Feasibility checkfeasibility +0 +— +— + + + +Implementimplement +0 +— +— + + + +Remediateremediate +0 +— +— + + + +TDDtdd +3 +0 of 3 +4.7M + + + +Triagetriage +1 +1 of 1 +282k + + +
+ +
+
+

Bootstrap

+shipped · edited +
+0 runs yet +
+ +
+
+
+
Steps +
+prepareapplycommit-pushdiff-capopen-pr +
+
+
+
YAML✓ Valid
+
+
1 +2 +3 +4 +5 +6 +7
+
id: bootstrap +steps: + - type: bootstrap.prepare + - type: bootstrap.apply + - type: bootstrap.commit-push + - type: bootstrap.diff-cap + - type: bootstrap.open-pr
+
+
+
+
+Version 1 · History +
+ + + +
+
+
+
+
+ + diff --git a/docs/design/ui-redesign/mockups/P4-new-task-dialog.html b/docs/design/ui-redesign/mockups/P4-new-task-dialog.html new file mode 100644 index 000000000..c8bfddd4f --- /dev/null +++ b/docs/design/ui-redesign/mockups/P4-new-task-dialog.html @@ -0,0 +1,77 @@ + + + + +New task dialog + + + + + + +
+ +
+
Archie
+ +
+ +Connected +
+
Good morning
+ +
+ +
+
+

New task

Goes into Archie’s normal task queue.
+ +
+
+
owner/repository · recent: archie-core
+
Workflow +
+ + + + + + + + + + + + + +
+
+
+
Advanced · run as identity
+
+
+⌘↵ to start +
+ + +
+
+
+ + diff --git a/docs/design/ui-redesign/mockups/P5-events.html b/docs/design/ui-redesign/mockups/P5-events.html new file mode 100644 index 000000000..a128d0df2 --- /dev/null +++ b/docs/design/ui-redesign/mockups/P5-events.html @@ -0,0 +1,102 @@ + + + + +Events + + + + + + +
+ +
+
Archie
+ +
+ + +Connected +A +
+ +
+
+
+

Events

+

Webhooks come in, get mapped to event types, and bindings turn them into work.

+Listening +
+ +
+ +
+ +
+1 +
Capture
Webhooks received
+0 +
+ +
+2 +
Map
Payloads → event types
+0 +
+ +
+3 +
Bind
Event types → work
+0 +
+ +
+ +
+
+
Recent captures
Headers and payloads are redacted before they’re stored.
+
+
+
No captures yet
+
Point a webhook at this endpoint and it shows up here live.
+
+/webhooks/capture/<source> + +
+
+
+ +
+
Event types
Named shapes that mappings produce.
+
+
+
No event types or proposals
+
Paste a sample payload and Archie proposes a type for it. Proposals from real captures appear here too.
+
+
+
+
+
+ + diff --git a/docs/design/ui-redesign/mockups/S1-settings-sidebar-setting-rows.html b/docs/design/ui-redesign/mockups/S1-settings-sidebar-setting-rows.html new file mode 100644 index 000000000..87cd1eaa5 --- /dev/null +++ b/docs/design/ui-redesign/mockups/S1-settings-sidebar-setting-rows.html @@ -0,0 +1,176 @@ + + + + +Settings – sidebar layout + + + + + + +
+ +
+
+ +Archie +
+ +
+
+ +Connecting to archie-core… +
+ +
+ +
+ + +
+
+
+
+

Scheduling policy

+

How Archie picks up work items and labels them as they move through states.

+
+ + +Applies after restart +
+ +

Dispatch

+
+
Trigger
What causes a work item to be dispatched to an agent.
+
+
+ + +
+
Dispatches when Archie is assigned. Choose Label to set a trigger label instead.
+
+
+
+
Reaction posted when a work item is picked up.
+
+
+ +

State labels

+
+
Labels by state
Label applied to the ticket as the agent moves between states.
+
+
StateLabel
+ +
+queued + + +
+ +
+working + + +
+ +
+waiting + + +
+ +
+pr + + +
+ +
+parked + + +
+ +
+dead + + +
+ + +
+
+ +

Retries & polling

+
+
Attempts before an item is labelled dead.
+
+ + + +
+
+
+
How often the tracker is checked for new work.
+
+
+ + +
+was 1m0s +
+
+
+
+
+ +
+ +1 unsaved change +· Poll interval +
+ + +
+
+ + diff --git a/docs/design/ui-redesign/mockups/S2-settings-personas.html b/docs/design/ui-redesign/mockups/S2-settings-personas.html new file mode 100644 index 000000000..8a3c44edc --- /dev/null +++ b/docs/design/ui-redesign/mockups/S2-settings-personas.html @@ -0,0 +1,154 @@ + + + + +Settings – personas + + + + + + +
+ +
+
+ +Archie +
+ +
+
+ +Connected · v1 +
+
+ +
+
System / Advanced
+

Advanced settings

+ +
+ +
+
+
+ + +
+
+ + +archie +default + +You are Archie, a capable coding and project assistant. Be direct without being brusque… + + + +helpful + + +You are a helpful, friendly AI assistant. + + + +concise + + +You are a concise assistant. Keep responses brief and to the point. + + + +technical + + +You are a technical expert. Provide detailed, accurate technical information. + + + +creative + + +You are a creative assistant. Think outside the box and offer innovative solutions. + + + +teacher + + +You are a patient teacher. Explain concepts clearly with examples. + + +
+
Personas are system prompts an agent can adopt. The default is used when a work item doesn't specify one.
+
+ +
+
+

archie

+default +
+ + +
+
+
+
+ + +Lowercase, used as the persona key. +
+
+Default persona + +
+
+
+
312 chars · ~70 tokens
+ +
+
+ +Try this persona against a sample message before saving + +
+
+
+Saved · version 1 · History +
+ + +
+
+
+
+ + diff --git a/docs/design/ui-redesign/mockups/S3-settings-tools-mcp.html b/docs/design/ui-redesign/mockups/S3-settings-tools-mcp.html new file mode 100644 index 000000000..3947b9ddf --- /dev/null +++ b/docs/design/ui-redesign/mockups/S3-settings-tools-mcp.html @@ -0,0 +1,144 @@ + + + + +Settings – tools and MCP + + + + + + +
+ +
+
+ +Archie +
+ +
+
+ +Connected · v1 +
+
+ +
+ + +
+
+
+

Tools & MCP

+

External tools, model providers and fetch limits available to agents.

+
+ +
+ +
+ +
+
+
+
MCP servers
Model Context Protocol servers agents can call.
+
+
+
+
No MCP servers yet
+
Add a stdio command or an HTTP endpoint. Agents see its tools on next restart.
+
+ + +
+
+ +
+
+
Mx
+
MiniMax
Model provider
+ +
+
+
+API key +
+ +bws +/ +MINIMAX_API_KEY +
+ +
+
Credential resolved by Archie
+
+
+
+ +
+
+
+
Web fetch
Let agents download pages and files
+ +
+
+
+
MB
+
sec
+
+ +
+
+ +
+
+
Tool output policy
Large tool results are truncated or spilled to disk.
+
+
+
chars
About 12k tokens per tool call.
+
Full output is written here and the agent gets a path.
+
+
+
+
+
+
+ + diff --git a/docs/design/ui-redesign/mockups/S4-settings-review-drawer.html b/docs/design/ui-redesign/mockups/S4-settings-review-drawer.html new file mode 100644 index 000000000..ce65aea7a --- /dev/null +++ b/docs/design/ui-redesign/mockups/S4-settings-review-drawer.html @@ -0,0 +1,124 @@ + + + + +Settings – review changes + + + + + + +
+ +
+
+ +Archie +
+ +
+ +
+

Advanced settings

+

Collapsed sections show their current values at a glance.

+ +
Personas6 personas · default archie
+
Schedulesnone
+
Scheduling policytrigger assignee · 3 retries · poll 30s1 edited
+
Tools & MCP0 MCP · MiniMax on · web fetch on
+
Pluginsall directories default
+ +
+
+ +Container runtime +2 edited +
+
+
+
+
+
+
+
+
+
+
+
+ +
+ + +
+ + diff --git a/docs/design/ui-redesign/mockups/S5-settings-channels.html b/docs/design/ui-redesign/mockups/S5-settings-channels.html new file mode 100644 index 000000000..017501a1b --- /dev/null +++ b/docs/design/ui-redesign/mockups/S5-settings-channels.html @@ -0,0 +1,155 @@ + + + + +Settings – channels + + + + + + +
+ +
+
Archie
+ +
+ + +Connected +A +
+ +
+ + +
+
+
+

Channels

+

Where you talk to Archie, and how chat sessions behave.

+
+Applies after restart +
+ +
+
+
+
+
Telegram
Talk to Archie and approve its work from your phone.
+Running +
+
+
Bot token
Secret reference for the Telegram bot.
+
+
+ +env/HEYARCHIE_TELEGRAM_BOT_TOKEN +
+
+
Credential resolved by Archie
+
+
+
+
Allowed users
Telegram user IDs that may talk to Archie. Everyone else is ignored.
+
+1312197967 + +
+
+
+ + +
+
+
Email
Listen for mail and relay replies.
+Not set up + +
+ +
+
+
Webhook
Deliver agent output to a URL, with a signing secret and template.
+Not set up + +
+ + +
Chat session defaults · all channels
+
+
+
Directory chat sessions start in.
+ +
+
+
Filesystem access
Outside the workspace.
+
+ +Unrestricted filesystemOn: agents can read and write anywhere this user can. +
+
+
+
Show tool calls
Post each tool call into the chat.
+ +
+
+
Per chat turn. 0 = no limit.
+ +
+
+
Rate limit
Off while either value is 0.
+
requests per
+
+
+
Models chat sessions may use.
+ +
+
+
Who Archie treats as its operator.
+ +
+
+ +
+ +Version 1 · 11 fields set by system:migration 8 hrs ago · View in History +
+
+
+
+
+ + diff --git a/docs/design/ui-redesign/mockups/T-theme-components.html b/docs/design/ui-redesign/mockups/T-theme-components.html new file mode 100644 index 000000000..4c2a8ea2f --- /dev/null +++ b/docs/design/ui-redesign/mockups/T-theme-components.html @@ -0,0 +1,138 @@ + + + + +Theme and components + + + + + + +
+
+

Graphite theme

+

Warm neutral greys carry the page; one low-chroma accent marks the active item, focus and primary action.

+
+ +
+ +
+

Palette

+
+ +
+
+Ground +#121314 +
+ +
+
+Surface +#16171a +
+ +
+
+Raised +#1e2023 +
+ +
+
+Border +#2a2c30 +
+ +
+
+Text +#e8e6e1 +
+ +
+
+Muted +#8f8c85 +
+ +
+
+Accent +#86b5a0 +
+ +
+
+Warn +#d9a45b +
+ +
+

Type

+
+IBM Plex Sans 600 · 24 +IBM Plex Sans 400 · 14 body +IBM Plex Mono · values, keys, durations +
+
+ +
+

Buttons

+
+ + + + +
+

Status

+
+Connected +Connecting… +Applies after restart +2 edited +Invalid duration +
+

Toggles & choice

+
+ + +
+ + +
+
+
+ +
+

Inputs

+
+
+
+
+
Use a number and a unit, e.g. 1h or 90m
+
Secret reference +
+ +bws /MINIMAX_API_KEY +resolved +
+
+
+
+ + diff --git a/docs/design/ui-redesign/source/P0-navigation-map.dc.html b/docs/design/ui-redesign/source/P0-navigation-map.dc.html new file mode 100644 index 000000000..4c8ca74df --- /dev/null +++ b/docs/design/ui-redesign/source/P0-navigation-map.dc.html @@ -0,0 +1,103 @@ + + + + +Proposed navigation + + + + + + + + + +
+
+

Navigation: today → proposed

+

Five top-level places, each with one job. Anything you configure lives in Settings; anything you act on lives where the work is.

+
+ +
+
+
Today
+
Dashboard
+
Work dropdown
+
TasksWorkflows editor + start work + statsChannels settings + audit
+
Events
+
Inspector · Bindings · Mappings
+
System dropdown
+
Advanced 6 cards, 6 save buttons
+

Dropdown contents are inferred from the screenshots; confirm against the router.

+
+ +
+
Proposed
+
+
Dashboard what needs me
+
Needs you queueLive activityHealth: gates, tokens
+
Tasks the work
+
Task list filter by stateTask detail log · files · config · debugAttempts in a side rail
+
Workflows how work runs
+
List with success + costDefinition editorPerformance tab stages, failures
+
Events what comes in
+
InspectorBindingsMappings
+
Settings everything you configure, one save flow
+
+Agents
Personas · Schedules · Scheduling policy
+Integrations
Channels · Tools & MCP · Plugins
+Runtime
Container runtime · History
+
+
+
+Always in the top bar: New task · ⌘K Jump to · connection status +
+
+
+ +
+ + + + + + + +
WhatMoves toWhy
{{m.what}}→ {{m.to}}{{m.why}}
+
+
+
+ + + diff --git a/docs/design/ui-redesign/source/P1-dashboard.dc.html b/docs/design/ui-redesign/source/P1-dashboard.dc.html new file mode 100644 index 000000000..535fac93f --- /dev/null +++ b/docs/design/ui-redesign/source/P1-dashboard.dc.html @@ -0,0 +1,172 @@ + + + + +Dashboard + + + + + + + + + +
+ +
+
Archie
+ +
+ + +Connected +A +
+ +
+
+
+

Good morning

+

Nothing is running. 3 tasks need you.

+
+ +
+ +
+ +
+
{{s.label}}
+
{{s.value}}
+
{{s.sub}}
+
+
+
+ +
+
+
+
Needs you3
All tasks
+ +
+{{n.state}} +
+{{n.title}} +
{{n.meta}}
+
+
+
+
+
+ +
+
Live activitylive
+
+
+ + + + + + + +
EventTaskDetailWhen
{{a.event}}×{{a.count}}{{a.task}}{{a.detail}}{{a.when}}
+
+
+ +
+
+
Quality gates
last 4 runs
+
+
25%pass rate
+ +
+
{{g.name}}{{g.score}}
+
+
+
+
+
+ +
+
Token outlook
+
+
+
Today
14.5M
+
Next 30 days at this rate
≈ 434M
+
+
+
{{d.label}}
+
+
Only 1 day of history. The projection steadies after a week of runs.
+
+
+
+
+
+ + +
+
+ + + diff --git a/docs/design/ui-redesign/source/P2-task-detail.dc.html b/docs/design/ui-redesign/source/P2-task-detail.dc.html new file mode 100644 index 000000000..796c6d752 --- /dev/null +++ b/docs/design/ui-redesign/source/P2-task-detail.dc.html @@ -0,0 +1,138 @@ + + + + +Task detail + + + + + + + + + +
+ +
+
Archie
+ +
+ + +Connected +A +
+ +
+
+
Tasks / #1
+
+
+

changes_captured key-set validation is top-level only

+ +
+ + +
+
+ +
+ +
+
Parked: couldn’t prepare the worktree
+
fetch origin: http transport: Get "https://github.com/samcharles93/archie-core.git/info/refs?service=git-upload-pack": terminated signal received
+
+ +
+ +
+
+ +
+ + + +
+ +
+
+
+08:38:49 +ERROR +
+
task parked: worktree prepare failed: fetch origin: http transport: Get "https://github.com/samcharles93/archie-core.git/info/refs?service=git-upload-pack": terminated signal received
+
component=daemontask=1
+
+
+
End of attempt 1 · 1 line
+
+
+ + +
+
+
+
+ + + diff --git a/docs/design/ui-redesign/source/P3-workflows.dc.html b/docs/design/ui-redesign/source/P3-workflows.dc.html new file mode 100644 index 000000000..a28f1fef8 --- /dev/null +++ b/docs/design/ui-redesign/source/P3-workflows.dc.html @@ -0,0 +1,142 @@ + + + + +Workflows + + + + + + + + + +
+ +
+
Archie
+ +
+ + +Connected +A +
+ +
+
+
+

Workflows

+

The step sequences agents follow. Success rate is merged tasks over all runs.

+
+ + +
+ +
+
+
WorkflowRunsSuccessAvg tok
+ + +{{f.name}}{{f.id}} +{{f.runs}} +{{f.rate}} +{{f.tokens}} + + +
+ +
+
+

Bootstrap

+shipped · edited +
+0 runs yet +
+ +
+
+
+
Steps +
+{{s.name}} +
+
+
+
YAML✓ Valid
+
+
{{lineNos}}
+
id: bootstrap +steps: + - type: bootstrap.prepare + - type: bootstrap.apply + - type: bootstrap.commit-push + - type: bootstrap.diff-cap + - type: bootstrap.open-pr
+
+
+
+
+Version 1 · History +
+ + + +
+
+
+
+
+
+ + + diff --git a/docs/design/ui-redesign/source/P4-new-task-dialog.dc.html b/docs/design/ui-redesign/source/P4-new-task-dialog.dc.html new file mode 100644 index 000000000..424ec87c8 --- /dev/null +++ b/docs/design/ui-redesign/source/P4-new-task-dialog.dc.html @@ -0,0 +1,83 @@ + + + + +New task dialog + + + + + + + + + +
+ +
+
Archie
+ +
+ +Connected +
+
Good morning
+ +
+ +
+
+

New task

Goes into Archie’s normal task queue.
+ +
+
+
owner/repository · recent: archie-core
+
Workflow +
+ + + +
+
+
+
Advanced · run as identity
+
+
+⌘↵ to start +
+ + +
+
+
+
+ + + diff --git a/docs/design/ui-redesign/source/P5-events.dc.html b/docs/design/ui-redesign/source/P5-events.dc.html new file mode 100644 index 000000000..a92a793ad --- /dev/null +++ b/docs/design/ui-redesign/source/P5-events.dc.html @@ -0,0 +1,108 @@ + + + + +Events + + + + + + + + + +
+ +
+
Archie
+ +
+ + +Connected +A +
+ +
+
+
+

Events

+

Webhooks come in, get mapped to event types, and bindings turn them into work.

+Listening +
+ +
+ +
+ +
+{{f.n}} +
{{f.title}}
{{f.sub}}
+{{f.count}} +
+
+
+ +
+
+
Recent captures
Headers and payloads are redacted before they’re stored.
+
+
+
No captures yet
+
Point a webhook at this endpoint and it shows up here live.
+
+/webhooks/capture/<source> + +
+
+
+ +
+
Event types
Named shapes that mappings produce.
+
+
+
No event types or proposals
+
Paste a sample payload and Archie proposes a type for it. Proposals from real captures appear here too.
+
+
+
+
+
+
+ + + diff --git a/docs/design/ui-redesign/source/S1-settings-sidebar-setting-rows.dc.html b/docs/design/ui-redesign/source/S1-settings-sidebar-setting-rows.dc.html new file mode 100644 index 000000000..0d3761beb --- /dev/null +++ b/docs/design/ui-redesign/source/S1-settings-sidebar-setting-rows.dc.html @@ -0,0 +1,167 @@ + + + + +Settings – sidebar layout + + + + + + + + + +
+ +
+
+ +Archie +
+ +
+
+ +Connecting to archie-core… +
+ +
+ +
+ + +
+
+
+
+

Scheduling policy

+

How Archie picks up work items and labels them as they move through states.

+
+ + +Applies after restart +
+ +

Dispatch

+
+
Trigger
What causes a work item to be dispatched to an agent.
+
+
+ + +
+
Dispatches when Archie is assigned. Choose Label to set a trigger label instead.
+
+
+
+
Reaction posted when a work item is picked up.
+
+
+ +

State labels

+
+
Labels by state
Label applied to the ticket as the agent moves between states.
+
+
StateLabel
+ +
+{{l.state}} + + +
+
+ +
+
+ +

Retries & polling

+
+
Attempts before an item is labelled dead.
+
+ + + +
+
+
+
How often the tracker is checked for new work.
+
+
+ + +
+was 1m0s +
+
+
+
+
+ +
+ +1 unsaved change +· Poll interval +
+ + +
+
+
+ + + diff --git a/docs/design/ui-redesign/source/S2-settings-personas.dc.html b/docs/design/ui-redesign/source/S2-settings-personas.dc.html new file mode 100644 index 000000000..532c645af --- /dev/null +++ b/docs/design/ui-redesign/source/S2-settings-personas.dc.html @@ -0,0 +1,146 @@ + + + + +Settings – personas + + + + + + + + + +
+ +
+
+ +Archie +
+ +
+
+ +Connected · v1 +
+
+ +
+
System / Advanced
+

Advanced settings

+ +
+ +
+
+
+ + +
+ +
Personas are system prompts an agent can adopt. The default is used when a work item doesn't specify one.
+
+ +
+
+

archie

+default +
+ + +
+
+
+
+ + +Lowercase, used as the persona key. +
+
+Default persona + +
+
+
+
312 chars · ~70 tokens
+ +
+
+ +Try this persona against a sample message before saving + +
+
+
+Saved · version 1 · History +
+ + +
+
+
+
+
+ + + diff --git a/docs/design/ui-redesign/source/S3-settings-tools-mcp.dc.html b/docs/design/ui-redesign/source/S3-settings-tools-mcp.dc.html new file mode 100644 index 000000000..c00dc601d --- /dev/null +++ b/docs/design/ui-redesign/source/S3-settings-tools-mcp.dc.html @@ -0,0 +1,155 @@ + + + + +Settings – tools and MCP + + + + + + + + + +
+ +
+
+ +Archie +
+ +
+
+ +Connected · v1 +
+
+ +
+ + +
+
+
+

Tools & MCP

+

External tools, model providers and fetch limits available to agents.

+
+ +
+ +
+ +
+
+
+
MCP servers
Model Context Protocol servers agents can call.
+
+
+
+
No MCP servers yet
+
Add a stdio command or an HTTP endpoint. Agents see its tools on next restart.
+
+ + +
+
+ +
+
+
Mx
+
MiniMax
Model provider
+ +
+
+
+API key +
+ +bws +/ +MINIMAX_API_KEY +
+ +
+
Credential resolved by Archie
+
+
+
+ +
+
+
+
Web fetch
Let agents download pages and files
+ +
+
+
+
MB
+
sec
+
+ +
+
+ +
+
+
Tool output policy
Large tool results are truncated or spilled to disk.
+
+
+
chars
About 12k tokens per tool call.
+
Full output is written here and the agent gets a path.
+
+
+
+
+
+
+
+ + + diff --git a/docs/design/ui-redesign/source/S4-settings-review-drawer.dc.html b/docs/design/ui-redesign/source/S4-settings-review-drawer.dc.html new file mode 100644 index 000000000..ec6b33052 --- /dev/null +++ b/docs/design/ui-redesign/source/S4-settings-review-drawer.dc.html @@ -0,0 +1,123 @@ + + + + +Settings – review changes + + + + + + + + + +
+ +
+
+ +Archie +
+ +
+ +
+

Advanced settings

+

Collapsed sections show their current values at a glance.

+ +
Personas6 personas · default archie
+
Schedulesnone
+
Scheduling policytrigger assignee · 3 retries · poll 30s1 edited
+
Tools & MCP0 MCP · MiniMax on · web fetch on
+
Pluginsall directories default
+ +
+
+ +Container runtime +2 edited +
+
+
+
+
+
+
+
+
+
+
+
+ +
+ + +
+
+ + + diff --git a/docs/design/ui-redesign/source/S5-settings-channels.dc.html b/docs/design/ui-redesign/source/S5-settings-channels.dc.html new file mode 100644 index 000000000..cf718798c --- /dev/null +++ b/docs/design/ui-redesign/source/S5-settings-channels.dc.html @@ -0,0 +1,165 @@ + + + + +Settings – channels + + + + + + + + + +
+ +
+
Archie
+ +
+ + +Connected +A +
+ +
+ + +
+
+
+

Channels

+

Where you talk to Archie, and how chat sessions behave.

+
+Applies after restart +
+ +
+
+
+
+
Telegram
Talk to Archie and approve its work from your phone.
+Running +
+
+
Bot token
Secret reference for the Telegram bot.
+
+
+ +env/HEYARCHIE_TELEGRAM_BOT_TOKEN +
+
+
Credential resolved by Archie
+
+
+
+
Allowed users
Telegram user IDs that may talk to Archie. Everyone else is ignored.
+
+1312197967 + +
+
+
+ + +
+
+
{{c.name}}
{{c.sub}}
+Not set up + +
+
+ +
Chat session defaults · all channels
+
+
+
Directory chat sessions start in.
+ +
+
+
Filesystem access
Outside the workspace.
+
+ +Unrestricted filesystemOn: agents can read and write anywhere this user can. +
+
+
+
Show tool calls
Post each tool call into the chat.
+ +
+
+
Per chat turn. 0 = no limit.
+ +
+
+
Rate limit
Off while either value is 0.
+
requests per
+
+
+
Models chat sessions may use.
+ +
+
+
Who Archie treats as its operator.
+ +
+
+ +
+ +Version 1 · 11 fields set by system:migration 8 hrs ago · View in History +
+
+
+
+
+
+ + + diff --git a/docs/design/ui-redesign/source/T-theme-components.dc.html b/docs/design/ui-redesign/source/T-theme-components.dc.html new file mode 100644 index 000000000..eb42915a5 --- /dev/null +++ b/docs/design/ui-redesign/source/T-theme-components.dc.html @@ -0,0 +1,120 @@ + + + + +Theme and components + + + + + + + + + +
+
+

Graphite theme

+

Warm neutral greys carry the page; one low-chroma accent marks the active item, focus and primary action.

+
+ +
+ +
+

Palette

+
+ +
+
+{{s.name}} +{{s.hex}} +
+
+
+

Type

+
+IBM Plex Sans 600 · 24 +IBM Plex Sans 400 · 14 body +IBM Plex Mono · values, keys, durations +
+
+ +
+

Buttons

+
+ + + + +
+

Status

+
+Connected +Connecting… +Applies after restart +2 edited +Invalid duration +
+

Toggles & choice

+
+ + +
+ + +
+
+
+ +
+

Inputs

+
+
+
+
+
Use a number and a unit, e.g. 1h or 90m
+
Secret reference +
+ +bws /MINIMAX_API_KEY +resolved +
+
+
+
+
+ + + diff --git a/docs/design/ui-redesign/tokens/tokens.css b/docs/design/ui-redesign/tokens/tokens.css new file mode 100644 index 000000000..097a6f8d0 --- /dev/null +++ b/docs/design/ui-redesign/tokens/tokens.css @@ -0,0 +1,84 @@ +/* + * Archie "Graphite" theme tokens. + * Warm neutral greys carry the page; ONE low-chroma accent marks the active + * nav item, focus rings, "edited" markers and the primary action. Nothing else + * uses the accent. Map these onto whatever styling system the app already uses + * (Tailwind theme, CSS modules, styled-components…) rather than adding a + * parallel system. + */ +@import url("https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500&family=IBM+Plex+Sans:wght@400;500;600&display=swap"); + +:root { + /* Surfaces (darkest → lightest) */ + --bg: #121314; /* page ground, input fill */ + --bg-header: #151618; /* app top bar */ + --surface: #16171a; /* cards, panels, list containers */ + --surface-2: #17181a; /* sticky save bar, drawer, table header */ + --raised: #1e2023; /* active nav item, secondary button, hover */ + --raised-2: #26282c; /* selected segment in a segmented control */ + + /* Lines */ + --border-subtle: #202225; /* row dividers inside tables */ + --border: #232529; /* section dividers, header/sidebar edges */ + --border-card: #2a2c30; /* card and panel outlines */ + --border-input: #2e3034; /* inputs, toggles off-track */ + --border-button: #34373c; /* secondary button outline */ + --border-edited: #3a3f3c; /* outline of a section with unsaved edits */ + + /* Text */ + --text: #e8e6e1; /* primary */ + --text-2: #a6a39b; /* secondary, nav items, descriptions of sections */ + --text-3: #8f8c85; /* hints, captions, placeholders, table headers (≥4.5:1 on --surface) */ + --text-on-accent:#101412; /* text on accent-filled buttons */ + + /* Accent — one at a time. Default sage; alternatives kept for a theme picker. */ + --accent: #86b5a0; /* sage (default) */ + --accent-ring: rgba(134, 181, 160, 0.15); /* focus halo */ + /* --accent: #8aa4c2; steel */ + /* --accent: #d4a373; sand */ + /* --accent: #a397c9; muted violet (closest to the old purple) */ + + /* Status */ + --warn: #d9a45b; /* "applies after restart", "connecting" dot */ + --warn-text: #e3c08f; + --warn-bg: rgba(217, 164, 91, 0.08); + --warn-border: rgba(217, 164, 91, 0.25); + --danger: #d9776b; /* delete, invalid input border, dead state */ + --danger-text: #e0a39a; + --danger-bg: rgba(217, 119, 107, 0.08); + --danger-border: #3a2a28; + --diff-add-bg: rgba(134, 181, 160, 0.10); + --diff-add-text: #a9d1bf; + --diff-del-bg: rgba(217, 119, 107, 0.08); + --diff-del-text: #e0a39a; + + /* Agent state colours (label table swatches, and anywhere states are shown) */ + --state-queued: #8f8c85; + --state-working: #8aa4c2; + --state-waiting: #d9a45b; + --state-pr: #86b5a0; + --state-parked: #6f6c66; + --state-dead: #d9776b; + + /* Type */ + --font-sans: "IBM Plex Sans", system-ui, sans-serif; + --font-mono: "IBM Plex Mono", ui-monospace, monospace; /* ALL config values, keys, durations, image refs */ + --fs-page-title: 24px; /* weight 600, letter-spacing -0.01em */ + --fs-card-title: 15px; /* weight 500 */ + --fs-body: 14px; + --fs-control: 13px; /* inputs, buttons, nav, labels (label weight 500) */ + --fs-hint: 12px; /* line-height 1.5 */ + --fs-eyebrow: 11px; /* uppercase, letter-spacing 0.06–0.08em, --text-3 */ + + /* Shape & spacing */ + --radius-sm: 4px; /* kbd hints */ + --radius: 6px; /* inputs, buttons, nav items */ + --radius-md: 8px; /* segmented control, callouts, diff cards */ + --radius-lg: 10px; /* cards, panels */ + --radius-pill: 999px; + --control-h: 36px; /* inputs, buttons, nav items */ + --header-h: 56px; + --sidebar-w: 264px; + --content-max: 920px; + --row-label-w: 280px; /* left column of a setting row */ +} diff --git a/docs/design/ui-redesign/tokens/tokens.json b/docs/design/ui-redesign/tokens/tokens.json new file mode 100644 index 000000000..1e7acc492 --- /dev/null +++ b/docs/design/ui-redesign/tokens/tokens.json @@ -0,0 +1,45 @@ +{ + "name": "Archie Graphite", + "color": { + "bg": "#121314", + "bgHeader": "#151618", + "surface": "#16171a", + "surface2": "#17181a", + "raised": "#1e2023", + "raised2": "#26282c", + "borderSubtle": "#202225", + "border": "#232529", + "borderCard": "#2a2c30", + "borderInput": "#2e3034", + "borderButton": "#34373c", + "borderEdited": "#3a3f3c", + "text": "#e8e6e1", + "text2": "#a6a39b", + "text3": "#8f8c85", + "textOnAccent": "#101412", + "accent": "#86b5a0", + "accentRing": "rgba(134,181,160,0.15)", + "accentAlternatives": { "sage": "#86b5a0", "steel": "#8aa4c2", "sand": "#d4a373", "mutedViolet": "#a397c9" }, + "warn": "#d9a45b", + "warnText": "#e3c08f", + "warnBg": "rgba(217,164,91,0.08)", + "warnBorder": "rgba(217,164,91,0.25)", + "danger": "#d9776b", + "dangerText": "#e0a39a", + "dangerBg": "rgba(217,119,107,0.08)", + "dangerBorder": "#3a2a28", + "diffAddBg": "rgba(134,181,160,0.10)", + "diffAddText": "#a9d1bf", + "diffDelBg": "rgba(217,119,107,0.08)", + "diffDelText": "#e0a39a", + "state": { "queued": "#8f8c85", "working": "#8aa4c2", "waiting": "#d9a45b", "pr": "#86b5a0", "parked": "#6f6c66", "dead": "#d9776b" } + }, + "font": { + "sans": "\"IBM Plex Sans\", system-ui, sans-serif", + "mono": "\"IBM Plex Mono\", ui-monospace, monospace", + "size": { "pageTitle": 24, "cardTitle": 15, "body": 14, "control": 13, "hint": 12, "eyebrow": 11 }, + "weight": { "regular": 400, "medium": 500, "semibold": 600 } + }, + "radius": { "sm": 4, "base": 6, "md": 8, "lg": 10, "pill": 999 }, + "size": { "controlHeight": 36, "headerHeight": 56, "sidebarWidth": 264, "contentMax": 920, "rowLabelWidth": 280 } +} diff --git a/docs/inspiration/2026-09-05-awx-service-decomposition-and-ansible-task-model.md b/docs/inspiration/2026-09-05-awx-service-decomposition-and-ansible-task-model.md deleted file mode 100644 index c9f16f8f6..000000000 --- a/docs/inspiration/2026-09-05-awx-service-decomposition-and-ansible-task-model.md +++ /dev/null @@ -1,149 +0,0 @@ -# Sam's message, verbatim (2026-09-05) - -Source: chat message pasting an AWX forum post (AWX modernisation series, -"Refactoring AWX into a Pluggable, Service-Oriented Architecture") plus a -terminal transcript and a follow-up message including Ansible's -`ansible/playbook/task.py`. Preserved verbatim below for later reference. -Image attachment (`AAP Pluggable Architecture` diagram) is described, not -reproduced, since this file is text-only. - ---- - -[01:09:53] sam@helix /work/clones - -> git clone https://github.com/ansible/ansible.git -> Cloning into 'ansible'... -> remote: Enumerating objects: 644471, done. -> remote: Counting objects: 100% (21/21), done. -> remote: Compressing objects: 100% (21/21), done. -> remote: Total 644471 (delta 5), reused 2 (delta 0), pack-reused 644450 (from 3) -> Receiving objects: 100% (644471/644471), 251.86 MiB | 9.60 MiB/s, done. -> Resolving deltas: 100% (427812/427812), done. -> [01:12:50] sam@helix /work/clones -> git clone https://github.com/ansible/awx.git -> Cloning into 'awx'... -> remote: Enumerating objects: 331428, done. -> remote: Counting objects: 100% (399/399), done. -> remote: Compressing objects: 100% (256/256), done. -> remote: Total 331428 (delta 259), reused 153 (delta 143), pack-reused 331029 (from 3) -> Receiving objects: 100% (331428/331428), 346.81 MiB | 12.94 MiB/s, done. -> Resolving deltas: 100% (254095/254095), done. -> [01:14:59] sam@helix /work/clones - ---- - -[Image #2] - -Hi folks, - -In our previous post, we discussed the upcoming changes we're making to the AWX project. Today, we'd like to dive deeper into one of the most significant changes: refactoring AWX into a pluggable, service-oriented architecture. -Current State of AWX - -AWX is currently structured as a monolithic Django application. It consists of several entry points, each running as individual processes, including our API, Job Dispatcher, Event Processor, and Websocket subsystem. Alongside these, AWX relies on various ancillary processes such as Redis, Rsyslog, Receptor, Nginx, Uwsgi, and Daphne. -Challenges with the Current Architecture - -Over time, it has become increasingly challenging to implement changes due to the large, self-contained nature of the application. This monolithic structure has not only slowed down our development process but also made it difficult to ensure efficient code reuse across our other applications. Consequently, this impacts both our development efficiency and the ability to quickly iterate on features and fixes. As we continue to extend capabilities across Ansible Automation Platform we cannot afford these challenges and maintain upstream projects the way they are currently structured. -Proposed Changes - -To address these challenges, we are beginning to transition AWX towards a more pluggable, service-oriented architecture. By breaking down the monolithic structure into smaller, modular services, we aim to enhance both flexibility and maintainability. This shift will enable us to make changes more swiftly and efficiently in AWX while also improving our ability to reuse code across various projects leveraged by Ansible Automation Platform. -Implementation Plan - -Our implementation plan involves several key steps: - - Identifying Modular Services: We will start by identifying the core functionalities that can be extracted into individual plugins and/or services. - Creating a Communication Framework: Establish a robust communication framework to ensure seamless interaction between these services. - Gradual Transition: Implement the new architecture in phases to allow for continuous feedback and improvement. - Community Collaboration: Engage with our community throughout the process to gather feedback and ensure the new architecture meets the needs of our users. - -Future-Looking Architecture - -1316×628 38.8 KB - -Expected Outcomes - -By refactoring AWX into a service-oriented architecture, we expect several positive outcomes: - - Improved Flexibility: Easier to implement changes and add new features. - Enhanced Maintainability: Simplified codebase with clear service boundaries. - Better Code Reuse: More efficient reuse of code across different projects. - Active Community Participation: Greater opportunity for community members to contribute and shape the project. - -Call to Action - -We invite feedback and collaboration with us on this significant transformation by replying to this forum post. - -Join the discussions on our forum, share your thoughts, and help shape the future of awx . -Conclusion - -These architectural changes are a crucial step towards a more modern and scalable AWX. We look forward to your participation and support as we embark on this journey together. - -Stay updated by joining The Forum, following the -News & Announcements and -awx tags. - -Thank you for your continued support. -Links in this AWX update series - - Blog: Upcoming Changes to the AWX Project - Streamlining AWX Releases - Refactoring AWX into a Pluggable, Service-Oriented Architecture (this post) - Upcoming changes to AWX Operator installation methods - AWX UI and credential types transitioning to the new pluggable architecture - AWX modernisation: Moving forward - AWX modernisation: Ansible UI - AWX modernisation: Ansible Jewel - -Useful links - - 2024-05-30 Blog: Upcoming Changes to the AWX Project - 2024-07-01 Streamlining AWX Releases - The Forum: AWX topics - The Forum: Newsletter Category - ---- - -Taking a look at this, How could we reframe ourselves to capture some of this market? - -Archie is already a beast of a project, I think that it would be an excellent idea to think about cleaning up, simplifying, and unifying many of it's layers down to cleaner interfaces and even if it's starting at the most basic layers such as splitting the UI from the backend, turning the agent into a core runner, or even having 2 separate agent definitions, an AI agent and an agent runner. or. even better, an agent runner which utilises an open source project like Pi as the AI harness instead of having to code our own one. - -I have Pi running now, with an immensely fast and capable model (deepseek-v4-flash-vision-exp) which is absolutely able to perform many actions at great speed, and that could assist us to getting this chunk of work done. - -the idea of everything being pluggable services - making the entire solution modular, is exactly the goal I've had from the start. and it's already heading that way, but it's missing some guidance, assistance and care. I believe that a multi-agent system could help me get there, where I talk to an agent like claude, which spawns subagents to start implementation in isolation, and another agent monitors the work, assists, and carefully merges as the migration is in progress. - -[01:23:10] sam@helix /work/apps/archie-core - -> tree -> (directory tree of archie-core omitted here -- see repository working tree at -> the time of writing for the full listing; top-level shape was: AGENTS.md, -> ARCHITECTURE.md, cmd/{archie-agent,archied,archie-playbooks}, deployments/, -> docs/{architecture,archive,data,guides,prds,public}, examples/, extras/, -> internal/{agentexec,app,channels,config,container,daemon,domain,eventbus, -> events,forge,forgerpc,gate,gateway,indexing,infrastructure,installtype, -> logging,memory,natsrpc,pairing,plugin,ratelimit,releaseannounce, -> releaseupdate,secret,skill,skillscript,storage,store,storerpc,taskrun, -> taskstate,tools,webhookguard,webui,worktree,worktreerpc,yaegiutil}, scripts/, -> tools/, ui/{dist,src,test}) -> [01:23:12] sam@helix /work/apps/archie-core - ---- - -One other thing I've grabbed inspiration from the Ansible project and I'm hoping to splice in - is the task.py (and likely more items) definitions; I think that being able to use existing ansible playbooks (and eventually roles/etc) within archie, would be astoundingly benefitial for engagement. - -(ansible/playbook/task.py, GPLv3, Michael DeHaan et al. -- full file pasted in -chat; omitted here as reference-only source code, not reproduced verbatim in -this repository. It defines Ansible's `Task` class: FieldAttribute-based -declarative fields such as `args`, `action`, `loop`, `register`, -`changed_when`/`failed_when`/`until`, `delay`/`poll`/`retries`, -`loop_control`; `preprocess_data` which runs `ModuleArgsParser` to resolve the -legacy free-form task shape into `(action, args, delegate_to)`; `post_validate` -which templates fields through Jinja2 (`TemplateEngine`); parent-chain -attribute inheritance (`_get_parent_attribute` walking up through Block / -TaskInclude / Play); and `_resolve_conditional` for `when:` evaluation.) - ---- - -Attached image: "AAP Pluggable Architecture" diagram -- a decomposition tree -with "AWX Decomposition" as root, branching to: Credentials, Subscription/ -Billing, Auth (children: RBAC, SSO, Policy/ABAC), Communication (child: -Inter Service, and Execution (mesh) linked back into Runtime), Telemetry, -Inventory, Runtime (child: Scheduler), Content (child: Projects). diff --git a/docs/inspiration/module-reference-awx-decomposition-vs-archie.md b/docs/inspiration/module-reference-awx-decomposition-vs-archie.md deleted file mode 100644 index 6958aa7a7..000000000 --- a/docs/inspiration/module-reference-awx-decomposition-vs-archie.md +++ /dev/null @@ -1,127 +0,0 @@ -# Module reference: AWX decomposition / Ansible task model vs. Archie - -Status: exploratory reference, not a design decision. Nothing here is -authoritative -- `docs/architecture/` stays the source of truth. This exists -so a later PRD (if one gets written) doesn't have to re-derive "what do we -already have vs. what AWX/Ansible are describing." See -[[2026-09-05-awx-service-decomposition-and-ansible-task-model]] for the -source material this is built from. - -Two follow-on artifacts extend this line of exploration: - -- Two Archify diagrams contrasting current vs. an ideal service-oriented - shape: `/work/artefacts/archie-core-current-state-archify.html` and - `/work/artefacts/archie-core-ideal-state-archify.html`. The current-state - diagram is grounded in verified coupling (webui's task-action path routes - through its own HTTP handler in-process; direct `gateway.SessionStore` / - `Router` / `TurnHistory` access; a shared `config.Holder`) -- not the - "already split" claim this document's earlier draft mistakenly made. -- [[service-discovery-research-2026-09-05]] -- externally researched - comparison of service-discovery mechanisms for the ideal-state's "install - a service, the fleet auto-aligns" requirement. Recommends Kubernetes-native - discovery as primary (Helm chart + Operator on k3s / a real cluster) with - NATS-based discovery (already a hard dependency) as the built-in fallback - for no-K8s single-host installs, both behind one `ServiceRegistry` - interface. - -## Reading the two source ideas separately - -The AWX post and the Ansible `Task` paste are two different asks and should -stay two different tracks: - -1. **AWX's decomposition tree** is an argument for splitting a monolith - along service boundaries (Auth, Comms, Runtime, Content, ...) with a - pluggable communication mesh between them. Archie's six-domain split - (`docs/architecture/index.md`) already **is** that argument, applied - earlier and at a different grain (domain boundaries in one Go module + - NATS transport, not separate deployable services). The gap isn't "do we - need boundaries," it's "are the boundaries clean and are they enforced." -2. **Ansible's `Task`/module system** is a request for a _content_ format: - let users write YAML tasks against a stable action vocabulary and have - Archie interpret them, the way Ansible interprets `- name: ... action: -module: args`. Archie has the skeleton of this already (EDA playbook - engine, Module action position) but it's deliberately narrow today. - -## AWX decomposition tree -> Archie's existing domains - -| AWX node | Archie equivalent today | Location | -| ------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------- | -| Auth (RBAC / SSO / Policy-ABAC) | `internal/domain/binding` (task-to-identity/config binding) + `internal/policy` (cross-cutting, zero internal imports) + forge/channel auth (Telegram pairing, webhook HMAC) | `internal/domain/binding/`, `internal/policy/`, `internal/pairing/`, `internal/webhookguard/` | -| Communication / Inter-Service | NATS (`ARCHIE_TASKS` JetStream work queue, core-NATS RPC via `_INBOX.*`) | `internal/infrastructure/eventbus/nats/`, `internal/natsrpc/`, `internal/eventbus/` (contract, zero internal imports) | -| Execution (mesh) | Container pool running isolated agent worktrees over NATS, not a mesh of remote execution nodes (Ansible's Receptor equivalent doesn't exist -- Archie's "remote execution" is a Docker container, not a fleet) | `internal/container/pool.go`, `internal/agentexec/`, `internal/worktree/` | -| Runtime / Scheduler | `internal/domain/scheduling` (ticker contract) + cron-driven work intake | `internal/domain/scheduling/`, `internal/infrastructure/cronstore/` | -| Content / Projects | Nearest analogue is the **EDA playbook + module system** (below) plus `internal/skill` (skill catalogue) -- Archie has no "project" = git-checkout-of-automation-content concept the way AWX does | `internal/domain/eda/playbook/`, `internal/domain/eda/module/`, `internal/skill/` | -| Telemetry | `internal/logging` (task sink, feed, registry) + `internal/events` | `internal/logging/`, `internal/events/` | -| Inventory | No direct equivalent. Closest is forge-side repo/identity config (`[[identities]]`, `internal/forge`) -- Archie targets one identity acting across a small set of forge repos, not a dynamic inventory of managed hosts | `internal/forge/`, `internal/config/` | -| Credentials | `internal/secret` (engine host, env/age/sops/vault engines) | `internal/secret/`, `internal/secret/enginehost/` | -| Subscription/Billing | No equivalent -- Archie is self-hosted, single-tenant; this AWX node doesn't map to anything and shouldn't | -- | -| UI split from backend | Already true: `internal/webui` (Go API server) serves a separately built SPA from `ui/dist` (Vite/React-ish, `ui/src//`) over HTTP/SSE. There is no shared-process coupling to undo. | `internal/webui/`, `ui/src/` | - -**Read on "reframe to capture market":** the honest gap next to AWX/AAP isn't -domain boundaries -- Archie already has those, arguably cleaner (env-enforced -gates, one dependency direction, contracts with zero internal imports). The -gap is (a) no content/inventory layer letting non-programmers hand Archie -declarative automation the way an Ansible playbook does, and (b) everything -still ships as one Go binary + one container image, not independently -deployable/upgradable services. (a) is the more differentiated, more -buildable opportunity given a one-person team; (b) is expensive AWX-style -service splitting with limited payoff at Archie's current scale and should -not be pursued for its own sake. - -## Ansible `Task` model -> Archie's EDA playbook/module system - -Ansible's `task.py` is the runtime representation of one YAML task after -`ModuleArgsParser` resolves the legacy free-form shape and `TemplateEngine` -renders Jinja2. Archie's nearest shipped analogue is the EDA playbook engine, -which is **intentionally much narrower right now**: - -| Ansible concept | Archie's current shape | Gap / what porting the idea would mean | -| --------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `Task` (one step, `action` + `args`) | `playbook.Action` (`internal/domain/eda/playbook/playbook.go`) -- but **exactly one action per playbook, position must be `"workflow"`**, hard-rejected at load otherwise | Multi-action, multi-position playbooks are the literal ask ("use existing ansible playbooks... within archie") but are explicitly blocked today on unresolved execution-time gaps: mid-run failure semantics, idempotency for non-workflow actions (see the package doc comment and `docs/architecture/plugins-and-extensions.md`'s Event sources section). This is a known, named boundary, not an oversight. | -| Module (`ansible.builtin.*`, arbitrary Python) | `module.Kind` registry, Yaegi-interpreted `.go` files against a generated per-kind symbol table (`internal/domain/eda/module/`) -- **one shipped kind: `log`** | Ansible modules are dynamically loaded from a huge ecosystem; Archie's Module position is closed-registry-of-named-kinds, each with its own hand-written contract package (`internal/domain/eda/module/`). Adding "run a shell command," "call a forge API," "send a channel message" module kinds is possible under the existing pattern but each is new work, not automatic from having the mechanism. | -| `when:` conditional | `Action.When`, compiled CEL (`internal/domain/eda/expr`), not Jinja2 | Already decided: CEL over Jinja2 (open question 1 in the playbook engine PRD, resolved). Don't reopen. | -| `register` / fact accumulation across tasks | Not present -- `DispatchInput.Event` is a flat map exposed to CEL, there's no cross-action result chaining because there's only one action | Needed before multi-action playbooks are meaningful; tracked implicitly by the same "unresolved execution-time gaps" blocker above. | -| `loop` / `until`/`retries`/`delay` | Not present | Same -- follows from allowing more than one action per playbook. | -| Field-attribute inheritance (task -> block -> play) | No block/parent chain -- a playbook is flat: one `Trigger` + one `Action` | Ansible's play/block/role hierarchy has no Archie counterpart yet; would only matter once multi-action/roles are in scope. | -| Roles (reusable task bundles) | Nearest is `internal/skill` (skill catalogue, frontmatter, tool defs) -- conceptually closer to Claude Skills than Ansible roles | Not a role system; skills are agent-facing capability bundles, not declarative task sequences. | -| Channel / Forge action positions | Named and designed but explicitly **not implemented** (`docs/architecture/plugins-and-extensions.md`: "Channel and Forge action positions are designed but not yet implemented," open investigation `archie-core-t2db.19`) | This is the direct next step toward "playbooks that do things," independent of the Ansible-compatibility idea. | - -**What porting real Ansible playbooks would actually require**, in rough -dependency order, if this becomes a real proposal later: - -1. Lift the playbook engine's hard boundary: multi-action playbooks, which - needs the mid-run failure/idempotency semantics the doc comment flags as - the blocker today. -2. A result-passing mechanism between actions (Ansible's `register`) -- - currently nothing carries one action's output into the next action's - `when`/`args`. -3. Loop/retry primitives per action. -4. A much larger Module `Kind` registry, or a deliberate decision to accept - a narrower "Archie automation language inspired by Ansible's shape" rather - than "runs unmodified Ansible YAML" -- the latter also drags in Jinja2, - the module_utils Python runtime, and inventory/host-targeting concepts - Archie has no use for (Archie targets git repos and forge issues, not - fleets of managed hosts). Recommend treating "Ansible-_inspired_ syntax, - not Ansible-_compatible_ execution" as the working assumption if/when a - PRD gets written -- it avoids importing Ansible's inventory/host model, - which doesn't fit Archie's single-repo-per-task execution shape at all. - -## On the multi-agent / Pi-harness-as-runner idea - -Out of scope for this reference doc (it's an operating-model question, not a -module-mapping one) but noted since it was raised alongside the above: this -is a `migration-decisions.md`-track question (agent execution as a strict -data boundary is a named invariant in `ARCHITECTURE.md`), not something to -back into via the EDA/module work. Flag separately if it's worth pursuing. - -## Bottom line - -- No code changes implied by this document. It's a map, not a proposal. -- The two ideas in Sam's message decompose cleanly: AWX's service-split - argument is mostly already satisfied by Archie's domain architecture; the - Ansible-playbook-content idea is a real, currently-blocked extension of - the EDA Module/Channel/Forge action positions, gated on the same - execution-semantics work already named in `plugins-and-extensions.md`. -- If this becomes a real initiative, it belongs in `docs/prds/` as a - decisive 1-pager per `AGENTS.md`'s scope-discipline rule -- not as an - elaboration of this file. diff --git a/docs/inspiration/service-decomposition-open-questions-research-2026-09-05.md b/docs/inspiration/service-decomposition-open-questions-research-2026-09-05.md deleted file mode 100644 index 34eac1c06..000000000 --- a/docs/inspiration/service-decomposition-open-questions-research-2026-09-05.md +++ /dev/null @@ -1,868 +0,0 @@ -# Service decomposition open questions: research for #1–#5 - -Status: research pass that resolves all five blocking open questions in -[[service-decomposition]] (the Proposed-status PRD). It extends — it does -not replace — that PRD and [[service-discovery-research-2026-09-05]]. -Questions #2 (contract definition mechanism) and #3 (in-process vs -out-of-process during migration) were resolved in a later pass; Q1's -Phase 0 dependency on #2's contract-definition mechanism (buf + grpc-go, -committed generated code) is now satisfied. - -Produced by an agent research pass against primary sources: a -supervisor-run set of `deep_search_exa` queries plus direct fetches of -the canonical primary texts (Martin Fowler / Zhamak Dehghani's -monolith-breaking article, microservices.io's database-per-service -pattern, Microsoft's .NET microservices data-sovereignty guidance, the -Kubebuilder book, Helm's chart documentation). Every recommendation is -grounded in the verified archie-core coupling findings from the PRD and -in the code (checked at `internal/app/archied/main.go`, -`internal/webui/server.go`, `internal/webui/api_chat.go`, -`internal/store/interface.go`, `internal/store/store.go`, -`internal/storerpc/storerpc.go`, `internal/gateway/session_store_sqlite.go`, -`internal/app/archied/bootstrap.go`). Reproduced close to verbatim as the -record; light formatting only. - -Repositioning note: the PRD's own text floats a hypothesis ("Gateway -Service's `ChatContract` should exist before UI Service is extracted"). -This document **confirms that hypothesis with code archaeology and -strengthens it**, and it is the single most important finding: archie-core's -Gateway is both the _stickiest_ capability and the one with an already- -clean seam and already-isolated data. The generic "extract a leaf / -read-only thing first" advice does not apply here, and I say so with the -reason why. - ---- - -## Summary of the five recommendations - -| # | Question | Recommendation (one line) | -| --- | ---------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| 1 | Extraction order | **Gateway Service first**, then State Store, then UI, then Messaging, then Execution/Runner/Scheduler, then Curator (optional) — preceded by an in-process "contract seams" phase (modular monolith) that is #2's real prerequisite. | -| 2 | Contract definition mechanism | **buf v2 + protoc-gen-go + protoc-gen-go-grpc** (grpc-go, not connect-go), one committed `proto//v1/` tree generating into `internal/contracts//v1/`, directory-versioned, `buf breaking` gated in `task check` and mirrored into CI. | -| 3 | In-process vs. out-of-process during migration | **Multiplexed in-process is the migration default**: one wire-safe Go contract interface per service, a local adapter and a generated gRPC client adapter, composition (not `ServiceRegistry`) picks which one, and the flip to a real process is a same-commit deletion of the in-process path — no dual-live window. | -| 4 | State Store's contract shape | **One State Store service owns a single SQLite file behind narrow typed contracts** (the existing `internal/store` split already does the ownership; the gap is enforcement). No physical database-per-service at this scale, and no distributed-transaction problem, because there is still one store. Gateway keeps its own already-separate session SQLite. | -| 5 | Helm chart / Operator scoping | **Three charts** (a `library` chart of the shared contract templates, one `archie` chart for the 7 core services, one `archie-curator` chart + a Curator Operator) — and the smallest first milestone is a **single Curator CR that the Operator reconciles into a Deployment + Service, with Gateway resolving `curator` via the `ServiceRegistry`**. | - ---- - -## Question #1 — Extraction order - -### The question and the hypothesis - -The PRD asks which service is pulled out of the monolith first and what -staged sequence follows. Its own text proposes: Gateway Service's -`ChatContract` should exist before UI Service is extracted, "since UI is -the most entangled consumer today." - -### Verified coupling (the load-bearing facts) - -The PRD's three cited couplings are real; I re-checked the call sites: - -1. **Telegram task-action routes through webui's HTTP handler.** The - message path is `chatTaskActorAdapter.ApplyChatTaskAction` - (`internal/app/archied/main.go:655`) which the daemon wires and which - dispatches into `internal/webui`'s `handleTaskAction` - (`internal/webui/api_tasks.go:136`, mounted at - `server.go:294`). Messaging Service (the Telegram adapter) has no - direct route to the gateway today — it must detour through a UI HTTP - handler to apply a pause/resume/abandon action. -2. **UI reaches directly into gateway internals.** - `internal/webui/api_chat.go`'s `ChatService` is _literally_ `Router -*gateway.Router`, `Sessions gateway.SessionStore`, `Turns -*gateway.Turns` plus `Models gateway.ModelManager` and `Personas -*gateway.PersonaRegistry`, and it calls `chat.Sessions.(gateway.TurnHistory)` - at line 198 and `chat.Router.Route`/`ResolveSessionKey` at 256/261. - This is not "a UI calling a Gateway API" — it is the UI holding the - Gateway's internal objects and calling their methods in-process. -3. **A shared `config.Holder`.** `bootstrap.go:1236` comments explicitly: - "web and the daemon must share ONE Holder"; the daemon's live Holder is - handed to webui at `bootstrap.go:336` and again where the dashboard - mutation path runs. - -Two further facts the PRD does not foreground but that decide the order: - -- **The Gateway is already decoupled from the store.** `main.go:139` - and `gateway/tasks.go:44` state it deliberately: gateway does **not** - import `internal/store`. It consumes narrow contracts - (`StatusReader`, `TaskCreator`, `TaskLister`, `TaskController`, - `AgentReader`) that `internal/app/archied` adapts. This is a ready seam. -- **The Gateway already owns an isolated session store.** - `internal/gateway/session_store_sqlite.go` is a _separate_ SQLite DB - (`OpenSQLiteSessionStore`, own `sqliteSessionSchema`) from - `internal/store`. Chat session/turn/message data is **already** separate - from task/work-intake data. - -### What the research says about sequencing - -The canonical guidance is Fowler / Dehghani's _How to break a Monolith -into Microservices_. Its explicit sequencing principles are: **warm up -with a simple and fairly decoupled capability**; **minimise dependency -back to the monolith**; **split sticky capabilities early**; **decouple -vertically and release the data early**; **decouple what is important to -the business and changes frequently**; **go macro first, then micro**; -**migrate in atomic evolutionary steps**. The popular-strangler-fig -commentary (YuSMP, Md Sanwar Hossain, CloudRPS) adds a pragmatic -variant: improve the monolith into a _modular monolith_ first, create a -routing facade, extract the **low-coupling / leaf / read-heavy** context -first, defer auth and the core "sticky" engines to later, and treat the -first extraction as an **operations dry-run** (build pipeline, contract -testing, observability, rollback) rather than maximising value. - -There is a real tension here. The bulk of the practitioner advice says -"extract the least-coupled leaf first." But that advice is calibrated for -large, team-owned, revenue-critical systems where a first extraction -regression is a production incident and where the team has not yet found -its seams. Two of its own authors note the counterweight: Fowler's -**"split sticky capabilities early"** explicitly warns against deferring -the tangled capability, on the theory that the longer you wait the more -sticky and expensive it becomes; and StackAuthority's blueprint sorts by -**data coupling and change velocity**, not pure ease — "order matters more -than most teams realise." - -### Why the generic "leaf first" is wrong here - -archie-core is not the enterprise monolith those guides assume. It is -already a **modular monolith with clean domain boundaries** -(`organisation.md` is enforced; `internal/domain/*` owns one cohesive -job; the six-domain split is settled). It has **no** organisational -blast-radius to protect (solo maintainer's daemon, not a payment path), -and its **actual** cost is concentrated in the process-packaging tangle, -not in undiscovered seams. It also has what the "seam-finding" guides -tell you to look for but rarely find: a capability that is **sticky and -already has a clean contract seam and already-isolated data**. - -So the deciding question is not "which is the safest to cut first?" It is -"which capability, if cut, releases the most entangled consumer and -stands up the product's primary contract?" The answer is the Gateway. - -This **confirms** the PRD hypothesis, and adds a reason the PRD did not -state: the Gateway is extractable _now_, on its own, with zero store -migration, because it is already store-decoupled and already owns its -session DB. UI is **not** extractable first — it is trapped behind the -Gateway's internals and can only become a thin client once -`ChatContract` exists. Extracting Gateway first is therefore also the -cheapest way to unblock UI (the most entangled consumer), which is the -PRD's ultimate goal. - -### Decision: the ordered phase list - -This is a **phase list** (each phase is a stable, working, independently -releasable step; it is not a task breakdown). Each phase is one "atomic -evolutionary step" per Fowler. - -**Phase 0 — Contract seams (still a modular monolith, no process split).** -Introduce, in-process, the seams that make later extraction a swap of -transport rather than a rewrite: a `ChatContract` interface owned by the -Gateway (aligning `Router`/`SessionStore`/`Turns`/`ModelManager`/ -`PersonaRegistry` behind it, so `webui` depends on the contract type, not -on the Gateway's structs); the `ServiceRegistry` interface from the -discovery research; and the State Store's already-narrow interfaces -(`TaskStore`/`CaptureStore`/`MappingStore`/`BindingStore`) ratified as the -State Store contract. **Dependency:** this is where #2's contract -definition mechanism (`proto/` tree, codegen) lands; the seam is a -prerequisite for the process split but #2 owns its mechanism. No network -hop yet — this is the "modular monolith first" safe step. - -**Phase 1 — Extract the Gateway Service (first real extraction).** -Stand up `archie-gateway` as its own binary serving `ChatContract` over -gRPC, using its existing isolated session SQLite and its existing -store-adapters. Migrate consumers (UI, and the Messaging/Telegram -task-action path) to call `ChatContract` over gRPC rather than holding -`gateway.Router` in a struct or HTTP-detouring through webui. **Why -here:** stickiest capability (everything routes through it) → Fowler's -"split sticky capabilities early"; already store-decoupled → "minimise -dependency back to the monolith" is already satisfied; highest-value -contract (the PRD calls gRPC sync the product's primary contract); and it -directly dissolves coupling #1 (Telegram→webui detour) and #2 -(webui→gateway internals) at their root. This is the operations -dry-run — prove the GCP/gRPC/discovery playbook on the thing the whole -product runs through. - -**Phase 2 — Extract the State Store Service.** -Expose `internal/store` as its own service behind its narrow contracts -over gRPC (this is the generalisation we already have the seed for — -`internal/storerpc` today proxies `store.WorkflowStore` to the agent over -NATS; see Q4). Migrate the direct store imports in `internal/webui`, -`internal/domain/workflow`, and the intake/binding paths onto the -contract. **Why here:** "release the data early" (Fowler); UI and Workflow -both read store state **directly** today, so neither can become a peer -until that path is a contract call; and it is the lowest-risk data move -because per Q4 it stays one SQLite file behind an API. Leaves a working -system: Gateway on gRPC, everything else in the monolith but reading -state via contract. - -**Phase 3 — Extract the UI Service.** -Now a genuinely thin client: serves the SPA from `ui/dist` and calls -Gateway's `ChatContract` and State Store's read contracts. The -`config.Holder` sharing and store/gateway internal access are gone. This -closes the last verified coupling (#3 — shared Holder) and the last of the -webui-entanglement list. - -**Phase 4 — Extract the Messaging Service.** -Telegram/email/webhook adapters become a peer service that calls -Gateway's `ChatContract` directly (no UI HTTP detour). Now every async -channel is a first-class peer; the webui is no longer in any message path. - -**Phase 5 — Extract Execution Environment + Runner + Scheduler.** -`internal/domain/workflow` dispatch, `internal/container/pool.go`, -`internal/agentexec`, `internal/worktree` become the Execution Environment / -Runner services (consuming State Store's `WorkflowStore` contract and the -existing container contract); `internal/domain/scheduling` + -`internal/infrastructure/cronstore` become the Scheduler. These are the -heaviest and most store-coupled, so they go last; by here the facade -(Gateway) and the data seam (State Store) are already proven. - -**Phase 6 — Curator Service (the optional one, last).** -Install as a Gateway plugin (its current shape is already a contract / -registrar / registry family) and prove the latest-order discovery path + -the optional-service `NotInstalled` semantic. This is deliberately last: -it is the proof-of-optionality and the Q5 exercise, not a load-bearing -first step. (The K8s Operator to _deploy_ it is Q5's concern and can be -built on the Q1 timeline once the base chart exists.) - -### What this doesn't settle - -- **#2 and #3.** The phase list assumes #2 (proto/codegen) and #3 - (multiplexed in-process) are resolved consistently: Phase 0 is the - modular-monolith with in-process seams, and Phase 1 is the first true - process split. If #3 decides against in-process multiplexing, Phase 0 - collapses into Phase 1 for the Gateway. -- **Whether Gateway should also host a "chat gateway" that owns the - Session Store contract** vs. delegating chat state to a future concern. - Decided _not_ to move session data into State Store here — it is already - isolated and Gateway-owned; moving it would be churn with no benefit. -- **Exact cadence / whether Curator can be extracted earlier.** It _can_, - but only as the operator/optionality exercise; keeping it last avoids - spending the "warm-up learning budget" on an optional component when the - base services are not yet on the contract. - ---- - - - -## Question #2 — Contract definition mechanism - -### The question - -Protobuf/gRPC service definitions need a home: a toolchain, a directory -layout, a versioning scheme, a committed-vs-build-time-generation call, and -codegen wiring into `Taskfile.yml` and CI. - -### Toolchain: buf v2 + protoc-gen-go + protoc-gen-go-grpc (grpc-go) - -**Decision: buf v2, driving `protoc-gen-go` and `protoc-gen-go-grpc`, -targeting grpc-go.** Raw `protoc` is rejected — it has no lint, no -breaking-change detection, and no managed mode for `go_package` paths, all -of which buf provides directly. **connect-go is rejected too**, despite -being a popular modern choice: its generated client is `net/http`-based, -and its own README states it adds "no new name resolution or load -balancing APIs." That is a direct conflict with the service-discovery -research's design, which relies on grpc-go's resolver plumbing (a custom -resolver for K8s DNS and a custom resolver reading the NATS JetStream KV -registry — see `docs/inspiration/service-discovery-research-2026-09-05.md` -and the `ServiceRegistry` interface at -`internal/servicediscovery/servicediscovery.go:72`). connect-go would push -K8s discovery onto `bufbuild/httplb` plus headless-Service DNS instead of -grpc-go's resolver, which is a second discovery mechanism this repo does -not want. `google.golang.org/grpc` becomes a direct dependency; today -`go.mod:59` carries only `google.golang.org/protobuf v1.36.10 // indirect`. - -### Layout: one committed `proto//v1/` tree, generated code committed to `internal/contracts/` - -**Decision: a single top-level `proto/` tree**, one buf module, laid out as -`proto//v1/*.proto` — per-service buf modules were considered and -rejected as unnecessary ceremony at this scale (~7 services, one repo, one -maintainer). The directory name is the canonical service name and must -match the registry/DNS/chart name used elsewhere (`ServiceRegistry`, -Helm chart service names). Generated Go is **committed** at -`internal/contracts//v1/`, produced via buf's managed mode -(`go_package_prefix`) plus `paths=source_relative`. This satisfies -`docs/architecture/dependencies-and-contracts.md:55`'s "Wire contracts and -generation" rule — wire contracts are partitioned per owning domain, never -centralised in a generic schema package. - -### Versioning: directory versioning, enforced by `buf breaking` - -**Decision: directory versioning** (`v1`, Go package `.v1`). A -breaking change gets a new `vN` directory; a published version is never -edited in place. Enforcement is `buf breaking --against -'.git#branch=main,subdir=proto'` wired into the gate. This was verified -against a real git ref in a scratch toolchain run (see Evidence below): it -correctly flagged a deleted RPC, a renamed field, and a field deletion, -exiting 100. - -### Committed vs. build-time generation: committed - -**Decision: commit the generated Go**, with a regenerate-and-diff-fail -freshness check in CI, following the existing "generated assets are LAW" -precedent (`ui/dist`, `task ui`, per `AGENTS.md`) and the committed Yaegi -`*extract` tables (`internal/domain/workflow/wfextract/wfextract.go`). -This keeps `task build` / `task test` hermetic — neither ever invokes -`buf` — while still catching drift between `.proto` sources and checked-in -Go via a `git diff --exit-code` step. - -### Taskfile / CI wiring - -New `task proto:generate`, `task proto:lint`, and `task proto:check` -(regenerate, then `git diff --exit-code -- internal/contracts`) tasks, -inserted into `task check` after `go fix ./...` and before `vet`/`lint`/ -`build`. This **must also be mirrored into -`.github/workflows/deploy.yml`'s "Quality gate" step** — CI does not -invoke `task check` today; it runs `gofumpt`, `go fix`, `vet`, `build`, and -`test` directly, so the proto gate needs the same direct treatment or it -will silently never run in CI. A shallow checkout (the default `actions/ -checkout` behaviour) breaks `buf breaking --against` because there is no -local `main` ref to diff against; CI needs `fetch-depth: 0` or an explicit -`git fetch origin main` step. - -### What this doesn't settle - -- **Per-plugin/toolchain version pinning for CI.** The repo currently does - `go install ...@latest` for `gofumpt`; whether `buf` and the protoc - plugins get the same treatment or pinned versions is an implementation - detail for whoever wires the Taskfile/CI entries, not a design decision. -- **Whether a headless/SRV Service variant changes anything about the - generated Go.** It doesn't — the wire contract is transport-agnostic; - discovery is a separate concern owned by `ServiceRegistry`. - ---- - - - -## Question #3 — In-process vs. out-of-process during migration - -### The question - -Whether services can run multiplexed inside one binary behind the same -contract during a transition period (so extraction is incremental and -testable), or whether each service must be a separate binary from day one. - -### Decision: multiplexed in-process is the migration default — this is the architecture's stated default, not a lean - -`docs/architecture/organisation.md:70-77` ("Process boundaries") already -states this as policy, verbatim: "Archie begins as a modular monolith even -when capabilities run in separate processes. A domain becomes a separately -deployed service only for a concrete need such as security isolation, -independent scaling, failure containment, or independent operation. -Possible future extraction does not justify premature network protocols or -duplicated service scaffolding." Question #3 asks whether to follow that -rule for this migration; the answer is yes, and it was already decided -architecture-wide. - -### Mechanism (six parts) - -1. **Wire-safe Go contract interfaces.** Each per-service contract is a - plain Go interface whose method signatures could cross the wire as-is: - values and streams only. No callbacks (e.g. Gateway's - `LLMStreamResponder`), no `*sql.Tx`, no object identity leaking through - the interface. If a type can't become a proto message, it can't appear - in the contract signature. -2. **Two adapters per contract.** A **local adapter** (in-process, calls - straight through, zero serialisation — not a test fake, a real - production adapter) and a **generated gRPC client adapter**. Both - satisfy the same interface, verified with a compile-time assertion in - the existing repo idiom: `var _ store.WorkflowStore = (*Client)(nil)` - (`internal/storerpc/storerpc.go:136`). The one-contract-two-transports - shape is already in production today for the agent container over NATS - (`internal/storerpc`, `internal/forgerpc`, `internal/worktreerpc`, wired - at `internal/infrastructure/agenttransport/nats/transport.go:101,111`). -3. **Composition chooses; `ServiceRegistry` stays network-only.** - `ServiceRegistry.Resolve` never returns an in-process shim — a linked, - in-process service is not in the registry at all. The registry models - the network view only; `internal/app` composition wiring is the local - view. Reasons: registry implementations should only ever observe real - endpoints; `ErrNotInstalled` is an installability semantic - (`internal/servicediscovery/servicediscovery.go:8-14`) that cannot - arise for a module that's simply linked into the binary; and having one - authoritative selection path (composition, not a registry call) - eliminates a class of mixed-mode races. Concretely: a per-service - `mode = "inproc" | "remote"` config value, defaulting to `inproc`. -4. **Per-contract conformance suite.** Reuse the existing conformance-test - idiom — `runSessionStoreSuite(t, newStore func(t *testing.T) -SessionStore)` at `internal/gateway/sessionstore_conformance_test.go:65` - — and run it against both the local adapter and a real gRPC server over - `bufconn`. This is the "always test the wire shape" discipline, kept for - tests only; production traffic in `inproc` mode never touches gRPC. -5. **The flip trigger is the service's own extraction phase**, not a - separate migration step: a new `cmd/archie-` binary plus a - same-commit deletion of the in-process serving path, with consumers - flipped to `mode = "remote"` in that same commit. One commit, one - authoritative implementation, no dual-live window. A Fowler-style - dual-live cutover (old and new both serving, gradually shifted traffic) - was considered and rejected at this scale: with two consumers in one - repo and one release cadence, a dual-live window buys nothing but drift - risk, concentrated exactly where the PRD's verified couplings already - are. Rollback is a release-level revert — an accepted, honest trade for - a solo maintainer, not a gap. -6. **Failure semantics.** In `inproc` mode there is nothing new to reason - about — a direct call either succeeds or panics like any other in- - process call. In `remote` mode, a dial failure fails fast; per - `ServiceRegistry`'s existing doc comment, - `ErrNotInstalled` means "disabled," never "broken," for optional - services (mirrors `internal/installtype/installtype.go`'s existing - precedent that deployment-shape facts are baked/stated, not - runtime-probed). - -### Consequence for the resolved extraction order (Gateway first) - -This directly satisfies Q1's Phase 0 dependency (see "What this doesn't -settle" under Question #1, above): Phase 0 — introducing the `ChatContract` -seam, its local adapter, the `.proto` definition, and the bufconn -conformance suite — ships as an in-process module first, with nothing -listening on a TCP port; the network protocol stays out of the production -path until Phase 1. Phase 1 (extracting the Gateway) then becomes a wiring -change only: add `cmd/archie-gateway`, delete the in-process serving path, -flip `mode` to `remote` for its consumers. No amendment to Q1's phase list -was needed — Q1 already anticipated exactly this shape. - -### What this doesn't settle - -- **Whether `mode` is a per-service config value or a build tag.** Decided - here as runtime config (`mode = "inproc" | "remote"`), consistent with - `internal/installtype`'s precedent of stating deployment shape rather - than probing for it; a compile-time split was not considered necessary. -- **The exact bufconn test harness plumbing.** Follows the existing - `runSessionStoreSuite` idiom; the concrete harness is an implementation - detail for whoever lands the first contract (Gateway's `ChatContract`). - -### Sources used for Q2 and Q3 - -- `google.golang.org/protobuf v1.36.10 // indirect` — `go.mod:59` (today's - only proto-adjacent dependency; confirms grpc-go is not yet a direct - dependency). -- `docs/architecture/organisation.md:70-77` — "Process boundaries" (the - architecture's standing, Approved answer for #3). -- `docs/architecture/dependencies-and-contracts.md:55` — "Wire contracts - and generation" (per-domain ownership of wire contracts; no generic - schema package). -- `internal/servicediscovery/servicediscovery.go:8-14,71-81` — - `ErrNotInstalled` semantics and the `ServiceRegistry` interface. -- `internal/storerpc/storerpc.go:136` — `var _ store.WorkflowStore = -(*Client)(nil)`, the compile-time contract-conformance idiom reused for - the local/remote adapter pair; `internal/forgerpc`, `internal/worktreerpc`, - and `internal/infrastructure/agenttransport/nats/transport.go:101,111` - as the existing one-contract-two-transports precedent in production. -- `internal/gateway/sessionstore_conformance_test.go:65` — - `runSessionStoreSuite`, the conformance-test idiom reused for - local-vs-remote adapter testing. -- `internal/webui/api_chat.go:22-26` — `ChatService`'s struct fields - (`Router *gateway.Router`, `Sessions gateway.SessionStore`, `Turns -*gateway.Turns`, `Models gateway.ModelManager`, `Personas -*gateway.PersonaRegistry`) — the concrete seam Q2/Q3's `ChatContract` - needs to cross. -- `internal/installtype/installtype.go` — precedent that deployment-shape - facts are stated config, never runtime-probed. -- AGENTS.md "Generated assets are LAW" (`ui/dist`, `task ui`); Yaegi - `*extract` tables with post-generation guard tests - (`internal/domain/workflow/wfextract/wfextract.go`) — precedent for - committing generated code. -- `Taskfile.yml` `check:` target vs. `.github/workflows/deploy.yml` - "Quality gate" step — confirms CI does not invoke `task check` and so - needs the proto gate mirrored in directly. -- buf/grpc-go vs. connect-go comparison: connect-go's own README states it - adds "no new name resolution or load balancing APIs" — the deciding fact - against it, given the discovery research's reliance on grpc-go resolver - plumbing. -- Scratch toolchain verification (run inside a disposable worktree, - discarded at teardown; not committed): `buf --version` → 1.71.0; - `protoc --version` → libprotoc 34.0. `buf lint` on a sample - `proto/gateway/v1/chat.proto` (package `gateway.v1`, service - `ChatService`) passed once request/response types followed the - `XRequest`/`XResponse` naming buf's STANDARD lint enforces. `buf -generate` (v2, managed `go_package_prefix`, `paths=source_relative`) - produced `chat.pb.go` (206 lines) and `chat_grpc.pb.go` (121 lines), - which compiled cleanly against `google.golang.org/grpc v1.83.2` in a - scratch module. `buf breaking --against -'.git#branch=main,subdir=.'` after deleting an RPC and renaming a field - correctly reported "Previously present RPC Send deleted," "field 2 user - deleted," "field 3 changed name," exit 100 — confirming the mechanism - works against a real git ref. A parallel connect-go run (installing - `protoc-gen-connect-go` v1.19.1; note the `github.com/connectrpc/ -connect-go` module path is dead, use `connectrpc.com/connect`) generated - a sibling `net/http`-based package, confirming the resolver-plumbing gap - cited above. `gofumpt -l` on the freshly generated output was clean, so - `task fmt`'s `gofumpt -w .` won't fight regenerated code. - ---- - -## Question #4 — State Store's contract shape - -### The question - -Does every extracted service get its **own storage** (full microservice -data isolation), or do **several services share one State Store service's -contract** (less isolation, less migration risk, avoids a -distributed-transactions problem)? - -### Codebase evidence - -- **`internal/store` is one SQLite DB** (`internal/store/store.go`, - `Open()`, `sqliteDSN()`, WAL + busy_timeout pragmas) with 7 tables: - `tasks`, `transitions` (workflow execution), `events` (observability), - `captured_events`, `bindings`, `binding_dispatches` (work intake / - binding), `field_mappings` (mapping). It is a single file used by many - domains. -- **The store is already interface-decomposed, not monolith-shaped.** - `internal/store/interface.go` splits a broad `TaskStore` into narrow - contracts: `TaskStore`, `WorkflowStore`, `CaptureStore`, `MappingStore`, - `BindingStore`, `BindingDispatcher`, `BindingTaskCreator`. Each is - deliberately narrow ("the interfacebloat limit"). -- **A store-as-contract-to-foreign-process pattern already exists and - works.** `internal/storerpc/storerpc.go` exposes `store.WorkflowStore` - (Update / Transition / InsertEvent) to the `archie-agent` container over - NATS request/reply, and its doc comment states the design fact: "archied - remains the sole owner of the `store.TaskStore`." This is the exact shape - the State Store service needs; it just needs to be generalised from - `WorkflowStore` to the full contract set and moved to the sync (gRPC) - transport. -- **The Gateway already owns a separate session SQLite.** As noted in Q1, - `internal/gateway/session_store_sqlite.go` is its own DB with its own - schema. So session/chat state is **already** isolated from task/work - state — the natural two-owner split is already present in code. - -### Does "every service its own storage" buy anything here? - -The research (microservices.io, Microsoft Learn data-sovereignty, AWS -Prescriptive Guidance) is emphatic that the database-per-service pattern is -**about ownership and enforcement, not about physically provisioning one -database cluster per service.** microservices.io names three ways to keep a -service's data private — _private-tables-per-service_, -_schema-per-service_, and _database-server-per-service_ — and says the -first two have "the lowest overhead," and that a shared MySQL instance with -per-service logical databases and per-service credentials is a legitimate -instance of the pattern. Microsoft's guidance and the ownership-over- -isolation posts (Progressive Robot, DEV's Aditya Pradhan, aakashx) make -the same point with a shared framing: **shared write ownership is the real -danger, not shared physical infrastructure.** aakashx's maturity ladder -(Level 0 shared-DB+shared-tables → Level 3 service-owned DBs → Level 5 -independent lifecycle) is precisely the "ownership first, physical split -only when justified" path. - -The decisive variable everywhere is **team topology**, not technology. -DevStarSJ's 2026 comparison gives the rule of thumb: 1–5 engineers → -shared DB (monolith is fine); 5–20 → shared DB with strict ownership -boundaries; 20–50 → hybrid; 50+ → database per service. The argument, -across all sources, is that database-per-service's _benefits_ are team -autonomy, independent deploy cadence, and failure blast-radius isolation — -three things that are **largely absent for a solo maintainer**. You still -pay the full "distributed data tax" (no cross-service joins → sagas or -CDC/outbox + read models; eventual consistency; more data stores to -operate and back up; a new class of ordering/duplicate events). For a -single person shipping one product, that tax buys autonomy you do not -have a team boundary to exploit. - -### Decision: one State Store service, single SQLite, narrow contracts, no physical per-service database - -**Recommendation:** archie-core keeps **one State Store service** that -owns the existing single SQLite file and exposes its **narrow typed -contracts** (`TaskStore`, `CaptureStore`, `MappingStore`, `BindingStore`, -`WorkflowStore`, …) over gRPC. Consumers (UI, Workflow, Work Intake, -Execution/Runner) call the State Store's contract; they never reach into -each other's tables — and because there is **still one store**, there is -**no distributed-transactions problem** (the very thing the question's -"share one contract" alternative is trying to avoid). The Gateway keeps -its own already-separate session SQLite (it is Gateway-private chat state -and already isolated; moving it is churn). - -This is "less isolation, less migration risk" chosen deliberately — it is -the _honest_ choice for a solo maintainer per the team-topology rule of -thumb, and it matches the store's existing interface decomposition (the -ownership is already correct — the _enforcement_ is the gap: webui and -workflow import `internal/store` directly across a would-be service -boundary). - -**Do NOT provision a physical database per service.** The only parts of -the PRD's "every service its own storage" framing that buy anything at -this scale are the ones that are already true in code: the Gateway owns -its session DB, and the interface split gives each domain a narrow -contract. Splitting the remaining SQLite file into per-service files -would introduce the distributed-data tax — cross-store joins for the -dashboard's combined task/event/capture views, sagas for intake→workflow -transitions, m×n data-store operations — with no corresponding autonomy -gain for a single maintainer. It is also the single most common source of -a _distributed monolith_, which the sources call the failure mode to -avoid. - -### Concrete migration path from the current single SQLite store - -1. **Ratify the contracts (cheap, already done).** Treat the narrow - interfaces in `internal/store/interface.go` as the State Store - contract surface. No code change; this is a naming/authority decision. -2. **Generalise the store surrogate — this is the step that becomes the - State Store service.** `internal/storerpc` currently proxies - `WorkflowStore` to the agent over NATS. Broaden it to serve the full - narrow contract set, and (per the PRD, gRPC is the sync transport) move - it from NATS request/reply to gRPC. The `archie-agent` / `storerpc.Client` - that satisfies `store.WorkflowStore` is the template for the client - every consumer gets. -3. **Swap consumers one contract at a time from direct import to the - contract call.** Order by blast radius: start with the low-touch reads - (`CaptureStore`, `MappingStore`, `BindingStore`) that a single UI - screen uses, then `WorkflowStore` (already proxied), then the - `TaskStore` lifecycle surface the daemon uses. Each swap leaves a - working binary because the in-process `*store.Store` still backs the - contract — this is a pure interface-boundary change, not a data move. -4. **Stand up the State Store process.** Once every consumer speaks the - contract, run `internal/store` as `archie-state-store` (a gRPC server - over the same SQLite file), and delete the in-process imports. The - single `archie.db` file is unchanged; only the access path changes. -5. **Only split the file if a concrete need appears.** If task-history - volume or a specific isolation/security requirement (e.g. a hosted - multi-tenant boundary) later justifies it, SQLite makes a per-domain - physical split cheap (one file per contract group, e.g. - `archie-tasks.db`, `archie-intake.db`). But do **not** pre-split: the - sources' consensus is to migrate toward physical separation "only when - there is evidence (slow queries, deployment coupling, scaling - bottlenecks)." - -### What this doesn't settle - -- **Cross-store reads for reporting.** The dashboard's combined - task/event/capture/mapping views are built in one SQLite today. If - those are split later, they need an API-composition / read-model path - (the sources name CQRS / materialised view). Not a blocker now; it is - the cost of a future physical split, which is exactly why the - recommendation is to not pre-split. -- **Whether the Gateway's session store stays Gateway-owned or moves to - State Store.** Decided: stays Gateway-owned (already isolated, high - -frequency chat state; moving it has no benefit). -- **The exact gRPC contract schema / versioning.** That is #2's - mechanism. The contract _surface_ is decided here; the wire schema is - not. -- **Migration of the `storerpc` NATS path.** The `archie-agent` container - still calls `storerpc` today. Under the PRD the Execution/Runner - processes are peers too, so the agent's store access should eventually - use the same contract. When that moves is an Execution-track question, - not a State-Store-shape one. - ---- - -## Question #5 — Helm chart / Operator scoping - -### The question - -`service-discovery-research-2026-09-05.md` already commits to -Kubernetes-native discovery via a Helm chart + Operator as the primary -path. Scope what that actually requires as a first real deliverable: what -a first Helm chart for the ~7-service fleet needs to contain, what the -Curator Operator's reconciliation loop needs to do, and the smallest real -first milestone that proves "install Curator, Gateway discovers it" end -to end. - -### What the base Kubernetes discovery needs (from the discovery research) - -The discovery research's Path A (K8s-native) flow is the contract our -deliverable has to satisfy: base services deploy as Deployment + Service; -a Service's label selector matches the Curator pods; the endpoint -controller writes pod IPs into an EndpointSlice; readiness probes gate -which pods are ready; CoreDNS serves `curator..svc.cluster.local`; the -Gateway's gRPC DNS resolver picks up the new endpoint on re-resolution -with no redeploy; removal empties the EndpointSlice and the record -disappears. Two facts shape the chart design: - -1. **Optional service semantics.** A scaled-to-zero / not-yet-created - Curator must resolve to `NotInstalled`, not `Down`. Under K8s that - comes from DNS `NXDOMAIN`/empty resolution being treated as "absent," - which requires the Gateway to model "absent" as a distinct resolution - outcome on the `ServiceRegistry` interface (already flagged in the - research's addendum). -2. **Chart count.** Seven services is too many for one monolithic - template and too few to justify seven charts. The idiomatic Helm - answer is a **library chart** for the shared contract templates plus - small per-deployable charts. - -### Decision: three charts (library + core services + Curator-with-Operator) - -- **`archie-library`** — a Helm **library chart** (`type: library`, - only `_*.tpl` files). Holds the shared resource templates: the - Deployment template, the Service template, readiness/liveness probe - helper, container-port naming, the label/selector block - (`app.kubernetes.io/name`, `instance`, `managed-by`, `component`), and - the `ServiceRegistry`-relevant named ports (`grpc`, `http`, `ssr`, - `nats`). This keeps the per-service charts declarative and consistent. -- **`archie`** — the chart for the **7 core services**: UI, Gateway, - Messaging, Scheduler, Execution Environment, Runner, State Store. One - `values.yaml` with a `services:` map; each service resolves to a small - template from the library chart. It also lands the base **ConfigMaps - / Secrets** that replace `config.toml` (a phased concern flagged in the - discovery research — the chart should _reference_ config as a separate - concern, not block on relocating it). It must make each service's - `Service` a **named-port** Service so gRPC resolution works, and each - a **ClusterIP** Service (no headless needed for the base sync path; a - headless/SRV Service is an optional addition the Gateway resolver can - consume but is not required for the DNS A-record flow). -- **`archie-curator`** — the chart for the **optional Curator**, plus the - **Curator Operator**. Operator chart installs the CRD, the - controller Deployment (with the ServiceAccount / ClusterRole / - ClusterRoleBinding the reconciler needs), and the RBAC markers; the - Curator chart installs the sample `Curator` CR. Because Curator is - optional, this chart is **not** deployed by default with `archie` — the - whole point is that a customer installs it later and the fleet - auto-aligns. - -### What the Curator Operator's reconcile loop actually needs to do - -This is a textbook Kubebuilder / Operator-SDK controller. The reconcile -loop (per the Kubebuilder book and the multi-resource reconciliation -pattern) is **level-triggered, not status-triggered**: it must always -converge the _whole_ desired set, never react to a specific event. Per -`Curator` CR, the loop: - -1. **Fetch the CR.** `r.Get(ctx, req.NamespacedName, &curator)`; treat - `IsNotFound` as a normal "already deleted" outcome (owner references - cascade child cleanup), not an error. -2. **Build the desired children.** Pure builder functions - (`deploymentForCurator`, `serviceForCurator`) produce the Deployment - (image, replicas, container port, readiness/liveness probes, - `app.kubernetes.io/{name,instance,managed-by,component}` labels, env - from a ConfigMap/Secret generated in the same pass) and the Service - (label-selector matching the Deployment pods, the gRPC named port). -3. **Set owner references** with `controllerutil.SetControllerReference` - so deleting the `Curator` CR cascades to its Deployment + Service. -4. **Apply idempotently** with `controllerutil.CreateOrUpdate` (or - Server-Side Apply) — create if absent, patch toward desired if - drifted; a manual `kubectl edit` on the Deployment is corrected on the - next reconcile. -5. **Watch the children** via `Owns(&appsv1.Deployment{})` and - `Owns(&corev1.Service{})` in `SetupWithManager`, so a pod crash or an - out-of-band edit enqueues a reconcile of the owning Curator CR. Without - `Owns()`, drift correction does not fire. -6. **Report status** on the status subresource (the - `+kubebuilder:object:root`/`subresource:status` marker): set a `Ready` - condition (via `meta.SetStatusCondition` with `ObservedGeneration`, - and never hand-set `LastTransitionTime`), reflecting the worst child's - readiness, and update only when `Status` changed. This is what the - Gateway (or an operator/`kubectl wait --for=condition=Ready`) observes. -7. **RBAC** via Kubebuilder markers: full verbs on `curators` and - `curators/status`, plus `get;list;watch;create;update;patch;delete` on - `deployments` and `services`. - -The reconciler stays a flat, dependency-ordered sequence (Deployment -before Service is not strictly required here, but the pattern is -dependency-first and idempotent-across-orders). - -### The smallest real first milestone ("install Curator → Gateway discovers it") - -Keep the first milestone as small as possible while proving the whole -flow through the `ServiceRegistry` — this is the "warm up on an optional -thing with a clean seam" exercise (and it is exactly what the discovery -research calls the product story). Concretely: - -**Milestone M1 — "Curator installs and Gateway resolves it, no redeploy."** - -- **CRD + Operator:** a `Curator` CRD and a controller that reconciles - one Curator CR into one Deployment + one Service with owner references - and a `Ready` status condition. (This is the whole operator; it is two - files at its core — the API type and the reconciler.) -- **Base chart:** `helm install archie` deploys Gateway + one - representative base service (start with Gateway + State Store + UI) - behind the `ServiceRegistry`, with Gateway holding a resolver that - already knows `curator`. -- **Curator chart:** `helm install archie-curator` (or `kubectl apply -f` - a `Curator` CR) → the Operator creates the Deployment + `curator` - Service → the endpoint controller writes the pod IP into the - EndpointSlice → CoreDNS serves `curator` → the Gateway's resolver picks - it up on re-resolution. -- **Assertion (the real "prove it"):** the Gateway logs / health shows - `curator` flipping from `NotInstalled` to `Installed(Requesting)` - (ready), and a Gateway-config or Gateway-restart is **not** required. Then - `helm uninstall archie-curator` (or delete the CR) → EndpointSlice - empties → DNS record goes away → Gateway drops `curator` back to - `NotInstalled`. No Gateway redeploy, no code change. - -This milestone deliberately does **not** include: config relocation from -`config.toml` to ConfigMaps/Secrets (a separate phased concern), the -NATS-fallback `ServiceRegistry` implementation (can be stubbed with a -static map for the assertion), auth/mTLS/NetworkPolicy, or the full 7 -services. It proves the one hard requirement — "install a service, the -fleet auto-aligns, no redeploy" — and the optional-service `NotInstalled` -semantic, with the smallest surface. - -**What beads-epic + first issues would look like** (filing this directly -from here, as the task asks): - -- Epic: `archie-core-k8s` (or the codename already in use) — "K8s-native - service discovery: base Helm chart + Curator Operator proving the - install→discover flow." -- Issue 1: Scaffold the Kubebuilder project and the `Curator` API - (`group: archie.samcharles93.io`, `v1alpha1`), CRD, RBAC markers. -- Issue 2: Implement the `Curator` reconciler (create/update/delete - Deployment + Service, owner refs, `Ready` status condition). -- Issue 3: Create `archie-library` chart with the shared Deployment / - Service templates and named-ports. -- Issue 4: Create `archie` chart deploying Gateway + State Store + UI - with per-service `ServiceRegistry`-friendly Services. -- Issue 5: Wire the Gateway's `ServiceRegistry` K8s implementation - (DNS resolver) to model `NotInstalled` distinctly from `Down/Unhealthy` - (the research's addendum requirement). -- Issue 6: End-to-end M1 assertion (install Curator CR → Gateway resolves - it → uninstall → Gateway drops it), likely as an envtest / kind test. - -### Sources used for Q5 - -- Kubebuilder Book — [Getting Started](https://www.kubebuilder.io/getting-started.html), - [Resources Managed by the Operator](https://book-v3.book.kubebuilder.io/reference/watching-resources/operator-managed), - [Owned Resources](https://kubebuilder.io/reference/watching-resources/secondary-owned-resources) - (for the reconcile loop, `Owns()`, owner references, status subresource, - RBAC markers). -- DEV Community — [Building Your First Kubernetes Operator with - Kubebuilder](https://dev.to/tim_derzhavets/building-your-first-kubernetes-operator-with-kubebuilder-from-zero-to-production-4ipm) - and [GoLinuxCloud — Kubernetes Operator Multi-Resource Reconciliation - Patterns](https://www.golinuxcloud.com/multi-resource-reconciliation/) - (level-triggered reconcile, idempotent `CreateOrUpdate`, dependency - order, per-child status aggregation). -- Helm — [Charts](https://helm.sh/docs/topics/charts/) (the chart file - structure; `Chart.yaml`; template dirs; the library-chart use of - `_*.tpl` and `type: library`). - -### What this doesn't settle - -- **Config relocation.** The charts reference ConfigMaps/Secrets but the - actual move of `config.toml` semantics into them is its own - phased decision (flagged in the discovery research) and is out of scope - for the first milestone. The base chart should degrade gracefully with - an in-cluster config so M1 works before the relocation is done. -- **The NATS-fallback `ServiceRegistry` implementation.** M1 uses a K8s - DNS resolver; the NATS KV implementation is a later, separate issue. -- **Auth / mTLS / NetworkPolicy / cert-manager.** Called out as a - separate concern in the discovery research; not in the first milestone. -- **Operator SDK vs raw Kubebuilder/controller-runtime.** The loop is - identical; the choice of kubebuilder scaffolding vs. Operator SDK is a - tooling preference that does not change the M1 scope. Kubebuilder is the - documented norm and is assumed here. -- **Whether the Operator should manage the _base_ services too.** The - first milestone only has an Operator for Curator (the optional one). - A "fleet Operator" that reconciles all services is a larger, later - idea; the base services can be plain chart templates for now. - ---- - -## Sources (primary, fetched during this pass) - -- Zhamak Dehghani, _How to break a Monolith into Microservices_ (Martin - Fowler site) — https://martinfowler.com/articles/break-monolith-into-microservices.html -- microservices.io, _Pattern: Database per service_ — - https://microservices.io/patterns/data/database-per-service.html -- Microsoft Learn, _.NET microservices: Data sovereignty per microservice_ — - https://learn.microsoft.com/en-us/dotnet/architecture/microservices/architect-microservice-container-applications/data-sovereignty-per-microservice -- Kubebuilder Book, _Getting Started_ — - https://www.kubebuilder.io/getting-started.html -- Kubebuilder Book, _Resources Managed by the Operator_ — - https://book-v3.book.kubebuilder.io/reference/watching-resources/operator-managed -- Kubebuilder Book, _Owned Resources_ — - https://kubebuilder.io/reference/watching-resources/secondary-owned-resources -- Helm, _Charts_ — https://helm.sh/docs/topics/charts/ -- (Supporting synthesis from the deep-search lanes: YuSMP strangler-fig - guide, Md Sanwar Hossain strangler-fig, CloudRPS strangler-fig, - Mobisoft first-microservice-to-extract, StackAuthority - monolith-to-services blueprint, DevStarSJ database-per-service-vs-shared - 2026, Progressive Robot / DEV Aditya Pradhan database-per-service - ownership-not-isolation, aakashx database ownership in microservices, - AWS Prescriptive Guidance data persistence, DEV Tim Derzhavets building - a Kubebuilder operator, GoLinuxCloud operator SDK tutorial and - multi-resource reconciliation, Codelooru how to write a Kubernetes - operator. These consulted sources corroborate the primary texts; the - primary texts are cited for the load-bearing claims.) - -Code evidence cited throughout is the archie-core tree at the time of -writing (see the file list at the top of this document). diff --git a/docs/inspiration/service-discovery-research-2026-09-05.md b/docs/inspiration/service-discovery-research-2026-09-05.md deleted file mode 100644 index 1975c3c84..000000000 --- a/docs/inspiration/service-discovery-research-2026-09-05.md +++ /dev/null @@ -1,291 +0,0 @@ -# Service discovery research for the archie-core service decomposition - -Status: exploratory research, not a settled decision. This backs the "ideal -state" service-oriented sketch in -[[module-reference-awx-decomposition-vs-archie]] and its two Archify diagrams -(`/work/artefacts/archie-core-current-state-archify.html`, -`/work/artefacts/archie-core-ideal-state-archify.html`). Nothing here commits -the codebase to anything; if the service decomposition itself gets approved, -this is the input to the actual `docs/architecture/migration-decisions.md` entry -and/or a `docs/prds/` design doc, not a substitute for either. - -Produced by an external research pass (Pi subagents plus supervisor-run -`deep_search_exa` queries against primary sources: NATS discovery, K8s-native -discovery, Consul operational footprint, gRPC/xDS/mesh weight). The K8s lane -detached mid-flight and was recovered via supervisor reply, covered from fetched -Kubernetes docs (Service/EndpointSlice/CoreDNS/Operator + k3s Helm). Reproduced -here close to verbatim as the record of that research; light formatting only. - -Business framing this research was scoped against, per Sam (2026-09-05): the -decomposition is being evaluated as a real product distribution strategy — -possibly sold self-hosted, possibly as a managed/hosted offering (the -RHEL/Ansible Automation Platform model: same product, sold both ways), not ruled -to either shape. Evaluate infrastructure choices on technical merit for that -audience, not through the lens of Sam's own homelab deployment preferences (see -`feedback_dont_project_homelab_prefs_onto_product` in Claude's project memory). -"Cost" in this document means operational complexity, never dollar price — -pricing and SaaS-plan questions are explicitly out of scope here. - ---- - -## 1. Candidate mechanisms - -| # | Mechanism | Who stands it up | Health-aware endpoints? | "Install → auto-join" mechanics | Single-host fit | Multi-host fit | -| --- | -------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------ | -| 1 | **Kubernetes-native** (Service + EndpointSlice + CoreDNS), delivered via Helm chart + Operator, on k3s (single-node) or a real cluster | A whole (even if small) control plane: api-server, etcd, scheduler, controller-manager, CoreDNS, kube-proxy. k3s packages this into a ~one-command install | Yes, free — readiness probes gate which pods land in an EndpointSlice | Deploy/helm install a Service (or an Operator reconciles a CR) → CoreDNS serves the name → existing services dial it | Strong (k3s is ~½ GB RAM) | Good (real cluster, or k3s server+agents) | -| 2 | **NATS-based discovery** (micro `$SRV` announce + JetStream KV registry) | NATS broker — already a hard dependency, so nothing new to stand up | No — only connection liveness; you write heartbeat+TTL for KV | Service connects to the bus on start, publishes/announces → peers observe the join | Excellent | Workable but requires a real NATS cluster / leaf nodes (TLS/NKey/JWT weight) | -| 3 | **Consul** (registry + agent + DNS) | A second control plane: 3–5 Raft servers + a client agent on every node | Yes (TCP/HTTP/gRPC/TTL) | Agent registers with server; peers resolve via Consul DNS | OK (one server + agents) | Good (multi-DC, WAN federation) but per-node agent burden | -| 4 | **etcd** (discovery substrate) | A Raft KV cluster you operate | Not natively — you own catalogue/health semantics | Lease registration + prefix watch | OK (embeddable) | Good (R3 replication) but you build the semantics | -| 5 | **gRPC xDS / service mesh** (Istio/Linkerd/Traffic Director, proxyless gRPC) | A control plane (+ per-pod sidecar if mesh) | Yes (xDS health) | Register with control plane → EDS pushed to subscribed clients | Heavy / overkill | Heavy; K8s-first; sidecar cost (~0.2 vCPU + 60 MB/pod @1k rps in Istio-sidecar-land) | -| 6 | **DNS-SRV / mDNS** | Nothing new | No native health; TTL caching breaks fast failover | Register a record | mDNS yes (but link-local); DNS-SRV needs a resolver you control | mDNS fails at the first router/VLAN; DNS-SRV needs your own resolver + a custom gRPC resolver (grpc-go doesn't consume SRV natively) | - -## 2. What this narrows to - -Six candidates surfaced, but the field collapses to two real finalists once -three filters specific to archie-core apply: (a) the fleet is ~7 Go services, -(b) a gRPC-sync + NATS-async mix is already the working assumption, and (c) the -defining requirement is "customer installs a service, the fleet auto-aligns, no -redeploy/reconfig." - -- **Consul / etcd are dominated by K8s-native.** Consul adds a whole second - control plane (Raft server quorum + a client agent on every node you don't - control) — redundant if the fleet lives in K8s (buying a second control plane - to replace one you already have), heavy if it doesn't. etcd makes you own - catalogue + health semantics, which is exactly what K8s-native and NATS each - give for free in different ways. Both remain viable, just not better. -- **gRPC xDS / service mesh is the wrong tool at this scale.** Field consensus - (multiple 2026 sources): don't adopt a mesh until 20+ services; archie-core is - at ~7, single-language (Go), with resilience logic already in Go. - xDS/proxyless-gRPC earns its keep only with locality-aware routing / canary / - circuit-breaking across hosts, which nothing here signals. The durable - takeaway isn't "use xDS"; it's that gRPC is resolver plumbing, not a registry - — whatever registry gets picked feeds gRPC through a resolver (DNS resolver, - or a custom one). -- **DNS-SRV / mDNS are insufficient.** mDNS is link-local (dies at - router/VLAN/container boundaries), so it can't span routed multi-host; DNS-SRV - has no health and grpc-go's default resolver doesn't consume SRV natively - anyway. - -So the genuine decision is K8s-native vs. reuse-NATS. - -## 3. K8s-native vs. NATS: an honest weigh - -**Where K8s-native wins decisively:** - -- The only mechanism that delivers "install a service → the fleet auto-aligns" - at the infrastructure layer, with health-filtered endpoints, where the - customer's install is a straightforward "apply a Deployment + Service" (or a - Helm chart, or an Operator reconciling a CR). This is the single hardest, most - product-defining requirement, and K8s solves it natively. -- Delivers, as a side effect, almost everything a 7-service fleet needs anyway: - health (readiness/liveness probes), orchestration (restart/scale), config - (ConfigMaps/Secrets), rollouts, clean external exposure (Ingress/Gateway). Not - extra weight for its own sake — buying pieces that would otherwise be - hand-built. -- The hosted/managed path is free. If the product is ever run for customers (the - "sold both ways" shape kept open above), K8s runs anyway. K8s-native discovery - makes self-hosted and hosted deployments use identical discovery semantics — - one codebase, no divergence. This is the RHEL/Ansible Automation Platform - lesson: same product, sold both ways, same internal architecture. - -**Where NATS wins:** - -- Zero new infrastructure. NATS is already a hard dependency and already in the - deployment (embedded, or the existing `docker-nats-stack.toml`). For the - lowest-end single-host customer who wants "one binary dropped on a box," NATS - discovery means no cluster, no K8s — just the bus already running. -- Genuinely idiomatic: a service connects, announces via the micro `$SRV` tree - (PING/INFO/STATS) or a JetStream KV record, and disappears the moment its - connection closes. Re-join = "open the connection and publish." No per-service - config, no sidecar, no hand registration. - -**Where NATS genuinely falls short for this product:** - -1. It's a NATS service locator, not a gRPC endpoint registry. The `$SRV` - framework and the KV bucket hand you names/responders, not `host:port` gRPC - endpoints. Each service's `host:port` has to be carried in metadata/KV and a - custom gRPC resolver hand-written; gRPC's built-in resolver/health model - won't "just work." Real integration work owned in the sync path — now the - product's primary contract. -2. No native health. NATS has no last-will or probe. Heartbeat+TTL (KV) must be - implemented to distinguish "installed but unhealthy" from "not installed," - and stale entries are your problem. K8s readiness probes do this for free. -3. Discovery is coupled to broker availability. If NATS is down, every service - looks down (a hard SPOF unless NATS is itself clustered). Multi-host is where - the cost shows: a real NATS cluster or leaf nodes, with TLS/NKey/JWT - credential management — operator weight, not "just works." - -The balance: NATS is a legitimate fallback and a genuine part of the answer; it -is not a substitute for the registry that resolves gRPC endpoints with health. -If the product's sync path is gRPC, the registry serving it should be K8s-native -(DNS → resolver, headless-Service SRV for ports, EndpointSlice health) rather -than a hand-built NATS registry. - -## 4. Recommendation - -**Primary:** Kubernetes-native service discovery (Service + -headless-Service/DNS + EndpointSlice, served by CoreDNS), delivered as a Helm -chart + Operator, on k3s for single-host customers and a real cluster for -multi-host / hosted. - -**Fallback:** NATS-based discovery (micro `$SRV` announce + JetStream KV -registry) for no-K8s single-host installs, using a custom gRPC resolver that -reads `host:port` from the KV bucket. - -**Rationale, short version:** - -- K8s-native is the only candidate that solves the hardest requirement — - "install a service and the rest of the system joins in to align" — at the - infrastructure layer with health-filtered endpoints and a - customer-comprehensible install. Not extra weight for its own sake; it - replaces a stack of pieces a 7-service product needs anyway, and makes the - multi-host + hosted paths free from one codebase. -- k3s packages the control plane into a ~one-command install a customer can - stand up, and the Operator/Helm/CRD pattern is exactly the "install Curator, - Gateway picks it up" product story. -- NATS is not discarded — it stays in the fleet for async fan-out, and becomes - the second discovery implementation so the smallest no-K8s customer keeps "one - binary on a box." The fallback is the honest acknowledgment that a full K8s - cluster is genuinely heavy for the very smallest single-node customer. - -Why not NATS-only: it's a service locator needing hand-built gRPC endpoint -resolution + health, and it couples discovery to broker availability. Why not -Consul/etcd: a redundant second control plane (if K8s) or "you own the -semantics" (etcd), with per-node agents. Why not a mesh: overkill at ~7 Go -services; consensus is 20+. - -### The seam that keeps both shapes on one codebase - -The Gateway (and any service that routes to peers) should talk to discovery -through one internal interface — - -```go -type ServiceRegistry interface { - Resolve(service string) []Endpoint - Watch(service string) <-chan Event // join/leave -} -``` - -— with two implementations: a K8s one (DNS / EndpointSlice / custom resolver) -and a NATS one (KV / `$SRV`). The rest of the code is registry-agnostic. This is -what makes "K8s-native primary, NATS fallback" a coherent architecture rather -than a fork: business logic doesn't change, only the registry injection point -does. - -## 5. End-to-end: "install Curator, Gateway discovers it" - -**Path A — K8s-native (primary):** - -1. Customer installs the product (`helm install archie`, or pre-provisioned on - k3s). Base services (Gateway, UI, Messaging, Scheduler, Execution, State - Store) each deploy as a Deployment + Service; Gateway is always up and - already holds a resolver for every known service name. -2. Customer installs Curator: `helm install archie-curator`, or the Operator - watches a `Curator` Custom Resource and reconciles it — creating a Deployment - (pods) + a `curator` Service. -3. The Service's label selector matches the Curator pods; the endpoint - controller writes their IPs into an EndpointSlice. Readiness probes gate - which pods are "ready" (a Curator that only registers once healthy won't - receive traffic). -4. CoreDNS immediately serves `curator..svc.cluster.local` (A record; a - headless Service additionally gives an SRV record with the port). -5. The Gateway resolves `curator..svc.cluster.local` through its gRPC DNS - resolver (or a K8s-aware resolver). On the next re-resolution/update it picks - up the new endpoint. No Gateway redeploy, no Gateway config change — and - because it's DNS, the Gateway code doesn't even need to know it's running - under K8s. -6. Removal: `helm uninstall archie-curator` (or scale to 0 / delete the CR) → - EndpointSlice empties → DNS record disappears → Gateway's resolver drops it. - Clean. - -**Path B — NATS fallback (single-host, no K8s):** - -1. One NATS (embedded, or external via the existing compose stack) is the shared - bus; its URL is part of the base install. -2. Every service, on start, connects to that URL and either (a) registers via - the micro framework (`AddService("curator", "1.0.0", …)`), appearing on the - `$SRV` tree, or (b) writes its `host:port` + version into a JetStream KV - bucket (`archie/registry/curator/`) and heartbeats it with a TTL. -3. The Gateway holds a live roster (from `$SRV.INFO` or a KV watch) and feeds it - into a custom gRPC resolver mapping service-name → `host:port`. -4. Customer starts one Curator binary (`archie-curator`, or `docker run` the - image) with the same NATS URL in its config. It connects, announces, and - heartbeats. The Gateway's roster observes the new entry (within one - announce/heartbeat window) and starts routing to it. No Gateway restart, no - config change beyond the shared NATS URL already present in the base install. -5. Removal: stop Curator → its connection closes → it leaves `$SRV` immediately - and its KV record expires via TTL. The Gateway routes that capability to "not - installed." - -## 6. Failure-mode honesty - -- **K8s-native:** pod death → readiness fails → dropped from EndpointSlice - within seconds, so the gateway stops routing to it (health-aware). DNS TTL - caching is mostly harmless because a Service's ClusterIP is stable and all - churn lives behind it in the EndpointSlice. If the control plane goes down, - already-running pods keep serving and DNS still resolves from cache; only new - scheduling/propagation halts. Known gap: cross-cluster and off-cluster - consumers (client-side resolvers, a worker fleet on VMs) need ExternalDNS or a - bridge. mTLS/auth, if needed, is a separate concern (NetworkPolicy / - cert-manager), not the mesh. -- **NATS fallback:** service dies → dropped from `$SRV` immediately, KV record - lingers until heartbeat-TTL (bounded staleness). Broker unreachable → every - service appears down (hard SPOF unless NATS is clustered). Plain subjects - aren't a consensus store (split-brain across partitions possible); JetStream - KV gives Raft per stream but KV placement across hosts needs its own - decisions. Health semantics must be built by hand. - -Both paths are robust against "a service dies"; the difference is who does the -health checking — K8s readiness probes do it for free, NATS makes you build it. - -## 7. Addendum — recovered K8s lane, optional-service semantics - -A separately recovered K8s-focused research lane landed independently on the -same verdict (K8s-native as the canonical, declarative, self-healing -fleet-discovery answer; fits multi-host and the AAP-style "sold both ways" model -best) and confirmed the same install → Operator → CoreDNS → resolver flow above. -It sharpened one point specific to archie-core's shape: - -**The optional, intermittently-running Curator needs explicit "absent" semantics -under K8s.** A scaled-to-zero or not-yet-created Curator has no ready endpoint -and no DNS record — the Gateway's gRPC `dns://` resolver gets `NXDOMAIN`/empty -resolution, and this must be treated as "Curator is disabled," not "Curator is -broken." Concretely: - -- Lazy, on-demand re-resolution — don't pin a dead subchannel as a hard failure. -- A distinct `NotInstalled` vs. `Down`/`Unhealthy` state for routing — the same - distinction the NATS path needs a KV "installed" marker to express. Under K8s, - health comes free (readiness gates the EndpointSlice), but the _presence_ of - an optional service still has to be modelled as a resolution outcome, not a - failure. - -This is a new implementation requirement on both paths (`ServiceRegistry`'s -`Resolve`/`Watch` contract needs a way to express "absent" distinctly from -"unhealthy"), not a change to the primary/fallback recommendation. - -Two secondary observations from that lane, noted but not verdict-changing: - -- **Two discovery systems, not one.** Under K8s, sync gRPC is served by cluster - DNS/EndpointSlice, while async NATS status/telemetry is served by NATS's own - clustering. These should not be conflated — this is exactly why the - `ServiceRegistry` seam matters: it isolates the sync path and keeps NATS - purely for async fan-out, as already planned. -- **Config relocation.** Moving install/run/upgrade from `config.toml` into - ConfigMaps/Secrets is a real change to how archie-core is deployed, worth a - deliberate PRD/settled-design before committing — a phased concern, not a - blocker for the discovery decision. - -## Bottom line - -Treat Kubernetes-native discovery (Helm chart + Operator on k3s / a real -cluster) as primary, and reuse NATS as the built-in fallback so single-host -no-K8s customers still get "install and auto-join." This is the only ordering -that satisfies the hardest requirement at the infrastructure layer, keeps the -hosted path free from one codebase, and doesn't force the smallest customer into -a full cluster. The two implementations live behind one `ServiceRegistry` -interface, so neither is a fork. The one added implementation requirement is the -optional-service "absent ≠ down" resolution model on both paths. - -Full recovered K8s-lane transcript, for the record: session path -`.../cf1825c4-0c08-4aaa-9ea1-aac40893825f/run-0/session.jsonl` (external to this -repository; not reproduced here). diff --git a/tools/docsite/main.go b/tools/docsite/main.go index b5b3ff303..497495467 100644 --- a/tools/docsite/main.go +++ b/tools/docsite/main.go @@ -145,6 +145,8 @@ type navNode struct { // - archive/ superseded design. Publishing it competes with the current // architecture for a reader's attention, which is the exact failure this // repository already fights. +// - design/ design handoff bundles (prompts, mockups, theme tokens): +// inputs to building the UI, not pages to read. // - inspiration/ research notes that discuss other products by name. // - news/ release notes, which tools/newsgen owns and a renderer reads // from releases.json. @@ -167,7 +169,7 @@ type navNode struct { // renderer that reads an artifact cannot see why a page is absent from it, and // neither can the next person deciding where a new page belongs. var ( - heldBackTrees = map[string]bool{"archive": true, "inspiration": true, "news": true} + heldBackTrees = map[string]bool{"archive": true, "design": true, "inspiration": true, "news": true} heldBackPages = map[string]bool{"github-token.md": true} developmentTree = map[string]bool{"architecture": true, "prds": true, "development": true} )