> ## Documentation Index
> Fetch the complete documentation index at: https://ulpi.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Decay & Reinforcement

> Control memory lifespan with decay rates and reinforcement

# Decay & Reinforcement

**What makes Memory Module different:** Memories that matter stay strong through reinforcement, while noise fades away through natural decay.

<Note>
  Memories naturally fade over time (decay). Access them or manually reinforce them to keep them strong. Different memory types fade at different rates.
</Note>

***

## Understanding Salience

**Salience** = importance score (0.0-1.0)

| Range         | Status    | Effect             |
| ------------- | --------- | ------------------ |
| **1.0**       | Brand new | Maximum importance |
| **0.7-0.9**   | Strong    | Easily accessible  |
| **0.3-0.6**   | Medium    | Still useful       |
| **0.1-0.2**   | Weak      | Fading             |
| **Under 0.1** | Candidate | Auto-pruning       |

**Why it matters:**

1. Whether memory appears in search
2. How it ranks when it does appear
3. When it gets auto-pruned

***

## Natural Decay: Forgetting Curve

**Every memory decays exponentially, just like human memory.**

| Sector         | Decay Rate (λ)  | Half-Life                 | Example                           |
| -------------- | --------------- | ------------------------- | --------------------------------- |
| **Reflective** | 0.001 (slowest) | \~693 days (\~2 years)    | "Why we chose microservices"      |
| **Semantic**   | 0.005           | \~139 days (\~4.6 months) | "JWT tokens expire after 30 days" |
| **Procedural** | 0.008           | \~87 days (\~2.9 months)  | "How to deploy to production"     |
| **Episodic**   | 0.015           | \~46 days (\~1.5 months)  | "Sprint planning meeting"         |
| **Emotional**  | 0.020 (fastest) | \~35 days (\~1.2 months)  | "Customer frustrated"             |

**Half-life:** Time for salience to drop to 50%. Memory continues fading exponentially after half-life.

### Decay Examples

<Tabs>
  <Tab title="Reflective (Slow)">
    **Strategic decision:**

    ```
    Day 0:   Salience 1.00 ████████████████████
    Month 3: Salience 0.92 ██████████████████
    Month 6: Salience 0.85 █████████████████
    Year 1:  Salience 0.72 ██████████████
    Year 2:  Salience 0.52 ██████████
    ```

    **Still strong after 2 years!**
  </Tab>

  <Tab title="Emotional (Fast)">
    **Customer sentiment:**

    ```
    Day 0:   Salience 1.00 ████████████████████
    Week 2:  Salience 0.74 ███████████████
    Month 1: Salience 0.55 ███████████
    Month 2: Salience 0.30 ██████ (fading)
    Month 3: Salience 0.17 ███ (very weak)
    ```

    **Fades quickly—old sentiment less relevant**
  </Tab>
</Tabs>

***

## Reinforcement: Strengthening Memories

### Automatic Reinforcement

**Happens every time you access a memory:**

* Searching and finding it
* Retrieving by ID
* Traversing via waypoints
* Viewing in admin panel

**Effect:** Small salience boost (+0.02 to +0.05), timestamps update

**Example:**

```
Your team's API auth docs (Semantic):

Created:     Salience 1.00
Month 2:     Salience 0.95 (natural decay)
Accessed 3x: Salience 0.98 (reinforced through use)
Month 4:     Salience 0.94 (decay continues)
Accessed 7x: Salience 1.00 (back to maximum!)

Becomes "hot memory": access_count ≥10 + last_accessed <7 days
```

**Why it matters:** Frequently accessed info naturally stays strong without manual intervention!

### Manual Reinforcement

**4 Reinforcement Profiles:**

<CardGroup cols={2}>
  <Card title="Quick Refresh (+0.05)" icon="bolt">
    **When:** Light reminder, brief review

    ```
    Reinforce memory with Quick Refresh
    ```

    Example: "Customer prefers email over phone"
  </Card>

  <Card title="Maintenance (+0.10)" icon="wrench">
    **When:** Keep reference accessible

    ```
    Reinforce memory with Maintenance
    ```

    Example: Weekly reinforcement of API docs
  </Card>

  <Card title="Deep Learning (+0.15)" icon="brain">
    **When:** Actively studying/learning

    ```
    Reinforce memory with Deep Learning
    ```

    Example: Learning new technology weekly
  </Card>

  <Card title="Emergency (+0.25)" icon="shield">
    **When:** Critical info must persist

    ```
    Reinforce memory with Emergency
    ```

    Example: Production incident procedures
  </Card>
</CardGroup>

### Reinforcement Strategies

<Tabs>
  <Tab title="Critical Info">
    **Goal:** Never let it fade

    **Strategy:**

    1. Store as Reflective (slowest decay)
    2. Emergency profile (+0.25) immediately
    3. Monthly reinforcement schedule

    **Result:** Effectively permanent

    Examples: Security protocols, core docs, strategic decisions
  </Tab>

  <Tab title="Reference Materials">
    **Goal:** Keep accessible medium-term

    **Strategy:**

    1. Store as Semantic (slow decay)
    2. Maintenance profile (+0.10) bi-weekly
    3. Let usage reinforce naturally

    **Result:** Strong while used, fades when obsolete

    Examples: API docs, conventions, how-to guides
  </Tab>

  <Tab title="Active Learning">
    **Goal:** Reinforce during learning

    **Strategy:**

    1. Store as Semantic
    2. Deep Learning (+0.15) weekly while studying
    3. Stop after mastery

    **Result:** Strong during learning, then natural decay

    Examples: Study notes, courses, onboarding
  </Tab>

  <Tab title="Temporary Context">
    **Goal:** Let it fade naturally

    **Strategy:**

    1. Store as Episodic (fast decay)
    2. No manual reinforcement
    3. Trust automatic reinforcement if needed

    **Result:** Fades after usefulness expires

    Examples: Sprint notes, bug investigations, debugging
  </Tab>
</Tabs>

***

## Access Patterns: Hot, Warm, Cold

**System automatically categorizes memories based on access:**

<CardGroup cols={3}>
  <Card title="🔥 Hot" icon="fire">
    **Definition:** `access_count ≥10 AND last_accessed <7 days`

    **Effect:**

    * Surfaces first in searches
    * High ranking boost
    * Auto-reinforcement

    **Examples:**

    * Current feature docs
    * Active customer context
    * Sprint code patterns
  </Card>

  <Card title="🌡️ Warm" icon="temperature-half">
    **Definition:** `access_count ≥3 AND last_accessed <30 days`

    **Effect:**

    * Good search ranking
    * Available when needed
    * Decaying slowly

    **Examples:**

    * Last month's retrospective
    * Recent customer issues
    * Occasional code patterns
  </Card>

  <Card title="❄️ Cold" icon="snowflake">
    **Definition:** All other memories

    **Effect:**

    * Lower search ranking
    * Natural decay continues
    * Pruning candidate if salience less than 0.1

    **Examples:**

    * Old meeting notes
    * Resolved bugs (months ago)
    * Outdated temporary notes
  </Card>
</CardGroup>

**Admin Panel:** Stats widget shows hot/warm/cold breakdown. Hot memories = what your team values most!

***

## Pruning: Automatic Cleanup

**Trigger:** Salience less than 0.1 after 90 days inactivity

**Process:**

1. Nightly job scans candidates
2. Checks salience threshold (default: 0.1)
3. Checks last accessed (>90 days)
4. Soft deletes (recoverable 30 days)
5. Hard deletes after grace period

**Why automatic:** Keeps knowledge base focused and performant without manual maintenance!

### Configuration

**Default (recommended):**

* Threshold: 0.1 salience
* Inactivity: 90 days
* Grace period: 30 days

**Can customize:**

* Lower threshold (prune more)
* Higher threshold (keep more)
* Disable auto-pruning (manual only)

**Admin Panel:**

* View candidates before deletion
* Manual prune with custom thresholds
* Recover soft-deleted within 30 days

### Manual Pruning

**Via AI assistant:**

```
Prune memories with salience below 0.1
```

**Via API:**

```bash theme={null}
curl -X POST https://api.ulpi.io/api/v1/memories/prune \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{"threshold": 0.1, "dry_run": true}'
```

**Dry run first!** Preview before actually pruning.

***

## Real-World Strategies

<Tabs>
  <Tab title="Set It & Forget It">
    **Approach:** Minimal intervention

    1. Store naturally as you work
    2. Let sectors handle decay
    3. No manual reinforcement
    4. Trust access patterns

    **Best for:** Personal knowledge, small teams

    **Result:** 80% benefit, 20% effort
  </Tab>

  <Tab title="Curated Knowledge Base">
    **Approach:** Strategic reinforcement

    1. Store with appropriate sectors
    2. Tag critical ("critical", "core-docs")
    3. Weekly reinforcement schedule
    4. Monthly review hot/warm/cold

    **Best for:** Professional teams, docs-heavy

    **Result:** Highly organized, auto-maintained
  </Tab>

  <Tab title="Learning-Focused">
    **Approach:** Optimize for retention

    1. Store study materials as Semantic
    2. Weekly Deep Learning reinforcement
    3. Stop after mastery
    4. Track via access patterns

    **Best for:** Students, researchers, learners

    **Result:** Spaced repetition without flashcards
  </Tab>

  <Tab title="Customer Context Master">
    **Approach:** Rich customer context

    1. Preferences: Semantic (medium)
    2. Interactions: Episodic (fast)
    3. Sentiment: Emotional (very fast)
    4. Reinforce before interactions

    **Best for:** Sales, success, support teams

    **Result:** Context without drowning in logs
  </Tab>
</Tabs>

***

## FAQ

<AccordionGroup>
  <Accordion title="Can I disable decay entirely?">
    No, but you can make memories effectively permanent:

    1. Use Reflective (693-day half-life)
    2. Emergency reinforcement (+0.25) regularly
    3. Result: \~5-10 year lifespan

    **Why not disable?** Decay keeps knowledge relevant!
  </Accordion>

  <Accordion title="Forgot to reinforce something important?">
    Don't worry! Automatic reinforcement from access keeps it alive.

    Admin panel shows memories approaching pruning threshold.
  </Accordion>

  <Accordion title="How often to manually reinforce?">
    * **Weekly:** Critical docs, active learning
    * **Bi-weekly:** Reference materials, conventions
    * **Monthly:** Strategic decisions, long-term docs
    * **Never:** Most memories! Let automatic handle it.
  </Accordion>

  <Accordion title="See decay curves?">
    Yes! Admin panel shows salience over time for each memory. Visualize decay curve and reinforcement events.
  </Accordion>
</AccordionGroup>

***

## Next Steps

<CardGroup cols={2}>
  <Card title="Cognitive Sectors" icon="brain" href="/memory/cognitive-sectors">
    5 memory types and decay rates
  </Card>

  <Card title="Best Practices" icon="star" href="/memory/best-practices">
    Effective memory management
  </Card>

  <Card title="Workflows" icon="list-check" href="/memory/workflows">
    Real-world decay & reinforcement
  </Card>

  <Card title="Admin Panel" icon="gear" href="/memory/best-practices#admin-panel-usage">
    Monitor memory health visually
  </Card>
</CardGroup>

***

*Memories that matter stay strong. Noise fades away. Trust the system.*
