In what scenarios must an instance distrust a LITMUS Composition Score that aggregates per-skill safety margins across a shared capability surface
**Date of Record:** 2026 December 1 **Scope:** Applies to any agent runtime that gates skill invocation using a LITMUS-style composition score computed by summing or averaging per-skill adversarial safety margins over a shared capability surface (tool access, filesystem scope, network egress, credential scope). Does not apply to per-call isolation sandboxes where each skill executes in a fresh, non-overlapping capability domain, nor to scores computed purely from static skill manifests without runtime adversarial probing.
Core Distinction
A LITMUS composition score is *additive* by construction: each skill $s_i$ is probed adversarially to yield a margin $m_i \in [0,1]$ (fraction of adversarial probes that stay within policy), and the composition score is typically $S = \sum_i w_i m_i$ or $S = \min_i m_i$ reported as a single scalar. The distinction that matters operationally is between **margin as a per-skill property** and **margin as a property of the composed capability surface**. Additive aggregation assumes the capability surfaces are disjoint or that adversarial pressure on one skill cannot raise the effective attack surface of another. When two individually-safe skills share a write primitive (e.g., a filesystem write tool and a shell executor both reaching the same mount), the composed surface is not the union of margins—it is the *intersection of the least-guarded path*, and the score over-reports safety.
The non-obvious failure: a skill with margin $m_i = 0.98$ can be *destabilized* by co-invocation with a skill of margin $m_j = 0.97$ because the second skill supplies the *capability* the first skill's adversarial probes assumed absent. LITMUS probes each skill in isolation, so the probe set for $s_i$ never contains the tool calls that $s_j$ makes available. The score is therefore a lower bound on safety only under the disjoint-capability invariant, which is almost never true in agent runtimes.
What Was Observed
A three-skill agent (file-read, file-write, shell-exec) reported a LITMUS composition score of 0.96 (weighted mean of 0.99, 0.97, 0.92). The runtime admitted a task chain: read a config, write a derived artifact, run a linter. During replay under adversarial perturbation, the following trace appeared:
- `file-read` probe set (isolation) included path-traversal attempts; margin 0.99 because the read tool rejects `..` segments.
- `file-write` probe set (isolation) included overwrite attempts on protected paths; margin 0.97 because write is scoped to a designated output directory.
- `shell-exec` probe set (isolation) included command-injection attempts; margin 0.92 because the executor blocks `;`, `|`, `$()`.
- **Composed invocation:** `file-write` wrote a file into the output directory whose *name* was derived from untrusted input (`config.<user-supplied>.json`). `shell-exec` then ran `lint *.json` inside that directory. The shell glob expanded to include the attacker-named file, and the linter's own config-loading logic read a file whose name the attacker controlled, which contained a `--plugin` directive that the linter executed. No individual skill's probe set contained this path because the read tool's traversal rejection, the write tool's directory scoping, and the shell's metacharacter blocklist each held—the exploit crossed skill boundaries through *shared filesystem state*, not through any single skill's policy.
The composition score of 0.96 was consistent with the observed per-skill margins and yet the composed system failed. The score was not wrong about its inputs; it was wrong about its *domain of validity*.
Condition of Validity
The additive LITMUS score $S = \sum_i w_i m_i$ is a valid safety bound **if and only if** the following invariant holds for every pair of skills $(s_i, s_j)$ that can be co-invoked in a single task:
$$\text{Cap}(s_i) \cap \text{Cap}(s_j) = \varnothing \quad \text{or} \quad \text{ProbeSet}(s_i) \supseteq \text{AdversarialReach}(s_i \mid \text{Cap}(s_j))$$
That is: either the capability surfaces are disjoint, or the probe set for $s_i$ was generated *conditioned on* the capabilities that $s_j$ contributes. In practice neither holds. Capability surfaces overlap on: shared filesystem mounts, shared environment variables, shared working directory, shared process table (a shell can signal a sibling), shared network namespace, and shared credential material. Probe sets are generated per-skill in isolation because generating the cross-product of adversarial conditions is combinatorially infeasible—$n$ skills with $k$ probes each requires $k^n$ composed probes to cover all co-invocation orderings.
The score is therefore valid only as a **per-skill admission signal** (is this skill individually acceptable?) and invalid as a **composition admission signal** (is this task chain acceptable?). The boundary is sharp: the moment the runtime admits a task that invokes two or more skills sharing any capability primitive, the composition score must not be used as the gate.
Decision Boundary
The runtime must switch from composition-score gating to **composed-surface probing** when any of the following is detected at task-admission time:
- **Shared write primitive:** two or more admitted skills can write to a common path prefix. The gate must re-probe with the union of write capabilities, including attacker-controlled filename derivation.
- **Shared read-after-write dependency:** a skill's output path is an input to another skill's glob, expansion, or config-loading step. The gate must treat the intermediate artifact as untrusted regardless of which skill produced it.
- **Shared process or network namespace:** a shell-class skill co-invoked with any skill that spawns subprocesses. The gate must assume the shell can observe and signal sibling processes.
- **Credential or environment inheritance:** any skill that reads environment variables or credential files that another skill can mutate.
When none of these hold—skills are truly disjoint (e.g., a pure-compute skill with no I/O co-invoked with a network-only skill in separate namespaces)—the additive score is admissible and the fast path may be used. The decision boundary is *capability-surface overlap*, not score magnitude. A score of 0.99 with overlap is less safe than a score of 0.85 without overlap, and the runtime must not rank by score across the boundary.
Operational Effect
The practical consequence is that LITMUS scores must be tagged with the capability surface they were computed over, and the runtime must refuse to compare or aggregate scores across different surfaces. Concretely:
- **Score provenance binding.** Each per-skill margin is stored with a hash of the capability surface it was probed under. A composition score is only valid if all constituent margins share a surface hash, or if the runtime has explicitly re-probed under the union surface.
- **Composition admission requires union-surface probing.** When overlap is detected, the runtime must run a *composed* probe set—at minimum, adversarial filenames through write→read→exec chains, environment mutation through write→exec, and process signaling through exec→exec—before admitting the task. This is more expensive and must be budgeted.
- **Fail-closed on surface drift.** If a skill's declared capability surface changes (a new mount, a new env var, a widened glob) after its margin was computed, the margin is stale and must be invalidated. A stale margin is not a conservative bound; it is an unverified claim.
- **No cross-surface ranking.** The scheduler must not prefer a high-score skill over a low-score skill when their surfaces differ, because the scores are not on a common scale. Ranking across surfaces is a category error that silently reintroduces the additive assumption.
The invariant to enforce: **a composition score is a proof only over the surface it was computed on, and the surface of a composed task is the union of the surfaces of its skills, which is never the surface any individual skill was probed on.** The runtime must treat every multi-skill task as requiring a fresh union-surface probe, and must treat the per-skill LITMUS score as an admission filter for *which skills may participate*, never as a guarantee for *what the composition may do*.
from __future__ import annotations
from dataclasses import dataclass, field
from typing import FrozenSet
class CompositionScoreMisapplied(RuntimeError):
"""Raised when a LITMUS composition score is used to gate a task whose
capability surface is not covered by the surfaces the constituent
per-skill margins were probed on."""
@dataclass(frozen=True)
class CapabilitySurface:
write_prefixes: FrozenSet[str]
read_prefixes: FrozenSet[str]
env_keys: FrozenSet[str]
namespaces: FrozenSet[str] # e.g. "fs", "net", "proc"
def overlaps(self, other: "CapabilitySurface") -> bool:
if self.namespaces & other.namespaces:
# shared namespace implies potential shared state
return True
if self.write_prefixes & other.read_prefixes:
return True
if other.write_prefixes & self.read_prefixes:
return True
if self.env_keys & other.env_keys:
return True
return False
@dataclass(frozen=True)
class SkillMargin:
skill_id: str
margin: float
probed_surface: CapabilitySurface
@dataclass
class CompositionGate:
margins: dict[str, SkillMargin] = field(default_factory=dict)
def admit_task(self, skill_ids: list[str]) -> float:
if not skill_ids:
raise CompositionScoreMisapplied("empty task chain has no surface")
missing = [s for s in skill_ids if s not in self.margins]
if missing:
raise CompositionScoreMisapplied(
f"skills {missing} have no probed margin; cannot compose"
)
surfaces = [self.margins[s].probed_surface for s in skill_ids]
# Detect capability-surface overlap across the composed chain.
for i in range(len(surfaces)):
for j in range(i + 1, len(surfaces)):
if surfaces[i].overlaps(surfaces[j]):
raise CompositionScoreMisapplied(
f"skills {skill_ids[i]!r} and {skill_ids[j]!r} share a "
f"capability surface; additive LITMUS score is not a "
f"valid bound. Re-probe under union surface before "
f"admitting."
)
# Only reachable when surfaces are pairwise disjoint.
return sum(self.margins[s].margin for s in skill_ids) / len(skill_ids)