entirecontext 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 (104) hide show
  1. entirecontext-0.1.0/PKG-INFO +615 -0
  2. entirecontext-0.1.0/README.md +593 -0
  3. entirecontext-0.1.0/pyproject.toml +51 -0
  4. entirecontext-0.1.0/src/entirecontext/__init__.py +3 -0
  5. entirecontext-0.1.0/src/entirecontext/cli/__init__.py +56 -0
  6. entirecontext-0.1.0/src/entirecontext/cli/ast_cmds.py +73 -0
  7. entirecontext-0.1.0/src/entirecontext/cli/blame_cmds.py +91 -0
  8. entirecontext-0.1.0/src/entirecontext/cli/checkpoint_cmds.py +316 -0
  9. entirecontext-0.1.0/src/entirecontext/cli/context_cmds.py +92 -0
  10. entirecontext-0.1.0/src/entirecontext/cli/dashboard_cmds.py +181 -0
  11. entirecontext-0.1.0/src/entirecontext/cli/decisions_cmds.py +461 -0
  12. entirecontext-0.1.0/src/entirecontext/cli/event_cmds.py +206 -0
  13. entirecontext-0.1.0/src/entirecontext/cli/futures_cmds.py +598 -0
  14. entirecontext-0.1.0/src/entirecontext/cli/graph_cmds.py +66 -0
  15. entirecontext-0.1.0/src/entirecontext/cli/helpers.py +30 -0
  16. entirecontext-0.1.0/src/entirecontext/cli/hook_cmds.py +72 -0
  17. entirecontext-0.1.0/src/entirecontext/cli/import_cmds.py +106 -0
  18. entirecontext-0.1.0/src/entirecontext/cli/index_cmds.py +50 -0
  19. entirecontext-0.1.0/src/entirecontext/cli/mcp_cmds.py +25 -0
  20. entirecontext-0.1.0/src/entirecontext/cli/project_cmds.py +522 -0
  21. entirecontext-0.1.0/src/entirecontext/cli/purge_cmds.py +121 -0
  22. entirecontext-0.1.0/src/entirecontext/cli/repo_cmds.py +47 -0
  23. entirecontext-0.1.0/src/entirecontext/cli/rewind_cmds.py +154 -0
  24. entirecontext-0.1.0/src/entirecontext/cli/search_cmds.py +250 -0
  25. entirecontext-0.1.0/src/entirecontext/cli/session_cmds.py +449 -0
  26. entirecontext-0.1.0/src/entirecontext/cli/sync_cmds.py +102 -0
  27. entirecontext-0.1.0/src/entirecontext/core/__init__.py +33 -0
  28. entirecontext-0.1.0/src/entirecontext/core/activation.py +192 -0
  29. entirecontext-0.1.0/src/entirecontext/core/agent_graph.py +203 -0
  30. entirecontext-0.1.0/src/entirecontext/core/ast_index.py +289 -0
  31. entirecontext-0.1.0/src/entirecontext/core/async_worker.py +137 -0
  32. entirecontext-0.1.0/src/entirecontext/core/attribution.py +225 -0
  33. entirecontext-0.1.0/src/entirecontext/core/checkpoint.py +129 -0
  34. entirecontext-0.1.0/src/entirecontext/core/config.py +197 -0
  35. entirecontext-0.1.0/src/entirecontext/core/consolidation.py +176 -0
  36. entirecontext-0.1.0/src/entirecontext/core/content_filter.py +77 -0
  37. entirecontext-0.1.0/src/entirecontext/core/context.py +114 -0
  38. entirecontext-0.1.0/src/entirecontext/core/cross_repo.py +490 -0
  39. entirecontext-0.1.0/src/entirecontext/core/dashboard.py +346 -0
  40. entirecontext-0.1.0/src/entirecontext/core/decisions.py +684 -0
  41. entirecontext-0.1.0/src/entirecontext/core/embedding.py +234 -0
  42. entirecontext-0.1.0/src/entirecontext/core/event.py +141 -0
  43. entirecontext-0.1.0/src/entirecontext/core/export.py +125 -0
  44. entirecontext-0.1.0/src/entirecontext/core/futures.py +338 -0
  45. entirecontext-0.1.0/src/entirecontext/core/git_utils.py +87 -0
  46. entirecontext-0.1.0/src/entirecontext/core/hybrid_search.py +14 -0
  47. entirecontext-0.1.0/src/entirecontext/core/import_aline.py +330 -0
  48. entirecontext-0.1.0/src/entirecontext/core/indexing.py +14 -0
  49. entirecontext-0.1.0/src/entirecontext/core/knowledge_graph.py +228 -0
  50. entirecontext-0.1.0/src/entirecontext/core/llm.py +178 -0
  51. entirecontext-0.1.0/src/entirecontext/core/project.py +147 -0
  52. entirecontext-0.1.0/src/entirecontext/core/purge.py +134 -0
  53. entirecontext-0.1.0/src/entirecontext/core/report.py +158 -0
  54. entirecontext-0.1.0/src/entirecontext/core/resolve.py +38 -0
  55. entirecontext-0.1.0/src/entirecontext/core/search.py +375 -0
  56. entirecontext-0.1.0/src/entirecontext/core/security.py +47 -0
  57. entirecontext-0.1.0/src/entirecontext/core/session.py +86 -0
  58. entirecontext-0.1.0/src/entirecontext/core/telemetry.py +262 -0
  59. entirecontext-0.1.0/src/entirecontext/core/tidy_pr.py +188 -0
  60. entirecontext-0.1.0/src/entirecontext/core/turn.py +96 -0
  61. entirecontext-0.1.0/src/entirecontext/db/__init__.py +17 -0
  62. entirecontext-0.1.0/src/entirecontext/db/connection.py +40 -0
  63. entirecontext-0.1.0/src/entirecontext/db/global_schema.py +21 -0
  64. entirecontext-0.1.0/src/entirecontext/db/migration.py +84 -0
  65. entirecontext-0.1.0/src/entirecontext/db/migrations/__init__.py +13 -0
  66. entirecontext-0.1.0/src/entirecontext/db/migrations/v002.py +7 -0
  67. entirecontext-0.1.0/src/entirecontext/db/migrations/v003.py +21 -0
  68. entirecontext-0.1.0/src/entirecontext/db/migrations/v004.py +18 -0
  69. entirecontext-0.1.0/src/entirecontext/db/migrations/v005.py +14 -0
  70. entirecontext-0.1.0/src/entirecontext/db/migrations/v006.py +46 -0
  71. entirecontext-0.1.0/src/entirecontext/db/migrations/v007.py +59 -0
  72. entirecontext-0.1.0/src/entirecontext/db/migrations/v008.py +23 -0
  73. entirecontext-0.1.0/src/entirecontext/db/migrations/v009.py +56 -0
  74. entirecontext-0.1.0/src/entirecontext/db/migrations/v010.py +22 -0
  75. entirecontext-0.1.0/src/entirecontext/db/migrations/v011.py +35 -0
  76. entirecontext-0.1.0/src/entirecontext/db/schema.py +584 -0
  77. entirecontext-0.1.0/src/entirecontext/hooks/__init__.py +5 -0
  78. entirecontext-0.1.0/src/entirecontext/hooks/codex_ingest.py +297 -0
  79. entirecontext-0.1.0/src/entirecontext/hooks/decision_hooks.py +239 -0
  80. entirecontext-0.1.0/src/entirecontext/hooks/handler.py +124 -0
  81. entirecontext-0.1.0/src/entirecontext/hooks/session_lifecycle.py +517 -0
  82. entirecontext-0.1.0/src/entirecontext/hooks/transcript_parser.py +53 -0
  83. entirecontext-0.1.0/src/entirecontext/hooks/turn_capture.py +226 -0
  84. entirecontext-0.1.0/src/entirecontext/mcp/__init__.py +5 -0
  85. entirecontext-0.1.0/src/entirecontext/mcp/runtime.py +135 -0
  86. entirecontext-0.1.0/src/entirecontext/mcp/server.py +135 -0
  87. entirecontext-0.1.0/src/entirecontext/mcp/tools/__init__.py +1 -0
  88. entirecontext-0.1.0/src/entirecontext/mcp/tools/checkpoint.py +154 -0
  89. entirecontext-0.1.0/src/entirecontext/mcp/tools/decisions.py +215 -0
  90. entirecontext-0.1.0/src/entirecontext/mcp/tools/futures.py +181 -0
  91. entirecontext-0.1.0/src/entirecontext/mcp/tools/misc.py +39 -0
  92. entirecontext-0.1.0/src/entirecontext/mcp/tools/search.py +270 -0
  93. entirecontext-0.1.0/src/entirecontext/mcp/tools/session.py +284 -0
  94. entirecontext-0.1.0/src/entirecontext/sync/__init__.py +18 -0
  95. entirecontext-0.1.0/src/entirecontext/sync/artifact_merge.py +74 -0
  96. entirecontext-0.1.0/src/entirecontext/sync/auto_sync.py +146 -0
  97. entirecontext-0.1.0/src/entirecontext/sync/coordinator.py +348 -0
  98. entirecontext-0.1.0/src/entirecontext/sync/engine.py +75 -0
  99. entirecontext-0.1.0/src/entirecontext/sync/export_flow.py +40 -0
  100. entirecontext-0.1.0/src/entirecontext/sync/exporter.py +127 -0
  101. entirecontext-0.1.0/src/entirecontext/sync/git_transport.py +96 -0
  102. entirecontext-0.1.0/src/entirecontext/sync/merge.py +127 -0
  103. entirecontext-0.1.0/src/entirecontext/sync/security.py +26 -0
  104. entirecontext-0.1.0/src/entirecontext/sync/shadow_branch.py +63 -0
@@ -0,0 +1,615 @@
1
+ Metadata-Version: 2.3
2
+ Name: entirecontext
3
+ Version: 0.1.0
4
+ Summary: Time-travel searchable agent memory anchored to your codebase
5
+ Author: Jaehoon You
6
+ Author-email: Jaehoon You <teslamint@gmail.com>
7
+ License: MIT
8
+ Requires-Dist: typer>=0.15.0
9
+ Requires-Dist: rich>=13.0.0
10
+ Requires-Dist: pyjwt>=2.12.0
11
+ Requires-Dist: pygments>=2.20.0
12
+ Requires-Dist: pytest>=8.0.0 ; extra == 'dev'
13
+ Requires-Dist: pytest-cov>=6.0.0 ; extra == 'dev'
14
+ Requires-Dist: ruff>=0.9.0 ; extra == 'dev'
15
+ Requires-Dist: mcp>=1.0.0 ; extra == 'mcp'
16
+ Requires-Dist: sentence-transformers>=3.0.0 ; extra == 'semantic'
17
+ Requires-Python: >=3.12
18
+ Provides-Extra: dev
19
+ Provides-Extra: mcp
20
+ Provides-Extra: semantic
21
+ Description-Content-Type: text/markdown
22
+
23
+ # EntireContext
24
+
25
+ **Git-anchored decision memory for coding agents.**
26
+
27
+ ![Python 3.12+](https://img.shields.io/badge/python-3.12%2B-blue) ![Version 0.1.0](https://img.shields.io/badge/version-0.1.0-green) ![Status Experimental](https://img.shields.io/badge/status-experimental-orange) ![License MIT](https://img.shields.io/badge/license-MIT-lightgrey)
28
+
29
+ > ⚠️ **Experimental** — API and data format may change without notice.
30
+
31
+ EntireContext captures AI coding work as it happens, distills decisions and lessons from it, and brings the right context back when similar code changes happen again.
32
+
33
+ ## Why It Exists
34
+
35
+ AI coding tools generate changes quickly, but engineering judgment still gets buried in chat logs. Important decisions, rejected alternatives, and hard-won lessons disappear across sessions, repos, and agents, so teams keep rediscovering the same context.
36
+
37
+ EntireContext turns session history into reusable engineering memory tied to commits, diffs, checkpoints, and files instead of leaving it as raw transcript storage.
38
+
39
+ ## Core Product Loop
40
+
41
+ - **Capture** — sessions, turns, tool calls, and checkpoints are recorded through hooks and anchored to git history
42
+ - **Distill** — assessments, feedback, and lessons convert raw session history into reusable judgment
43
+ - **Retrieve** — search, graph traversal, attribution, and rewind surface the most relevant prior context
44
+ - **Intervene** — agents and humans can apply past decisions before the next related change lands
45
+
46
+ ## What Makes EntireContext Different
47
+
48
+ - **Git-anchored memory** — context is tied to commits, branches, diffs, and checkpoints
49
+ - **Decision-oriented, not chat-oriented** — the goal is reusable engineering judgment, not transcript hoarding
50
+ - **Built for coding agents** — native hook integration plus MCP access for in-session retrieval
51
+ - **Per-repo and cross-repo** — preserve local project context while allowing broader learning patterns
52
+
53
+ ## Key Capabilities
54
+
55
+ - **Decision capture and assessment** — futures assessments, typed relationships, feedback loops, and lessons
56
+ - **Git time-travel** — checkpoints, rewind, blame, and historical inspection
57
+ - **Context retrieval** — regex, FTS5, semantic, and hybrid search across sessions and repos
58
+ - **Agent-facing interfaces** — MCP tools for search, checkpoints, assessments, graph traversal, and trends
59
+ - **Operational support** — sync, filtering, consolidation, dashboarding, export, and migration tools
60
+
61
+ ## Who It's For
62
+
63
+ - Engineers already using coding agents in day-to-day development
64
+ - Small teams that want decisions and lessons to accumulate instead of disappearing into chat history
65
+ - Repositories where historical intent matters as much as the final diff
66
+
67
+ ## AGENTS.md Templates
68
+
69
+ If you want agents to reuse stored decisions consistently, start from these templates:
70
+
71
+ - `entirecontext` maintainers: [docs/templates/entirecontext-maintainer-decision-reuse-template.md](docs/templates/entirecontext-maintainer-decision-reuse-template.md)
72
+ - Projects using EntireContext: [docs/templates/entirecontext-user-decision-reuse-template.md](docs/templates/entirecontext-user-decision-reuse-template.md)
73
+
74
+ ### Adding Proactive EntireContext Guidance
75
+
76
+ If you also want agents to proactively check broader EntireContext memory, add a repository-specific section to your `AGENTS.md`.
77
+
78
+ Recommended placement:
79
+
80
+ - Near other agent workflow rules or memory lookup rules
81
+ - Immediately after any OneContext/Aline history-search block if you already have one
82
+ - Keep the `<!-- ENTIRECONTEXT:START -->` and `<!-- ENTIRECONTEXT:END -->` markers so the block is easy to find and update later
83
+
84
+ This complements the decision-reuse templates above. Use it when you want agents to check not only decisions, but also assessments, lessons, checkpoints, attribution, sessions, and turns before answering or implementing non-trivial work.
85
+
86
+ Example block to add:
87
+
88
+ ```md
89
+ <!-- ENTIRECONTEXT:START -->
90
+ ## EntireContext - Proactive Memory Reuse
91
+
92
+ When the repository has EntireContext available, **proactively** use EntireContext
93
+ before answering questions about existing code, prior decisions, debugging context,
94
+ historical implementation details, repeated regressions, or earlier agent work.
95
+ Do not wait for the user to explicitly ask for a memory lookup.
96
+
97
+ Prefer EntireContext first for repository-scoped memory such as decisions,
98
+ assessments, lessons, checkpoints, attribution, sessions, and turns.
99
+ Use OneContext/Aline as a fallback when the user explicitly asks for Aline history
100
+ or when EntireContext does not contain the needed context.
101
+
102
+ Scenarios to proactively use EntireContext:
103
+ - User asks "why was X implemented this way?" or asks for prior rationale
104
+ - User is debugging behavior that may have previous fixes, regressions, or lessons
105
+ - User references a function, file, subsystem, checkpoint, session, or decision that may already exist in memory
106
+ - The task changes behavior, policy, schema, interface, lifecycle, sync, ranking, hooks, telemetry, or other long-lived system behavior
107
+ - You need prior assessments, lessons, attribution, or related turns before proposing non-trivial changes
108
+
109
+ Preferred retrieval order:
110
+ 1. Decision-specific lookup (`ec_decision_related`, `ec_decision_list`, `ec_decision_get`)
111
+ 2. Broader repo memory lookup (`ec_related`, `ec_search`, `ec_session_context`)
112
+ 3. Deep inspection (`ec_turn_content`, `ec_checkpoint_list`, `ec_attribution`, `ec_lessons`, `ec_assess_trends`)
113
+
114
+ If no relevant EntireContext records exist, state that explicitly before proceeding
115
+ with new reasoning.
116
+
117
+ ### Decision Capture — Recording What Was Decided
118
+
119
+ Retrieval alone loses decisions that were never recorded. Proactively **create**
120
+ decision records during the session, not only at the end.
121
+
122
+ When to record a decision (`ec_decision_create`):
123
+ - You compared alternatives and chose one (record what was rejected and why)
124
+ - You changed architecture, module boundaries, data flow, or public interfaces
125
+ - You established a convention, policy, or constraint that future work should follow
126
+ - A debugging session revealed a root cause that changes how the system should behave
127
+
128
+ When to record a decision outcome (`ec_decision_outcome`):
129
+ - Completed work confirmed, contradicted, refined, or replaced a prior decision
130
+ - A decision was applied and the result validated or invalidated its rationale
131
+
132
+ Capture timing:
133
+ - Record **during** the session as decisions happen — do not defer to SessionEnd
134
+ - SessionEnd auto-extraction (`maybe_extract_decisions`) is a fallback, not the primary path
135
+ - If you realize a past session made an unrecorded decision, record it retroactively
136
+ <!-- ENTIRECONTEXT:END -->
137
+ ```
138
+
139
+ ## Quick Start
140
+
141
+ Choose an install path first:
142
+
143
+ - **Local dependency** (inside a Python/uv project)
144
+ - **Global install (optional)** for using `ec` as a standalone CLI across any repo
145
+
146
+ Use **global install (optional)** when you want `ec` like an app/tool.
147
+ Use **local dependency** when you want to manage `entirecontext` in a Python project's dependencies.
148
+
149
+ ```bash
150
+ # 1A. Local dependency (Python/uv project)
151
+ uv add entirecontext
152
+ # or: pip install entirecontext
153
+ ```
154
+
155
+ ```bash
156
+ # 1B. Global install (optional, recommended for non-Python repos)
157
+ uv tool install entirecontext
158
+ # alternative:
159
+ pipx install entirecontext
160
+ ```
161
+
162
+ Use the same workflow after either install path:
163
+
164
+ ```bash
165
+ # 2. Initialize in your repo
166
+ cd your-project
167
+ ec init
168
+
169
+ # 3. Install Claude Code hooks
170
+ ec enable
171
+
172
+ # 4. Use Claude Code as usual — sessions are captured automatically
173
+
174
+ # 5. Query your history
175
+ ec search "authentication"
176
+ ec search "refactor" --fts
177
+ ec session list
178
+ ec blame src/main.py
179
+ ec checkpoint list
180
+ ```
181
+
182
+ ### Windows Notes
183
+
184
+ - Install alternative (Python launcher): `py -m pip install entirecontext`
185
+ - PowerShell example:
186
+ ```powershell
187
+ ec init
188
+ ec enable
189
+ ec search "authentication"
190
+ ```
191
+ - If `ec` is not recognized, open a new terminal (or sign out/in) so updated PATH is loaded.
192
+ - For `uv tool`/`pipx` installs, ensure the scripts directory is on PATH.
193
+
194
+ ## CLI Reference
195
+
196
+ The sections below are reference material for the current CLI surface. They stay close to the implemented interface on purpose so the product narrative above does not drift from what the tool actually does.
197
+
198
+ ### Top-Level Commands
199
+
200
+ | Command | Description |
201
+ |---------|-------------|
202
+ | `ec init` | Initialize EntireContext in current git repo |
203
+ | `ec enable [--no-git-hooks]` | Install Claude Code hooks and git hooks (skip git hooks with `--no-git-hooks`) |
204
+ | `ec disable` | Remove Claude Code hooks |
205
+ | `ec status` | Show capture status (project, sessions, turns, active session) |
206
+ | `ec config [KEY] [VALUE]` | Get or set configuration (dotted keys) |
207
+ | `ec doctor` | Diagnose issues (schema, hooks, unsynced checkpoints) |
208
+ | `ec search QUERY` | Search across sessions, turns, and events |
209
+ | `ec blame FILE [-L START,END] [--summary]` | Show per-line human/agent attribution |
210
+ | `ec rewind CHECKPOINT_ID` | Show or restore code state at a checkpoint |
211
+ | `ec sync [--no-filter]` | Export to shadow branch, then push with one automatic artifact-merge retry on non-fast-forward (skip secret filtering with `--no-filter`) |
212
+ | `ec pull` | Fetch latest `origin` shadow branch snapshot and import |
213
+ | `ec index [--semantic] [--force] [--model NAME]` | Rebuild FTS5 indexes, optionally generate embeddings |
214
+ | `ec dashboard [--since DATE] [--limit N]` | Show team dashboard: sessions, checkpoints, assessment trends |
215
+ | `ec graph [--session ID] [--since DATE] [--limit N]` | Show knowledge graph of git entities |
216
+ | `ec ast-search QUERY [--type TYPE] [--file PATH] [--limit N]` | Search indexed Python AST symbols |
217
+
218
+ ### `ec session` Subcommands
219
+
220
+ | Command | Description |
221
+ |---------|-------------|
222
+ | `ec session list` | List sessions (with turn counts and status) |
223
+ | `ec session show SESSION_ID` | Show session details and turn summaries |
224
+ | `ec session current` | Show current active session |
225
+ | `ec session export ID [--output FILE]` | Export session as Markdown (YAML frontmatter + sections) |
226
+ | `ec session graph [--agent ID] [--session ID] [--depth N]` | Visualise multi-agent session graph |
227
+ | `ec session activate [--turn ID] [--session ID] [--hops N] [--limit N]` | Find related turns via spreading activation |
228
+ | `ec session consolidate [--before DATE] [--session ID] [--limit N] [--execute]` | Compress old turn content (dry-run by default) |
229
+
230
+ ### `ec checkpoint` Subcommands
231
+
232
+ | Command | Description |
233
+ |---------|-------------|
234
+ | `ec checkpoint list` | List checkpoints (commit, branch, diff summary) |
235
+ | `ec checkpoint show CHECKPOINT_ID` | Show checkpoint details and file snapshot |
236
+ | `ec checkpoint diff ID1 ID2` | Diff between two checkpoints |
237
+
238
+ ### `ec event` Subcommands
239
+
240
+ | Command | Description |
241
+ |---------|-------------|
242
+ | `ec event list` | List events (filter by `--status`, `--type`) |
243
+ | `ec event show EVENT_ID` | Show event details and linked sessions |
244
+ | `ec event create TITLE` | Create event (`--type task\|temporal\|milestone`) |
245
+ | `ec event link EVENT_ID SESSION_ID` | Link a session to an event |
246
+
247
+ ### `ec futures` Subcommands
248
+
249
+ | Command | Description |
250
+ |---------|-------------|
251
+ | `ec futures assess [-c CHECKPOINT] [-r ROADMAP] [-m MODEL] [-b BACKEND]` | Assess staged diff or checkpoint against roadmap via LLM |
252
+ | `ec futures list [-v VERDICT] [-n LIMIT]` | List assessments (filter by `--verdict`) |
253
+ | `ec futures feedback ID FEEDBACK [-r REASON]` | Add agree/disagree feedback to an assessment |
254
+ | `ec futures lessons [-o OUTPUT] [-s SINCE]` | Generate LESSONS.md from assessed changes with feedback |
255
+ | `ec futures trend [--since DATE] [--limit N]` | Show cross-repo assessment trend analysis |
256
+ | `ec futures relate SRC TYPE TGT [--note TEXT]` | Add typed relationship between assessments |
257
+ | `ec futures relationships ID [--direction DIR]` | List relationships for an assessment |
258
+ | `ec futures unrelate SRC TYPE TGT` | Remove a typed relationship |
259
+ | `ec futures tidy-pr [--since DATE] [--limit N] [--output FILE]` | Generate tidy PR draft from narrow assessments |
260
+ | `ec futures report [--since DATE] [--limit N] [--output FILE]` | Generate team-shareable Markdown report |
261
+ | `ec futures worker-status` | Show background assessment worker status |
262
+ | `ec futures worker-stop` | Stop background assessment worker |
263
+ | `ec futures worker-launch [--diff TEXT]` | Launch background assessment worker |
264
+ | `ec decision create TITLE [--rationale TEXT] [--scope TEXT]` | Create a decision record |
265
+ | `ec decision list [--status STATUS] [--file PATH] [--limit N]` | List decisions (optional staleness/file filter) |
266
+ | `ec decision show DECISION_ID` | Show decision details and linked artifacts |
267
+ | `ec decision link DECISION_ID [--assessment ID\|--checkpoint ID\|--commit SHA\|--file PATH]` | Link decision to assessment/checkpoint/commit/file |
268
+ | `ec decision stale DECISION_ID --status STATUS` | Update decision staleness (`fresh\|stale\|superseded\|contradicted`) |
269
+
270
+ ### LLM Backends (`ec futures assess`)
271
+
272
+ | Backend | Flag | Auth | Default Model |
273
+ |---------|------|------|---------------|
274
+ | `openai` | `-b openai` | `OPENAI_API_KEY` | `gpt-4o-mini` |
275
+ | `github` | `-b github` | `GITHUB_TOKEN` | `openai/gpt-4o-mini` |
276
+ | `ollama` | `-b ollama` | None (local) | `llama3` |
277
+ | `codex` | `-b codex` | CLI subprocess | — |
278
+ | `claude` | `-b claude` | CLI subprocess | — |
279
+
280
+ ### `ec purge` Subcommands
281
+
282
+ | Command | Description |
283
+ |---------|-------------|
284
+ | `ec purge session SESSION_ID [--execute] [--force]` | Purge a session and all its turns (dry-run by default) |
285
+ | `ec purge turn TURN_ID... [--execute]` | Purge specific turns by ID |
286
+ | `ec purge match PATTERN [--execute] [--force]` | Purge turns matching a regex pattern |
287
+
288
+ ### `ec import` Command
289
+
290
+ | Command | Description |
291
+ |---------|-------------|
292
+ | `ec import --from-aline [PATH]` | Import sessions/turns/checkpoints from Aline DB |
293
+
294
+ Options: `--workspace`, `--dry-run`, `--skip-content`
295
+
296
+ ### `ec repo` Subcommands
297
+
298
+ | Command | Description |
299
+ |---------|-------------|
300
+ | `ec repo list` | List all registered EntireContext projects |
301
+
302
+ ### Common Flags
303
+
304
+ | Flag | Description |
305
+ |------|-------------|
306
+ | `-g`, `--global` | Search/list across all registered repos |
307
+ | `-r`, `--repo NAME` | Filter by repo name (repeatable) |
308
+ | `-n`, `--limit N` | Max results (default 20) |
309
+
310
+ ### Search Options
311
+
312
+ | Flag | Description |
313
+ |------|-------------|
314
+ | `--fts` | Use FTS5 full-text search |
315
+ | `--semantic` | Use semantic search (requires `entirecontext[semantic]`) |
316
+ | `--hybrid` | Use hybrid search (FTS5 + recency RRF reranking) |
317
+ | `--file PATH` | Filter by file path |
318
+ | `--commit HASH` | Filter by commit hash |
319
+ | `--agent TYPE` | Filter by agent type |
320
+ | `--since ISO8601` | Filter by date |
321
+ | `-t TARGET` | Search target: `turn` (default), `session`, `event`, `content` |
322
+
323
+ ## MCP Server
324
+
325
+ EntireContext exposes the same retrieval and assessment primitives to coding agents over MCP so the memory loop can run inside active coding sessions, not only through the CLI.
326
+
327
+ ### Automatic Setup
328
+
329
+ `ec enable` automatically registers the MCP server in `~/.claude/settings.json` (user-level):
330
+
331
+ ```bash
332
+ ec enable # installs hooks AND configures MCP server
333
+ ec doctor # verify MCP config is present
334
+ ```
335
+
336
+ This is idempotent — running `ec enable` again skips the MCP entry if it already exists. `ec disable` removes hooks but preserves the MCP config (other repos may use it).
337
+
338
+ ### Manual Setup
339
+
340
+ To configure manually, add to `~/.claude/settings.json`:
341
+
342
+ ```json
343
+ {
344
+ "mcpServers": {
345
+ "entirecontext": {
346
+ "command": "ec",
347
+ "args": ["mcp", "serve"],
348
+ "type": "stdio"
349
+ }
350
+ }
351
+ }
352
+ ```
353
+
354
+ ### Manual Removal
355
+
356
+ To remove the MCP server, delete the `entirecontext` key from `~/.claude/settings.json`:
357
+
358
+ ```bash
359
+ # Remove MCP config (use jq or edit manually)
360
+ jq 'del(.mcpServers.entirecontext)' ~/.claude/settings.json > tmp.json && mv tmp.json ~/.claude/settings.json
361
+ ```
362
+
363
+ ### Standalone Server
364
+
365
+ To run the MCP server directly (e.g. for debugging):
366
+
367
+ ```bash
368
+ ec mcp serve
369
+ ```
370
+
371
+ ### Available Tools
372
+
373
+ | Tool | Description |
374
+ |------|-------------|
375
+ | `ec_search` | Search turns/sessions with regex or FTS5. Filters: `file_filter`, `commit_filter`, `agent_filter`, `since` |
376
+ | `ec_checkpoint_list` | List checkpoints, optionally filtered by `session_id` and `since` |
377
+ | `ec_session_context` | Get session details with recent turns. Auto-detects current session if `session_id` omitted |
378
+ | `ec_attribution` | Get human/agent attribution for a file, with optional line range |
379
+ | `ec_rewind` | Show state at a specific checkpoint |
380
+ | `ec_related` | Find related sessions/turns by query text or file paths |
381
+ | `ec_turn_content` | Get full content for a specific turn (including JSONL content files) |
382
+ | `ec_assess` | Assess staged diff or checkpoint against roadmap via LLM |
383
+ | `ec_assess_create` | Create an assessment programmatically (verdict, impact, suggestion) |
384
+ | `ec_feedback` | Add agree/disagree feedback to an assessment |
385
+ | `ec_lessons` | Generate LESSONS.md from assessed changes with feedback |
386
+ | `ec_assess_trends` | Cross-repo assessment trend analysis (verdict distribution, feedback stats) |
387
+
388
+ All tools accept a `repos` parameter for cross-repo queries: `null` = current repo, `["*"]` = all repos, `["name"]` = specific repos.
389
+
390
+ ## Hook System
391
+
392
+ `ec enable` installs two kinds of hooks automatically. No manual intervention required.
393
+
394
+ ### Claude Code Hooks (`.claude/settings.local.json`)
395
+
396
+ | Hook Type | Trigger | Action |
397
+ |-----------|---------|--------|
398
+ | `SessionStart` | Claude Code session begins | Create/resume session record |
399
+ | `UserPromptSubmit` | User sends a message | Record turn start |
400
+ | `Stop` | Assistant completes response | Record turn end with summary |
401
+ | `PostToolUse` | Tool call completes | Track files touched and tools used |
402
+ | `SessionEnd` | Claude Code session ends | Finalize session, generate summary |
403
+
404
+ Hook protocol: stdin JSON, exit code 0 = success, 2 = block.
405
+
406
+ ### Git Hooks (`.git/hooks/`)
407
+
408
+ | Hook | Trigger | Action |
409
+ |------|---------|--------|
410
+ | `post-commit` | `git commit` | Create checkpoint tied to the new commit if a session is active |
411
+ | `pre-push` | `git push` | Run `ec sync` if `auto_sync_on_push` is enabled |
412
+
413
+ Skip git hook installation with `ec enable --no-git-hooks`. Both hooks are removed by `ec disable`.
414
+
415
+ ## Configuration
416
+
417
+ Config merges in order: **defaults** ← **global** (`~/.entirecontext/config.toml`) ← **per-repo** (`.entirecontext/config.toml`).
418
+
419
+ ### Default Configuration
420
+
421
+ ```toml
422
+ [capture]
423
+ auto_capture = true
424
+ checkpoint_on_commit = true
425
+
426
+ [capture.exclusions]
427
+ enabled = false
428
+ content_patterns = [] # regex — skip turns matching these
429
+ file_patterns = [] # glob — exclude files from tracking
430
+ tool_names = [] # exact — skip tool usage recording
431
+ redact_patterns = [] # regex — replace matches with [FILTERED] before storage
432
+
433
+ [search]
434
+ default_mode = "regex"
435
+ semantic_model = "all-MiniLM-L6-v2"
436
+
437
+ [sync]
438
+ auto_sync = false
439
+ auto_pull = false
440
+ cooldown_seconds = 300
441
+ pull_staleness_seconds = 600
442
+ push_on_sync = true
443
+ quiet = true
444
+
445
+ [display]
446
+ max_results = 20
447
+ color = true
448
+
449
+ [security]
450
+ filter_secrets = true
451
+ patterns = [
452
+ '(?i)(api[_-]?key|secret|password|token)\s*[=:]\s*[\'"]?[\w-]+',
453
+ '(?i)bearer\s+[\w.-]+',
454
+ 'ghp_[a-zA-Z0-9]{36}',
455
+ 'sk-[a-zA-Z0-9]{48}',
456
+ ]
457
+
458
+ [filtering.query_redaction]
459
+ enabled = false
460
+ patterns = [] # regex — redact matches in search/MCP results
461
+ replacement = "[FILTERED]"
462
+ ```
463
+
464
+ ### CLI Usage
465
+
466
+ ```bash
467
+ ec config # show all config
468
+ ec config search.default_mode # get a value
469
+ ec config search.default_mode fts # set a value
470
+ ec config security.filter_secrets true # set a value
471
+ ```
472
+
473
+ ## Sync Policy
474
+
475
+ Shadow branch sync uses artifact-level merge only on `entirecontext/checkpoints/v1`.
476
+
477
+ - `ec sync` performs one automatic retry only, and only when the first push is rejected as non-fast-forward.
478
+ - The retry path fetches `origin/entirecontext/checkpoints/v1`, merges exported artifacts, creates a new commit, and pushes again.
479
+ - `ec pull` imports from the latest `origin/<shadow-branch>` remote-tracking snapshot, not from the local shadow branch.
480
+ - There is no git conflict UI and no general git 3-way merge support in this path.
481
+ - Artifact merge policy:
482
+ - `manifest.json`: key union; higher `total_turns` wins for duplicate session entries.
483
+ - `sessions/<id>/meta.json`: higher `total_turns` wins; ties preserve non-null fields; `started_at` uses earlier value; `ended_at` uses later value.
484
+ - `sessions/<id>/transcript.jsonl`: deduplicate by turn `id`.
485
+ - `checkpoints/*.json`: filename union.
486
+ - Malformed remote artifacts, missing remote shadow snapshots, and retry push failures are explicit sync errors.
487
+
488
+ ## Architecture
489
+
490
+ Sessions, turns, and checkpoints flow from Claude Code hooks through the core business logic into SQLite, with optional export via shadow branch sync.
491
+
492
+ ```
493
+ CLI (Typer) → core/ → db/ → hooks/ → sync/
494
+ cli/ business SQLite Claude Code shadow branch
495
+ project_cmds logic schema integration export/import
496
+ session_cmds config migration turn capture merge
497
+ search_cmds security connection session lifecycle
498
+ hook_cmds cross_repo
499
+ checkpoint_cmds attribution
500
+ sync_cmds event
501
+ rewind_cmds indexing
502
+ repo_cmds search
503
+ event_cmds futures
504
+ blame_cmds llm
505
+ index_cmds import_aline
506
+ mcp_cmds content_filter
507
+ futures_cmds purge
508
+ import_cmds export
509
+ purge_cmds report
510
+ graph_cmds tidy_pr
511
+ ast_cmds dashboard
512
+ dashboard_cmds ast_index
513
+ knowledge_graph
514
+ agent_graph
515
+ activation
516
+ consolidation
517
+ hybrid_search
518
+ async_worker
519
+
520
+ mcp/server.py — MCP server interface (optional dependency)
521
+ ```
522
+
523
+ ### Data Model
524
+
525
+ | Table | Purpose |
526
+ |-------|---------|
527
+ | `projects` | Registered repos (name, path, remote URL) |
528
+ | `sessions` | Captured sessions (type, title, summary, turn count) |
529
+ | `turns` | Individual turns (user message, assistant summary, files touched) |
530
+ | `turn_content` | JSONL content file references for full turn data |
531
+ | `checkpoints` | Git-anchored snapshots (commit hash, branch, file snapshot, diff) |
532
+ | `agents` | Agent identities (type, role, parent agent) |
533
+ | `events` | Grouping mechanism (task / temporal / milestone) |
534
+ | `event_sessions` | Many-to-many link between events and sessions |
535
+ | `event_checkpoints` | Many-to-many link between events and checkpoints |
536
+ | `assessments` | Futures assessment results (verdict, impact, feedback) |
537
+ | `assessment_relationships` | Typed links between assessments (causes/fixes/contradicts) |
538
+ | `attributions` | Per-line human/agent file attribution |
539
+ | `embeddings` | Semantic search vectors |
540
+ | `ast_symbols` | Python AST symbol index (functions, classes, methods) |
541
+ | `sync_metadata` | Shadow branch sync state |
542
+
543
+ FTS5 virtual tables: `fts_turns`, `fts_events`, `fts_sessions`, `fts_ast_symbols` — auto-synced via triggers.
544
+
545
+ ### Data Locations
546
+
547
+ | Path | Contents |
548
+ |------|----------|
549
+ | `.entirecontext/db/local.db` | Per-repo SQLite database |
550
+ | `.entirecontext/content/` | JSONL turn content files |
551
+ | `.entirecontext/config.toml` | Per-repo configuration |
552
+ | `~/.entirecontext/db/ec.db` | Global database (cross-repo registry) |
553
+ | `~/.entirecontext/config.toml` | Global configuration |
554
+
555
+ ## Development
556
+
557
+ ```bash
558
+ git clone https://github.com/teslamint/entirecontext.git
559
+ cd entirecontext
560
+ uv sync --extra dev
561
+ ```
562
+
563
+ ### Run Tests
564
+
565
+ ```bash
566
+ uv run pytest # all tests
567
+ uv run pytest tests/test_core.py # single file
568
+ uv run pytest -k "test_search" # by name pattern
569
+ uv run pytest --cov=entirecontext # with coverage
570
+ ```
571
+
572
+ ### Lint & Format
573
+
574
+ ```bash
575
+ uv run ruff format . # format (line-length 120)
576
+ uv run ruff check . --fix # lint + autofix
577
+ ```
578
+
579
+ ### Optional Extras
580
+
581
+ | Extra | Dependencies | Purpose |
582
+ |-------|-------------|---------|
583
+ | `dev` | pytest, pytest-cov, ruff | Testing and linting |
584
+ | `semantic` | sentence-transformers | Semantic search with embeddings |
585
+ | `mcp` | mcp | MCP server for AI agent integration |
586
+
587
+ Install extras: `uv sync --extra dev --extra semantic --extra mcp`
588
+
589
+ ## Development Context
590
+ This project's entire AI development history is available
591
+ on the `entirecontext/checkpoints/v1` branch.
592
+
593
+ ## Acknowledgments
594
+
595
+ EntireContext was inspired by:
596
+
597
+ - [entireio/cli](https://github.com/entireio/cli) — Git-integrated AI agent session capture and context management
598
+ - [TheAgentContextLab/OneContext](https://github.com/TheAgentContextLab/OneContext) — Agent self-managed context layer for unified AI agent memory
599
+ - The **Futures Assessment** feature (`ec futures`) is inspired by Kent Beck's [Earn *And* Learn](https://tidyfirst.substack.com/p/earn-and-learn) and the [Tidy First](https://tidyfirst.substack.com/) philosophy — analyzing whether each change expands or narrows your project's future options.
600
+
601
+ ## License
602
+
603
+ [MIT](LICENSE)
604
+
605
+
606
+ ### Decision / Assessment / Lesson roles
607
+
608
+ - **Decision**: reusable engineering intent (what/why/scope), linked to files, checkpoints, and assessments.
609
+ - **Assessment**: point-in-time evaluation of a diff/checkpoint (expand/narrow/neutral) using Tidy First framing.
610
+ - **Lesson**: assessment + feedback distilled into guidance for future changes.
611
+
612
+ ### MCP Decision Tools
613
+
614
+ - `ec_decision_get(decision_id)` — resolve decision by full or prefix ID.
615
+ - `ec_decision_related(files?, assessment_ids?, diff_text?, limit?)` — rank linked decisions by file overlap, assessment relations, and diff text match.