memorytrace 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.
Files changed (101) hide show
  1. memorytrace-0.1.0/.gitignore +20 -0
  2. memorytrace-0.1.0/CLAUDE.md +196 -0
  3. memorytrace-0.1.0/LICENSE +21 -0
  4. memorytrace-0.1.0/PKG-INFO +138 -0
  5. memorytrace-0.1.0/README.md +100 -0
  6. memorytrace-0.1.0/docs/01-project-analysis/01-overview.md +49 -0
  7. memorytrace-0.1.0/docs/01-project-analysis/02-tech-stack.md +60 -0
  8. memorytrace-0.1.0/docs/01-project-analysis/03-architecture.md +171 -0
  9. memorytrace-0.1.0/docs/01-project-analysis/04-directory-structure.md +130 -0
  10. memorytrace-0.1.0/docs/01-project-analysis/05-cli-commands.md +95 -0
  11. memorytrace-0.1.0/docs/01-project-analysis/06-core-features.md +200 -0
  12. memorytrace-0.1.0/docs/01-project-analysis/07-storage-model.md +173 -0
  13. memorytrace-0.1.0/docs/01-project-analysis/08-design-decisions.md +151 -0
  14. memorytrace-0.1.0/docs/01-project-analysis/09-setup-guide.md +181 -0
  15. memorytrace-0.1.0/docs/02-problem-analysis/10-problem-analysis.md +394 -0
  16. memorytrace-0.1.0/docs/02-problem-analysis/11-agent-memory-critique.md +398 -0
  17. memorytrace-0.1.0/docs/02-problem-analysis/13-markdown-storage-problems.md +646 -0
  18. memorytrace-0.1.0/docs/03-improvement-plan/12-improvements-blueprint.md +817 -0
  19. memorytrace-0.1.0/docs/04-usage-guide/01-quickstart.md +273 -0
  20. memorytrace-0.1.0/docs/04-usage-guide/02-claude-code-setup.md +161 -0
  21. memorytrace-0.1.0/docs/README.md +42 -0
  22. memorytrace-0.1.0/engram/__init__.py +8 -0
  23. memorytrace-0.1.0/engram/__main__.py +6 -0
  24. memorytrace-0.1.0/engram/cli/__init__.py +1 -0
  25. memorytrace-0.1.0/engram/cli/app.py +291 -0
  26. memorytrace-0.1.0/engram/cli/formatters.py +90 -0
  27. memorytrace-0.1.0/engram/cli/simple.py +267 -0
  28. memorytrace-0.1.0/engram/config.py +72 -0
  29. memorytrace-0.1.0/engram/engine.py +612 -0
  30. memorytrace-0.1.0/engram/exceptions.py +41 -0
  31. memorytrace-0.1.0/engram/extraction/__init__.py +6 -0
  32. memorytrace-0.1.0/engram/extraction/base.py +20 -0
  33. memorytrace-0.1.0/engram/extraction/llm_extractor.py +197 -0
  34. memorytrace-0.1.0/engram/extraction/ner/__init__.py +7 -0
  35. memorytrace-0.1.0/engram/extraction/ner/cjk.py +63 -0
  36. memorytrace-0.1.0/engram/extraction/ner/english.py +109 -0
  37. memorytrace-0.1.0/engram/extraction/ner/korean.py +106 -0
  38. memorytrace-0.1.0/engram/extraction/regex_extractor.py +188 -0
  39. memorytrace-0.1.0/engram/integrations/__init__.py +1 -0
  40. memorytrace-0.1.0/engram/integrations/mcp_server.py +213 -0
  41. memorytrace-0.1.0/engram/integrations/sdk.py +194 -0
  42. memorytrace-0.1.0/engram/models/__init__.py +19 -0
  43. memorytrace-0.1.0/engram/models/entity.py +72 -0
  44. memorytrace-0.1.0/engram/models/fact.py +58 -0
  45. memorytrace-0.1.0/engram/models/quality.py +61 -0
  46. memorytrace-0.1.0/engram/models/relation.py +26 -0
  47. memorytrace-0.1.0/engram/models/search.py +96 -0
  48. memorytrace-0.1.0/engram/models/session.py +53 -0
  49. memorytrace-0.1.0/engram/models/source.py +73 -0
  50. memorytrace-0.1.0/engram/quality/__init__.py +8 -0
  51. memorytrace-0.1.0/engram/quality/confidence.py +38 -0
  52. memorytrace-0.1.0/engram/quality/conflict.py +79 -0
  53. memorytrace-0.1.0/engram/quality/decay.py +28 -0
  54. memorytrace-0.1.0/engram/quality/gate.py +120 -0
  55. memorytrace-0.1.0/engram/quality/pii.py +80 -0
  56. memorytrace-0.1.0/engram/search/__init__.py +13 -0
  57. memorytrace-0.1.0/engram/search/base.py +20 -0
  58. memorytrace-0.1.0/engram/search/fts5_search.py +210 -0
  59. memorytrace-0.1.0/engram/search/hybrid.py +99 -0
  60. memorytrace-0.1.0/engram/search/semantic.py +186 -0
  61. memorytrace-0.1.0/engram/search/tokenizer.py +85 -0
  62. memorytrace-0.1.0/engram/session/__init__.py +6 -0
  63. memorytrace-0.1.0/engram/session/context.py +87 -0
  64. memorytrace-0.1.0/engram/session/manager.py +152 -0
  65. memorytrace-0.1.0/engram/session/working_memory.py +57 -0
  66. memorytrace-0.1.0/engram/storage/__init__.py +6 -0
  67. memorytrace-0.1.0/engram/storage/base.py +63 -0
  68. memorytrace-0.1.0/engram/storage/markdown_export.py +144 -0
  69. memorytrace-0.1.0/engram/storage/migrations.py +30 -0
  70. memorytrace-0.1.0/engram/storage/sqlite_store.py +615 -0
  71. memorytrace-0.1.0/mem +139 -0
  72. memorytrace-0.1.0/pyproject.toml +75 -0
  73. memorytrace-0.1.0/tests/__init__.py +0 -0
  74. memorytrace-0.1.0/tests/conftest.py +99 -0
  75. memorytrace-0.1.0/tests/fixtures/__init__.py +0 -0
  76. memorytrace-0.1.0/tests/test_cli/__init__.py +0 -0
  77. memorytrace-0.1.0/tests/test_cli/test_app.py +166 -0
  78. memorytrace-0.1.0/tests/test_e2e.py +212 -0
  79. memorytrace-0.1.0/tests/test_engine.py +159 -0
  80. memorytrace-0.1.0/tests/test_extraction/__init__.py +0 -0
  81. memorytrace-0.1.0/tests/test_extraction/test_llm_extractor.py +112 -0
  82. memorytrace-0.1.0/tests/test_extraction/test_ner/__init__.py +0 -0
  83. memorytrace-0.1.0/tests/test_extraction/test_ner/test_english.py +101 -0
  84. memorytrace-0.1.0/tests/test_extraction/test_ner/test_korean.py +71 -0
  85. memorytrace-0.1.0/tests/test_extraction/test_regex_extractor.py +92 -0
  86. memorytrace-0.1.0/tests/test_integrations/__init__.py +0 -0
  87. memorytrace-0.1.0/tests/test_integrations/test_mcp_server.py +12 -0
  88. memorytrace-0.1.0/tests/test_quality/__init__.py +0 -0
  89. memorytrace-0.1.0/tests/test_quality/test_confidence.py +55 -0
  90. memorytrace-0.1.0/tests/test_quality/test_conflict.py +199 -0
  91. memorytrace-0.1.0/tests/test_quality/test_gate.py +207 -0
  92. memorytrace-0.1.0/tests/test_quality/test_pii.py +117 -0
  93. memorytrace-0.1.0/tests/test_search/__init__.py +0 -0
  94. memorytrace-0.1.0/tests/test_search/test_fts5_search.py +248 -0
  95. memorytrace-0.1.0/tests/test_search/test_semantic.py +19 -0
  96. memorytrace-0.1.0/tests/test_search/test_tokenizer.py +102 -0
  97. memorytrace-0.1.0/tests/test_session/__init__.py +0 -0
  98. memorytrace-0.1.0/tests/test_session/test_manager.py +117 -0
  99. memorytrace-0.1.0/tests/test_session/test_working_memory.py +73 -0
  100. memorytrace-0.1.0/tests/test_storage/__init__.py +0 -0
  101. memorytrace-0.1.0/tests/test_storage/test_sqlite_store.py +288 -0
@@ -0,0 +1,20 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ *.egg-info/
4
+ dist/
5
+ build/
6
+ .eggs/
7
+ *.egg
8
+ .pytest_cache/
9
+ .mypy_cache/
10
+ .ruff_cache/
11
+ *.db
12
+ *.db-wal
13
+ *.db-shm
14
+ .engram/
15
+ /tmp/
16
+ *.tmp
17
+ .DS_Store
18
+ .env
19
+ .venv/
20
+ venv/
@@ -0,0 +1,196 @@
1
+ # Engram — AI Agent Memory System
2
+
3
+ ## Overview
4
+ AI 에이전트를 위한 지속적·구조적·신뢰할 수 있는 메모리 시스템.
5
+ SQLite+FTS5 기반, MCP 통합, 품질 게이트 내장.
6
+
7
+ ## Tech Stack
8
+ - Language: Python 3.9+
9
+ - Storage: SQLite + FTS5 (표준 라이브러리, 제로 코어 의존성)
10
+ - Search: FTS5 내장 BM25 (기본) / 임베딩 시맨틱 (선택)
11
+ - Agent Integration: MCP 서버 (Claude Code / Codex)
12
+ - LLM: Optional 플러그인 (`pip install engram[llm]`)
13
+
14
+ ## Project Structure
15
+ ```
16
+ engram/
17
+ ├── models/ # 순수 데이터 클래스 (로직 없음)
18
+ ├── storage/ # SQLite+FTS5 백엔드 + Markdown 내보내기
19
+ ├── search/ # FTS5 BM25 + 시맨틱 + 하이브리드
20
+ ├── extraction/ # 정규식 NER + LLM 추출기
21
+ ├── quality/ # 신뢰도, 충돌, PII 게이트
22
+ ├── session/ # 세션 관리 + Working Memory
23
+ ├── integrations/ # MCP 서버 + Python SDK
24
+ └── cli/ # 사람용 CLI 인터페이스
25
+ ```
26
+
27
+ ## Commands
28
+ - `pip install -e ".[dev]"` — 개발 설치
29
+ - `python3 -m pytest tests/ -v` — 전체 테스트
30
+ - `python3 -m engram.cli.app --db ~/.engram/memory.db init` — 메모리 DB 초기화
31
+ - `python3 -m engram.cli.app --db ~/.engram/memory.db store "텍스트"` — 정보 저장
32
+ - `python3 -m engram.cli.app --db ~/.engram/memory.db search "쿼리"` — 검색
33
+
34
+ ## Engram Memory 사용 가이드 (Claude Code용)
35
+
36
+ ### 대화에서 중요한 정보가 나왔을 때 — 저장하기
37
+
38
+ ```bash
39
+ python3 -m engram.cli.app --db ~/.engram/memory.db store "저장할 정보"
40
+ ```
41
+
42
+ ### 이전 대화에서 논의한 내용이 필요할 때 — 검색하기
43
+
44
+ ```bash
45
+ python3 -m engram.cli.app --db ~/.engram/memory.db search "검색어"
46
+ python3 -m engram.cli.app --db ~/.engram/memory.db --json search "검색어"
47
+ ```
48
+
49
+ ### 특정 인물/조직 정보 조회
50
+
51
+ ```bash
52
+ python3 -m engram.cli.app --db ~/.engram/memory.db get "엔티티 이름"
53
+ python3 -m engram.cli.app --db ~/.engram/memory.db --json get "엔티티 이름"
54
+ ```
55
+
56
+ ### Python SDK로 직접 사용 (Bash 도구에서)
57
+
58
+ ```python
59
+ python3 -c "
60
+ from pathlib import Path
61
+ from engram.config import EngramConfig
62
+ from engram.engine import MemoryEngine
63
+
64
+ engine = MemoryEngine(EngramConfig(base_dir=Path.home() / '.engram'))
65
+
66
+ # 저장
67
+ engine.store('저장할 텍스트')
68
+
69
+ # 검색
70
+ result = engine.search('검색어')
71
+ print(result.to_agent_context())
72
+
73
+ # 엔티티 조회
74
+ entity = engine.get_entity('이름')
75
+ facts = engine.get_facts('이름')
76
+
77
+ engine.close()
78
+ "
79
+ ```
80
+
81
+ ### 사용 시나리오
82
+
83
+ 1. **사용자가 새로운 정보를 공유할 때**: `store`로 저장
84
+ 2. **이전 대화 내용이 필요할 때**: `search`로 검색
85
+ 3. **특정 인물/조직 배경이 필요할 때**: `get`으로 조회
86
+ 4. **프로젝트 시작 시**: `search`로 관련 컨텍스트 로드
87
+
88
+ ## Conventions
89
+ - 커밋 메시지: 한국어 허용, 변경 이유 중심으로 작성
90
+ - 코어 엔진에 `print()` 금지 — CLI 계층에서만 출력
91
+ - 모든 메서드는 구조화된 객체를 반환 (stdout 오염 없음)
92
+ - 타입 힌트 필수, `from __future__ import annotations` 사용
93
+
94
+ ## Design Principles
95
+ 1. **에이전트 퍼스트**: MCP/SDK가 1급 인터페이스, CLI는 래퍼
96
+ 2. **LLM-Optional**: 코어는 제로 디펜던시, LLM은 선택적 플러그인
97
+ 3. **이중 레이어 저장소**: SQLite(쿼리용) + Markdown(열람용)
98
+ 4. **방어적 쓰기**: 품질 게이트 → 신뢰도 점수, 충돌 검사, PII 마스킹
99
+ 5. **세션 연속성**: 대화 ID 기반 세션, Working Memory, 컨텍스트 캐리오버
100
+ 6. **인터페이스 추상화**: storage/search/extraction 교체 가능한 Protocol
101
+
102
+ ## 3단계 검증 (3-Step Verification)
103
+
104
+ 모든 코드 변경 시 아래 3단계를 반드시 거칠 것:
105
+
106
+ ### 1단계: 설계 검증 (Design Review)
107
+ - 변경 사항이 기존 아키텍처와 일관성이 있는가?
108
+ - 불필요한 복잡도를 추가하지 않는가?
109
+ - 해당 기능의 요구사항을 정확히 반영하는가?
110
+
111
+ ### 2단계: 구현 검증 (Implementation Review)
112
+ - 코드가 정상 동작하는가? (빌드, 린트, 타입 체크)
113
+ - 보안 취약점이 없는가? (OWASP Top 10 기준)
114
+ - 에러 핸들링이 적절한가?
115
+
116
+ ### 3단계: 통합 검증 (Integration Review)
117
+ - 기존 기능에 영향을 주지 않는가?
118
+ - 테스트가 모두 통과하는가?
119
+ - 성능 저하가 없는가?
120
+
121
+ ## Code Review Protocol (코드리뷰)
122
+
123
+ "코드리뷰 진행해줘"라고 요청 시 아래 프로토콜을 따른다. 최대 15회차, 1회차씩 순차 진행. 한 번에 여러 회차 동시 진행 금지.
124
+
125
+ ### 구조: 5단계 × 3회차
126
+
127
+ | 회차 | 단계 | 포커스 영역 | 체크 항목 |
128
+ |------|------|-----------|----------|
129
+ | 1~3 | 🔴 보안/권한 | OWASP Top 10 | 인증/인가 누락, 입력 검증, SQL 인젝션, XSS, 민감정보 노출, CORS, Rate Limit |
130
+ | 4~6 | 🟠 로직/정합성 | 비즈니스 로직 | 엣지 케이스, 에러 핸들링, null/undefined 처리, 트랜잭션 정합성, 데이터 정합성 |
131
+ | 7~9 | 🟡 성능/최적화 | 쿼리/연산 | N+1 쿼리, 불필요한 재렌더링, 메모리 누수, 번들 사이즈, 캐싱 부재, 인덱스 누락 |
132
+ | 10~12 | 🔵 구조/설계 | 아키텍처 | 의존성 방향, 모듈 분리, 중복 코드, 확장성, SOLID 원칙, 패키지 경계 |
133
+ | 13~15 | ⚪ 컨벤션/가독성 | 코드 품질 | 네이밍, 타입 정확성, 일관성, 불필요한 코드, 주석 필요 여부 |
134
+
135
+ ### 회차 진행 규칙
136
+
137
+ 1. **1회차에 1개 포커스만** — 해당 단계의 포커스 영역만 리뷰
138
+ 2. **리뷰 → 수정 → 다음 리뷰** — 수정 없이 다음 회차 진행 금지 (이슈 0건 제외)
139
+ 3. **다음 회차 시작 시 이전 수정 검증** — 회귀 체크 먼저 수행
140
+
141
+ ### 조기 종료 조건
142
+
143
+ - 해당 단계 내 3회 연속 이슈 0건 → 다음 단계로 스킵
144
+ - 전체 리뷰에서 5회 연속 이슈 0건 → 코드리뷰 종료
145
+ - **최소 보장: 🔴 보안/권한 단계(1~3회차)는 반드시 수행**
146
+
147
+ ### 이슈 심각도 분류
148
+
149
+ | 등급 | 라벨 | 설명 | 수정 필수 |
150
+ |------|------|------|----------|
151
+ | P0 | [CRITICAL] | 보안 취약점, 데이터 손실 가능 | 즉시 수정 |
152
+ | P1 | [ERROR] | 기능 오작동, 로직 오류 | 반드시 수정 |
153
+ | P2 | [WARNING] | 잠재적 문제, 성능 저하 | 권장 수정 |
154
+ | P3 | [INFO] | 개선 제안, 컨벤션 | 선택 수정 |
155
+
156
+ ### 회차별 리포트 형식
157
+
158
+ ```
159
+ ## 코드리뷰 [N/15] — {단계 이모지} {단계명}
160
+
161
+ ### 이전 수정 검증
162
+ [PASS/FAIL] {이전 회차 수정 사항 검증 결과}
163
+
164
+ ### 발견 이슈
165
+ 1. [P0/P1/P2/P3] 파일명:라인 — 이슈 설명
166
+ → 수정 방안: ...
167
+
168
+ ### 요약
169
+ - 발견: N건 (Critical: N, Error: N, Warning: N, Info: N)
170
+ - 수정 필요: N건
171
+ - 현재 진행: [N/15] {단계명}
172
+ ```
173
+
174
+ ### 코드리뷰 최종 리포트
175
+
176
+ 모든 회차 종료 후 (또는 조기 종료 시) 최종 리포트 작성:
177
+
178
+ ```
179
+ ## 코드리뷰 최종 리포트
180
+ - 총 회차: N/15
181
+ - 총 발견 이슈: N건
182
+ - 수정 완료: N건
183
+ - 단계별 이슈: 🔴 N건 / 🟠 N건 / 🟡 N건 / 🔵 N건 / ⚪ N건
184
+ - 잔여 이슈: N건 (사유 명시)
185
+ ```
186
+
187
+ ## Development Rules
188
+
189
+ ### Edit Safety
190
+ - 편집 전 파일 재읽기
191
+ - 함수/타입/변수 이름 변경 시: 모든 참조 grep 후 변경
192
+ - 파일 삭제 전 참조 없음 확인
193
+
194
+ ### Context Management
195
+ - 10+ 메시지 후에는 파일 편집 전 반드시 재읽기
196
+ - 5+ 독립 파일 작업 시 서브에이전트 병렬 분배
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Engram 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.
@@ -0,0 +1,138 @@
1
+ Metadata-Version: 2.4
2
+ Name: memorytrace
3
+ Version: 0.1.0
4
+ Summary: AI agent memory system with SQLite+FTS5, MCP integration, and quality gates
5
+ Project-URL: Homepage, https://github.com/engram-memory/engram
6
+ Project-URL: Issues, https://github.com/engram-memory/engram/issues
7
+ License-Expression: MIT
8
+ License-File: LICENSE
9
+ Keywords: agent,ai,fts5,llm,mcp,memory,sqlite
10
+ Classifier: Development Status :: 3 - Alpha
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: License :: OSI Approved :: MIT License
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3.9
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
20
+ Requires-Python: >=3.9
21
+ Provides-Extra: dev
22
+ Requires-Dist: mypy>=1.10; extra == 'dev'
23
+ Requires-Dist: pytest-cov>=5.0; extra == 'dev'
24
+ Requires-Dist: pytest>=8.0; extra == 'dev'
25
+ Requires-Dist: ruff>=0.5.0; extra == 'dev'
26
+ Provides-Extra: full
27
+ Requires-Dist: engram[llm]; extra == 'full'
28
+ Requires-Dist: engram[mcp]; extra == 'full'
29
+ Requires-Dist: engram[semantic]; extra == 'full'
30
+ Provides-Extra: llm
31
+ Requires-Dist: anthropic>=0.40.0; extra == 'llm'
32
+ Requires-Dist: openai>=1.50.0; extra == 'llm'
33
+ Provides-Extra: mcp
34
+ Requires-Dist: mcp>=1.0.0; extra == 'mcp'
35
+ Provides-Extra: semantic
36
+ Requires-Dist: numpy>=1.24.0; extra == 'semantic'
37
+ Description-Content-Type: text/markdown
38
+
39
+ # Engram
40
+
41
+ AI agent memory that learns across conversations.
42
+
43
+ ## Install
44
+
45
+ ```bash
46
+ pip install git+https://github.com/aop60003/default.git
47
+ ```
48
+
49
+ ## Use
50
+
51
+ ```bash
52
+ engram save "Minseong Jeong is the Space King of Galaxy Corp"
53
+ engram find "Space King"
54
+ engram who "Minseong Jeong"
55
+ ```
56
+
57
+ That's it. 3 commands. No config, no API keys, no database setup.
58
+
59
+ ## All Commands
60
+
61
+ ```
62
+ engram save "text" Save information (auto-extracts entities & facts)
63
+ engram find "query" Search memory
64
+ engram who "name" Look up a person/org
65
+ engram remember "name" "fact" Manually remember something
66
+ engram all List everything
67
+ engram status Health check
68
+ engram forget "name" Delete an entity
69
+ engram export Export to Markdown files
70
+ ```
71
+
72
+ ## Examples
73
+
74
+ ```bash
75
+ # Store meeting notes
76
+ engram save "Met Alice Johnson, VP of Engineering at Google. Discussed cloud AI partnership."
77
+
78
+ # Store Korean
79
+ engram remember "정민성" "AI와 우주 탐사에 관심이 많다"
80
+
81
+ # Search later
82
+ engram find "Google partnership"
83
+ engram who "Alice Johnson"
84
+
85
+ # Check status
86
+ engram status
87
+ ```
88
+
89
+ ## What It Does Automatically
90
+
91
+ - **Extracts** people & organizations from text (English, Korean, Chinese, Japanese)
92
+ - **Masks PII** — phone numbers, credit cards, emails become `[REDACTED]`
93
+ - **Deduplicates** — same fact won't be stored twice
94
+ - **Detects conflicts** — "CEO" then "CTO" for same person gets flagged
95
+ - **Generates summaries** — auto-summary when you don't provide one
96
+ - **Learns across sessions** — every conversation builds on previous ones
97
+
98
+ ## For Claude Code Users
99
+
100
+ Add slash commands to use memory inside Claude Code:
101
+
102
+ ```bash
103
+ # Copy command files
104
+ mkdir -p ~/.claude/commands
105
+ # See docs/04-usage-guide/02-claude-code-setup.md for details
106
+ ```
107
+
108
+ Then use: `/memory-save`, `/memory-find`, `/memory-who`, `/memory-remember`, `/memory-status`
109
+
110
+ ## For Developers (Python SDK)
111
+
112
+ ```python
113
+ from engram.integrations.sdk import EngramSDK
114
+
115
+ with EngramSDK() as sdk:
116
+ sdk.store("Minseong Jeong is the Space King of Galaxy Corp")
117
+ result = sdk.search("Space King")
118
+ print(result.to_agent_context())
119
+ ```
120
+
121
+ ## How It Works
122
+
123
+ ```
124
+ Text → NER Extraction → Quality Gate → SQLite+FTS5 → BM25 Search
125
+
126
+ Confidence Scoring
127
+ PII Masking
128
+ Duplicate Check
129
+ Conflict Detection
130
+ ```
131
+
132
+ - **Storage**: SQLite + FTS5 (zero dependencies, genuine BM25)
133
+ - **Export**: Markdown files for human reading
134
+ - **Session**: Context carries over between conversations
135
+
136
+ ## License
137
+
138
+ MIT
@@ -0,0 +1,100 @@
1
+ # Engram
2
+
3
+ AI agent memory that learns across conversations.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ pip install git+https://github.com/aop60003/default.git
9
+ ```
10
+
11
+ ## Use
12
+
13
+ ```bash
14
+ engram save "Minseong Jeong is the Space King of Galaxy Corp"
15
+ engram find "Space King"
16
+ engram who "Minseong Jeong"
17
+ ```
18
+
19
+ That's it. 3 commands. No config, no API keys, no database setup.
20
+
21
+ ## All Commands
22
+
23
+ ```
24
+ engram save "text" Save information (auto-extracts entities & facts)
25
+ engram find "query" Search memory
26
+ engram who "name" Look up a person/org
27
+ engram remember "name" "fact" Manually remember something
28
+ engram all List everything
29
+ engram status Health check
30
+ engram forget "name" Delete an entity
31
+ engram export Export to Markdown files
32
+ ```
33
+
34
+ ## Examples
35
+
36
+ ```bash
37
+ # Store meeting notes
38
+ engram save "Met Alice Johnson, VP of Engineering at Google. Discussed cloud AI partnership."
39
+
40
+ # Store Korean
41
+ engram remember "정민성" "AI와 우주 탐사에 관심이 많다"
42
+
43
+ # Search later
44
+ engram find "Google partnership"
45
+ engram who "Alice Johnson"
46
+
47
+ # Check status
48
+ engram status
49
+ ```
50
+
51
+ ## What It Does Automatically
52
+
53
+ - **Extracts** people & organizations from text (English, Korean, Chinese, Japanese)
54
+ - **Masks PII** — phone numbers, credit cards, emails become `[REDACTED]`
55
+ - **Deduplicates** — same fact won't be stored twice
56
+ - **Detects conflicts** — "CEO" then "CTO" for same person gets flagged
57
+ - **Generates summaries** — auto-summary when you don't provide one
58
+ - **Learns across sessions** — every conversation builds on previous ones
59
+
60
+ ## For Claude Code Users
61
+
62
+ Add slash commands to use memory inside Claude Code:
63
+
64
+ ```bash
65
+ # Copy command files
66
+ mkdir -p ~/.claude/commands
67
+ # See docs/04-usage-guide/02-claude-code-setup.md for details
68
+ ```
69
+
70
+ Then use: `/memory-save`, `/memory-find`, `/memory-who`, `/memory-remember`, `/memory-status`
71
+
72
+ ## For Developers (Python SDK)
73
+
74
+ ```python
75
+ from engram.integrations.sdk import EngramSDK
76
+
77
+ with EngramSDK() as sdk:
78
+ sdk.store("Minseong Jeong is the Space King of Galaxy Corp")
79
+ result = sdk.search("Space King")
80
+ print(result.to_agent_context())
81
+ ```
82
+
83
+ ## How It Works
84
+
85
+ ```
86
+ Text → NER Extraction → Quality Gate → SQLite+FTS5 → BM25 Search
87
+
88
+ Confidence Scoring
89
+ PII Masking
90
+ Duplicate Check
91
+ Conflict Detection
92
+ ```
93
+
94
+ - **Storage**: SQLite + FTS5 (zero dependencies, genuine BM25)
95
+ - **Export**: Markdown files for human reading
96
+ - **Session**: Context carries over between conversations
97
+
98
+ ## License
99
+
100
+ MIT
@@ -0,0 +1,49 @@
1
+ # 1. 프로젝트 개요
2
+
3
+ ## MemKraft란?
4
+
5
+ MemKraft는 **AI 에이전트를 위한 제로 디펜던시 복합 메모리 시스템**이다. 핵심 철학은 "모든 대화가 다음 대화를 더 똑똑하게 만든다"는 것으로, AI 에이전트가 세션마다 처음부터 시작하는 대신 지속적이고 구조화된 메모리를 갖도록 한다.
6
+
7
+ - **저자**: Seojun Kim (simonkim.nft@gmail.com)
8
+ - **라이선스**: MIT
9
+ - **버전**: 0.1.0 (Alpha)
10
+ - **설치**: `pipx install memkraft`
11
+
12
+ ## 핵심 컨셉
13
+
14
+ ### 1. Zero Dependencies (제로 의존성)
15
+ Python 표준 라이브러리만으로 구현. 벡터 DB, spaCy, 외부 API 없이 모든 기능이 동작한다.
16
+
17
+ ### 2. Markdown as Database
18
+ 모든 지식을 사람이 읽을 수 있는 Markdown 파일로 저장한다. Git으로 추적 가능하며, 벤더 종속 없이 어떤 텍스트 에디터로든 편집 가능하다.
19
+
20
+ ### 3. Compiled Truth + Timeline
21
+ GBrain 프로젝트에서 차용한 이중 레이어 구조:
22
+ - **Compiled Truth** (상단): 현재 상태의 요약 (Executive Summary, 역할, 소속 등)
23
+ - **Timeline** (하단): 시간순 기록 (`[Source: who, channel, date]` 형식의 출처 표기 필수)
24
+
25
+ ### 4. 출처 추적 (Source Attribution)
26
+ 모든 사실에는 출처 태그가 필수다. Dream Cycle이 출처 없는 사실을 자동으로 감지하여 경고한다.
27
+ 출처 우선순위: 직접 발언 > 1차 자료 > API > 웹 > 소셜 미디어
28
+
29
+ ### 5. MECE 분류 원칙
30
+ RESOLVER.md 결정 트리를 통해 모든 정보가 정확히 하나의 "홈" 디렉토리를 갖도록 한다. 중복 저장 대신 `[[wiki-links]]`와 "See Also"로 교차 참조한다.
31
+
32
+ ## 프로젝트 포지셔닝
33
+
34
+ MemKraft는 다음 도구들과 경쟁하는 포지션에 있다:
35
+
36
+ | 경쟁사 | 차이점 |
37
+ |--------|--------|
38
+ | Mem0 | 벡터 DB 기반 vs. MemKraft의 파일 기반 |
39
+ | Cognee | 그래프 DB + LLM 파이프라인 vs. 순수 Python |
40
+ | Zep | 서버 기반 메모리 vs. 로컬 파일 시스템 |
41
+ | Letta/MemGPT | 복잡한 메모리 계층 vs. 단순한 3-tier 구조 |
42
+ | GBrain | Compiled Truth 모델의 원류 (MemKraft가 차용) |
43
+
44
+ ## 타겟 사용자
45
+
46
+ - AI 에이전트 개발자
47
+ - 지식 관리 시스템이 필요한 개인/팀
48
+ - 외부 의존성 없이 가벼운 메모리 시스템을 원하는 개발자
49
+ - 한국어/다국어 환경에서 작업하는 사용자
@@ -0,0 +1,60 @@
1
+ # 2. 기술 스택 및 의존성
2
+
3
+ ## 기술 스택 요약
4
+
5
+ | 계층 | 기술 |
6
+ |------|------|
7
+ | **언어** | Python 3.9+ (3.9 ~ 3.12 지원) |
8
+ | **의존성** | 없음 (Python 표준 라이브러리만 사용) |
9
+ | **스토리지** | 로컬 파일 시스템 (Markdown 파일) |
10
+ | **세션 로깅** | JSONL 포맷 |
11
+ | **검색 엔진** | 커스텀 BM25 스타일 IDF 가중치 토큰 스코어링 |
12
+ | **퍼지 매칭** | `difflib.SequenceMatcher` |
13
+ | **개체명 인식 (NER)** | 정규식 기반 다국어 엔티티 탐지 |
14
+ | **빌드 시스템** | setuptools (`pyproject.toml` + `setup.py`) |
15
+ | **테스트** | pytest (51개 테스트) |
16
+ | **배포** | PyPI 패키지 (CLI 엔트리포인트) |
17
+
18
+ ## 의도적으로 사용하지 않는 기술
19
+
20
+ MemKraft는 "제로 디펜던시"를 철학으로 삼고 있다. 다음 기술들을 의도적으로 배제했다:
21
+
22
+ | 일반적 선택 | MemKraft 대안 | 이유 |
23
+ |-------------|---------------|------|
24
+ | 벡터 DB (Pinecone, Chroma 등) | 커스텀 BM25 + IDF 스코어링 | 외부 의존성 제거 |
25
+ | spaCy / Transformers (NER) | 정규식 기반 탐지 | 설치 용량 및 의존성 최소화 |
26
+ | rapidfuzz (퍼지 매칭) | `difflib.SequenceMatcher` | 표준 라이브러리 활용 |
27
+ | SQLite / PostgreSQL | Markdown 파일 | 사람이 읽을 수 있는 형식 유지 |
28
+ | FastAPI / Flask (API 서버) | CLI 인터페이스 | 단순성 우선 |
29
+ | Pillow (이미지 처리) | 순수 Python PNG 생성기 | 의존성 제거 |
30
+
31
+ ## 사용하는 표준 라이브러리 모듈
32
+
33
+ - `argparse` - CLI 인자 파싱
34
+ - `pathlib` - 파일 경로 처리
35
+ - `json` - JSON 직렬화/역직렬화
36
+ - `datetime` - 날짜/시간 처리
37
+ - `re` - 정규식 패턴 매칭 (NER)
38
+ - `difflib` - 퍼지 문자열 매칭
39
+ - `math` - IDF 계산 (log)
40
+ - `collections` - Counter, defaultdict
41
+ - `shutil` - 파일 복사 (템플릿 초기화)
42
+ - `os` - 환경 변수 (`MEMKRAFT_DIR`)
43
+ - `zlib` - PNG 압축 (배너 생성 스크립트)
44
+ - `struct` - 바이너리 데이터 패킹 (PNG 생성)
45
+
46
+ ## 패키징
47
+
48
+ ```toml
49
+ # pyproject.toml 핵심 설정
50
+ [project]
51
+ name = "memkraft"
52
+ version = "0.1.0"
53
+ requires-python = ">=3.9"
54
+ dependencies = [] # 제로 디펜던시
55
+
56
+ [project.scripts]
57
+ memkraft = "memkraft.cli:main"
58
+ ```
59
+
60
+ 개발 의존성은 `pytest`만 존재한다.