Skip to content

feat: implement category-specific decay coefficients and pruning passes #17 - #73

Closed
prasiddhi-105 wants to merge 2 commits into
memact-archive:mainfrom
prasiddhi-105:feat/category-decay-17
Closed

prasiddhi-105 wants to merge 2 commits into
memact-archive:mainfrom
prasiddhi-105:feat/category-decay-17

Conversation

@prasiddhi-105

Copy link
Copy Markdown
Contributor

🎯 Overview

This PR resolves issue #17 by implementing a centralized category decay parameters registry and executing a dedicated pruning pass inside the memory engine.

🛠️ Changes Implemented

  • Category Decay Registry: Added explicit decay coefficients for tracked categories (e.g., news-reading: 0.15, shopping: 0.08, health: 0.005) alongside default threshold configurations.
  • Pruning Pass Logic (decayMemories): Implemented logic to automatically map incoming memory records, fall back to inferred categories when necessary, compute decay operations up to 4 decimal places, and cleanly filter out records falling below the elimination threshold (0.15).
  • Category Integration: Updated individual category definitions (news-reading.mjs and shopping.mjs) to properly export their decay coefficients.
  • Test Suite Validation: Updated and expanded test/engine.test.mjs to validate category-specific decay behaviors.

🧪 Testing

Validated locally using the Node.js native test runner:

node --test test/engine.test.mjs

@keepsloading

Copy link
Copy Markdown
Contributor

Hey @prasiddhi-105! 👋

The category-specific decay coefficients logic you added looks promising, but I cannot merge this PR as-is because of a critical concern:

This PR removes 30+ core source files that are unrelated to the issue:

  • src/adapters/postgresql.mjs
  • src/cap-packet.mjs, src/claims.mjs, src/cli.mjs
  • src/core-schemas.mjs, src/engine.mjs (massive 1359-line deletion)
  • src/scoring.mjs, src/semantic-matching.mjs, src/storage.mjs
  • And many more...

This appears to be a branch divergence issue — your feature branch may have been created from an older base and diverged significantly from main. The decay coefficients feature itself should only be adding new code, not removing entire modules.

Please:

  1. Create a fresh branch off the latest main
  2. Cherry-pick or re-apply just your decay coefficient changes
  3. Make sure the diff only adds new code (no unrelated file removals)
  4. Open a new PR

Happy to help if you run into issues! 🙏

@keepsloading keepsloading left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

The category-specific decay coefficient logic is a good direction, but this PR has a critical problem that blocks merging:

This branch is deleting 30+ core source files that are completely unrelated to the decay feature, including:

  • src/adapters/postgresql.mjs (PostgreSQL adapter)
  • src/schemas/core.mjs (core schemas)
  • src/scoring/engine.mjs (scoring engine)
  • src/matching/semantic.mjs (semantic matching)
  • and many more

This appears to be a branch divergence issue — your feature branch likely branched from a very old commit and the diff is comparing against a stale base, making it look like these files are being deleted when they are not intended to be.

Please:

  1. Create a fresh branch from the latest main
  2. Cherry-pick or manually re-apply only the decay coefficient changes
  3. Open a new PR from that clean branch

The decay logic itself is welcome — we just need it isolated without the unintended deletions. 🙏

@keepsloading

Copy link
Copy Markdown
Contributor

@prasiddhi-105 I can see you pushed a second commit (ddfb0d71) trying to resolve the conflicts, but the branch is still deleting 30 core files — src/claims.mjs, src/core-schemas.mjs, src/scoring.mjs, src/semantic-matching.mjs, src/storage.mjs, the PostgreSQL adapter, all backup/postgres test files, and more.

This isn't a merge conflict issue — it's a branch divergence problem. Your branch is based on a very old commit of main, so Git sees all the files added since then as deletions in your diff.

The fix is to start fresh:

  1. Create a new branch from the latest main
  2. Manually add only your decay coefficient changes to src/engine.mjs
  3. Open a new PR

Do not try to rebase or merge — the divergence is too large and you'll keep fighting conflicts. A clean branch is the right path here. 🙏

@prasiddhi-105

prasiddhi-105 commented Jul 3, 2026 •

Copy link
Copy Markdown
Contributor Author

@keepsloading Okayy sure, I'll do it tomorrow and update you !

@keepsloading

Copy link
Copy Markdown
Contributor

SSoC26 Success: We found your dummy PR in [Context] (#Context#315) and have verified its linkage. Thank you!

@keepsloading keepsloading left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Changes Requested

Hey @prasiddhi-105 — this PR is tagged as implementing Category-Specific Decay Coefficients (Issue #17), but the diff shows it removing 25 core files that are fundamental to the Memory module:

Files deleted that should not be removed:

  • src/claims.mjs — core claim processing
  • src/source-metadata.mjs — source reliability scoring
  • src/cap-packet.mjs, src/core-schemas.mjs, src/memory-schemas.mjs — data schemas
  • src/adapters/postgresql.mjs, src/postgres-statements.mjs — database layer
  • src/evidence-links.mjs, src/graph-snapshots.mjs, src/temporal-paths.mjs — graph & time tracking
  • src/field-encryption.mjs, src/scoring.mjs, src/semantic-matching.mjs — core utilities
  • 5 test files covering backup, restore, encryption, and context-memory behavior

This would break Memory PR#87 (incremental index updates) and Memory PR#86 (app trust scoring), both of which depend on claims.mjs and source-metadata.mjs respectively.

What the PR should do instead:

  • Keep all existing files intact
  • Add the decay coefficient registry (category → decay params mapping) as a new module (e.g., src/decay-coefficients.mjs)
  • Add a pruning pass to the engine that applies per-category decay rates
  • Add tests for the decay behavior

Please revert the file deletions and scope the PR to only the decay coefficient implementation. Happy to re-review once updated!

@keepsloading

Copy link
Copy Markdown
Contributor

Architecture Review — Merge Candidate ✅

@prasiddhi-105 — this PR implements exactly the right concept in exactly the right place.

Category-specific decay coefficients with pruning passes directly fills the Memory: Temporal Decay v1 milestone. The architecture has shifted in a way that makes this work more valuable, not less.

Two targeted changes before merge:

  1. Terminology alignment — Please align variable names with the formal decay_status protocol enum:

    • Use current, aging, stale, expired (not custom terminology)
    • This ensures CAP responses expose the correct field values
  2. Threshold sourcing — Decay thresholds should be sourced from the Context category registry rather than hardcoded in Memory. This allows Context to own the sensitivity definitions (e.g., fitness.v1 decays faster than declared_fact).

These are two targeted changes — the core algorithm, coefficient model, and test coverage are sound. Would you be willing to make these adjustments?

This review is part of the Memact organization-wide migration to the identity infrastructure vision. Thank you for your sustained contribution — this is one of the highest-value PRs in the organization.

@Boundier

Boundier commented Jul 5, 2026

Copy link
Copy Markdown

Hey, thanks for engaging with this issue.

We recently shifted the Memact architecture. Memact used to be a memory engine that inferred and acted on user data. It is now becoming open identity infrastructure where users own their data address and apps interact through open protocols.

Because of this shift, many of the older issues no longer fit the new direction, so we are closing them to keep the tracker clean.

If you had already written code for this issue, let us know and we will reopen it for review. A merged PR is not guaranteed but we will take a look.

Check out the new open issues at https://github.com/Memact for what is active now.

1 similar comment
@keepsloading

Copy link
Copy Markdown
Contributor

Hey, thanks for engaging with this issue.

We recently shifted the Memact architecture. Memact used to be a memory engine that inferred and acted on user data. It is now becoming open identity infrastructure where users own their data address and apps interact through open protocols.

Because of this shift, many of the older issues no longer fit the new direction, so we are closing them to keep the tracker clean.

If you had already written code for this issue, let us know and we will reopen it for review. A merged PR is not guaranteed but we will take a look.

Check out the new open issues at https://github.com/Memact for what is active now.

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.

3 participants