Skip to content

feat(agent): add evolution memory writer - #104

Merged
Pepps233 merged 2 commits into
feat/evidence-ranking-validatorfrom
feat/evolution-writer
Aug 23, 2026
Merged

Pepps233 merged 2 commits into
feat/evidence-ranking-validatorfrom
feat/evolution-writer

Conversation

@Pepps233

@Pepps233 Pepps233 commented Aug 20, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Implements deterministic EVOLVE.md mutation writing and atomic harness activation over the selected proposal groups emitted by the evidence-ranking pipeline in #103, without enabling later interactive controls, prompt-boundary refresh, post-activation evaluation, or automated rollback behavior.

The Writer captures stable memory identity outside the rendered prompt, validates structured ADD, REMOVE, and REPLACE operations against the frozen base revision, and applies the complete selected batch to one temporary candidate before advancing the harness with compare-and-swap semantics.
It persists exact reversible diffs, proposal and evidence provenance, operation IDs, parent and resulting revisions, activation state, and the rollback parent so failed batches leave the prior harness active and interrupted retries remain idempotent.

Reasoning

The Writer preserves stable memory identity, validates a complete mutation batch before activation, and uses compare-and-swap semantics so concurrent harness changes cannot be overwritten.
Candidate and activation receipts remain durable and idempotent, while failed batches leave the active harness unchanged.

Changes

  • Add deterministic EVOLVE.md parsing, stable memory catalogs, structured ADD/REMOVE/REPLACE application, and batch-level validation.
  • Stage immutable candidates and activate them through the harness state store with exact base-version checks.
  • Record reversible diffs, proposal and evidence provenance, operation IDs, parent and result revisions, activation time, and rollback parent in the ledger.
  • Reject manual-memory removal, malformed Markdown, duplicate entries, sensitive content, stale bases, and tampered Writer receipts.
  • Add integration coverage for successful activation, atomic failure, idempotent retry, concurrent activation conflicts, and receipt verification.

Testing

  • node ../../node_modules/vitest/dist/cli.js --run test/evolution-memory-writer.test.ts test/control-plane.test.ts
  • npm run check
  • ./test.sh

- Applies selected EVOLVE.md deltas to one validated candidate without rewriting unrelated bytes
- Preserves stable memory identity and activates one compare-and-swap harness revision with durable audit data
- Rejects staged outputs whose batch, operations, base, or exact diff diverge from durable candidate data
- Prevents activation results from recording a different revision than the one selected by the Writer
@Pepps233 Pepps233 self-assigned this Aug 20, 2026
@Pepps233
Pepps233 requested a review from Issacboy123 August 20, 2026 06:48
@Pepps233
Pepps233 marked this pull request as ready for review August 23, 2026 16:37
@Pepps233
Pepps233 merged commit 5a8489b into main Aug 23, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant