Cap large observations at the boundary. Tell the consumer that truncation occurred and keep the full content addressable through a stable handle; never silently return a prefix as if it were complete.Capped output and remediation errors
Bound observations while enabling recovery.
observation_boundaryRECORD STATUSCandidate · v0.1.0UML class view
The proposed contract drawn as participant roles, received calls, and numbered dependencies.
Object interactions
The same roles and calls as a class collaboration and a numbered message sequence.
Pointcut
Where the mechanism applies. All four dimensions belong to the proposed match, not just its vocabulary.
- Context
- A tool or environment can emit output larger than the context allowance.
- Trigger
- Output crosses a size or token cap.
- Structure
- Limit policy, truncation metadata, and access to complete artifacts.
- Effect
- The harness returns a bounded observation with explicit recovery information.
Protected contract
The obligation that clients, operators, and auditors should be able to rely on.
- Requires
- Output size is measurable and original content remains addressable.
- Ensures
- The consumer knows truncation occurred and can seek the full result.
- Invariant
- Truncation never masquerades as complete evidence.
- Violation
- Oversized or unavailable output returns a typed remediation error.
Negative control
A logging length limit unrelated to agent observations does not count.
Variation & lifecycle
The hot spot is admitted only where the protected semantics survive.
Permitted variation
Character, line, token, structure-aware caps, summaries, and repair hints.
Test obligation
Test exact limit, over-limit, non-UTF8, complete-artifact retrieval, and retry.
Evolution question
Did remediation become a typed contract rather than only text truncation?
Prompt + code design
An illustrative prompt and a small design sketch for the proposed contract. Names and APIs are invented; this is not a repository excerpt.
def cap_observation(observation, limit):
if len(observation.content) <= limit:
return observation
handle = store.put(observation.content)
preview = observation.content[:limit]
return Observation(
content=preview,
truncated=True,
full_ref=handle,
repair_hint=f"read({handle}, offset=...)",
)Illustrative design sketch. A truncation flag without a retrieval path turns a size limit into lost evidence. This example is a teaching aid, not implementation evidence or a conformance claim.
Detection & matching
The frozen rule that retrieves this record, the canonical source exemplar, and the control that should stay unmatched.
- Join point
observation_boundary- Source locator
- See the source record.
- Lexical cue
(?i)\b(?:max_output|output[_-]?limit|truncat(?:e|ed|ion)|remediat(?:e|ion))\bFrozen expression, v0.1.0. A match is a retrieval cue, not a confirmed implementation.- Aliases
- None
- Canonical exemplar
- openai/openai-agents-python
src/agents/sandbox/util/token_truncation.py:73Support: tests/sandbox/test_token_truncation.py:1 - Negative control
- A logging length limit unrelated to agent observations does not count.
Scope-anchored review. pohe-agent analyze <repo> --pattern P10 anchors the cue to its enclosing declaration and checks a separate operational signature for all four pointcut dimensions. Missing roles and negative-control risks remain visible; a structural match is not E2/E3. Calibration report ↗
Repository files
Up to five public files retrieved by the frozen cue and pinned to the audited commit. A match is a place to inspect, not a confirmed implementation.
src/agents/sandbox/util/token_truncation.py:73CANONICAL SOURCE02aaif-goose/goosecrates/goose/src/acp/handoff.rs:6RETRIEVAL CUE03affaan-m/ECCskills/continuous-learning-v2/scripts/instinct-cli.py:1228RETRIEVAL CUE04agno-agi/agnolibs/agno/agno/client/os.py:2028RETRIEVAL CUE05Aider-AI/aideraider/repomap.py:781RETRIEVAL CUEEvidence & provenance
Each layer answers a different question. Do not substitute retrieval for review.
Source-located exemplar
A concrete source anchor is available for this proposed record. It is one exemplar, not evidence that all repositories—or every contract field—conform.
Review boundary: this candidate and its specification come from an AI-assisted study. Independent human validation remains open.
100.0% of repository families in the frozen panel have at least one current cue, historical cue, or canonical source layer. This is not confirmed prevalence.
Current lexical-cue repositories: 40 / 4186bd29878b30src/agents/sandbox/util/token_truncation.py:73tests/sandbox/test_token_truncation.py:1Bounded output with explicit truncation metadata.
Exploratory retrieval cue Regex / v0.1.0
(?i)\b(?:max_output|output[_-]?limit|truncat(?:e|ed|ion)|remediat(?:e|ion))\bThis expression is a discovery instrument only. A match is a retrieval cue—not a confirmed implementation, pointcut match, or contract proof.