Skip to content

docs: promote Workflows + introduce Primitives nav section#778

Draft
khaliqgant wants to merge 12 commits intomainfrom
docs/workflows-primitives-restructure
Draft

docs: promote Workflows + introduce Primitives nav section#778
khaliqgant wants to merge 12 commits intomainfrom
docs/workflows-primitives-restructure

Conversation

@khaliqgant
Copy link
Copy Markdown
Member

Summary

Restructures the docs navigation so Workflows is addressable as a top-level flagship section (not buried as a single bullet in "Advanced"), and groups the Basics pages into a more scannable "Primitives" section with nested sub-items.

Why

Current reference-workflows.mdx is 180 lines of pure API reference because everything else — patterns, gotchas, helpers, 80-to-100 — lives in two Claude-Code-only skills. This PR moves that content into public, addressable docs.

Also, features like applySiblingLinks (landing in relay SDK #776) have no home to be documented without this restructure.

Nav changes

Before:

- Getting Started (Introduction, Quickstart)
- Basics (Spawning, Sending, Event handlers, Channels, DMs, Threads, Emoji, Files, Auth, Permissions, Scheduling)
- Advanced (Workflows, Cloud, Workforce)
- ...

After:

- Getting Started (Introduction, Quickstart, Spawning an agent, Event handlers)
- Primitives
    - Message (Channels, DMs, Threads, Emoji reactions)
    - File
    - Auth (Permissions)
    - Schedule
- Workflows                            ← promoted
    - Introduction
    - Quickstart
    - Builder API                       ← was `reference-workflows`
    - Patterns
    - Setup helpers
    - Common mistakes
    - Run from CLI                      ← was under `CLI`
- Advanced (Cloud, Workforce)
- Tools, CLI, SDKs, Plugins, Examples unchanged

Technical details

Nav renderer:

  • NavItem gets optional children: NavItem[] for nested sub-items.
  • DocsNav.tsx renders children as an indented sub-list with a left border.
  • getAllDocSlugs() recurses through the tree for static-generation coverage.
  • One new CSS class (navChildren) — minimal visual change beyond the indent.

New pages (~1100 lines total, real content not placeholders):

Page Content source
workflows-introduction.mdx Landing + mental model + when to use
workflows-quickstart.mdx End-to-end 5-min example
workflows-patterns.mdx Ported from writing-agent-relay-workflows + relay-80-100-workflow skills
workflows-setup-helpers.mdx Per-repo helper convention + applySiblingLinks
workflows-common-mistakes.mdx Ported from the skill's common-mistakes table

Draft because

Open questions I'd love your call on:

  1. Permissions — under Auth (current) or its own primitive?
  2. Sending messages — currently acts as the Message landing page. Should it be a separate page with Message as an umbrella, or stay as-is?
  3. Agent primitive — should there be an Agent primitive (for Spawning + Event handlers) rather than putting them in Getting Started?
  4. reference-workflows.mdx — I kept the slug for redirect compat but relabeled the nav to "Builder API". Rename the file too (with a redirect)?
  5. applySiblingLinks reference — currently mentioned in workflows-setup-helpers.mdx but the SDK PR (feat(sdk): applySiblingLinks — link sibling-repo packages during workflow setup #776) isn't merged yet. Left the link pointing at the source file; swap to hosted typedoc once it exists.

Test plan

  • tsc --noEmit clean for nav/renderer changes
  • lint-staged (prettier + eslint) clean
  • Visual QA: load each new page, confirm sidebar shows Workflows section with all 7 children, confirm Primitives section shows nested sub-items under Message and Auth
  • Check mobile nav layout with the nested children
  • Verify existing pages (Channels, DMs, etc.) still load via their new nested paths in sidebar (slugs unchanged, only nav position moved)

Follow-ups

  • Fill in TODO sections of Builder API reference (currently the old reference-workflows.mdx content as-is).
  • Add a Workflows → Examples page or link to a /examples directory in the repo.
  • Port applySiblingLinks reference to a typedoc-rendered page once the SDK docs pipeline lands.

…tion

Nav changes:
  - 'Basics' becomes 'Primitives' and groups related pages semantically:
    * Message (expandable): Channels, DMs, Threads, Emoji reactions
    * File (was 'File sharing')
    * Auth (expandable): Permissions
    * Schedule (was 'Scheduling')
  - 'Spawning an agent' + 'Event handlers' move up into Getting Started
  - Workflows promoted from a single bullet under Advanced to a top-level
    section with 7 pages: Introduction, Quickstart, Builder API,
    Patterns, Setup helpers, Common mistakes, Run from CLI
  - CLI's 'Run workflows' folds into the Workflows section
  - Advanced now only contains Cloud + Workforce

Nav renderer:
  - NavItem gains optional children: NavItem[] for nested sub-items
  - DocsNav.tsx renders children as an indented sub-list with left border
  - getAllDocSlugs() walks the tree for static-generation coverage

New pages (stubbed with real content, not placeholders):
  - workflows-introduction.mdx: landing, mental model, when to use
  - workflows-quickstart.mdx: end-to-end 5-min example
  - workflows-patterns.mdx: 80-to-100, lead+workers, multi-file edit,
    cross-repo, supervisor, parallelism/waves
  - workflows-setup-helpers.mdx: per-repo setup helper convention +
    applySiblingLinks (landing in relay SDK #776)
  - workflows-common-mistakes.mdx: the table every workflow author
    needs once, ported from the writing-agent-relay-workflows skill

Content porting is from the two private Claude-Code skills
(writing-agent-relay-workflows and relay-80-100-workflow) so this
content is now public + addressable by URL.

DRAFT PR. Open questions for review:
  - Should 'Permissions' be under Auth or its own primitive?
  - 'Sending messages' acts as the Message landing — separate page or
    umbrella?
  - Should there be an 'Agent' primitive (for Spawning + Event handlers)
    rather than putting them in Getting Started?
Primitives sub-items (Message, Auth) now render collapsed by default
with a chevron toggle button. Rules:

- Click the chevron to expand/collapse. Parent link stays active as a
  real nav link (clicking the label navigates to the parent page).
- Auto-expands when the current URL is the parent or any of its
  children, so users don't lose their bearings after clicking a child
  link.
- Chevron rotates 90deg when open; hover highlights the toggle.
- Accessible: aria-expanded + aria-controls + aria-label on toggle.

NavItemRow is now a component (uses useState) so each expandable item
maintains independent open state. Non-expandable items (no children)
render with the same layout as before — no chevron.
--sync-code was previously mentioned once in cli-cloud-commands.mdx
with no explanation. New workflow authors kept discovering the
'untracked files silently excluded' footgun the hard way.

Adds:
  - A full section in cli-cloud-commands.mdx covering what --sync-code
    does (tarballs git-tracked + staged files), when to use it
    (~always), when not to (rare cases), and the typical flow.
  - A cloud-execution block in workflows-introduction.mdx showing the
    common invocation pattern + linking to the full reference.
  - A 'Run it in the cloud' section in workflows-quickstart.mdx that
    walks through stage-then-sync-run-sync-back.

Cross-links from the intro and quickstart to the cli page section.
Reinforces the existing 'untracked files excluded' entry in
workflows-common-mistakes.mdx.
Corrects the staging-is-enough claim that appeared in the prior commit.
--sync-code tarballs HEAD:

  ✅ Committed files (pushed or local)
  ❌ Staged-but-not-committed
  ❌ Unstaged edits
  ❌ Untracked files

Updates all four affected pages (cli-cloud-commands, workflows-
introduction, workflows-quickstart, workflows-common-mistakes) with
consistent wording: 'commit' rather than 'git add', with a callout
that pushing isn't required but committing is.
The CLI install section rendered the two install options as a bullet
list with inline backtick code, which crammed the long curl URL onto
the same visual line as the label and wrapped awkwardly.

Switch to the same CodeGroup pattern used by the SDK install block
higher on the page — npm vs install-script tabs, each with its own
code block. Also adds a 'Start a local broker and spawn agents' intro
line before the subsequent command block.
Reorder the CodeGroup so install script shows first (becomes the
default tab), label it 'recommended', and add a one-sentence note
explaining why — install script pulls the native broker binary for
the user's platform alongside the CLI, while npm only gets the
JavaScript entrypoint.
Let readers discover the pattern where a host agent (Claude, Codex,
etc.) spawns and manages its own team of sub-agents from inside a
session, via the running-headless-orchestrator skill.

Two install paths shown (prpm as recommended with the --as host[,host]
variant, plus the direct skills-add command as an alternative), and a
one-line prompt example so readers see what to tell the host once the
skill is loaded.
…framing

'A workflow is a DAG of steps' was only true for the default pattern.
The SDK ships 25 swarm patterns (debate, mesh, review-loop, saga,
circuit-breaker, swarm, etc.) — many are NOT DAGs. Replaced with a
grouped table (DAG/trees, hubs, iterative loops, non-fixed, selection,
error-handling) plus a note that hub patterns auto-harden with a
supervisor while plain dag/pipeline don't.

Step types were understated too. WorkflowStepType is 'agent' |
'deterministic' | 'worktree' | 'integration'. Added worktree + integration.

Also reframed the top of the page to make two things explicit:

  1. Workflows compose the primitives (channels, DMs, threads, files,
     scheduling) — they don't replace them. Links to each primitive page
     for discoverability.
  2. Workflows are repeatable — the point is that you write them once
     and run them N times, share them, schedule them, resume from
     partial failure. Added this as a first-class 'why' bullet and a
     paragraph about orchestration at scale.
…skills block

Two corrections + one addition:

1. GitHub primitive moved from top-level Primitives to Workflows.
   It's a workflow-specific primitive (integration step shaped for
   workflow(), not a general Relay primitive like channels/DMs), so
   it belongs alongside Patterns and Setup helpers under Workflows.

2. workflows-introduction 'how workflows use primitives' section
   separates top-level Relay primitives (channels/DMs/threads/files/
   scheduling) from workflow-specific primitives (GitHub). One
   trailing paragraph introduces the latter category.

3. New 'Let an agent write your workflows' section at the bottom of
   workflows-introduction. Same install-box pattern as the headless
   orchestrator block in quickstart:
     - prpm (recommended, with --as claude[,codex] variants)
     - skills add (alternative)
   Mentions both writing-agent-relay-workflows (core authoring) and
   relay-80-100-workflow (validation-gate layer) with a one-line role
   description for each + two example prompts.
Dropped the standalone GitHubClient client-only usage block — the
primitive is used WITHIN a workflow, not as a standalone imperative
client. Kept the workflow integration step (createGitHubStep) as the
one canonical usage example.

Updated intro to state the primitive is bundled with the SDK (no
separate install), and switched the import path to the bundled subpath
`@agent-relay/sdk/github`. This is the target state — the bundling
lands in a sibling SDK PR so this doc is accurate on merge.
… HEAD)

Previous iterations overshot in both directions — first said staging
was enough, then corrected to 'only committed.' Actual ground truth
from reading relay's createTarball (packages/cloud/src/workflows.ts):

  1. git ls-files -z -> tracked paths
  2. tar.create() reads working-tree contents of those paths

So:
  - Committed files -> yes
  - Committed + modified -> yes (working-tree contents)
  - Staged new file (added, not committed) -> yes
  - Untracked (never added) -> NO
  - Gitignored -> NO

`git add` is enough. Commit not required. No `git clone` fallback
if --sync-code is omitted — sandbox starts with empty $HOME.

Affected pages: cli-cloud-commands (full explainer), workflows-
introduction (cloud exec block), workflows-quickstart (Run-in-cloud
section), workflows-common-mistakes (one-liner). All now consistent.
The example prompt implied the skill would auto-invoke. Make the skill
name explicit so users see how to reference it in their own prompts.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant