Files
reverse-engineering-anything/docs/specs/agent-environments/state-view/plan.md
T
Edgar ArakelyanandClaude Opus 5.5 ad439bd2f2 feat(environment): extract the initial state a capture's reads observed
Add the environment-state analysis view. From the parents the environment
manifest accepts, it extracts the data the capture's reads observed before
the first related write: entity types with an identity field (proved by a
path parameter or inferred from an identity name), entities with their
recorded values and provenance, documents for written non-entity paths, and
a render plan per read tool that is kept only when it reproduces the tool's
latest initial recordings from the state; every other read tool is a
recorded view with the reason. The Evidence is always inferred.

Response-body decoding moves to a domain owner shared with replay, exact
JSON parsing moves to the owner of the exact-number policy, the manifest and
state views share parent admission and record grouping, and
projectAnalysisView takes its accumulators as one object.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 17:29:37 -07:00

1.6 KiB

Implementation plan

  1. Move response-body decoding from the environment source into recordedResponseBody.ts with the caller's byte limit, and exact JSON parsing into exactJsonNumber.ts, so replay and state extraction share one owner each.
  2. Add environmentStateRules.ts as pure helpers: write classification, API bases and roots, entity location, identity names, JSON pointers of depth one, value bytes and the entity and list renderers.
  3. Add EnvironmentStateExtraction.ts for planning item and list tools, observing entities and assembling the result, environmentStateMerge.ts for merging observations, and environmentStateGate.ts for reproducing each plan's recordings; every body is parsed through a budget callback and released before the next.
  4. Add EnvironmentStateAccumulator.ts, extending the manifest accumulator so grouping is shared, retaining record lines and references to the admitted records, and charging bodies and kept values.
  5. Add environmentStateView.ts with the request schema (sharing the manifest's template_rules schema), the result fields and the projector; share capture admission and record grouping with the manifest view; register the kind and pass accumulators to projectAnalysisView as one object; always seal the result inferred.
  6. Cover domain, service, MCP, CLI, catalog and acceptance behavior; document the view in the capture guide, the agent environments guide, the contracts reference and the authored skill.

No new tool, provider, side effect or network activity is introduced. The state is a projection of already retained Evidence; serving it is deferred.