projectmem 0.3.4__tar.gz → 0.3.5__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 (79) hide show
  1. {projectmem-0.3.4 → projectmem-0.3.5}/CHANGELOG.md +24 -0
  2. {projectmem-0.3.4 → projectmem-0.3.5}/PKG-INFO +40 -12
  3. {projectmem-0.3.4 → projectmem-0.3.5}/README.md +39 -11
  4. {projectmem-0.3.4 → projectmem-0.3.5}/TUTORIAL.md +1 -1
  5. {projectmem-0.3.4 → projectmem-0.3.5}/pyproject.toml +1 -1
  6. {projectmem-0.3.4 → projectmem-0.3.5}/src/projectmem/__init__.py +1 -1
  7. {projectmem-0.3.4 → projectmem-0.3.5}/src/projectmem/commands/dashboard.py +2 -1
  8. {projectmem-0.3.4 → projectmem-0.3.5}/src/projectmem/commands/init.py +1 -1
  9. {projectmem-0.3.4 → projectmem-0.3.5}/src/projectmem/commands/precheck.py +60 -19
  10. {projectmem-0.3.4 → projectmem-0.3.5}/src/projectmem/mcp_server.py +31 -11
  11. {projectmem-0.3.4 → projectmem-0.3.5}/src/projectmem/staleness.py +92 -19
  12. {projectmem-0.3.4 → projectmem-0.3.5}/src/projectmem/storage.py +10 -3
  13. {projectmem-0.3.4 → projectmem-0.3.5}/src/projectmem/summary.py +29 -16
  14. {projectmem-0.3.4 → projectmem-0.3.5}/tests/test_agent_guidance.py +31 -1
  15. {projectmem-0.3.4 → projectmem-0.3.5}/tests/test_instructions_refresh.py +1 -0
  16. {projectmem-0.3.4 → projectmem-0.3.5}/tests/test_mcp_server.py +96 -0
  17. {projectmem-0.3.4 → projectmem-0.3.5}/tests/test_staleness_repair.py +97 -0
  18. {projectmem-0.3.4 → projectmem-0.3.5}/tests/test_summary.py +103 -2
  19. {projectmem-0.3.4 → projectmem-0.3.5}/.gitignore +0 -0
  20. {projectmem-0.3.4 → projectmem-0.3.5}/LICENSE +0 -0
  21. {projectmem-0.3.4 → projectmem-0.3.5}/SECURITY.md +0 -0
  22. {projectmem-0.3.4 → projectmem-0.3.5}/llms.txt +0 -0
  23. {projectmem-0.3.4 → projectmem-0.3.5}/src/projectmem/cli.py +0 -0
  24. {projectmem-0.3.4 → projectmem-0.3.5}/src/projectmem/commands/__init__.py +0 -0
  25. {projectmem-0.3.4 → projectmem-0.3.5}/src/projectmem/commands/attempt.py +0 -0
  26. {projectmem-0.3.4 → projectmem-0.3.5}/src/projectmem/commands/auto_capture.py +0 -0
  27. {projectmem-0.3.4 → projectmem-0.3.5}/src/projectmem/commands/backfill.py +0 -0
  28. {projectmem-0.3.4 → projectmem-0.3.5}/src/projectmem/commands/brief.py +0 -0
  29. {projectmem-0.3.4 → projectmem-0.3.5}/src/projectmem/commands/context.py +0 -0
  30. {projectmem-0.3.4 → projectmem-0.3.5}/src/projectmem/commands/decision.py +0 -0
  31. {projectmem-0.3.4 → projectmem-0.3.5}/src/projectmem/commands/doctor.py +0 -0
  32. {projectmem-0.3.4 → projectmem-0.3.5}/src/projectmem/commands/export.py +0 -0
  33. {projectmem-0.3.4 → projectmem-0.3.5}/src/projectmem/commands/fix.py +0 -0
  34. {projectmem-0.3.4 → projectmem-0.3.5}/src/projectmem/commands/global_cmd.py +0 -0
  35. {projectmem-0.3.4 → projectmem-0.3.5}/src/projectmem/commands/hooks.py +0 -0
  36. {projectmem-0.3.4 → projectmem-0.3.5}/src/projectmem/commands/instructions.py +0 -0
  37. {projectmem-0.3.4 → projectmem-0.3.5}/src/projectmem/commands/log.py +0 -0
  38. {projectmem-0.3.4 → projectmem-0.3.5}/src/projectmem/commands/map.py +0 -0
  39. {projectmem-0.3.4 → projectmem-0.3.5}/src/projectmem/commands/note.py +0 -0
  40. {projectmem-0.3.4 → projectmem-0.3.5}/src/projectmem/commands/plan.py +0 -0
  41. {projectmem-0.3.4 → projectmem-0.3.5}/src/projectmem/commands/project.py +0 -0
  42. {projectmem-0.3.4 → projectmem-0.3.5}/src/projectmem/commands/regenerate.py +0 -0
  43. {projectmem-0.3.4 → projectmem-0.3.5}/src/projectmem/commands/score.py +0 -0
  44. {projectmem-0.3.4 → projectmem-0.3.5}/src/projectmem/commands/search.py +0 -0
  45. {projectmem-0.3.4 → projectmem-0.3.5}/src/projectmem/commands/show.py +0 -0
  46. {projectmem-0.3.4 → projectmem-0.3.5}/src/projectmem/commands/stats.py +0 -0
  47. {projectmem-0.3.4 → projectmem-0.3.5}/src/projectmem/commands/visualize.py +0 -0
  48. {projectmem-0.3.4 → projectmem-0.3.5}/src/projectmem/commands/watch.py +0 -0
  49. {projectmem-0.3.4 → projectmem-0.3.5}/src/projectmem/commands/wrap.py +0 -0
  50. {projectmem-0.3.4 → projectmem-0.3.5}/src/projectmem/global_memory.py +0 -0
  51. {projectmem-0.3.4 → projectmem-0.3.5}/src/projectmem/glyphs.py +0 -0
  52. {projectmem-0.3.4 → projectmem-0.3.5}/src/projectmem/models.py +0 -0
  53. {projectmem-0.3.4 → projectmem-0.3.5}/src/projectmem/project_registry.py +0 -0
  54. {projectmem-0.3.4 → projectmem-0.3.5}/src/projectmem/redaction.py +0 -0
  55. {projectmem-0.3.4 → projectmem-0.3.5}/src/projectmem/resolver.py +0 -0
  56. {projectmem-0.3.4 → projectmem-0.3.5}/src/projectmem/search.py +0 -0
  57. {projectmem-0.3.4 → projectmem-0.3.5}/src/projectmem/structure.py +0 -0
  58. {projectmem-0.3.4 → projectmem-0.3.5}/tests/conftest.py +0 -0
  59. {projectmem-0.3.4 → projectmem-0.3.5}/tests/test_attempt.py +0 -0
  60. {projectmem-0.3.4 → projectmem-0.3.5}/tests/test_auto_capture.py +0 -0
  61. {projectmem-0.3.4 → projectmem-0.3.5}/tests/test_client_config_discovery.py +0 -0
  62. {projectmem-0.3.4 → projectmem-0.3.5}/tests/test_dashboard.py +0 -0
  63. {projectmem-0.3.4 → projectmem-0.3.5}/tests/test_global_mcp.py +0 -0
  64. {projectmem-0.3.4 → projectmem-0.3.5}/tests/test_hooks_path.py +0 -0
  65. {projectmem-0.3.4 → projectmem-0.3.5}/tests/test_init.py +0 -0
  66. {projectmem-0.3.4 → projectmem-0.3.5}/tests/test_init_ux.py +0 -0
  67. {projectmem-0.3.4 → projectmem-0.3.5}/tests/test_location_parsing.py +0 -0
  68. {projectmem-0.3.4 → projectmem-0.3.5}/tests/test_log.py +0 -0
  69. {projectmem-0.3.4 → projectmem-0.3.5}/tests/test_plan.py +0 -0
  70. {projectmem-0.3.4 → projectmem-0.3.5}/tests/test_redaction.py +0 -0
  71. {projectmem-0.3.4 → projectmem-0.3.5}/tests/test_search.py +0 -0
  72. {projectmem-0.3.4 → projectmem-0.3.5}/tests/test_showoff.py +0 -0
  73. {projectmem-0.3.4 → projectmem-0.3.5}/tests/test_staleness_performance.py +0 -0
  74. {projectmem-0.3.4 → projectmem-0.3.5}/tests/test_structure.py +0 -0
  75. {projectmem-0.3.4 → projectmem-0.3.5}/tests/test_v014_features.py +0 -0
  76. {projectmem-0.3.4 → projectmem-0.3.5}/tests/test_visualize.py +0 -0
  77. {projectmem-0.3.4 → projectmem-0.3.5}/tests/test_watch.py +0 -0
  78. {projectmem-0.3.4 → projectmem-0.3.5}/tests/test_windows_console_encoding.py +0 -0
  79. {projectmem-0.3.4 → projectmem-0.3.5}/tests/test_windows_hooks_and_context.py +0 -0
@@ -1,5 +1,29 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.3.5
4
+
5
+ **Two community fixes: precheck recognises a file however its path is spelled, and the summary stays small even when entries are long.**
6
+
7
+ ### Fixed
8
+
9
+ - **`precheck_file` called a file with known failures "Safe to modify" when its path was spelled differently.** Events store project-relative paths, so `./src/auth.py`, an absolute path, a path through a symlinked folder, a backslash path or a Windows `C:\` path matched nothing. Every path, the one being checked and the ones in the log, is now made project-relative before matching, and two spellings of one file give one set of warnings. A decision logged at an absolute path is now also judged stale for the right file. Matching got faster as well: checking 5 files against a 3,000-event log went from 663 ms to 163 ms. ([#26](https://github.com/riponcm/projectmem/pull/26))
10
+
11
+ - **`get_issue` missed unpadded ids and passed raw input to a file glob.** `get_issue("1")` and `get_issue("#1")` now find issue 0001, as `pjm fix` does, and backfilled `legacy_…` ids work. Input containing `*`, `?` or `[` is refused instead of matching some other issue. ([#26](https://github.com/riponcm/projectmem/pull/26))
12
+
13
+ - **`summary.md` could still cost ~9,000–12,000 tokens on an aged project.** 0.3.4 capped how many entries the summary shows, but not how long each one is. Each record is now clipped at 300 characters, with line breaks folded first and locations kept whole. A fixed issue is one line (id, title, location), and its details are one `get_issue` call away. Open issues still show their last 3 failed or partial attempts. On a real 238-event project, the summary went from 8,974 to 3,458 tokens. ([#29](https://github.com/riponcm/projectmem/issues/29), [#30](https://github.com/riponcm/projectmem/pull/30))
14
+
15
+ - **`precheck_file("")` reported the whole log.** An empty string is part of every summary, so a blank path matched every failed attempt and open issue. Blank paths are now ignored, and whitespace around a path is trimmed.
16
+
17
+ - A whitespace-only location rendered as `[]` in the summary and hid the fix's location. It now counts as no location.
18
+
19
+ ### Changed
20
+
21
+ - **`AI_INSTRUCTIONS.md` asks for shorter records:** issue titles under 140 characters, everything else under 300. The five write tools say the same in their argument descriptions. Because the template changed, run `pjm init` once in each project. It refreshes the file and keeps your previous copy as `AI_INSTRUCTIONS.md.bak`, so merge back anything you added by hand.
22
+
23
+ - **Token figures corrected.** The guidance said `get_summary` costs "a few hundred to ~1,500 tokens". That was measured on short synthetic entries, and a real project with long entries was far above it ([#29](https://github.com/riponcm/projectmem/issues/29)). It now says a few hundred on a young project and a few thousand on an aged one. The README's per-session estimate also left out `get_instructions`, which agents read first in every session and which is about 3,300 tokens on its own. The table now counts it and gives measured figures: on nine real projects, the three files read at session start total about 3,700 to 7,600 tokens.
24
+
25
+ The fixes for #26 were contributed by [@vishalhabib99](https://github.com/vishalhabib99), and #29 was reported and fixed by [@bigfree](https://github.com/bigfree).
26
+
3
27
  ## 0.3.4
4
28
 
5
29
  **Three reports, three community fixes, and six more bugs found by checking them.** Each report below was reproduced end to end before it was fixed, and each fix was reviewed by someone other than its author.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: projectmem
3
- Version: 0.3.4
3
+ Version: 0.3.5
4
4
  Summary: Coding agent memory — local-first memory and judgment for AI coding agents. One MCP server for every project; warns before repeating failed fixes.
5
5
  Project-URL: Homepage, https://projectmem.dev
6
6
  Project-URL: Repository, https://github.com/riponcm/projectmem
@@ -37,8 +37,8 @@ Description-Content-Type: text/markdown
37
37
  <img src="https://raw.githubusercontent.com/projectmem/projectmemdoc/main/logo/projectmem-wordmark-800.png" alt="projectmem" width="420" />
38
38
 
39
39
  <p>
40
- <a href="https://github.com/riponcm/projectmem/blob/main/CHANGELOG.md"><b>🎉 v0.3.4 is out</b></a> —
41
- the summary stays small as your project ages, commits are filed under the code they change, and stale warnings no longer depend on your time zone.
40
+ <a href="https://github.com/riponcm/projectmem/blob/main/CHANGELOG.md"><b>🎉 v0.3.5 is out</b></a> —
41
+ precheck recognises a file however its path is spelled, and the summary stays small even when entries are long.
42
42
  <a href="https://github.com/riponcm/projectmem/blob/main/CHANGELOG.md">See what changed →</a>
43
43
  </p>
44
44
 
@@ -196,7 +196,7 @@ cd your-project && pjm init
196
196
  |---|---|
197
197
  | **[Complete setup guide](https://projectmem.dev/blog/projectmem-complete-guide-ai-coding-agent-memory)** | The full walkthrough on the web — install, MCP setup per client, `pjm doctor`, your first logged issue, and both dashboards. Every terminal output is captured from a real run. |
198
198
  | **[TUTORIAL.md](https://github.com/riponcm/projectmem/blob/main/TUTORIAL.md)** | 15-minute step-by-step walkthrough — set up projectmem on your own project, watch the lifecycle, see the pre-commit warning fire. |
199
- | **[CHANGELOG.md](https://github.com/riponcm/projectmem/blob/main/CHANGELOG.md)** | Release history. Latest: v0.3.4 — fixes for three community reports, a bounded summary, and a time-zone regression from 0.3.3. |
199
+ | **[CHANGELOG.md](https://github.com/riponcm/projectmem/blob/main/CHANGELOG.md)** | Release history. Latest: v0.3.5 — precheck matches every spelling of a path, and long entries no longer bloat the summary. |
200
200
  | **[Research paper (arXiv:2606.12329)](https://arxiv.org/abs/2606.12329)** | *PROJECTMEM: A Local-First, Event-Sourced Memory and Judgment Layer for AI Coding Agents* — the peer-readable version: design, Memory-as-Governance framing, capability comparison, and the 207-event dogfooding study. |
201
201
  | **[LICENSE](https://github.com/riponcm/projectmem/blob/main/LICENSE)** | MIT |
202
202
 
@@ -233,6 +233,30 @@ That's it. `pjm init` installs three git hooks (pre-commit warnings, post-commit
233
233
 
234
234
  ---
235
235
 
236
+ ## ✨ New in 0.3.5 — warnings for every spelling, and a summary that stays small
237
+
238
+ **Precheck recognises a file however its path is spelled.** Events store
239
+ project-relative paths, so asking about `./src/auth.py`, an absolute path, a
240
+ path through a symlinked folder or a Windows `C:\` path matched nothing, and
241
+ precheck called a file with known failures "Safe to modify". Every spelling now
242
+ gets the same warnings, and checking is faster on large logs.
243
+ `get_issue("1")` and `get_issue("#1")` find issue 0001.
244
+ ([#26](https://github.com/riponcm/projectmem/pull/26))
245
+
246
+ **Long entries no longer bloat the summary.** 0.3.4 capped how many entries
247
+ the summary shows, not how long each one is. Records are now clipped at 300
248
+ characters, and a fixed issue takes one line. On a real 238-event project the
249
+ summary went from 8,974 tokens to 3,458.
250
+ ([#29](https://github.com/riponcm/projectmem/issues/29),
251
+ [#30](https://github.com/riponcm/projectmem/pull/30))
252
+
253
+ **Upgrading? Run `pjm init` once in each project.** The instructions now ask
254
+ agents for shorter records, and `pjm init` refreshes `AI_INSTRUCTIONS.md`,
255
+ keeping your previous copy as `AI_INSTRUCTIONS.md.bak`.
256
+
257
+ The #26 fixes were contributed by [@vishalhabib99](https://github.com/vishalhabib99),
258
+ and #29 was reported and fixed by [@bigfree](https://github.com/bigfree).
259
+
236
260
  ## ✨ New in 0.3.4 — memory that stays small, and warnings you can trust
237
261
 
238
262
  **The summary no longer grows forever.** Notes were capped, but Recent issues
@@ -481,15 +505,19 @@ Want a source supported? [Open an issue](https://github.com/riponcm/projectmem/i
481
505
 
482
506
  The architecture is built around one rule: **AI reads small, distilled files. Tools generate them from the big raw log.**
483
507
 
484
- *Estimates, not benchmarks.* Measured on the 0.3.4 summary itself: about 250
485
- tokens for a young project and about 1,100 for one with 25 issues and 60
486
- decisions; more when many issues are open.
508
+ *Measured on 0.3.5 with the `cl100k_base` tokenizer, on nine real projects of
509
+ 9 to 238 events.* At session start an agent reads three files.
510
+ `AI_INSTRUCTIONS.md` is about 3,300 tokens and costs the same in every project.
511
+ `summary.md` ranged from about 400 to 3,500 tokens, and `PROJECT_MAP.md` from
512
+ about 100 to 900. A synthetic worst case with 40 open issues and long entries in
513
+ every record brings the summary to about 6,300. The baseline and `pjm wrap` rows
514
+ are estimates.
487
515
 
488
- | Access mode | Tokens / session (estimate) | How it works |
516
+ | Access mode | Tokens / session | How it works |
489
517
  |---|---|---|
490
518
  | No projectmem (baseline) | 5,000 – 20,000+ | AI re-reads source files every session |
491
- | Universal Mode (markdown) | ~2,500 | AI reads 3 small distilled files once |
492
- | **MCP Mode** *(recommended)* | **~800 – 1,500** | AI calls `get_summary()`, then `get_issue(issue_id)` only when relevant |
519
+ | Universal Mode (markdown) | ~3,700 – 7,600 | AI reads 3 distilled files once |
520
+ | **MCP Mode** *(recommended)* | **~3,700 – 7,600** at session start | AI calls `get_instructions()`, `get_summary()` and `get_project_map()`, then `get_issue(issue_id)` or `precheck_file(file_path)` only when relevant |
493
521
  | `pjm wrap` (pre-injection) | 500 – 2,000 | Pre-generated, you set the budget |
494
522
 
495
523
  **AI never reads `events.jsonl` directly.** That file is for tools (`pjm score`, `pjm context`, `pjm wrap`). Tools distill the raw log into compact AI-readable summaries.
@@ -896,7 +924,7 @@ projectmem is described in a peer-readable research paper:
896
924
 
897
925
  > **PROJECTMEM: A Local-First, Event-Sourced Memory and Judgment Layer for AI Coding Agents**
898
926
  > Ripon Chandra Malo, Tong Qiu — University of Utah
899
- > [arXiv:2606.12329](https://arxiv.org/abs/2606.12329) · cs.SE (cross-list cs.AI)
927
+ > [arXiv:2606.12329](https://arxiv.org/abs/2606.12329) · cs.AI
900
928
 
901
929
  The paper introduces the **Memory-as-Governance** framing — memory that doesn't merely answer the agent but acts on its next action — and reports the design, the deterministic pre-commit judgment gate, a capability comparison against 12 contemporary memory systems, and a two-month, 207-event dogfooding study across 10 real projects.
902
930
 
@@ -910,7 +938,7 @@ If projectmem is useful in your research or writing, please cite:
910
938
  year = {2026},
911
939
  eprint = {2606.12329},
912
940
  archivePrefix = {arXiv},
913
- primaryClass = {cs.SE},
941
+ primaryClass = {cs.AI},
914
942
  url = {https://arxiv.org/abs/2606.12329}
915
943
  }
916
944
  ```
@@ -4,8 +4,8 @@
4
4
  <img src="https://raw.githubusercontent.com/projectmem/projectmemdoc/main/logo/projectmem-wordmark-800.png" alt="projectmem" width="420" />
5
5
 
6
6
  <p>
7
- <a href="https://github.com/riponcm/projectmem/blob/main/CHANGELOG.md"><b>🎉 v0.3.4 is out</b></a> —
8
- the summary stays small as your project ages, commits are filed under the code they change, and stale warnings no longer depend on your time zone.
7
+ <a href="https://github.com/riponcm/projectmem/blob/main/CHANGELOG.md"><b>🎉 v0.3.5 is out</b></a> —
8
+ precheck recognises a file however its path is spelled, and the summary stays small even when entries are long.
9
9
  <a href="https://github.com/riponcm/projectmem/blob/main/CHANGELOG.md">See what changed →</a>
10
10
  </p>
11
11
 
@@ -163,7 +163,7 @@ cd your-project && pjm init
163
163
  |---|---|
164
164
  | **[Complete setup guide](https://projectmem.dev/blog/projectmem-complete-guide-ai-coding-agent-memory)** | The full walkthrough on the web — install, MCP setup per client, `pjm doctor`, your first logged issue, and both dashboards. Every terminal output is captured from a real run. |
165
165
  | **[TUTORIAL.md](https://github.com/riponcm/projectmem/blob/main/TUTORIAL.md)** | 15-minute step-by-step walkthrough — set up projectmem on your own project, watch the lifecycle, see the pre-commit warning fire. |
166
- | **[CHANGELOG.md](https://github.com/riponcm/projectmem/blob/main/CHANGELOG.md)** | Release history. Latest: v0.3.4 — fixes for three community reports, a bounded summary, and a time-zone regression from 0.3.3. |
166
+ | **[CHANGELOG.md](https://github.com/riponcm/projectmem/blob/main/CHANGELOG.md)** | Release history. Latest: v0.3.5 — precheck matches every spelling of a path, and long entries no longer bloat the summary. |
167
167
  | **[Research paper (arXiv:2606.12329)](https://arxiv.org/abs/2606.12329)** | *PROJECTMEM: A Local-First, Event-Sourced Memory and Judgment Layer for AI Coding Agents* — the peer-readable version: design, Memory-as-Governance framing, capability comparison, and the 207-event dogfooding study. |
168
168
  | **[LICENSE](https://github.com/riponcm/projectmem/blob/main/LICENSE)** | MIT |
169
169
 
@@ -200,6 +200,30 @@ That's it. `pjm init` installs three git hooks (pre-commit warnings, post-commit
200
200
 
201
201
  ---
202
202
 
203
+ ## ✨ New in 0.3.5 — warnings for every spelling, and a summary that stays small
204
+
205
+ **Precheck recognises a file however its path is spelled.** Events store
206
+ project-relative paths, so asking about `./src/auth.py`, an absolute path, a
207
+ path through a symlinked folder or a Windows `C:\` path matched nothing, and
208
+ precheck called a file with known failures "Safe to modify". Every spelling now
209
+ gets the same warnings, and checking is faster on large logs.
210
+ `get_issue("1")` and `get_issue("#1")` find issue 0001.
211
+ ([#26](https://github.com/riponcm/projectmem/pull/26))
212
+
213
+ **Long entries no longer bloat the summary.** 0.3.4 capped how many entries
214
+ the summary shows, not how long each one is. Records are now clipped at 300
215
+ characters, and a fixed issue takes one line. On a real 238-event project the
216
+ summary went from 8,974 tokens to 3,458.
217
+ ([#29](https://github.com/riponcm/projectmem/issues/29),
218
+ [#30](https://github.com/riponcm/projectmem/pull/30))
219
+
220
+ **Upgrading? Run `pjm init` once in each project.** The instructions now ask
221
+ agents for shorter records, and `pjm init` refreshes `AI_INSTRUCTIONS.md`,
222
+ keeping your previous copy as `AI_INSTRUCTIONS.md.bak`.
223
+
224
+ The #26 fixes were contributed by [@vishalhabib99](https://github.com/vishalhabib99),
225
+ and #29 was reported and fixed by [@bigfree](https://github.com/bigfree).
226
+
203
227
  ## ✨ New in 0.3.4 — memory that stays small, and warnings you can trust
204
228
 
205
229
  **The summary no longer grows forever.** Notes were capped, but Recent issues
@@ -448,15 +472,19 @@ Want a source supported? [Open an issue](https://github.com/riponcm/projectmem/i
448
472
 
449
473
  The architecture is built around one rule: **AI reads small, distilled files. Tools generate them from the big raw log.**
450
474
 
451
- *Estimates, not benchmarks.* Measured on the 0.3.4 summary itself: about 250
452
- tokens for a young project and about 1,100 for one with 25 issues and 60
453
- decisions; more when many issues are open.
475
+ *Measured on 0.3.5 with the `cl100k_base` tokenizer, on nine real projects of
476
+ 9 to 238 events.* At session start an agent reads three files.
477
+ `AI_INSTRUCTIONS.md` is about 3,300 tokens and costs the same in every project.
478
+ `summary.md` ranged from about 400 to 3,500 tokens, and `PROJECT_MAP.md` from
479
+ about 100 to 900. A synthetic worst case with 40 open issues and long entries in
480
+ every record brings the summary to about 6,300. The baseline and `pjm wrap` rows
481
+ are estimates.
454
482
 
455
- | Access mode | Tokens / session (estimate) | How it works |
483
+ | Access mode | Tokens / session | How it works |
456
484
  |---|---|---|
457
485
  | No projectmem (baseline) | 5,000 – 20,000+ | AI re-reads source files every session |
458
- | Universal Mode (markdown) | ~2,500 | AI reads 3 small distilled files once |
459
- | **MCP Mode** *(recommended)* | **~800 – 1,500** | AI calls `get_summary()`, then `get_issue(issue_id)` only when relevant |
486
+ | Universal Mode (markdown) | ~3,700 – 7,600 | AI reads 3 distilled files once |
487
+ | **MCP Mode** *(recommended)* | **~3,700 – 7,600** at session start | AI calls `get_instructions()`, `get_summary()` and `get_project_map()`, then `get_issue(issue_id)` or `precheck_file(file_path)` only when relevant |
460
488
  | `pjm wrap` (pre-injection) | 500 – 2,000 | Pre-generated, you set the budget |
461
489
 
462
490
  **AI never reads `events.jsonl` directly.** That file is for tools (`pjm score`, `pjm context`, `pjm wrap`). Tools distill the raw log into compact AI-readable summaries.
@@ -863,7 +891,7 @@ projectmem is described in a peer-readable research paper:
863
891
 
864
892
  > **PROJECTMEM: A Local-First, Event-Sourced Memory and Judgment Layer for AI Coding Agents**
865
893
  > Ripon Chandra Malo, Tong Qiu — University of Utah
866
- > [arXiv:2606.12329](https://arxiv.org/abs/2606.12329) · cs.SE (cross-list cs.AI)
894
+ > [arXiv:2606.12329](https://arxiv.org/abs/2606.12329) · cs.AI
867
895
 
868
896
  The paper introduces the **Memory-as-Governance** framing — memory that doesn't merely answer the agent but acts on its next action — and reports the design, the deterministic pre-commit judgment gate, a capability comparison against 12 contemporary memory systems, and a two-month, 207-event dogfooding study across 10 real projects.
869
897
 
@@ -877,7 +905,7 @@ If projectmem is useful in your research or writing, please cite:
877
905
  year = {2026},
878
906
  eprint = {2606.12329},
879
907
  archivePrefix = {arXiv},
880
- primaryClass = {cs.SE},
908
+ primaryClass = {cs.AI},
881
909
  url = {https://arxiv.org/abs/2606.12329}
882
910
  }
883
911
  ```
@@ -243,5 +243,5 @@ In about 15 minutes you exercised every part of projectmem:
243
243
 
244
244
  ---
245
245
 
246
- *Last updated for projectmem 0.3.4 — see the [changelog](CHANGELOG.md) for what
246
+ *Last updated for projectmem 0.3.5 — see the [changelog](CHANGELOG.md) for what
247
247
  changed since.*
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "projectmem"
7
- version = "0.3.4"
7
+ version = "0.3.5"
8
8
  description = "Coding agent memory — local-first memory and judgment for AI coding agents. One MCP server for every project; warns before repeating failed fixes."
9
9
  authors = [{ name = "Ripon Chandra Malo" }]
10
10
  readme = "README.md"
@@ -1,3 +1,3 @@
1
1
  """Local-first memory for repos."""
2
2
 
3
- __version__ = "0.3.4"
3
+ __version__ = "0.3.5"
@@ -603,7 +603,8 @@ code{font-family:ui-monospace,Menlo,monospace;background:#DFE7F3;padding:1px 5px
603
603
  <div class="foot">100% local · aggregated at read-time from each repo's <code>.projectmem/</code> · nothing ever leaves your machine · <a href="https://github.com/riponcm/projectmem" target="_blank" rel="noopener">★ GitHub</a> · <a href="https://projectmem.dev/guide" target="_blank" rel="noopener">Docs</a>
604
604
  &middot; projectmem <b id="pm-ver">{{PJM_VERSION}}</b>
605
605
  <a id="pm-check" role="button" tabindex="0" style="cursor:pointer;border-bottom:1px dotted currentColor">check for updates</a>
606
- <br><span style="opacity:.8">Also from the same maker: <a href="https://ossdrop.com" target="_blank" rel="noopener">OSSDrop</a> — a curated home for open-source tools. Drop yours.</span></div>
606
+ <br><span style="opacity:.8">Also from the same maker: <a href="https://ossdrop.com" target="_blank" rel="noopener">OSSDrop</a> — a curated home for open-source tools. Drop yours.
607
+ &middot; <a href="https://jharu.matily.org" target="_blank" rel="noopener">Jharu</a> — a free disk cleaner for dev caches and the git worktrees coding agents leave behind.</span></div>
607
608
  </div>
608
609
  <script>
609
610
  var DATA={{DASH_DATA}};
@@ -182,7 +182,7 @@ def _claude_md_bridge(project_name: str | None = None) -> str:
182
182
  "summary file regenerates from `events.jsonl` automatically — write\n"
183
183
  "via the MCP tools and the summary will follow.\n\n"
184
184
  "Do not re-scan source files when MCP tools can give you the same\n"
185
- "answer in a few hundred tokens instead of thousands. This is not optional.\n"
185
+ "answer for a fraction of the tokens a re-scan costs. This is not optional.\n"
186
186
  f"{_CLAUDE_MD_BRIDGE_END}\n"
187
187
  )
188
188
 
@@ -28,7 +28,7 @@ import typer
28
28
 
29
29
  from projectmem.glyphs import RULE
30
30
  from projectmem.models import Event, location_to_file, superseded_ids
31
- from projectmem.staleness import is_memory_path
31
+ from projectmem.staleness import is_memory_path, project_relative, root_posix_of
32
32
  from projectmem.storage import MEM_DIR, read_events, require_mem_dir
33
33
 
34
34
 
@@ -256,7 +256,18 @@ def _analyze_files(
256
256
  # own doing: checking it reported "HIGH CHURN: 7 changes in last 30 days /
257
257
  # May indicate unresolved architectural issue" about the memory layer.
258
258
  # Filtered here, not in the callers, so the MCP precheck_file path is covered.
259
- files = [f for f in files if not is_memory_path(f, root)]
259
+ root_posix = root_posix_of(root)
260
+ files = [f for f in files if not is_memory_path(f, root, root_posix=root_posix)]
261
+ # Events store project-relative paths; `./src/a.py` or an absolute path
262
+ # matched nothing and came back "Safe to modify". Two spellings of one
263
+ # file are one file, and the root itself ("." once anchored) is not a file
264
+ # at all: as a summary match it would hit every event with a period in it.
265
+ # A blank path is worse: "" is in every summary, so it matched the whole log.
266
+ files = list(dict.fromkeys(
267
+ rel for f in files
268
+ if f.strip()
269
+ and (rel := project_relative(f.strip(), root, root_posix=root_posix)) != "."
270
+ ))
260
271
  if not files:
261
272
  return warnings
262
273
 
@@ -278,9 +289,12 @@ def _analyze_files(
278
289
  except Exception:
279
290
  stale_by_file = defaultdict(list)
280
291
 
292
+ # Every event's paths normalized once, not once per checked file.
293
+ live_paths = _live_event_paths(events, root, root_posix)
294
+
281
295
  for file_path in files:
282
296
  # Find all events referencing this file
283
- file_events = _events_for_file(file_path, events)
297
+ file_events = _events_for_file(file_path, events, root, live_paths)
284
298
 
285
299
  if not file_events:
286
300
  continue
@@ -419,32 +433,59 @@ def _analyze_files(
419
433
  return warnings
420
434
 
421
435
 
422
- def _events_for_file(file_path: str, events: list[Event]) -> list[Event]:
436
+ def _events_for_file(
437
+ file_path: str,
438
+ events: list[Event],
439
+ root: Path | None = None,
440
+ live_paths: list[tuple[Event, frozenset[str]]] | None = None,
441
+ ) -> list[Event]:
423
442
  """Return all live events that reference this file.
424
443
 
425
444
  Superseded events are excluded. Warning someone off an approach on the
426
445
  strength of a decision they explicitly retired is worse than not warning
427
446
  at all — it makes the memory look wrong at the moment it interrupts you.
447
+
448
+ ``live_paths`` is ``_live_event_paths(events, root)``; pass it when asking
449
+ about several files so the log is normalized once.
450
+ """
451
+ if live_paths is None:
452
+ live_paths = _live_event_paths(events, root)
453
+ return [
454
+ e for e, paths in live_paths
455
+ # Direct files list or location field, then a summary mention
456
+ if file_path in paths or file_path in e.summary
457
+ ]
458
+
459
+
460
+ def _live_event_paths(
461
+ events: list[Event], root: Path | None = None, root_posix: str | None = None
462
+ ) -> list[tuple[Event, frozenset[str]]]:
463
+ """Each live event with the project-relative spellings of the files it
464
+ cites (``files`` plus the location's file), in log order.
465
+
466
+ One pass over the log, with each distinct raw path normalized once: logs
467
+ repeat the same few paths thousands of times, and precheck runs before
468
+ every edit.
428
469
  """
470
+ root_posix = root_posix or root_posix_of(root)
429
471
  retired = superseded_ids(events)
430
- matching: list[Event] = []
472
+ cache: dict[str, str] = {}
473
+
474
+ def rel(path: str) -> str:
475
+ if path not in cache:
476
+ cache[path] = project_relative(path, root, root_posix=root_posix)
477
+ return cache[path]
478
+
479
+ out: list[tuple[Event, frozenset[str]]] = []
431
480
  for e in events:
432
481
  if e.id in retired:
433
482
  continue
434
- # Direct files list
435
- if file_path in e.files:
436
- matching.append(e)
437
- continue
438
- # Location field
439
- if e.location:
440
- loc_file = location_to_file(e.location) or ""
441
- if loc_file == file_path:
442
- matching.append(e)
443
- continue
444
- # Summary mention
445
- if file_path in e.summary:
446
- matching.append(e)
447
- return matching
483
+ paths = {rel(f) for f in e.files}
484
+ loc_file = location_to_file(e.location) if e.location else None
485
+ if loc_file:
486
+ paths.add(rel(loc_file))
487
+ out.append((e, frozenset(paths)))
488
+ return out
448
489
 
449
490
 
450
491
  def _find_open_issues(
@@ -32,6 +32,7 @@ import contextlib
32
32
  import functools
33
33
  import io
34
34
  import os
35
+ import re
35
36
  import sys
36
37
  from pathlib import Path
37
38
  from typing import Annotated, Callable, Optional
@@ -48,6 +49,8 @@ from pydantic import Field
48
49
 
49
50
  from projectmem.commands import attempt, decision, fix, log, note
50
51
  from projectmem.storage import (
52
+ RECORD_CHARS,
53
+ TITLE_CHARS,
51
54
  ai_instructions_path,
52
55
  discover_mem_dir,
53
56
  project_map_path,
@@ -57,6 +60,13 @@ from projectmem.storage import (
57
60
  )
58
61
 
59
62
 
63
+ _TITLE_LENGTH = f" Keep it under {TITLE_CHARS} characters."
64
+ _RECORD_LENGTH = (
65
+ f" Keep it under {RECORD_CHARS} characters: summary.md clips longer text."
66
+ )
67
+ _FIX_LENGTH = f" Keep it under {RECORD_CHARS} characters."
68
+
69
+
60
70
  # ── L-005: pin the project root before tools run ────────────────────────
61
71
 
62
72
  def _resolve_project_root() -> Path | None:
@@ -188,9 +198,9 @@ mcp = FastMCP(
188
198
  "You are connected to projectmem — a mandatory project memory + "
189
199
  "judgment layer. The tools below are FAR cheaper than re-deriving "
190
200
  "the same information from source: get_summary returns a bounded "
191
- "snapshot, typically a few hundred to ~1,500 tokens; re-scanning the "
192
- "project to answer the same question usually costs several times "
193
- "that.\n"
201
+ "snapshot, a few hundred tokens on a young project and a few thousand "
202
+ "on an aged one; re-scanning the project to answer the same question "
203
+ "usually costs several times that.\n"
194
204
  "\n"
195
205
  "SESSION START — call these three tools, in this order, BEFORE\n"
196
206
  "answering ANY question about this project:\n"
@@ -267,8 +277,8 @@ def get_summary(project: ProjectArg = None) -> str:
267
277
  Do NOT answer from conversation history alone.
268
278
  Do NOT re-scan source files (package.json, README, src/) to understand
269
279
  the project — `summary.md` is the distilled authoritative source and
270
- stays bounded as the project ages (typically a few hundred to ~1,500
271
- tokens), far less than re-deriving it.
280
+ stays bounded as the project ages (a few hundred tokens on a young
281
+ project, a few thousand on an aged one), far less than re-deriving it.
272
282
 
273
283
  Your prior assumptions about this project may be stale. Call this
274
284
  cheaply at session start (and again before ending) to verify your
@@ -374,9 +384,15 @@ def get_issue(
374
384
  summary. Example: get_issue('0042').
375
385
 
376
386
  Read-only."""
377
- from projectmem.storage import issues_dir
387
+ from projectmem.storage import issues_dir, normalize_issue_id
378
388
  idir = issues_dir(_root_for(project))
379
- matches = list(idir.glob(f"{issue_id}-*.md"))
389
+ # Same normalization as record_fix: "1", "001" and "#1" all mean 0001.
390
+ # Only ID-shaped input reaches the glob ("0001", backfill's "legacy_f436"),
391
+ # so "*" or "?" can't match some other issue.
392
+ wanted = normalize_issue_id(issue_id) or ""
393
+ if not re.fullmatch(r"[\w-]+", wanted):
394
+ return f"No issue found with ID {issue_id}."
395
+ matches = list(idir.glob(f"{wanted}-*.md"))
380
396
  if not matches:
381
397
  return f"No issue found with ID {issue_id}."
382
398
  return matches[0].read_text(encoding="utf-8")
@@ -541,8 +557,8 @@ def get_global_gotchas(
541
557
  def log_issue(
542
558
  summary: Annotated[str, Field(
543
559
  description="One-line description of the bug or unexpected "
544
- "behavior (~140 chars recommended). Becomes the "
545
- "issue title and is matched by search_events."
560
+ "behavior. Becomes the issue title and is matched by "
561
+ "search_events." + _TITLE_LENGTH
546
562
  )],
547
563
  location: Annotated[Optional[str], Field(
548
564
  description="Optional file path or component where the issue "
@@ -572,7 +588,9 @@ def log_issue(
572
588
  def record_attempt(
573
589
  summary: Annotated[str, Field(
574
590
  description="One-line description of what you tried (e.g., "
575
- "'tried contain: layout — preview still jumps')."
591
+ "'tried contain: layout — preview still jumps'). Put "
592
+ "further evidence into another attempt, not this one."
593
+ + _RECORD_LENGTH
576
594
  )],
577
595
  outcome: Annotated[str, Field(
578
596
  description="Result of the attempt. Must be exactly one of "
@@ -628,6 +646,7 @@ def record_fix(
628
646
  description=(
629
647
  "One-line description of the confirmed fix "
630
648
  "(e.g., 'guarded submit handler with isSubmitting ref')."
649
+ + _FIX_LENGTH
631
650
  )
632
651
  ),
633
652
  ],
@@ -672,6 +691,7 @@ def add_decision(
672
691
  "product decision (e.g., 'use bcrypt rounds=12 for "
673
692
  "password hashing'). Becomes part of the project's "
674
693
  "permanent record — write it for a future contributor."
694
+ + _RECORD_LENGTH
675
695
  )],
676
696
  location: Annotated[Optional[str], Field(
677
697
  description="Optional file path or scope where the decision "
@@ -717,7 +737,7 @@ def add_note(
717
737
  "or context worth preserving. Prefix with 'gotcha:' "
718
738
  "or 'lesson:' to enable cross-project promotion — "
719
739
  "e.g., 'gotcha: bcrypt v4 silently truncates "
720
- "passwords longer than 72 bytes'."
740
+ "passwords longer than 72 bytes'." + _RECORD_LENGTH
721
741
  )],
722
742
  location: Annotated[Optional[str], Field(
723
743
  description="Optional file path or library this note applies to "