# Review what the agent wrote to kywi.config.ts

URL: https://kywi-docs-production.up.railway.app/agent/review-what-the-agent-wrote-to-kywiconfigts
Type: docPage

Every developer-server config write lands on disk immediately, with no diff or dry-run step — reviewing it means reading the file afterward.

The developer server's eight config-mutation tools — `add_content_type`, `add_field`, `remove_field`, `add_theme`, `update_content_type`, `update_theme_regions`, `add_module`, `add_plugin` — all work the same way: parse `kywi.config.ts` with the TypeScript compiler, splice in the change, and write the file straight back out. None of them return a preview, and none require a second, confirming call. The moment the tool call returns, the file on disk is the new file.

## There is no dry-run

A config write is written straight to disk, not staged or held for confirmation. Review it by reading the file after the call, the same way you'd review any other change an agent made to a file in the repo: `git diff kywi.config.ts` shows exactly what moved, and it's the only place a "before" exists once the write has happened.

## Migrations can follow in the same breath

The same server also exposes `run_migration`, which shells out to run it. A content-type or field change and the migration that applies it can happen as two back-to-back tool calls with nothing built into the tool set to pause between them — if you want a human checkpoint between "the schema changed" and "the database changed," that checkpoint has to come from how you brief the agent, not from the tools themselves.

## What makes a write fail instead of landing wrong

These tools fail closed on a shape they can't safely edit, rather than guessing. A config file with no literal `defineKywiConfig({ ... })` call to splice into fails before anything is written, and says why in the same breath:

Could not find the `defineKywiConfig({ ... })` object in the config file. Every entry a Kywi app reads lives inside that object, so there is nowhere safe to write.

## the whole error the agent receives

and a target array written as anything other than an array literal — a spread, a function call, an import — fails the same way rather than being silently misapplied. That protection only covers shapes the tool recognizes as unsafe, though: on an array literal it can parse, the splice just happens.

## What a success tells you, and what it doesn’t

Each write returns what it added and a note. What "added" looks like depends on the tool — `add_content_type` returns the type's `label` and a count of `fields`; `add_field` returns just the field's name; `add_theme` returns its `regions` — but only the three tools that shape a content type's fields (`add_content_type`, `add_field`, `remove_field`) put "run `run_migration`" in that note; the other five carry a different heads-up about what the tool couldn't finish for you instead. Either way, the note is the only prompt telling you there's a follow-up step, and a field count is the only description of shape any of them give you — three fields is three fields whether or not they are the three you asked for.

Nothing in the response says where in the file the splice went, what it landed next to, or that an import was added alongside it (these tools add one when the change needs it).

## Filesystem mode only

All of this exists because the developer server is running in `filesystem` mode. In `api` mode there's no direct write path to `kywi.config.ts` through this server at all — a config change has to go through a person editing the file instead.
