<?xml version="1.0" encoding="utf-8"?>
<entry xmlns="http://www.w3.org/2005/Atom" xml:base="https://docs.spec-kitty.ai/architecture/charter-backend-service-future/">
  <id>https://docs.spec-kitty.ai/architecture/charter-backend-service-future/</id>
  <title>Charter Backend Service (Future — Backlog)</title>
  <updated>2026-10-19T00:00:00.000Z</updated>
  <author><name>Spec Kitty</name></author>
  <link rel="alternate" type="text/html" href="https://docs.spec-kitty.ai/architecture/charter-backend-service-future/"/>
  <summary>Preliminary backlog design for a separate charter/doctrine resolution process behind a stable API/MCP endpoint: remote compute, shared caching, out-of-cycle precompute. Backlog.</summary>
  <content type="html">&lt;span id=&quot;charter-backend-service-future--backlog&quot;&gt;&lt;/span&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Scope:&lt;/strong&gt; &lt;strong&gt;BACKLOG — not scheduled for 4.0.0&lt;/strong&gt; (design spike #3815 sits in the Product backlog; see the &lt;a href=&quot;/plans/4-0-0-milestone-roadmap/&quot;&gt;4.0.0 roadmap&lt;/a&gt;). This is a &lt;em&gt;preliminary&lt;/em&gt; design sketch
for discussion, not committed work. The near-term stabilization that must land first
(activation-data fix + orchestrator-injects contract + &lt;code dir=&quot;auto&quot;&gt;/spk-load-profile&lt;/code&gt;) is specified
in &lt;a href=&quot;/architecture/profile-load-reliability/&quot;&gt;Profile-Load Reliability&lt;/a&gt; §4. This document describes
the &lt;strong&gt;evolution&lt;/strong&gt; that the orchestrator-injects contract deliberately makes possible.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Not the same as charter &lt;em&gt;package&lt;/em&gt; extraction.&lt;/strong&gt; This page is about a future &lt;em&gt;runtime
resolution service&lt;/em&gt; (a long-lived process behind an API/MCP seam). It is distinct from the
&lt;strong&gt;charter → own-repository / external-contract-package&lt;/strong&gt; extraction ratified 2026-10-12 (ADR
&lt;a href=&quot;/adr/4.x/2026-10-12-2-charter-extraction-to-its-own-repository/&quot;&gt;&lt;code dir=&quot;auto&quot;&gt;2026-10-12-2&lt;/code&gt;&lt;/a&gt;; that
one is packaging/repository topology, precondition #645, now GA-gating). The two can compose
later but are separate tracks; this backend service remains backlog and is unchanged by the
October direction.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Update 2026-10-19:&lt;/strong&gt; the package extraction is superseded (&lt;code dir=&quot;auto&quot;&gt;spec-kitty-charter&lt;/code&gt; ADR-0008 and
ADR-0010): the Python charter stays in core until it is retired, and offering reads cut over
to the &lt;code dir=&quot;auto&quot;&gt;spec-kitty-charter&lt;/code&gt; service, a CLI-started per-worktree daemon behind
&lt;code dir=&quot;auto&quot;&gt;charter.offering.api&lt;/code&gt; (ADR
&lt;a href=&quot;/adr/4.x/2026-10-03-1-charter-read-write-service-strangler/&quot;&gt;&lt;code dir=&quot;auto&quot;&gt;2026-10-03-1&lt;/code&gt;&lt;/a&gt;, Amendment
2026-10-19).&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2 id=&quot;1-motivation&quot;&gt;1. Motivation&lt;/h2&gt;
&lt;p&gt;Today, charter/doctrine resolution runs &lt;strong&gt;in-process, per invocation&lt;/strong&gt;, via the
&lt;code dir=&quot;auto&quot;&gt;spec-kitty&lt;/code&gt; CLI (&lt;code dir=&quot;auto&quot;&gt;agent profile show&lt;/code&gt;, &lt;code dir=&quot;auto&quot;&gt;charter context&lt;/code&gt;). That is correct for a single
orchestrator, but it couples every resolution to a local checkout and pays a cold-start +
environment-drift cost each call. A separate, long-lived &lt;strong&gt;charter backend process&lt;/strong&gt; —
reached through a stable API and/or MCP endpoint — unlocks capabilities the in-process
model cannot offer:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Remote compute&lt;/strong&gt; — resolution runs where the doctrine corpus and compute live, not on
every consumer’s machine; thin clients (CI, IDE agents, headless/cron, other repos) call
the same authority.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Shared caching&lt;/strong&gt; — a warm process caches compiled charters, DRG traversals, profile
lineage, and action-scoped context across invocations and across consumers, instead of
recompiling per CLI call.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Out-of-cycle context precomputation&lt;/strong&gt; — the backend can precompute and refresh
action-scoped context and profile bundles &lt;em&gt;ahead of&lt;/em&gt; a mission/squad run (on charter
change, on a schedule), so dispatch reads a ready artifact rather than resolving on the
critical path.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;2-design-constraints-carried-from-the-near-term-work&quot;&gt;2. Design constraints (carried from the near-term work)&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Same resolution contract.&lt;/strong&gt; The backend sits behind the &lt;em&gt;identical&lt;/em&gt; contract the
orchestrator already uses in &lt;a href=&quot;/architecture/profile-load-reliability/&quot;&gt;Profile-Load Reliability&lt;/a&gt;
§4.2 — request &lt;code dir=&quot;auto&quot;&gt;(profile_id, action)&lt;/code&gt; → resolved profile + compact context. Adopting
it must not touch delegate prompts.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Fail-loud, never fail-open.&lt;/strong&gt; Backend-down or profile-unresolved surfaces as a hard
error at the orchestrator (substitute / activate / abort) — never a silently unprofiled
delegate. This is the invariant Issue 1 violated.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Overlays applied server-side.&lt;/strong&gt; Resolution must apply overlays, &lt;code dir=&quot;auto&quot;&gt;specializes_from&lt;/code&gt;
lineage, and &lt;code dir=&quot;auto&quot;&gt;enhances&lt;/code&gt;/&lt;code dir=&quot;auto&quot;&gt;overrides&lt;/code&gt; — the raw-YAML fallback that skips these is not an
acceptable backend response.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Loopback-only, read-only by default.&lt;/strong&gt; If exposed over HTTP, bind to &lt;code dir=&quot;auto&quot;&gt;127.0.0.1&lt;/code&gt;
read-only (consistent with the repo’s loopback-only control-plane policy); do not force
HTTPS on an intentionally-loopback transport. Remote exposure is an explicit,
authenticated opt-in, not the default.&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&quot;3-transport-options-to-evaluate-not-yet-decided&quot;&gt;3. Transport options (to evaluate, not yet decided)&lt;/h2&gt;

























&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Option&lt;/th&gt;&lt;th&gt;Wins&lt;/th&gt;&lt;th&gt;New failure modes&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;strong&gt;Local daemon + API&lt;/strong&gt; (precedent: the retired sync daemon, &lt;code dir=&quot;auto&quot;&gt;core/loopback_http.py&lt;/code&gt;, &lt;code dir=&quot;auto&quot;&gt;auth/loopback/callback_server.py&lt;/code&gt;)&lt;/td&gt;&lt;td&gt;Warm authority; kills cold-start + install/PYTHONPATH drift; one source of truth across harnesses&lt;/td&gt;&lt;td&gt;Daemon lifecycle (start/stop/ports); staleness on charter change (needs reload/invalidation); availability dependency; real-port tests must run serially&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;strong&gt;MCP endpoint&lt;/strong&gt;&lt;/td&gt;&lt;td&gt;Directly serves shell-less harnesses (tool result → context, no shell); uniform across MCP-capable agents&lt;/td&gt;&lt;td&gt;“Interactively-authenticated MCP servers may be absent in headless/cron” — trades the shell-less gap for an absent-in-headless gap&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;strong&gt;Remote service&lt;/strong&gt;&lt;/td&gt;&lt;td&gt;Remote compute; shared cache across machines/repos; centrally-refreshed doctrine for a multi-repo program&lt;/td&gt;&lt;td&gt;Network dependency; auth/tenancy; cache-coherence; larger security surface&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;p&gt;A likely path is &lt;strong&gt;local daemon first&lt;/strong&gt; (behind the §2 contract), with MCP and remote
exposure as later transports over the same core — but this is open for design review.&lt;/p&gt;
&lt;h2 id=&quot;4-open-questions&quot;&gt;4. Open questions&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Cache invalidation&lt;/strong&gt; — how does the backend detect charter/pack/DRG changes and
invalidate compiled artifacts without serving stale doctrine?&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Consistency vs. freshness&lt;/strong&gt; — for a long squad run, does a delegate get a pinned
snapshot (deterministic) or the latest (fresh)? The near-term design pins at dispatch;
the backend should keep that default.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Authority reconciliation&lt;/strong&gt; — the canonical “squad-eligible profiles” query is
&lt;strong&gt;authored in charter data near-term&lt;/strong&gt; (&lt;a href=&quot;/architecture/profile-load-reliability/&quot;&gt;Profile-Load Reliability&lt;/a&gt;
§4.2 / §6 D4); the only backlog-open question is whether the backend later &lt;strong&gt;exposes&lt;/strong&gt; it as
an endpoint. This is the seam gap from Profile-Load Reliability §2.4, promoted to a
first-class API concern.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Degradation&lt;/strong&gt; — precise behavior when the backend is unreachable: the orchestrator
falls back to in-process CLI resolution (same contract) and never to unprofiled dispatch.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Relationship to &lt;code dir=&quot;auto&quot;&gt;orchestrator-api&lt;/code&gt;&lt;/strong&gt; — does this reuse or extend the existing external
orchestrator-api surface, or stand alone?&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;5-non-goals&quot;&gt;5. Non-goals&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Not a replacement for the in-process CLI resolution path — that remains the default and
the degradation target.&lt;/li&gt;
&lt;li&gt;Not a prerequisite for fixing squad profile loading — the near-term design stands alone.&lt;/li&gt;
&lt;li&gt;Not scheduled for 4.0.0.&lt;/li&gt;
&lt;/ul&gt;</content>
</entry>
