Agent-First Development / Violet

Agent-First Development: software built as commands that people and agents both call. Not AI that writes your code.

Preview, on npm

Violet

A design token engine.
Every change is a command.

Violet keeps a design system's tokens on one tree, where each theme stores only what it changes. 34 commands read and change that tree, and the CLI, the MCP server and your own code all call the same ones.

npm install --save-dev @lushly-dev/violet-cli@preview

One commandThree callers
Terminal
violet call tokens.resolve -i '{"nodeId":"atlas-dark"}'
Your code
registry.execute('tokens.resolve', { nodeId: 'atlas-dark' }, context)
An agent
tools/call { "name": "tokens.resolve", "arguments": { "nodeId": "atlas-dark" } }

The same answer Resolved 13 tokens for 'atlas-dark' through 2 ancestor(s)

34 commands
Checked input goes in, a structured result comes out. A failure says how to recover.
Five ways in
The CLI, an MCP and REST server, the registry, the engine alone and a browser runtime.
Nine outputs
CSS, SCSS, Tailwind, TypeScript, Swift, Kotlin, Dart, Lua and JSON, from one tree.
Fig. 01The commands

Call it.
The tree answers.

Try itPick a line under the prompt, or type your own. The tree beside it is the store the prompt is talking to.

The store behind the prompt
  • Loading the tree…

Pick a node to put a command for it on the prompt. To change this tree by hand, go to the design side.

Fig. 02The result

Every answer says
what to do next.

Each command returns the same envelope. A success says what happened and what it touched. A failure names the problem and the next thing to try, so an agent carries on instead of stalling.

It worked
It didn't
reasoning
What happened, in a sentence a person or an agent can repeat.
sources
Which node and which token the answer came from.
suggestion
On a failure, the command to run or the value to change.

Both results were produced on this page, just now, by the tree above.

Fig. 03The layers

Five packages, so you take
only the layer you need.

The engine needs zod and nothing else, and it knows nothing about AFD. The command layer sits on the engine. The command line and the server sit on the commands. Depend on the lowest layer that does your job.

Endpoints

violet-cli

The violet binary: export, compare, CI setup, any command by name.

violet-server

The violet-mcp binary: an MCP server and a local REST API. Every command is a tool except validate and doctor, which stay in the CLI.

Integration

violet-afd

The command registry and 34 commands. Each takes validated input and returns a CommandResult.

Foundation

violet-core

Storage, inheritance resolution, export to nine formats, rules and the CSS value validators.

violet-runtime

The browser SDK: apply a node's tokens as custom properties and switch themes at runtime.

Fig. 04The code

Five ways in.
One behaviour.

@lushly-dev/violet-afdIn your process
import { createMemoryDatabase, initializeCore, registry } from '@lushly-dev/violet-afd';

initializeCore();
const context = { db: createMemoryDatabase(), actor: 'build' };

await registry.execute('node.create', { name: 'base', type: 'root' }, context);
await registry.execute('token.add', { nodeId: 'base', tokenId: 'color.bg', value: '#FFFFFF' }, context);
const css = await registry.execute('export', { nodeId: 'base', format: 'css' }, context);
The registry the terminal above is calling. Each execute validates its input and returns a result, so a build script and an agent get the same answers.
Fig. 05The guard

A token can't
smuggle CSS.

Agents write tokens now, and a token ends up in a stylesheet. Before a page draws a value, pass it through a validator. It returns a rebuilt, safe value or null. It never hands the input back.

It is an allow-list, not a filter: what it doesn't recognise is refused, including url(), var() and named colours. The functions live in @lushly-dev/violet-core/css, which imports nothing, so a page can load them alone.

Fig. 06The store

Keep the tree
where it suits you.

Four places to keep it

Files
DTCG JSON in your repo, one node per file. Nothing to host.
SQLite
The command line's default, in ~/.violet/violet.db.
Postgres or Neon
One shared tree for a team, behind the REST API.
Memory
For tests and workers. It is what this page runs on.

Three workflows from one command

tokens-validate.yml
Checks the tokens and their rules on every pull request.
tokens-release.yml
Builds and releases the exports when you push a tokens-v* tag.
tokens-sync.yml
Fetches exports from a hosted Violet API instead of local files.

violet cicd setup -n <node>

Fig. 07The start

Install the layer
you'll stand on.

Command line
npm install --save-dev @lushly-dev/violet-cli@preview
Commands in your code
npm install @lushly-dev/violet-core@preview @lushly-dev/violet-afd@preview zod
MCP server
npm install @lushly-dev/violet-server@preview

Status

Preview. All five packages are on npm at 0.3.0-preview.0, under the preview tag, and share one version. SQLite needs the optional better-sqlite3 package; memory and files need nothing native. The hosted API, the web editor and the Figma plugin are not released yet.