<?xml version="1.0" encoding="UTF-8"?>
<spec xmlns="https://vibevm.org/spec/1">
  <title id="root">typescript-ai-native-mcp — the server brief</title>
  <status stage="spec" state="done"/>
  <p p="1"><fact id="SERVED-OVER-MCP-AS-ONE-STDIO-BINARY" status="impl/done">**What it is.** The AI-Native TypeScript discipline served over MCP:
one stdio binary, seventeen tools, launched by an agent host straight
from this package's slot.</fact></p>
  <p p="2"><fact id="SERVING-NEEDS-NO-VIBE-ON-THE-MACHINE" status="impl/done">Serving needs no vibe anywhere on the machine
(PROP-027 §2.6; the live chain scrubs PATH to prove it).</fact></p>
  <p p="3"><fact id="TRANSPORT-IS-THE-VENDORED-MCP-CORE" status="impl/done">Transport: the
vendored `mcp-core` (line-delimited JSON-RPC 2.0, protocol
`2024-11-05` — MCP-CORE-v0.1).</fact></p>
  <p p="4"><fact id="THE-TS-ORACLE-IS-THE-COMPILER" status="spec/done">The TS oracle IS the compiler (the
LanguageService is tsc's own engine) — no approximation caveat rides
these answers.</fact></p>
  <p p="5"><fact id="THE-TOOLS-CALL-THE-SAME-LIB-FNS-THE-CLIS-CALL" status="impl/done">**One engine, one truth.** The tools call the SAME lib fns the CLIs
call, and the `=X.Y.Z` pin on `stack:org.vibevm.ai-native/typescript-ai-native-lang`
holds this package's vendored copies and the consumer's installed stack
to one resolved version set.</fact></p>
  <p p="6"><fact id="TOOL-LEVEL-FAILURE-IS-AN-ISERROR-RESULT" status="impl/done">Tool-level failure — a red gate, an
absent-toolchain refusal WITH ITS RECIPE — is an `isError` RESULT;
protocol errors are reserved for the transport grammar.</fact></p>
  <section id="parity-map" title="The parity map">
    <table p="7">
      <tr>
        <td>Tool</td>
        <td>CLI</td>
      </tr>
      <tr>
        <td><fact id="ROW-INIT" status="impl/done">`init`</fact></td>
        <td><fact id="ROW-INIT-CLI" status="impl/done">`typescript-ai-native init [--namespace] [--force]`</fact></td>
      </tr>
      <tr>
        <td><fact id="ROW-FLOOR" status="impl/done">`floor`</fact></td>
        <td><fact id="ROW-FLOOR-CLI" status="impl/done">`typescript-ai-native floor [--keep-going]`</fact></td>
      </tr>
      <tr>
        <td><fact id="ROW-CONFORM-CHECK" status="impl/done">`conform_check`</fact></td>
        <td><fact id="ROW-CONFORM-CHECK-CLI" status="impl/done">`typescript-ai-native-conform check [--scope] [--baseline]`</fact></td>
      </tr>
      <tr>
        <td><fact id="ROW-CONFORM-FREEZE" status="impl/done">`conform_freeze`</fact></td>
        <td><fact id="ROW-CONFORM-FREEZE-CLI" status="impl/done">`typescript-ai-native-conform freeze [--baseline]`</fact></td>
      </tr>
      <tr>
        <td><fact id="ROW-SPECMAP-CHECK" status="impl/done">`specmap_check`</fact></td>
        <td><fact id="ROW-SPECMAP-CHECK-CLI" status="impl/done">`typescript-ai-native-specmap --check`</fact></td>
      </tr>
      <tr>
        <td><fact id="ROW-SPECMAP-WRITE" status="impl/done">`specmap_write`</fact></td>
        <td><fact id="ROW-SPECMAP-WRITE-CLI" status="impl/done">`typescript-ai-native-specmap`</fact></td>
      </tr>
      <tr>
        <td><fact id="ROW-TRACE-EXPLAIN" status="impl/done">`trace_explain`</fact></td>
        <td><fact id="ROW-TRACE-EXPLAIN-CLI" status="impl/done">`typescript-ai-native trace &lt;target&gt; [--json] [--prose]`</fact></td>
      </tr>
      <tr>
        <td><fact id="ROW-TEST-GATE" status="impl/done">`test_gate`</fact></td>
        <td><fact id="ROW-TEST-GATE-CLI" status="impl/done">`typescript-ai-native test-gate [--baseline]`</fact></td>
      </tr>
      <tr>
        <td><fact id="ROW-TRIPWIRE" status="impl/done">`tripwire`</fact></td>
        <td><fact id="ROW-TRIPWIRE-CLI" status="impl/done">`typescript-ai-native tripwire [--base] [--debt]`</fact></td>
      </tr>
      <tr>
        <td><fact id="ROW-HEALTH" status="impl/done">`health`</fact></td>
        <td><fact id="ROW-HEALTH-CLI" status="impl/done">`typescript-ai-native health [--out]`</fact></td>
      </tr>
      <tr>
        <td><fact id="ROW-FAST-LOOP" status="impl/done">`fast_loop`</fact></td>
        <td><fact id="ROW-FAST-LOOP-CLI" status="impl/done">`typescript-ai-native fast-loop [--cell] [--budget-secs] [--enforce-budget]`</fact></td>
      </tr>
      <tr>
        <td><fact id="ROW-CODEMOD-ADD-CELL" status="impl/done">`codemod_add_cell`</fact></td>
        <td><fact id="ROW-CODEMOD-ADD-CELL-CLI" status="impl/done">`typescript-ai-native codemod add-cell &lt;cell&gt; &lt;spec-uri&gt;`</fact></td>
      </tr>
      <tr>
        <td><fact id="ROW-TCG-VALIDATE" status="impl/done">`tcg_validate`</fact></td>
        <td><fact id="ROW-TCG-VALIDATE-CLI" status="impl/done">`typescript-ai-native-tcg validate &lt;file&gt; [--content-from]`</fact></td>
      </tr>
      <tr>
        <td><fact id="ROW-TCG-SCOPE" status="impl/done">`tcg_scope`</fact></td>
        <td><fact id="ROW-TCG-SCOPE-CLI" status="impl/done">`typescript-ai-native-tcg scope &lt;file&gt; [--position]`</fact></td>
      </tr>
      <tr>
        <td><fact id="ROW-TCG-COMPLETE" status="impl/done">`tcg_complete`</fact></td>
        <td><fact id="ROW-TCG-COMPLETE-CLI" status="impl/done">`typescript-ai-native-tcg complete &lt;file&gt; --position [--prefix] [--max]`</fact></td>
      </tr>
      <tr>
        <td><fact id="ROW-TCG-TYPE" status="impl/done">`tcg_type`</fact></td>
        <td><fact id="ROW-TCG-TYPE-CLI" status="impl/done">`typescript-ai-native-tcg type &lt;file&gt; --position`</fact></td>
      </tr>
      <tr>
        <td><fact id="ROW-TCG-BENCH" status="impl/done">`tcg_bench`</fact></td>
        <td><fact id="ROW-TCG-BENCH-CLI" status="impl/done">`typescript-ai-native-tcg bench --corpus --report`</fact></td>
      </tr>
    </table>
    <p p="8"><fact id="THE-SPECMAP-GATE-FORM-STAYS-CLI-ONLY" status="impl/done">`typescript-ai-native-specmap --gate` (the package-self-trace form) stays
CLI-only, as on the rust side.</fact></p>
    <p p="9"><fact id="THE-TS-UMBRELLA-HAS-NO-LEDGER-COMMAND" status="impl/done">The TS umbrella has no ledger command —
seventeen tools, not eighteen.</fact></p>
  </section>
  <section id="discipline-tools" title="The discipline half">
    <p p="10"><fact id="TWELVE-THIN-ADAPTERS-OVER-THE-LIB-FNS" status="impl/done">Twelve thin adapters over `typescript_ai_native_cli` /
`typescript_ai_native_conform` / `typescript_ai_native_specmap` lib fns, each
wrapped in the stderr-capture guard — an agent's report carries the
run's whole story (node, tsc, prettier, eslint children included).</fact></p>
    <p p="11"><fact id="EVERY-SCHEMA-CARRIES-THE-OPTIONAL-LANGUAGE-PROPERTY" status="impl/done">Every schema carries the optional `language` property; a
non-`typescript` value refuses with the recipe naming that language's
own server (PROP-026 §2 continuity).</fact></p>
    <p p="12"><fact id="HEAVY-TOOLS-SAY-EXPECT-MINUTES-AND-NOTHING-PROMPTS" status="impl/done">Heavy tools say «expect minutes»;
nothing prompts.</fact></p>
  </section>
  <section id="tcg-tools" title="The tcg half">
    <p p="13"><fact id="ONE-PERSISTENT-ORACLE-SESSION-SHARED-BY-FIVE-TOOLS" status="impl/done">The four oracle ops + the bench harness over ONE persistent
LanguageService session shared by all five tools: lazy-spawned and
`init`-ed on first use (the policy's topology — cells dir, seam —
rides the init), respawned ONCE per op on a crashed session.</fact></p>
    <p p="14"><fact id="ENRICHMENT-GOES-THROUGH-ENRICH-VALIDATE" status="impl/done">Enrichment
goes through `typescript_ai_native_tcg::enrich_validate` — the gate's own
rules — with the policy reloaded per call, so a mid-session freeze is
honoured immediately.</fact></p>
    <p p="15"><fact id="TCG-VALIDATE-ISERROR-MIRRORS-THE-ONE-SHOT-EXIT-CONTRACT" status="impl/done">`tcg_validate`'s `isError` mirrors the one-shot
exit contract: an error diagnostic OR a non-baselined finding.</fact></p>
    <p p="16"><fact id="THE-NDJSON-SERVE-RELAY-REMAINS-SHIPPED" status="impl/done">The
NDJSON serve relay (`typescript-ai-native-tcg serve`, TCG-PROTOCOL-v0.1) remains
shipped in the stack as the non-MCP embedding form.</fact></p>
  </section>
</spec>
