← Inventions Dashboard
Invention Summary
Prompt-Gated Temporal Decay (PGTD)
A lightweight, local-first memory management library that applies exponential decay to stored information over time. The decay rate is dynamically modified (gated) based on the relevance of keywords in the user's prompt, ensuring that salient information persists while irrelevant noise fades away.
ID: prompt-gated-temporal-decay-pgtd
Folder: inventions/prompt-gated-temporal-decay-pgtd
Created: 2026-03-29 07:55:42
Updated: 2026-03-29 07:56:16
Files: 10
Source: student_autonomy
⬇ Download as .zip ~26.4 KB uncompressed
README.md
ARES's plain-English description of what this invention does and how to run it.
# Prompt-Gated Temporal Decay (PGTD)

A Python library implementing a **Prompt-Gated Temporal Decay (PGTD)** memory system.

## Concept

Traditional databases treat all data as equally persistent. PGTD introduces a biological-inspired forgetting mechanism. Stored memories decay in value over time (Temporal Decay). However, specific keywords in a retrieval prompt can "gate" this decay, boosting the retrieval score of specific memories based on context relevance.

## Features

*   **Temporal Decay:** Memories lose relevance score exponentially based on elapsed time.
*   **Prompt Gating:** User queries containing specific keywords can override or slow decay for tagged memories.
*   **Local Only:** Zero network dependencies. Pure Python stdlib.
*   **Configurable Decay:** Adjust half-life and gate sensitivity.

## Installation

```bash
pip install -e .
```

## Usage

```python
import time
from prompt_gated_temporal_decay_pgtd import PGTDMemoryStore

# Initialize store with a decay rate (lambda)
store = PGTDMemoryStore(decay_lambda=0.1)

# Store a memory with access keys (gates)
store.store(
    content="The blue key opens the server room.", 
    keys=["blue", "key", "server"]
)

# ... some time passes ...

# Query without the gate (memory may have decayed too much)
results = store.recall("Where is the server room?")

# Query with the gate (match on 'server' or 'blue' boosts signal)
results = store.recall("I need the blue key.")
```

## Implementation Details

This implementation uses a simplified time-dependent scoring function:

$$Score(t) = \frac{1.0}{1.0 + \lambda \cdot \Delta t} \cdot GateMultiplier$$

Where `GateMultiplier` is applied if the query intersects with the memory's access keys.

### Limitations

This is a demonstration invention. It uses in-memory storage (RAM) only. Data is not persisted to disk. It simulates time-based effects best when used in long-running processes or when manually injecting timestamps.

<!-- ARES_AUTO_VERIFIED_SUMMARY:START -->
## Verified Project Notes

- Package import path: `prompt_gated_temporal_decay_pgtd`
- Entrypoint: `run_demo.py`
- Delivery mode: `prototype`
- Release tier: `prototype`
- Verification status: `PASS`
- Clean-room release gates: `NOT_RUN`
- Public exports: `MemoryNode, PGTDMemoryStore`
- Python files detected: `run_demo.py, prompt_gated_temporal_decay_pgtd/__init__.py, prompt_gated_temporal_decay_pgtd/core.py`

## Verification Commands

- `PASS` `"/home/corbybender/ares/.venv-linux/bin/python" -m py_compile "run_demo.py"`
- `PASS` `"/home/corbybender/ares/.venv-linux/bin/python" -m compileall "prompt_gated_temporal_decay_pgtd"`
- `PASS` `"/home/corbybender/ares/.venv-linux/bin/python" run_demo.py`

## Current Limits

- No additional consistency warnings were detected by the local audit.
<!-- ARES_AUTO_VERIFIED_SUMMARY:END -->
Files
PathBytes
__pycache__/run_demo.cpython-314.pyc 4459
DESIGN_BRIEF.md 788
invention.json 4125
prompt_gated_temporal_decay_pgtd/__init__.py 140
prompt_gated_temporal_decay_pgtd/__pycache__/__init__.cpython-314.pyc 369
prompt_gated_temporal_decay_pgtd/__pycache__/core.cpython-314.pyc 5814
prompt_gated_temporal_decay_pgtd/core.py 3354
pyproject.toml 346
README.md 2833
run_demo.py 4765
Manifest
Structured metadata ARES recorded when it created this project.
{
  "id": "prompt-gated-temporal-decay-pgtd",
  "title": "Prompt-Gated Temporal Decay (PGTD)",
  "summary": "A lightweight, local-first memory management library that applies exponential decay to stored information over time. The decay rate is dynamically modified (gated) based on the relevance of keywords in the user's prompt, ensuring that salient information persists while irrelevant noise fades away.",
  "source": "student_autonomy",
  "kind": "invention",
  "path": "inventions/prompt-gated-temporal-decay-pgtd",
  "delivery_mode": "prototype",
  "release_tier": "prototype",
  "release_verification_status": "not_run",
  "created_at": "2026-03-29 07:55:42",
  "updated_at": "2026-03-29 07:56:16",
  "project_entrypoint": "run_demo.py",
  "smoke_test_status": "passed",
  "smoke_test_output": "Starting PGTD Local Invention Test... ============================================================ PHASE 1: Encoding Memories (T=0) ============================================================ Storing: 'The blue key opens the server room.' (Keys: blue, key, ops) Storing: 'Order pizza for lunch.' (Keys: pizza, food) Storing: 'User credentials: admin/12345.' (Keys: credentials, secret) ============================================================ PHASE 2: Immediate Recall (T=0) ====================",
  "generated_files": 5,
  "project_generated_at": "2026-03-29 07:56:14",
  "source_exp_path": "experiments\\exp_self.20260308175823.014_20260308_175854",
  "verification_status": "passed",
  "verification_results": [
    {
      "command": "\"/home/corbybender/ares/.venv-linux/bin/python\" -m py_compile \"run_demo.py\"",
      "passed": true,
      "returncode": 0,
      "timed_out": false,
      "stdout_excerpt": "",
      "stderr_excerpt": ""
    },
    {
      "command": "\"/home/corbybender/ares/.venv-linux/bin/python\" -m compileall \"prompt_gated_temporal_decay_pgtd\"",
      "passed": true,
      "returncode": 0,
      "timed_out": false,
      "stdout_excerpt": "Listing 'prompt_gated_temporal_decay_pgtd'...",
      "stderr_excerpt": ""
    },
    {
      "command": "\"/home/corbybender/ares/.venv-linux/bin/python\" run_demo.py",
      "passed": true,
      "returncode": 0,
      "timed_out": false,
      "stdout_excerpt": "Starting PGTD Local Invention Test...\n\n============================================================\n PHASE 1: Encoding Memories (T=0) \n============================================================\nStoring: 'The blue key opens the server room.' (Keys: blue, key, ops)\nStoring: 'Order pizza for lunch.' (Keys: pizza, food)\nStoring: 'User credentials: admin/12345.' (Keys: credentials, secret)\n\n============================================================\n PHASE 2: Immediate Recall (T=0) \n============================================================\nQuery: 'What do I need for lunch?'\nResults: [('User credentials: admin/12345.', 1.0), ('Order pizza for lunch.', 1.0), ('The blue key opens the server room.', 1.0)]\n\n============================================================\n PHASE 3: The Void (T=100 seconds later) \n============================================================\n... simulating 100 seconds of decay ...\nQuery: 'What is on my todo list?' (No specific gate keys)\nResults: [('User credentials: admin/12345.', 0.1667), ('Order pizza for lunch.', 0.1667), ('The blue key opens the server room.', 0.1667)]\n\n============================================================\n PHASE 4: Gated Recall (T=100) \n============================================================\nQuery: 'I am hungry, pizza?'\nResults: [('Order pizza for lunch.', 1.0), ('User credentials: admin/12345.', 0.1667), ('The blue key opens the server room.', 0.1667)]\nQuery: 'Blue ops key.'\nResults: [('The blue key opens the server room.', 1.0), ('User credentials: admin/12345.', 0.1667), ('Order pizza for lunch.', 0.1667)]\n\n======",
      "stderr_excerpt": ""
    }
  ],
  "project_status": "built"
}