eidet-sdk 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.
@@ -0,0 +1,93 @@
1
+ Metadata-Version: 2.4
2
+ Name: eidet-sdk
3
+ Version: 0.1.0
4
+ Summary: Python client SDK for Eidet — long-term memory for AI coding agents
5
+ License: MIT
6
+ Project-URL: Homepage, https://github.com/stevehansen/eidet
7
+ Keywords: eidet,memory,ai,coding-agent,mcp
8
+ Requires-Python: >=3.10
9
+ Description-Content-Type: text/markdown
10
+ Requires-Dist: httpx>=0.27
11
+
12
+ # eidet-sdk
13
+
14
+ Python client SDK for [Eidet](https://github.com/stevehansen/eidet) — long-term memory for AI coding agents.
15
+
16
+ ## Install
17
+
18
+ ```bash
19
+ pip install eidet-sdk
20
+ ```
21
+
22
+ ## Usage
23
+
24
+ ```python
25
+ from eidet_sdk import EidetClient, StoreRequest, MemoryType
26
+
27
+ client = EidetClient() # defaults to http://localhost:19380
28
+
29
+ # Store a memory
30
+ result = client.store(StoreRequest(
31
+ repo="/path/to/project",
32
+ content="The auth module uses JWT with RS256 signing",
33
+ type=MemoryType.OBSERVATION,
34
+ tags=["auth", "jwt"],
35
+ ))
36
+
37
+ # Search memories
38
+ results = client.recall("/path/to/project", "authentication")
39
+
40
+ # Get session context (L0 identity + L1 top memories, < 600 tokens)
41
+ context = client.context("/path/to/project")
42
+
43
+ # Browse all memories
44
+ page = client.browse("/path/to/project", skip=0, take=50)
45
+
46
+ # Feedback loop
47
+ client.feedback("memories/...", was_used=True) # echo (useful)
48
+ client.feedback("memories/...", was_used=False) # fizzle (irrelevant)
49
+ ```
50
+
51
+ ## Context Manager
52
+
53
+ ```python
54
+ with EidetClient(url="http://localhost:19380") as client:
55
+ results = client.recall("/path/to/project", "deployment")
56
+ ```
57
+
58
+ ## API Key Authentication
59
+
60
+ ```python
61
+ client = EidetClient(url="http://localhost:19380", api_key="your-api-key")
62
+ ```
63
+
64
+ ## All Methods
65
+
66
+ | Method | Description |
67
+ |--------|-------------|
68
+ | `store(request)` | Store a memory (observation, insight, procedure, heuristic) |
69
+ | `recall(repo, query, **kwargs)` | Search memories by meaning and keywords |
70
+ | `context(repo)` | Get compact session context (< 600 tokens) |
71
+ | `get_memory(id)` | Get a specific memory by ID |
72
+ | `forget(id, reason?)` | Soft-delete a memory |
73
+ | `feedback(memory_id, was_used)` | Echo (useful) or fizzle (irrelevant) feedback |
74
+ | `history(id)` | Get version chain for a memory |
75
+ | `browse(repo, **kwargs)` | Paginated memory listing |
76
+ | `graph(repo, limit?)` | Graph data for visualization |
77
+ | `repos()` | List all known repositories |
78
+ | `intake(repo)` | Ingest project files as seed memories |
79
+ | `consolidate(repo)` | Merge related observations into insights |
80
+ | `maintenance(repo)` | Run maintenance pipeline |
81
+ | `export_markdown(repo)` | Export memories as markdown |
82
+ | `health()` | Health check |
83
+ | `status()` | Service status and stats |
84
+
85
+ ## Requirements
86
+
87
+ - Eidet service running locally (`eidet serve` or installed as system service)
88
+ - Python 3.10+
89
+ - httpx
90
+
91
+ ## License
92
+
93
+ [MIT](https://github.com/stevehansen/eidet/blob/main/LICENSE)
@@ -0,0 +1,82 @@
1
+ # eidet-sdk
2
+
3
+ Python client SDK for [Eidet](https://github.com/stevehansen/eidet) — long-term memory for AI coding agents.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ pip install eidet-sdk
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ```python
14
+ from eidet_sdk import EidetClient, StoreRequest, MemoryType
15
+
16
+ client = EidetClient() # defaults to http://localhost:19380
17
+
18
+ # Store a memory
19
+ result = client.store(StoreRequest(
20
+ repo="/path/to/project",
21
+ content="The auth module uses JWT with RS256 signing",
22
+ type=MemoryType.OBSERVATION,
23
+ tags=["auth", "jwt"],
24
+ ))
25
+
26
+ # Search memories
27
+ results = client.recall("/path/to/project", "authentication")
28
+
29
+ # Get session context (L0 identity + L1 top memories, < 600 tokens)
30
+ context = client.context("/path/to/project")
31
+
32
+ # Browse all memories
33
+ page = client.browse("/path/to/project", skip=0, take=50)
34
+
35
+ # Feedback loop
36
+ client.feedback("memories/...", was_used=True) # echo (useful)
37
+ client.feedback("memories/...", was_used=False) # fizzle (irrelevant)
38
+ ```
39
+
40
+ ## Context Manager
41
+
42
+ ```python
43
+ with EidetClient(url="http://localhost:19380") as client:
44
+ results = client.recall("/path/to/project", "deployment")
45
+ ```
46
+
47
+ ## API Key Authentication
48
+
49
+ ```python
50
+ client = EidetClient(url="http://localhost:19380", api_key="your-api-key")
51
+ ```
52
+
53
+ ## All Methods
54
+
55
+ | Method | Description |
56
+ |--------|-------------|
57
+ | `store(request)` | Store a memory (observation, insight, procedure, heuristic) |
58
+ | `recall(repo, query, **kwargs)` | Search memories by meaning and keywords |
59
+ | `context(repo)` | Get compact session context (< 600 tokens) |
60
+ | `get_memory(id)` | Get a specific memory by ID |
61
+ | `forget(id, reason?)` | Soft-delete a memory |
62
+ | `feedback(memory_id, was_used)` | Echo (useful) or fizzle (irrelevant) feedback |
63
+ | `history(id)` | Get version chain for a memory |
64
+ | `browse(repo, **kwargs)` | Paginated memory listing |
65
+ | `graph(repo, limit?)` | Graph data for visualization |
66
+ | `repos()` | List all known repositories |
67
+ | `intake(repo)` | Ingest project files as seed memories |
68
+ | `consolidate(repo)` | Merge related observations into insights |
69
+ | `maintenance(repo)` | Run maintenance pipeline |
70
+ | `export_markdown(repo)` | Export memories as markdown |
71
+ | `health()` | Health check |
72
+ | `status()` | Service status and stats |
73
+
74
+ ## Requirements
75
+
76
+ - Eidet service running locally (`eidet serve` or installed as system service)
77
+ - Python 3.10+
78
+ - httpx
79
+
80
+ ## License
81
+
82
+ [MIT](https://github.com/stevehansen/eidet/blob/main/LICENSE)
@@ -0,0 +1,4 @@
1
+ from .client import EidetClient, EidetError, MemoryType, StoreRequest
2
+
3
+ __all__ = ["EidetClient", "EidetError", "MemoryType", "StoreRequest"]
4
+ __version__ = "0.1.0"
@@ -0,0 +1,187 @@
1
+ """Eidet Python SDK — REST API client for Eidet memory service."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from dataclasses import dataclass, field
6
+ from enum import Enum
7
+ from typing import Any
8
+
9
+ import httpx
10
+
11
+
12
+ class MemoryType(str, Enum):
13
+ OBSERVATION = "observation"
14
+ INSIGHT = "insight"
15
+ PROCEDURE = "procedure"
16
+ HEURISTIC = "heuristic"
17
+
18
+
19
+ @dataclass
20
+ class StoreRequest:
21
+ repo: str
22
+ content: str
23
+ type: MemoryType = MemoryType.OBSERVATION
24
+ tags: list[str] = field(default_factory=list)
25
+ importance: float = 0.5
26
+ source: str = "sdk"
27
+ session_id: str | None = None
28
+ supersedes: str | None = None
29
+
30
+
31
+ class EidetError(Exception):
32
+ def __init__(self, status: int, body: str) -> None:
33
+ self.status = status
34
+ self.body = body
35
+ super().__init__(f"Eidet API error {status}: {body}")
36
+
37
+
38
+ class EidetClient:
39
+ """Client for the Eidet memory service REST API."""
40
+
41
+ def __init__(self, url: str = "http://localhost:19380", api_key: str | None = None) -> None:
42
+ self._base = url.rstrip("/")
43
+ headers: dict[str, str] = {}
44
+ if api_key:
45
+ headers["Authorization"] = f"Bearer {api_key}"
46
+ self._client = httpx.Client(base_url=self._base, headers=headers, timeout=30.0)
47
+
48
+ def close(self) -> None:
49
+ self._client.close()
50
+
51
+ def __enter__(self) -> EidetClient:
52
+ return self
53
+
54
+ def __exit__(self, *args: Any) -> None:
55
+ self.close()
56
+
57
+ # ─── Core operations ─────────────────────────────────────────
58
+
59
+ def store(
60
+ self,
61
+ repo: str,
62
+ content: str,
63
+ type: MemoryType | str = MemoryType.OBSERVATION,
64
+ *,
65
+ tags: list[str] | None = None,
66
+ importance: float = 0.5,
67
+ source: str = "sdk",
68
+ session_id: str | None = None,
69
+ supersedes: str | None = None,
70
+ ) -> dict[str, Any]:
71
+ body: dict[str, Any] = {
72
+ "repo": repo,
73
+ "content": content,
74
+ "type": str(type.value) if isinstance(type, MemoryType) else type,
75
+ "importance": importance,
76
+ "source": source,
77
+ }
78
+ if tags:
79
+ body["tags"] = tags
80
+ if session_id:
81
+ body["sessionId"] = session_id
82
+ if supersedes:
83
+ body["supersedes"] = supersedes
84
+ return self._post("/api/eidet", body)
85
+
86
+ def recall(
87
+ self,
88
+ repo: str,
89
+ query: str,
90
+ *,
91
+ limit: int = 10,
92
+ type: MemoryType | str | None = None,
93
+ tags: list[str] | None = None,
94
+ ) -> list[dict[str, Any]]:
95
+ params: dict[str, str] = {"repo": repo, "q": query, "limit": str(limit)}
96
+ if type:
97
+ params["type"] = str(type.value) if isinstance(type, MemoryType) else type
98
+ if tags:
99
+ params["tags"] = ",".join(tags)
100
+ data = self._get("/api/eidet/search", params=params)
101
+ return data["results"]
102
+
103
+ def context(self, repo: str) -> str:
104
+ data = self._get("/api/eidet/context", params={"repo": repo})
105
+ return data["context"]
106
+
107
+ def get_memory(self, memory_id: str) -> dict[str, Any]:
108
+ return self._get(f"/api/eidet/{memory_id}")
109
+
110
+ def forget(self, memory_id: str, reason: str | None = None) -> bool:
111
+ params = {"reason": reason} if reason else {}
112
+ data = self._delete(f"/api/eidet/{memory_id}", params=params)
113
+ return data.get("forgotten", False)
114
+
115
+ def feedback(self, memory_id: str, was_used: bool) -> bool:
116
+ data = self._post("/api/eidet/feedback", {"memoryId": memory_id, "wasUsed": was_used})
117
+ return data.get("applied", False)
118
+
119
+ def history(self, memory_id: str) -> list[dict[str, Any]]:
120
+ data = self._get(f"/api/eidet/history/{memory_id}")
121
+ return data["chain"]
122
+
123
+ # ─── Browse & Graph ──────────────────────────────────────────
124
+
125
+ def browse(
126
+ self,
127
+ repo: str,
128
+ *,
129
+ skip: int = 0,
130
+ take: int = 50,
131
+ type: MemoryType | str | None = None,
132
+ ) -> dict[str, Any]:
133
+ params: dict[str, str] = {"repo": repo, "skip": str(skip), "take": str(take)}
134
+ if type:
135
+ params["type"] = str(type.value) if isinstance(type, MemoryType) else type
136
+ return self._get("/api/eidet/browse", params=params)
137
+
138
+ def graph(self, repo: str, limit: int = 200) -> dict[str, Any]:
139
+ return self._get("/api/eidet/graph", params={"repo": repo, "limit": str(limit)})
140
+
141
+ def repos(self) -> list[str]:
142
+ data = self._get("/api/eidet/repos")
143
+ return [r["repoId"] for r in data["repos"]]
144
+
145
+ # ─── Operations ──────────────────────────────────────────────
146
+
147
+ def intake(self, repo: str) -> dict[str, Any]:
148
+ return self._post(f"/api/eidet/intake?repo={repo}")
149
+
150
+ def consolidate(self, repo: str) -> dict[str, Any]:
151
+ return self._post(f"/api/eidet/consolidate?repo={repo}")
152
+
153
+ def maintenance(self, repo: str) -> dict[str, Any]:
154
+ return self._post(f"/api/maintenance?repo={repo}")
155
+
156
+ def export_markdown(self, repo: str) -> str:
157
+ res = self._client.get("/api/eidet/export", params={"repo": repo})
158
+ res.raise_for_status()
159
+ return res.text
160
+
161
+ # ─── Health ──────────────────────────────────────────────────
162
+
163
+ def health(self) -> dict[str, Any]:
164
+ return self._get("/api/health")
165
+
166
+ def status(self) -> dict[str, Any]:
167
+ return self._get("/api/status")
168
+
169
+ # ─── HTTP helpers ────────────────────────────────────────────
170
+
171
+ def _get(self, path: str, params: dict[str, str] | None = None) -> dict[str, Any]:
172
+ res = self._client.get(path, params=params)
173
+ if not res.is_success:
174
+ raise EidetError(res.status_code, res.text)
175
+ return res.json()
176
+
177
+ def _post(self, path: str, body: dict[str, Any] | None = None) -> dict[str, Any]:
178
+ res = self._client.post(path, json=body)
179
+ if not res.is_success:
180
+ raise EidetError(res.status_code, res.text)
181
+ return res.json()
182
+
183
+ def _delete(self, path: str, params: dict[str, str] | None = None) -> dict[str, Any]:
184
+ res = self._client.delete(path, params=params)
185
+ if not res.is_success:
186
+ raise EidetError(res.status_code, res.text)
187
+ return res.json()
@@ -0,0 +1,93 @@
1
+ Metadata-Version: 2.4
2
+ Name: eidet-sdk
3
+ Version: 0.1.0
4
+ Summary: Python client SDK for Eidet — long-term memory for AI coding agents
5
+ License: MIT
6
+ Project-URL: Homepage, https://github.com/stevehansen/eidet
7
+ Keywords: eidet,memory,ai,coding-agent,mcp
8
+ Requires-Python: >=3.10
9
+ Description-Content-Type: text/markdown
10
+ Requires-Dist: httpx>=0.27
11
+
12
+ # eidet-sdk
13
+
14
+ Python client SDK for [Eidet](https://github.com/stevehansen/eidet) — long-term memory for AI coding agents.
15
+
16
+ ## Install
17
+
18
+ ```bash
19
+ pip install eidet-sdk
20
+ ```
21
+
22
+ ## Usage
23
+
24
+ ```python
25
+ from eidet_sdk import EidetClient, StoreRequest, MemoryType
26
+
27
+ client = EidetClient() # defaults to http://localhost:19380
28
+
29
+ # Store a memory
30
+ result = client.store(StoreRequest(
31
+ repo="/path/to/project",
32
+ content="The auth module uses JWT with RS256 signing",
33
+ type=MemoryType.OBSERVATION,
34
+ tags=["auth", "jwt"],
35
+ ))
36
+
37
+ # Search memories
38
+ results = client.recall("/path/to/project", "authentication")
39
+
40
+ # Get session context (L0 identity + L1 top memories, < 600 tokens)
41
+ context = client.context("/path/to/project")
42
+
43
+ # Browse all memories
44
+ page = client.browse("/path/to/project", skip=0, take=50)
45
+
46
+ # Feedback loop
47
+ client.feedback("memories/...", was_used=True) # echo (useful)
48
+ client.feedback("memories/...", was_used=False) # fizzle (irrelevant)
49
+ ```
50
+
51
+ ## Context Manager
52
+
53
+ ```python
54
+ with EidetClient(url="http://localhost:19380") as client:
55
+ results = client.recall("/path/to/project", "deployment")
56
+ ```
57
+
58
+ ## API Key Authentication
59
+
60
+ ```python
61
+ client = EidetClient(url="http://localhost:19380", api_key="your-api-key")
62
+ ```
63
+
64
+ ## All Methods
65
+
66
+ | Method | Description |
67
+ |--------|-------------|
68
+ | `store(request)` | Store a memory (observation, insight, procedure, heuristic) |
69
+ | `recall(repo, query, **kwargs)` | Search memories by meaning and keywords |
70
+ | `context(repo)` | Get compact session context (< 600 tokens) |
71
+ | `get_memory(id)` | Get a specific memory by ID |
72
+ | `forget(id, reason?)` | Soft-delete a memory |
73
+ | `feedback(memory_id, was_used)` | Echo (useful) or fizzle (irrelevant) feedback |
74
+ | `history(id)` | Get version chain for a memory |
75
+ | `browse(repo, **kwargs)` | Paginated memory listing |
76
+ | `graph(repo, limit?)` | Graph data for visualization |
77
+ | `repos()` | List all known repositories |
78
+ | `intake(repo)` | Ingest project files as seed memories |
79
+ | `consolidate(repo)` | Merge related observations into insights |
80
+ | `maintenance(repo)` | Run maintenance pipeline |
81
+ | `export_markdown(repo)` | Export memories as markdown |
82
+ | `health()` | Health check |
83
+ | `status()` | Service status and stats |
84
+
85
+ ## Requirements
86
+
87
+ - Eidet service running locally (`eidet serve` or installed as system service)
88
+ - Python 3.10+
89
+ - httpx
90
+
91
+ ## License
92
+
93
+ [MIT](https://github.com/stevehansen/eidet/blob/main/LICENSE)
@@ -0,0 +1,9 @@
1
+ README.md
2
+ pyproject.toml
3
+ eidet_sdk/__init__.py
4
+ eidet_sdk/client.py
5
+ eidet_sdk.egg-info/PKG-INFO
6
+ eidet_sdk.egg-info/SOURCES.txt
7
+ eidet_sdk.egg-info/dependency_links.txt
8
+ eidet_sdk.egg-info/requires.txt
9
+ eidet_sdk.egg-info/top_level.txt
@@ -0,0 +1 @@
1
+ httpx>=0.27
@@ -0,0 +1 @@
1
+ eidet_sdk
@@ -0,0 +1,16 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68.0"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "eidet-sdk"
7
+ version = "0.1.0"
8
+ description = "Python client SDK for Eidet — long-term memory for AI coding agents"
9
+ readme = "README.md"
10
+ requires-python = ">=3.10"
11
+ license = {text = "MIT"}
12
+ keywords = ["eidet", "memory", "ai", "coding-agent", "mcp"]
13
+ dependencies = ["httpx>=0.27"]
14
+
15
+ [project.urls]
16
+ Homepage = "https://github.com/stevehansen/eidet"
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+