Skip to content

Write with Your LLM

Ask your LLM to write Qosm code — the standard workflow.


With your IDE connected and capabilities configured, you're ready to build. Go to your editor and ask the LLM to write code.

The prompt

Something like:

"Write a Qosm function that fetches the health status of api.example.com and classifies any errors using my_claude. Push it to my project."

What the LLM does

Behind the scenes, the LLM uses the Qosm MCP tools in a loop:

  1. get_project_context — reads your project's code and capability declarations
  2. Writes Qosm code — using the capabilities it sees in the context
  3. qosm_check — sends the code to the compiler. If there are type errors, the LLM reads them and fixes the code. This loop repeats until the compiler is happy.
  4. qosm_push — saves the final code to your project

This is the key insight: the LLM doesn't just guess at correct code — it iterates against a real typechecker. If it tries to call a function that doesn't exist, use a string where an int is expected, or forget to handle an error case, the compiler catches it.

See the result

Go to the workspace and open your project. You'll see the code the LLM pushed. The inference panel on the right shows:

  • Bindings — every function with its inferred type
  • Effects — which capabilities the code uses (LLM.Call, Http.Get, etc.)
  • Call graph — in the Home view, a visual map of which functions call what

Check and Run

The workspace has two modes:

  • Check — typechecks only. No execution, no LLM calls, no credits consumed. Use this to verify code is correct.
  • Run — typechecks and executes. Model calls happen, HTTP requests fire, results come back.

Press Cmd+Enter to run, or click individual functions in the Home view to test them with specific arguments.

Editing by hand

You can also edit Qosm code directly in the workspace editor. The typechecker runs on every keystroke (200ms debounce), so you get instant feedback on errors. This is useful for small tweaks, but for anything substantial, asking the LLM is faster — it knows the language syntax and can iterate against the compiler automatically.

What to learn next

You now know the full workflow: connect → configure → ask → run. The next section dives into why this works — the ideas behind Qosm's security model.

What Makes Qosm Different →