gaius-memory 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.
- gaius_memory-0.1.0/LICENSE +156 -0
- gaius_memory-0.1.0/PKG-INFO +398 -0
- gaius_memory-0.1.0/README.md +367 -0
- gaius_memory-0.1.0/gaius/__init__.py +50 -0
- gaius_memory-0.1.0/gaius/__main__.py +3 -0
- gaius_memory-0.1.0/gaius/_core.py +6890 -0
- gaius_memory-0.1.0/gaius/concord.py +1530 -0
- gaius_memory-0.1.0/gaius/corpus_audit.py +392 -0
- gaius_memory-0.1.0/gaius/degradation.py +490 -0
- gaius_memory-0.1.0/gaius/kg.py +713 -0
- gaius_memory-0.1.0/gaius/landscape.py +1004 -0
- gaius_memory-0.1.0/gaius/maturity.py +499 -0
- gaius_memory-0.1.0/gaius/mcp_server.py +439 -0
- gaius_memory-0.1.0/gaius/outcomes.py +130 -0
- gaius_memory-0.1.0/gaius/parsers.py +637 -0
- gaius_memory-0.1.0/gaius/presets/default.yaml +51 -0
- gaius_memory-0.1.0/gaius/presets/k8s.yaml +87 -0
- gaius_memory-0.1.0/gaius/raft.py +578 -0
- gaius_memory-0.1.0/gaius/recentstate.py +454 -0
- gaius_memory-0.1.0/gaius/reconcile.py +222 -0
- gaius_memory-0.1.0/gaius/record.py +247 -0
- gaius_memory-0.1.0/gaius/skill/SKILL.md +146 -0
- gaius_memory-0.1.0/gaius/skill/mnemos-scaffold.md +170 -0
- gaius_memory-0.1.0/gaius/telemetry.py +418 -0
- gaius_memory-0.1.0/gaius_memory.egg-info/PKG-INFO +398 -0
- gaius_memory-0.1.0/gaius_memory.egg-info/SOURCES.txt +53 -0
- gaius_memory-0.1.0/gaius_memory.egg-info/dependency_links.txt +1 -0
- gaius_memory-0.1.0/gaius_memory.egg-info/entry_points.txt +3 -0
- gaius_memory-0.1.0/gaius_memory.egg-info/requires.txt +14 -0
- gaius_memory-0.1.0/gaius_memory.egg-info/top_level.txt +1 -0
- gaius_memory-0.1.0/pyproject.toml +60 -0
- gaius_memory-0.1.0/setup.cfg +4 -0
- gaius_memory-0.1.0/tests/test_agent_review.py +106 -0
- gaius_memory-0.1.0/tests/test_completion.py +47 -0
- gaius_memory-0.1.0/tests/test_concord.py +747 -0
- gaius_memory-0.1.0/tests/test_confirmation_cap.py +56 -0
- gaius_memory-0.1.0/tests/test_core.py +751 -0
- gaius_memory-0.1.0/tests/test_corpus_audit.py +65 -0
- gaius_memory-0.1.0/tests/test_corpus_enforce.py +115 -0
- gaius_memory-0.1.0/tests/test_decay_volatility.py +32 -0
- gaius_memory-0.1.0/tests/test_degradation.py +154 -0
- gaius_memory-0.1.0/tests/test_kg.py +309 -0
- gaius_memory-0.1.0/tests/test_live_ttl.py +119 -0
- gaius_memory-0.1.0/tests/test_mined_fact_type.py +82 -0
- gaius_memory-0.1.0/tests/test_mnemosyne.py +670 -0
- gaius_memory-0.1.0/tests/test_narration_noise.py +207 -0
- gaius_memory-0.1.0/tests/test_outcomes.py +58 -0
- gaius_memory-0.1.0/tests/test_peer_agents.py +270 -0
- gaius_memory-0.1.0/tests/test_peer_promote.py +118 -0
- gaius_memory-0.1.0/tests/test_recentstate.py +469 -0
- gaius_memory-0.1.0/tests/test_reconcile.py +142 -0
- gaius_memory-0.1.0/tests/test_record.py +123 -0
- gaius_memory-0.1.0/tests/test_rescore.py +157 -0
- gaius_memory-0.1.0/tests/test_route_suggest.py +85 -0
- gaius_memory-0.1.0/tests/test_skill_stubs.py +124 -0
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship made available under
|
|
36
|
+
the License, as indicated by a copyright notice that is included in
|
|
37
|
+
or attached to the work (an example is provided in the Appendix below).
|
|
38
|
+
|
|
39
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
40
|
+
form, that is based on (or derived from) the Work and for which the
|
|
41
|
+
editorial revisions, annotations, elaborations, or other
|
|
42
|
+
transformations represent, as a whole, an original work of authorship.
|
|
43
|
+
For the purposes of this License, Derivative Works shall not include
|
|
44
|
+
works that remain separable from, or merely link (or bind by name) to
|
|
45
|
+
the interfaces of, the Work and Derivative Works thereof.
|
|
46
|
+
|
|
47
|
+
"Contribution" shall mean, as submitted to the Licensor for inclusion
|
|
48
|
+
in the Work by the copyright owner or by an Individual or Legal Entity
|
|
49
|
+
authorized to submit on behalf of the copyright owner. For the
|
|
50
|
+
purposes of this definition, "contribution" includes the original
|
|
51
|
+
version of the Work and any modifications or additions to that Work
|
|
52
|
+
or Derivative Works of the Work.
|
|
53
|
+
|
|
54
|
+
"Contributor" shall mean Licensor and any Legal Entity on behalf of
|
|
55
|
+
whom a Contribution has been received by the Licensor and included
|
|
56
|
+
within the Work.
|
|
57
|
+
|
|
58
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
59
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
60
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
61
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
62
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
63
|
+
Work and such Derivative Works in Source or Object form.
|
|
64
|
+
|
|
65
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
66
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
67
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
68
|
+
(except as stated in this section) patent license to make, have made,
|
|
69
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
70
|
+
where such license applies only to those patent claims licensable by
|
|
71
|
+
such Contributor that are necessarily infringed by their
|
|
72
|
+
Contribution(s) alone or by the combined Contribution(s) and the
|
|
73
|
+
Work. If You institute patent litigation against any entity
|
|
74
|
+
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
|
75
|
+
the Work or any combination of the Work constitutes direct or
|
|
76
|
+
contributory patent infringement, then any patent rights granted to
|
|
77
|
+
You under this License for the Work shall terminate as of the date
|
|
78
|
+
such litigation is filed.
|
|
79
|
+
|
|
80
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
81
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
82
|
+
modifications, and in Source or Object form, provided that You
|
|
83
|
+
meet the following conditions:
|
|
84
|
+
|
|
85
|
+
(a) You must give any other recipients of the Work or Derivative
|
|
86
|
+
Works a copy of this License; and
|
|
87
|
+
|
|
88
|
+
(b) You must cause any modified files to carry prominent notices
|
|
89
|
+
stating that You changed the files; and
|
|
90
|
+
|
|
91
|
+
(c) You must retain, in all of the Source form of the Derivative
|
|
92
|
+
Works, all copyright, patent, trademark, and attribution
|
|
93
|
+
notices from the Source form of the Work, excluding those
|
|
94
|
+
notices that do not pertain to any part of the Derivative Works; and
|
|
95
|
+
|
|
96
|
+
(d) If the Work includes a "NOTICE" text file, as part of Your
|
|
97
|
+
distribution, You must include a readable copy of the attribution
|
|
98
|
+
notices contained within such NOTICE file, in all significant
|
|
99
|
+
locations in any Source or Object form you distribute, such as
|
|
100
|
+
part of the relevant documentation, or within a display generated
|
|
101
|
+
by the Executable, if and where such third-party notices normally
|
|
102
|
+
appear. The contents of the NOTICE file are for informational
|
|
103
|
+
purposes only and do not modify the License.
|
|
104
|
+
|
|
105
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
106
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
107
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
108
|
+
this License, without any additional terms or conditions.
|
|
109
|
+
|
|
110
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
111
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
112
|
+
except as required for reasonable and customary use in describing the
|
|
113
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
114
|
+
|
|
115
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
116
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
117
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
118
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
119
|
+
implied, including, without limitation, any warranties or conditions
|
|
120
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
121
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
122
|
+
appropriateness of using or reproducing the Work and assume any
|
|
123
|
+
risks associated with Your exercise of permissions under this License.
|
|
124
|
+
|
|
125
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
126
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
127
|
+
unless required by applicable law (such as deliberate and grossly
|
|
128
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
129
|
+
liable to You for damages, including any direct, indirect, special,
|
|
130
|
+
incidental, or exemplary damages of any character arising as a result
|
|
131
|
+
of this License or out of the use or inability to use the Work,
|
|
132
|
+
even if such Contributor has been advised of the possibility of such
|
|
133
|
+
damages.
|
|
134
|
+
|
|
135
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
136
|
+
the Work or Derivative Works thereof, You may choose to offer, and
|
|
137
|
+
charge a fee for, acceptance of support, warranty, indemnity, or
|
|
138
|
+
other liability obligations and/or rights consistent with this
|
|
139
|
+
License. However, in accepting such obligations, You may offer only
|
|
140
|
+
conditions consistent with this License.
|
|
141
|
+
|
|
142
|
+
END OF TERMS AND CONDITIONS
|
|
143
|
+
|
|
144
|
+
Copyright 2026 kub0-ai
|
|
145
|
+
|
|
146
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
147
|
+
you may not use this file except in compliance with the License.
|
|
148
|
+
You may obtain a copy of the License at
|
|
149
|
+
|
|
150
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
151
|
+
|
|
152
|
+
Unless required by applicable law or agreed to in writing, software
|
|
153
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
154
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
155
|
+
See the License for the specific language governing permissions and
|
|
156
|
+
limitations under the License.
|
|
@@ -0,0 +1,398 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: gaius-memory
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Ops memory lifecycle manager for AI coding agents
|
|
5
|
+
Author-email: Jay Kubo <jaykubo@outlook.com>
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://github.com/jkubo/gaius
|
|
8
|
+
Project-URL: Issues, https://github.com/jkubo/gaius/issues
|
|
9
|
+
Keywords: memory,ai,agents,claude-code,ops,knowledge-graph
|
|
10
|
+
Classifier: Development Status :: 4 - Beta
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
15
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
16
|
+
Classifier: Topic :: System :: Systems Administration
|
|
17
|
+
Requires-Python: >=3.11
|
|
18
|
+
Description-Content-Type: text/markdown
|
|
19
|
+
License-File: LICENSE
|
|
20
|
+
Requires-Dist: pyyaml>=6.0
|
|
21
|
+
Provides-Extra: semantic
|
|
22
|
+
Requires-Dist: sentence-transformers>=2.7; extra == "semantic"
|
|
23
|
+
Requires-Dist: sqlite-vec>=0.1; extra == "semantic"
|
|
24
|
+
Provides-Extra: mcp
|
|
25
|
+
Requires-Dist: mcp>=1.0; extra == "mcp"
|
|
26
|
+
Provides-Extra: all
|
|
27
|
+
Requires-Dist: gaius-memory[mcp,semantic]; extra == "all"
|
|
28
|
+
Provides-Extra: dev
|
|
29
|
+
Requires-Dist: pytest>=8.0; extra == "dev"
|
|
30
|
+
Dynamic: license-file
|
|
31
|
+
|
|
32
|
+
# gaius
|
|
33
|
+
|
|
34
|
+
**Ops memory lifecycle manager for AI coding agents.**
|
|
35
|
+
|
|
36
|
+
[](LICENSE)
|
|
37
|
+
[](https://github.com/jkubo/gaius)
|
|
38
|
+
|
|
39
|
+
Not another RAG chatbot memory — a production-grade system that extracts facts from Claude Code, Gemini CLI, Grok, and Codex sessions, ranks them into an inject-ready corpus, enforces behavioral gates, and prevents you from breaking prod at 3am.
|
|
40
|
+
|
|
41
|
+
> **Why gaius** — three things most agent-memory tools skip:
|
|
42
|
+
> - **Runs unattended** — extract → promote → inject with no human in the hot path; correction is optional.
|
|
43
|
+
> - **Prevents actions, not just recalls them** — hard gates `exit:2` on force-push, unconfirmed live-trade, prod-delete.
|
|
44
|
+
> - **Fully offline** — BM25 + sqlite-vec in one SQLite file. No API keys, no cloud.
|
|
45
|
+
|
|
46
|
+
> **Install from git** — the `gaius-memory` name on PyPI is not published yet. Do not `pip install gaius-memory` from PyPI.
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
# CLI (offline core). Extras: [semantic], [mcp], [http]
|
|
50
|
+
pip install "gaius-memory @ git+https://github.com/jkubo/gaius"
|
|
51
|
+
|
|
52
|
+
# Or with uv / Claude Code MCP (see .mcp.json):
|
|
53
|
+
# uvx --from "gaius-memory[mcp] @ git+https://github.com/jkubo/gaius" gaius-mcp
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
```
|
|
57
|
+
gaius retire # scan sessions → stage summaries
|
|
58
|
+
gaius batch # (optional) review + correct — facts inject by default
|
|
59
|
+
gaius inject # inject context into active session
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
## What It Does
|
|
65
|
+
|
|
66
|
+
Engineers running Claude Code all day generate enormous amounts of institutional knowledge that vanishes when the context window closes. gaius captures it:
|
|
67
|
+
|
|
68
|
+
1. **Extract** — scans Claude Code (and Gemini CLI) session JSONLs, extracts compact summaries with typed signals (knowledge, patterns, errors)
|
|
69
|
+
2. **Review (optional)** — extracted facts are promoted and inject-eligible by default; review is a *correction* loop, not a gate before entry. `reject` drops a bad fact, `defer` punts it, `agent-review` clears it from the queue without touching its rank, `confirm` pins a verified one — while decay, dedup, and mnemosyne health checks keep quality up without a human bottleneck.
|
|
70
|
+
3. **Index** — promotes extracted facts into a hybrid keyword + semantic SQLite database (`facts.db`)
|
|
71
|
+
4. **Inject** — at task start, retrieves relevant facts and loads skills context into the session
|
|
72
|
+
5. **Coordinate** — cross-session claims, shared findings, and a claimable task pool (`gaius concord`) so parallel sessions on one machine divide work instead of colliding
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
## Benchmark
|
|
77
|
+
|
|
78
|
+
The demo below is a **regression / smoke check, NOT a quality score**: it confirms retrieval still
|
|
79
|
+
works on a fresh clone. A perfect score on a hand-built 27-fact corpus (same author wrote the facts
|
|
80
|
+
and the queries) proves the pipeline runs, nothing more. Real quality is the **External evaluation**
|
|
81
|
+
section below, on a benchmark gaius didn't build.
|
|
82
|
+
|
|
83
|
+
`bench_inject.py` builds a throwaway SQLite corpus from `benchmarks/demo_corpus/`:
|
|
84
|
+
|
|
85
|
+
```
|
|
86
|
+
$ python3 benchmarks/bench_inject.py
|
|
87
|
+
|
|
88
|
+
gaius Injection Benchmark (25 queries, bundled demo corpus)
|
|
89
|
+
════════════════════════════════════════════════════════════
|
|
90
|
+
Recall: 25/25 (100%) regression check, NOT a quality score
|
|
91
|
+
Prec-warn: 3/25
|
|
92
|
+
Corpus: 27 demo facts (throwaway SQLite, no daemon, ~0.08s/query)
|
|
93
|
+
|
|
94
|
+
Semantic mode (embed daemon, real corpus):
|
|
95
|
+
Cold start: ~7s (first query, model load)
|
|
96
|
+
Daemon warm: ~8ms (Unix socket, model kept in memory)
|
|
97
|
+
|
|
98
|
+
Storage: sqlite-vec (384-dim, all-MiniLM-L6-v2) + BM25 in a single SQLite file
|
|
99
|
+
No API keys, no cloud, runs entirely offline.
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
## External evaluation (LongMemEval-S)
|
|
103
|
+
|
|
104
|
+
The demo above only proves the pipeline runs. For an *unbiased* measure, gaius's retrieval is scored on
|
|
105
|
+
[LongMemEval-S](https://github.com/xiaowu0162/LongMemEval) (ICLR 2025): a third-party benchmark whose
|
|
106
|
+
500 questions, ~48-session haystacks, and gold labels gaius has no hand in choosing (independent by
|
|
107
|
+
construction, not a self-graded demo). Reproducible: `python3 benchmarks/bench_longmemeval.py --matrix`.
|
|
108
|
+
|
|
109
|
+
Two metrics, not the same: **R@k** = per-question fractional recall (stricter; 65% of questions are
|
|
110
|
+
multi-gold); **hit@k** = recall_any@k ("at least one gold session in top-k"), the metric published
|
|
111
|
+
baselines report, so compare hit@k to those, not R@k.
|
|
112
|
+
|
|
113
|
+
gaius retrieval (all-MiniLM-L6-v2), 500 questions:
|
|
114
|
+
|
|
115
|
+
| config | MRR | R@5 | R@10 | hit@10 |
|
|
116
|
+
|--------|-----|-----|------|--------|
|
|
117
|
+
| session-semantic | 0.827 | 85.7 | 92.7 | 96.8 |
|
|
118
|
+
| turn-semantic | 0.906 | 92.8 | 96.6 | 98.8 |
|
|
119
|
+
| **turn-hybrid** (real inject path) | **0.912** | 92.8 | 95.2 | **98.6** |
|
|
120
|
+
|
|
121
|
+
On the matched metric (hit@k), gaius at its real regime (short-fact units + the hybrid inject ranking)
|
|
122
|
+
scores **hit@10 98.6%**, at par with published same-model (all-MiniLM-L6-v2) session-level retrieval
|
|
123
|
+
baselines (~96-99% recall_any@10; protocols differ; retrieval-only, not an end-to-end QA metric).
|
|
124
|
+
Larger embedding models beat all-MiniLM outright, a deliberate tradeoff for gaius's 384-dim, no-GPU,
|
|
125
|
+
fully-offline footprint. Weakest category: temporal-reasoning (~94% R@10 at turn-semantic).
|
|
126
|
+
|
|
127
|
+
This measures the retrieval engine. Whether *proactive injection* improves agent outcomes is a
|
|
128
|
+
separate evaluation (in progress), and is **not** claimed here.
|
|
129
|
+
|
|
130
|
+
**Chunked-embedding validation:** feeding gaius a whole long session and letting it chunk internally
|
|
131
|
+
recovers the recall naive whole-session embedding loses to the 256-token cap: chunk-granularity hit@10
|
|
132
|
+
**98.4%** vs naive whole-session **95.2%** on a matched 250-question subset, at the turn-level ceiling.
|
|
133
|
+
|
|
134
|
+
---
|
|
135
|
+
|
|
136
|
+
## What's Genuinely Novel
|
|
137
|
+
|
|
138
|
+
| Feature | Description |
|
|
139
|
+
|---------|-------------|
|
|
140
|
+
| **Review & correction loop** | `retire → stage → promote` runs unattended and facts inject by default; `reject`/`defer`/`confirm` plus decay, dedup, and mnemosyne health let you *correct* the corpus without a human in the hot path. |
|
|
141
|
+
| **Multi-agent corroboration** | Facts confirmed by multiple AI agents (Claude + Gemini) get a 1.5× score boost. Cross-model verification for higher confidence. |
|
|
142
|
+
| **Session-type behavioral priming** | Load different skill sets based on what you're doing: ops, trading, security, code review. |
|
|
143
|
+
| **Hard enforcement gates** | Memory that *prevents actions*. `exit:2` blocks force-push, live trading without confirmation, critical resource deletion. |
|
|
144
|
+
| **Mnemosyne health monitoring** | Automated memory bloat prevention. Line-count thresholds, misclassification audit, split/prune proposals. |
|
|
145
|
+
| **Live state injection** | Domain files with `kubectl`/`curl` commands in frontmatter, TTL-cached. Memory that knows what's happening right now. |
|
|
146
|
+
| **Hybrid sqlite-vec search** | Keyword TF-IDF/BM25 + semantic embeddings in a single SQLite file. |
|
|
147
|
+
| **Chunked embedding** | Long facts are split into <=256-token chunks, each embedded; retrieval max-pools over a fact's chunks, so long content isn't silently truncated to its first ~256 tokens. |
|
|
148
|
+
| **Temporal knowledge graph** | Entity-relationship triples with validity windows. `gaius kg timeline node` shows what changed and when. |
|
|
149
|
+
| **Obsidian-vault viewer** | The knowledge graph exports `[[wikilink]]` "Related" blocks into your memory files (`kg export-links`), so the corpus opens directly as an Obsidian vault — browse entities and their links visually, no extra tooling. |
|
|
150
|
+
| **Cross-session coordination** | `gaius concord` — advisory claims with TTL + pid-liveness, shared findings with an adversarial review loop, a claimable task pool, and a live roster. Parallel sessions get *ownership*: each can go deep on its lane instead of defensively re-checking the whole world. |
|
|
151
|
+
| **MCP server** | 7 tools for mid-session memory access without leaving Claude Code. |
|
|
152
|
+
|
|
153
|
+
---
|
|
154
|
+
|
|
155
|
+
## Quick Start
|
|
156
|
+
|
|
157
|
+
### Install
|
|
158
|
+
|
|
159
|
+
```bash
|
|
160
|
+
# Option 1: Claude Code plugin (recommended — wires the hooks, skill, and MCP server for you)
|
|
161
|
+
/plugin marketplace add jkubo/claude-plugins
|
|
162
|
+
/plugin install gaius@jkubo-tools
|
|
163
|
+
/reload-plugins
|
|
164
|
+
|
|
165
|
+
# Option 2: development install (editable, reads from repo)
|
|
166
|
+
git clone https://github.com/jkubo/gaius
|
|
167
|
+
cd gaius
|
|
168
|
+
pip install -e ".[semantic]" # includes sentence-transformers + sqlite-vec
|
|
169
|
+
|
|
170
|
+
# Option 3: script install (no pip, uses system/venv python)
|
|
171
|
+
install -m 755 gaius_cli ~/.local/bin/gaius
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
The plugin bundles the `gaius` skill, the MCP server, and three hooks: corpus
|
|
175
|
+
injection at session start, a mnemosyne health check after memory-file edits, and
|
|
176
|
+
an optional per-prompt injection (`GAIUS_PROMPT_INJECT=1`, off by default because it
|
|
177
|
+
bills tokens every turn). It needs [`uv`](https://docs.astral.sh/uv/) for the MCP
|
|
178
|
+
server, and it stays out of the way if you already run a standalone install — the
|
|
179
|
+
hooks yield to `~/.local/bin/gaius-*` wrappers rather than injecting the corpus twice
|
|
180
|
+
(`GAIUS_PLUGIN_HOOKS=force` overrides).
|
|
181
|
+
|
|
182
|
+
Token budgets are deliberately conservative (2000 corpus + 1500 skills per session);
|
|
183
|
+
raise with `GAIUS_INJECT_BUDGET` / `GAIUS_SKILLS_BUDGET`.
|
|
184
|
+
|
|
185
|
+
You still run `gaius init` once after installing — the plugin wires Claude Code, not
|
|
186
|
+
your corpus.
|
|
187
|
+
|
|
188
|
+
### Initialize
|
|
189
|
+
|
|
190
|
+
```bash
|
|
191
|
+
# Create config dir
|
|
192
|
+
mkdir -p ~/.gaius
|
|
193
|
+
|
|
194
|
+
# Copy example config
|
|
195
|
+
cp presets/k8s.yaml ~/.gaius/config.yaml # for K8s clusters
|
|
196
|
+
# or: cp presets/default.yaml ~/.gaius/config.yaml
|
|
197
|
+
|
|
198
|
+
# Edit to set your sessions_dir and domain_dir
|
|
199
|
+
$EDITOR ~/.gaius/config.yaml
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
### First Run
|
|
203
|
+
|
|
204
|
+
```bash
|
|
205
|
+
# Scan local sessions and stage summaries.
|
|
206
|
+
# Plain `retire` also auto-sweeps Grok (~/.grok/sessions) and Codex
|
|
207
|
+
# (~/.codex/sessions) when those CLI dirs exist; `--format <name>` scopes to one.
|
|
208
|
+
gaius retire
|
|
209
|
+
|
|
210
|
+
# Review staged summaries (optional — extracted facts already inject by default).
|
|
211
|
+
# Read each and, if you want, promote highlights into your domain/*.md files.
|
|
212
|
+
# Worth the loop for high-stakes domains (trading, prod ops) where a wrong fact is
|
|
213
|
+
# costly; skip it for low-stakes notes and let decay + dedup self-correct.
|
|
214
|
+
gaius batch # print all unreviewed in sequence
|
|
215
|
+
gaius next # print one at a time
|
|
216
|
+
gaius done <uuid> # mark a staged summary reviewed (queue hygiene, not an inject gate)
|
|
217
|
+
|
|
218
|
+
# Check corpus stats
|
|
219
|
+
gaius stats
|
|
220
|
+
|
|
221
|
+
# Inject context at session start
|
|
222
|
+
gaius inject --task "debug flannel networking" --budget 4000
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
### MCP Server (Claude Code)
|
|
226
|
+
|
|
227
|
+
```bash
|
|
228
|
+
# Register the MCP server in Claude Code
|
|
229
|
+
claude mcp add gaius -- python3 -m gaius.mcp_server
|
|
230
|
+
|
|
231
|
+
# Or if using the script install:
|
|
232
|
+
claude mcp add gaius -- /path/to/gaius/gaius/mcp_server.py
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
7 tools available mid-session: `gaius_search`, `gaius_kg_query`, `gaius_kg_timeline`, `gaius_stats`, `gaius_fact_add`, `gaius_prime_session`, `gaius_skill_recommend`.
|
|
236
|
+
|
|
237
|
+
---
|
|
238
|
+
|
|
239
|
+
## Cross-Session Coordination (concord)
|
|
240
|
+
|
|
241
|
+
**When to use:** more than one agent (or human + agent) on the same repo or incident at once — parallel sessions, a multi-responder incident, or a fan-out whose subtasks must not collide. Single-session work doesn't need it.
|
|
242
|
+
|
|
243
|
+
Run five Claude Code sessions against one repo and they will re-derive the same diagnosis
|
|
244
|
+
and overwrite each other's fixes. `gaius concord` is a local, offline-first coordination
|
|
245
|
+
sidecar (`~/.gaius/concord.db` — one SQLite file, no services) that gives parallel sessions:
|
|
246
|
+
|
|
247
|
+
- **Advisory claims** — atomic single-winner leases on shared resources
|
|
248
|
+
(`subsystem:storage`, `node:web-01`, `incident:IC`) with TTL + holder-pid liveness, so a
|
|
249
|
+
dead session can't squat a lease. Winning a claim retitles the terminal tab
|
|
250
|
+
(`⚑ storage · session-name`) — ownership visible at a glance. Near-miss naming
|
|
251
|
+
(`subsystem:db` vs `subsystem:db-migration`) surfaces as an overlap warning.
|
|
252
|
+
- **Findings** — discoveries published to sibling sessions, with an adversarial review
|
|
253
|
+
loop (`open → reviewing → confirmed/refuted`).
|
|
254
|
+
- **Task pool** — an incident commander seeds divided work once; each new session takes
|
|
255
|
+
the next task atomically.
|
|
256
|
+
- **Roster** — live sessions merged from Claude (`~/.claude/sessions/`) + Grok
|
|
257
|
+
(`~/.grok/active_sessions.json`) registries, joined with
|
|
258
|
+
the claims they hold.
|
|
259
|
+
|
|
260
|
+
```bash
|
|
261
|
+
gaius concord status # one-screen sitrep
|
|
262
|
+
gaius concord claim subsystem:db --note "schema migration"
|
|
263
|
+
gaius concord finding add --summary "replica lag is the root cause" --severity major
|
|
264
|
+
gaius concord task add "verify backups" --resource svc:backup
|
|
265
|
+
gaius concord task take # atomic — one winner per task
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
Claims are **advisory by design**: awareness is automated, action is never taken on a
|
|
269
|
+
peer's behalf — a sibling's message is an observation, not authorization. Hook wiring
|
|
270
|
+
(session-start briefs, per-prompt deltas, warn-on-conflicting-mutation, the kill-switch
|
|
271
|
+
pattern) is documented in [`docs/concord.md`](docs/concord.md). Zero configuration
|
|
272
|
+
required; an optional remote bridge (`gaius concord sync`) federates multiple machines
|
|
273
|
+
against any server implementing the same heartbeat/finding contract.
|
|
274
|
+
|
|
275
|
+
---
|
|
276
|
+
|
|
277
|
+
## Architecture
|
|
278
|
+
|
|
279
|
+
```
|
|
280
|
+
gaius/
|
|
281
|
+
├── gaius/
|
|
282
|
+
│ ├── _core.py # core logic (extraction, search, inject, dedup, decay)
|
|
283
|
+
│ ├── concord.py # cross-session coordination (claims / findings / task pool)
|
|
284
|
+
│ ├── kg.py # temporal knowledge-graph commands
|
|
285
|
+
│ ├── parsers.py # session / domain-file parsers
|
|
286
|
+
│ ├── record.py # session recorder (OpenAI-compatible endpoints)
|
|
287
|
+
│ ├── telemetry.py # prompt / injection event logging
|
|
288
|
+
│ ├── mcp_server.py # MCP server (7 tools)
|
|
289
|
+
│ ├── __init__.py # Public API surface
|
|
290
|
+
│ └── __main__.py # python -m gaius
|
|
291
|
+
├── http_adapter.py # FastAPI REST adapter (optional, for remote access)
|
|
292
|
+
├── presets/
|
|
293
|
+
│ ├── k8s.yaml # Entity patterns for Kubernetes clusters
|
|
294
|
+
│ └── default.yaml # Minimal defaults for any project
|
|
295
|
+
├── benchmarks/
|
|
296
|
+
│ ├── bench_inject.py # injection regression check (bundled demo corpus)
|
|
297
|
+
│ ├── bench_longmemeval.py # LongMemEval-S external retrieval eval (--matrix)
|
|
298
|
+
│ └── bench_retrieval.py # legacy Recall@k/MRR harness (not for public numbers)
|
|
299
|
+
├── tests/
|
|
300
|
+
│ └── *.py # unit + integration suites (test_core.py, ...)
|
|
301
|
+
├── pyproject.toml
|
|
302
|
+
└── LICENSE # Apache 2.0
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
**Storage**: single `~/.gaius/facts.db` SQLite file — facts table with BM25 virtual table + sqlite-vec embedding index. No external services required.
|
|
306
|
+
|
|
307
|
+
**Embed daemon**: optional systemd user service (`gaius-embed-daemon`) keeps `all-MiniLM-L6-v2` loaded in memory (~8ms/query warm vs ~7s cold).
|
|
308
|
+
|
|
309
|
+
---
|
|
310
|
+
|
|
311
|
+
## Configuration
|
|
312
|
+
|
|
313
|
+
Config file: `~/.gaius/config.yaml`
|
|
314
|
+
|
|
315
|
+
```yaml
|
|
316
|
+
# Sessions directory (Claude Code project JSONLs)
|
|
317
|
+
sessions_dir: ~/.claude/projects
|
|
318
|
+
|
|
319
|
+
# Domain memory directory (your *.md knowledge files)
|
|
320
|
+
domain_dir: ~/my-memory/domain
|
|
321
|
+
|
|
322
|
+
# Skills directory (prospective how-to guides)
|
|
323
|
+
skills_dir: ~/my-memory/skills
|
|
324
|
+
|
|
325
|
+
# Principal mapping — agents grouped for cross-agent scoring
|
|
326
|
+
principals:
|
|
327
|
+
default: operator
|
|
328
|
+
|
|
329
|
+
# Entity extraction — extend the built-in K8s baseline
|
|
330
|
+
entities:
|
|
331
|
+
preset: k8s # use built-in K8s patterns; set to "none" to disable
|
|
332
|
+
patterns:
|
|
333
|
+
service: '\b(?:my-api|my-worker|my-scheduler)\b'
|
|
334
|
+
namespace: '\b(?:prod|staging|dev)\b'
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
See `presets/k8s.yaml` for a full annotated example.
|
|
338
|
+
|
|
339
|
+
---
|
|
340
|
+
|
|
341
|
+
## Commands
|
|
342
|
+
|
|
343
|
+
| Command | Description |
|
|
344
|
+
|---------|-------------|
|
|
345
|
+
| `gaius retire` | Scan local sessions → stage new summaries (auto-sweeps Claude/Grok/Codex; `--format` to scope) |
|
|
346
|
+
| `gaius record` | Capture chat sessions into gaius JSONL (vLLM, any OpenAI-compatible endpoint) |
|
|
347
|
+
| `gaius s3-retire <agent>` | Retire from S3-archived agent sessions (rclone) |
|
|
348
|
+
| `gaius harvest` | Scan cold Gemini CLI sessions (`.json` format) |
|
|
349
|
+
| `gaius grok-retire` | Scan Grok CLI sessions (`~/.grok/sessions/`) → stage decision events |
|
|
350
|
+
| `gaius codex-retire` | Scan Codex CLI rollouts (`~/.codex/sessions/`) → stage decision events |
|
|
351
|
+
| `gaius next` | Print oldest unreviewed summary |
|
|
352
|
+
| `gaius batch` | Print all unreviewed summaries in sequence |
|
|
353
|
+
| `gaius done <uuid>` | Mark summary as reviewed |
|
|
354
|
+
| `gaius confirm` / `reject` / `defer <fact-id>` | Review-loop verdict on a pending fact (confirm → human/confidence=1.0; reject → excluded from inject; defer → re-surface in 7 days) |
|
|
355
|
+
| `gaius agent-review <fact-id>` | Mark a pending fact machine-reviewed — queue hygiene only; weighted ≤ auto, never boosts inject rank |
|
|
356
|
+
| `gaius rescan <uuid>` | Force re-extraction of a specific staged session |
|
|
357
|
+
| `gaius show` | List all staged summaries |
|
|
358
|
+
| `gaius stats` | Extraction and corpus statistics |
|
|
359
|
+
| `gaius inject` | Inject ranked corpus + skills into active session |
|
|
360
|
+
| `gaius kg query <entity>` | Query knowledge graph for an entity |
|
|
361
|
+
| `gaius kg timeline <entity>` | Show temporal changes for an entity |
|
|
362
|
+
| `gaius governor` | Cross-agent knowledge gap analysis |
|
|
363
|
+
| `gaius embed` | Build/rebuild semantic embedding index |
|
|
364
|
+
| `gaius index` | Rebuild memory index |
|
|
365
|
+
| `gaius landscape` | Show memory system landscape |
|
|
366
|
+
| `gaius skills` | List available skills with scores |
|
|
367
|
+
| `gaius concord <sub>` | Cross-session coordination — claims / findings / task pool (see below) |
|
|
368
|
+
| `gaius recent-roll` | Evict aged, done, pointered `## Recent State` bullets from MEMORY.md into a non-injected archive changelog |
|
|
369
|
+
| `gaius reconcile` | Promote curated repo-doc facts into the corpus (flagged-unverified, insert-once) + dev↔mirror divergence sentinel |
|
|
370
|
+
| `gaius drift` | Check canonical cluster facts for cross-agent drift against a registry |
|
|
371
|
+
| `gaius decay` | Apply time-based score decay to all facts |
|
|
372
|
+
| `gaius completion <shell>` | Emit a shell completion script (`bash`/`zsh`/`fish`) for command names + global flags |
|
|
373
|
+
|
|
374
|
+
> This table is a highlights subset — run `gaius --help` for the full command list.
|
|
375
|
+
|
|
376
|
+
---
|
|
377
|
+
|
|
378
|
+
## Dependencies
|
|
379
|
+
|
|
380
|
+
**Core** (no extras): `pyyaml>=6.0` — pure Python, no binary deps.
|
|
381
|
+
|
|
382
|
+
**Semantic search** (`pip install "gaius-memory[semantic] @ git+https://github.com/jkubo/gaius"`):
|
|
383
|
+
- `sentence-transformers>=2.7` — local embedding model (`all-MiniLM-L6-v2`, 384-dim)
|
|
384
|
+
- `sqlite-vec>=0.1` — vector search extension for SQLite
|
|
385
|
+
|
|
386
|
+
**MCP server** (`pip install "gaius-memory[mcp] @ git+https://github.com/jkubo/gaius"`):
|
|
387
|
+
- `mcp[server]>=1.0`
|
|
388
|
+
|
|
389
|
+
**HTTP adapter** (`pip install "gaius-memory[http] @ git+https://github.com/jkubo/gaius"`):
|
|
390
|
+
- `fastapi>=0.100`, `uvicorn[standard]>=0.23`
|
|
391
|
+
|
|
392
|
+
Without `[semantic]`, gaius falls back to keyword-only BM25 search (no embeddings required).
|
|
393
|
+
|
|
394
|
+
---
|
|
395
|
+
|
|
396
|
+
## License
|
|
397
|
+
|
|
398
|
+
Apache 2.0 — see [LICENSE](LICENSE).
|