Skip to content

Typesafe AI (decisions with confidence)

Context Code makes dozens of small decisions that the chat model does not make: which model to use for this turn, which skills are relevant, whether a tool is dangerous, which specialists a plan needs. Until now those were decided with hand-written keyword lists and weights. They half work: “I need to understand the login flow” contains no “informational” keyword and ended up forcing a plan, and any sentence that mentioned “api” in passing fired the engineering team.

Typesafe AI is a service built for exactly that: you send it a state (the request text, a tool name, a list of skills) and a question, and it answers with a confidence number. Context Code only acts on the answer when that confidence is high; below the threshold it falls back to the usual heuristic.

It is optional. With no key, the app behaves exactly as it did before.

  1. Create an account at console.typesafe.ai and open Keys (console.typesafe.ai/keys).
  2. Generate a new key and copy it.
  3. In Context Code, open Settings and find the Typesafe section. Paste the key and save.

The key is stored in the app’s encrypted store, the same one that holds your AI provider credentials: it is never written to a plain text file and never appears in the logs. If you would rather not store it, the app also accepts the TYPESAFE_API_KEY environment variable.

  • The model for the turn, when the model selector is on Automatic. Instead of always sending the same engine, it measures how much capability your request needs and picks among your connected profiles.
  • Relevant skills. Out of every skill you have installed, only the ones related to the request enter the context. Less noise for the model and fewer tokens per turn.
  • Risk in “Ask me first”. When you review actions one by one, the prompt tells reversible work apart from work that is not, instead of treating everything the same.
  • The model for each orchestrator subagent. A “rename this variable in three files” drops to the fastest, cheapest model on your list; an architecture redesign or a bug you have to chase across layers moves up to the most capable one. Subagents whose .md file already declares profile: or model: are left alone: your file wins.
  • Intent and domains of the request. Whether what you wrote asks for an explanation or for work done, and which areas it touches (frontend, backend, data, infrastructure, security, QA, design, documentation…). That is where a plan’s proposed team comes from.

When Typesafe made a decision, it says so:

Model chosen by Typesafe: claude-haiku-4-5 (confidence 0.87)

That line shows up next to the turn’s model and in each orchestrator subagent’s report. There is never a silent decision: if you do not see the line, the app chose with its usual rules.

Very little, because the questions are tiny: a state of a few hundred tokens and an answer of a handful.

  • Input: $0.042 per million tokens.
  • A normal chat turn asks one or two questions. At a daily working pace, the monthly spend is measured in cents.
  • What it can save is in the order of euros: not downshifting the orchestrator’s mechanical tasks and loading skills that were beside the point costs more than this does.

Everything goes back to how it always was, with no error popup and nothing blocked:

  • The turn’s model is chosen by the app’s own rules.
  • Skills are filtered by name and description, as before.
  • Risk is rated from the tool table.
  • Subagents inherit the orchestrator’s engine.
  • The team is proposed by the keyword detector.

The same happens when the answer arrives with low confidence, when the service takes too long, or when there is no internet. Work never stops waiting for a decision.

  • It works best in English. The service is trained on English instructions, and that is how the app sends them. Your requests go through exactly as you wrote them: in Spanish and Portuguese it gets them right, but with somewhat less confidence — and less confidence simply means the usual heuristic is used instead.
  • It reads, it does not compute. It decides over the text it is sent; it runs nothing, it does not see your files and it does not receive the chat history. Only the trimmed request, the tool name or the skill list, depending on the case.
  • High-risk decisions still ask for confirmation. Typesafe can sort information and flag what is delicate, but it never approves on your behalf: deleting files, pushing to a remote or running commands outside the project are confirmed exactly as they are without a key.
  • A suggestion cannot bring a task down. If the profile it proposes no longer exists or does not answer, the previous engine is inherited and the work carries on.