File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11"""kimi-mneme — Persistent memory for Kimi Code CLI."""
22
3- __version__ = "2.0.23 "
3+ __version__ = "2.0.24 "
Original file line number Diff line number Diff line change 1- """AI provider for observation structuring using configurable LLM backends."""
1+ """AI provider for observation structuring using configurable LLM backends.
2+
3+ Location: mneme/core/ai_provider.py
4+
5+ This module provides the AI/Hybrid providers that orchestrate observation structuring.
6+ It sends tool call data to an LLM and parses the JSON response into structured observations.
7+
8+ Architecture:
9+ AIProvider (abstract)
10+ ├── ConfigurableAIProvider -- Uses any LLM client (Kimi, Ollama, OpenAI-compatible)
11+ └── HybridProvider -- Tries AI first, falls back to heuristic structuring
12+
13+ Related modules:
14+ - mneme/core/prompts/json_parser.py -- Parses LLM JSON responses
15+ - mneme/core/prompts/observation_prompt.py -- Prompt templates
16+ - mneme/core/heuristic_structuring.py -- Fallback when AI is unavailable
17+ - mneme/core/llm_client.py -- LLM client abstraction
18+ - mneme/core/worker.py -- Background worker using HybridProvider
19+ - mneme/db/structured_store.py -- Stores ParsedObservation results
20+
21+ Tests: tests/test_ai_provider.py
22+ """
223
324from __future__ import annotations
425
Original file line number Diff line number Diff line change 11"""Heuristic structuring as fallback when AI is unavailable.
22
3+ Location: mneme/core/heuristic_structuring.py
4+
35This module extracts structured observations from raw tool calls using
46rule-based analysis. It's designed to be fast, deterministic, and produce
57high-quality results comparable to AI structuring for common patterns.
8+
9+ Architecture:
10+ HeuristicStructuring
11+ ├── structure() -- Main entry point
12+ ├── _detect_type() -- Detects observation type from tool/error/prompt
13+ ├── _generate_title() -- Generates human-readable title
14+ ├── _generate_subtitle() -- Generates subtitle/summary
15+ ├── _extract_facts() -- Extracts key facts (up to 5)
16+ ├── _generate_narrative() -- Generates narrative description
17+ ├── _detect_concepts() -- Detects concept tags from patterns
18+ ├── _extract_files_*() -- Extracts file paths
19+ └── _extract_file_paths() -- Regex-based file path extraction
20+
21+ Related modules:
22+ - mneme/core/ai_provider.py -- HybridProvider falls back to this module
23+ - mneme/core/prompts/json_parser.py -- ParsedObservation dataclass (same fields)
24+ - mneme/db/structured_store.py -- Stores HeuristicObservation results
25+
26+ Tests: tests/test_ai_provider.py (TestHeuristicStructuring)
627"""
728
829from __future__ import annotations
Original file line number Diff line number Diff line change 1- """Parse JSON responses from AI structuring."""
1+ """Parse JSON responses from AI structuring.
2+
3+ Location: mneme/core/prompts/json_parser.py
4+
5+ This module is part of the AI structuring pipeline. It parses raw JSON responses
6+ from LLMs into structured ParsedObservation objects.
7+
8+ Related modules:
9+ - mneme/core/ai_provider.py -- Uses parse_observation_json() via HybridProvider / ConfigurableAIProvider
10+ - mneme/core/prompts/observation_prompt.py -- Prompt templates sent to LLM
11+ - mneme/core/heuristic_structuring.py -- Fallback when AI is disabled
12+ - mneme/core/worker.py -- Background worker that orchestrates structuring
13+ - mneme/db/structured_store.py -- Stores the resulting ParsedObservation
14+
15+ Tests: tests/test_json_parser.py
16+ """
217
318from __future__ import annotations
419
Original file line number Diff line number Diff line change 1- """Background worker for AI structuring queue."""
1+ """Background worker for AI structuring queue.
2+
3+ Location: mneme/core/worker.py
4+
5+ This module runs a background loop that fetches pending observations from the queue,
6+ processes them through AI/heuristic structuring, and stores structured results.
7+
8+ Architecture:
9+ StructuringWorker
10+ ├── _build_ai_provider_from_config() -- Creates ConfigurableAIProvider from config
11+ ├── start() -- Main loop (async)
12+ ├── _process_batch() -- Claims messages, structures, stores results
13+ └── _extract_project() -- Extracts project name from cwd
14+
15+ Related modules:
16+ - mneme/core/ai_provider.py -- HybridProvider / ConfigurableAIProvider
17+ - mneme/core/prompts/json_parser.py -- Parses LLM JSON responses
18+ - mneme/core/heuristic_structuring.py -- Fallback when AI is unavailable
19+ - mneme/db/store.py -- Raw observation queue (claim_pending_messages)
20+ - mneme/db/structured_store.py -- Stores structured observations
21+ - mneme/db/vector.py -- Vector search index
22+
23+ Tests: tests/test_worker.py
24+ """
225
326from __future__ import annotations
427
Original file line number Diff line number Diff line change 11{
22 "name" : " kimi-mneme" ,
3- "version" : " 2.0.23 " ,
3+ "version" : " 2.0.24 " ,
44 "description" : " Persistent memory plugin for Kimi Code CLI \u2014 search and retrieve past session context. Part of the kimi-plugins ecosystem." ,
55 "config_file" : " config.json" ,
66 "inject" : {
111111 }
112112 }
113113 ]
114- }
114+ }
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ build-backend = "hatchling.build"
44
55[project ]
66name = " kimi-mneme"
7- version = " 2.0.23 "
7+ version = " 2.0.24 "
88description = " Persistent memory plugin for Kimi Code CLI"
99readme = " README.md"
1010license = { text = " AGPL-3.0" }
You can’t perform that action at this time.
0 commit comments