Use with AI agents

Every page of this site ships inside the published package, as plain markdown, at node_modules/@wych/react/docs. Nothing discovers that path on its own. Point at it from your AGENTS.md or CLAUDE.md.

## @wych/react

This project uses `@wych/react`, a TEA-style feature runtime for React built
on Effect. The docs are local, as markdown:

    node_modules/@wych/react/docs

Read `index.md` first. Then `reference/` for the API you are changing,
`how-to/` for a recipe, `explanation/` for why the model works this way.
Do not invent APIs: every export is listed under `reference/`.

Why the model suits an agent

A define({ props, state, action, output }) block is a feature's whole contract on one screen: what comes in, what it holds, what it can do, what it tells its parent. An agent reads that one object literal instead of reconstructing a useEffect graph or hunting for state hidden in closures.

import { Action, define } from "@wych/react";
import { Schema } from "effect";

const Typed = Action("Typed", { text: Schema.String }); // internal: reaches the reducer
const Submitted = Action.output("Submitted", { text: Schema.String }); // outbound: leaves via onSubmitted

const SearchBox = define({
  props: Schema.Struct({ placeholder: Schema.String }), // what the parent passes in
  state: Schema.Struct({ text: Schema.String }), // what the feature holds
  action: Action.of([Typed]), // what it can do
  output: Action.of([Submitted]), // what it tells its parent
});

Wrong is a type error, not a runtime surprise. Schemas type props and state; the reducer owes one handler per tag in the action vocabulary's cases (see reference/actions.md, cases); every declared output becomes a required on<Tag> prop at each JSX call site (see reference/runtime.md); and Command is typed against the reducer's own action and output, not annotated by hand (the contextual typing rule, reference/commands.md). An agent that gets one of these wrong finds out at tsc, before running anything.

It can also check its own work. feature.run folds actions to quiescence in Node against a test Layer, so an agent verifies async logic without a browser (see how-to/test-a-feature-without-react.md).

Check what is on disk

ls node_modules/@wych/react/docs
# => explanation  how-to  index.md  reference  tutorial

ls node_modules/@wych/react/docs/reference
# => actions.md  commands.md  devtools.md  features.md
#    lifecycle.md  runtime.md  tasks.md

The tarball ships dist and docs. The version on disk matches the version you installed, so an agent reading it cannot describe an API you do not have.

Read them over HTTP

Two routes serve the same content over HTTP.

# One line per page, with links. Follows the llms.txt convention.
curl https://wych.build/llms.txt

# Every page concatenated into one document.
curl https://wych.build/llms-full.txt

The layout

The tree follows Diátaxis. The directory says what a page is for, which is the cheapest signal an agent can use to pick one.

docs/
  index.md          # the section map
  tutorial/         # lessons, numbered in reading order
  how-to/           # recipes for a task you already have
  reference/        # one page per API area
  explanation/      # why the model is shaped this way

Send an agent to reference/ for a signature and how-to/ for a working file set. The model is the one page worth reading before writing any feature.

Edit this page on GitHub