pdm-memory 0.1.2__tar.gz → 0.1.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pdm_memory-0.1.4/LICENSE +110 -0
- {pdm_memory-0.1.2 → pdm_memory-0.1.4}/PKG-INFO +127 -54
- {pdm_memory-0.1.2 → pdm_memory-0.1.4}/README.md +13 -3
- {pdm_memory-0.1.2 → pdm_memory-0.1.4}/pdm_memory/__init__.py +5 -1
- pdm_memory-0.1.4/pdm_memory/auth/__init__.py +8 -0
- {pdm_memory-0.1.2 → pdm_memory-0.1.4}/pdm_memory/auth/jwt_handler.py +4 -0
- pdm_memory-0.1.4/pdm_memory/bench.py +9 -0
- pdm_memory-0.1.4/pdm_memory/core/__init__.py +5 -0
- {pdm_memory-0.1.2 → pdm_memory-0.1.4}/pdm_memory/core/math.py +86 -40
- {pdm_memory-0.1.2 → pdm_memory-0.1.4}/pdm_memory/core/retrieval.py +17 -42
- {pdm_memory-0.1.2 → pdm_memory-0.1.4}/pdm_memory/core/signature.py +6 -2
- {pdm_memory-0.1.2 → pdm_memory-0.1.4}/pdm_memory/ingest/__init__.py +4 -0
- {pdm_memory-0.1.2 → pdm_memory-0.1.4}/pdm_memory/ingest/auto_signature.py +4 -0
- {pdm_memory-0.1.2 → pdm_memory-0.1.4}/pdm_memory/ingest/batch.py +4 -0
- {pdm_memory-0.1.2 → pdm_memory-0.1.4}/pdm_memory/ingest/ingester.py +4 -0
- {pdm_memory-0.1.2 → pdm_memory-0.1.4}/pdm_memory/integrations/__init__.py +4 -0
- {pdm_memory-0.1.2 → pdm_memory-0.1.4}/pdm_memory/integrations/anthropic_adapter.py +4 -0
- {pdm_memory-0.1.2 → pdm_memory-0.1.4}/pdm_memory/integrations/context_manager.py +4 -0
- {pdm_memory-0.1.2 → pdm_memory-0.1.4}/pdm_memory/integrations/gemini_adapter.py +4 -0
- {pdm_memory-0.1.2 → pdm_memory-0.1.4}/pdm_memory/integrations/groq_adapter.py +4 -0
- {pdm_memory-0.1.2 → pdm_memory-0.1.4}/pdm_memory/integrations/ollama_adapter.py +4 -0
- {pdm_memory-0.1.2 → pdm_memory-0.1.4}/pdm_memory/integrations/openai_adapter.py +4 -0
- {pdm_memory-0.1.2 → pdm_memory-0.1.4}/pdm_memory/memory.py +57 -44
- {pdm_memory-0.1.2 → pdm_memory-0.1.4}/pdm_memory/storage/__init__.py +4 -0
- {pdm_memory-0.1.2 → pdm_memory-0.1.4}/pdm_memory/storage/base.py +19 -5
- pdm_memory-0.1.4/pdm_memory/storage/cloud_driver.py +435 -0
- pdm_memory-0.1.4/pdm_memory/storage/errors.py +26 -0
- {pdm_memory-0.1.2 → pdm_memory-0.1.4}/pdm_memory/storage/sqlite_driver.py +96 -28
- {pdm_memory-0.1.2 → pdm_memory-0.1.4}/pdm_memory/sync.py +38 -7
- pdm_memory-0.1.4/pdm_memory/tools/__init__.py +5 -0
- {pdm_memory-0.1.2 → pdm_memory-0.1.4}/pdm_memory/tools/bench.py +4 -0
- {pdm_memory-0.1.2 → pdm_memory-0.1.4}/pdm_memory/tools/cli.py +4 -0
- {pdm_memory-0.1.2 → pdm_memory-0.1.4}/pdm_memory.egg-info/PKG-INFO +127 -54
- {pdm_memory-0.1.2 → pdm_memory-0.1.4}/pdm_memory.egg-info/SOURCES.txt +2 -0
- {pdm_memory-0.1.2 → pdm_memory-0.1.4}/pyproject.toml +6 -3
- pdm_memory-0.1.4/tests/test_cloud_driver.py +164 -0
- {pdm_memory-0.1.2 → pdm_memory-0.1.4}/tests/test_math.py +43 -11
- {pdm_memory-0.1.2 → pdm_memory-0.1.4}/tests/test_memory.py +13 -0
- {pdm_memory-0.1.2 → pdm_memory-0.1.4}/tests/test_sqlite_driver.py +33 -1
- pdm_memory-0.1.2/LICENSE +0 -50
- pdm_memory-0.1.2/pdm_memory/auth/__init__.py +0 -4
- pdm_memory-0.1.2/pdm_memory/bench.py +0 -5
- pdm_memory-0.1.2/pdm_memory/core/__init__.py +0 -1
- pdm_memory-0.1.2/pdm_memory/storage/cloud_driver.py +0 -271
- pdm_memory-0.1.2/pdm_memory/tools/__init__.py +0 -1
- {pdm_memory-0.1.2 → pdm_memory-0.1.4}/pdm_memory.egg-info/dependency_links.txt +0 -0
- {pdm_memory-0.1.2 → pdm_memory-0.1.4}/pdm_memory.egg-info/entry_points.txt +0 -0
- {pdm_memory-0.1.2 → pdm_memory-0.1.4}/pdm_memory.egg-info/requires.txt +0 -0
- {pdm_memory-0.1.2 → pdm_memory-0.1.4}/pdm_memory.egg-info/top_level.txt +0 -0
- {pdm_memory-0.1.2 → pdm_memory-0.1.4}/setup.cfg +0 -0
- {pdm_memory-0.1.2 → pdm_memory-0.1.4}/tests/test_bench.py +0 -0
- {pdm_memory-0.1.2 → pdm_memory-0.1.4}/tests/test_cli.py +0 -0
- {pdm_memory-0.1.2 → pdm_memory-0.1.4}/tests/test_gemini_adapter.py +0 -0
- {pdm_memory-0.1.2 → pdm_memory-0.1.4}/tests/test_groq_adapter.py +0 -0
- {pdm_memory-0.1.2 → pdm_memory-0.1.4}/tests/test_jwt_auth.py +0 -0
- {pdm_memory-0.1.2 → pdm_memory-0.1.4}/tests/test_ollama_adapter.py +0 -0
pdm_memory-0.1.4/LICENSE
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
Elastic License 2.0 (ELv2)
|
|
2
|
+
=========================
|
|
3
|
+
|
|
4
|
+
Copyright (c) 2026 Westfield Innovations LLC
|
|
5
|
+
|
|
6
|
+
Core software modification and redistribution of altered versions are
|
|
7
|
+
prohibited without a commercial license from Westfield Innovations LLC.
|
|
8
|
+
Extensions via defined plugin interfaces (e.g., BaseStorage) are permitted.
|
|
9
|
+
|
|
10
|
+
Patent Pending — U.S. App. No. 19/739,419 | 63/953,563 | 63/953,842
|
|
11
|
+
|
|
12
|
+
The software in this repository is licensed under the Elastic License 2.0
|
|
13
|
+
(the text of which follows), subject to the additional Westfield Innovations
|
|
14
|
+
LLC restrictions stated above. Free use is permitted "as-shipped". Unauthorized
|
|
15
|
+
modification, forking, or redistribution of altered core logic is prohibited
|
|
16
|
+
without a separate commercial license from Westfield Innovations LLC.
|
|
17
|
+
|
|
18
|
+
--------------------------------------------------------------------------
|
|
19
|
+
Elastic License 2.0
|
|
20
|
+
--------------------------------------------------------------------------
|
|
21
|
+
|
|
22
|
+
## Acceptance
|
|
23
|
+
|
|
24
|
+
By using the software, you agree to all of the terms and conditions below.
|
|
25
|
+
|
|
26
|
+
## Copyright License
|
|
27
|
+
|
|
28
|
+
The licensor grants you a non-exclusive, royalty-free, worldwide,
|
|
29
|
+
non-sublicensable, non-transferable license to use, copy, distribute, make
|
|
30
|
+
available, and prepare derivative works of the software, in each case subject
|
|
31
|
+
to the limitations and conditions below.
|
|
32
|
+
|
|
33
|
+
## Limitations
|
|
34
|
+
|
|
35
|
+
You may not provide the software to third parties as a hosted or managed
|
|
36
|
+
service, where the service provides users with access to any substantial set
|
|
37
|
+
of the features or functionality of the software.
|
|
38
|
+
|
|
39
|
+
You may not move, change, disable, or circumvent the license key functionality
|
|
40
|
+
in the software, and you may not remove or obscure any functionality in the
|
|
41
|
+
software that is protected by the license key.
|
|
42
|
+
|
|
43
|
+
You may not alter, remove, or obscure any licensing, copyright, or other
|
|
44
|
+
notices of the licensor in the software. Any use of the licensor's trademarks
|
|
45
|
+
is subject to applicable law.
|
|
46
|
+
|
|
47
|
+
## Patents
|
|
48
|
+
|
|
49
|
+
The licensor grants you a license, under any patent claims the licensor can
|
|
50
|
+
license, or becomes able to license, to make, have made, use, sell, offer for
|
|
51
|
+
sale, import and have imported the software, in each case subject to the
|
|
52
|
+
limitations and conditions in this license. This license does not cover any
|
|
53
|
+
patent claims that you cause to be infringed by modifications or additions to
|
|
54
|
+
the software. If you or your company make any written claim that the software
|
|
55
|
+
infringes or contributes to infringement of any patent, your patent license
|
|
56
|
+
for the software granted under these terms ends immediately. If your company
|
|
57
|
+
makes such a claim, your patent license ends immediately for work on behalf of
|
|
58
|
+
your company.
|
|
59
|
+
|
|
60
|
+
## Notices
|
|
61
|
+
|
|
62
|
+
You must ensure that anyone who gets a copy of any part of the software from
|
|
63
|
+
you also gets a copy of these terms.
|
|
64
|
+
|
|
65
|
+
If you modify the software, you must include in any modified copies of the
|
|
66
|
+
software prominent notices stating that you have modified the software.
|
|
67
|
+
|
|
68
|
+
## No Other Rights
|
|
69
|
+
|
|
70
|
+
These terms do not imply any licenses other than those expressly granted in
|
|
71
|
+
these terms.
|
|
72
|
+
|
|
73
|
+
## Termination
|
|
74
|
+
|
|
75
|
+
If you use the software in violation of these terms, such use is not licensed,
|
|
76
|
+
and your licenses will automatically terminate. If the licensor provides you
|
|
77
|
+
with a notice of your violation, and you cease all violation of this license
|
|
78
|
+
no later than 30 days after you receive that notice, your licenses will be
|
|
79
|
+
reinstated retroactively. However, if you violate these terms after such
|
|
80
|
+
reinstatement, any additional violation of these terms will cause your
|
|
81
|
+
licenses to terminate automatically and permanently.
|
|
82
|
+
|
|
83
|
+
## No Liability
|
|
84
|
+
|
|
85
|
+
As far as the law allows, the software comes as is, without any warranty or
|
|
86
|
+
condition, and the licensor will not be liable to you for any damages arising
|
|
87
|
+
out of these terms or the use or nature of the software, under any kind of
|
|
88
|
+
legal claim.
|
|
89
|
+
|
|
90
|
+
## Definitions
|
|
91
|
+
|
|
92
|
+
The **licensor** is the entity offering these terms, and the **software** is
|
|
93
|
+
the software the licensor makes available under these terms, including any
|
|
94
|
+
portion of it.
|
|
95
|
+
|
|
96
|
+
**you** refers to the individual or entity agreeing to these terms.
|
|
97
|
+
|
|
98
|
+
**your company** is any legal entity, sole proprietorship, or other kind of
|
|
99
|
+
organization that you work for, plus all organizations that have control over,
|
|
100
|
+
are under the control of, or are under common control with that organization.
|
|
101
|
+
**control** means ownership of substantially all the assets of an entity, or
|
|
102
|
+
the power to direct its management and policies by vote, contract, or
|
|
103
|
+
otherwise. Control can be direct or indirect.
|
|
104
|
+
|
|
105
|
+
**your licenses** are all the licenses granted to you for the software under
|
|
106
|
+
these terms.
|
|
107
|
+
|
|
108
|
+
**use** means anything you do with the software requiring one of your licenses.
|
|
109
|
+
|
|
110
|
+
**trademark** means trademarks, service marks, and similar rights.
|
|
@@ -1,65 +1,128 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pdm-memory
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.4
|
|
4
4
|
Summary: Pressure-Driven Memory (PDM) — persistent, resonance-based memory for AI apps.
|
|
5
5
|
Author: Westfield Innovations LLC
|
|
6
|
-
License:
|
|
6
|
+
License: Elastic License 2.0 (ELv2)
|
|
7
|
+
=========================
|
|
7
8
|
|
|
8
9
|
Copyright (c) 2026 Westfield Innovations LLC
|
|
9
10
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
The
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
11
|
+
Core software modification and redistribution of altered versions are
|
|
12
|
+
prohibited without a commercial license from Westfield Innovations LLC.
|
|
13
|
+
Extensions via defined plugin interfaces (e.g., BaseStorage) are permitted.
|
|
14
|
+
|
|
15
|
+
Patent Pending — U.S. App. No. 19/739,419 | 63/953,563 | 63/953,842
|
|
16
|
+
|
|
17
|
+
The software in this repository is licensed under the Elastic License 2.0
|
|
18
|
+
(the text of which follows), subject to the additional Westfield Innovations
|
|
19
|
+
LLC restrictions stated above. Free use is permitted "as-shipped". Unauthorized
|
|
20
|
+
modification, forking, or redistribution of altered core logic is prohibited
|
|
21
|
+
without a separate commercial license from Westfield Innovations LLC.
|
|
22
|
+
|
|
23
|
+
--------------------------------------------------------------------------
|
|
24
|
+
Elastic License 2.0
|
|
25
|
+
--------------------------------------------------------------------------
|
|
26
|
+
|
|
27
|
+
## Acceptance
|
|
28
|
+
|
|
29
|
+
By using the software, you agree to all of the terms and conditions below.
|
|
30
|
+
|
|
31
|
+
## Copyright License
|
|
32
|
+
|
|
33
|
+
The licensor grants you a non-exclusive, royalty-free, worldwide,
|
|
34
|
+
non-sublicensable, non-transferable license to use, copy, distribute, make
|
|
35
|
+
available, and prepare derivative works of the software, in each case subject
|
|
36
|
+
to the limitations and conditions below.
|
|
37
|
+
|
|
38
|
+
## Limitations
|
|
39
|
+
|
|
40
|
+
You may not provide the software to third parties as a hosted or managed
|
|
41
|
+
service, where the service provides users with access to any substantial set
|
|
42
|
+
of the features or functionality of the software.
|
|
43
|
+
|
|
44
|
+
You may not move, change, disable, or circumvent the license key functionality
|
|
45
|
+
in the software, and you may not remove or obscure any functionality in the
|
|
46
|
+
software that is protected by the license key.
|
|
47
|
+
|
|
48
|
+
You may not alter, remove, or obscure any licensing, copyright, or other
|
|
49
|
+
notices of the licensor in the software. Any use of the licensor's trademarks
|
|
50
|
+
is subject to applicable law.
|
|
51
|
+
|
|
52
|
+
## Patents
|
|
53
|
+
|
|
54
|
+
The licensor grants you a license, under any patent claims the licensor can
|
|
55
|
+
license, or becomes able to license, to make, have made, use, sell, offer for
|
|
56
|
+
sale, import and have imported the software, in each case subject to the
|
|
57
|
+
limitations and conditions in this license. This license does not cover any
|
|
58
|
+
patent claims that you cause to be infringed by modifications or additions to
|
|
59
|
+
the software. If you or your company make any written claim that the software
|
|
60
|
+
infringes or contributes to infringement of any patent, your patent license
|
|
61
|
+
for the software granted under these terms ends immediately. If your company
|
|
62
|
+
makes such a claim, your patent license ends immediately for work on behalf of
|
|
63
|
+
your company.
|
|
64
|
+
|
|
65
|
+
## Notices
|
|
66
|
+
|
|
67
|
+
You must ensure that anyone who gets a copy of any part of the software from
|
|
68
|
+
you also gets a copy of these terms.
|
|
69
|
+
|
|
70
|
+
If you modify the software, you must include in any modified copies of the
|
|
71
|
+
software prominent notices stating that you have modified the software.
|
|
72
|
+
|
|
73
|
+
## No Other Rights
|
|
74
|
+
|
|
75
|
+
These terms do not imply any licenses other than those expressly granted in
|
|
76
|
+
these terms.
|
|
77
|
+
|
|
78
|
+
## Termination
|
|
79
|
+
|
|
80
|
+
If you use the software in violation of these terms, such use is not licensed,
|
|
81
|
+
and your licenses will automatically terminate. If the licensor provides you
|
|
82
|
+
with a notice of your violation, and you cease all violation of this license
|
|
83
|
+
no later than 30 days after you receive that notice, your licenses will be
|
|
84
|
+
reinstated retroactively. However, if you violate these terms after such
|
|
85
|
+
reinstatement, any additional violation of these terms will cause your
|
|
86
|
+
licenses to terminate automatically and permanently.
|
|
87
|
+
|
|
88
|
+
## No Liability
|
|
89
|
+
|
|
90
|
+
As far as the law allows, the software comes as is, without any warranty or
|
|
91
|
+
condition, and the licensor will not be liable to you for any damages arising
|
|
92
|
+
out of these terms or the use or nature of the software, under any kind of
|
|
93
|
+
legal claim.
|
|
94
|
+
|
|
95
|
+
## Definitions
|
|
96
|
+
|
|
97
|
+
The **licensor** is the entity offering these terms, and the **software** is
|
|
98
|
+
the software the licensor makes available under these terms, including any
|
|
99
|
+
portion of it.
|
|
100
|
+
|
|
101
|
+
**you** refers to the individual or entity agreeing to these terms.
|
|
102
|
+
|
|
103
|
+
**your company** is any legal entity, sole proprietorship, or other kind of
|
|
104
|
+
organization that you work for, plus all organizations that have control over,
|
|
105
|
+
are under the control of, or are under common control with that organization.
|
|
106
|
+
**control** means ownership of substantially all the assets of an entity, or
|
|
107
|
+
the power to direct its management and policies by vote, contract, or
|
|
108
|
+
otherwise. Control can be direct or indirect.
|
|
109
|
+
|
|
110
|
+
**your licenses** are all the licenses granted to you for the software under
|
|
111
|
+
these terms.
|
|
112
|
+
|
|
113
|
+
**use** means anything you do with the software requiring one of your licenses.
|
|
114
|
+
|
|
115
|
+
**trademark** means trademarks, service marks, and similar rights.
|
|
116
|
+
|
|
117
|
+
Project-URL: Homepage, https://azus.ai
|
|
118
|
+
Project-URL: Documentation, https://azus.ai
|
|
58
119
|
Project-URL: Bug Tracker, https://github.com/westfield-innovations/pdm-memory/issues
|
|
120
|
+
Project-URL: Source, https://github.com/westfield-innovations/pdm-memory
|
|
121
|
+
Project-URL: Repository, https://github.com/westfield-innovations/pdm-memory
|
|
59
122
|
Keywords: ai,memory,llm,rag,pressure-driven,persistent-memory
|
|
60
123
|
Classifier: Development Status :: 4 - Beta
|
|
61
124
|
Classifier: Intended Audience :: Developers
|
|
62
|
-
Classifier: License ::
|
|
125
|
+
Classifier: License :: Other/Proprietary License
|
|
63
126
|
Classifier: Programming Language :: Python :: 3
|
|
64
127
|
Classifier: Programming Language :: Python :: 3.10
|
|
65
128
|
Classifier: Programming Language :: Python :: 3.11
|
|
@@ -106,7 +169,7 @@ Dynamic: license-file
|
|
|
106
169
|
[](https://pypi.org/project/pdm-memory/)
|
|
107
170
|
[](https://pypi.org/project/pdm-memory/)
|
|
108
171
|
[](https://github.com/westfield-innovations/pdm-memory/actions)
|
|
109
|
-
[](LICENSE)
|
|
110
173
|
|
|
111
174
|
Your LLM forgets everything between conversations. The standard fix — stuff a vector database into the context window — is expensive, slow, and retrieves **what matches words, not what matters**.
|
|
112
175
|
|
|
@@ -480,6 +543,16 @@ mem._engine = RetrievalEngine()
|
|
|
480
543
|
|
|
481
544
|
## 📄 License
|
|
482
545
|
|
|
483
|
-
|
|
546
|
+
Free to use **as-shipped** under a custom [Elastic License 2.0 (ELv2)](LICENSE)
|
|
547
|
+
base from **Westfield Innovations LLC**.
|
|
548
|
+
|
|
549
|
+
- Use the SDK as distributed: yes.
|
|
550
|
+
- Modify / fork / redistribute altered **core** logic: **no**, without a
|
|
551
|
+
commercial license from Westfield Innovations LLC.
|
|
552
|
+
- Extensions via defined plugin interfaces (e.g. `BaseStorage`): **permitted**.
|
|
553
|
+
|
|
554
|
+
**Patent Pending** — U.S. App. No. **19/739,419** · **63/953,563** · **63/953,842**.
|
|
555
|
+
|
|
556
|
+
If this software makes you money, send Carl a birthday card. He collects them.
|
|
484
557
|
|
|
485
|
-
Built by **Westfield Innovations LLC** · [
|
|
558
|
+
Built by **Westfield Innovations LLC** · [azus.ai](https://azus.ai) · [getdeepsignals.com](https://getdeepsignals.com)
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
[](https://pypi.org/project/pdm-memory/)
|
|
4
4
|
[](https://pypi.org/project/pdm-memory/)
|
|
5
5
|
[](https://github.com/westfield-innovations/pdm-memory/actions)
|
|
6
|
-
[](LICENSE)
|
|
7
7
|
|
|
8
8
|
Your LLM forgets everything between conversations. The standard fix — stuff a vector database into the context window — is expensive, slow, and retrieves **what matches words, not what matters**.
|
|
9
9
|
|
|
@@ -377,6 +377,16 @@ mem._engine = RetrievalEngine()
|
|
|
377
377
|
|
|
378
378
|
## 📄 License
|
|
379
379
|
|
|
380
|
-
|
|
380
|
+
Free to use **as-shipped** under a custom [Elastic License 2.0 (ELv2)](LICENSE)
|
|
381
|
+
base from **Westfield Innovations LLC**.
|
|
381
382
|
|
|
382
|
-
|
|
383
|
+
- Use the SDK as distributed: yes.
|
|
384
|
+
- Modify / fork / redistribute altered **core** logic: **no**, without a
|
|
385
|
+
commercial license from Westfield Innovations LLC.
|
|
386
|
+
- Extensions via defined plugin interfaces (e.g. `BaseStorage`): **permitted**.
|
|
387
|
+
|
|
388
|
+
**Patent Pending** — U.S. App. No. **19/739,419** · **63/953,563** · **63/953,842**.
|
|
389
|
+
|
|
390
|
+
If this software makes you money, send Carl a birthday card. He collects them.
|
|
391
|
+
|
|
392
|
+
Built by **Westfield Innovations LLC** · [azus.ai](https://azus.ai) · [getdeepsignals.com](https://getdeepsignals.com)
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
# © 2026 Westfield Innovations LLC. Patent Pending.
|
|
2
|
+
# U.S. App. No. 19/739,419 | 63/953,563 | 63/953,842
|
|
3
|
+
# MODIFICATION PROHIBITED. USE AS SHIPPED.
|
|
4
|
+
|
|
1
5
|
"""
|
|
2
6
|
pdm_memory — Pressure-Driven Memory SDK
|
|
3
7
|
========================================
|
|
@@ -18,5 +22,5 @@ See README.md for full documentation.
|
|
|
18
22
|
from pdm_memory.memory import Memory
|
|
19
23
|
from pdm_memory.core.signature import MemoryHit, DrawerInfo
|
|
20
24
|
|
|
21
|
-
__version__ = "0.1.
|
|
25
|
+
__version__ = "0.1.3"
|
|
22
26
|
__all__ = ["Memory", "MemoryHit", "DrawerInfo", "__version__"]
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# © 2026 Westfield Innovations LLC. Patent Pending.
|
|
2
|
+
# U.S. App. No. 19/739,419 | 63/953,563 | 63/953,842
|
|
3
|
+
# MODIFICATION PROHIBITED. USE AS SHIPPED.
|
|
4
|
+
|
|
5
|
+
"""Entry point for: python -m pdm_memory.bench"""
|
|
6
|
+
from pdm_memory.tools.bench import main
|
|
7
|
+
|
|
8
|
+
if __name__ == "__main__":
|
|
9
|
+
main()
|
|
@@ -1,20 +1,29 @@
|
|
|
1
|
+
# © 2026 Westfield Innovations LLC. Patent Pending.
|
|
2
|
+
# U.S. App. No. 19/739,419 | 63/953,563 | 63/953,842
|
|
3
|
+
# MODIFICATION PROHIBITED. USE AS SHIPPED.
|
|
4
|
+
|
|
1
5
|
"""
|
|
2
6
|
PDM Core Math — Pure Python, zero external dependencies.
|
|
3
7
|
|
|
4
8
|
All formulas are ported faithfully from companion_api/pdm/kernel.py
|
|
5
9
|
and companion_api/pdm/models.py. No Django, no ORM, no Celery.
|
|
6
10
|
|
|
7
|
-
Formula reference:
|
|
11
|
+
Formula reference (ONE canonical decay law):
|
|
8
12
|
effective_spike = min(100, P_magnitude × (t_persistence/30) × phase_privilege)
|
|
9
13
|
decay_factor = 1 - exp(-λ × t) where λ = ln2 / half_life
|
|
10
14
|
V = (correct + 1) / (total + 2) [Laplace smoothing]
|
|
11
15
|
P_effective = P × V × (1 - decay_factor) × intent_weight × quality × comparator
|
|
12
|
-
|
|
16
|
+
|
|
17
|
+
Grace: if days_since_created ≤ t_persistence → decay_factor = 0.
|
|
18
|
+
Surviving fraction = (1 - decay_factor) = exp(-λ × t).
|
|
19
|
+
|
|
20
|
+
Legacy power-law (p × decay_rate^days) is REMOVED — it double-penalized recall.
|
|
13
21
|
"""
|
|
14
22
|
|
|
15
23
|
from __future__ import annotations
|
|
16
24
|
|
|
17
25
|
import math
|
|
26
|
+
import warnings
|
|
18
27
|
from typing import Dict, List, Optional
|
|
19
28
|
|
|
20
29
|
|
|
@@ -38,10 +47,10 @@ DEFAULT_HALF_LIFE: float = 30.0
|
|
|
38
47
|
P_MAX: float = 100.0
|
|
39
48
|
P_FLOOR: float = 0.0
|
|
40
49
|
|
|
41
|
-
# Decay trigger — signatures below this are eligible for deletion
|
|
50
|
+
# Decay trigger — signatures below this live P_eff are eligible for deletion
|
|
42
51
|
DECAY_DELETE_THRESHOLD: float = 30.0
|
|
43
52
|
|
|
44
|
-
#
|
|
53
|
+
# Kept for SignatureRecord/schema backward-compat only — NOT used by pressure decay.
|
|
45
54
|
DEFAULT_DECAY_RATE: float = 0.9
|
|
46
55
|
|
|
47
56
|
|
|
@@ -71,28 +80,38 @@ def calculate_effective_spike(
|
|
|
71
80
|
return min(P_MAX, max(P_FLOOR, raw))
|
|
72
81
|
|
|
73
82
|
|
|
83
|
+
def resolve_half_life(domain: Optional[str]) -> float:
|
|
84
|
+
"""Map knowledge domain → half-life days (canonical decay clock)."""
|
|
85
|
+
if not domain:
|
|
86
|
+
return DEFAULT_HALF_LIFE
|
|
87
|
+
return DOMAIN_HALF_LIVES.get(domain, DEFAULT_HALF_LIFE)
|
|
88
|
+
|
|
89
|
+
|
|
74
90
|
def calculate_decay_factor(
|
|
75
91
|
days_since_retrieved: float,
|
|
76
92
|
half_life: float = DEFAULT_HALF_LIFE,
|
|
93
|
+
*,
|
|
94
|
+
days_since_created: Optional[float] = None,
|
|
95
|
+
t_persistence: float = 0.0,
|
|
77
96
|
) -> float:
|
|
78
97
|
"""
|
|
79
|
-
|
|
98
|
+
Canonical exponential decay factor based on time since last retrieval.
|
|
80
99
|
|
|
81
100
|
decay_factor = 1 - exp(-λ × t) where λ = ln2 / half_life
|
|
82
101
|
|
|
102
|
+
Grace window: if ``days_since_created`` is provided and
|
|
103
|
+
``days_since_created <= t_persistence``, returns 0.0 (no decay yet).
|
|
104
|
+
|
|
83
105
|
A decay_factor close to 0 means the memory is fresh (little decay).
|
|
84
106
|
A decay_factor close to 1 means the memory is very stale.
|
|
85
|
-
|
|
86
|
-
Args:
|
|
87
|
-
days_since_retrieved: Days since this memory was last accessed.
|
|
88
|
-
half_life: Domain-specific half-life in days.
|
|
89
|
-
|
|
90
|
-
Returns:
|
|
91
|
-
decay_factor in [0, 1].
|
|
92
107
|
"""
|
|
108
|
+
if days_since_created is not None and days_since_created <= max(0.0, t_persistence):
|
|
109
|
+
return 0.0
|
|
110
|
+
|
|
111
|
+
days = max(0.0, float(days_since_retrieved))
|
|
93
112
|
half_life = max(0.1, half_life)
|
|
94
113
|
lam = math.log(2) / half_life
|
|
95
|
-
return 1.0 - math.exp(-lam *
|
|
114
|
+
return 1.0 - math.exp(-lam * days)
|
|
96
115
|
|
|
97
116
|
|
|
98
117
|
def calculate_v(correct: int, total: int) -> float:
|
|
@@ -169,50 +188,77 @@ def calculate_p_effective(
|
|
|
169
188
|
|
|
170
189
|
|
|
171
190
|
# ---------------------------------------------------------------------------
|
|
172
|
-
#
|
|
191
|
+
# Maintenance projection of stored pressure (same half-life law as P_effective)
|
|
173
192
|
# ---------------------------------------------------------------------------
|
|
174
193
|
|
|
175
194
|
|
|
176
|
-
def
|
|
195
|
+
def calculate_half_life_pressure(
|
|
177
196
|
p_magnitude: float,
|
|
178
|
-
|
|
197
|
+
days_since_retrieved: float,
|
|
198
|
+
half_life: float,
|
|
179
199
|
t_persistence: float,
|
|
180
200
|
phase_privilege: float = 1.0,
|
|
181
|
-
|
|
201
|
+
*,
|
|
202
|
+
days_since_created: Optional[float] = None,
|
|
182
203
|
) -> tuple[float, float]:
|
|
183
204
|
"""
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
Decay only fires after t_persistence days. If days_elapsed ≤ t_persistence,
|
|
187
|
-
the memory is within its guaranteed persistence window — no decay applied.
|
|
205
|
+
Project stored pressure after canonical half-life decay.
|
|
188
206
|
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
decayed_p = p_magnitude × decay_per_day^(days_elapsed - t_persistence)
|
|
192
|
-
else:
|
|
193
|
-
decayed_p = p_magnitude (still in persistence window)
|
|
207
|
+
Uses the SAME law as live scoring:
|
|
208
|
+
new_p = p_magnitude × (1 - decay_factor) = p_magnitude × exp(-λ × t)
|
|
194
209
|
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
days_elapsed: Days since the memory was created (or last decayed).
|
|
198
|
-
t_persistence: Guaranteed persistence window in days.
|
|
199
|
-
phase_privilege: Phase multiplier for effective_spike.
|
|
200
|
-
decay_per_day: Multiplier per day past persistence (default 0.9 = 10% loss/day).
|
|
210
|
+
Prefer deleting by live ``P_effective`` over rewriting ``p_magnitude``.
|
|
211
|
+
This helper exists for maintenance tooling / tests that need a projected P.
|
|
201
212
|
|
|
202
213
|
Returns:
|
|
203
|
-
Tuple (
|
|
214
|
+
Tuple (projected_p_magnitude, new_effective_spike).
|
|
204
215
|
"""
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
216
|
+
created_days = (
|
|
217
|
+
days_since_created
|
|
218
|
+
if days_since_created is not None
|
|
219
|
+
else days_since_retrieved
|
|
220
|
+
)
|
|
221
|
+
decay = calculate_decay_factor(
|
|
222
|
+
days_since_retrieved,
|
|
223
|
+
half_life,
|
|
224
|
+
days_since_created=created_days,
|
|
225
|
+
t_persistence=t_persistence,
|
|
226
|
+
)
|
|
227
|
+
new_p = max(P_FLOOR, min(P_MAX, p_magnitude * (1.0 - decay)))
|
|
212
228
|
new_spike = calculate_effective_spike(new_p, t_persistence, phase_privilege)
|
|
213
229
|
return round(new_p, 6), round(new_spike, 6)
|
|
214
230
|
|
|
215
231
|
|
|
232
|
+
def calculate_incremental_decay(
|
|
233
|
+
p_magnitude: float,
|
|
234
|
+
days_elapsed: float,
|
|
235
|
+
t_persistence: float,
|
|
236
|
+
phase_privilege: float = 1.0,
|
|
237
|
+
decay_per_day: float = DEFAULT_DECAY_RATE,
|
|
238
|
+
half_life: float = DEFAULT_HALF_LIFE,
|
|
239
|
+
) -> tuple[float, float]:
|
|
240
|
+
"""
|
|
241
|
+
DEPRECATED alias for :func:`calculate_half_life_pressure`.
|
|
242
|
+
|
|
243
|
+
The old power-law ``p × decay_per_day^days`` double-counted with live
|
|
244
|
+
half-life scoring and is no longer applied. ``decay_per_day`` is ignored.
|
|
245
|
+
"""
|
|
246
|
+
warnings.warn(
|
|
247
|
+
"calculate_incremental_decay is deprecated; use calculate_half_life_pressure "
|
|
248
|
+
"(canonical domain half-life). decay_per_day is ignored.",
|
|
249
|
+
DeprecationWarning,
|
|
250
|
+
stacklevel=2,
|
|
251
|
+
)
|
|
252
|
+
return calculate_half_life_pressure(
|
|
253
|
+
p_magnitude=p_magnitude,
|
|
254
|
+
days_since_retrieved=max(0.0, days_elapsed - max(0.0, t_persistence)),
|
|
255
|
+
half_life=half_life,
|
|
256
|
+
t_persistence=t_persistence,
|
|
257
|
+
phase_privilege=phase_privilege,
|
|
258
|
+
days_since_created=days_elapsed,
|
|
259
|
+
)
|
|
260
|
+
|
|
261
|
+
|
|
216
262
|
# ---------------------------------------------------------------------------
|
|
217
263
|
# Task 1.3: Temporal geometry (PDM-T), ported from models.py
|
|
218
264
|
# ---------------------------------------------------------------------------
|