{
  "schema_version": "1.3.0",
  "slug": "what-happens-when-an-instance-misattributes-child-agent-token-spend-under-inherited-context-conventions",
  "title": "What happens when an instance misattributes child-agent token spend under inherited context conventions",
  "date_of_record": "2026 December 1",
  "scope": "Applies to orchestrator/worker agent topologies where sub-agents inherit a parent's prompt/tool-call conventions and a shared observability bus attributes token and cost counters to the emitting agent. Does not apply to single-agent deployments or to systems where every sub-agent has an isolated billing identity and no shared context inheritance.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-misattributes-child-agent-token-spend-under-inherited-context-conventions.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-misattributes-child-agent-token-spend-under-inherited-context-conventions.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-misattributes-child-agent-token-spend-under-inherited-context-conventions.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1483,
    "python_slice_tokens": 276,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure is not \"the meter is wrong.\" It is that the *semantic convention* governing what a token belongs to—the parent that seeded the context, or the child that emitted the completion—drifts silently when a sub-agent is spawned via context inheritance. A parent agent fans out to a worker by passing a large shared prefix (system prompt, tool schemas, pri...",
    "what_was_observed": "A three-worker fan-out under a 42k-token shared system prompt and tool schema set. Per-span telemetry: - Parent span: `input_tokens=42100`, `output_tokens=1800`. - Worker A span: `input_tokens=42100 + 640`, `output_tokens=900`. - Worker B span: `input_tokens=42100 + 610`, `output_tokens=880`. - Worker C span: `input_tokens=42100 + 590`, `output_tokens=870`. The rollup reported total input tokens of `42100 + (42740 + ...",
    "condition_of_validity": "The naive per-span convention is valid **only** when the intersection of any two agents' input contexts is empty—i.e., no shared prefix, no inherited system prompt, no replayed conversation history. It is also valid when the observability bus carries an explicit `shared_prefix_ref` and `prefix_owner` field so the rollup can subtract the shared region from ea...",
    "decision_boundary": "When a sub-agent's `input_tokens` exceeds a threshold fraction (empirically ~0.8) of the parent's `input_tokens` and the child was spawned within the parent's span lifetime, treat the child's input as *inherited* and do not attribute its prefix to the child. Emit a `prefix_inheritance` event with `{child_span, parent_span, shared_tokens, owner: parent}` and ...",
    "operational_effect": "Without the guardrail, cost dashboards systematically under-report fan-out cost (because the parent looks cheap) while over-reporting per-worker cost (because workers carry phantom prefix), which inverts the optimization signal: engineers prune workers that are actually cheap and leave the expensive shared prefix untouched. The corrected convention flips the..."
  },
  "matched_failure_symptoms": [
    "SUBPROCESS_PIPE_HANG_OR_FD_LEAK"
  ],
  "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": "551244a0110712e4aceed4908a9acac771cc8741c9ca829e47095241efd18ce5",
    "verified_classes": [
      "AttributionConventionError",
      "Span"
    ],
    "verified_functions": [
      "attribute_cost"
    ],
    "verified_functions_count": 1,
    "defensive_guards_count": 4,
    "raised_exceptions": [
      "AttributionConventionError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
