Skip to content

feat: ship an agent harness for harnesspm - #459

Merged
tenphi merged 1 commit into
mainfrom
claude/scope-gpookh
Nov 12, 2026
Merged

tenphi merged 1 commit into
mainfrom
claude/scope-gpookh

Conversation

@tenphi

@tenphi tenphi commented Nov 12, 2026

Copy link
Copy Markdown
Owner

What

Tasty ships an agent harness in harness/, for harnesspm. Every app on Tasty, and through extends every app on a UI kit built on it, gets:

  • 📏 Rule tasty:rules/usage (always on, 599 bytes): read the brief and the project's config first, tokens and units, state maps, and the tool.
  • 📚 Docs tasty:docs: docs/ of the installed version, indexed by a hand-written docs/llms.txt with the 13 consumer pages.
  • 🔧 Script tasty:styles: the CSS a styles object produces, with the app's configure() loaded through --setup, and a warning for every value that stayed unresolved.

Design note

Units

Unit Shipped Why
Rule tasty:rules/usage ✅ A digest of ai-agents.md sections 0–5 plus a pointer to the tool. It is copied into every consumer's AGENTS.md, so it stays under 640 bytes (a test checks). Two ## sections, so a UI kit can patch one, such as "Checking styles".
The full brief, ai-agents.md Pointer It stays the one source. The rule names it, and the docs index lists it first. No copy in harness/.
Docs + docs/llms.txt ✅ 13 consumer pages. Internals (pipeline, injector, runtime-benchmarks) and positioning (comparison, adoption) are left out. A test checks every link, and fails when a new page is in neither the index nor the internal list.
Script tasty:styles ✅ The most valuable unit: a bare renderStyles() looks authoritative and is wrong (see below).
Script tasty:state ❌ Folded in A state key shows up in the tasty:styles output as its selector or at-rule. The help says: put the key in a state map.
Skill tasty-component ❌ The rule plus methodology.md cover it, and a docs index works better than a skill an agent must choose to load.
Hooks, MCP server, sub-agent ❌ Lint on edit belongs to the ESLint plugin's own harness, later.

How tasty:styles gets the app's config: --setup <module>

Units, presets, recipes and state aliases come from configure(), which apps call at runtime. The tool imports each --setup module before rendering:

  • a module that calls configure() when imported, such as src/tasty-setup.ts or @cube-dev/ui-kit/dist/components/Root.js;
  • or a module that default-exports a config, such as a tasty-zero.config.ts that the Babel plugin's configFile already reads. The tool passes it to configure().

--setup takes a file path or a path inside a package, and repeats. TypeScript works on Node 22.18 or later. Guards:

  • Without --setup, a warning says the CSS is for Tasty's defaults, and names the project files that call configure().
  • When the setup did not change the config of the Tasty copy the tool uses (another copy, or configure() inside a function), it says so.
  • --setup tasty.config.ts is refused: that file only lists names for the linter.

Rendering: computeStyles(), not renderStyles()

Prototyping showed that a bare renderStyles() prints recipe: card; as a CSS declaration even when the recipe is configured: tasty() resolves recipes in an earlier step. The tool renders through computeStyles(), the core that tasty() and useStyles() share. In Node it returns the real CSS: recipes resolved, one class per style chunk (doubled, as at runtime), keyframes renamed.

Unresolved values

Tasty is silent about some of them, so the tool checks:

Case What Tasty does The tool
A unit that is neither Tasty's nor CSS's (10foo) Passes it through raw Warns, naming the value and the property
A recipe when none are configured Drops it silently Warns
An unknown recipe when some are configured Warns Shows Tasty's warning
An unknown preset Falls back to the default font Warns, when the config defines presets (UI Kit defines them outside configure(), so there it is not checked)
An unknown state alias, a misplaced '' Warns Shows Tasty's warnings (the tool runs in development mode)

Verification

  • Locally: pnpm typecheck, pnpm lint (now also harness/), pnpm format:check (now also harness/**/*.mjs), pnpm knip, pnpm check:test-only, and pnpm test:node (2,326 tests). The browser project runs in CI; this change does not touch browser code. The public API snapshot is unchanged.
  • src/harness.test.ts: 18 tests. The logic runs against src/; the CLI tests run once dist/ exists, as in CI.
  • pnpm check:harness (harnesspm check, now in CI): ✅ valid, always-on text 0.6 KiB. @tenphi/harnesspm is a devDependency.

End to end

Recipe from the handoff: pnpm pack, a fresh app (git init, the tarball as a file: dependency, @tenphi/harnesspm 0.1.0 from npm, pnpm, an isolated HOME), npx harnesspm init, "trust": { "@tenphi/tasty": true }, and sync run as a person (outside the agent markers).

The app: a small dashboard with src/tasty-setup.ts (configure() with units x = var(--gap) and r = var(--radius), the @mobile and @dark states, tokens, 4 presets and 2 recipes), a tasty.config.ts with the names, and a StatCard component built with tasty().

What harnesspm wrote:

  • The managed block in AGENTS.md has the rule with both sections, the docs index at node_modules/.harnesspm/pkgs/@tenphi/tasty/docs/llms.txt, and the script line.
  • .claude/settings.local.json allows Bash(npx harnesspm run tasty:styles *).
  • npx harnesspm why tasty:rules/usage and why tasty:docs name the installed files.

The tool through the runner:

  • With --setup ./src/tasty-setup.ts (TypeScript, Node 22): the app's units, states and recipes applied, 0.46 s. The setup and the tool share one Tasty instance through pnpm's symlinks.
  • Without --setup: the defaults warning names src/tasty-setup.ts.
  • UI Kit scenario: an app on @cube-dev/ui-kit 0.212.0, with a pnpm override that points its @tenphi/tasty at this tarball. --setup @cube-dev/ui-kit/dist/components/Root.js loads in plain Node in 0.68 s, with UI Kit's units (x = var(--gap), cr = var(--card-radius), …), its @dark, @hc, @reduced-motion and @mobile states, and its recipes. The output shows what @dark really becomes: prefers-color-scheme media queries plus [data-scheme] selectors.

A live agent run. Headless Claude Code, --permission-mode acceptEdits, with a task that never mentions harnesspm, the rule or the tool:

In src/components/StatCard.tsx the delta text should be green when the change is positive and red when it is negative. Add that, with whatever color tokens the app needs. Also, on phones (below 768px) the card should be more compact: less padding, and the value should be one size smaller. Desktop should look the same as now.

It finished in 10 turns (41 s). On its own, it:

  1. read the docs index and ai-agents.md, and the project's setup;
  2. ran tasty:styles --help;
  3. added #success and #danger to configure() and to tasty.config.ts;
  4. wrote idiomatic styles: padding: { '': '4x', '@mobile': '2x' }, preset: { '': 'h2', '@mobile': 'h3' }, and color: { '': '#accent', 'trend=up': '#success', 'trend=down': '#danger' } with mods={{ trend }};
  5. ran tasty:styles '<the full styles>' --setup src/tasty-setup.ts, found the right setup module by itself, got no warnings, and reported the real sizes from the output (padding 24px → 12px).

Follow-ups

  • UI Kit (after a Tasty release): extends: ["@tenphi/glaze", "@tenphi/tasty"]; drop the Tasty pages and TASTY_PAGES from scripts/prepare-docs.mjs; shorten the Tasty bullet in uikit:rules/usage; patch the "Checking styles" section of tasty:rules/usage to name --setup @cube-dev/ui-kit/dist/components/Root.js, or add uikit:styles with that setup built in.
  • harnesspm: harnesspm why tasty:scripts/styles answers "No unit", though the managed block names that ID.

Generated by Claude Code

Apps on Tasty get an always-on style rule, an index of the docs of the
installed version (docs/llms.txt), and the tasty:styles tool, which prints
the CSS a styles object produces after --setup modules load the app's
configure(), and warns about values that stayed unresolved.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Gr8S7Ed6WF7j8cpXBKzCuV
@github-actions

Copy link
Copy Markdown
Contributor

📦 Snapshot release

Published 0.0.0-snapshot.cde1317.

pnpm add @tenphi/[email protected]

@tenphi
tenphi marked this pull request as ready for review November 12, 2026 15:46
@tenphi
tenphi merged commit 3fa7f0e into main Nov 12, 2026
7 checks passed
@github-actions github-actions Bot mentioned this pull request Nov 12, 2026

This branch was successfully deployed

1 active deployment
release — 867ccf23 Deployed Nov 12, 2026 by tenphi via Build & snapshot release #1250
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.

2 participants