lerim 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.
- lerim-0.1.0/LICENSE +70 -0
- lerim-0.1.0/PKG-INFO +369 -0
- lerim-0.1.0/README.md +330 -0
- lerim-0.1.0/pyproject.toml +79 -0
- lerim-0.1.0/setup.cfg +4 -0
- lerim-0.1.0/src/lerim/__init__.py +17 -0
- lerim-0.1.0/src/lerim/__main__.py +5 -0
- lerim-0.1.0/src/lerim/adapters/__init__.py +29 -0
- lerim-0.1.0/src/lerim/adapters/base.py +95 -0
- lerim-0.1.0/src/lerim/adapters/claude.py +237 -0
- lerim-0.1.0/src/lerim/adapters/codex.py +236 -0
- lerim-0.1.0/src/lerim/adapters/common.py +117 -0
- lerim-0.1.0/src/lerim/adapters/cursor.py +424 -0
- lerim-0.1.0/src/lerim/adapters/opencode.py +476 -0
- lerim-0.1.0/src/lerim/adapters/registry.py +188 -0
- lerim-0.1.0/src/lerim/app/__init__.py +7 -0
- lerim-0.1.0/src/lerim/app/arg_utils.py +48 -0
- lerim-0.1.0/src/lerim/app/cli.py +903 -0
- lerim-0.1.0/src/lerim/app/daemon.py +618 -0
- lerim-0.1.0/src/lerim/app/dashboard.py +1335 -0
- lerim-0.1.0/src/lerim/config/__init__.py +6 -0
- lerim-0.1.0/src/lerim/config/default.toml +92 -0
- lerim-0.1.0/src/lerim/config/logging.py +95 -0
- lerim-0.1.0/src/lerim/config/project_scope.py +80 -0
- lerim-0.1.0/src/lerim/config/settings.py +617 -0
- lerim-0.1.0/src/lerim/config/tracing.py +42 -0
- lerim-0.1.0/src/lerim/memory/__init__.py +21 -0
- lerim-0.1.0/src/lerim/memory/access_tracker.py +156 -0
- lerim-0.1.0/src/lerim/memory/extract_pipeline.py +277 -0
- lerim-0.1.0/src/lerim/memory/memory_record.py +182 -0
- lerim-0.1.0/src/lerim/memory/memory_repo.py +102 -0
- lerim-0.1.0/src/lerim/memory/schemas.py +44 -0
- lerim-0.1.0/src/lerim/memory/summarization_pipeline.py +307 -0
- lerim-0.1.0/src/lerim/memory/utils.py +63 -0
- lerim-0.1.0/src/lerim/runtime/__init__.py +28 -0
- lerim-0.1.0/src/lerim/runtime/agent.py +741 -0
- lerim-0.1.0/src/lerim/runtime/contracts.py +54 -0
- lerim-0.1.0/src/lerim/runtime/prompts/__init__.py +13 -0
- lerim-0.1.0/src/lerim/runtime/prompts/chat.py +114 -0
- lerim-0.1.0/src/lerim/runtime/prompts/maintain.py +189 -0
- lerim-0.1.0/src/lerim/runtime/prompts/sync.py +115 -0
- lerim-0.1.0/src/lerim/runtime/prompts/system.py +23 -0
- lerim-0.1.0/src/lerim/runtime/providers.py +283 -0
- lerim-0.1.0/src/lerim/runtime/subagents.py +101 -0
- lerim-0.1.0/src/lerim/runtime/tools.py +692 -0
- lerim-0.1.0/src/lerim/sessions/__init__.py +45 -0
- lerim-0.1.0/src/lerim/sessions/catalog.py +1019 -0
- lerim-0.1.0/src/lerim/sessions/queue.py +27 -0
- lerim-0.1.0/src/lerim.egg-info/PKG-INFO +369 -0
- lerim-0.1.0/src/lerim.egg-info/SOURCES.txt +104 -0
- lerim-0.1.0/src/lerim.egg-info/dependency_links.txt +1 -0
- lerim-0.1.0/src/lerim.egg-info/entry_points.txt +2 -0
- lerim-0.1.0/src/lerim.egg-info/requires.txt +32 -0
- lerim-0.1.0/src/lerim.egg-info/top_level.txt +1 -0
- lerim-0.1.0/tests/test_adapter_common.py +97 -0
- lerim-0.1.0/tests/test_adapter_registry.py +121 -0
- lerim-0.1.0/tests/test_agent_memory_write_flow.py +157 -0
- lerim-0.1.0/tests/test_agent_memory_write_integration.py +124 -0
- lerim-0.1.0/tests/test_agent_memory_write_modes_e2e.py +117 -0
- lerim-0.1.0/tests/test_arg_utils.py +68 -0
- lerim-0.1.0/tests/test_catalog_queries.py +214 -0
- lerim-0.1.0/tests/test_claude_adapter.py +283 -0
- lerim-0.1.0/tests/test_cli.py +231 -0
- lerim-0.1.0/tests/test_codex_adapter.py +180 -0
- lerim-0.1.0/tests/test_config.py +154 -0
- lerim-0.1.0/tests/test_context_layers_e2e.py +43 -0
- lerim-0.1.0/tests/test_cursor_adapter.py +301 -0
- lerim-0.1.0/tests/test_daemon_sync_maintain.py +137 -0
- lerim-0.1.0/tests/test_dashboard_api.py +181 -0
- lerim-0.1.0/tests/test_dashboard_read_only_contract.py +16 -0
- lerim-0.1.0/tests/test_dashboard_visual_polish.py +32 -0
- lerim-0.1.0/tests/test_e2e_full_cycle.py +51 -0
- lerim-0.1.0/tests/test_e2e_maintain.py +48 -0
- lerim-0.1.0/tests/test_e2e_real.py +97 -0
- lerim-0.1.0/tests/test_e2e_sync.py +65 -0
- lerim-0.1.0/tests/test_extract_lead_authority.py +43 -0
- lerim-0.1.0/tests/test_extract_parser_boundary.py +19 -0
- lerim-0.1.0/tests/test_fts.py +61 -0
- lerim-0.1.0/tests/test_graph_explorer_frontend.py +144 -0
- lerim-0.1.0/tests/test_index_html.py +285 -0
- lerim-0.1.0/tests/test_indexer_platform_paths.py +172 -0
- lerim-0.1.0/tests/test_integration_agent.py +40 -0
- lerim-0.1.0/tests/test_integration_extract.py +70 -0
- lerim-0.1.0/tests/test_integration_providers.py +40 -0
- lerim-0.1.0/tests/test_integration_summarize.py +72 -0
- lerim-0.1.0/tests/test_learning_runs.py +104 -0
- lerim-0.1.0/tests/test_logging.py +58 -0
- lerim-0.1.0/tests/test_maintain_command.py +12 -0
- lerim-0.1.0/tests/test_memory_decay.py +244 -0
- lerim-0.1.0/tests/test_memory_layout.py +39 -0
- lerim-0.1.0/tests/test_memory_record.py +142 -0
- lerim-0.1.0/tests/test_memory_schemas.py +91 -0
- lerim-0.1.0/tests/test_memory_search_toggles.py +38 -0
- lerim-0.1.0/tests/test_opencode_adapter.py +233 -0
- lerim-0.1.0/tests/test_project_scope.py +83 -0
- lerim-0.1.0/tests/test_providers.py +163 -0
- lerim-0.1.0/tests/test_regression_contracts.py +92 -0
- lerim-0.1.0/tests/test_runtime_agent_contract.py +181 -0
- lerim-0.1.0/tests/test_runtime_tools.py +328 -0
- lerim-0.1.0/tests/test_session_extract_writeback.py +64 -0
- lerim-0.1.0/tests/test_skills.py +51 -0
- lerim-0.1.0/tests/test_smoke_agent.py +35 -0
- lerim-0.1.0/tests/test_smoke_pipelines.py +68 -0
- lerim-0.1.0/tests/test_subagents.py +41 -0
- lerim-0.1.0/tests/test_summary_write.py +82 -0
- lerim-0.1.0/tests/test_trace_summarization_pipeline.py +71 -0
lerim-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
Business Source License 1.1
|
|
2
|
+
|
|
3
|
+
Parameters
|
|
4
|
+
|
|
5
|
+
Licensor: Isaac Kargar
|
|
6
|
+
Licensed Work: Lerim
|
|
7
|
+
The Licensed Work is (c) 2026 Isaac Kargar.
|
|
8
|
+
Additional Use Grant: You may make production use of the Licensed Work,
|
|
9
|
+
provided such use does not include more than a single
|
|
10
|
+
individual user. Use by more than one individual, or
|
|
11
|
+
use to provide the Licensed Work to third parties as a
|
|
12
|
+
hosted or managed service, requires a separate commercial
|
|
13
|
+
license from the Licensor.
|
|
14
|
+
Change Date: Four years from the date of each release of the
|
|
15
|
+
Licensed Work.
|
|
16
|
+
Change License: Apache License, Version 2.0
|
|
17
|
+
|
|
18
|
+
For information about alternative licensing arrangements for the Licensed Work,
|
|
19
|
+
please contact: isaac@lerim.dev
|
|
20
|
+
|
|
21
|
+
Notice
|
|
22
|
+
|
|
23
|
+
The Business Source License (this document, or the "License") is not an Open
|
|
24
|
+
Source license. However, the Licensed Work will eventually be made available
|
|
25
|
+
under an Open Source License, as stated in this License.
|
|
26
|
+
|
|
27
|
+
License text copyright (c) 2017 MariaDB Corporation Ab, All Rights Reserved.
|
|
28
|
+
"Business Source License" is a trademark of MariaDB Corporation Ab.
|
|
29
|
+
|
|
30
|
+
Terms
|
|
31
|
+
|
|
32
|
+
The Licensor hereby grants you the right to copy, modify, create derivative
|
|
33
|
+
works, redistribute, and make non-production use of the Licensed Work. The
|
|
34
|
+
Licensor may make an Additional Use Grant, above, permitting limited
|
|
35
|
+
production use.
|
|
36
|
+
|
|
37
|
+
Effective on the Change Date, or the fourth anniversary of the first publicly
|
|
38
|
+
available distribution of a specific version of the Licensed Work under this
|
|
39
|
+
License, whichever comes first, the Licensor hereby grants you rights under
|
|
40
|
+
the terms of the Change License, and the rights granted in the paragraph
|
|
41
|
+
above terminate.
|
|
42
|
+
|
|
43
|
+
If your use of the Licensed Work does not comply with the requirements
|
|
44
|
+
currently in effect as described in this License, you must purchase a
|
|
45
|
+
commercial license from the Licensor, its affiliated entities, or authorized
|
|
46
|
+
resellers, or you must refrain from using the Licensed Work.
|
|
47
|
+
|
|
48
|
+
All copies of the original and modified Licensed Work, and derivative works
|
|
49
|
+
of the Licensed Work, are subject to this License. This License applies
|
|
50
|
+
separately for each version of the Licensed Work and the Change Date may vary
|
|
51
|
+
for each version of the Licensed Work released by Licensor.
|
|
52
|
+
|
|
53
|
+
You must conspicuously display this License on each original or modified copy
|
|
54
|
+
of the Licensed Work. If you receive the Licensed Work in original or
|
|
55
|
+
modified form from a third party, the terms and conditions set forth in this
|
|
56
|
+
License apply to your use of that work.
|
|
57
|
+
|
|
58
|
+
Any use of the Licensed Work in violation of this License will automatically
|
|
59
|
+
terminate your rights under this License for the current and all other
|
|
60
|
+
versions of the Licensed Work.
|
|
61
|
+
|
|
62
|
+
This License does not grant you any right in any trademark or logo of
|
|
63
|
+
Licensor or its affiliates (provided that you may use a trademark or logo of
|
|
64
|
+
Licensor as expressly required by this License).
|
|
65
|
+
|
|
66
|
+
TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON
|
|
67
|
+
AN "AS IS" BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS,
|
|
68
|
+
EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF
|
|
69
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND
|
|
70
|
+
TITLE.
|
lerim-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,369 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: lerim
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Continual learning layer for coding agents and software projects.
|
|
5
|
+
License: BSL-1.1
|
|
6
|
+
Project-URL: Homepage, https://lerim.dev
|
|
7
|
+
Project-URL: Documentation, https://docs.lerim.dev
|
|
8
|
+
Project-URL: Repository, https://github.com/lerim-dev/lerim-cli
|
|
9
|
+
Project-URL: Changelog, https://github.com/lerim-dev/lerim-cli/blob/main/CHANGELOG.md
|
|
10
|
+
Project-URL: Issues, https://github.com/lerim-dev/lerim-cli/issues
|
|
11
|
+
Requires-Python: >=3.10
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
License-File: LICENSE
|
|
14
|
+
Requires-Dist: pydantic>=2.0
|
|
15
|
+
Requires-Dist: eval_type_backport>=0.2.0; python_version < "3.13"
|
|
16
|
+
Requires-Dist: tomli>=2.0; python_version < "3.11"
|
|
17
|
+
Requires-Dist: python-dotenv>=1.2.1
|
|
18
|
+
Requires-Dist: PyYAML>=6.0
|
|
19
|
+
Requires-Dist: loguru>=0.7.3
|
|
20
|
+
Requires-Dist: dspy>=3.1.3
|
|
21
|
+
Requires-Dist: python-frontmatter>=1.1.0
|
|
22
|
+
Requires-Dist: openrouter>=0.6.0
|
|
23
|
+
Requires-Dist: pydantic-ai>=1.61.0
|
|
24
|
+
Requires-Dist: logfire>=4.25.0
|
|
25
|
+
Provides-Extra: embeddings
|
|
26
|
+
Requires-Dist: lancedb>=0.27.1; extra == "embeddings"
|
|
27
|
+
Requires-Dist: pyarrow>=15.0.0; extra == "embeddings"
|
|
28
|
+
Requires-Dist: torch>=2.2; extra == "embeddings"
|
|
29
|
+
Requires-Dist: transformers<5,>=4.44.2; extra == "embeddings"
|
|
30
|
+
Provides-Extra: test
|
|
31
|
+
Requires-Dist: pytest>=8.0; extra == "test"
|
|
32
|
+
Requires-Dist: pytest-asyncio>=0.24; extra == "test"
|
|
33
|
+
Provides-Extra: lint
|
|
34
|
+
Requires-Dist: ruff>=0.15.0; extra == "lint"
|
|
35
|
+
Provides-Extra: docs
|
|
36
|
+
Requires-Dist: mkdocs-material>=9.6; extra == "docs"
|
|
37
|
+
Requires-Dist: mkdocstrings[python]>=0.27; extra == "docs"
|
|
38
|
+
Dynamic: license-file
|
|
39
|
+
|
|
40
|
+
<p align="center">
|
|
41
|
+
<img src="assets/lerim.png" alt="Lerim Logo" width="160">
|
|
42
|
+
</p>
|
|
43
|
+
|
|
44
|
+
<p align="center"><strong>Continual learning layer for coding agents</strong></p>
|
|
45
|
+
<p align="center"><a href="https://lerim.dev/">lerim.dev</a></p>
|
|
46
|
+
|
|
47
|
+
<p align="center">
|
|
48
|
+
<img src="assets/agent-network.gif" alt="Lerim network animation" width="450">
|
|
49
|
+
</p>
|
|
50
|
+
|
|
51
|
+
Lerim is a continual learning layer that gives coding agents persistent memory across sessions. It watches your agent conversations (Claude Code, Codex, Cursor, OpenCode, ...), extracts decisions and learnings, and stores them as plain markdown files that both humans and agents can read. Memories are refined offline over time through merging, deduplication, archiving, and decay-based forgetting. You can query stored memories anytime to bring relevant past context into your current session.
|
|
52
|
+
|
|
53
|
+
## Summary
|
|
54
|
+
|
|
55
|
+
Lerim is file-first and primitive-first.
|
|
56
|
+
|
|
57
|
+
- Primitive folders: `decisions`, `learnings`, `summaries`
|
|
58
|
+
- Project memory first: `<repo>/.lerim/`
|
|
59
|
+
- Global fallback memory: `~/.lerim/`
|
|
60
|
+
- Search default: `files` (no index required)
|
|
61
|
+
- Orchestration runtime: `pydantic-ai` lead agent + read-only explorer subagent
|
|
62
|
+
- Extraction/summarization: `dspy.RLM` role-configured models (default OpenRouter `x-ai/grok-4.1-fast`)
|
|
63
|
+
- Graph source of truth: explicit id/slug references (and `related` when present)
|
|
64
|
+
|
|
65
|
+
This keeps memory readable by humans and easy for agents to traverse.
|
|
66
|
+
|
|
67
|
+
Lead flow:
|
|
68
|
+
|
|
69
|
+
1. Extract candidates from transcript archive.
|
|
70
|
+
2. Lead agent orchestrates with runtime tools and delegates a read-only explorer subagent.
|
|
71
|
+
3. Lead runs deterministic decision policy for `add|update|no-op`.
|
|
72
|
+
4. Lead writes memory only through boundary-enforced runtime write/edit tools.
|
|
73
|
+
5. `sync` stays lightweight; `maintain` runs offline memory refinement (merge duplicates, archive low-value entries, consolidate related memories, apply time-based decay).
|
|
74
|
+
|
|
75
|
+
### Sync path
|
|
76
|
+
|
|
77
|
+
<p align="center">
|
|
78
|
+
<img src="assets/sync.png" alt="Sync path" width="700">
|
|
79
|
+
</p>
|
|
80
|
+
|
|
81
|
+
The sync path processes new agent sessions: reads transcript archives, extracts decision and learning candidates via DSPy, deduplicates against existing memories, and writes new primitives to the memory folder.
|
|
82
|
+
|
|
83
|
+
### Maintain path
|
|
84
|
+
|
|
85
|
+
<p align="center">
|
|
86
|
+
<img src="assets/maintain.png" alt="Maintain path" width="700">
|
|
87
|
+
</p>
|
|
88
|
+
|
|
89
|
+
The maintain path runs offline refinement over stored memories: merges duplicates, archives low-value entries, consolidates related memories, and applies time-based decay to keep the memory store clean and relevant.
|
|
90
|
+
|
|
91
|
+
## Quick start
|
|
92
|
+
|
|
93
|
+
### 1. Install
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
pip install lerim
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
Lerim's extraction pipeline requires [Deno](https://deno.land/):
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
brew install deno
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### 2. Connect your agent platforms and start the learning loop
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
lerim connect auto # detect Claude Code, Codex, Cursor, OpenCode sessions
|
|
109
|
+
lerim daemon # sync sessions + maintain memories in a continuous loop
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
That's it. Lerim now watches your sessions, extracts decisions and learnings, and refines them over time.
|
|
113
|
+
|
|
114
|
+
### 3. Teach your agent about Lerim
|
|
115
|
+
|
|
116
|
+
Install the Lerim skill so your agent knows how to query past context:
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
npx skills add lerim-dev/lerim-cli
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
This works with Claude Code, Codex, Cursor, Copilot, Cline, Windsurf, OpenCode, and [other agents that support skills](https://skills-ai.dev).
|
|
123
|
+
|
|
124
|
+
### 4. Get the most out of Lerim
|
|
125
|
+
|
|
126
|
+
At the start of a session, tell your agent:
|
|
127
|
+
|
|
128
|
+
> Check lerim for any relevant memories about [topic you're working on].
|
|
129
|
+
|
|
130
|
+
Your agent will run `lerim chat` or `lerim memory search` to pull in past decisions and learnings before it starts working.
|
|
131
|
+
|
|
132
|
+
## Dashboard
|
|
133
|
+
|
|
134
|
+
The dashboard gives you a local UI for session analytics, memory browsing, and runtime status.
|
|
135
|
+
|
|
136
|
+
<p align="center">
|
|
137
|
+
<img src="assets/dashboard.png" alt="Lerim dashboard" width="1100">
|
|
138
|
+
</p>
|
|
139
|
+
|
|
140
|
+
### Run it locally
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
# simple
|
|
144
|
+
lerim dashboard
|
|
145
|
+
|
|
146
|
+
# explicit host/port
|
|
147
|
+
python -m lerim dashboard --host 127.0.0.1 --port 8765
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
Then open `http://127.0.0.1:8765`.
|
|
151
|
+
|
|
152
|
+
### Tabs
|
|
153
|
+
|
|
154
|
+
- **Overview**: high-level metrics and charts (sessions, messages, tools, errors, tokens, activity by day/hour, model usage).
|
|
155
|
+
- **Runs**: searchable session list (50/page) with status and metadata; open any run in a full-screen chat viewer.
|
|
156
|
+
- **Memories**: library + editor for memory records (filter, inspect, edit title/body/kind/confidence/tags).
|
|
157
|
+
- **Pipeline**: sync/maintain status, extraction queue state, and latest extraction report.
|
|
158
|
+
- **Settings**: dashboard-editable config for server, model roles, and tracing; saves to `~/.lerim/config.toml`.
|
|
159
|
+
|
|
160
|
+
### Notes
|
|
161
|
+
|
|
162
|
+
- Top bar filters (`Agent`, `Scope`) update dashboard metrics and run listings.
|
|
163
|
+
- Graph Explorer code is kept in the project but currently hidden in the UI.
|
|
164
|
+
|
|
165
|
+
## CLI reference
|
|
166
|
+
|
|
167
|
+
Full command reference: [`skills/lerim/cli-reference.md`](skills/lerim/cli-reference.md)
|
|
168
|
+
|
|
169
|
+
```bash
|
|
170
|
+
lerim connect auto # detect and connect platforms
|
|
171
|
+
lerim sync # one-shot: sync sessions + extract
|
|
172
|
+
lerim maintain # one-shot: merge, archive, decay
|
|
173
|
+
lerim daemon # continuous sync + maintain loop
|
|
174
|
+
lerim chat "Why did we choose this?" # query memories
|
|
175
|
+
lerim memory search "auth pattern" # keyword search
|
|
176
|
+
lerim memory list # list all memories
|
|
177
|
+
lerim memory add --title "..." --body "..." # manual memory
|
|
178
|
+
lerim memory reset --scope both --yes # wipe and start fresh
|
|
179
|
+
lerim dashboard # local web UI
|
|
180
|
+
lerim status # runtime state
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
### Development
|
|
184
|
+
|
|
185
|
+
```bash
|
|
186
|
+
uv venv && source .venv/bin/activate
|
|
187
|
+
uv pip install -e .
|
|
188
|
+
tests/run_tests.sh unit
|
|
189
|
+
tests/run_tests.sh all
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
### Configuration
|
|
193
|
+
|
|
194
|
+
TOML-layered config (low to high priority):
|
|
195
|
+
|
|
196
|
+
1. `src/lerim/config/default.toml` (shipped with package -- all defaults)
|
|
197
|
+
2. `~/.lerim/config.toml` (user global)
|
|
198
|
+
3. `<repo>/.lerim/config.toml` (project overrides)
|
|
199
|
+
4. `LERIM_CONFIG` env var path (explicit override, for CI/tests)
|
|
200
|
+
|
|
201
|
+
API keys come from environment variables only (`ZAI_API_KEY`, `OPENROUTER_API_KEY`, `OPENAI_API_KEY`, optional `ANTHROPIC_API_KEY`).
|
|
202
|
+
|
|
203
|
+
Default role model config (from `src/lerim/config/default.toml`):
|
|
204
|
+
|
|
205
|
+
- `lead`: `provider=openrouter`, `model=x-ai/grok-4.1-fast`
|
|
206
|
+
- `explorer`: `provider=openrouter`, `model=x-ai/grok-4.1-fast`
|
|
207
|
+
- `extract`: `provider=openrouter`, `model=x-ai/grok-4.1-fast`, `sub_model=x-ai/grok-4.1-fast`
|
|
208
|
+
- `summarize`: `provider=openrouter`, `model=x-ai/grok-4.1-fast`, `sub_model=x-ai/grok-4.1-fast`
|
|
209
|
+
|
|
210
|
+
### Tracing (OpenTelemetry)
|
|
211
|
+
|
|
212
|
+
Lerim uses PydanticAI's built-in OpenTelemetry instrumentation for agent observability.
|
|
213
|
+
Stderr logs are kept minimal; detailed traces (model calls, tool calls, tokens, timing)
|
|
214
|
+
go through OTel spans instead.
|
|
215
|
+
|
|
216
|
+
One-time setup:
|
|
217
|
+
|
|
218
|
+
```bash
|
|
219
|
+
uv pip install logfire
|
|
220
|
+
logfire auth
|
|
221
|
+
logfire projects new
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
Enable tracing:
|
|
225
|
+
|
|
226
|
+
```bash
|
|
227
|
+
# env var (quick toggle)
|
|
228
|
+
LERIM_TRACING=1 lerim sync
|
|
229
|
+
|
|
230
|
+
# or in config
|
|
231
|
+
# .lerim/config.toml
|
|
232
|
+
[tracing]
|
|
233
|
+
enabled = true
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
View traces at https://logfire.pydantic.dev.
|
|
237
|
+
|
|
238
|
+
Config options (`[tracing]` in TOML):
|
|
239
|
+
|
|
240
|
+
| Key | Default | Description |
|
|
241
|
+
|-----|---------|-------------|
|
|
242
|
+
| `enabled` | `false` | Enable tracing (or set `LERIM_TRACING=1`) |
|
|
243
|
+
| `include_httpx` | `false` | Capture raw HTTP request/response bodies |
|
|
244
|
+
| `include_content` | `true` | Include prompt/completion text in spans |
|
|
245
|
+
|
|
246
|
+
### Connecting coding agents
|
|
247
|
+
|
|
248
|
+
Lerim ingests session transcripts from your coding agents to extract decisions and learnings. The `lerim connect` command registers an agent platform so Lerim knows where to find its sessions.
|
|
249
|
+
|
|
250
|
+
#### Supported agents
|
|
251
|
+
|
|
252
|
+
| Platform | Session store | Format |
|
|
253
|
+
|----------|--------------|--------|
|
|
254
|
+
| `claude` | `~/.claude/projects/` | JSONL files |
|
|
255
|
+
| `codex` | `~/.codex/sessions/` | JSONL files |
|
|
256
|
+
| `cursor` | `~/Library/Application Support/Cursor/User/globalStorage/` (macOS) | SQLite `state.vscdb`, exported to JSONL cache |
|
|
257
|
+
| `opencode` | `~/.local/share/opencode/` | SQLite `opencode.db`, exported to JSONL cache |
|
|
258
|
+
|
|
259
|
+
#### How to connect
|
|
260
|
+
|
|
261
|
+
Auto-detect and connect all supported platforms at once:
|
|
262
|
+
|
|
263
|
+
```bash
|
|
264
|
+
lerim connect auto
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
Or connect a specific platform:
|
|
268
|
+
|
|
269
|
+
```bash
|
|
270
|
+
lerim connect claude
|
|
271
|
+
lerim connect codex
|
|
272
|
+
lerim connect cursor
|
|
273
|
+
lerim connect opencode
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
List currently connected platforms:
|
|
277
|
+
|
|
278
|
+
```bash
|
|
279
|
+
lerim connect list
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
Disconnect a platform:
|
|
283
|
+
|
|
284
|
+
```bash
|
|
285
|
+
lerim connect remove claude
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
#### Custom session path
|
|
289
|
+
|
|
290
|
+
If your agent stores sessions in a non-default location, use `--path` to point Lerim to the correct folder:
|
|
291
|
+
|
|
292
|
+
```bash
|
|
293
|
+
lerim connect claude --path /custom/path/to/claude/sessions
|
|
294
|
+
lerim connect cursor --path ~/my-cursor-data/globalStorage
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
The path is expanded (`~` is resolved) and must exist on disk. This overrides the auto-detected default for that platform.
|
|
298
|
+
|
|
299
|
+
### Search
|
|
300
|
+
|
|
301
|
+
Retrieval is file-first: scan markdown memory files directly. No index required.
|
|
302
|
+
|
|
303
|
+
## Memory layout
|
|
304
|
+
|
|
305
|
+
Project scope:
|
|
306
|
+
|
|
307
|
+
```text
|
|
308
|
+
<repo>/.lerim/
|
|
309
|
+
config.toml # project overrides
|
|
310
|
+
memory/
|
|
311
|
+
decisions/
|
|
312
|
+
learnings/
|
|
313
|
+
summaries/
|
|
314
|
+
YYYYMMDD/
|
|
315
|
+
HHMMSS/
|
|
316
|
+
{slug}.md
|
|
317
|
+
archived/
|
|
318
|
+
decisions/
|
|
319
|
+
learnings/
|
|
320
|
+
meta/
|
|
321
|
+
traces/
|
|
322
|
+
sessions/
|
|
323
|
+
workspace/
|
|
324
|
+
sync-<YYYYMMDD-HHMMSS>-<shortid>/
|
|
325
|
+
extract.json
|
|
326
|
+
summary.json
|
|
327
|
+
memory_actions.json
|
|
328
|
+
agent.log
|
|
329
|
+
subagents.log
|
|
330
|
+
session.log
|
|
331
|
+
maintain-<YYYYMMDD-HHMMSS>-<shortid>/
|
|
332
|
+
maintain_actions.json
|
|
333
|
+
agent.log
|
|
334
|
+
subagents.log
|
|
335
|
+
index/ # reserved
|
|
336
|
+
```
|
|
337
|
+
|
|
338
|
+
Global fallback scope follows the same layout under `~/.lerim/`.
|
|
339
|
+
|
|
340
|
+
## Primitive frontmatter (lean)
|
|
341
|
+
|
|
342
|
+
- `decision`: `id,title,created,updated,source,confidence,tags`
|
|
343
|
+
- `learning`: `id,title,created,updated,source,confidence,tags,kind`
|
|
344
|
+
- `summary`: `id,title,description,date,time,coding_agent,raw_trace_path,run_id,repo_name,created,source,tags`
|
|
345
|
+
|
|
346
|
+
All metadata lives in frontmatter — no sidecars.
|
|
347
|
+
|
|
348
|
+
## Reset policy
|
|
349
|
+
|
|
350
|
+
Memory reset is explicit and destructive.
|
|
351
|
+
|
|
352
|
+
- `lerim memory reset --scope project|global|both --yes`
|
|
353
|
+
- Deletes `memory/`, `workspace/`, and `index/` under selected root(s), then recreates canonical folders.
|
|
354
|
+
- `--scope project`: resets `<repo>/.lerim/` only.
|
|
355
|
+
- `--scope global`: resets `~/.lerim/` only (includes sessions DB).
|
|
356
|
+
- `--scope both` (default): resets both.
|
|
357
|
+
- Sessions DB lives in global `index/`, so `--scope project` alone does not reset sessions.
|
|
358
|
+
|
|
359
|
+
Fresh start:
|
|
360
|
+
```bash
|
|
361
|
+
lerim memory reset --yes # wipe everything
|
|
362
|
+
lerim sync --max-sessions 5 # re-sync newest conversations
|
|
363
|
+
```
|
|
364
|
+
|
|
365
|
+
## Docs
|
|
366
|
+
|
|
367
|
+
- Runtime architecture: `docs/architecture.md`
|
|
368
|
+
- CLI reference: `skills/lerim/cli-reference.md`
|
|
369
|
+
- Agent skill: `skills/lerim/SKILL.md`
|