pmem-ai 0.6.3 → 0.7.0

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 (67) hide show
  1. package/CHANGELOG.md +44 -0
  2. package/README.md +56 -1
  3. package/dist/commands/ask.d.ts.map +1 -1
  4. package/dist/commands/ask.js +5 -1
  5. package/dist/commands/ask.js.map +1 -1
  6. package/dist/commands/distill.d.ts.map +1 -1
  7. package/dist/commands/distill.js +15 -6
  8. package/dist/commands/distill.js.map +1 -1
  9. package/dist/commands/doctor.d.ts.map +1 -1
  10. package/dist/commands/doctor.js +21 -8
  11. package/dist/commands/doctor.js.map +1 -1
  12. package/dist/commands/graph.d.ts.map +1 -1
  13. package/dist/commands/graph.js +7 -2
  14. package/dist/commands/graph.js.map +1 -1
  15. package/dist/commands/init.d.ts +13 -0
  16. package/dist/commands/init.d.ts.map +1 -1
  17. package/dist/commands/init.js +142 -32
  18. package/dist/commands/init.js.map +1 -1
  19. package/dist/commands/integration.d.ts.map +1 -1
  20. package/dist/commands/integration.js +170 -15
  21. package/dist/commands/integration.js.map +1 -1
  22. package/dist/commands/new.d.ts.map +1 -1
  23. package/dist/commands/new.js +15 -14
  24. package/dist/commands/new.js.map +1 -1
  25. package/dist/commands/rebuild.d.ts.map +1 -1
  26. package/dist/commands/rebuild.js +82 -13
  27. package/dist/commands/rebuild.js.map +1 -1
  28. package/dist/commands/recall.d.ts.map +1 -1
  29. package/dist/commands/recall.js +11 -5
  30. package/dist/commands/recall.js.map +1 -1
  31. package/dist/commands/rename.d.ts.map +1 -1
  32. package/dist/commands/rename.js +98 -19
  33. package/dist/commands/rename.js.map +1 -1
  34. package/dist/commands/status.d.ts.map +1 -1
  35. package/dist/commands/status.js +31 -6
  36. package/dist/commands/status.js.map +1 -1
  37. package/dist/commands/verify.d.ts.map +1 -1
  38. package/dist/commands/verify.js +5 -3
  39. package/dist/commands/verify.js.map +1 -1
  40. package/dist/core/discover/index.d.ts.map +1 -1
  41. package/dist/core/discover/index.js +15 -0
  42. package/dist/core/discover/index.js.map +1 -1
  43. package/dist/core/fs.d.ts +7 -0
  44. package/dist/core/fs.d.ts.map +1 -1
  45. package/dist/core/fs.js +57 -1
  46. package/dist/core/fs.js.map +1 -1
  47. package/dist/core/manifest.d.ts +23 -1
  48. package/dist/core/manifest.d.ts.map +1 -1
  49. package/dist/core/manifest.js +72 -0
  50. package/dist/core/manifest.js.map +1 -1
  51. package/dist/index.js +3 -1
  52. package/dist/index.js.map +1 -1
  53. package/dist/types.d.ts +32 -1
  54. package/dist/types.d.ts.map +1 -1
  55. package/docs/handover-v0.6.4.md +285 -0
  56. package/docs/project-roadmap.md +129 -4
  57. package/docs/release-checklist-v0.7.0.md +60 -0
  58. package/docs/session-start-create-design-eval.md +203 -0
  59. package/docs/usage.md +38 -0
  60. package/docs/v0.6.4 pre-design.md +526 -0
  61. package/docs/v0.7.0 pre-design.md +405 -0
  62. package/package.json +6 -3
  63. package/skills/pmem/SKILL.md +55 -7
  64. package/skills/pmem/references/first-init.md +21 -0
  65. package/skills/pmem/references/memory-cards.md +44 -1
  66. package/skills/pmem/references/session-workflow.md +3 -3
  67. package/skills/pmem/references/universal-domains.md +66 -0
@@ -0,0 +1,203 @@
1
+ # v0.6.4 polish 4 — `pmem session start --create-if-missing` Design Evaluation
2
+
3
+ > **Scope:** Design evaluation only. **No code changes** are proposed in this document.
4
+ > Author: Sub-agent 1 (polish 4) | Date: 2026-06-02
5
+ > Source: `docs/v0.6.4 pre-design.md` §6.1 (task 4)
6
+ > Coordination note: This file is **independent** of `docs/handover-v0.6.4.md` to avoid concurrent-write conflicts with the sub-agent writing that handover file.
7
+
8
+ ---
9
+
10
+ ## 1. Question
11
+
12
+ Should `pmem session start` accept a `--create-if-missing` option that auto-creates a
13
+ minimal `.pmem/` skeleton when the user runs the command in a directory that has no
14
+ `.pmem/` yet?
15
+
16
+ Pre-design framing (`docs/v0.6.4 pre-design.md` §6.1):
17
+
18
+ > 加 `--create-if-missing` option 的风险面:自动创建可能掩盖"用户在错目录跑 pmem"的问题
19
+
20
+ ---
21
+
22
+ ## 2. Current behavior (baseline)
23
+
24
+ `src/commands/session.ts:7-14` (verified in this polish):
25
+
26
+ ```typescript
27
+ export function sessionStartCommand(agentName?: string): void {
28
+ const pmemPath = path.join(process.cwd(), PMEM_DIR);
29
+ if (!fileExists(pmemPath)) {
30
+ console.log('No .pmem directory found. Run `pmem init` first.');
31
+ return;
32
+ }
33
+ ...
34
+ }
35
+ ```
36
+
37
+ Reproduced E2E in `temp/polish-4-6-7-test/session-pmem/`:
38
+
39
+ ```bash
40
+ $ cd temp/polish-4-6-7-test/session-pmem # no .pmem/
41
+ $ pmem session start -a "TestAgent"
42
+ No .pmem directory found. Run `pmem init` first.
43
+ ```
44
+
45
+ Behavior is currently: **silent early-return with a one-line hint**, exit code 0.
46
+ There is no `pmem.db` check, no `manifest.yml` check, no error — the user gets a
47
+ calm "go init first" message.
48
+
49
+ ---
50
+
51
+ ## 3. Risk surface
52
+
53
+ If we add `--create-if-missing`, the following scenarios change behavior:
54
+
55
+ ### 3.1 Wrong-directory masking (highest risk)
56
+
57
+ A user `cd`s into the wrong project root, runs `pmem session start --create-if-missing`,
58
+ and ends up with a brand-new `.pmem/` in a directory that was never their project.
59
+ They then run `pmem ask ...` and get fresh-empty results, which they misinterpret
60
+ as "the project really has no memory yet" — when actually they just polluted
61
+ `/tmp/whatever/` with a fresh memory store.
62
+
63
+ Probability: medium. Cost: medium (user confusion, possible unintended writes to
64
+ a directory they didn't intend to track).
65
+
66
+ ### 3.2 Empty-memory false confidence (medium risk)
67
+
68
+ A freshly auto-created `.pmem/` has zero cards. The user runs `pmem status` and
69
+ sees "ok" everywhere (since the schema is created, manifest is valid, no dirty
70
+ flags, no cards), interprets the green dashboard as "nothing to do" and walks
71
+ away from the real project that they meant to be in.
72
+
73
+ Probability: low. Cost: medium.
74
+
75
+ ### 3.3 Lost init guidance (low risk)
76
+
77
+ The current `pmem init` flow has hooks for `--guided`, `--answers`, integration
78
+ installation, and stack detection. If `session start` short-circuits init, the
79
+ user never sees any of that. They get a session ID but no memory cards, no
80
+ `index.md`, no `AGENTS.md`, no integration template.
81
+
82
+ Probability: high. Cost: low (recoverable — they can run `pmem init` later, but
83
+ their session ID is now associated with an empty store).
84
+
85
+ ### 3.4 Conflict with v0.6 track's "confirmation-first" principle
86
+
87
+ The pre-design §三 (P2 §v0.6 设计原则) is explicit:
88
+
89
+ > 5. Agent workflow is confirmation-first: detect, suggest, confirm/apply, rebuild, verify.
90
+
91
+ Auto-creating a `.pmem/` on session start is the opposite of confirmation-first —
92
+ it commits the user to a memory store before they confirmed the project shape.
93
+ This isn't catastrophic, but it's a tone mismatch with the rest of the v0.6 design.
94
+
95
+ ### 3.5 Interplay with v0.6.2 exit code changes
96
+
97
+ After v0.6.2, agents parse `--format json` to determine next steps. A new
98
+ `--create-if-missing` flag would have to be reflected in JSON output (`session
99
+ start` currently doesn't have JSON output, only text). Adding a flag without
100
+ planning its machine-readable representation risks re-introducing the friction
101
+ that v0.6.2 just removed.
102
+
103
+ ---
104
+
105
+ ## 4. Survey of comparable agent tools
106
+
107
+ (For the record; the live web search was not reachable from this environment,
108
+ so this is based on knowledge of how these tools behave at v0.6 design time.)
109
+
110
+ | Tool | Auto-creates root config dir? | Auto-creates project memory? | Behavior on missing |
111
+ |------|-------------------------------|------------------------------|---------------------|
112
+ | Claude Code | Yes — `.claude/` per repo | **No** — `CLAUDE.md` is user-initiated | Suggests `claude init` / first-run dialog |
113
+ | Cursor | Yes — `.cursor/` per workspace | **No** — `.cursor/rules/*.mdc` are user-initiated | Shows "no rules" indicator; does not auto-create |
114
+ | Codex CLI | Yes — `.codex/` per project | **No** — `AGENTS.md` is user-initiated | Suggests `codex init` / writes a stub on first prompt only if user explicitly opts in |
115
+
116
+ **Pattern across all three:** root config dirs are auto-created silently (cheap
117
+ infrastructure), but **project-memory artifacts are user-initiated**. None of
118
+ these tools auto-magically creates a project memory on first session start.
119
+
120
+ pmem's situation is closer to "project memory" than "root config" — the
121
+ `.pmem/` is the actual source of truth for the project, not just a settings
122
+ folder. So the analogy is: `pmem session start --create-if-missing` would be
123
+ asking the tool to do something none of Claude Code, Cursor, or Codex does.
124
+
125
+ ---
126
+
127
+ ## 5. Recommendation
128
+
129
+ **Defer (do not implement in v0.6.4). Re-evaluate in v0.7.0+ as part of the
130
+ "agent-native cold-start" track.**
131
+
132
+ Reasons:
133
+
134
+ 1. **Risk profile outweighs benefit.** The main beneficiary of `--create-if-missing`
135
+ is the "user forgot to init" case, which is recoverable in ~5 seconds
136
+ (`pmem init` then `pmem session start` again). The cost of accidentally
137
+ creating a memory store in the wrong directory is much higher.
138
+
139
+ 2. **No comparable tool does this.** The three agent CLIs pmem cares most about
140
+ (Claude Code, Cursor, Codex) all require explicit initialization for
141
+ project-memory artifacts. Adopting auto-create would be a divergence from
142
+ the ecosystem without a clear user-experience win.
143
+
144
+ 3. **Tone mismatch with v0.6 track.** v0.6 is confirmation-first; auto-create
145
+ on session start is the opposite.
146
+
147
+ 4. **Better solution already exists.** `pmem doctor` already detects "no
148
+ `.pmem/`" with a clear `fix: Run: pmem init <project-name>` message. The
149
+ current `pmem session start` message is also clear. The friction is
150
+ real but it's 5 seconds, not blocking.
151
+
152
+ 5. **v0.7.0 is the right home.** v0.7.0's "Universal Agent Memory" track will
153
+ redesign cold-start, including potentially auto-bootstrap from project
154
+ markers (e.g., detect a `package.json` and offer to init). At that point
155
+ we can do `--create-if-missing` properly with confirmation prompts,
156
+ wizard, and stack detection — none of which fit in a v0.6.4 polish slot.
157
+
158
+ ### What I would change in v0.6.4 (zero-risk improvement, no auto-create)
159
+
160
+ While evaluating this, I noticed `pmem session start` on a missing `.pmem/`
161
+ prints a single line: `No .pmem directory found. Run `pmem init` first.`
162
+
163
+ A **zero-risk** improvement that aligns with the polish 6/7 tone improvements
164
+ would be to expand that one-liner into a 3-line hint that mentions the
165
+ agent-native flags and a sample `pmem init` invocation. That is **not**
166
+ `--create-if-missing`; it's just richer help text. I will leave this as a
167
+ candidate for v0.6.5 if anyone wants to bundle it with the other session-text
168
+ polish, but I am not implementing it in this polish (polish 4 is design-only
169
+ per pre-design §6.1).
170
+
171
+ ### What I would change in v0.7.0 (if/when we revisit)
172
+
173
+ - Add `--create-if-missing` with an **explicit confirmation prompt** unless
174
+ `--yes` is passed.
175
+ - When auto-creating, run the same skeleton that `pmem init --minimal` would
176
+ produce (no guided wizard, no integration install — just the bare structure).
177
+ - Print a banner: `Auto-created .pmem/ in /this/dir. Use `pmem init --guided`
178
+ to enrich with project context, or remove .pmem/ if this was a mistake.`
179
+ - Add a guard: refuse to create `.pmem/` if the current directory is
180
+ `$HOME`, `/`, `/tmp`, or any parent of those — to prevent catastrophic
181
+ auto-creation at the filesystem root.
182
+
183
+ ---
184
+
185
+ ## 6. Summary (1 sentence)
186
+
187
+ **Defer `--create-if-missing` to v0.7.0+; the friction it removes is 5 seconds
188
+ of `pmem init`, but the wrong-directory masking risk is non-trivial and no
189
+ comparable agent tool (Claude Code / Cursor / Codex) auto-creates project
190
+ memory on first session.**
191
+
192
+ ---
193
+
194
+ ## 7. Coordination note
195
+
196
+ This document is intentionally written to `docs/session-start-create-design-eval.md`
197
+ (separate file) instead of `docs/handover-v0.6.4.md` to avoid concurrent-write
198
+ conflicts with the sub-agent writing that handover. The main agent should
199
+ either:
200
+ - Link this file from the handover under a "polish 4 evaluation" section, or
201
+ - Inline §5 and §6 of this file into the handover's session-start section.
202
+
203
+ Either way, the source of truth for the design evaluation lives here.
package/docs/usage.md CHANGED
@@ -44,6 +44,13 @@ This creates a `.pmem/` directory with:
44
44
 
45
45
  `pmem init --guided` lets you answer 3 questions interactively to populate the project info.
46
46
 
47
+ By default, `pmem init` uses the `software` preset. You can initialize with a different domain preset using the `--domain` flag:
48
+
49
+ ```bash
50
+ pmem init your-novel --domain novel
51
+ ```
52
+ Available presets: `software` (default), `novel`, and `research`. Specifying a preset initializes folders corresponding to the domain and registers preset schemas inside the manifest.
53
+
47
54
  ## 3. Create Your First Memory Card
48
55
 
49
56
  A memory card is a Markdown file with YAML frontmatter. The most important type is `module` — it connects source files to memory:
@@ -366,6 +373,37 @@ mv .pmem/pmem.db .pmem/pmem.db.bak
366
373
  pmem rebuild --full
367
374
  ```
368
375
 
376
+ ## 12. Universal Preset Domains and Custom Schemas
377
+
378
+ Starting with v0.7.0, `pmem` is domain-neutral, supporting custom card types, custom directories, and domain-specific behaviors.
379
+
380
+ ### Domain Presets
381
+ You can set a preset when initializing:
382
+ - `pmem init --domain software` (default): Configures `modules/`, `features/`, `decisions/`, `tasks/`, `risks/`, `traces/`.
383
+ - `pmem init --domain novel`: Configures `characters/`, `chapters/`, `world/`, `arc/`, `decisions/`, `traces/`. Automatically disables autodiscovery to prevent scanning noise in creative directories.
384
+ - `pmem init --domain research`: Configures `sources/`, `claims/`, `notes/`, `experiments/`, `decisions/`, `traces/`. Automatically disables autodiscovery.
385
+
386
+ ### Customizing Schema & Discovery in `manifest.yml`
387
+ You can customize card validation and structure directly in your `.pmem/manifest.yml` file under the `schema` key:
388
+ - `schema.card_types`: List of all valid card types allowed in the project.
389
+ - `schema.type_dirs`: Map of card types to directory paths (e.g., `chapter: chapters`).
390
+ - `schema.creatable_types`: Types that `pmem new` can instantiate.
391
+ - `schema.foundational_types`: Core types returned as foundational cards during recall.
392
+ - `schema.evidence_types`: Card types representing evidence (used for `pmem ask` and graph tracing).
393
+ - `schema.default_type`: Fallback type when none is specified.
394
+
395
+ To toggle relationship autodiscovery, configure `discover.enabled`:
396
+ ```yaml
397
+ discover:
398
+ enabled: false
399
+ ```
400
+
401
+ ### Recall Output (`active_foundation`)
402
+ In `pmem recall --format json`, the field `active_foundation` returns foundational cards based on `schema.foundational_types`. For legacy compatibility, the `active_modules` field is also populated with the same list of cards.
403
+
404
+ ### Zero-Migration Compatibility
405
+ v0.6.x legacy projects do not need any migration or changes. If a project does not contain a `schema` block in its manifest, `pmem` will automatically fallback to the legacy `software` defaults without modifying or rewriting the manifest file.
406
+
369
407
  ## Next Steps
370
408
 
371
409
  - Read the [README](../README.md) for the full CLI reference