Skip to main content

craftforJ Assistant

Open in ChatGPT

The craftforJ assistant is a coding agent that works inside your running app. It writes Java freely, compiles what it wrote before you ever see it, applies the change, and keeps working after your app restarts. It ships with webforJ as part of craftforJ, the development environment that gives you the component tree, routes, live properties, and theming of an app while it runs.

How the two compare

webforJ AI plugincraftforJ assistant
Lives inYour editorThe running app
ReadsYour source filesYour app, live, with its real values
DoesWrites codeWrites code, and inspects, changes, navigates, and themes the running app
Verifies byYour next buildCompiling each edit before you see it, then showing you the result running
Suited toBuilding something new from scratchUnderstanding, fixing, building, and prototyping against the app in front of you

The two are complementary and can hand work to each other. Once the work outgrows craftforJ, you can hand a craftforJ conversation off to your editor.

What it can do

You give the agent a goal rather than a command. It plans, inspects whatever it needs, acts, checks the result, and corrects itself across many steps in a single turn.

It writes Java freely, so it isn't limited to the property changes you can make by hand. Each edit is staged rather than written to disk, sent to a real Java compiler, and corrected by the agent against the diagnostics that come back, so what reaches your review already compiles against your running app. Applying it restarts the app, and the agent picks its plan up again once it's back.

Alongside that it reaches everything craftforJ knows: the live component tree and real property values, your Java source, the routing table and route access rules, the theme and stylesheet, the page itself for CSS and scripts, screenshots of a component, and the webforJ knowledge base and --dwc-* token tools built in. See AI Assistant for the detail.

Configuring a model

craftforJ ships no model of its own, so you choose the one that runs it. Add an API key for one of the supported providers, or point craftforJ at a model running locally with Ollama. Your key is stored on the machine running your app and held in the browser only while the page is open, and the assistant talks to your provider from the browser rather than through your server. See Configuring a model.

AI can still make mistakes

Working against the running app and compiling its own output makes the agent considerably more accurate than one writing blind. It can still be wrong. Review what it did before you keep it.

Getting started

craftforJ is disabled until you turn it on, and it runs only in development:

webforj.conf
webforj.debug = true
webforj.devtools.craftforj.enabled = true

Open craftforJ with Alt + Shift + D and switch to the AI Assistant tab. For the full setup, see Getting Started.