Skip to main content

Core Concepts

Context Fabric Work Reuse

Work reuse lets the gateway use evidence from an engineering task that someone already completed. That evidence is a work receipt: a record of the changes, the test results, and the repository and branch of the task.

For example, an agent investigates a test failure and records a verified fix. When a later request asks about the same failure, the gateway can add that receipt to the model context, or run the verifier that proved the fix.

Reuse is not a response cache. The gateway still calls the model. It does not replay earlier commands or apply an earlier patch by itself. When it cannot use a receipt, the request continues as a new investigation.

Set up capture and scope first. See Context Fabric Lifecycle.

The decision loop​

For each request, the gateway:

  1. Classifies the task as exact_repeat, near_repeat, known_pattern_new_location, or novel.
  2. Searches for a verified work receipt in scope, before it uses broader context recall.
  3. Selects a reuse mode from the receipt evidence.
  4. Evaluates the active governance policy for that mode.
  5. Applies the mode only if the gateway can execute it. Otherwise, it opens a new investigation.
  6. Records the decision in the response metadata and in audit events.

An earlier answer alone never authorizes reuse.

What a work receipt contains​

A receipt can contain:

  • The task intent and a normalized fingerprint of the prompt
  • The repository, branch, team, and agent scope
  • Changed files and symbols
  • Commands that can run again, and known error signatures
  • A patch summary and the last result
  • Verifier or test evidence
  • Confidence and verification status
  • A link to a newer receipt that replaces it

Verdictan redacts detected secrets and other sensitive values from stored summaries, command previews, and evidence before it stores a receipt. This is an additional control, not permission to store sensitive data. Remove what the receipt does not need before you submit it.

Reuse modes​

The gateway selects a mode from the novelty class, the confidence, the scope match, and the policy decision.

ModeWhat the gateway doesTypical case
answer_from_receiptAdds the verified receipt summary to the request context and calls the model. It does not return the earlier answer.An exact_repeat task with a verified, high-confidence patch summary
run_known_verifierRuns only the known verifier commands of the receipt through the configured local access, and adds the result to the context.Work with a verifier that can run again, but no safe command reuse
replay_commandsRecognized by selection and policy, but the gateway changes it to open_fresh_investigation. It cannot replay commands.An exact_repeat or near_repeat task with commands that can run again
adapt_previous_patchRecognized by selection and policy, but the gateway changes it to open_fresh_investigation. It cannot adapt a patch.A near_repeat task or known pattern with overlapping files
open_fresh_investigationStarts a new investigation without reuse.Novel work, weak evidence, a denied policy, or missing local requirements

When the evidence is not strong enough for safe reuse, the gateway selects open_fresh_investigation.

Governance boundaries​

The gateway applies answer_from_receipt or run_known_verifier without a user action only when all of these are true:

  • The receipt is trusted and in scope.
  • The active policy allows the mode.
  • The confidence is at or above the threshold for the mode.
  • For run_known_verifier, the gateway has local access to run the verifier.
  • Each verifier action is read-only and has no side effects.

It never applies replay_commands or adapt_previous_patch automatically.

Get approval, or start a new investigation, for work with more risk:

  • Destructive commands
  • External writes or data export
  • Secrets or sensitive policy operations
  • Production writes or service changes
  • Low-confidence results
  • A policy evaluation that is missing or failed

The gateway evaluates policy when it reuses a receipt. The policy that applied when the receipt was captured does not count.

Poisoning defense and scope isolation​

When context is old or poisoned, reuse fails closed. Autonomous reuse ignores:

  • Receipts in the stale, disputed, superseded, or conflict_pending state
  • Context outside the active organization, team, repository, branch, or agent scope
  • Receipts without the provenance that safe reuse needs

The gateway also:

  • Ranks receipts by trust and age.
  • Invalidates compiled context packs when a matching receipt or shared context changes.
  • Requires verifier commands to pass before a reused path reports success.
  • Checks the active policy every time, even if an earlier decision allowed the same action.

Verify reuse​

  1. Send a test request in the same repository, branch, team, and agent scope as a verified receipt.
  2. Find the verdictan.work_reuse object in the response metadata.
  3. Compare requested_mode with mode. A requested mode can change to open_fresh_investigation.
  4. Examine matched_receipt_id, policy_decision, and reason_code, and then reuse_applied.
  5. If a verifier ran, examine its result and the related events in Trail.

These fields are in the verdictan object of the response:

FieldMeaning
context_fabric.novelty_classThe novelty class of the task
work_reuse.novelty_classThe novelty class that the reuse decision used
work_reuse.requested_mode, work_reuse.modeThe mode that the evidence requested, and the mode that the gateway applied
work_reuse.matched_receipt_idThe matching receipt, if one matched
work_reuse.policy_decision, work_reuse.policy_id, work_reuse.reason_codeThe policy result for the requested mode
work_reuse.verifier_commands, work_reuse.verifierThe verifier commands and their result, if a verifier ran
work_reuse.reuse_applied, work_reuse.replay_successWhether reuse and replay succeeded

Trail records these events:

  • gateway.work_reuse.policy_decision
  • gateway.work_reuse.verifier.start
  • gateway.work_reuse.verifier.success
  • gateway.work_reuse.verifier.failure
  • gateway.work_reuse.outcome

The metadata also estimates the tool executions and model calls that reuse saved. If you put these numbers in a cost or reuse report, label them as telemetry estimates. They are not invoice data.

When reuse does not occur​

With Context Fabric on, the gateway starts a new investigation when:

  • The task is novel.
  • The receipt is not in the active team, repository, branch, or agent scope.
  • The receipt is not in a trusted state.
  • The gateway cannot safely reuse or verify work in the active working directory.
  • The active policy denies the action or requires approval.

Next steps​