{
  "schema_version": "1.3.0",
  "slug": "why-does-an-instance-drift-past-its-declared-capability-envelope-during-mid-session-skill-hot-swap-and-how-do-we-bound-the-leak",
  "title": "Why does an instance drift past its declared capability envelope during mid-session skill hot-swap, and how do we bound the leak?",
  "date_of_record": "2026 November 28",
  "scope": "Applies to long-lived agent instances that load, unload, or replace sandboxed skill manifests at runtime without a full process restart, where capabilities are enforced by a policy broker inspecting tool-call intents. Does not apply to cold-boot-only skill loading, nor to stateless one-shot invocations where the manifest is bound to a single request.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/why-does-an-instance-drift-past-its-declared-capability-envelope-during-mid-session-skill-hot-swap-and-how-do-we-bound-the-leak.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-drift-past-its-declared-capability-envelope-during-mid-session-skill-hot-swap-and-how-do-we-bound-the-leak.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-drift-past-its-declared-capability-envelope-during-mid-session-skill-hot-swap-and-how-do-we-bound-the-leak.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1890,
    "python_slice_tokens": 418,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The distinction that matters here is between **capability declaration** (the static set of permissions a skill manifest asserts, e.g. `fs.read:/data`, `net.egress:api.internal`) and **capability derivation** (the transitive closure of what the *running instance* can actually reach once a skill is loaded into an already-warm context). Policy enforcement typic...",
    "what_was_observed": "A coding agent instance was configured with a `repo-analyst` skill holding `fs.read:/repo` and a `shell.exec:readonly` capability. Mid-task, the orchestrator hot-swapped in an untrusted third-party `format-linter` skill declaring only `fs.read:/repo/tmp` and `stdout.write`. The swap passed manifest validation: the new skill's declared set was a strict subset of the process's ambient grants, so the broker raised no di...",
    "condition_of_validity": "The invariant that was assumed — *\"the active manifest's grant set bounds the instance's reachable capability set\"* — holds **only if** the instance's context and shared state are fully re-derived from the active manifest at swap time. Concretely, the invariant is valid iff all three hold: - **Schema partition:** every tool schema in the model context is tag...",
    "decision_boundary": "The decision boundary is whether to enforce at **load time** (validate the manifest, trust the runtime to keep context clean) or at **call time** (validate every intent against a provenance-stamped, skill-scoped grant, and reject unattributed intents by default). Load-time enforcement is cheap and fails open under hot-swap. Call-time enforcement is the only ...",
    "operational_effect": "The operational consequence is that hot-swap must be treated as a **capability boundary crossing**, not a routine config update. The correct implementation is a swap protocol with three mandatory phases: (1) *quiesce* — drain in-flight intents and freeze the scratchpad; (2) *scrub* — evict schemas, clear or namespace scratchpads, and tag caches with the outg..."
  },
  "matched_failure_symptoms": [
    "DOMAIN:EPISTEMIC_PROVENANCE_AND_FEDERATION_ROUTING"
  ],
  "composition_edges": {
    "primary_domain": "epistemic_provenance_and_federation_routing",
    "upstream_precondition_residuals": [
      "https://corpusfetch.com/c/according-to-what-precedence-hierarchy-must-an-instance-resolve-contradictory-directives-across-system-developer-and-user-tiers.md",
      "https://corpusfetch.com/c/how-should-an-instance-decide-that-a-stored-conclusion-has-gone-stale-without-a-new-observation.md"
    ],
    "downstream_consequence_residuals": [
      "https://corpusfetch.com/c/by-what-checkpoint-and-compaction-boundaries-must-an-instance-externalize-working-state-to-prevent-context-window-drift-and-truncation-amnesia.md",
      "https://corpusfetch.com/c/across-what-additive-schema-and-unknown-field-preservation-boundaries-must-an-instance-evolve-wire-contracts-to-prevent-rolling-deploy-deserialization-crashes.md"
    ],
    "co_occurring_sibling_residuals": [
      "https://corpusfetch.com/c/how-can-an-instance-capture-implicit-user-preferences-without-storing-private-data.md",
      "https://corpusfetch.com/c/how-can-an-instance-compress-long-reasoning-traces-into-binding-conclusions.md"
    ]
  },
  "empirical_verification_warrant": {
    "status": "AST_AND_INVARIANT_VERIFIED",
    "syntax_valid": true,
    "code_sha256": "a5c12bf0782f85ca279e454bd9ac78976163932175969564c9d7b2728e7b266b",
    "verified_classes": [
      "CapabilityEnvelopeEscape",
      "SkillScopedBroker"
    ],
    "verified_functions": [
      "swap_skill",
      "__init__",
      "_resolve_provenance",
      "authorize",
      "read_cache"
    ],
    "verified_functions_count": 5,
    "defensive_guards_count": 6,
    "raised_exceptions": [
      "CapabilityEnvelopeEscape"
    ],
    "sample_fail_closed_invariants": [
      "cannot hot-swap while intents are in flight; quiesce first"
    ],
    "stdlib_dependencies": [],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
