Skip to content

feat: add authoritative incremental decision memory - #2001

Open
alpiua wants to merge 4 commits into
MemPalace:developfrom
alpiua:agent/authority-changed-set-supersession-poc
Open

feat: add authoritative incremental decision memory#2001
alpiua wants to merge 4 commits into
MemPalace:developfrom
alpiua:agent/authority-changed-set-supersession-poc

Conversation

@alpiua

@alpiua alpiua commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

What this adds

This PR gives long-running coding agents a safer way to use project memory: they can tell whether a recalled item is still backed by its source, update only files that changed, replace an obsolete decision without erasing history, and send concurrent writes through one durable writer.

The problem

Semantic similarity alone cannot answer whether an old memory is still authoritative. Full project re-mines are expensive for small edits, and implicit "replacement" risks silently discarding verbatim history. At the same time, independent MCP clients can contend for the local write path.

Implementation, by reviewable commit

1. Memory freshness from authoritative sources — 6854769

Why: callers need to distinguish current evidence from memory whose backing source changed or disappeared.

How: adds optional authority_uri, authority_version, and memory_kind metadata; opt-in local-file verification reports current, stale, or unverified. Verification is cached within a search and duplicate ranked hits are removed.

Result: legacy memories remain compatible and unverified by default; agents can opt into freshness checks before relying on recalled context.

2. Incremental project updates from a changed set — 9d91aa3

Why: a producer that already knows which files changed should not have to trigger a full filesystem walk.

How: introduces a validated, project-relative {changed, deleted} manifest; preserves containment checks and tombstones; cleans up newly ignored files; and scopes re-indexing to the affected wing.

Result: small edits can update the correct memory slice without weakening source safety or reprocessing an entire project.

3. Explicit, reversible decision replacement — cf7546e

Why: replacing a decision must be deliberate and must not delete the verbatim rationale it supersedes.

How: requires an exact non-empty decision_key plus predecessor ID. The old drawer remains stored as superseded history; ordinary search hides it unless history is requested.

Result: agents retrieve the current decision by default while audits can follow the full decision trail. Semantic similarity never supersedes a record implicitly.

4. One durable writer for concurrent MCP clients — 0851bac

Why: process-lifetime peer locks make concurrent write behavior fragile and provide poor diagnostics when a job stalls.

How: routes mutating MCP calls through the daemon, with leased and heartbeated jobs, recovery of expired leases, coalescing of file events, bounded synchronous waits, and sanitized job-status endpoints.

Result: concurrent clients submit work safely through one write lane, while callers can inspect progress without receiving queued write payloads.

Compatibility and safety

  • New metadata and MCP parameters are optional.
  • Existing drawers are never assumed current; they report unverified until verification is requested.
  • Authority adapters are local-file-only in this iteration; no external source is contacted.
  • Changed-set paths cannot escape the project root.
  • Supersession preserves verbatim history and requires explicit identifiers.
  • The daemon serializes writes; reads remain direct.

Validation

  • uv run ruff format --check .
  • uv run ruff check .
  • Full test suite is running locally; CI will rerun for this rewritten commit series.

Scope

This is a cohesive incremental-memory foundation, not a final schema or a hosted sync feature. Remote authority adapters and an idempotency key for daemon submissions remain future work.

@alpiua
alpiua force-pushed the agent/authority-changed-set-supersession-poc branch from 090ec6d to fa7661d Compare July 27, 2026 09:11
@alpiua alpiua changed the title feat: prototype authoritative incremental decision memory feat: add authoritative incremental decision memory Jul 27, 2026
@alpiua
alpiua force-pushed the agent/authority-changed-set-supersession-poc branch from fa7661d to 45655d5 Compare July 27, 2026 09:43
@alpiua
alpiua changed the base branch from main to develop July 27, 2026 09:43
@alpiua
alpiua force-pushed the agent/authority-changed-set-supersession-poc branch 2 times, most recently from 0851bac to 68ad517 Compare July 27, 2026 10:34
@alpiua
alpiua marked this pull request as ready for review July 27, 2026 11:21
@igorls

igorls commented Aug 15, 2026

Copy link
Copy Markdown
Member

Thanks for this contribution, and apologies for the slow turnaround.

develop has moved a fair way since this was opened and the branch no longer merges cleanly. If you're still interested in landing it, could you rebase onto current develop? Once it merges cleanly and CI is green I'll get it reviewed for the 3.8.0 cycle.

If you'd rather not pick it back up, no problem at all — just say so and I'll close it out, and thanks either way for taking the time to send it.

@alpiua
alpiua force-pushed the agent/authority-changed-set-supersession-poc branch from 68ad517 to ffe96d3 Compare August 18, 2026 11:47
Expose optional authority provenance and verification on retrieved memories so agents can distinguish current, stale, and unverified evidence. Cache local-file verification during each search and deduplicate ranked hits without changing legacy retrieval defaults.
@alpiua
alpiua force-pushed the agent/authority-changed-set-supersession-poc branch from ffe96d3 to 25b46c0 Compare August 18, 2026 11:50
alpiua added 3 commits August 18, 2026 14:57
Accept backend-owned changed/deleted manifests so project updates avoid a full filesystem scan. Keep path containment, tombstones, gitignore cleanup, and wing-scoped reindexing explicit to preserve the existing corpus safely.
Let callers replace a decision through an exact decision key and predecessor ID while retaining the original verbatim drawer as queryable history. Similarity never performs implicit replacement, and normal search excludes superseded entries by default.
Route mutating MCP operations through one durable daemon writer instead of process-lifetime peer locks. Add leased, coalesced jobs with bounded wait responses and safe status diagnostics so concurrent clients can submit writes without exposing queued payloads.
@alpiua
alpiua force-pushed the agent/authority-changed-set-supersession-poc branch from 25b46c0 to fb83ba3 Compare August 18, 2026 12:04
@alpiua

alpiua commented Aug 18, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for this contribution, and apologies for the slow turnaround.

develop has moved a fair way since this was opened and the branch no longer merges cleanly. If you're still interested in landing it, could you rebase onto current develop? Once it merges cleanly and CI is green I'll get it reviewed for the 3.8.0 cycle.

If you'd rather not pick it back up, no problem at all — just say so and I'll close it out, and thanks either way for taking the time to send it.

Hi @igorls
I rebased the branch to upstream/develop.

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.

2 participants