{{ theme.skipToContentLabel || 'Skip to content' }}

Context and Artifact Governance

Status: published 0.3.0 stable release. Supported platforms: Windows and Linux. macOS is not yet officially supported.

What this module solves

Long tasks face two opposing risks: an ever-growing context can exceed the model window, while blunt truncation can lose unfinished work, approval decisions, or failure evidence. Sending complete tool output to the model wastes tokens and can expose credentials. This module separates model-visible context from complete local evidence.

Stable contract

CapabilityModel-visible dataComplete evidence
Stable prefixCore rules, project instructions, tools, facts, and skills in fixed orderSHA-256 fingerprint in traces and metrics
Context compactionLocal deterministic summary plus complete recent turnsReason, token counts, and summary fingerprint
Large outputBounded head and tail, byte summary, and relative artifact reference.coremind/artifacts/*.log, size, hash, and media type
Prompt cacheDeclared availability and actual read/write tokensAggregated provider usage; zero remains zero

The summary preserves goals, constraints, approvals, changed files, test state, incomplete work, next steps, and uncertain effects. Thresholds are checked before every provider request, including requests inside a long loop.

Security boundary

  • The resolved artifact root must remain inside the workspace and names are framework-generated.
  • Only trusted tool temporary-output paths can be imported; forged paths are neither read nor deleted.
  • Suspected API keys, tokens, passwords, or private keys remove the model preview and delete both temporary and staged artifacts.
  • Artifacts are local evidence. They are never uploaded or converted into cross-project memory automatically.
  • Full permission mode does not disable path or credential protection.

Public interfaces

  • buildStableContextPrefix() creates a byte-stable prefix and fingerprint.
  • protectContext() applies deterministic threshold compaction.
  • compareContextStrategies() compares offline metrics without changing defaults.
  • ArtifactStore streams imports, builds previews and hashes, and performs bounded cleanup.
  • RunMetrics.context and RunMetrics.artifacts expose verifiable measurements.

Source and evidence

{{ theme.lastUpdated?.text || theme.lastUpdatedText || 'Last updated' }}:

Released under the MIT License.