Skip to content

feat(execution): add validated context transformation - #7

Merged
HayronHgh merged 5 commits into
mainfrom
agent/validated-transformation-execution
Aug 9, 2026
Merged

feat(execution): add validated context transformation#7
HayronHgh merged 5 commits into
mainfrom
agent/validated-transformation-execution

Conversation

@HayronHgh

@HayronHgh HayronHgh commented Aug 9, 2026

Copy link
Copy Markdown
Owner

Summary

Completes the validated transformation, atomic execution, and post-commit finalization chain for 0.2.0-dev.5:

ValidatedPlan
  -> D0-D2 Execution Preflight
  -> ExecutablePlan
  -> D3 Transformer
  -> TransformationCandidate
  -> D4 Post-transform Validator
  -> ValidatedTransformation
  -> D5 Atomic Executor
  -> ExecutionResult(COMMITTED)
  -> D6 Post-commit Finalization
  -> Inventory Rebuild
  -> Canonical Signed Accounting
  -> ExecutionReport
  -> STOP

D0-D4 remain zero-mutation. D5 is the sole deterministic message-context commit boundary. D6 is model-free derived observation and has no rollback authority.

Milestone progress

  • D0 — execution protocol and frozen M4 experiment identity
  • D1 — current-source RecoveryVerifier
  • D2 — ValidatedPlan -> ExecutablePlan preflight
  • D3 — immutable zero-mutation TransformationCandidate generation
  • D4 — deterministic and semantic post-transform validation
  • D5 — model-free atomic context executor
  • D6 — inventory rebuild, canonical re-estimation, and signed reduction accounting

D6 finalization boundary

  • D5 captures canonical pre-commit ContextManager.estimateComponents() output
  • The committed result binds the exact tool-schema digest and M3 potential upper bound
  • D6 accepts only a strict COMMITTED ExecutionResult
  • Current contextGeneration must equal D5's committed generation
  • The existing Context Inventory registry must still match inventoryBefore
  • ContextInventory.synchronize() rebuilds from committed messages without replacing the registry
  • Removed units become inactive; replacements retain stable IDs and refresh content/token cost
  • Inventory ID/fingerprint reflects the committed context
  • Before/after use the same ContextManager estimator, tool envelope, tool choice, and fixed overhead
  • actualReductionTokens = before.totalTokens - after.totalTokens
  • Negative reduction is preserved and never clamped
  • Potential upper bound and observed actual reduction remain separate metrics
  • Success emits an immutable ExecutionReport
  • Drift/rebuild/accounting failure emits EXECUTION_FINALIZATION_FAILED with no actual-reduction claim
  • D6 failure never becomes EXECUTION_ABORTED, relabels D5, or rolls back committed messages

Preserved invariants

  • ValidatedPlan != ExecutablePlan
  • M3 recovery classification is not execution-time recovery proof
  • COMPRESS authorization does not authorize arbitrary replacement content
  • ValidatedTransformation alone is not an execution capability
  • D5 and D6 are model-free
  • M4 planner-v1, inventory selection, budgets, protocols, policy, PAR/IPR, and telemetry remain hash-frozen
  • No artifact/project-memory/episode write or semantic-policy change
  • The branch stops at ExecutionReport -> STOP; no D7 scope

Accounting note

“Actual” means the observed signed difference under ContextOS's frozen-compatible canonical ContextManager estimator. It includes message serialization overhead, tool schemas/tool choice, and fixed prompt overhead; it does not claim tokenizer-exact llama.cpp backend counts.

Validation

  • npm.cmd test: 172 tests, 171 passed, 1 Windows symlink capability skip
  • D5-D6 focused tests: 25 tests
  • D6 coverage includes stable-ID rebuild, inactive removed units, fingerprint change, canonical before/after envelope, identical tools/overhead, signed negative reduction, generation drift, failure non-rollback, immutable report, and end-to-end execution
  • JavaScript syntax: 57 files
  • JSON parsing: 19 files
  • Markdown local links: 110 links across 30 files
  • git diff --check
  • M4 frozen-input diff against aa59f4d: empty
  • D6 model/external-write scan: clean
  • Signed reduction clamp scan: clean

Documentation

Updated English and Traditional Chinese README, changelog, architecture, execution contract, technical report, and RFC.

This PR remains Draft as the complete dev.5 D0-D6 freeze candidate.

@HayronHgh
HayronHgh marked this pull request as ready for review August 9, 2026 20:42
@HayronHgh
HayronHgh merged commit 9c4f3d8 into main Aug 9, 2026
4 checks passed
@HayronHgh
HayronHgh deleted the agent/validated-transformation-execution branch August 9, 2026 20:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant