gleanr 0.1.0__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.
- gleanr-0.1.0/.gitignore +171 -0
- gleanr-0.1.0/CLAUDE.md +43 -0
- gleanr-0.1.0/LICENSE +21 -0
- gleanr-0.1.0/PKG-INFO +555 -0
- gleanr-0.1.0/PLAN.md +1175 -0
- gleanr-0.1.0/README.md +503 -0
- gleanr-0.1.0/examples/__init__.py +1 -0
- gleanr-0.1.0/examples/diagnose_missing_facts.py +177 -0
- gleanr-0.1.0/examples/evaluation/__init__.py +30 -0
- gleanr-0.1.0/examples/evaluation/evaluator.py +533 -0
- gleanr-0.1.0/examples/evaluation/metrics.py +559 -0
- gleanr-0.1.0/examples/evaluation/reporter.py +370 -0
- gleanr-0.1.0/examples/evaluation/run.py +250 -0
- gleanr-0.1.0/examples/evaluation/scenarios.py +514 -0
- gleanr-0.1.0/examples/smoke_test_consolidation.py +237 -0
- gleanr-0.1.0/examples/test_agent/__init__.py +1 -0
- gleanr-0.1.0/examples/test_agent/agent.py +321 -0
- gleanr-0.1.0/examples/test_agent/cli.py +135 -0
- gleanr-0.1.0/examples/test_agent/config.py +80 -0
- gleanr-0.1.0/examples/test_agent/llm.py +433 -0
- gleanr-0.1.0/examples/test_agent/run.py +168 -0
- gleanr-0.1.0/examples/test_agent/tools.py +167 -0
- gleanr-0.1.0/gleanr/__init__.py +100 -0
- gleanr-0.1.0/gleanr/cache/__init__.py +10 -0
- gleanr-0.1.0/gleanr/cache/config.py +32 -0
- gleanr-0.1.0/gleanr/cache/lru.py +186 -0
- gleanr-0.1.0/gleanr/core/__init__.py +19 -0
- gleanr-0.1.0/gleanr/core/config.py +224 -0
- gleanr-0.1.0/gleanr/core/session.py +381 -0
- gleanr-0.1.0/gleanr/errors/__init__.py +29 -0
- gleanr-0.1.0/gleanr/errors/exceptions.py +154 -0
- gleanr-0.1.0/gleanr/memory/__init__.py +15 -0
- gleanr-0.1.0/gleanr/memory/coverage.py +94 -0
- gleanr-0.1.0/gleanr/memory/episode_manager.py +205 -0
- gleanr-0.1.0/gleanr/memory/ingestion.py +182 -0
- gleanr-0.1.0/gleanr/memory/recall.py +361 -0
- gleanr-0.1.0/gleanr/memory/reflection.py +621 -0
- gleanr-0.1.0/gleanr/models/__init__.py +38 -0
- gleanr-0.1.0/gleanr/models/consolidation.py +39 -0
- gleanr-0.1.0/gleanr/models/episode.py +73 -0
- gleanr-0.1.0/gleanr/models/fact.py +83 -0
- gleanr-0.1.0/gleanr/models/turn.py +77 -0
- gleanr-0.1.0/gleanr/models/types.py +107 -0
- gleanr-0.1.0/gleanr/providers/__init__.py +19 -0
- gleanr-0.1.0/gleanr/providers/anthropic.py +146 -0
- gleanr-0.1.0/gleanr/providers/base.py +143 -0
- gleanr-0.1.0/gleanr/providers/http.py +377 -0
- gleanr-0.1.0/gleanr/providers/openai.py +213 -0
- gleanr-0.1.0/gleanr/providers/parsing.py +227 -0
- gleanr-0.1.0/gleanr/storage/__init__.py +16 -0
- gleanr-0.1.0/gleanr/storage/base.py +301 -0
- gleanr-0.1.0/gleanr/storage/memory.py +239 -0
- gleanr-0.1.0/gleanr/storage/sqlite.py +640 -0
- gleanr-0.1.0/gleanr/utils/__init__.py +72 -0
- gleanr-0.1.0/gleanr/utils/ids.py +58 -0
- gleanr-0.1.0/gleanr/utils/markers.py +133 -0
- gleanr-0.1.0/gleanr/utils/retry.py +121 -0
- gleanr-0.1.0/gleanr/utils/tokens.py +65 -0
- gleanr-0.1.0/gleanr/utils/validation.py +233 -0
- gleanr-0.1.0/gleanr/utils/vectors.py +24 -0
- gleanr-0.1.0/pyproject.toml +115 -0
- gleanr-0.1.0/tests/__init__.py +1 -0
- gleanr-0.1.0/tests/conftest.py +132 -0
- gleanr-0.1.0/tests/integration/__init__.py +1 -0
- gleanr-0.1.0/tests/integration/test_consolidation.py +356 -0
- gleanr-0.1.0/tests/integration/test_full_cycle.py +253 -0
- gleanr-0.1.0/tests/unit/__init__.py +1 -0
- gleanr-0.1.0/tests/unit/test_cache.py +186 -0
- gleanr-0.1.0/tests/unit/test_consolidation_models.py +88 -0
- gleanr-0.1.0/tests/unit/test_coverage.py +136 -0
- gleanr-0.1.0/tests/unit/test_markers.py +160 -0
- gleanr-0.1.0/tests/unit/test_models.py +332 -0
- gleanr-0.1.0/tests/unit/test_parsing.py +155 -0
- gleanr-0.1.0/tests/unit/test_reflection.py +1029 -0
- gleanr-0.1.0/tests/unit/test_storage.py +462 -0
- gleanr-0.1.0/tests/unit/test_validation.py +219 -0
- gleanr-0.1.0/tests/unit/test_vectors.py +29 -0
gleanr-0.1.0/.gitignore
ADDED
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
share/python-wheels/
|
|
24
|
+
*.egg-info/
|
|
25
|
+
.installed.cfg
|
|
26
|
+
*.egg
|
|
27
|
+
MANIFEST
|
|
28
|
+
|
|
29
|
+
# PyInstaller
|
|
30
|
+
*.manifest
|
|
31
|
+
*.spec
|
|
32
|
+
|
|
33
|
+
# Installer logs
|
|
34
|
+
pip-log.txt
|
|
35
|
+
pip-delete-this-directory.txt
|
|
36
|
+
|
|
37
|
+
# Unit test / coverage reports
|
|
38
|
+
htmlcov/
|
|
39
|
+
.tox/
|
|
40
|
+
.nox/
|
|
41
|
+
.coverage
|
|
42
|
+
.coverage.*
|
|
43
|
+
.cache
|
|
44
|
+
nosetests.xml
|
|
45
|
+
coverage.xml
|
|
46
|
+
*.cover
|
|
47
|
+
*.py,cover
|
|
48
|
+
.hypothesis/
|
|
49
|
+
.pytest_cache/
|
|
50
|
+
|
|
51
|
+
# Translations
|
|
52
|
+
*.mo
|
|
53
|
+
*.pot
|
|
54
|
+
|
|
55
|
+
# Django stuff:
|
|
56
|
+
*.log
|
|
57
|
+
local_settings.py
|
|
58
|
+
db.sqlite3
|
|
59
|
+
db.sqlite3-journal
|
|
60
|
+
|
|
61
|
+
# Flask stuff:
|
|
62
|
+
instance/
|
|
63
|
+
.webassets-cache
|
|
64
|
+
|
|
65
|
+
# Scrapy stuff:
|
|
66
|
+
.scrapy
|
|
67
|
+
|
|
68
|
+
# Sphinx documentation
|
|
69
|
+
docs/_build/
|
|
70
|
+
|
|
71
|
+
# PyBuilder
|
|
72
|
+
.pybuilder/
|
|
73
|
+
target/
|
|
74
|
+
|
|
75
|
+
# Jupyter Notebook
|
|
76
|
+
.ipynb_checkpoints
|
|
77
|
+
|
|
78
|
+
# IPython
|
|
79
|
+
profile_default/
|
|
80
|
+
ipython_config.py
|
|
81
|
+
|
|
82
|
+
# pyenv
|
|
83
|
+
.python-version
|
|
84
|
+
|
|
85
|
+
# pipenv
|
|
86
|
+
Pipfile.lock
|
|
87
|
+
|
|
88
|
+
# poetry
|
|
89
|
+
poetry.lock
|
|
90
|
+
|
|
91
|
+
# pdm
|
|
92
|
+
.pdm.toml
|
|
93
|
+
.pdm-python
|
|
94
|
+
.pdm-build/
|
|
95
|
+
|
|
96
|
+
# PEP 582
|
|
97
|
+
__pypackages__/
|
|
98
|
+
|
|
99
|
+
# Celery stuff
|
|
100
|
+
celerybeat-schedule
|
|
101
|
+
celerybeat.pid
|
|
102
|
+
|
|
103
|
+
# SageMath parsed files
|
|
104
|
+
*.sage.py
|
|
105
|
+
|
|
106
|
+
# Environments
|
|
107
|
+
.env
|
|
108
|
+
.venv
|
|
109
|
+
env/
|
|
110
|
+
venv/
|
|
111
|
+
ENV/
|
|
112
|
+
env.bak/
|
|
113
|
+
venv.bak/
|
|
114
|
+
|
|
115
|
+
# Spyder project settings
|
|
116
|
+
.spyderproject
|
|
117
|
+
.spyproject
|
|
118
|
+
|
|
119
|
+
# Rope project settings
|
|
120
|
+
.ropeproject
|
|
121
|
+
|
|
122
|
+
# mkdocs documentation
|
|
123
|
+
/site
|
|
124
|
+
|
|
125
|
+
# mypy
|
|
126
|
+
.mypy_cache/
|
|
127
|
+
.dmypy.json
|
|
128
|
+
dmypy.json
|
|
129
|
+
|
|
130
|
+
# Pyre type checker
|
|
131
|
+
.pyre/
|
|
132
|
+
|
|
133
|
+
# pytype static type analyzer
|
|
134
|
+
.pytype/
|
|
135
|
+
|
|
136
|
+
# Cython debug symbols
|
|
137
|
+
cython_debug/
|
|
138
|
+
|
|
139
|
+
# IDEs and editors
|
|
140
|
+
.idea/
|
|
141
|
+
.vscode/
|
|
142
|
+
*.swp
|
|
143
|
+
*.swo
|
|
144
|
+
*~
|
|
145
|
+
.project
|
|
146
|
+
.pydevproject
|
|
147
|
+
.settings/
|
|
148
|
+
*.sublime-project
|
|
149
|
+
*.sublime-workspace
|
|
150
|
+
|
|
151
|
+
# OS generated files
|
|
152
|
+
.DS_Store
|
|
153
|
+
.DS_Store?
|
|
154
|
+
._*
|
|
155
|
+
.Spotlight-V100
|
|
156
|
+
.Trashes
|
|
157
|
+
ehthumbs.db
|
|
158
|
+
Thumbs.db
|
|
159
|
+
|
|
160
|
+
# Gleanr specific
|
|
161
|
+
*.db
|
|
162
|
+
*.sqlite
|
|
163
|
+
*.sqlite3
|
|
164
|
+
data/
|
|
165
|
+
.gleanr/
|
|
166
|
+
|
|
167
|
+
# Test artifacts
|
|
168
|
+
.test_data/
|
|
169
|
+
test_*.db
|
|
170
|
+
.claude/settings.local.json
|
|
171
|
+
gleanr/py.typed
|
gleanr-0.1.0/CLAUDE.md
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# CLAUDE.md
|
|
2
|
+
|
|
3
|
+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
|
4
|
+
|
|
5
|
+
## Project Overview
|
|
6
|
+
|
|
7
|
+
Gleanr (Agent Context Management System) is a session-scoped memory layer for AI agents. It provides structured, persistent context management that is distinct from knowledge retrieval (RAG/search).
|
|
8
|
+
|
|
9
|
+
**Core principle:** Agent memory is not knowledge retrieval. Gleanr handles internal agent state (experience-driven, persistent, continuity-focused), not external knowledge queries.
|
|
10
|
+
|
|
11
|
+
## Architecture
|
|
12
|
+
|
|
13
|
+
### Three Planes Model
|
|
14
|
+
1. **Memory Plane (Gleanr)** - Internal, session-scoped, always-on per turn
|
|
15
|
+
2. **Knowledge Plane (Tools)** - RAG, web search, APIs (external, stateless)
|
|
16
|
+
3. **Reasoning Plane (LLM)** - Consumes context from both planes
|
|
17
|
+
|
|
18
|
+
Gleanr operates **before tool invocation** and **after agent output**.
|
|
19
|
+
|
|
20
|
+
### Memory Levels
|
|
21
|
+
- **L0 (Raw Turns)** - Verbatim messages, short-lived with aggressive TTL
|
|
22
|
+
- **L1 (Episodes)** - Mandatory grouping of turns around goals/tasks, session-bound
|
|
23
|
+
- **L2 (Semantic Facts)** - Optional, reflection-generated (decisions, constraints, outcomes)
|
|
24
|
+
- **L3 (Themes)** - Future, not in v1
|
|
25
|
+
|
|
26
|
+
### Turn Lifecycle
|
|
27
|
+
1. Begin Turn: User input received → relevant memory recalled automatically
|
|
28
|
+
2. Reasoning & Tools: Agent plans, optional RAG/search
|
|
29
|
+
3. End Turn: Response produced → memory-worthy info ingested → reflection scheduled async
|
|
30
|
+
|
|
31
|
+
## Key Design Decisions
|
|
32
|
+
|
|
33
|
+
- Reflection enabled by default but system works without it (L1 episodes remain functional)
|
|
34
|
+
- Store conclusions, not evidence (no raw RAG results, no chain-of-thought)
|
|
35
|
+
- Token-budgeted recall with hard limits
|
|
36
|
+
- All memory events track `actor_type` (user|agent|tool) and `actor_id`
|
|
37
|
+
- Integration target: ≤10 LOC per agent
|
|
38
|
+
|
|
39
|
+
## What to Store vs Not Store
|
|
40
|
+
|
|
41
|
+
**Store:** Decisions made, constraints discovered, failures/retries, tool outcomes, session preferences
|
|
42
|
+
|
|
43
|
+
**Never store:** Raw RAG results, web pages, redundant paraphrases, hidden reasoning
|
gleanr-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 ACMS Contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|